diff --git a/R/Aaaa.R b/R/Aaaa.R index 40d61b16..d0c05268 100644 --- a/R/Aaaa.R +++ b/R/Aaaa.R @@ -82,8 +82,7 @@ block_list <- c("ENV", "PROB", "PARAM", "INIT", "PREAMBLE", "PRED", "BLOCK", "TRANSIT", "YAML", "NMEXT", "INPUT") -block_list_single <- c("MAIN", "SET", "GLOBAL", "PREAMBLE", "PRED", "TABLE", - "ODE", "PKMODEL", "PLUGIN") +block_list_single <- c("MAIN", "SET", "GLOBAL", "PREAMBLE", "PRED", "PKMODEL") Reserved_cvar <- c("SOLVERTIME","table","ETA","EPS", "AMT", "CMT", "ID", "TIME", "EVID","simeps", "self", "simeta", diff --git a/R/modspec.R b/R/modspec.R index 4aa1eb5a..91f0942a 100644 --- a/R/modspec.R +++ b/R/modspec.R @@ -157,15 +157,16 @@ check_sim_eta_eps_n <- function(x, spec) { } check_spec_contents <- function(x, crump = TRUE, warn = TRUE, ...) { - invalid <- setdiff(x, block_list) - valid <- intersect(x, block_list) - - check_duplicated <- intersect(block_list_single, x) + # Check for valid and invalid blocks + invalid <- base::setdiff(x, block_list) + valid <- base::intersect(x, block_list) + # Check for block duplicates where we only allow single + check_duplicated <- base::intersect(x, block_list_single) dups <- c() - for(bl in check_duplicated) { - if(sum(bl == x) > 1) { - dups <- c(dups, bl) + for(block in check_duplicated) { + if(sum(block == x) > 1) { + dups <- c(dups, block) } } if(length(dups)) { diff --git a/R/mread.R b/R/mread.R index ac072ac4..db6db213 100644 --- a/R/mread.R +++ b/R/mread.R @@ -283,7 +283,12 @@ mread <- function(model, project = getOption("mrgsolve.project", getwd()), # Collect potential multiples subr <- collect_subr(spec) table <- unlist(spec[names(spec)=="TABLE"], use.names = FALSE) - spec[["ODE"]] <- unlist(spec[names(spec)=="ODE"], use.names = FALSE) + if("ODE" %in% names(spec)) { + spec[["ODE"]] <- unlist(spec[names(spec)=="ODE"], use.names = FALSE) + } + if("PLUGIN" %in% names(spec)) { + spec[["PLUGIN"]] <- unlist(spec[names(spec)=="PLUGIN"], use.names = FALSE) + } # TODO: deprecate audit argument mread.env[["audit_dadt"]] <- @@ -431,7 +436,7 @@ mread <- function(model, project = getOption("mrgsolve.project", getwd()), x <- update_capture(x, .ren.chr(capture_vars)) build$preclean <- TRUE } - + # Check mod ---- check_pkmodel(x, subr, spec) check_globals(mread.env[["move_global"]], Cmt(x)) @@ -555,7 +560,7 @@ mread <- function(model, project = getOption("mrgsolve.project", getwd()), from = temp_write, to = build[["compfile"]] ) - + if(!compile) return(x) if(ignore.stdout & !quiet) {