From dcd96634f7f088d4631beda9ab535a841a49570e Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 7 Jan 2018 17:39:18 +0100 Subject: [PATCH] devices/**/*defs*.h, fix adms too --- .../devices/adms/admst/ngspiceMODULEacld.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEdefs.h.xml | 11 ++++++----- .../devices/adms/admst/ngspiceMODULEdest.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEload.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEnoise.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEpzld.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEsetup.c.xml | 8 ++++---- .../devices/adms/admst/ngspiceMODULEtemp.c.xml | 4 ++-- .../devices/adms/admst/ngspiceMODULEtrunc.c.xml | 4 ++-- 9 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEacld.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEacld.c.xml index 4afc72b93..34c33f4d4 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEacld.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEacld.c.xml @@ -51,10 +51,10 @@ int $(module)acLoad(GENmodel *inModel, CKTcircuit *ckt) { register $(module)model *model = ($(module)model*)inModel; register $(module)instance *here; - for ( ; model != NULL; model = model->$(module)nextModel ) + for ( ; model != NULL; model = $(module)nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->$(module)instances; here != NULL ; here = here->$(module)nextInstance) + for (here = $(module)instances(model); here != NULL ; here = here->$(module)nextInstance) { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEdefs.h.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEdefs.h.xml index 47c12af49..5d0ffaa41 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEdefs.h.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEdefs.h.xml @@ -265,12 +265,12 @@ typedef struct s$(module)instance { /* per model data */ typedef struct s$(module)model { /* model structure */ - int $(module)modType; /* type index of this device type */ - struct s$(module)model *$(module)nextModel; /* pointer to next possible model in linked list */ - $(module)instance * $(module)instances; /* pointer to list of instances that have this model */ - IFuid $(module)modName; /* pointer to the name of this model */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#define $(module)modType gen.GENmodType +#define $(module)nextModel(inst) ((struct $(module)model*)((inst)->gen.GENnextModel)) +#define $(module)instances(inst) ((struct $(module)instance*)((inst)->gen.GENinstances)) +#define $(module)modName gen.GENmodName /* model parameters */ @@ -298,6 +298,7 @@ typedef struct s$(module)model { /* model structure */ } $(module)model; + diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEdest.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEdest.c.xml index 341560499..f1a4fe69c 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEdest.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEdest.c.xml @@ -54,11 +54,11 @@ void $(module)destroy(GENmodel **inModel) $(module)model *mod = *model; $(module)model *oldmod = NULL; - for ( ; mod ; mod = mod->$(module)nextModel ) { + for ( ; mod ; mod = $(module)nextModel(mod) ) { if (oldmod) FREE(oldmod); oldmod = mod; prev = ($(module)instance *)NULL; - for (here = mod->$(module)instances; here ; here = here->$(module)nextInstance) { + for (here = $(module)instances(mod); here ; here = here->$(module)nextInstance) { if(prev) FREE(prev); prev = here; } diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEload.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEload.c.xml index 34661a2c6..881ccb69f 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEload.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEload.c.xml @@ -194,10 +194,10 @@ int $(module)load(GENmodel *inModel, CKTcircuit *ckt) ((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC))) ? 1 : 0; - for ( ; model != NULL; model = model->$(module)nextModel ) + for ( ; model != NULL; model = $(module)nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->$(module)instances; here != NULL ; here = here->$(module)nextInstance) + for (here = $(module)instances(model); here != NULL ; here = here->$(module)nextInstance) { { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEnoise.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEnoise.c.xml index a2c809d64..9954e3aae 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEnoise.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEnoise.c.xml @@ -48,9 +48,9 @@ $(module)noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Nd $(module)model *firstModel = ($(module)model *) genmodel; $(module)model *model; $(module)instance *inst; - for (model=firstModel; model != NULL; model=model->$(module)nextModel) + for (model=firstModel; model != NULL; model=$(module)nextModel(model)) { - for (inst=model->$(module)instances; inst != NULL; inst=inst->$(module)nextInstance) + for (inst=$(module)instances(model); inst != NULL; inst=inst->$(module)nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEpzld.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEpzld.c.xml index 3242bb6fa..9c41b7e3d 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEpzld.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEpzld.c.xml @@ -53,10 +53,10 @@ int $(module)pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) register $(module)model *model = ($(module)model*)inModel; register $(module)instance *here; NG_IGNOREABLE(ckt); - for ( ; model != NULL; model = model->$(module)nextModel ) + for ( ; model != NULL; model = $(module)nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->$(module)instances; here != NULL ; here = here->$(module)nextInstance) + for (here = $(module)instances(model); here != NULL ; here = here->$(module)nextInstance) { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml index 1dca4ada5..574483ad9 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEsetup.c.xml @@ -59,7 +59,7 @@ int $(module)setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int * register $(module)instance *here; /* loop through all the $(module) device models */ - for ( ;model != NULL ;model = model->$(module)nextModel ) + for ( ;model != NULL ;model = $(module)nextModel(model) ) { @@ -79,7 +79,7 @@ int $(module)setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int * - for ( here = model->$(module)instances ;here != NULL ; here = here->$(module)nextInstance ) + for ( here = $(module)instances(model) ;here != NULL ; here = here->$(module)nextInstance ) { @@ -174,9 +174,9 @@ $(module)unsetup(GENmodel *inModel, CKTcircuit *ckt) $(module)instance *here; /* loop through all the $(module) device models */ - for ( ;model != NULL ;model = model->$(module)nextModel ) + for ( ;model != NULL ;model = $(module)nextModel(model) ) { - for ( here = model->$(module)instances ;here != NULL ; here = here->$(module)nextInstance ) + for ( here = $(module)instances(model) ;here != NULL ; here = here->$(module)nextInstance ) { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEtemp.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEtemp.c.xml index 8974b21bd..d14439a96 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEtemp.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEtemp.c.xml @@ -58,12 +58,12 @@ int $(module)temp(GENmodel *inModel, CKTcircuit *ckt) register $(module)model *model = ($(module)model*)inModel; register $(module)instance *here; NG_IGNOREABLE(ckt); - for ( ; model != NULL; model = model->$(module)nextModel ) + for ( ; model != NULL; model = $(module)nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->$(module)instances; here != NULL ; here = here->$(module)nextInstance) + for (here = $(module)instances(model); here != NULL ; here = here->$(module)nextInstance) { diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEtrunc.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEtrunc.c.xml index 5e3931d00..bdc122238 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEtrunc.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEtrunc.c.xml @@ -56,10 +56,10 @@ int $(module)trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double debugtemp; #endif /* STEPDEBUG */ - for ( ; model != NULL; model = model->$(module)nextModel ) + for ( ; model != NULL; model = $(module)nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->$(module)instances; here != NULL ; here = here->$(module)nextInstance) + for (here = $(module)instances(model); here != NULL ; here = here->$(module)nextInstance) { #ifdef STEPDEBUG debugtemp = *timeStep;