diff --git a/src/codegen.c b/src/codegen.c index e7da220d0..d59e3b275 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -676,8 +676,8 @@ SEXP _rxode2_codegen(SEXP c_file, SEXP prefix, SEXP libname, if (tb.hasKa == 1) { sAppend(&sbOut, "#define _DEPOT_ %d\n", tb.statei); sAppend(&sbOut, "#define _CENTRAL_ %d\n", tb.statei+1); - } else if (tb.hasCentral == 1) { - if (tb.hasDepot){ + } else if (tb.hasCentralCmt == 1) { + if (tb.hasDepotCmt){ fclose(fpIO); _rxode2parse_unprotect(); err_trans("linCmt() does not have 'depot' compartment without a 'ka'"); diff --git a/src/parseFunsDosing.h b/src/parseFunsDosing.h index 01b9700aa..2ad5cfbe8 100644 --- a/src/parseFunsDosing.h +++ b/src/parseFunsDosing.h @@ -57,12 +57,12 @@ static inline int handleFunctionTadSingleStateCcode(transFunctions *tf,char *v2) sAppend(&sb, "_%s1(", tf->v); sAppend(&sbDt, "_%s1(", tf->v); if (new_de(v2, 0)){ - if (!strcmp("depot", v2)) { - tb.hasDepot = 1; + if (tb.linCmt && !strcmp("depot", v2)) { + tb.hasDepotCmt = 1; aAppendN("_DEPOT_)", 8); return 1; - } else if (!strcmp("central", v2)) { - tb.hasCentral = 1; + } else if (tb.linCmt && !strcmp("central", v2)) { + tb.hasCentralCmt = 1; aAppendN("_CENTRAL_)", 10); return 1; } else { diff --git a/src/tran.c b/src/tran.c index abeef91e6..a79055839 100644 --- a/src/tran.c +++ b/src/tran.c @@ -405,8 +405,6 @@ void reset(void) { tb.maxtheta = 0; tb.hasCmt = 0; tb.maxeta = 0; - tb.hasDepot = 0; - tb.hasCentral = 0; tb.hasDepotCmt = 0; tb.hasCentralCmt = 0; tb.hasKa = 0; diff --git a/src/tran.h b/src/tran.h index f4f08775d..743886344 100644 --- a/src/tran.h +++ b/src/tran.h @@ -84,8 +84,6 @@ lhs symbols? int maxtheta; int hasCmt; int maxeta; - int hasDepot; - int hasCentral; int hasDepotCmt; int hasCentralCmt; int hasKa;