diff --git a/NEWS.md b/NEWS.md index a4fea9384..3febe2b7e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,8 @@ - Rework the `tad()` and related functions so they use the same interface as compartments (this way they do not depend on the order - of compartments); See #815 + of compartments); See #815. Also allow dummy variables to ignore + state requirements (for parsing mu-referenced equations). - Add `getRxNpars` to api. This allows the development version of `babelmixr2` to better check what model is loaded and unload/reload diff --git a/src/genModelVars.h b/src/genModelVars.h index df76543fe..60efbbc4f 100644 --- a/src/genModelVars.h +++ b/src/genModelVars.h @@ -200,7 +200,7 @@ static inline SEXP calcIniVals(void) { SEXP orderForderS1(SEXP ordIn); static inline int sortStateVectorsErrHandle(int prop, int pass, int i) { - if (prop == 0 || pass == 1) { + if (prop == 0 || pass == 1 || tb.dummyLhs == 1) { return 1; } char *buf = NULL; diff --git a/src/parseCmtProperties.h b/src/parseCmtProperties.h index d333c043b..7bb3b4549 100644 --- a/src/parseCmtProperties.h +++ b/src/parseCmtProperties.h @@ -183,6 +183,9 @@ static inline int handleRemainingAssignmentsCalcPropComplexAssign(nodeInfo ni, c // New assignment tb.ixL = tb.ix; tb.lh[tb.ix] = isLHS; + if (!strcmp(v, "rxdummyLhs")) { + tb.dummyLhs = 1; + } } else if (tb.ix < 0){ if (!strcmp("rxlin___", v)) { tb.ixL=-1; @@ -216,6 +219,9 @@ static inline int handleRemainingAssignmentsCalcPropComplexAssign(nodeInfo ni, c tb.lh[tb.ix] = isLHSparam; } else { tb.lh[tb.ix] = isLHS; + if (!strcmp(v, "rxdummyLhs")) { + tb.dummyLhs = 1; + } } tb.ixL=-1; } @@ -299,6 +305,9 @@ static inline int handleRemainingAssignmentsCalcPropIni(nodeInfo ni, char *name, /* Rprintf("Duplicate %s; %d %d\n", v, tb.lh[tb.ix], tb.ini0[tb.ix]); */ if (tb.lh[tb.ix] != isLHS){ tb.lh[tb.ix] = isLHS; + if (!strcmp(v, "rxdummyLhs")) { + tb.dummyLhs = 1; + } if (nodeHas(ini0) && tb.ini0[tb.ix] == 1){ sPrint(&_gbuf,"cannot have conditional initial conditions for '%s'",v); updateSyntaxCol(); diff --git a/src/tran.c b/src/tran.c index a79055839..641d33115 100644 --- a/src/tran.c +++ b/src/tran.c @@ -422,6 +422,7 @@ void reset(void) { tb.linExtra = false; tb.nwhile = 0; tb.lvlStr = 0; + tb.dummyLhs = 0; tb.nInd = 0; tb.simflg = 0; tb.nLlik = 0; diff --git a/src/tran.h b/src/tran.h index 743886344..38819f336 100644 --- a/src/tran.h +++ b/src/tran.h @@ -107,6 +107,7 @@ lhs symbols? int lastDdt; int nLlik; int lvlStr; + int dummyLhs; } symtab; extern symtab tb;