diff --git a/src/include/ngspice/mifdefs.h b/src/include/ngspice/mifdefs.h index 87e62d2f1..6ac2b9372 100644 --- a/src/include/ngspice/mifdefs.h +++ b/src/include/ngspice/mifdefs.h @@ -51,10 +51,12 @@ NON-STANDARD FEATURES struct MIFinstance { - struct MIFmodel *MIFmodPtr; /* backpointer to model */ - struct MIFinstance *MIFnextInstance; /* pointer to next instance of current model */ - IFuid MIFname; /* pointer to character string naming this instance */ - int MIFstates; /* state info, unused */ + struct GENinstance gen; + +#define MIFmodPtr(inst) ((struct MIFmodel *)((inst)->gen.GENmodPtr)) +#define MIFnextInstance(inst) ((struct MIFinstance *)((inst)->gen.GENnextInstance)) +#define MIFname gen.GENname +#define MIFstates gen.GENstate int num_conn; /* number of connections on the code model */ Mif_Conn_Data_t **conn; /* array of data structures for each connection */ @@ -90,12 +92,12 @@ struct MIFinstance { struct MIFmodel { - int MIFmodType; /* type index of this device type */ - struct MIFmodel *MIFnextModel; /* pointer to next possible model in linked list */ - struct MIFinstance *MIFinstances; /* pointer to list of instances that have this model */ - IFuid MIFmodName; /* pointer to character string naming this model */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#define MIFmodType gen.GENmodType +#define MIFnextModel(inst) ((struct MIFmodel *)((inst)->gen.GENnextModel)) +#define MIFinstances(inst) ((struct MIFinstance *)((inst)->gen.GENinstances)) +#define MIFmodName gen.GENmodName int num_param; /* number of parameters on the code model */ Mif_Param_Data_t **param; /* array of structs for each parameter */ diff --git a/src/include/ngspice/numgen.h b/src/include/ngspice/numgen.h index c012a49fe..5a649f592 100644 --- a/src/include/ngspice/numgen.h +++ b/src/include/ngspice/numgen.h @@ -19,14 +19,14 @@ Authors: 1991 David Gates #include "ngspice/carddefs.h" typedef struct sGENnumModel { /* model structure for a numerical device */ - int GENmodType; /* type index of this device type */ - struct sGENnumModel *GENnextModel; /* pointer to next model in list */ - GENinstance *GENinstances; /* pointer to list of instances */ - IFuid GENmodName; /* pointer to string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define GENmodType gen.GENmodType +#define GENnextModel(inst) ((struct sGENnumModel *)((inst)->gen.GENnextModel)) +#define GENinstances(inst) ((GENinstance *)((inst)->gen.GENinstances)) +#define GENmodName gen.GENmodName -/* Everything below here is numerical-device-specific */ MESHcard *GENxMeshes; /* list of xmesh cards */ MESHcard *GENyMeshes; /* list of ymesh cards */ DOMNcard *GENdomains; /* list of domain cards */ diff --git a/src/spicelib/devices/asrc/asrcdefs.h b/src/spicelib/devices/asrc/asrcdefs.h index 921c23f7f..91d8f2fc2 100644 --- a/src/spicelib/devices/asrc/asrcdefs.h +++ b/src/spicelib/devices/asrc/asrcdefs.h @@ -18,11 +18,14 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sASRCinstance { - struct sASRCmodel *ASRCmodPtr; /* backpointer to model */ - struct sASRCinstance *ASRCnextInstance; /* pointer to next instance of - * current model */ - IFuid ASRCname; /* pointer to character string naming this instance */ - int ASRCstates; /* state info */ + + struct GENinstance gen; + +#define ASRCmodPtr(inst) ((struct sASRCmodel *)((inst)->gen.GENmodPtr)) +#define ASRCnextInstance(inst) ((struct sASRCinstance *)((inst)->gen.GENnextInstance)) +#define ASRCname gen.GENname +#define ASRCstates gen.GENstate + const int ASRCposNode; /* number of positive node of source */ const int ASRCnegNode; /* number of negative node of source */ @@ -56,14 +59,13 @@ typedef struct sASRCinstance { /* per model data */ typedef struct sASRCmodel { /* model structure for a source */ - int ASRCmodType; /* type index of this device */ - struct sASRCmodel *ASRCnextModel; /* pointer to next possible model - * in linked list */ - ASRCinstance *ASRCinstances; /* pointer to list of instances - * that have this model */ - IFuid ASRCmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define ASRCmodType gen.GENmodType +#define ASRCnextModel(inst) ((struct sASRCmodel *)((inst)->gen.GENnextModel)) +#define ASRCinstances(inst) ((ASRCinstance *)((inst)->gen.GENinstances)) +#define ASRCmodName gen.GENmodName } ASRCmodel; diff --git a/src/spicelib/devices/bjt/bjtdefs.h b/src/spicelib/devices/bjt/bjtdefs.h index 040a242c2..dab3ef915 100644 --- a/src/spicelib/devices/bjt/bjtdefs.h +++ b/src/spicelib/devices/bjt/bjtdefs.h @@ -17,11 +17,13 @@ Author: 1985 Thomas L. Quarles /* data needed to describe a single instance */ typedef struct sBJTinstance { - struct sBJTmodel *BJTmodPtr; /* backpointer to model */ - struct sBJTinstance *BJTnextInstance; /* pointer to next instance of - * current model*/ - IFuid BJTname; /* pointer to character string naming this instance */ - int BJTstate; /* pointer to start of state vector for bjt */ + + struct GENinstance gen; + +#define BJTmodPtr(inst) ((struct sBJTmodel *)((inst)->gen.GENmodPtr)) +#define BJTnextInstance(inst) ((struct sBJTinstance *)((inst)->gen.GENnextInstance)) +#define BJTname gen.GENname +#define BJTstate gen.GENstate const int BJTcolNode; /* number of collector node of bjt */ const int BJTbaseNode; /* number of base node of bjt */ @@ -323,14 +325,13 @@ typedef struct sBJTinstance { /* per model data */ typedef struct sBJTmodel { /* model structure for a bjt */ - int BJTmodType; /* type index of this device type */ - struct sBJTmodel *BJTnextModel; /* pointer to next possible model in - * linked list */ - BJTinstance * BJTinstances; /* pointer to list of instances - * that have this model */ - IFuid BJTmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BJTmodType gen.GENmodType +#define BJTnextModel(inst) ((struct sBJTmodel *)((inst)->gen.GENnextModel)) +#define BJTinstances(inst) ((BJTinstance *)((inst)->gen.GENinstances)) +#define BJTmodName gen.GENmodName int BJTtype; int BJTsubs; diff --git a/src/spicelib/devices/bsim1/bsim1def.h b/src/spicelib/devices/bsim1/bsim1def.h index 75540bbb3..34df9b3e6 100644 --- a/src/spicelib/devices/bsim1/bsim1def.h +++ b/src/spicelib/devices/bsim1/bsim1def.h @@ -20,11 +20,13 @@ Author: 1985 Hong June Park, Thomas L. Quarles /* information needed for each instance */ typedef struct sBSIM1instance { - struct sBSIM1model *B1modPtr; /* pointer to model */ - struct sBSIM1instance *B1nextInstance; /* pointer to next instance of - *current model*/ - IFuid B1name; /* pointer to character string naming this instance */ - int B1states; /* index into state table for this device */ + + struct GENinstance gen; + +#define B1modPtr(inst) ((struct sBSIM1model *)((inst)->gen.GENmodPtr)) +#define B1nextInstance(inst) ((struct sBSIM1instance *)((inst)->gen.GENnextInstance)) +#define B1name gen.GENname +#define B1states gen.GENstate const int B1dNode; /* number of the gate node of the mosfet */ const int B1gNode; /* number of the gate node of the mosfet */ @@ -315,14 +317,13 @@ typedef struct sBSIM1instance { /* per model data */ typedef struct sBSIM1model { /* model structure for a resistor */ - int B1modType; /* type index of this device type */ - struct sBSIM1model *B1nextModel; /* pointer to next possible model - *in linked list */ - B1instance * B1instances; /* pointer to list of instances - * that have this model */ - IFuid B1modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B1modType gen.GENmodType +#define B1nextModel(inst) ((struct sBSIM1model *)((inst)->gen.GENnextModel)) +#define B1instances(inst) ((B1instance *)((inst)->gen.GENinstances)) +#define B1modName gen.GENmodName int B1type; /* device type : 1 = nmos, -1 = pmos */ diff --git a/src/spicelib/devices/bsim2/bsim2def.h b/src/spicelib/devices/bsim2/bsim2def.h index 94ec28ce2..1dbda587a 100644 --- a/src/spicelib/devices/bsim2/bsim2def.h +++ b/src/spicelib/devices/bsim2/bsim2def.h @@ -16,11 +16,13 @@ Author: 1988 Min-Chie Jeng, Hong June Park, Thomas L. Quarles /* information needed for each instance */ typedef struct sBSIM2instance { - struct sBSIM2model *B2modPtr; /* pointer to model */ - struct sBSIM2instance *B2nextInstance; /* pointer to next instance of - *current model*/ - IFuid B2name; /* pointer to character string naming this instance */ - int B2states; /* index into state table for this device */ + + struct GENinstance gen; + +#define B2modPtr(inst) ((struct sBSIM2model *)((inst)->gen.GENmodPtr)) +#define B2nextInstance(inst) ((struct sBSIM2instance *)((inst)->gen.GENnextInstance)) +#define B2name gen.GENname +#define B2states gen.GENstate const int B2dNode; /* number of the gate node of the mosfet */ const int B2gNode; /* number of the gate node of the mosfet */ @@ -237,14 +239,13 @@ struct bsim2SizeDependParam /* per model data */ typedef struct sBSIM2model { /* model structure for a resistor */ - int B2modType; /* type index of this device type */ - struct sBSIM2model *B2nextModel; /* pointer to next possible model - *in linked list */ - B2instance * B2instances; /* pointer to list of instances - * that have this model */ - IFuid B2modName; /* pointer to the name of this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B2modType gen.GENmodType +#define B2nextModel(inst) ((struct sBSIM2model *)((inst)->gen.GENnextModel)) +#define B2instances(inst) ((B2instance *)((inst)->gen.GENinstances)) +#define B2modName gen.GENmodName int B2type; /* device type: 1 = nmos, -1 = pmos */ int pad; diff --git a/src/spicelib/devices/bsim3/bsim3def.h b/src/spicelib/devices/bsim3/bsim3def.h index c8fc235a1..13c5afc26 100644 --- a/src/spicelib/devices/bsim3/bsim3def.h +++ b/src/spicelib/devices/bsim3/bsim3def.h @@ -18,10 +18,14 @@ File: bsim3def.h typedef struct sBSIM3instance { - struct sBSIM3model *BSIM3modPtr; - struct sBSIM3instance *BSIM3nextInstance; - IFuid BSIM3name; - int BSIM3states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM3modPtr(inst) ((struct sBSIM3model *)((inst)->gen.GENmodPtr)) +#define BSIM3nextInstance(inst) ((struct sBSIM3instance *)((inst)->gen.GENnextInstance)) +#define BSIM3name gen.GENname +#define BSIM3states gen.GENstate + const int BSIM3dNode; const int BSIM3gNode; const int BSIM3sNode; @@ -399,12 +403,13 @@ struct bsim3SizeDependParam typedef struct sBSIM3model { - int BSIM3modType; - struct sBSIM3model *BSIM3nextModel; - BSIM3instance *BSIM3instances; - IFuid BSIM3modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM3modType gen.GENmodType +#define BSIM3nextModel(inst) ((struct sBSIM3model *)((inst)->gen.GENnextModel)) +#define BSIM3instances(inst) ((BSIM3instance *)((inst)->gen.GENinstances)) +#define BSIM3modName gen.GENmodName int BSIM3type; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h index bc7a9cf7e..93402cda7 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h +++ b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h @@ -21,10 +21,13 @@ Modified by Paolo Nenzi 2002 typedef struct sB3SOIDDinstance { - struct sB3SOIDDmodel *B3SOIDDmodPtr; - struct sB3SOIDDinstance *B3SOIDDnextInstance; - IFuid B3SOIDDname; - int B3SOIDDstates; /* index into state table for this device */ + + struct GENinstance gen; + +#define B3SOIDDmodPtr(inst) ((struct sB3SOIDDmodel *)((inst)->gen.GENmodPtr)) +#define B3SOIDDnextInstance(inst) ((struct sB3SOIDDinstance *)((inst)->gen.GENnextInstance)) +#define B3SOIDDname gen.GENname +#define B3SOIDDstates gen.GENstate const int B3SOIDDdNode; const int B3SOIDDgNode; @@ -597,12 +600,13 @@ struct b3soiddSizeDependParam typedef struct sB3SOIDDmodel { - int B3SOIDDmodType; - struct sB3SOIDDmodel *B3SOIDDnextModel; - B3SOIDDinstance *B3SOIDDinstances; - IFuid B3SOIDDmodName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B3SOIDDmodType gen.GENmodType +#define B3SOIDDnextModel(inst) ((struct sB3SOIDDmodel *)((inst)->gen.GENnextModel)) +#define B3SOIDDinstances(inst) ((B3SOIDDinstance *)((inst)->gen.GENinstances)) +#define B3SOIDDmodName gen.GENmodName int B3SOIDDtype; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h index 6f1434e99..7bbe71fc9 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h +++ b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h @@ -21,10 +21,13 @@ File: b3soifddef.h typedef struct sB3SOIFDinstance { - struct sB3SOIFDmodel *B3SOIFDmodPtr; - struct sB3SOIFDinstance *B3SOIFDnextInstance; - IFuid B3SOIFDname; - int B3SOIFDstates; /* index into state table for this device */ + + struct GENinstance gen; + +#define B3SOIFDmodPtr(inst) ((struct sB3SOIFDmodel *)((inst)->gen.GENmodPtr)) +#define B3SOIFDnextInstance(inst) ((struct sB3SOIFDinstance *)((inst)->gen.GENnextInstance)) +#define B3SOIFDname gen.GENname +#define B3SOIFDstates gen.GENstate const int B3SOIFDdNode; const int B3SOIFDgNode; @@ -597,12 +600,13 @@ struct b3soifdSizeDependParam typedef struct sB3SOIFDmodel { - int B3SOIFDmodType; - struct sB3SOIFDmodel *B3SOIFDnextModel; - B3SOIFDinstance *B3SOIFDinstances; - IFuid B3SOIFDmodName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B3SOIFDmodType gen.GENmodType +#define B3SOIFDnextModel(inst) ((struct sB3SOIFDmodel *)((inst)->gen.GENnextModel)) +#define B3SOIFDinstances(inst) ((B3SOIFDinstance *)((inst)->gen.GENinstances)) +#define B3SOIFDmodName gen.GENmodName int B3SOIFDtype; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h index d38c9ea78..769eca872 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h +++ b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h @@ -25,10 +25,13 @@ Modified by Paolo Nenzi 2002 typedef struct sB3SOIPDinstance { - struct sB3SOIPDmodel *B3SOIPDmodPtr; - struct sB3SOIPDinstance *B3SOIPDnextInstance; - IFuid B3SOIPDname; - int B3SOIPDstates; /* index into state table for this device */ + + struct GENinstance gen; + +#define B3SOIPDmodPtr(inst) ((struct sB3SOIPDmodel *)((inst)->gen.GENmodPtr)) +#define B3SOIPDnextInstance(inst) ((struct sB3SOIPDinstance *)((inst)->gen.GENnextInstance)) +#define B3SOIPDname gen.GENname +#define B3SOIPDstates gen.GENstate const int B3SOIPDdNode; const int B3SOIPDgNode; @@ -587,12 +590,13 @@ struct b3soipdSizeDependParam typedef struct sB3SOIPDmodel { - int B3SOIPDmodType; - struct sB3SOIPDmodel *B3SOIPDnextModel; - B3SOIPDinstance *B3SOIPDinstances; - IFuid B3SOIPDmodName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B3SOIPDmodType gen.GENmodType +#define B3SOIPDnextModel(inst) ((struct sB3SOIPDmodel *)((inst)->gen.GENnextModel)) +#define B3SOIPDinstances(inst) ((B3SOIPDinstance *)((inst)->gen.GENinstances)) +#define B3SOIPDmodName gen.GENmodName int B3SOIPDtype; diff --git a/src/spicelib/devices/bsim3v0/bsim3v0def.h b/src/spicelib/devices/bsim3v0/bsim3v0def.h index 2e14bed98..062d010df 100644 --- a/src/spicelib/devices/bsim3v0/bsim3v0def.h +++ b/src/spicelib/devices/bsim3v0/bsim3v0def.h @@ -15,11 +15,14 @@ File: bsim3v0def.h typedef struct sBSIM3v0instance { - struct sBSIM3v0model *BSIM3v0modPtr; - struct sBSIM3v0instance *BSIM3v0nextInstance; - IFuid BSIM3v0name; - int BSIM3v0states; /* index into state table for this device */ - + + struct GENinstance gen; + +#define BSIM3v0modPtr(inst) ((struct sBSIM3v0model *)((inst)->gen.GENmodPtr)) +#define BSIM3v0nextInstance(inst) ((struct sBSIM3v0instance *)((inst)->gen.GENnextInstance)) +#define BSIM3v0name gen.GENname +#define BSIM3v0states gen.GENstate + const int BSIM3v0dNode; const int BSIM3v0gNode; const int BSIM3v0sNode; @@ -318,12 +321,13 @@ struct bsim3v0SizeDependParam typedef struct sBSIM3v0model { - int BSIM3v0modType; - struct sBSIM3v0model *BSIM3v0nextModel; - BSIM3v0instance *BSIM3v0instances; - IFuid BSIM3v0modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM3v0modType gen.GENmodType +#define BSIM3v0nextModel(inst) ((struct sBSIM3v0model *)((inst)->gen.GENnextModel)) +#define BSIM3v0instances(inst) ((BSIM3v0instance *)((inst)->gen.GENinstances)) +#define BSIM3v0modName gen.GENmodName int BSIM3v0type; diff --git a/src/spicelib/devices/bsim3v1/bsim3v1def.h b/src/spicelib/devices/bsim3v1/bsim3v1def.h index 8aba22813..be9f83846 100644 --- a/src/spicelib/devices/bsim3v1/bsim3v1def.h +++ b/src/spicelib/devices/bsim3v1/bsim3v1def.h @@ -16,10 +16,13 @@ File: bsim3v1def.h typedef struct sBSIM3v1instance { - struct sBSIM3v1model *BSIM3v1modPtr; - struct sBSIM3v1instance *BSIM3v1nextInstance; - IFuid BSIM3v1name; - int BSIM3v1states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM3v1modPtr(inst) ((struct sBSIM3v1model *)((inst)->gen.GENmodPtr)) +#define BSIM3v1nextInstance(inst) ((struct sBSIM3v1instance *)((inst)->gen.GENnextInstance)) +#define BSIM3v1name gen.GENname +#define BSIM3v1states gen.GENstate const int BSIM3v1dNode; const int BSIM3v1gNode; @@ -320,12 +323,13 @@ struct bsim3v1SizeDependParam typedef struct sBSIM3v1model { - int BSIM3v1modType; - struct sBSIM3v1model *BSIM3v1nextModel; - BSIM3v1instance *BSIM3v1instances; - IFuid BSIM3v1modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM3v1modType gen.GENmodType +#define BSIM3v1nextModel(inst) ((struct sBSIM3v1model *)((inst)->gen.GENnextModel)) +#define BSIM3v1instances(inst) ((BSIM3v1instance *)((inst)->gen.GENinstances)) +#define BSIM3v1modName gen.GENmodName int BSIM3v1type; diff --git a/src/spicelib/devices/bsim3v32/bsim3v32def.h b/src/spicelib/devices/bsim3v32/bsim3v32def.h index 1a65860e6..85192c57f 100644 --- a/src/spicelib/devices/bsim3v32/bsim3v32def.h +++ b/src/spicelib/devices/bsim3v32/bsim3v32def.h @@ -18,10 +18,14 @@ File: bsim3v32def.h typedef struct sBSIM3v32instance { - struct sBSIM3v32model *BSIM3v32modPtr; - struct sBSIM3v32instance *BSIM3v32nextInstance; - IFuid BSIM3v32name; - int BSIM3v32states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM3v32modPtr(inst) ((struct sBSIM3v32model *)((inst)->gen.GENmodPtr)) +#define BSIM3v32nextInstance(inst) ((struct sBSIM3v32instance *)((inst)->gen.GENnextInstance)) +#define BSIM3v32name gen.GENname +#define BSIM3v32states gen.GENstate + const int BSIM3v32dNode; const int BSIM3v32gNode; const int BSIM3v32sNode; @@ -396,12 +400,13 @@ struct bsim3v32SizeDependParam typedef struct sBSIM3v32model { - int BSIM3v32modType; - struct sBSIM3v32model *BSIM3v32nextModel; - BSIM3v32instance *BSIM3v32instances; - IFuid BSIM3v32modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM3v32modType gen.GENmodType +#define BSIM3v32nextModel(inst) ((struct sBSIM3v32model *)((inst)->gen.GENnextModel)) +#define BSIM3v32instances(inst) ((BSIM3v32instance *)((inst)->gen.GENinstances)) +#define BSIM3v32modName gen.GENmodName int BSIM3v32type; diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index 2a10ea10b..fcb7864ed 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -69,10 +69,14 @@ typedef struct sBSIM4instance { - struct sBSIM4model *BSIM4modPtr; - struct sBSIM4instance *BSIM4nextInstance; - IFuid BSIM4name; - int BSIM4states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM4modPtr(inst) ((struct sBSIM4model *)((inst)->gen.GENmodPtr)) +#define BSIM4nextInstance(inst) ((struct sBSIM4instance *)((inst)->gen.GENnextInstance)) +#define BSIM4name gen.GENname +#define BSIM4states gen.GENstate + const int BSIM4dNode; const int BSIM4gNodeExt; const int BSIM4sNode; @@ -857,12 +861,13 @@ struct bsim4SizeDependParam typedef struct sBSIM4model { - int BSIM4modType; - struct sBSIM4model *BSIM4nextModel; - BSIM4instance *BSIM4instances; - IFuid BSIM4modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM4modType gen.GENmodType +#define BSIM4nextModel(inst) ((struct sBSIM4model *)((inst)->gen.GENnextModel)) +#define BSIM4instances(inst) ((BSIM4instance *)((inst)->gen.GENinstances)) +#define BSIM4modName gen.GENmodName int BSIM4type; diff --git a/src/spicelib/devices/bsim4v5/bsim4v5def.h b/src/spicelib/devices/bsim4v5/bsim4v5def.h index 300900695..443be7b02 100644 --- a/src/spicelib/devices/bsim4v5/bsim4v5def.h +++ b/src/spicelib/devices/bsim4v5/bsim4v5def.h @@ -20,10 +20,14 @@ File: bsim4v5def.h typedef struct sBSIM4v5instance { - struct sBSIM4v5model *BSIM4v5modPtr; - struct sBSIM4v5instance *BSIM4v5nextInstance; - IFuid BSIM4v5name; - int BSIM4v5states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM4v5modPtr(inst) ((struct sBSIM4v5model *)((inst)->gen.GENmodPtr)) +#define BSIM4v5nextInstance(inst) ((struct sBSIM4v5instance *)((inst)->gen.GENnextInstance)) +#define BSIM4v5name gen.GENname +#define BSIM4v5states gen.GENstate + const int BSIM4v5dNode; const int BSIM4v5gNodeExt; const int BSIM4v5sNode; @@ -774,12 +778,13 @@ struct bsim4v5SizeDependParam typedef struct sBSIM4v5model { - int BSIM4v5modType; - struct sBSIM4v5model *BSIM4v5nextModel; - BSIM4v5instance *BSIM4v5instances; - IFuid BSIM4v5modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM4v5modType gen.GENmodType +#define BSIM4v5nextModel(inst) ((struct sBSIM4v5model *)((inst)->gen.GENnextModel)) +#define BSIM4v5instances(inst) ((BSIM4v5instance *)((inst)->gen.GENinstances)) +#define BSIM4v5modName gen.GENmodName int BSIM4v5type; diff --git a/src/spicelib/devices/bsim4v6/bsim4v6def.h b/src/spicelib/devices/bsim4v6/bsim4v6def.h index 5f2a94f28..62de645f5 100644 --- a/src/spicelib/devices/bsim4v6/bsim4v6def.h +++ b/src/spicelib/devices/bsim4v6/bsim4v6def.h @@ -29,10 +29,14 @@ Modified by Wenwei Yang, 07/31/2008. typedef struct sBSIM4v6instance { - struct sBSIM4v6model *BSIM4v6modPtr; - struct sBSIM4v6instance *BSIM4v6nextInstance; - IFuid BSIM4v6name; - int BSIM4v6states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM4v6modPtr(inst) ((struct sBSIM4v6model *)((inst)->gen.GENmodPtr)) +#define BSIM4v6nextInstance(inst) ((struct sBSIM4v6instance *)((inst)->gen.GENnextInstance)) +#define BSIM4v6name gen.GENname +#define BSIM4v6states gen.GENstate + const int BSIM4v6dNode; const int BSIM4v6gNodeExt; const int BSIM4v6sNode; @@ -795,12 +799,13 @@ struct bsim4v6SizeDependParam typedef struct sBSIM4v6model { - int BSIM4v6modType; - struct sBSIM4v6model *BSIM4v6nextModel; - BSIM4v6instance *BSIM4v6instances; - IFuid BSIM4v6modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM4v6modType gen.GENmodType +#define BSIM4v6nextModel(inst) ((struct sBSIM4v6model *)((inst)->gen.GENnextModel)) +#define BSIM4v6instances(inst) ((BSIM4v6instance *)((inst)->gen.GENinstances)) +#define BSIM4v6modName gen.GENmodName int BSIM4v6type; diff --git a/src/spicelib/devices/bsim4v7/bsim4v7def.h b/src/spicelib/devices/bsim4v7/bsim4v7def.h index 1803e0c4e..8fafb865a 100644 --- a/src/spicelib/devices/bsim4v7/bsim4v7def.h +++ b/src/spicelib/devices/bsim4v7/bsim4v7def.h @@ -30,10 +30,14 @@ Modified by Wenwei Yang, 07/31/2008. typedef struct sBSIM4v7instance { - struct sBSIM4v7model *BSIM4v7modPtr; - struct sBSIM4v7instance *BSIM4v7nextInstance; - IFuid BSIM4v7name; - int BSIM4v7states; /* index into state table for this device */ + + struct GENinstance gen; + +#define BSIM4v7modPtr(inst) ((struct sBSIM4v7model *)((inst)->gen.GENmodPtr)) +#define BSIM4v7nextInstance(inst) ((struct sBSIM4v7instance *)((inst)->gen.GENnextInstance)) +#define BSIM4v7name gen.GENname +#define BSIM4v7states gen.GENstate + const int BSIM4v7dNode; const int BSIM4v7gNodeExt; const int BSIM4v7sNode; @@ -813,12 +817,13 @@ struct bsim4SizeDependParam typedef struct sBSIM4v7model { - int BSIM4v7modType; - struct sBSIM4v7model *BSIM4v7nextModel; - BSIM4v7instance *BSIM4v7instances; - IFuid BSIM4v7modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define BSIM4v7modType gen.GENmodType +#define BSIM4v7nextModel(inst) ((struct sBSIM4v7model *)((inst)->gen.GENnextModel)) +#define BSIM4v7instances(inst) ((BSIM4v7instance *)((inst)->gen.GENinstances)) +#define BSIM4v7modName gen.GENmodName int BSIM4v7type; diff --git a/src/spicelib/devices/bsimsoi/b4soidef.h b/src/spicelib/devices/bsimsoi/b4soidef.h index ce858a1a7..96913736a 100644 --- a/src/spicelib/devices/bsimsoi/b4soidef.h +++ b/src/spicelib/devices/bsimsoi/b4soidef.h @@ -26,10 +26,13 @@ File: b4soidef.h typedef struct sB4SOIinstance { - struct sB4SOImodel *B4SOImodPtr; - struct sB4SOIinstance *B4SOInextInstance; - IFuid B4SOIname; - int B4SOIstates; /* index into state table for this device */ + + struct GENinstance gen; + +#define B4SOImodPtr(inst) ((struct sB4SOImodel *)((inst)->gen.GENmodPtr)) +#define B4SOInextInstance(inst) ((struct sB4SOIinstance *)((inst)->gen.GENnextInstance)) +#define B4SOIname gen.GENname +#define B4SOIstates gen.GENstate const int B4SOIdNode; const int B4SOIgNodeExt; /* v3.1 changed gNode to gNodeExt */ @@ -1080,12 +1083,13 @@ struct b4soiSizeDependParam typedef struct sB4SOImodel { - int B4SOImodType; - struct sB4SOImodel *B4SOInextModel; - B4SOIinstance *B4SOIinstances; - IFuid B4SOImodName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define B4SOImodType gen.GENmodType +#define B4SOInextModel(inst) ((struct sB4SOImodel *)((inst)->gen.GENnextModel)) +#define B4SOIinstances(inst) ((B4SOIinstance *)((inst)->gen.GENinstances)) +#define B4SOImodName gen.GENmodName int B4SOItype; diff --git a/src/spicelib/devices/cap/capdefs.h b/src/spicelib/devices/cap/capdefs.h index 7a4e26307..c6fe2959e 100644 --- a/src/spicelib/devices/cap/capdefs.h +++ b/src/spicelib/devices/cap/capdefs.h @@ -19,11 +19,14 @@ Modified: September 2003 Paolo Nenzi /* information to describe each instance */ typedef struct sCAPinstance { - struct sCAPmodel *CAPmodPtr; /* backpointer to model */ - struct sCAPinstance *CAPnextInstance; /* pointer to next instance of - * current model*/ - IFuid CAPname; /* pointer to character string naming this instance */ - int CAPstate; /* pointer to start of capacitor state vector */ + + struct GENinstance gen; + +#define CAPmodPtr(inst) ((struct sCAPmodel *)((inst)->gen.GENmodPtr)) +#define CAPnextInstance(inst) ((struct sCAPinstance *)((inst)->gen.GENnextInstance)) +#define CAPname gen.GENname +#define CAPstate gen.GENstate + const int CAPposNode; /* number of positive node of capacitor */ const int CAPnegNode; /* number of negative node of capacitor */ @@ -73,14 +76,13 @@ beginning of the array */ /* data per model */ typedef struct sCAPmodel { /* model structure for a capacitor */ - int CAPmodType; /* type index of this device type */ - struct sCAPmodel *CAPnextModel; /* pointer to next possible model in - * linked list */ - CAPinstance * CAPinstances; /* pointer to list of instances that have this - * model */ - IFuid CAPmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define CAPmodType gen.GENmodType +#define CAPnextModel(inst) ((struct sCAPmodel *)((inst)->gen.GENnextModel)) +#define CAPinstances(inst) ((CAPinstance *)((inst)->gen.GENinstances)) +#define CAPmodName gen.GENmodName double CAPtnom; /* temperature at which capacitance measured */ double CAPtempCoeff1; /* linear temperature coefficient */ diff --git a/src/spicelib/devices/cccs/cccsdefs.h b/src/spicelib/devices/cccs/cccsdefs.h index 0a5875927..c64e9cba0 100644 --- a/src/spicelib/devices/cccs/cccsdefs.h +++ b/src/spicelib/devices/cccs/cccsdefs.h @@ -16,11 +16,13 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sCCCSinstance { - struct sCCCSmodel *CCCSmodPtr; /* backpointer to model */ - struct sCCCSinstance *CCCSnextInstance; /* pointer to next instance of - *current model*/ - IFuid CCCSname; /* pointer to character string naming this instance */ - int CCCSstate; /* not used */ + + struct GENinstance gen; + +#define CCCSmodPtr(inst) ((struct sCCCSmodel *)((inst)->gen.GENmodPtr)) +#define CCCSnextInstance(inst) ((struct sCCCSinstance *)((inst)->gen.GENnextInstance)) +#define CCCSname gen.GENname +#define CCCSstate gen.GENstate const int CCCSposNode; /* number of positive node of source */ const int CCCSnegNode; /* number of negative node of source */ @@ -47,14 +49,13 @@ typedef struct sCCCSinstance { /* per model data */ typedef struct sCCCSmodel { /* model structure for a source */ - int CCCSmodType; /* type index of this device type */ - struct sCCCSmodel *CCCSnextModel; /* pointer to next possible model - *in linked list */ - CCCSinstance * CCCSinstances; /* pointer to list of instances - that have this model */ - IFuid CCCSmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define CCCSmodType gen.GENmodType +#define CCCSnextModel(inst) ((struct sCCCSmodel *)((inst)->gen.GENnextModel)) +#define CCCSinstances(inst) ((CCCSinstance *)((inst)->gen.GENinstances)) +#define CCCSmodName gen.GENmodName } CCCSmodel; diff --git a/src/spicelib/devices/ccvs/ccvsdefs.h b/src/spicelib/devices/ccvs/ccvsdefs.h index 1c96890a6..09c42fd3c 100644 --- a/src/spicelib/devices/ccvs/ccvsdefs.h +++ b/src/spicelib/devices/ccvs/ccvsdefs.h @@ -16,11 +16,13 @@ Author: 1985 Thomas L. Quarles /* information used to describe a single instance */ typedef struct sCCVSinstance { - struct sCCVSmodel *CCVSmodPtr; /* backpointer to model */ - struct sCCVSinstance *CCVSnextInstance; /* pointer to next instance of - *current model*/ - IFuid CCVSname; /* pointer to character string naming this instance */ - int CCVSstate; /* not used */ + + struct GENinstance gen; + +#define CCVSmodPtr(inst) ((struct sCCVSmodel *)((inst)->gen.GENmodPtr)) +#define CCVSnextInstance(inst) ((struct sCCVSinstance *)((inst)->gen.GENnextInstance)) +#define CCVSname gen.GENname +#define CCVSstate gen.GENstate const int CCVSposNode; /* number of positive node of source */ const int CCVSnegNode; /* number of negative node of source */ @@ -51,14 +53,13 @@ typedef struct sCCVSinstance { /* per model data */ typedef struct sCCVSmodel { /* model structure for a CCVsource */ - int CCVSmodType; /* type index of this device type */ - struct sCCVSmodel *CCVSnextModel; /* pointer to next possible model - *in linked list */ - CCVSinstance * CCVSinstances; /* pointer to list of instances - that have this model */ - IFuid CCVSmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define CCVSmodType gen.GENmodType +#define CCVSnextModel(inst) ((struct sCCVSmodel *)((inst)->gen.GENnextModel)) +#define CCVSinstances(inst) ((CCVSinstance *)((inst)->gen.GENinstances)) +#define CCVSmodName gen.GENmodName } CCVSmodel; diff --git a/src/spicelib/devices/cpl/cpldefs.h b/src/spicelib/devices/cpl/cpldefs.h index 9c441a0da..10ec38923 100644 --- a/src/spicelib/devices/cpl/cpldefs.h +++ b/src/spicelib/devices/cpl/cpldefs.h @@ -16,12 +16,13 @@ reserved. /* information used to describe a single instance */ typedef struct sCPLinstance { - struct sCPLmodel *CPLmodPtr; /* backpointer to model */ - struct sCPLinstance *CPLnextInstance; /* pointer to next instance of - * current model*/ - IFuid CPLname; /* pointer to character string naming this instance */ - int CPLstate; /* not used */ + struct GENinstance gen; + +#define CPLmodPtr(inst) ((struct sCPLmodel *)((inst)->gen.GENmodPtr)) +#define CPLnextInstance(inst) ((struct sCPLinstance *)((inst)->gen.GENnextInstance)) +#define CPLname gen.GENname +#define CPLstate gen.GENstate int *CPLposNodes; int *CPLnegNodes; @@ -63,14 +64,13 @@ typedef struct sCPLinstance { /* per model data */ typedef struct sCPLmodel { /* model structure for a cpl */ - int CPLmodType; /* type index of this device type */ - struct sCPLmodel *CPLnextModel; /* pointer to next possible model in - * linked list */ - CPLinstance * CPLinstances; /* pointer to list of instances that have this - * model */ - IFuid CPLmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define CPLmodType gen.GENmodType +#define CPLnextModel(inst) ((struct sCPLmodel *)((inst)->gen.GENnextModel)) +#define CPLinstances(inst) ((CPLinstance *)((inst)->gen.GENinstances)) +#define CPLmodName gen.GENmodName double *Rm; int Rm_counter; diff --git a/src/spicelib/devices/csw/cswdefs.h b/src/spicelib/devices/csw/cswdefs.h index 59522dabb..7a5737361 100644 --- a/src/spicelib/devices/csw/cswdefs.h +++ b/src/spicelib/devices/csw/cswdefs.h @@ -19,11 +19,13 @@ Modified: 2000 AlansFixes /* information to describe each instance */ typedef struct sCSWinstance { - struct sCSWmodel *CSWmodPtr; /* backpointer to model */ - struct sCSWinstance *CSWnextInstance; /* pointer to next instance of - * current model*/ - IFuid CSWname; /* pointer to character string naming this instance */ - int CSWstate; /* pointer to start of switch's section of state vector */ + + struct GENinstance gen; + +#define CSWmodPtr(inst) ((struct sCSWmodel *)((inst)->gen.GENmodPtr)) +#define CSWnextInstance(inst) ((struct sCSWinstance *)((inst)->gen.GENnextInstance)) +#define CSWname gen.GENname +#define CSWstate gen.GENstate const int CSWposNode; /* number of positive node of switch */ const int CSWnegNode; /* number of negative node of switch */ @@ -57,14 +59,13 @@ typedef struct sCSWinstance { #define CSW_NUM_STATES 2 typedef struct sCSWmodel { /* model structure for a switch */ - int CSWmodType; /* type index of this device type */ - struct sCSWmodel *CSWnextModel; /* pointer to next possible model in - * linked list */ - CSWinstance *CSWinstances; /* pointer to list of instances that have this - * model */ - IFuid CSWmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define CSWmodType gen.GENmodType +#define CSWnextModel(inst) ((struct sCSWmodel *)((inst)->gen.GENnextModel)) +#define CSWinstances(inst) ((CSWinstance *)((inst)->gen.GENinstances)) +#define CSWmodName gen.GENmodName double CSWonResistance; /* switch "on" resistance */ double CSWoffResistance; /* switch "off" resistance */ diff --git a/src/spicelib/devices/dio/diodefs.h b/src/spicelib/devices/dio/diodefs.h index 65c0f869b..280a1e0ce 100644 --- a/src/spicelib/devices/dio/diodefs.h +++ b/src/spicelib/devices/dio/diodefs.h @@ -18,11 +18,14 @@ Modified by Paolo Nenzi 2003 and Dietmar Warning 2012 /* information needed per instance */ typedef struct sDIOinstance { - struct sDIOmodel *DIOmodPtr; /* backpointer to model */ - struct sDIOinstance *DIOnextInstance; /* pointer to next instance of - * current model*/ - IFuid DIOname; /* pointer to character string naming this instance */ - int DIOstate; /* pointer to start of state vector for diode */ + + struct GENinstance gen; + +#define DIOmodPtr(inst) ((struct sDIOmodel *)((inst)->gen.GENmodPtr)) +#define DIOnextInstance(inst) ((struct sDIOinstance *)((inst)->gen.GENnextInstance)) +#define DIOname gen.GENname +#define DIOstate gen.GENstate + const int DIOposNode; /* number of positive node of diode */ const int DIOnegNode; /* number of negative node of diode */ int DIOposPrimeNode; /* number of positive prime node of diode */ @@ -164,14 +167,13 @@ typedef struct sDIOinstance { /* per model data */ typedef struct sDIOmodel { /* model structure for a diode */ - int DIOmodType; /* type index of this device type */ - struct sDIOmodel *DIOnextModel; /* pointer to next possible model in - * linked list */ - DIOinstance * DIOinstances; /* pointer to list of instances - * that have this model */ - IFuid DIOmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define DIOmodType gen.GENmodType +#define DIOnextModel(inst) ((struct sDIOmodel *)((inst)->gen.GENnextModel)) +#define DIOinstances(inst) ((DIOinstance *)((inst)->gen.GENinstances)) +#define DIOmodName gen.GENmodName unsigned DIOlevelGiven : 1; unsigned DIOsatCurGiven : 1; diff --git a/src/spicelib/devices/hfet1/hfetdefs.h b/src/spicelib/devices/hfet1/hfetdefs.h index 61ed45403..1c3ac5ce4 100644 --- a/src/spicelib/devices/hfet1/hfetdefs.h +++ b/src/spicelib/devices/hfet1/hfetdefs.h @@ -15,11 +15,14 @@ Modified: Paolo Nenzi #define HFETAnumStates 24 typedef struct sHFETAinstance { - struct sHFETAmodel *HFETAmodPtr; - struct sHFETAinstance *HFETAnextInstance; - IFuid HFETAname; - int HFETAstate; /* index into state table for this device */ - + + struct GENinstance gen; + +#define HFETAmodPtr(inst) ((struct sHFETAmodel *)((inst)->gen.GENmodPtr)) +#define HFETAnextInstance(inst) ((struct sHFETAinstance *)((inst)->gen.GENnextInstance)) +#define HFETAname gen.GENname +#define HFETAstate gen.GENstate + const int HFETAdrainNode; const int HFETAgateNode; const int HFETAsourceNode; @@ -128,12 +131,13 @@ typedef struct sHFETAinstance { /* per model data */ typedef struct sHFETAmodel { - int HFETAmodType; - struct sHFETAmodel *HFETAnextModel; - HFETAinstance *HFETAinstances; - IFuid HFETAmodName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define HFETAmodType gen.GENmodType +#define HFETAnextModel(inst) ((struct sHFETAmodel *)((inst)->gen.GENnextModel)) +#define HFETAinstances(inst) ((HFETAinstance *)((inst)->gen.GENinstances)) +#define HFETAmodName gen.GENmodName int HFETAtype; int HFETAgatemod; diff --git a/src/spicelib/devices/hfet2/hfet2defs.h b/src/spicelib/devices/hfet2/hfet2defs.h index 78f869515..5e938c7f2 100644 --- a/src/spicelib/devices/hfet2/hfet2defs.h +++ b/src/spicelib/devices/hfet2/hfet2defs.h @@ -9,11 +9,14 @@ typedef struct sHFET2instance { - struct sHFET2model *HFET2modPtr; - struct sHFET2instance *HFET2nextInstance; - IFuid HFET2name; - int HFET2state; /* index into state table for this device */ - + + struct GENinstance gen; + +#define HFET2modPtr(inst) ((struct sHFET2model *)((inst)->gen.GENmodPtr)) +#define HFET2nextInstance(inst) ((struct sHFET2instance *)((inst)->gen.GENnextInstance)) +#define HFET2name gen.GENname +#define HFET2state gen.GENstate + int HFET2drainNode; int HFET2gateNode; int HFET2sourceNode; @@ -86,12 +89,13 @@ typedef struct sHFET2instance { typedef struct sHFET2model { - int HFET2modType; - struct sHFET2model *HFET2nextModel; - HFET2instance * HFET2instances; - IFuid HFET2modName; - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define HFET2modType gen.GENmodType +#define HFET2nextModel(inst) ((struct sHFET2model *)((inst)->gen.GENnextModel)) +#define HFET2instances(inst) ((HFET2instance *)((inst)->gen.GENinstances)) +#define HFET2modName gen.GENmodName int HFET2type; diff --git a/src/spicelib/devices/hisim2/hsm2def.h b/src/spicelib/devices/hisim2/hsm2def.h index 77e290735..1ffe6f8b1 100644 --- a/src/spicelib/devices/hisim2/hsm2def.h +++ b/src/spicelib/devices/hisim2/hsm2def.h @@ -137,11 +137,13 @@ typedef struct sHSM2hereMKSParam { /* information needed for each instance */ typedef struct sHSM2instance { - struct sHSM2model *HSM2modPtr; /* pointer to model */ - struct sHSM2instance *HSM2nextInstance; /* pointer to next instance of - current model*/ - IFuid HSM2name; /* pointer to character string naming this instance */ - int HSM2states; /* index into state table for this device */ + + struct GENinstance gen; + +#define HSM2modPtr(inst) ((struct sHSM2model *)((inst)->gen.GENmodPtr)) +#define HSM2nextInstance(inst) ((struct sHSM2instance *)((inst)->gen.GENnextInstance)) +#define HSM2name gen.GENname +#define HSM2states gen.GENstate const int HSM2dNode; /* number of the drain node of the mosfet */ const int HSM2gNode; /* number of the gate node of the mosfet */ @@ -681,14 +683,13 @@ typedef struct sHSM2instance { /* per model data */ typedef struct sHSM2model { /* model structure for a resistor */ - int HSM2modType; /* type index of this device type */ - struct sHSM2model *HSM2nextModel; /* pointer to next possible model - in linked list */ - HSM2instance * HSM2instances; /* pointer to list of instances - that have this model */ - IFuid HSM2modName; /* pointer to the name of this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define HSM2modType gen.GENmodType +#define HSM2nextModel(inst) ((struct sHSM2model *)((inst)->gen.GENnextModel)) +#define HSM2instances(inst) ((HSM2instance *)((inst)->gen.GENinstances)) +#define HSM2modName gen.GENmodName int HSM2_type; /* device type: 1 = nmos, -1 = pmos */ int HSM2_level; /* level */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvdef.h b/src/spicelib/devices/hisimhv1/hsmhvdef.h index 91db73d52..d93015c53 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvdef.h +++ b/src/spicelib/devices/hisimhv1/hsmhvdef.h @@ -213,11 +213,13 @@ typedef struct sHSMHVhereMKSParam { /* information needed for each instance */ typedef struct sHSMHVinstance { - struct sHSMHVmodel *HSMHVmodPtr; /* pointer to model */ - struct sHSMHVinstance *HSMHVnextInstance; /* pointer to next instance of - current model*/ - IFuid HSMHVname; /* pointer to character string naming this instance */ - int HSMHVstates; /* index into state table for this device */ + + struct GENinstance gen; + +#define HSMHVmodPtr(inst) ((struct sHSMHVmodel *)((inst)->gen.GENmodPtr)) +#define HSMHVnextInstance(inst) ((struct sHSMHVinstance *)((inst)->gen.GENnextInstance)) +#define HSMHVname gen.GENname +#define HSMHVstates gen.GENstate const int HSMHVdNode; /* number of the drain node of the mosfet */ const int HSMHVgNode; /* number of the gate node of the mosfet */ @@ -911,14 +913,13 @@ typedef struct sHSMHVinstance { /* per model data */ typedef struct sHSMHVmodel { /* model structure for a resistor */ - int HSMHVmodType; /* type index of this device type */ - struct sHSMHVmodel *HSMHVnextModel; /* pointer to next possible model - in linked list */ - HSMHVinstance * HSMHVinstances; /* pointer to list of instances - that have this model */ - IFuid HSMHVmodName; /* pointer to the name of this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define HSMHVmodType gen.GENmodType +#define HSMHVnextModel(inst) ((struct sHSMHVmodel *)((inst)->gen.GENnextModel)) +#define HSMHVinstances(inst) ((HSMHVinstance *)((inst)->gen.GENinstances)) +#define HSMHVmodName gen.GENmodName int HSMHV_type; /* device type: 1 = nmos, -1 = pmos */ int HSMHV_level; /* level */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2def.h b/src/spicelib/devices/hisimhv2/hsmhv2def.h index f13b4732c..aba3c33c0 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2def.h +++ b/src/spicelib/devices/hisimhv2/hsmhv2def.h @@ -261,11 +261,13 @@ typedef struct sHSMHV2hereMKSParam { /* information needed for each instance */ typedef struct sHSMHV2instance { - struct sHSMHV2model *HSMHV2modPtr; /* pointer to model */ - struct sHSMHV2instance *HSMHV2nextInstance; /* pointer to next instance of - current model*/ - IFuid HSMHV2name; /* pointer to character string naming this instance */ - int HSMHV2states; /* index into state table for this device */ + + struct GENinstance gen; + +#define HSMHV2modPtr(inst) ((struct sHSMHV2model *)((inst)->gen.GENmodPtr)) +#define HSMHV2nextInstance(inst) ((struct sHSMHV2instance *)((inst)->gen.GENnextInstance)) +#define HSMHV2name gen.GENname +#define HSMHV2states gen.GENstate const int HSMHV2dNode; /* number of the drain node of the mosfet */ const int HSMHV2gNode; /* number of the gate node of the mosfet */ @@ -1021,14 +1023,13 @@ typedef struct sHSMHV2instance { /* per model data */ typedef struct sHSMHV2model { /* model structure for a resistor */ - int HSMHV2modType; /* type index of this device type */ - struct sHSMHV2model *HSMHV2nextModel; /* pointer to next possible model - in linked list */ - HSMHV2instance * HSMHV2instances; /* pointer to list of instances - that have this model */ - IFuid HSMHV2modName; /* pointer to the name of this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define HSMHV2modType gen.GENmodType +#define HSMHV2nextModel(inst) ((struct sHSMHV2model *)((inst)->gen.GENnextModel)) +#define HSMHV2instances(inst) ((HSMHV2instance *)((inst)->gen.GENinstances)) +#define HSMHV2modName gen.GENmodName int HSMHV2_type; /* device type: 1 = nmos, -1 = pmos */ int HSMHV2_level; /* level */ diff --git a/src/spicelib/devices/ind/inddefs.h b/src/spicelib/devices/ind/inddefs.h index 8dafa77d5..e987bc4cb 100644 --- a/src/spicelib/devices/ind/inddefs.h +++ b/src/spicelib/devices/ind/inddefs.h @@ -27,11 +27,14 @@ typedef struct sMUTmodel MUTmodel; /* information needed for each instance */ struct sINDinstance { - INDmodel *INDmodPtr; /* backpointer to model */ - INDinstance *INDnextInstance; /* pointer to next instance of - * current model */ - IFuid INDname; /* pointer to character string naming this instance */ - int INDstate; /* pointer to beginning of state vector for inductor */ + + struct GENinstance gen; + +#define INDmodPtr(inst) ((INDmodel *)((inst)->gen.GENmodPtr)) +#define INDnextInstance(inst) ((INDinstance *)((inst)->gen.GENnextInstance)) +#define INDname gen.GENname +#define INDstate gen.GENstate + const int INDposNode; /* number of positive node of inductor */ const int INDnegNode; /* number of negative node of inductor */ @@ -84,14 +87,13 @@ struct sINDinstance { /* per model data */ struct sINDmodel { /* model structure for an inductor */ - int INDmodType; /* type index of this device type */ - INDmodel *INDnextModel; /* pointer to next possible model in - * linked list */ - INDinstance *INDinstances; /* pointer to list of instances that have this - * model */ - IFuid INDmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define INDmodType gen.GENmodType +#define INDnextModel(inst) ((INDmodel *)((inst)->gen.GENnextModel)) +#define INDinstances(inst) ((INDinstance *)((inst)->gen.GENinstances)) +#define INDmodName gen.GENmodName double INDmInd; /* Model inductance */ double INDtnom; /* temperature at which inductance measured */ @@ -123,11 +125,14 @@ struct sINDmodel { /* model structure for an inductor */ /* information needed for each instance */ struct sMUTinstance { - MUTmodel *MUTmodPtr; /* backpointer to model */ - MUTinstance *MUTnextInstance; /* pointer to next instance of - * current model */ - IFuid MUTname; /* pointer to character string naming this instance */ - int MUTstates; /* state info, unused */ + + struct GENinstance gen; + +#define MUTmodPtr(inst) ((MUTmodel *)((inst)->gen.GENmodPtr)) +#define MUTnextInstance(inst) ((MUTinstance *)((inst)->gen.GENnextInstance)) +#define MUTname gen.GENname +#define MUTstates gen.GENstate + double MUTcoupling; /* mutual inductance input by user */ double MUTfactor; /* mutual inductance scaled for internal use */ IFuid MUTindName1; /* name of coupled inductor 1 */ @@ -148,14 +153,14 @@ struct sMUTinstance { /* per model data */ struct sMUTmodel { /* model structure for a mutual inductor */ - int MUTmodType; /* type index of this device type */ - MUTmodel *MUTnextModel; /* pointer to next possible model in - * linked list */ - MUTinstance *MUTinstances; /* pointer to list of instances that have this - * model */ - IFuid MUTmodName; /* pointer to character string naming this model */ -/* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MUTmodType gen.GENmodType +#define MUTnextModel(inst) ((MUTmodel *)((inst)->gen.GENnextModel)) +#define MUTinstances(inst) ((MUTinstance *)((inst)->gen.GENinstances)) +#define MUTmodName gen.GENmodName + }; diff --git a/src/spicelib/devices/isrc/isrcdefs.h b/src/spicelib/devices/isrc/isrcdefs.h index 1519168da..4e8533aed 100644 --- a/src/spicelib/devices/isrc/isrcdefs.h +++ b/src/spicelib/devices/isrc/isrcdefs.h @@ -19,11 +19,13 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sISRCinstance { - struct sISRCmodel *ISRCmodPtr; /* backpointer to model */ - struct sISRCinstance *ISRCnextInstance; /* pointer to next instance of - *current model */ - IFuid ISRCname; /* pointer to character string naming this instance */ - int ISRCstate; /* not used */ + + struct GENinstance gen; + +#define ISRCmodPtr(inst) ((struct sISRCmodel *)((inst)->gen.GENmodPtr)) +#define ISRCnextInstance(inst) ((struct sISRCinstance *)((inst)->gen.GENnextInstance)) +#define ISRCname gen.GENname +#define ISRCstate gen.GENstate const int ISRCnegNode; /* number of negative node of source */ const int ISRCposNode; /* number of positive node of source */ @@ -72,14 +74,13 @@ typedef struct sISRCinstance { /* per model data */ typedef struct sISRCmodel { - int ISRCmodType; /* type index of this device type */ - struct sISRCmodel *ISRCnextModel; /* pointer to next possible model - *in linked list */ - ISRCinstance * ISRCinstances; /* pointer to list of instances - * that have this model */ - IFuid ISRCmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define ISRCmodType gen.GENmodType +#define ISRCnextModel(inst) ((struct sISRCmodel *)((inst)->gen.GENnextModel)) +#define ISRCinstances(inst) ((ISRCinstance *)((inst)->gen.GENinstances)) +#define ISRCmodName gen.GENmodName } ISRCmodel; diff --git a/src/spicelib/devices/jfet/jfetdefs.h b/src/spicelib/devices/jfet/jfetdefs.h index 9ec278104..2dbc79b29 100644 --- a/src/spicelib/devices/jfet/jfetdefs.h +++ b/src/spicelib/devices/jfet/jfetdefs.h @@ -21,11 +21,14 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern /* information used to describe a single instance */ typedef struct sJFETinstance { - struct sJFETmodel *JFETmodPtr; /* backpointer to model */ - struct sJFETinstance *JFETnextInstance; /* pointer to next instance of - * current model*/ - IFuid JFETname; /* pointer to character string naming this instance */ - int JFETstate; /* pointer to start of state vector for jfet */ + + struct GENinstance gen; + +#define JFETmodPtr(inst) ((struct sJFETmodel *)((inst)->gen.GENmodPtr)) +#define JFETnextInstance(inst) ((struct sJFETinstance *)((inst)->gen.GENnextInstance)) +#define JFETname gen.GENname +#define JFETstate gen.GENstate + const int JFETdrainNode; /* number of drain node of jfet */ const int JFETgateNode; /* number of gate node of jfet */ const int JFETsourceNode; /* number of source node of jfet */ @@ -168,14 +171,13 @@ typedef struct sJFETinstance { /* per model data */ typedef struct sJFETmodel { /* model structure for a jfet */ - int JFETmodType; /* type index of this device type */ - struct sJFETmodel *JFETnextModel; /* pointer to next possible model in - * linked list */ - JFETinstance * JFETinstances; /* pointer to list of instances - * that have this model */ - IFuid JFETmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define JFETmodType gen.GENmodType +#define JFETnextModel(inst) ((struct sJFETmodel *)((inst)->gen.GENnextModel)) +#define JFETinstances(inst) ((JFETinstance *)((inst)->gen.GENinstances)) +#define JFETmodName gen.GENmodName int JFETtype; diff --git a/src/spicelib/devices/jfet2/jfet2defs.h b/src/spicelib/devices/jfet2/jfet2defs.h index 86f1dd798..320c96608 100644 --- a/src/spicelib/devices/jfet2/jfet2defs.h +++ b/src/spicelib/devices/jfet2/jfet2defs.h @@ -26,11 +26,14 @@ Modified to add PS model and new parameter definitions ( Anthony E. Parker ) /* information used to describe a single instance */ typedef struct sJFET2instance { - struct sJFET2model *JFET2modPtr; /* backpointer to model */ - struct sJFET2instance *JFET2nextInstance; /* pointer to next instance of - * current model*/ - IFuid JFET2name; /* pointer to character string naming this instance */ - int JFET2state; /* pointer to start of state vector for jfet */ + + struct GENinstance gen; + +#define JFET2modPtr(inst) ((struct sJFET2model *)((inst)->gen.GENmodPtr)) +#define JFET2nextInstance(inst) ((struct sJFET2instance *)((inst)->gen.GENnextInstance)) +#define JFET2name gen.GENname +#define JFET2state gen.GENstate + const int JFET2drainNode; /* number of drain node of jfet */ const int JFET2gateNode; /* number of gate node of jfet */ const int JFET2sourceNode; /* number of source node of jfet */ @@ -180,14 +183,13 @@ typedef struct sJFET2instance { /* per model data */ typedef struct sJFET2model { /* model structure for a jfet */ - int JFET2modType; /* type index of this device type */ - struct sJFET2model *JFET2nextModel; /* pointer to next possible model in - * linked list */ - JFET2instance * JFET2instances; /* pointer to list of instances - * that have this model */ - IFuid JFET2modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define JFET2modType gen.GENmodType +#define JFET2nextModel(inst) ((struct sJFET2model *)((inst)->gen.GENnextModel)) +#define JFET2instances(inst) ((JFET2instance *)((inst)->gen.GENinstances)) +#define JFET2modName gen.GENmodName int JFET2type; diff --git a/src/spicelib/devices/ltra/ltradefs.h b/src/spicelib/devices/ltra/ltradefs.h index 33e9eb43d..f1f0e3d2e 100644 --- a/src/spicelib/devices/ltra/ltradefs.h +++ b/src/spicelib/devices/ltra/ltradefs.h @@ -18,11 +18,14 @@ Author: 1990 Jaijeet S. Roychowdhury /* information used to describe a single instance */ typedef struct sLTRAinstance { - struct sLTRAmodel *LTRAmodPtr; /* backpointer to model */ - struct sLTRAinstance *LTRAnextInstance; /* pointer to next instance of - * current model*/ - IFuid LTRAname; /* pointer to character string naming this instance */ - int LTRAstate; /* not used */ + + struct GENinstance gen; + +#define LTRAmodPtr(inst) ((struct sLTRAmodel *)((inst)->gen.GENmodPtr)) +#define LTRAnextInstance(inst) ((struct sLTRAinstance *)((inst)->gen.GENnextInstance)) +#define LTRAname gen.GENname +#define LTRAstate gen.GENstate + const int LTRAposNode1; /* number of positive node of end 1 of t. line */ const int LTRAnegNode1; /* number of negative node of end 1 of t. line */ const int LTRAposNode2; /* number of positive node of end 2 of t. line */ @@ -73,14 +76,13 @@ typedef struct sLTRAinstance { /* per model data */ typedef struct sLTRAmodel { /* model structure for a transmission lines */ - int LTRAmodType; /* type index of this device type */ - struct sLTRAmodel *LTRAnextModel; /* pointer to next possible model in - * linked list */ - LTRAinstance * LTRAinstances; /* pointer to list of instances that have this - * model */ - IFuid LTRAmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define LTRAmodType gen.GENmodType +#define LTRAnextModel(inst) ((struct sLTRAmodel *)((inst)->gen.GENnextModel)) +#define LTRAinstances(inst) ((LTRAinstance *)((inst)->gen.GENinstances)) +#define LTRAmodName gen.GENmodName double LTRAh1dashFirstVal; /* first needed value of h1dasg at current timepoint */ diff --git a/src/spicelib/devices/mes/mesdefs.h b/src/spicelib/devices/mes/mesdefs.h index 71ae13565..c0bb29556 100644 --- a/src/spicelib/devices/mes/mesdefs.h +++ b/src/spicelib/devices/mes/mesdefs.h @@ -20,11 +20,14 @@ Author: 1985 S. Hwang /* information used to describe a single instance */ typedef struct sMESinstance { - struct sMESmodel *MESmodPtr; /* backpointer to model */ - struct sMESinstance *MESnextInstance; /* pointer to next instance of - * current model*/ - IFuid MESname; /* pointer to character string naming this instance */ - int MESstate; /* pointer to start of state vector for mesfet */ + + struct GENinstance gen; + +#define MESmodPtr(inst) ((struct sMESmodel *)((inst)->gen.GENmodPtr)) +#define MESnextInstance(inst) ((struct sMESinstance *)((inst)->gen.GENnextInstance)) +#define MESname gen.GENname +#define MESstate gen.GENstate + const int MESdrainNode; /* number of drain node of mesfet */ const int MESgateNode; /* number of gate node of mesfet */ const int MESsourceNode; /* number of source node of mesfet */ @@ -161,14 +164,13 @@ int MESmode; /* per model data */ typedef struct sMESmodel { /* model structure for a mesfet */ - int MESmodType; /* type index of this device type */ - struct sMESmodel *MESnextModel; /* pointer to next possible model in - * linked list */ - MESinstance * MESinstances; /* pointer to list of instances - * that have this model */ - IFuid MESmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MESmodType gen.GENmodType +#define MESnextModel(inst) ((struct sMESmodel *)((inst)->gen.GENnextModel)) +#define MESinstances(inst) ((MESinstance *)((inst)->gen.GENinstances)) +#define MESmodName gen.GENmodName int MEStype; diff --git a/src/spicelib/devices/mesa/mesadefs.h b/src/spicelib/devices/mesa/mesadefs.h index 13e8a046d..1f6c652cd 100644 --- a/src/spicelib/devices/mesa/mesadefs.h +++ b/src/spicelib/devices/mesa/mesadefs.h @@ -18,12 +18,14 @@ Author: Trond Ytterdal /* information used to describe a single instance */ typedef struct sMESAinstance { - struct sMESAmodel *MESAmodPtr; /* backpointer to model */ - struct sMESAinstance *MESAnextInstance; /* pointer to next instance of - * current model*/ - IFuid MESAname; /* pointer to character string naming this instance */ - int MESAstate; /* pointer to start of state vector for MESAfet */ - + + struct GENinstance gen; + +#define MESAmodPtr(inst) ((struct sMESAmodel *)((inst)->gen.GENmodPtr)) +#define MESAnextInstance(inst) ((struct sMESAinstance *)((inst)->gen.GENnextInstance)) +#define MESAname gen.GENname +#define MESAstate gen.GENstate + const int MESAdrainNode; /* number of drain node of MESAfet */ const int MESAgateNode; /* number of gate node of MESAfet */ const int MESAsourceNode; /* number of source node of MESAfet */ @@ -214,14 +216,13 @@ int MESAmode; /* per model data */ typedef struct sMESAmodel { /* model structure for a MESAfet */ - int MESAmodType; /* type index of this device type */ - struct sMESAmodel *MESAnextModel; /* pointer to next possible model in - * linked list */ - MESAinstance * MESAinstances; /* pointer to list of instances - * that have this model */ - IFuid MESAmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MESAmodType gen.GENmodType +#define MESAnextModel(inst) ((struct sMESAmodel *)((inst)->gen.GENnextModel)) +#define MESAinstances(inst) ((MESAinstance *)((inst)->gen.GENinstances)) +#define MESAmodName gen.GENmodName int MESAtype; diff --git a/src/spicelib/devices/mos1/mos1defs.h b/src/spicelib/devices/mos1/mos1defs.h index b5862df3c..81b79c7f4 100644 --- a/src/spicelib/devices/mos1/mos1defs.h +++ b/src/spicelib/devices/mos1/mos1defs.h @@ -18,11 +18,13 @@ Modified: 2000 AlansFixes /* information needed for each instance */ typedef struct sMOS1instance { - struct sMOS1model *MOS1modPtr; /* backpointer to model */ - struct sMOS1instance *MOS1nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS1name; /* pointer to character string naming this instance */ - int MOS1states; /* index into state table for this device */ + + struct GENinstance gen; + +#define MOS1modPtr(inst) ((struct sMOS1model *)((inst)->gen.GENmodPtr)) +#define MOS1nextInstance(inst) ((struct sMOS1instance *)((inst)->gen.GENnextInstance)) +#define MOS1name gen.GENname +#define MOS1states gen.GENstate const int MOS1dNode; /* number of the gate node of the mosfet */ const int MOS1gNode; /* number of the gate node of the mosfet */ @@ -312,14 +314,13 @@ typedef struct sMOS1instance { typedef struct sMOS1model { /* model structure for a resistor */ - int MOS1modType; /* type index to this device type */ - struct sMOS1model *MOS1nextModel; /* pointer to next possible model - *in linked list */ - MOS1instance * MOS1instances; /* pointer to list of instances - * that have this model */ - IFuid MOS1modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MOS1modType gen.GENmodType +#define MOS1nextModel(inst) ((struct sMOS1model *)((inst)->gen.GENnextModel)) +#define MOS1instances(inst) ((MOS1instance *)((inst)->gen.GENinstances)) +#define MOS1modName gen.GENmodName int MOS1type; /* device type : 1 = nmos, -1 = pmos */ double MOS1tnom; /* temperature at which parameters measured */ diff --git a/src/spicelib/devices/mos2/mos2defs.h b/src/spicelib/devices/mos2/mos2defs.h index 8e2b38f37..431dc7d35 100644 --- a/src/spicelib/devices/mos2/mos2defs.h +++ b/src/spicelib/devices/mos2/mos2defs.h @@ -18,11 +18,14 @@ Modified: 2000 AlansFIxes /* information needed for each instance */ typedef struct sMOS2instance { - struct sMOS2model *MOS2modPtr; /* backpointer to model */ - struct sMOS2instance *MOS2nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS2name; /* pointer to character string naming this instance */ - int MOS2states; /* index into state table for this device */ + + struct GENinstance gen; + +#define MOS2modPtr(inst) ((struct sMOS2model *)((inst)->gen.GENmodPtr)) +#define MOS2nextInstance(inst) ((struct sMOS2instance *)((inst)->gen.GENnextInstance)) +#define MOS2name gen.GENname +#define MOS2states gen.GENstate + const int MOS2dNode; /* number of the gate node of the mosfet */ const int MOS2gNode; /* number of the gate node of the mosfet */ const int MOS2sNode; /* number of the source node of the mosfet */ @@ -320,14 +323,13 @@ typedef struct sMOS2instance { */ typedef struct sMOS2model { /* model structure for a resistor */ - int MOS2modType; /* type index of this device type */ - struct sMOS2model *MOS2nextModel; /* pointer to next possible model - *in linked list */ - MOS2instance * MOS2instances; /* pointer to list of instances - * that have this model */ - IFuid MOS2modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MOS2modType gen.GENmodType +#define MOS2nextModel(inst) ((struct sMOS2model *)((inst)->gen.GENnextModel)) +#define MOS2instances(inst) ((MOS2instance *)((inst)->gen.GENinstances)) +#define MOS2modName gen.GENmodName int MOS2type; /* device type : 1 = nmos, -1 = pmos */ int MOS2gateType; diff --git a/src/spicelib/devices/mos3/mos3defs.h b/src/spicelib/devices/mos3/mos3defs.h index 0089ef378..f6159f0a1 100644 --- a/src/spicelib/devices/mos3/mos3defs.h +++ b/src/spicelib/devices/mos3/mos3defs.h @@ -18,11 +18,14 @@ Modified: 2000 AlanFixes /* information needed for each instance */ typedef struct sMOS3instance { - struct sMOS3model *MOS3modPtr; /* backpointer to model */ - struct sMOS3instance *MOS3nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS3name; /* pointer to character string naming this instance */ - int MOS3states; /* index into state table for this device */ + + struct GENinstance gen; + +#define MOS3modPtr(inst) ((struct sMOS3model *)((inst)->gen.GENmodPtr)) +#define MOS3nextInstance(inst) ((struct sMOS3instance *)((inst)->gen.GENnextInstance)) +#define MOS3name gen.GENname +#define MOS3states gen.GENstate + const int MOS3dNode; /* number of the gate node of the mosfet */ const int MOS3gNode; /* number of the gate node of the mosfet */ const int MOS3sNode; /* number of the source node of the mosfet */ @@ -316,14 +319,13 @@ typedef struct sMOS3instance { */ typedef struct sMOS3model { /* model structure for a resistor */ - int MOS3modType; /* type index of this device type */ - struct sMOS3model *MOS3nextModel; /* pointer to next possible model - *in linked list */ - MOS3instance * MOS3instances; /* pointer to list of instances - * that have this model */ - IFuid MOS3modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MOS3modType gen.GENmodType +#define MOS3nextModel(inst) ((struct sMOS3model *)((inst)->gen.GENnextModel)) +#define MOS3instances(inst) ((MOS3instance *)((inst)->gen.GENinstances)) +#define MOS3modName gen.GENmodName int MOS3type; /* device type : 1 = nmos, -1 = pmos */ double MOS3tnom; /* temperature at which parameters measured */ diff --git a/src/spicelib/devices/mos6/mos6defs.h b/src/spicelib/devices/mos6/mos6defs.h index 053d8948e..ba871ac67 100644 --- a/src/spicelib/devices/mos6/mos6defs.h +++ b/src/spicelib/devices/mos6/mos6defs.h @@ -16,11 +16,14 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sMOS6instance { - struct sMOS6model *MOS6modPtr; /* backpointer to model */ - struct sMOS6instance *MOS6nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS6name; /* pointer to character string naming this instance */ - int MOS6states; /* index into state table for this device */ + + struct GENinstance gen; + +#define MOS6modPtr(inst) ((struct sMOS6model *)((inst)->gen.GENmodPtr)) +#define MOS6nextInstance(inst) ((struct sMOS6instance *)((inst)->gen.GENnextInstance)) +#define MOS6name gen.GENname +#define MOS6states gen.GENstate + const int MOS6dNode; /* number of the gate node of the mosfet */ const int MOS6gNode; /* number of the gate node of the mosfet */ const int MOS6sNode; /* number of the source node of the mosfet */ @@ -243,14 +246,13 @@ typedef struct sMOS6instance { typedef struct sMOS6model { /* model structure for a resistor */ - int MOS6modType; /* type index to this device type */ - struct sMOS6model *MOS6nextModel; /* pointer to next possible model - *in linked list */ - MOS6instance * MOS6instances; /* pointer to list of instances - * that have this model */ - IFuid MOS6modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MOS6modType gen.GENmodType +#define MOS6nextModel(inst) ((struct sMOS6model *)((inst)->gen.GENnextModel)) +#define MOS6instances(inst) ((MOS6instance *)((inst)->gen.GENinstances)) +#define MOS6modName gen.GENmodName int MOS6type; /* device type : 1 = nmos, -1 = pmos */ double MOS6tnom; /* temperature at which parameters measured */ diff --git a/src/spicelib/devices/mos9/mos9defs.h b/src/spicelib/devices/mos9/mos9defs.h index e40588b33..486c41cad 100644 --- a/src/spicelib/devices/mos9/mos9defs.h +++ b/src/spicelib/devices/mos9/mos9defs.h @@ -18,11 +18,14 @@ Modified: Alan Gillespie /* information needed for each instance */ typedef struct sMOS9instance { - struct sMOS9model *MOS9modPtr; /* backpointer to model */ - struct sMOS9instance *MOS9nextInstance; /* pointer to next instance of - *current model*/ - IFuid MOS9name; /* pointer to character string naming this instance */ - int MOS9states; /* index into state table for this device */ + + struct GENinstance gen; + +#define MOS9modPtr(inst) ((struct sMOS9model *)((inst)->gen.GENmodPtr)) +#define MOS9nextInstance(inst) ((struct sMOS9instance *)((inst)->gen.GENnextInstance)) +#define MOS9name gen.GENname +#define MOS9states gen.GENstate + const int MOS9dNode; /* number of the gate node of the mosfet */ const int MOS9gNode; /* number of the gate node of the mosfet */ const int MOS9sNode; /* number of the source node of the mosfet */ @@ -318,14 +321,13 @@ typedef struct sMOS9instance { */ typedef struct sMOS9model { /* model structure for a resistor */ - int MOS9modType; /* type index of this device type */ - struct sMOS9model *MOS9nextModel; /* pointer to next possible model - *in linked list */ - MOS9instance * MOS9instances; /* pointer to list of instances - * that have this model */ - IFuid MOS9modName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define MOS9modType gen.GENmodType +#define MOS9nextModel(inst) ((struct sMOS9model *)((inst)->gen.GENnextModel)) +#define MOS9instances(inst) ((MOS9instance *)((inst)->gen.GENinstances)) +#define MOS9modName gen.GENmodName int MOS9type; /* device type : 1 = nmos, -1 = pmos */ double MOS9tnom; /* temperature at which parameters measured */ diff --git a/src/spicelib/devices/nbjt/nbjtdefs.h b/src/spicelib/devices/nbjt/nbjtdefs.h index b012eca48..730e3e48c 100644 --- a/src/spicelib/devices/nbjt/nbjtdefs.h +++ b/src/spicelib/devices/nbjt/nbjtdefs.h @@ -22,14 +22,14 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNBJTinstance { - struct sNBJTmodel *NBJTmodPtr;/* back pointer to model */ - struct sNBJTinstance *NBJTnextInstance; /* pointer to next instance - * of current model */ - IFuid NBJTname; /* pointer to character string naming this - * instance */ - int NBJTstate; /* pointer to start of state vector for bjt */ - /* entries in the state vector for bjt: */ + struct GENinstance gen; + +#define NBJTmodPtr(inst) ((struct sNBJTmodel *)((inst)->gen.GENmodPtr)) +#define NBJTnextInstance(inst) ((struct sNBJTinstance *)((inst)->gen.GENnextInstance)) +#define NBJTname gen.GENname +#define NBJTstate gen.GENstate + #define NBJTvbe NBJTstate #define NBJTvce NBJTstate+1 #define NBJTic NBJTstate+2 @@ -87,17 +87,14 @@ typedef struct sNBJTinstance { /* per model data */ typedef struct sNBJTmodel { /* model structure for a bjt */ - int NBJTmodType; /* type index of this device type */ - struct sNBJTmodel *NBJTnextModel; /* pointer to next possible model in - * linked list */ - NBJTinstance *NBJTinstances; /* pointer to list of instances that have - * this model */ - IFuid NBJTmodName; /* pointer to character string naming this - * model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NBJTmodType gen.GENmodType +#define NBJTnextModel(inst) ((struct sNBJTmodel *)((inst)->gen.GENnextModel)) +#define NBJTinstances(inst) ((NBJTinstance *)((inst)->gen.GENinstances)) +#define NBJTmodName gen.GENmodName - /* Everything below here is numerical-device-specific */ MESHcard *NBJTxMeshes; /* list of xmesh cards */ MESHcard *NBJTyMeshes; /* list of ymesh cards */ DOMNcard *NBJTdomains; /* list of domain cards */ diff --git a/src/spicelib/devices/nbjt2/nbjt2def.h b/src/spicelib/devices/nbjt2/nbjt2def.h index fcd58f839..d48d080d9 100644 --- a/src/spicelib/devices/nbjt2/nbjt2def.h +++ b/src/spicelib/devices/nbjt2/nbjt2def.h @@ -22,14 +22,14 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNBJT2instance { - struct sNBJT2model *NBJT2modPtr; /* back pointer to model */ - struct sNBJT2instance *NBJT2nextInstance; /* pointer to next instance - * of current model */ - IFuid NBJT2name; /* pointer to character string naming this - * instance */ - int NBJT2state; /* pointer to start of state vector for bjt */ - /* entries in the state vector for bjt: */ + struct GENinstance gen; + +#define NBJT2modPtr(inst) ((struct sNBJT2model *)((inst)->gen.GENmodPtr)) +#define NBJT2nextInstance(inst) ((struct sNBJT2instance *)((inst)->gen.GENnextInstance)) +#define NBJT2name gen.GENname +#define NBJT2state gen.GENstate + #define NBJT2vbe NBJT2state #define NBJT2vce NBJT2state+1 #define NBJT2ic NBJT2state+2 @@ -89,17 +89,14 @@ typedef struct sNBJT2instance { /* per model data */ typedef struct sNBJT2model { /* model structure for a bjt */ - int NBJT2modType; /* type index of this device type */ - struct sNBJT2model *NBJT2nextModel; /* pointer to next possible model in - * linked list */ - NBJT2instance *NBJT2instances;/* pointer to list of instances that have - * this model */ - IFuid NBJT2modName; /* pointer to character string naming this - * model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NBJT2modType gen.GENmodType +#define NBJT2nextModel(inst) ((struct sNBJT2model *)((inst)->gen.GENnextModel)) +#define NBJT2instances(inst) ((NBJT2instance *)((inst)->gen.GENinstances)) +#define NBJT2modName gen.GENmodName - /* Everything below here is numerical-device-specific */ MESHcard *NBJT2xMeshes; /* list of xmesh cards */ MESHcard *NBJT2yMeshes; /* list of ymesh cards */ DOMNcard *NBJT2domains; /* list of domain cards */ diff --git a/src/spicelib/devices/ndev/ndevdefs.h b/src/spicelib/devices/ndev/ndevdefs.h index 2415cb9c0..81bf44aaa 100644 --- a/src/spicelib/devices/ndev/ndevdefs.h +++ b/src/spicelib/devices/ndev/ndevdefs.h @@ -24,12 +24,14 @@ University of Science and Technology of China /* information needed per instance */ typedef struct sNDEVinstance { - struct sNDEVmodel *NDEVmodPtr;/* back pointer to model */ - struct sNDEVinstance *NDEVnextInstance; /* pointer to next instance - * of current model */ - IFuid NDEVname; /* pointer to character string naming this - * instance */ - int NDEVstate; /* pointer to start of state vector for diode */ + + struct GENinstance gen; + +#define NDEVmodPtr(inst) ((struct sNDEVmodel *)((inst)->gen.GENmodPtr)) +#define NDEVnextInstance(inst) ((struct sNDEVinstance *)((inst)->gen.GENnextInstance)) +#define NDEVname gen.GENname +#define NDEVstate gen.GENstate + const int pin[7]; /* max 7 terminals are allowed */ int term; /* the real number of terminals */ CKTnode *node[7]; /* the array of CKT node's node pointer */ @@ -44,16 +46,14 @@ typedef struct sNDEVinstance { /* per model data */ typedef struct sNDEVmodel { /* model structure for a diode */ - /* the following 4 entries should always exist */ - int NDEVmodType; /* type index of this device type */ - struct sNDEVmodel *NDEVnextModel; /* pointer to next possible model in linked list */ - NDEVinstance *NDEVinstances; /* pointer to list of instances that have this model */ - IFuid NDEVmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NDEVmodType gen.GENmodType +#define NDEVnextModel(inst) ((struct sNDEVmodel *)((inst)->gen.GENnextModel)) +#define NDEVinstances(inst) ((NDEVinstance *)((inst)->gen.GENinstances)) +#define NDEVmodName gen.GENmodName - /* here can be freely defined as your wish*/ - char * NDEVmodelfile; char * host; int port; /* Port number. */ diff --git a/src/spicelib/devices/numd/numddefs.h b/src/spicelib/devices/numd/numddefs.h index 080d49aaf..f44640977 100644 --- a/src/spicelib/devices/numd/numddefs.h +++ b/src/spicelib/devices/numd/numddefs.h @@ -22,12 +22,13 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMDinstance { - struct sNUMDmodel *NUMDmodPtr;/* back pointer to model */ - struct sNUMDinstance *NUMDnextInstance; /* pointer to next instance - * of current model */ - IFuid NUMDname; /* pointer to character string naming this - * instance */ - int NUMDstate; /* pointer to start of state vector for diode */ + + struct GENinstance gen; + +#define NUMDmodPtr(inst) ((struct sNUMDmodel *)((inst)->gen.GENmodPtr)) +#define NUMDnextInstance(inst) ((struct sNUMDinstance *)((inst)->gen.GENnextInstance)) +#define NUMDname gen.GENname +#define NUMDstate gen.GENstate #define NUMDvoltage NUMDstate #define NUMDid NUMDstate+1 @@ -68,17 +69,14 @@ typedef struct sNUMDinstance { /* per model data */ typedef struct sNUMDmodel { /* model structure for a diode */ - int NUMDmodType; /* type index of this device type */ - struct sNUMDmodel *NUMDnextModel; /* pointer to next possible model in - * linked list */ - NUMDinstance *NUMDinstances; /* pointer to list of instances that have - * this model */ - IFuid NUMDmodName; /* pointer to character string naming this - * model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NUMDmodType gen.GENmodType +#define NUMDnextModel(inst) ((struct sNUMDmodel *)((inst)->gen.GENnextModel)) +#define NUMDinstances(inst) ((NUMDinstance *)((inst)->gen.GENinstances)) +#define NUMDmodName gen.GENmodName - /* Everything below here is numerical-device-specific */ MESHcard *NUMDxMeshes; /* list of xmesh cards */ MESHcard *NUMDyMeshes; /* list of ymesh cards */ DOMNcard *NUMDdomains; /* list of domain cards */ diff --git a/src/spicelib/devices/numd2/numd2def.h b/src/spicelib/devices/numd2/numd2def.h index 3aeffa568..58742da00 100644 --- a/src/spicelib/devices/numd2/numd2def.h +++ b/src/spicelib/devices/numd2/numd2def.h @@ -22,12 +22,13 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMD2instance { - struct sNUMD2model *NUMD2modPtr; /* back pointer to model */ - struct sNUMD2instance *NUMD2nextInstance; /* pointer to next instance - * of current model */ - IFuid NUMD2name; /* pointer to character string naming this - * instance */ - int NUMD2state; /* pointer to start of state vector for diode */ + + struct GENinstance gen; + +#define NUMD2modPtr(inst) ((struct sNUMD2model *)((inst)->gen.GENmodPtr)) +#define NUMD2nextInstance(inst) ((struct sNUMD2instance *)((inst)->gen.GENnextInstance)) +#define NUMD2name gen.GENname +#define NUMD2state gen.GENstate #define NUMD2voltage NUMD2state #define NUMD2id NUMD2state+1 @@ -70,17 +71,14 @@ typedef struct sNUMD2instance { /* per model data */ typedef struct sNUMD2model { /* model structure for a diode */ - int NUMD2modType; /* type index of this device type */ - struct sNUMD2model *NUMD2nextModel; /* pointer to next possible model in - * linked list */ - NUMD2instance *NUMD2instances;/* pointer to list of instances that have - * this model */ - IFuid NUMD2modName; /* pointer to character string naming this - * model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NUMD2modType gen.GENmodType +#define NUMD2nextModel(inst) ((struct sNUMD2model *)((inst)->gen.GENnextModel)) +#define NUMD2instances(inst) ((NUMD2instance *)((inst)->gen.GENinstances)) +#define NUMD2modName gen.GENmodName - /* Everything below here is numerical-device-specific */ MESHcard *NUMD2xMeshes; /* list of xmesh cards */ MESHcard *NUMD2yMeshes; /* list of ymesh cards */ DOMNcard *NUMD2domains; /* list of domain cards */ diff --git a/src/spicelib/devices/numos/numosdef.h b/src/spicelib/devices/numos/numosdef.h index 18de61139..5a5b1ed5d 100644 --- a/src/spicelib/devices/numos/numosdef.h +++ b/src/spicelib/devices/numos/numosdef.h @@ -22,15 +22,14 @@ Authors: 1987 Karti Mayaram, 1991 David Gates /* information needed per instance */ typedef struct sNUMOSinstance { - struct sNUMOSmodel *NUMOSmodPtr; /* back pointer to model */ - struct sNUMOSinstance *NUMOSnextInstance; /* pointer to next instance - * of current model */ - IFuid NUMOSname; /* pointer to character string naming this - * instance */ - int NUMOSstate; /* pointer to start of state vector for - * mosfet */ - /* entries in the state vector for mosfet: */ + struct GENinstance gen; + +#define NUMOSmodPtr(inst) ((struct sNUMOSmodel *)((inst)->gen.GENmodPtr)) +#define NUMOSnextInstance(inst) ((struct sNUMOSinstance *)((inst)->gen.GENnextInstance)) +#define NUMOSname gen.GENname +#define NUMOSstate gen.GENstate + #define NUMOSvdb NUMOSstate #define NUMOSvsb NUMOSstate+1 #define NUMOSvgb NUMOSstate+2 @@ -118,14 +117,14 @@ typedef struct sNUMOSinstance { /* per model data */ typedef struct sNUMOSmodel { /* model structure for a numerical device */ - int NUMOSmodType; /* type index of this device type */ - struct sNUMOSmodel *NUMOSnextModel; /* pointer to next model in list */ - NUMOSinstance *NUMOSinstances;/* pointer to list of instances */ - IFuid NUMOSmodName; /* pointer to string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define NUMOSmodType gen.GENmodType +#define NUMOSnextModel(inst) ((struct sNUMOSmodel *)((inst)->gen.GENnextModel)) +#define NUMOSinstances(inst) ((NUMOSinstance *)((inst)->gen.GENinstances)) +#define NUMOSmodName gen.GENmodName - /* Everything below here is numerical-device-specific */ MESHcard *NUMOSxMeshes; /* list of xmesh cards */ MESHcard *NUMOSyMeshes; /* list of ymesh cards */ DOMNcard *NUMOSdomains; /* list of domain cards */ diff --git a/src/spicelib/devices/res/resdefs.h b/src/spicelib/devices/res/resdefs.h index b92922bde..52cb7daca 100644 --- a/src/spicelib/devices/res/resdefs.h +++ b/src/spicelib/devices/res/resdefs.h @@ -19,12 +19,14 @@ Modified: 2000 AlansFixes /* information used to describe a single instance */ typedef struct sRESinstance { - struct sRESmodel *RESmodPtr; /* backpointer to model */ - struct sRESinstance *RESnextInstance; /* pointer to next instance of - * current model*/ - IFuid RESname; /* pointer to character string naming this instance */ - int RESstate; /* not used but needed for sructure consistency */ + struct GENinstance gen; + +#define RESmodPtr(inst) ((struct sRESmodel *)((inst)->gen.GENmodPtr)) +#define RESnextInstance(inst) ((struct sRESinstance *)((inst)->gen.GENnextInstance)) +#define RESname gen.GENname +#define RESstate gen.GENstate + const int RESposNode; /* number of positive node of resistor */ const int RESnegNode; /* number of negative node of resistor */ @@ -92,14 +94,13 @@ typedef struct sRESinstance { /* per model data */ typedef struct sRESmodel { /* model structure for a resistor */ - int RESmodType; /* type index of this device type */ - struct sRESmodel *RESnextModel; /* pointer to next possible model in - * linked list */ - RESinstance * RESinstances; /* pointer to list of instances that have this - * model */ - IFuid RESmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define RESmodType gen.GENmodType +#define RESnextModel(inst) ((struct sRESmodel *)((inst)->gen.GENnextModel)) +#define RESinstances(inst) ((RESinstance *)((inst)->gen.GENinstances)) +#define RESmodName gen.GENmodName double REStnom; /* temperature at which resistance measured */ double REStempCoeff1; /* first temperature coefficient of resistors */ diff --git a/src/spicelib/devices/soi3/soi3defs.h b/src/spicelib/devices/soi3/soi3defs.h index 80877e022..77be8b355 100644 --- a/src/spicelib/devices/soi3/soi3defs.h +++ b/src/spicelib/devices/soi3/soi3defs.h @@ -37,12 +37,12 @@ ngspice integration typedef struct sSOI3instance { - struct sSOI3model *SOI3modPtr; /* backpointer to model */ - struct sSOI3instance *SOI3nextInstance; /* pointer to next instance of - *current model*/ - IFuid SOI3name; /* pointer to character string naming this instance */ - int SOI3states; /* index into state table for this device */ + struct GENinstance gen; +#define SOI3modPtr(inst) ((struct sSOI3model *)((inst)->gen.GENmodPtr)) +#define SOI3nextInstance(inst) ((struct sSOI3instance *)((inst)->gen.GENnextInstance)) +#define SOI3name gen.GENname +#define SOI3states gen.GENstate const int SOI3dNode; /* number of the drain node of the mosfet */ const int SOI3gfNode; /* number of the front gate node of the mosfet */ @@ -416,14 +416,12 @@ typedef struct sSOI3instance { typedef struct sSOI3model { /* model structure for an SOI3 MOSFET */ - int SOI3modType; /* type index to this device type */ - struct sSOI3model *SOI3nextModel; /* pointer to next possible model - *in linked list */ - SOI3instance * SOI3instances; /* pointer to list of instances - * that have this model */ - IFuid SOI3modName; /* pointer to character string naming this model */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#define SOI3modType gen.GENmodType +#define SOI3nextModel(inst) ((struct sSOI3model *)((inst)->gen.GENnextModel)) +#define SOI3instances(inst) ((SOI3instance *)((inst)->gen.GENinstances)) +#define SOI3modName gen.GENmodName int SOI3type; /* device type : 1 = nsoi, -1 = psoi */ double SOI3tnom; /* temperature at which parameters measured */ diff --git a/src/spicelib/devices/sw/swdefs.h b/src/spicelib/devices/sw/swdefs.h index ff6c995af..4e73cc4e4 100644 --- a/src/spicelib/devices/sw/swdefs.h +++ b/src/spicelib/devices/sw/swdefs.h @@ -19,11 +19,13 @@ Modified: 2000 AlansFixes /* information to describe each instance */ typedef struct sSWinstance { - struct sSWmodel *SWmodPtr; /* backpointer to model */ - struct sSWinstance *SWnextInstance; /* pointer to next instance of - * current model*/ - IFuid SWname; /* pointer to character string naming this instance */ - int SWstate; /* pointer to start of switch's section of state vector */ + + struct GENinstance gen; + +#define SWmodPtr(inst) ((struct sSWmodel *)((inst)->gen.GENmodPtr)) +#define SWnextInstance(inst) ((struct sSWinstance *)((inst)->gen.GENnextInstance)) +#define SWname gen.GENname +#define SWstate gen.GENstate const int SWposNode; /* number of positive node of switch */ const int SWnegNode; /* number of negative node of switch */ @@ -56,14 +58,13 @@ typedef struct sSWinstance { #define SW_NUM_STATES 2 typedef struct sSWmodel { /* model structure for a switch */ - int SWmodType; /* type index of this device type */ - struct sSWmodel *SWnextModel; /* pointer to next possible model in - * linked list */ - SWinstance *SWinstances; /* pointer to list of instances that have this - * model */ - IFuid SWmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define SWmodType gen.GENmodType +#define SWnextModel(inst) ((struct sSWmodel *)((inst)->gen.GENnextModel)) +#define SWinstances(inst) ((SWinstance *)((inst)->gen.GENinstances)) +#define SWmodName gen.GENmodName double SWonResistance; /* switch "on" resistance */ double SWoffResistance; /* switch "off" resistance */ diff --git a/src/spicelib/devices/tra/tradefs.h b/src/spicelib/devices/tra/tradefs.h index 817f289a6..d90448f55 100644 --- a/src/spicelib/devices/tra/tradefs.h +++ b/src/spicelib/devices/tra/tradefs.h @@ -18,11 +18,14 @@ Author: 1985 Thomas L. Quarles /* information used to describe a single instance */ typedef struct sTRAinstance { - struct sTRAmodel *TRAmodPtr; /* backpointer to model */ - struct sTRAinstance *TRAnextInstance; /* pointer to next instance of - * current model*/ - IFuid TRAname; /* pointer to character string naming this instance */ - int TRAstate; /* not used */ + + struct GENinstance gen; + +#define TRAmodPtr(inst) ((struct sTRAmodel *)((inst)->gen.GENmodPtr)) +#define TRAnextInstance(inst) ((struct sTRAinstance *)((inst)->gen.GENnextInstance)) +#define TRAname gen.GENname +#define TRAstate gen.GENstate + const int TRAposNode1; /* number of positive node of end 1 of t. line */ const int TRAnegNode1; /* number of negative node of end 1 of t. line */ const int TRAposNode2; /* number of positive node of end 2 of t. line */ @@ -86,14 +89,13 @@ typedef struct sTRAinstance { /* per model data */ typedef struct sTRAmodel { /* model structure for a transmission lines */ - int TRAmodType; /* type index of this device type */ - struct sTRAmodel *TRAnextModel; /* pointer to next possible model in - * linked list */ - TRAinstance * TRAinstances; /* pointer to list of instances that have this - * model */ - IFuid TRAmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define TRAmodType gen.GENmodType +#define TRAnextModel(inst) ((struct sTRAmodel *)((inst)->gen.GENnextModel)) +#define TRAinstances(inst) ((TRAinstance *)((inst)->gen.GENinstances)) +#define TRAmodName gen.GENmodName } TRAmodel; diff --git a/src/spicelib/devices/txl/txldefs.h b/src/spicelib/devices/txl/txldefs.h index 68baa92a5..ccdba9838 100644 --- a/src/spicelib/devices/txl/txldefs.h +++ b/src/spicelib/devices/txl/txldefs.h @@ -11,12 +11,13 @@ /* information used to describe a single instance */ typedef struct sTXLinstance { - struct sTXLmodel *TXLmodPtr; /* backpointer to model */ - struct sTXLinstance *TXLnextInstance; /* pointer to next instance of - * current model*/ - IFuid TXLname; /* pointer to character string naming this instance */ - int TXLstates; /* state info, unused */ + struct GENinstance gen; + +#define TXLmodPtr(inst) ((struct sTXLmodel *)((inst)->gen.GENmodPtr)) +#define TXLnextInstance(inst) ((struct sTXLinstance *)((inst)->gen.GENnextInstance)) +#define TXLname gen.GENname +#define TXLstates gen.GENstate int TXLposNode; int TXLnegNode; @@ -55,14 +56,13 @@ typedef struct sTXLinstance { /* per model data */ typedef struct sTXLmodel { /* model structure for a txl */ - int TXLmodType; /* type index of this device type */ - struct sTXLmodel *TXLnextModel; /* pointer to next possible model in - * linked list */ - TXLinstance * TXLinstances; /* pointer to list of instances that have this - * model */ - IFuid TXLmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define TXLmodType gen.GENmodType +#define TXLnextModel(inst) ((struct sTXLmodel *)((inst)->gen.GENnextModel)) +#define TXLinstances(inst) ((TXLinstance *)((inst)->gen.GENinstances)) +#define TXLmodName gen.GENmodName double R; double L; diff --git a/src/spicelib/devices/urc/urcdefs.h b/src/spicelib/devices/urc/urcdefs.h index 4adbb88c4..7f96c1716 100644 --- a/src/spicelib/devices/urc/urcdefs.h +++ b/src/spicelib/devices/urc/urcdefs.h @@ -19,11 +19,14 @@ Author: 1985 Thomas L. Quarles /* information needed for each instance */ typedef struct sURCinstance { - struct sURCmodel *URCmodPtr; /* backpointer to model */ - struct sURCinstance *URCnextInstance; /* pointer to next instance of - * current model*/ - IFuid URCname; /* pointer to character string naming this instance */ - int URCstate; /* not used */ + + struct GENinstance gen; + +#define URCmodPtr(inst) ((struct sURCmodel *)((inst)->gen.GENmodPtr)) +#define URCnextInstance(inst) ((struct sURCinstance *)((inst)->gen.GENnextInstance)) +#define URCname gen.GENname +#define URCstate gen.GENstate + const int URCposNode; /* number of positive node of URC */ const int URCnegNode; /* number of negative node of URC */ const int URCgndNode; /* number of the "ground" node of the URC */ @@ -37,14 +40,13 @@ typedef struct sURCinstance { /* per model data */ typedef struct sURCmodel { /* model structure for a resistor */ - int URCmodType; /* type index of this device type */ - struct sURCmodel *URCnextModel; /* pointer to next possible model - * in linked list */ - URCinstance * URCinstances; /* pointer to list of instances that have this - * model */ - IFuid URCmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define URCmodType gen.GENmodType +#define URCnextModel(inst) ((struct sURCmodel *)((inst)->gen.GENnextModel)) +#define URCinstances(inst) ((URCinstance *)((inst)->gen.GENinstances)) +#define URCmodName gen.GENmodName double URCk; /* propagation constant for URC */ double URCfmax; /* max frequence of interest */ diff --git a/src/spicelib/devices/vbic/vbicdefs.h b/src/spicelib/devices/vbic/vbicdefs.h index 65032f91e..012bd7e95 100644 --- a/src/spicelib/devices/vbic/vbicdefs.h +++ b/src/spicelib/devices/vbic/vbicdefs.h @@ -19,11 +19,13 @@ Spice3 Implementation: 2003 Dietmar Warning DAnalyse GmbH /* data needed to describe a single instance */ typedef struct sVBICinstance { - struct sVBICmodel *VBICmodPtr; /* backpointer to model */ - struct sVBICinstance *VBICnextInstance; /* pointer to next instance of - current model*/ - IFuid VBICname; /* pointer to character string naming this instance */ - int VBICstate; /* pointer to start of state vector for vbic */ + + struct GENinstance gen; + +#define VBICmodPtr(inst) ((struct sVBICmodel *)((inst)->gen.GENmodPtr)) +#define VBICnextInstance(inst) ((struct sVBICinstance *)((inst)->gen.GENnextInstance)) +#define VBICname gen.GENname +#define VBICstate gen.GENstate const int VBICcollNode; /* number of collector node of vbic */ const int VBICbaseNode; /* number of base node of vbic */ @@ -350,15 +352,13 @@ typedef struct sVBICinstance { /* per model data */ typedef struct sVBICmodel { /* model structure for a vbic */ - int VBICmodType; /* type index of this device type */ - struct sVBICmodel *VBICnextModel; /* pointer to next possible model in - linked list */ - VBICinstance * VBICinstances; /* pointer to list of instances that have - this model */ - IFuid VBICmodName; /* pointer to character string naming - this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define VBICmodType gen.GENmodType +#define VBICnextModel(inst) ((struct sVBICmodel *)((inst)->gen.GENnextModel)) +#define VBICinstances(inst) ((VBICinstance *)((inst)->gen.GENinstances)) +#define VBICmodName gen.GENmodName int VBICtype; diff --git a/src/spicelib/devices/vccs/vccsdefs.h b/src/spicelib/devices/vccs/vccsdefs.h index 2f2f6e040..3b9d9cde5 100644 --- a/src/spicelib/devices/vccs/vccsdefs.h +++ b/src/spicelib/devices/vccs/vccsdefs.h @@ -18,11 +18,13 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sVCCSinstance { - struct sVCCSmodel *VCCSmodPtr; /* backpointer to model */ - struct sVCCSinstance *VCCSnextInstance; /* pointer to next instance of - *current model*/ - IFuid VCCSname; /* pointer to character string naming this instance */ - int VCCSstates; /* state info */ + + struct GENinstance gen; + +#define VCCSmodPtr(inst) ((struct sVCCSmodel *)((inst)->gen.GENmodPtr)) +#define VCCSnextInstance(inst) ((struct sVCCSinstance *)((inst)->gen.GENnextInstance)) +#define VCCSname gen.GENname +#define VCCSstates gen.GENstate const int VCCSposNode; /* number of positive node of source */ const int VCCSnegNode; /* number of negative node of source */ @@ -55,14 +57,13 @@ typedef struct sVCCSinstance { /* per model data */ typedef struct sVCCSmodel { /* model structure for a source */ - int VCCSmodType; /* type index of this device type */ - struct sVCCSmodel *VCCSnextModel; /* pointer to next possible model - * in linked list */ - VCCSinstance * VCCSinstances; /* pointer to list of instances - * that have this model */ - IFuid VCCSmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define VCCSmodType gen.GENmodType +#define VCCSnextModel(inst) ((struct sVCCSmodel *)((inst)->gen.GENnextModel)) +#define VCCSinstances(inst) ((VCCSinstance *)((inst)->gen.GENinstances)) +#define VCCSmodName gen.GENmodName } VCCSmodel; diff --git a/src/spicelib/devices/vcvs/vcvsdefs.h b/src/spicelib/devices/vcvs/vcvsdefs.h index 92880c992..a2c36874e 100644 --- a/src/spicelib/devices/vcvs/vcvsdefs.h +++ b/src/spicelib/devices/vcvs/vcvsdefs.h @@ -19,11 +19,13 @@ Author: 1985 Thomas L. Quarles /* information to describe a single instance */ typedef struct sVCVSinstance { - struct sVCVSmodel *VCVSmodPtr; /* backpointer to model */ - struct sVCVSinstance *VCVSnextInstance; /* pointer to next instance of - *current model*/ - IFuid VCVSname; /* pointer to character string naming this instance */ - int VCVSstates; /* state info */ + + struct GENinstance gen; + +#define VCVSmodPtr(inst) ((struct sVCVSmodel *)((inst)->gen.GENmodPtr)) +#define VCVSnextInstance(inst) ((struct sVCVSinstance *)((inst)->gen.GENnextInstance)) +#define VCVSname gen.GENname +#define VCVSstates gen.GENstate const int VCVSposNode; /* number of positive node of source */ const int VCVSnegNode; /* number of negative node of source */ @@ -59,14 +61,13 @@ typedef struct sVCVSinstance { /* per model data */ typedef struct sVCVSmodel { /* model structure for a source */ - int VCVSmodType; /* type index of this device type */ - struct sVCVSmodel *VCVSnextModel; /* pointer to next possible model - *in linked list */ - VCVSinstance * VCVSinstances; /* pointer to list of instances - * that have this model */ - IFuid VCVSmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define VCVSmodType gen.GENmodType +#define VCVSnextModel(inst) ((struct sVCVSmodel *)((inst)->gen.GENnextModel)) +#define VCVSinstances(inst) ((VCVSinstance *)((inst)->gen.GENinstances)) +#define VCVSmodName gen.GENmodName } VCVSmodel; diff --git a/src/spicelib/devices/vsrc/vsrcdefs.h b/src/spicelib/devices/vsrc/vsrcdefs.h index 1c28fee5e..0c5cfeddb 100644 --- a/src/spicelib/devices/vsrc/vsrcdefs.h +++ b/src/spicelib/devices/vsrc/vsrcdefs.h @@ -21,11 +21,13 @@ struct trnoise_state; /* information needed for each instance */ typedef struct sVSRCinstance { - struct sVSRCmodel *VSRCmodPtr; /* backpointer to model */ - struct sVSRCinstance *VSRCnextInstance; /* pointer to next instance of - *current model */ - IFuid VSRCname; /* pointer to character string naming this instance */ - int VSRCstate; /* not used */ + + struct GENinstance gen; + +#define VSRCmodPtr(inst) ((struct sVSRCmodel *)((inst)->gen.GENmodPtr)) +#define VSRCnextInstance(inst) ((struct sVSRCinstance *)((inst)->gen.GENnextInstance)) +#define VSRCname gen.GENname +#define VSRCstate gen.GENstate const int VSRCposNode; /* number of positive node of source */ const int VSRCnegNode; /* number of negative node of source */ @@ -81,14 +83,13 @@ typedef struct sVSRCinstance { /* per model data */ typedef struct sVSRCmodel { - int VSRCmodType; /* type index of this device type */ - struct sVSRCmodel *VSRCnextModel; /* pointer to next possible model - *in linked list */ - VSRCinstance * VSRCinstances; /* pointer to list of instances - * that have this model */ - IFuid VSRCmodName; /* pointer to character string naming this model */ - /* --- end of generic struct GENmodel --- */ + struct GENmodel gen; + +#define VSRCmodType gen.GENmodType +#define VSRCnextModel(inst) ((struct sVSRCmodel *)((inst)->gen.GENnextModel)) +#define VSRCinstances(inst) ((VSRCinstance *)((inst)->gen.GENinstances)) +#define VSRCmodName gen.GENmodName } VSRCmodel;