diff --git a/src/include/cktdefs.h b/src/include/cktdefs.h index bdec508b4..30554cc52 100644 --- a/src/include/cktdefs.h +++ b/src/include/cktdefs.h @@ -49,7 +49,23 @@ typedef struct sCKTnode { typedef struct { - GENmodel *CKThead[MAXNUMDEVS]; /* The max number of loadable devices */ + + +/* gtri - begin - wbk - change declaration to allow dynamic sizing */ + +/* An associated change is made in CKTinit.c to alloc the space */ +/* required for the pointers. No changes are needed to the source */ +/* code at the 3C1 level, although the compiler will generate */ +/* slightly different code for references to this data. */ + +/* GENmodel *CKThead[MAXNUMDEVS]; The max number of loadable devices */ + GENmodel **CKThead; + +/* gtri - end - wbk - change declaration to allow dynamic sizing */ + +/* GENmodel *CKThead[MAXNUMDEVS]; maschmann : deleted */ + + STATistics *CKTstat; /* The STATistics structure */ double *(CKTstates[8]); /* Used as memory of past steps ??? */ diff --git a/src/spicelib/devices/cktinit.c b/src/spicelib/devices/cktinit.c index 3590fb2b2..cb29e0b65 100644 --- a/src/spicelib/devices/cktinit.c +++ b/src/spicelib/devices/cktinit.c @@ -22,6 +22,16 @@ CKTinit(void **ckt) /* new circuit to create */ sckt = (CKTcircuit *)(*ckt); if (sckt == NULL) return(E_NOMEM); + +/* gtri - begin - dynamically allocate the array of model lists */ +/* CKThead used to be statically sized in CKTdefs.h, but has been changed */ +/* to a ** pointer */ + (sckt)->CKThead = (GENmodel **)MALLOC(DEVmaxnum * sizeof(GENmodel *)); + if((sckt)->CKThead == NULL) return(E_NOMEM); +/* gtri - end - dynamically allocate the array of model lists */ + + + for (i = 0; i < DEVmaxnum; i++) sckt->CKThead[i] = (GENmodel *) NULL;