diff --git a/julia/Dynare.jl b/julia/Dynare.jl index 0e74023bf85432dc5adaa463589c6c1f3a771539..82efd64f2d672b17931f8b69fa72cdfeefa732bd 100644 --- a/julia/Dynare.jl +++ b/julia/Dynare.jl @@ -34,10 +34,16 @@ end macro dynare(modfiles...) ex = Expr(:toplevel) - for modfile in modfiles - eval(:(compile($modfile))) - basename = split(modfile, ".mod"; keep=false) - push!(ex.args, Expr(:import, symbol(basename[1]))) + if length(modfiles)>1 + for modfile in modfiles + eval(:(compile($modfile))) + basename = split(modfile, ".mod"; keep=false) + push!(ex.args, Expr(:import, symbol(basename[1]))) + end + else + eval(:(compile($modfiles))) + basename = split(modfiles[1], ".mod"; keep=false) + push!(ex.args, Expr(:importall, symbol(basename[1]))) end return ex end diff --git a/tests/julia/rbc/test1.jl b/tests/julia/rbc/test1.jl new file mode 100644 index 0000000000000000000000000000000000000000..57c64728687ebfe492bb43c722c3d04b30bbd7d5 --- /dev/null +++ b/tests/julia/rbc/test1.jl @@ -0,0 +1,16 @@ +#clear workspace +workspace() + +# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead. +if isempty(findin([abspath("../../../julia")], LOAD_PATH)) + unshift!(LOAD_PATH, abspath("../../../julia")) +end + +# Load Dynare package +importall Dynare + +# Compile the rbc.mod file -> produce a module with the model definition. + +@dynare "rbc1.mod" + +print(model.fname) diff --git a/tests/julia/rbc/test2.jl b/tests/julia/rbc/test2.jl new file mode 100644 index 0000000000000000000000000000000000000000..6941d81f26d3b91070ba67a1373c1b21585194c8 --- /dev/null +++ b/tests/julia/rbc/test2.jl @@ -0,0 +1,17 @@ +#clear workspace +workspace() + +# Modification of the path (for packages). Should be done in ~/.juliarc.jl with a fixed path instead. +if isempty(findin([abspath("../../../julia")], LOAD_PATH)) + unshift!(LOAD_PATH, abspath("../../../julia")) +end + +# Load Dynare package +importall Dynare + +# Compile the rbc.mod file -> produce a module with the model definition. + + +@dynare "rbc2.mod" + +print(model.fname) diff --git a/tests/julia/rbc/test.jl b/tests/julia/rbc/test3.jl similarity index 99% rename from tests/julia/rbc/test.jl rename to tests/julia/rbc/test3.jl index e0857b90e34ff3e53fc47d0021bdb41333e7bf71..fd02a5b46f18e47e76af110f38e64366ac3414e9 100644 --- a/tests/julia/rbc/test.jl +++ b/tests/julia/rbc/test3.jl @@ -19,6 +19,5 @@ importall Dynare # @compile "rbc1.mod" # using rbc1 - print(rbc1.model.fname) print(rbc2.model.fname)