Specialize @dynare macro if one model is processed.
In this case importall is used instead of import.time-shift
parent
bcd39ef2f7
commit
c3b5aee714
|
@ -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
|
||||
|
|
|
@ -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)
|
|
@ -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)
|
|
@ -19,6 +19,5 @@ importall Dynare
|
|||
# @compile "rbc1.mod"
|
||||
# using rbc1
|
||||
|
||||
|
||||
print(rbc1.model.fname)
|
||||
print(rbc2.model.fname)
|
Loading…
Reference in New Issue