Skip to content

Commit

Permalink
Add dummyLhs bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 2, 2024
1 parent 210388e commit 4c953c9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/genModelVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions src/parseCmtProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/tran.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/tran.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ lhs symbols?
int lastDdt;
int nLlik;
int lvlStr;
int dummyLhs;
} symtab;

extern symtab tb;
Expand Down

0 comments on commit 4c953c9

Please sign in to comment.