Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
droodman committed Apr 13, 2024
1 parent 2f508ab commit 8e36a39
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 370 deletions.
25 changes: 21 additions & 4 deletions _jl.ado
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@ cap program drop _jl
program define _jl, rclass
_on_colon_parse `0'
local qui = cond(substr(`"`s(after)'"', strlen(`"`s(after)'"'), 1) == ";", "qui", "")
plugin call _julia `=cond(c(k),"*","")', eval`qui' `"`s(after)'"'
foreach macro in `__jllocals' {
c_local `macro': copy local `macro'
cap noi plugin call _julia `=cond(c(k),"*","")', eval`qui' `"`s(after)'"'

if _rc {
local rc = _rc
local __jlans: subinstr local __jlans "`" "'", all
c_local ans: copy local __jlans
cap noi if `"`__jlans'"' != "nothing" {
if `rc' { // print error type in red
local t = strpos(`"`__jlans'"', ":")
di as err substr(`"`__jlans'"', 1, `t') _c
local __jlans = substr(`"`__jlans'"', `t'+1, .)
}
local t = strpos(`"`__jlans'"', char(10))
while `t' {
di as txt substr(`"`__jlans'"', 1, `t'-1)
local __jlans = substr(`"`__jlans'"', `t'+1, .)
local t = strpos(`"`__jlans'"', char(10))
}
di as txt `"`__jlans'"'
}
}
return local ans: copy local __jlans
end

program _julia, plugin using(jl.plugin)
program _julia, plugin using(jl.plugin)
14 changes: 7 additions & 7 deletions jl.ado
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,18 @@ program define jl, rclass
AddPkg DataFrames
AddPkg CategoricalArrays
}
plugin call _julia, eval `"splitpath(Base.active_project())[end-1]"'
local __jlans `__jlans' // strip quotes
return local env: subinstr local __jlans "\\" "\", all
plugin call _julia, eval `"dirname(Base.active_project())"'
local __jlans `__jlans' // strip quotes
return local envdir: subinstr local __jlans "\\" "\", all
plugin call _julia, eval `"dirname(Base.load_path_expand("@v#.#"))"'
di as txt `"Current package environment: `return(env)'`=cond("`return(envdir)'"=="`__jlans'"," (default)","")', at `return(envdir)'"'
}
else if `"`cmd'"'=="AddPkg" {
AddPkg `0'
if "`return(envdir)'" != `__jlans' {
plugin call _julia, eval `"splitpath(Base.active_project())[end-1]"'
return local env `__jlans' // strip quotes
}
di as txt `"Current package environment: `=cond("`return(env)'"=="","(default)","`return(env)'")', at `return(envdir)'"'
}
else if `"`cmd'"'=="AddPkg" AddPkg `0'
else if `"`cmd'"'=="use" {
syntax namelist [using/], [clear]
if c(changed) & "`clear'"=="" error 4
Expand Down Expand Up @@ -427,4 +427,4 @@ program _julia, plugin using(jl.plugin)
* 0.10.1 Fixed memory leak
* 0.10.2 threads() option on start
* 0.10.3 Bug fix for 0.10.2
* 1.0.0 Add GetEnv, support for closing ";", and interactive mode
* 1.0.0 Add GetEnv, support for closing ";", and interactive mode
Loading

0 comments on commit 8e36a39

Please sign in to comment.