From 9b45dbbbba4e20c0afc12217853a56a710d81262 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 9 Jan 2018 18:01:24 +0100 Subject: [PATCH] devices/**/*defs*.h, use a struct GENmodule slot --- src/include/ngspice/mifdefs.h | 11 ++++---- src/include/ngspice/numgen.h | 7 +----- src/spicelib/analysis/cktdisto.c | 8 +++--- src/spicelib/analysis/dctrcurv.c | 12 ++++----- src/spicelib/devices/asrc/asrcacld.c | 4 +-- src/spicelib/devices/asrc/asrcconv.c | 4 +-- src/spicelib/devices/asrc/asrcdefs.h | 12 ++++----- src/spicelib/devices/asrc/asrcdest.c | 4 +-- src/spicelib/devices/asrc/asrcfbr.c | 4 +-- src/spicelib/devices/asrc/asrcload.c | 4 +-- src/spicelib/devices/asrc/asrcpzld.c | 4 +-- src/spicelib/devices/asrc/asrcset.c | 8 +++--- src/spicelib/devices/asrc/asrctemp.c | 4 +-- src/spicelib/devices/bjt/bjtacld.c | 4 +-- src/spicelib/devices/bjt/bjtconv.c | 4 +-- src/spicelib/devices/bjt/bjtdefs.h | 12 ++++----- src/spicelib/devices/bjt/bjtdest.c | 4 +-- src/spicelib/devices/bjt/bjtdisto.c | 4 +-- src/spicelib/devices/bjt/bjtdset.c | 4 +-- src/spicelib/devices/bjt/bjtgetic.c | 4 +-- src/spicelib/devices/bjt/bjtload.c | 4 +-- src/spicelib/devices/bjt/bjtnoise.c | 4 +-- src/spicelib/devices/bjt/bjtpzld.c | 4 +-- src/spicelib/devices/bjt/bjtsacl.c | 4 +-- src/spicelib/devices/bjt/bjtsetup.c | 8 +++--- src/spicelib/devices/bjt/bjtsload.c | 4 +-- src/spicelib/devices/bjt/bjtsoachk.c | 4 +-- src/spicelib/devices/bjt/bjtsprt.c | 4 +-- src/spicelib/devices/bjt/bjtsset.c | 4 +-- src/spicelib/devices/bjt/bjtsupd.c | 4 +-- src/spicelib/devices/bjt/bjttemp.c | 4 +-- src/spicelib/devices/bjt/bjttrunc.c | 4 +-- src/spicelib/devices/bsim1/b1acld.c | 4 +-- src/spicelib/devices/bsim1/b1cvtest.c | 4 +-- src/spicelib/devices/bsim1/b1dest.c | 4 +-- src/spicelib/devices/bsim1/b1disto.c | 4 +-- src/spicelib/devices/bsim1/b1dset.c | 4 +-- src/spicelib/devices/bsim1/b1getic.c | 4 +-- src/spicelib/devices/bsim1/b1ld.c | 4 +-- src/spicelib/devices/bsim1/b1noi.c | 4 +-- src/spicelib/devices/bsim1/b1pzld.c | 4 +-- src/spicelib/devices/bsim1/b1set.c | 8 +++--- src/spicelib/devices/bsim1/b1temp.c | 4 +-- src/spicelib/devices/bsim1/b1trunc.c | 4 +-- src/spicelib/devices/bsim1/bsim1def.h | 12 ++++----- src/spicelib/devices/bsim2/b2acld.c | 4 +-- src/spicelib/devices/bsim2/b2cvtest.c | 4 +-- src/spicelib/devices/bsim2/b2dest.c | 4 +-- src/spicelib/devices/bsim2/b2getic.c | 4 +-- src/spicelib/devices/bsim2/b2ld.c | 4 +-- src/spicelib/devices/bsim2/b2noi.c | 4 +-- src/spicelib/devices/bsim2/b2pzld.c | 4 +-- src/spicelib/devices/bsim2/b2set.c | 8 +++--- src/spicelib/devices/bsim2/b2temp.c | 4 +-- src/spicelib/devices/bsim2/b2trunc.c | 4 +-- src/spicelib/devices/bsim2/bsim2def.h | 12 ++++----- src/spicelib/devices/bsim3/b3acld.c | 4 +-- src/spicelib/devices/bsim3/b3cvtest.c | 4 +-- src/spicelib/devices/bsim3/b3dest.c | 4 +-- src/spicelib/devices/bsim3/b3getic.c | 4 +-- src/spicelib/devices/bsim3/b3ld.c | 4 +-- src/spicelib/devices/bsim3/b3noi.c | 4 +-- src/spicelib/devices/bsim3/b3pzld.c | 4 +-- src/spicelib/devices/bsim3/b3set.c | 16 ++++++------ src/spicelib/devices/bsim3/b3soachk.c | 4 +-- src/spicelib/devices/bsim3/b3temp.c | 4 +-- src/spicelib/devices/bsim3/b3trunc.c | 4 +-- src/spicelib/devices/bsim3/bsim3def.h | 10 ++++---- .../devices/bsim3soi_dd/b3soiddacld.c | 4 +-- .../devices/bsim3soi_dd/b3soiddcvtest.c | 4 +-- src/spicelib/devices/bsim3soi_dd/b3soidddef.h | 10 ++++---- .../devices/bsim3soi_dd/b3soidddest.c | 4 +-- .../devices/bsim3soi_dd/b3soiddgetic.c | 4 +-- src/spicelib/devices/bsim3soi_dd/b3soiddld.c | 4 +-- src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c | 4 +-- .../devices/bsim3soi_dd/b3soiddpzld.c | 4 +-- src/spicelib/devices/bsim3soi_dd/b3soiddset.c | 8 +++--- .../devices/bsim3soi_dd/b3soiddtemp.c | 4 +-- .../devices/bsim3soi_dd/b3soiddtrunc.c | 4 +-- .../devices/bsim3soi_fd/b3soifdacld.c | 4 +-- .../devices/bsim3soi_fd/b3soifdcvtest.c | 4 +-- src/spicelib/devices/bsim3soi_fd/b3soifddef.h | 10 ++++---- .../devices/bsim3soi_fd/b3soifddest.c | 4 +-- .../devices/bsim3soi_fd/b3soifdgetic.c | 4 +-- src/spicelib/devices/bsim3soi_fd/b3soifdld.c | 4 +-- src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c | 4 +-- .../devices/bsim3soi_fd/b3soifdpzld.c | 4 +-- src/spicelib/devices/bsim3soi_fd/b3soifdset.c | 8 +++--- .../devices/bsim3soi_fd/b3soifdtemp.c | 4 +-- .../devices/bsim3soi_fd/b3soifdtrunc.c | 4 +-- .../devices/bsim3soi_pd/b3soipdacld.c | 4 +-- .../devices/bsim3soi_pd/b3soipdcvtest.c | 4 +-- src/spicelib/devices/bsim3soi_pd/b3soipddef.h | 10 ++++---- .../devices/bsim3soi_pd/b3soipddest.c | 4 +-- .../devices/bsim3soi_pd/b3soipdgetic.c | 4 +-- src/spicelib/devices/bsim3soi_pd/b3soipdld.c | 4 +-- src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c | 4 +-- .../devices/bsim3soi_pd/b3soipdpzld.c | 4 +-- src/spicelib/devices/bsim3soi_pd/b3soipdset.c | 8 +++--- .../devices/bsim3soi_pd/b3soipdtemp.c | 4 +-- .../devices/bsim3soi_pd/b3soipdtrunc.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0acld.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0cvtest.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0dest.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0getic.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0ld.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0noi.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0pzld.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0set.c | 8 +++--- src/spicelib/devices/bsim3v0/b3v0temp.c | 4 +-- src/spicelib/devices/bsim3v0/b3v0trunc.c | 4 +-- src/spicelib/devices/bsim3v0/bsim3v0def.h | 10 ++++---- src/spicelib/devices/bsim3v1/b3v1acld.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1cvtest.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1dest.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1getic.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1ld.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1noi.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1pzld.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1set.c | 8 +++--- src/spicelib/devices/bsim3v1/b3v1temp.c | 4 +-- src/spicelib/devices/bsim3v1/b3v1trunc.c | 4 +-- src/spicelib/devices/bsim3v1/bsim3v1def.h | 10 ++++---- src/spicelib/devices/bsim3v32/b3v32acld.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32cvtest.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32dest.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32getic.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32ld.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32noi.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32pzld.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32set.c | 16 ++++++------ src/spicelib/devices/bsim3v32/b3v32soachk.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32temp.c | 4 +-- src/spicelib/devices/bsim3v32/b3v32trunc.c | 4 +-- src/spicelib/devices/bsim3v32/bsim3v32def.h | 10 ++++---- src/spicelib/devices/bsim4/b4acld.c | 4 +-- src/spicelib/devices/bsim4/b4cvtest.c | 4 +-- src/spicelib/devices/bsim4/b4dest.c | 4 +-- src/spicelib/devices/bsim4/b4getic.c | 4 +-- src/spicelib/devices/bsim4/b4ld.c | 4 +-- src/spicelib/devices/bsim4/b4noi.c | 4 +-- src/spicelib/devices/bsim4/b4pzld.c | 4 +-- src/spicelib/devices/bsim4/b4set.c | 16 ++++++------ src/spicelib/devices/bsim4/b4soachk.c | 4 +-- src/spicelib/devices/bsim4/b4temp.c | 4 +-- src/spicelib/devices/bsim4/b4trunc.c | 4 +-- src/spicelib/devices/bsim4/bsim4def.h | 10 ++++---- src/spicelib/devices/bsim4v5/b4v5acld.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5cvtest.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5dest.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5getic.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5ld.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5noi.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5pzld.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5set.c | 16 ++++++------ src/spicelib/devices/bsim4v5/b4v5soachk.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5temp.c | 4 +-- src/spicelib/devices/bsim4v5/b4v5trunc.c | 4 +-- src/spicelib/devices/bsim4v5/bsim4v5def.h | 10 ++++---- src/spicelib/devices/bsim4v6/b4v6acld.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6cvtest.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6dest.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6getic.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6ld.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6noi.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6pzld.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6set.c | 16 ++++++------ src/spicelib/devices/bsim4v6/b4v6soachk.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6temp.c | 4 +-- src/spicelib/devices/bsim4v6/b4v6trunc.c | 4 +-- src/spicelib/devices/bsim4v6/bsim4v6def.h | 10 ++++---- src/spicelib/devices/bsim4v7/b4v7acld.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7cvtest.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7dest.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7getic.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7ld.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7noi.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7pzld.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7set.c | 16 ++++++------ src/spicelib/devices/bsim4v7/b4v7soachk.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7temp.c | 4 +-- src/spicelib/devices/bsim4v7/b4v7trunc.c | 4 +-- src/spicelib/devices/bsim4v7/bsim4v7def.h | 10 ++++---- src/spicelib/devices/bsimsoi/b4soiacld.c | 4 +-- src/spicelib/devices/bsimsoi/b4soicvtest.c | 4 +-- src/spicelib/devices/bsimsoi/b4soidef.h | 10 ++++---- src/spicelib/devices/bsimsoi/b4soidest.c | 4 +-- src/spicelib/devices/bsimsoi/b4soigetic.c | 4 +-- src/spicelib/devices/bsimsoi/b4soild.c | 4 +-- src/spicelib/devices/bsimsoi/b4soinoi.c | 4 +-- src/spicelib/devices/bsimsoi/b4soipzld.c | 4 +-- src/spicelib/devices/bsimsoi/b4soiset.c | 16 ++++++------ src/spicelib/devices/bsimsoi/b4soisoachk.c | 4 +-- src/spicelib/devices/bsimsoi/b4soitemp.c | 4 +-- src/spicelib/devices/bsimsoi/b4soitrunc.c | 4 +-- src/spicelib/devices/cap/capacld.c | 4 +-- src/spicelib/devices/cap/capdefs.h | 12 ++++----- src/spicelib/devices/cap/capdest.c | 4 +-- src/spicelib/devices/cap/capgetic.c | 4 +-- src/spicelib/devices/cap/capload.c | 4 +-- src/spicelib/devices/cap/cappzld.c | 4 +-- src/spicelib/devices/cap/capsacl.c | 4 +-- src/spicelib/devices/cap/capsetup.c | 4 +-- src/spicelib/devices/cap/capsload.c | 4 +-- src/spicelib/devices/cap/capsoachk.c | 4 +-- src/spicelib/devices/cap/capsprt.c | 4 +-- src/spicelib/devices/cap/capsset.c | 4 +-- src/spicelib/devices/cap/capsupd.c | 4 +-- src/spicelib/devices/cap/captemp.c | 4 +-- src/spicelib/devices/cap/captrunc.c | 4 +-- src/spicelib/devices/cccs/cccsdefs.h | 12 ++++----- src/spicelib/devices/cccs/cccsdest.c | 4 +-- src/spicelib/devices/cccs/cccsload.c | 4 +-- src/spicelib/devices/cccs/cccspzld.c | 4 +-- src/spicelib/devices/cccs/cccssacl.c | 4 +-- src/spicelib/devices/cccs/cccsset.c | 4 +-- src/spicelib/devices/cccs/cccssld.c | 4 +-- src/spicelib/devices/cccs/cccssprt.c | 4 +-- src/spicelib/devices/cccs/cccssset.c | 4 +-- src/spicelib/devices/ccvs/ccvsdefs.h | 12 ++++----- src/spicelib/devices/ccvs/ccvsdest.c | 4 +-- src/spicelib/devices/ccvs/ccvsfbr.c | 4 +-- src/spicelib/devices/ccvs/ccvsload.c | 4 +-- src/spicelib/devices/ccvs/ccvspzld.c | 4 +-- src/spicelib/devices/ccvs/ccvssacl.c | 4 +-- src/spicelib/devices/ccvs/ccvsset.c | 8 +++--- src/spicelib/devices/ccvs/ccvssld.c | 4 +-- src/spicelib/devices/ccvs/ccvssprt.c | 4 +-- src/spicelib/devices/ccvs/ccvssset.c | 4 +-- src/spicelib/devices/cpl/cpldefs.h | 12 ++++----- src/spicelib/devices/cpl/cpldest.c | 4 +-- src/spicelib/devices/cpl/cplload.c | 8 +++--- src/spicelib/devices/cpl/cplsetup.c | 8 +++--- src/spicelib/devices/csw/cswacld.c | 4 +-- src/spicelib/devices/csw/cswdefs.h | 12 ++++----- src/spicelib/devices/csw/cswdest.c | 4 +-- src/spicelib/devices/csw/cswload.c | 4 +-- src/spicelib/devices/csw/cswnoise.c | 4 +-- src/spicelib/devices/csw/cswpzld.c | 4 +-- src/spicelib/devices/csw/cswsetup.c | 4 +-- src/spicelib/devices/csw/cswtrunc.c | 4 +-- src/spicelib/devices/dio/dioacld.c | 4 +-- src/spicelib/devices/dio/dioconv.c | 4 +-- src/spicelib/devices/dio/diodefs.h | 12 ++++----- src/spicelib/devices/dio/diodest.c | 4 +-- src/spicelib/devices/dio/diodisto.c | 4 +-- src/spicelib/devices/dio/diodset.c | 4 +-- src/spicelib/devices/dio/diogetic.c | 4 +-- src/spicelib/devices/dio/dioload.c | 4 +-- src/spicelib/devices/dio/dionoise.c | 4 +-- src/spicelib/devices/dio/diopzld.c | 4 +-- src/spicelib/devices/dio/diosacl.c | 4 +-- src/spicelib/devices/dio/diosetup.c | 8 +++--- src/spicelib/devices/dio/diosload.c | 4 +-- src/spicelib/devices/dio/diosoachk.c | 4 +-- src/spicelib/devices/dio/diosprt.c | 4 +-- src/spicelib/devices/dio/diosset.c | 4 +-- src/spicelib/devices/dio/diosupd.c | 4 +-- src/spicelib/devices/dio/diotemp.c | 4 +-- src/spicelib/devices/dio/diotrunc.c | 4 +-- src/spicelib/devices/hfet1/hfetacl.c | 4 +-- src/spicelib/devices/hfet1/hfetdefs.h | 10 ++++---- src/spicelib/devices/hfet1/hfetdest.c | 4 +-- src/spicelib/devices/hfet1/hfetgetic.c | 4 +-- src/spicelib/devices/hfet1/hfetload.c | 4 +-- src/spicelib/devices/hfet1/hfetpzl.c | 4 +-- src/spicelib/devices/hfet1/hfetsetup.c | 8 +++--- src/spicelib/devices/hfet1/hfettemp.c | 4 +-- src/spicelib/devices/hfet1/hfettrunc.c | 4 +-- src/spicelib/devices/hfet2/hfet2acl.c | 4 +-- src/spicelib/devices/hfet2/hfet2defs.h | 10 ++++---- src/spicelib/devices/hfet2/hfet2dest.c | 4 +-- src/spicelib/devices/hfet2/hfet2getic.c | 4 +-- src/spicelib/devices/hfet2/hfet2load.c | 4 +-- src/spicelib/devices/hfet2/hfet2pzl.c | 4 +-- src/spicelib/devices/hfet2/hfet2setup.c | 8 +++--- src/spicelib/devices/hfet2/hfet2temp.c | 4 +-- src/spicelib/devices/hfet2/hfet2trunc.c | 4 +-- src/spicelib/devices/hisim2/hsm2acld.c | 4 +-- src/spicelib/devices/hisim2/hsm2cvtest.c | 4 +-- src/spicelib/devices/hisim2/hsm2def.h | 12 ++++----- src/spicelib/devices/hisim2/hsm2dest.c | 4 +-- src/spicelib/devices/hisim2/hsm2getic.c | 4 +-- src/spicelib/devices/hisim2/hsm2ld.c | 4 +-- src/spicelib/devices/hisim2/hsm2noi.c | 4 +-- src/spicelib/devices/hisim2/hsm2pzld.c | 4 +-- src/spicelib/devices/hisim2/hsm2set.c | 16 ++++++------ src/spicelib/devices/hisim2/hsm2soachk.c | 4 +-- src/spicelib/devices/hisim2/hsm2temp.c | 4 +-- src/spicelib/devices/hisim2/hsm2trunc.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvacld.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvcvtest.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvdef.h | 12 ++++----- src/spicelib/devices/hisimhv1/hsmhvdest.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvgetic.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvld.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvnoi.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvpzld.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvset.c | 8 +++--- src/spicelib/devices/hisimhv1/hsmhvsoachk.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvtemp.c | 4 +-- src/spicelib/devices/hisimhv1/hsmhvtrunc.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2acld.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2cvtest.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2def.h | 12 ++++----- src/spicelib/devices/hisimhv2/hsmhv2dest.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2getic.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2ld.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2noi.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2pzld.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2set.c | 8 +++--- src/spicelib/devices/hisimhv2/hsmhv2soachk.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2temp.c | 4 +-- src/spicelib/devices/hisimhv2/hsmhv2trunc.c | 4 +-- src/spicelib/devices/ind/indacld.c | 4 +-- src/spicelib/devices/ind/inddefs.h | 25 ++++++++----------- src/spicelib/devices/ind/inddest.c | 4 +-- src/spicelib/devices/ind/indload.c | 12 ++++----- src/spicelib/devices/ind/indpzld.c | 4 +-- src/spicelib/devices/ind/indsacl.c | 12 ++++----- src/spicelib/devices/ind/indsetup.c | 8 +++--- src/spicelib/devices/ind/indsload.c | 12 ++++----- src/spicelib/devices/ind/indsprt.c | 4 +-- src/spicelib/devices/ind/indsset.c | 4 +-- src/spicelib/devices/ind/indsupd.c | 12 ++++----- src/spicelib/devices/ind/indtemp.c | 4 +-- src/spicelib/devices/ind/indtrunc.c | 4 +-- src/spicelib/devices/ind/mutacld.c | 4 +-- src/spicelib/devices/ind/mutdest.c | 4 +-- src/spicelib/devices/ind/mutpzld.c | 4 +-- src/spicelib/devices/ind/mutsetup.c | 4 +-- src/spicelib/devices/ind/mutsprt.c | 4 +-- src/spicelib/devices/ind/mutsset.c | 4 +-- src/spicelib/devices/ind/muttemp.c | 4 +-- src/spicelib/devices/isrc/isrcacct.c | 4 +-- src/spicelib/devices/isrc/isrcacld.c | 4 +-- src/spicelib/devices/isrc/isrcdefs.h | 12 ++++----- src/spicelib/devices/isrc/isrcdest.c | 4 +-- src/spicelib/devices/isrc/isrcload.c | 4 +-- src/spicelib/devices/isrc/isrctemp.c | 4 +-- src/spicelib/devices/jfet/jfetacld.c | 4 +-- src/spicelib/devices/jfet/jfetdefs.h | 12 ++++----- src/spicelib/devices/jfet/jfetdest.c | 4 +-- src/spicelib/devices/jfet/jfetdist.c | 4 +-- src/spicelib/devices/jfet/jfetdset.c | 4 +-- src/spicelib/devices/jfet/jfetic.c | 4 +-- src/spicelib/devices/jfet/jfetload.c | 4 +-- src/spicelib/devices/jfet/jfetnoi.c | 4 +-- src/spicelib/devices/jfet/jfetpzld.c | 4 +-- src/spicelib/devices/jfet/jfetset.c | 8 +++--- src/spicelib/devices/jfet/jfettemp.c | 4 +-- src/spicelib/devices/jfet/jfettrun.c | 4 +-- src/spicelib/devices/jfet2/jfet2acld.c | 4 +-- src/spicelib/devices/jfet2/jfet2defs.h | 12 ++++----- src/spicelib/devices/jfet2/jfet2dest.c | 4 +-- src/spicelib/devices/jfet2/jfet2ic.c | 4 +-- src/spicelib/devices/jfet2/jfet2load.c | 4 +-- src/spicelib/devices/jfet2/jfet2noi.c | 4 +-- src/spicelib/devices/jfet2/jfet2set.c | 8 +++--- src/spicelib/devices/jfet2/jfet2temp.c | 4 +-- src/spicelib/devices/jfet2/jfet2trun.c | 4 +-- src/spicelib/devices/ltra/ltraacct.c | 8 +++--- src/spicelib/devices/ltra/ltraacld.c | 4 +-- src/spicelib/devices/ltra/ltradefs.h | 12 ++++----- src/spicelib/devices/ltra/ltradest.c | 4 +-- src/spicelib/devices/ltra/ltraload.c | 4 +-- src/spicelib/devices/ltra/ltraset.c | 8 +++--- src/spicelib/devices/ltra/ltratemp.c | 4 +-- src/spicelib/devices/ltra/ltratrun.c | 4 +-- src/spicelib/devices/mes/mesacl.c | 4 +-- src/spicelib/devices/mes/mesdefs.h | 12 ++++----- src/spicelib/devices/mes/mesdest.c | 4 +-- src/spicelib/devices/mes/mesdisto.c | 4 +-- src/spicelib/devices/mes/mesdset.c | 4 +-- src/spicelib/devices/mes/mesgetic.c | 4 +-- src/spicelib/devices/mes/mesload.c | 4 +-- src/spicelib/devices/mes/mesnoise.c | 4 +-- src/spicelib/devices/mes/mespzld.c | 4 +-- src/spicelib/devices/mes/messetup.c | 8 +++--- src/spicelib/devices/mes/mestemp.c | 2 +- src/spicelib/devices/mes/mestrunc.c | 4 +-- src/spicelib/devices/mesa/mesaacl.c | 4 +-- src/spicelib/devices/mesa/mesadefs.h | 12 ++++----- src/spicelib/devices/mesa/mesadest.c | 4 +-- src/spicelib/devices/mesa/mesagetic.c | 4 +-- src/spicelib/devices/mesa/mesaload.c | 4 +-- src/spicelib/devices/mesa/mesapzl.c | 4 +-- src/spicelib/devices/mesa/mesasetup.c | 8 +++--- src/spicelib/devices/mesa/mesatemp.c | 4 +-- src/spicelib/devices/mesa/mesatrunc.c | 4 +-- src/spicelib/devices/mos1/mos1acld.c | 4 +-- src/spicelib/devices/mos1/mos1conv.c | 4 +-- src/spicelib/devices/mos1/mos1defs.h | 12 ++++----- src/spicelib/devices/mos1/mos1dest.c | 4 +-- src/spicelib/devices/mos1/mos1dist.c | 4 +-- src/spicelib/devices/mos1/mos1dset.c | 4 +-- src/spicelib/devices/mos1/mos1ic.c | 4 +-- src/spicelib/devices/mos1/mos1load.c | 4 +-- src/spicelib/devices/mos1/mos1noi.c | 4 +-- src/spicelib/devices/mos1/mos1pzld.c | 4 +-- src/spicelib/devices/mos1/mos1sacl.c | 4 +-- src/spicelib/devices/mos1/mos1set.c | 8 +++--- src/spicelib/devices/mos1/mos1sld.c | 4 +-- src/spicelib/devices/mos1/mos1sprt.c | 4 +-- src/spicelib/devices/mos1/mos1sset.c | 4 +-- src/spicelib/devices/mos1/mos1supd.c | 4 +-- src/spicelib/devices/mos1/mos1temp.c | 4 +-- src/spicelib/devices/mos1/mos1trun.c | 4 +-- src/spicelib/devices/mos2/mos2acld.c | 4 +-- src/spicelib/devices/mos2/mos2conv.c | 4 +-- src/spicelib/devices/mos2/mos2defs.h | 12 ++++----- src/spicelib/devices/mos2/mos2dest.c | 4 +-- src/spicelib/devices/mos2/mos2dist.c | 4 +-- src/spicelib/devices/mos2/mos2dset.c | 4 +-- src/spicelib/devices/mos2/mos2ic.c | 4 +-- src/spicelib/devices/mos2/mos2load.c | 4 +-- src/spicelib/devices/mos2/mos2noi.c | 4 +-- src/spicelib/devices/mos2/mos2pzld.c | 4 +-- src/spicelib/devices/mos2/mos2sacl.c | 4 +-- src/spicelib/devices/mos2/mos2set.c | 8 +++--- src/spicelib/devices/mos2/mos2sld.c | 4 +-- src/spicelib/devices/mos2/mos2sprt.c | 4 +-- src/spicelib/devices/mos2/mos2sset.c | 4 +-- src/spicelib/devices/mos2/mos2supd.c | 4 +-- src/spicelib/devices/mos2/mos2temp.c | 4 +-- src/spicelib/devices/mos2/mos2trun.c | 4 +-- src/spicelib/devices/mos3/mos3acld.c | 4 +-- src/spicelib/devices/mos3/mos3conv.c | 4 +-- src/spicelib/devices/mos3/mos3defs.h | 12 ++++----- src/spicelib/devices/mos3/mos3dest.c | 4 +-- src/spicelib/devices/mos3/mos3dist.c | 4 +-- src/spicelib/devices/mos3/mos3dset.c | 4 +-- src/spicelib/devices/mos3/mos3ic.c | 4 +-- src/spicelib/devices/mos3/mos3load.c | 4 +-- src/spicelib/devices/mos3/mos3noi.c | 4 +-- src/spicelib/devices/mos3/mos3pzld.c | 4 +-- src/spicelib/devices/mos3/mos3sacl.c | 4 +-- src/spicelib/devices/mos3/mos3set.c | 8 +++--- src/spicelib/devices/mos3/mos3sld.c | 4 +-- src/spicelib/devices/mos3/mos3sprt.c | 4 +-- src/spicelib/devices/mos3/mos3sset.c | 4 +-- src/spicelib/devices/mos3/mos3supd.c | 4 +-- src/spicelib/devices/mos3/mos3temp.c | 4 +-- src/spicelib/devices/mos3/mos3trun.c | 4 +-- src/spicelib/devices/mos6/mos6conv.c | 4 +-- src/spicelib/devices/mos6/mos6defs.h | 12 ++++----- src/spicelib/devices/mos6/mos6dest.c | 4 +-- src/spicelib/devices/mos6/mos6ic.c | 4 +-- src/spicelib/devices/mos6/mos6load.c | 4 +-- src/spicelib/devices/mos6/mos6set.c | 8 +++--- src/spicelib/devices/mos6/mos6temp.c | 4 +-- src/spicelib/devices/mos6/mos6trun.c | 4 +-- src/spicelib/devices/mos9/mos9acld.c | 4 +-- src/spicelib/devices/mos9/mos9conv.c | 4 +-- src/spicelib/devices/mos9/mos9defs.h | 12 ++++----- src/spicelib/devices/mos9/mos9dest.c | 4 +-- src/spicelib/devices/mos9/mos9dist.c | 4 +-- src/spicelib/devices/mos9/mos9dset.c | 4 +-- src/spicelib/devices/mos9/mos9ic.c | 4 +-- src/spicelib/devices/mos9/mos9load.c | 4 +-- src/spicelib/devices/mos9/mos9noi.c | 4 +-- src/spicelib/devices/mos9/mos9pzld.c | 4 +-- src/spicelib/devices/mos9/mos9sacl.c | 4 +-- src/spicelib/devices/mos9/mos9set.c | 8 +++--- src/spicelib/devices/mos9/mos9sld.c | 4 +-- src/spicelib/devices/mos9/mos9sprt.c | 4 +-- src/spicelib/devices/mos9/mos9sset.c | 4 +-- src/spicelib/devices/mos9/mos9supd.c | 4 +-- src/spicelib/devices/mos9/mos9temp.c | 4 +-- src/spicelib/devices/mos9/mos9trun.c | 4 +-- src/spicelib/devices/nbjt/nbjtacld.c | 4 +-- src/spicelib/devices/nbjt/nbjtdefs.h | 13 ++++------ src/spicelib/devices/nbjt/nbjtdest.c | 4 +-- src/spicelib/devices/nbjt/nbjtdump.c | 8 +++--- src/spicelib/devices/nbjt/nbjtload.c | 4 +-- src/spicelib/devices/nbjt/nbjtpzld.c | 4 +-- src/spicelib/devices/nbjt/nbjtset.c | 4 +-- src/spicelib/devices/nbjt/nbjttemp.c | 4 +-- src/spicelib/devices/nbjt/nbjttrun.c | 4 +-- src/spicelib/devices/nbjt2/nbjt2def.h | 13 ++++------ src/spicelib/devices/nbjt2/nbt2acld.c | 4 +-- src/spicelib/devices/nbjt2/nbt2dest.c | 4 +-- src/spicelib/devices/nbjt2/nbt2dump.c | 8 +++--- src/spicelib/devices/nbjt2/nbt2load.c | 4 +-- src/spicelib/devices/nbjt2/nbt2pzld.c | 4 +-- src/spicelib/devices/nbjt2/nbt2set.c | 4 +-- src/spicelib/devices/nbjt2/nbt2temp.c | 4 +-- src/spicelib/devices/nbjt2/nbt2trun.c | 4 +-- src/spicelib/devices/ndev/ndevaccept.c | 8 +++--- src/spicelib/devices/ndev/ndevdefs.h | 15 +++++------ src/spicelib/devices/ndev/ndevdest.c | 4 +-- src/spicelib/devices/ndev/ndevload.c | 12 ++++----- src/spicelib/devices/ndev/ndevset.c | 4 +-- src/spicelib/devices/numd/numdacld.c | 4 +-- src/spicelib/devices/numd/numddefs.h | 13 ++++------ src/spicelib/devices/numd/numddest.c | 4 +-- src/spicelib/devices/numd/numddump.c | 8 +++--- src/spicelib/devices/numd/numdload.c | 4 +-- src/spicelib/devices/numd/numdpzld.c | 4 +-- src/spicelib/devices/numd/numdset.c | 4 +-- src/spicelib/devices/numd/numdtemp.c | 4 +-- src/spicelib/devices/numd/numdtrun.c | 4 +-- src/spicelib/devices/numd2/nud2acld.c | 4 +-- src/spicelib/devices/numd2/nud2dest.c | 4 +-- src/spicelib/devices/numd2/nud2dump.c | 8 +++--- src/spicelib/devices/numd2/nud2load.c | 4 +-- src/spicelib/devices/numd2/nud2pzld.c | 4 +-- src/spicelib/devices/numd2/nud2set.c | 4 +-- src/spicelib/devices/numd2/nud2temp.c | 4 +-- src/spicelib/devices/numd2/nud2trun.c | 4 +-- src/spicelib/devices/numd2/numd2def.h | 13 ++++------ src/spicelib/devices/numos/nummacld.c | 4 +-- src/spicelib/devices/numos/nummdest.c | 4 +-- src/spicelib/devices/numos/nummdump.c | 8 +++--- src/spicelib/devices/numos/nummload.c | 4 +-- src/spicelib/devices/numos/nummpzld.c | 4 +-- src/spicelib/devices/numos/nummset.c | 4 +-- src/spicelib/devices/numos/nummtemp.c | 4 +-- src/spicelib/devices/numos/nummtrun.c | 4 +-- src/spicelib/devices/numos/numosdef.h | 10 ++++---- src/spicelib/devices/res/resdefs.h | 12 ++++----- src/spicelib/devices/res/resdest.c | 4 +-- src/spicelib/devices/res/resload.c | 8 +++--- src/spicelib/devices/res/resnoise.c | 4 +-- src/spicelib/devices/res/respzld.c | 4 +-- src/spicelib/devices/res/ressacl.c | 4 +-- src/spicelib/devices/res/ressetup.c | 4 +-- src/spicelib/devices/res/ressload.c | 4 +-- src/spicelib/devices/res/ressoachk.c | 4 +-- src/spicelib/devices/res/ressprt.c | 4 +-- src/spicelib/devices/res/ressset.c | 4 +-- src/spicelib/devices/res/restemp.c | 4 +-- src/spicelib/devices/soi3/soi3acld.c | 4 +-- src/spicelib/devices/soi3/soi3conv.c | 4 +-- src/spicelib/devices/soi3/soi3defs.h | 12 ++++----- src/spicelib/devices/soi3/soi3dest.c | 4 +-- src/spicelib/devices/soi3/soi3ic.c | 4 +-- src/spicelib/devices/soi3/soi3load.c | 4 +-- src/spicelib/devices/soi3/soi3nois.c | 4 +-- src/spicelib/devices/soi3/soi3set.c | 8 +++--- src/spicelib/devices/soi3/soi3temp.c | 4 +-- src/spicelib/devices/soi3/soi3trun.c | 4 +-- src/spicelib/devices/sw/swacload.c | 4 +-- src/spicelib/devices/sw/swdefs.h | 12 ++++----- src/spicelib/devices/sw/swdest.c | 4 +-- src/spicelib/devices/sw/swload.c | 4 +-- src/spicelib/devices/sw/swnoise.c | 4 +-- src/spicelib/devices/sw/swpzload.c | 4 +-- src/spicelib/devices/sw/swsetup.c | 4 +-- src/spicelib/devices/sw/swtrunc.c | 4 +-- src/spicelib/devices/tra/traacct.c | 4 +-- src/spicelib/devices/tra/traacld.c | 4 +-- src/spicelib/devices/tra/tradefs.h | 12 ++++----- src/spicelib/devices/tra/tradest.c | 4 +-- src/spicelib/devices/tra/traload.c | 4 +-- src/spicelib/devices/tra/trasetup.c | 8 +++--- src/spicelib/devices/tra/tratemp.c | 4 +-- src/spicelib/devices/tra/tratrunc.c | 4 +-- src/spicelib/devices/txl/txlacct.c | 8 +++--- src/spicelib/devices/txl/txldefs.h | 12 ++++----- src/spicelib/devices/txl/txldest.c | 4 +-- src/spicelib/devices/txl/txlfbr.c | 4 +-- src/spicelib/devices/txl/txlload.c | 8 +++--- src/spicelib/devices/txl/txlsetup.c | 8 +++--- src/spicelib/devices/urc/urcdefs.h | 12 ++++----- src/spicelib/devices/urc/urcdest.c | 4 +-- src/spicelib/devices/urc/urcsetup.c | 8 +++--- src/spicelib/devices/vbic/vbicacld.c | 4 +-- src/spicelib/devices/vbic/vbicconv.c | 4 +-- src/spicelib/devices/vbic/vbicdefs.h | 13 ++++------ src/spicelib/devices/vbic/vbicdest.c | 4 +-- src/spicelib/devices/vbic/vbicgetic.c | 4 +-- src/spicelib/devices/vbic/vbicload.c | 4 +-- src/spicelib/devices/vbic/vbicnoise.c | 4 +-- src/spicelib/devices/vbic/vbicpzld.c | 4 +-- src/spicelib/devices/vbic/vbicsetup.c | 8 +++--- src/spicelib/devices/vbic/vbicsoachk.c | 4 +-- src/spicelib/devices/vbic/vbictemp.c | 4 +-- src/spicelib/devices/vbic/vbictrunc.c | 4 +-- src/spicelib/devices/vccs/vccsdefs.h | 12 ++++----- src/spicelib/devices/vccs/vccsdest.c | 4 +-- src/spicelib/devices/vccs/vccsload.c | 4 +-- src/spicelib/devices/vccs/vccspzld.c | 4 +-- src/spicelib/devices/vccs/vccssacl.c | 4 +-- src/spicelib/devices/vccs/vccsset.c | 4 +-- src/spicelib/devices/vccs/vccssld.c | 4 +-- src/spicelib/devices/vccs/vccssprt.c | 4 +-- src/spicelib/devices/vccs/vccssset.c | 4 +-- src/spicelib/devices/vcvs/vcvsdefs.h | 12 ++++----- src/spicelib/devices/vcvs/vcvsdest.c | 4 +-- src/spicelib/devices/vcvs/vcvsfbr.c | 4 +-- src/spicelib/devices/vcvs/vcvsload.c | 4 +-- src/spicelib/devices/vcvs/vcvspzld.c | 4 +-- src/spicelib/devices/vcvs/vcvssacl.c | 4 +-- src/spicelib/devices/vcvs/vcvsset.c | 8 +++--- src/spicelib/devices/vcvs/vcvssld.c | 4 +-- src/spicelib/devices/vcvs/vcvssprt.c | 4 +-- src/spicelib/devices/vcvs/vcvssset.c | 4 +-- src/spicelib/devices/vsrc/vsrcacct.c | 4 +-- src/spicelib/devices/vsrc/vsrcacld.c | 4 +-- src/spicelib/devices/vsrc/vsrcdefs.h | 12 ++++----- src/spicelib/devices/vsrc/vsrcdest.c | 4 +-- src/spicelib/devices/vsrc/vsrcfbr.c | 4 +-- src/spicelib/devices/vsrc/vsrcload.c | 4 +-- src/spicelib/devices/vsrc/vsrcpzld.c | 4 +-- src/spicelib/devices/vsrc/vsrcpzs.c | 4 +-- src/spicelib/devices/vsrc/vsrcset.c | 8 +++--- src/spicelib/devices/vsrc/vsrctemp.c | 4 +-- src/xspice/cm/cmmeters.c | 24 +++++++++--------- src/xspice/mif/mifconvt.c | 4 +-- src/xspice/mif/mifload.c | 4 +-- src/xspice/mif/mifsetup.c | 14 +++++------ src/xspice/mif/miftrunc.c | 4 +-- 613 files changed, 1579 insertions(+), 1670 deletions(-) diff --git a/src/include/ngspice/mifdefs.h b/src/include/ngspice/mifdefs.h index ae472d91b..f12e00864 100644 --- a/src/include/ngspice/mifdefs.h +++ b/src/include/ngspice/mifdefs.h @@ -44,6 +44,7 @@ NON-STANDARD FEATURES #include "ngspice/mifcmdat.h" +#include "ngspice/gendefs.h" #include "ngspice/ifsim.h" @@ -89,12 +90,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..76f521a08 100644 --- a/src/include/ngspice/numgen.h +++ b/src/include/ngspice/numgen.h @@ -19,12 +19,7 @@ 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; /* Everything below here is numerical-device-specific */ MESHcard *GENxMeshes; /* list of xmesh cards */ diff --git a/src/spicelib/analysis/cktdisto.c b/src/spicelib/analysis/cktdisto.c index 824218f5a..439f848ac 100644 --- a/src/spicelib/analysis/cktdisto.c +++ b/src/spicelib/analysis/cktdisto.c @@ -89,8 +89,8 @@ CKTdisto (CKTcircuit *ckt, int mode) VSRCinstance *here; VSRCmodel *model; for(model = (VSRCmodel *)ckt->CKThead[vcode];model != NULL; - model=model->VSRCnextModel){ - for(here=model->VSRCinstances;here!=NULL; + model=VSRCnextModel(model)){ + for(here=VSRCinstances(model);here!=NULL; here=here->VSRCnextInstance) { /* check if the source has a distortion input*/ @@ -125,8 +125,8 @@ if (((here->VSRCdF1given) && (mode == D_RHSF1)) || ISRCmodel *model; for(model= (ISRCmodel *)ckt->CKThead[icode];model != NULL; - model=model->ISRCnextModel){ - for(here=model->ISRCinstances;here!=NULL; + model=ISRCnextModel(model)){ + for(here=ISRCinstances(model);here!=NULL; here=here->ISRCnextInstance) { /* check if the source has a distortion input*/ diff --git a/src/spicelib/analysis/dctrcurv.c b/src/spicelib/analysis/dctrcurv.c index dec1e4475..a9004cdbf 100644 --- a/src/spicelib/analysis/dctrcurv.c +++ b/src/spicelib/analysis/dctrcurv.c @@ -90,8 +90,8 @@ DCtrCurv(CKTcircuit *ckt, int restart) RESinstance *here; RESmodel *model; - for (model = (RESmodel *)ckt->CKThead[rcode]; model; model = model->RESnextModel) - for (here = model->RESinstances; here; here = here->RESnextInstance) + for (model = (RESmodel *)ckt->CKThead[rcode]; model; model = RESnextModel(model)) + for (here = RESinstances(model); here; here = here->RESnextInstance) if (here->RESname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->RESresist; @@ -109,8 +109,8 @@ DCtrCurv(CKTcircuit *ckt, int restart) VSRCinstance *here; VSRCmodel *model; - for (model = (VSRCmodel *)ckt->CKThead[vcode]; model; model = model->VSRCnextModel) - for (here = model->VSRCinstances; here; here = here->VSRCnextInstance) + for (model = (VSRCmodel *)ckt->CKThead[vcode]; model; model = VSRCnextModel(model)) + for (here = VSRCinstances(model); here; here = here->VSRCnextInstance) if (here->VSRCname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->VSRCdcValue; @@ -127,8 +127,8 @@ DCtrCurv(CKTcircuit *ckt, int restart) ISRCinstance *here; ISRCmodel *model; - for (model = (ISRCmodel *)ckt->CKThead[icode]; model; model = model->ISRCnextModel) - for (here = model->ISRCinstances; here; here = here->ISRCnextInstance) + for (model = (ISRCmodel *)ckt->CKThead[icode]; model; model = ISRCnextModel(model)) + for (here = ISRCinstances(model); here; here = here->ISRCnextInstance) if (here->ISRCname == job->TRCVvName[i]) { job->TRCVvElt[i] = (GENinstance *)here; job->TRCVvSave[i] = here->ISRCdcValue; diff --git a/src/spicelib/devices/asrc/asrcacld.c b/src/spicelib/devices/asrc/asrcacld.c index 2ab34c00f..55adbdf3c 100644 --- a/src/spicelib/devices/asrc/asrcacld.c +++ b/src/spicelib/devices/asrc/asrcacld.c @@ -28,8 +28,8 @@ ASRCacLoad(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcconv.c b/src/spicelib/devices/asrc/asrcconv.c index 1ec374271..bc57c306b 100644 --- a/src/spicelib/devices/asrc/asrcconv.c +++ b/src/spicelib/devices/asrc/asrcconv.c @@ -21,8 +21,8 @@ ASRCconvTest(GENmodel *inModel, CKTcircuit *ckt) double tol; double rhs; - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { i = here->ASRCtree->numVars; if (asrc_nvals < i) { diff --git a/src/spicelib/devices/asrc/asrcdefs.h b/src/spicelib/devices/asrc/asrcdefs.h index ffc21ca03..058371298 100644 --- a/src/spicelib/devices/asrc/asrcdefs.h +++ b/src/spicelib/devices/asrc/asrcdefs.h @@ -56,14 +56,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/asrc/asrcdest.c b/src/spicelib/devices/asrc/asrcdest.c index 9289cfd66..fffc5de89 100644 --- a/src/spicelib/devices/asrc/asrcdest.c +++ b/src/spicelib/devices/asrc/asrcdest.c @@ -15,8 +15,8 @@ ASRCdestroy(GENmodel **inModel) ASRCmodel *mod = *(ASRCmodel**) inModel; while (mod) { - ASRCmodel *next_mod = mod->ASRCnextModel; - ASRCinstance *inst = mod->ASRCinstances; + ASRCmodel *next_mod = ASRCnextModel(mod); + ASRCinstance *inst = ASRCinstances(mod); while (inst) { ASRCinstance *next_inst = inst->ASRCnextInstance; INPfreeTree(inst->ASRCtree); diff --git a/src/spicelib/devices/asrc/asrcfbr.c b/src/spicelib/devices/asrc/asrcfbr.c index f6c224add..164a82772 100644 --- a/src/spicelib/devices/asrc/asrcfbr.c +++ b/src/spicelib/devices/asrc/asrcfbr.c @@ -19,8 +19,8 @@ ASRCfindBr(CKTcircuit *ckt, GENmodel *inputModel, IFuid name) int error; CKTnode *tmp; - for (; model; model = model->ASRCnextModel) - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) + for (; model; model = ASRCnextModel(model)) + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) if (here->ASRCname == name) { if (here->ASRCbranch == 0) { error = CKTmkCur(ckt, &tmp, here->ASRCname, "branch"); diff --git a/src/spicelib/devices/asrc/asrcload.c b/src/spicelib/devices/asrc/asrcload.c index 9adc5a748..e6c5f230f 100644 --- a/src/spicelib/devices/asrc/asrcload.c +++ b/src/spicelib/devices/asrc/asrcload.c @@ -29,8 +29,8 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) double difference; double factor; - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here=here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here=here->ASRCnextInstance) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcpzld.c b/src/spicelib/devices/asrc/asrcpzld.c index 16419f4be..2f988047b 100644 --- a/src/spicelib/devices/asrc/asrcpzld.c +++ b/src/spicelib/devices/asrc/asrcpzld.c @@ -27,8 +27,8 @@ ASRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; factor = 1.0 diff --git a/src/spicelib/devices/asrc/asrcset.c b/src/spicelib/devices/asrc/asrcset.c index 89d30a9bd..f6119f99c 100644 --- a/src/spicelib/devices/asrc/asrcset.c +++ b/src/spicelib/devices/asrc/asrcset.c @@ -31,8 +31,8 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here=here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here=here->ASRCnextInstance) { if (!here->ASRCtree) return E_PARMVAL; @@ -126,8 +126,8 @@ ASRCunsetup(GENmodel *inModel, CKTcircuit *ckt) ASRCmodel *model = (ASRCmodel *) inModel; ASRCinstance *here; - for (; model; model = model->ASRCnextModel) - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { if (here->ASRCbranch > 0) CKTdltNNum(ckt, here->ASRCbranch); here->ASRCbranch = 0; diff --git a/src/spicelib/devices/asrc/asrctemp.c b/src/spicelib/devices/asrc/asrctemp.c index 469018eaa..b6caa31ab 100644 --- a/src/spicelib/devices/asrc/asrctemp.c +++ b/src/spicelib/devices/asrc/asrctemp.c @@ -15,8 +15,8 @@ ASRCtemp(GENmodel *inModel, CKTcircuit *ckt) ASRCmodel *model = (ASRCmodel *) inModel; ASRCinstance *here; - for (; model; model = model->ASRCnextModel) { - for (here = model->ASRCinstances; here; here = here->ASRCnextInstance) { + for (; model; model = ASRCnextModel(model)) { + for (here = ASRCinstances(model); here; here = here->ASRCnextInstance) { /* Default Value Processing for Source Instance */ diff --git a/src/spicelib/devices/bjt/bjtacld.c b/src/spicelib/devices/bjt/bjtacld.c index 30bc78ee1..064c999da 100644 --- a/src/spicelib/devices/bjt/bjtacld.c +++ b/src/spicelib/devices/bjt/bjtacld.c @@ -37,8 +37,8 @@ BJTacLoad(GENmodel *inModel, CKTcircuit *ckt) double xcmcb; double m; - for( ; model != NULL; model = model->BJTnextModel) { - for( here = model->BJTinstances; here!= NULL; + for( ; model != NULL; model = BJTnextModel(model)) { + for( here = BJTinstances(model); here!= NULL; here = here->BJTnextInstance) { m = here->BJTm; diff --git a/src/spicelib/devices/bjt/bjtconv.c b/src/spicelib/devices/bjt/bjtconv.c index 21201e7b8..b99185a06 100644 --- a/src/spicelib/devices/bjt/bjtconv.c +++ b/src/spicelib/devices/bjt/bjtconv.c @@ -32,8 +32,8 @@ BJTconvTest(GENmodel *inModel, CKTcircuit *ckt) - for( ; model != NULL; model = model->BJTnextModel) { - for(here=model->BJTinstances;here!=NULL;here = here->BJTnextInstance){ + for( ; model != NULL; model = BJTnextModel(model)) { + for(here=BJTinstances(model);here!=NULL;here = here->BJTnextInstance){ vbe=model->BJTtype*( *(ckt->CKTrhsOld+here->BJTbasePrimeNode)- diff --git a/src/spicelib/devices/bjt/bjtdefs.h b/src/spicelib/devices/bjt/bjtdefs.h index 040a242c2..cc7007b8c 100644 --- a/src/spicelib/devices/bjt/bjtdefs.h +++ b/src/spicelib/devices/bjt/bjtdefs.h @@ -323,14 +323,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/bjt/bjtdest.c b/src/spicelib/devices/bjt/bjtdest.c index 20f4e213d..8815539ee 100644 --- a/src/spicelib/devices/bjt/bjtdest.c +++ b/src/spicelib/devices/bjt/bjtdest.c @@ -19,8 +19,8 @@ BJTdestroy(GENmodel **inModel) BJTmodel *mod = *(BJTmodel**) inModel; while (mod) { - BJTmodel *next_mod = mod->BJTnextModel; - BJTinstance *inst = mod->BJTinstances; + BJTmodel *next_mod = BJTnextModel(mod); + BJTinstance *inst = BJTinstances(mod); while (inst) { BJTinstance *next_inst = inst->BJTnextInstance; FREE(inst->BJTsens); diff --git a/src/spicelib/devices/bjt/bjtdisto.c b/src/spicelib/devices/bjt/bjtdisto.c index ff85a4625..0af1dbe3d 100644 --- a/src/spicelib/devices/bjt/bjtdisto.c +++ b/src/spicelib/devices/bjt/bjtdisto.c @@ -52,11 +52,11 @@ BJTdisto(int mode, GENmodel *genmodel, CKTcircuit *ckt) (mode == D_2F1MF2)) { /* loop through all the BJT models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { td = model->BJTexcessPhaseFactor; /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { /* getting Volterra kernels */ diff --git a/src/spicelib/devices/bjt/bjtdset.c b/src/spicelib/devices/bjt/bjtdset.c index 26f65b968..862f51150 100644 --- a/src/spicelib/devices/bjt/bjtdset.c +++ b/src/spicelib/devices/bjt/bjtdset.c @@ -141,10 +141,10 @@ int BJTdSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { vt = here->BJTtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/bjt/bjtgetic.c b/src/spicelib/devices/bjt/bjtgetic.c index 9fa51f32b..775fa9c03 100644 --- a/src/spicelib/devices/bjt/bjtgetic.c +++ b/src/spicelib/devices/bjt/bjtgetic.c @@ -29,8 +29,8 @@ BJTgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->BJTnextModel) { - for(here = model->BJTinstances; here ; here = here->BJTnextInstance) { + for( ; model ; model = BJTnextModel(model)) { + for(here = BJTinstances(model); here ; here = here->BJTnextInstance) { if(!here->BJTicVBEGiven) { here->BJTicVBE = diff --git a/src/spicelib/devices/bjt/bjtload.c b/src/spicelib/devices/bjt/bjtload.c index 82c25d278..a807fe24b 100644 --- a/src/spicelib/devices/bjt/bjtload.c +++ b/src/spicelib/devices/bjt/bjtload.c @@ -139,10 +139,10 @@ BJTload(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { vt = here->BJTtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/bjt/bjtnoise.c b/src/spicelib/devices/bjt/bjtnoise.c index b17a40e42..44a1e4deb 100644 --- a/src/spicelib/devices/bjt/bjtnoise.c +++ b/src/spicelib/devices/bjt/bjtnoise.c @@ -50,8 +50,8 @@ BJTnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; -for (model=firstModel; model != NULL; model=model->BJTnextModel) { - for (inst=model->BJTinstances; inst != NULL; +for (model=firstModel; model != NULL; model=BJTnextModel(model)) { + for (inst=BJTinstances(model); inst != NULL; inst=inst->BJTnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/bjt/bjtpzld.c b/src/spicelib/devices/bjt/bjtpzld.c index 92de1f2eb..69685c809 100644 --- a/src/spicelib/devices/bjt/bjtpzld.c +++ b/src/spicelib/devices/bjt/bjtpzld.c @@ -33,8 +33,8 @@ BJTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double xcmcb; double m; - for( ; model != NULL; model = model->BJTnextModel) { - for( here = model->BJTinstances; here!= NULL; + for( ; model != NULL; model = BJTnextModel(model)) { + for( here = BJTinstances(model); here!= NULL; here = here->BJTnextInstance) { m = here->BJTm; diff --git a/src/spicelib/devices/bjt/bjtsacl.c b/src/spicelib/devices/bjt/bjtsacl.c index e083982f2..97921a0dd 100644 --- a/src/spicelib/devices/bjt/bjtsacl.c +++ b/src/spicelib/devices/bjt/bjtsacl.c @@ -92,10 +92,10 @@ BJTsAcLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; /* loop through all the models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { diff --git a/src/spicelib/devices/bjt/bjtsetup.c b/src/spicelib/devices/bjt/bjtsetup.c index 239914838..803971a44 100644 --- a/src/spicelib/devices/bjt/bjtsetup.c +++ b/src/spicelib/devices/bjt/bjtsetup.c @@ -32,7 +32,7 @@ BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the diode models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { if(model->BJTtype != NPN && model->BJTtype != PNP) { model->BJTtype = NPN; @@ -345,7 +345,7 @@ BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) */ /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { CKTnode *tmpNode; IFuid tmpName; @@ -476,9 +476,9 @@ BJTunsetup( BJTinstance *here; for (model = (BJTmodel *)inModel; model != NULL; - model = model->BJTnextModel) + model = BJTnextModel(model)) { - for (here = model->BJTinstances; here != NULL; + for (here = BJTinstances(model); here != NULL; here=here->BJTnextInstance) { if (here->BJTemitPrimeNode > 0 diff --git a/src/spicelib/devices/bjt/bjtsload.c b/src/spicelib/devices/bjt/bjtsload.c index 09abc5f14..bb99e341f 100644 --- a/src/spicelib/devices/bjt/bjtsload.c +++ b/src/spicelib/devices/bjt/bjtsload.c @@ -86,10 +86,10 @@ BJTsLoad(GENmodel *inModel, CKTcircuit *ckt) info->SENstatus = PERTURBATION; /* loop through all the models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/bjt/bjtsoachk.c b/src/spicelib/devices/bjt/bjtsoachk.c index 31cad7952..69665bd69 100644 --- a/src/spicelib/devices/bjt/bjtsoachk.c +++ b/src/spicelib/devices/bjt/bjtsoachk.c @@ -30,9 +30,9 @@ BJTsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BJTnextModel) { + for (; model; model = BJTnextModel(model)) { - for (here = model->BJTinstances; here; here=here->BJTnextInstance) { + for (here = BJTinstances(model); here; here=here->BJTnextInstance) { vbe = fabs(ckt->CKTrhsOld [here->BJTbasePrimeNode] - ckt->CKTrhsOld [here->BJTemitPrimeNode]); diff --git a/src/spicelib/devices/bjt/bjtsprt.c b/src/spicelib/devices/bjt/bjtsprt.c index dcc947ddb..d0a5bc6dd 100644 --- a/src/spicelib/devices/bjt/bjtsprt.c +++ b/src/spicelib/devices/bjt/bjtsprt.c @@ -27,12 +27,12 @@ BJTsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("BJTS-----------------\n"); /* loop through all the BJT models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { printf("Model name:%s\n",model->BJTmodName); /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { ckt->CKTsenInfo->SEN_parmVal[here->BJTsenParmNo] = here->BJTarea; diff --git a/src/spicelib/devices/bjt/bjtsset.c b/src/spicelib/devices/bjt/bjtsset.c index 1b7664ebc..0dfc14034 100644 --- a/src/spicelib/devices/bjt/bjtsset.c +++ b/src/spicelib/devices/bjt/bjtsset.c @@ -30,11 +30,11 @@ BJTsSetup(SENstruct *info, GENmodel *inModel) #endif /* STEPDEBUG */ /* loop through all the diode models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { if(here->BJTsenParmNo){ diff --git a/src/spicelib/devices/bjt/bjtsupd.c b/src/spicelib/devices/bjt/bjtsupd.c index f76ef8f71..8d5170527 100644 --- a/src/spicelib/devices/bjt/bjtsupd.c +++ b/src/spicelib/devices/bjt/bjtsupd.c @@ -43,10 +43,10 @@ BJTsUpdate(GENmodel *inModel, CKTcircuit *ckt) printf("CKTtime = %.5e\n",ckt->CKTtime); #endif /* SENSDEBUG */ /* loop through all the BJT models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { sxpbe = 0; diff --git a/src/spicelib/devices/bjt/bjttemp.c b/src/spicelib/devices/bjt/bjttemp.c index 89e62c2c8..05da5c001 100644 --- a/src/spicelib/devices/bjt/bjttemp.c +++ b/src/spicelib/devices/bjt/bjttemp.c @@ -38,7 +38,7 @@ BJTtemp(GENmodel *inModel, CKTcircuit *ckt) double dt; /* loop through all the bipolar models */ - for( ; model != NULL; model = model->BJTnextModel ) { + for( ; model != NULL; model = BJTnextModel(model) ) { if(!model->BJTtnomGiven) model->BJTtnom = ckt->CKTnomTemp; vtnom = CONSTKoverQ * model->BJTtnom; @@ -100,7 +100,7 @@ BJTtemp(GENmodel *inModel, CKTcircuit *ckt) (1 + model->BJTjunctionExpBC); /* loop through all the instances of the model */ - for (here = model->BJTinstances; here != NULL ; + for (here = BJTinstances(model); here != NULL ; here=here->BJTnextInstance) { double arg1, pbfact1, egfet1; diff --git a/src/spicelib/devices/bjt/bjttrunc.c b/src/spicelib/devices/bjt/bjttrunc.c index b00afac97..72a3c79b9 100644 --- a/src/spicelib/devices/bjt/bjttrunc.c +++ b/src/spicelib/devices/bjt/bjttrunc.c @@ -24,8 +24,8 @@ BJTtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) BJTmodel *model = (BJTmodel*)inModel; BJTinstance *here; - for( ; model != NULL; model = model->BJTnextModel) { - for(here=model->BJTinstances;here!=NULL;here = here->BJTnextInstance){ + for( ; model != NULL; model = BJTnextModel(model)) { + for(here=BJTinstances(model);here!=NULL;here = here->BJTnextInstance){ CKTterr(here->BJTqbe,ckt,timeStep); CKTterr(here->BJTqbc,ckt,timeStep); diff --git a/src/spicelib/devices/bsim1/b1acld.c b/src/spicelib/devices/bsim1/b1acld.c index a875125d6..caf3993f9 100644 --- a/src/spicelib/devices/bsim1/b1acld.c +++ b/src/spicelib/devices/bsim1/b1acld.c @@ -53,8 +53,8 @@ B1acLoad(GENmodel *inModel, CKTcircuit *ckt) double m; /* parallel multiplier */ omega = ckt->CKTomega; - for( ; model != NULL; model = model->B1nextModel) { - for(here = model->B1instances; here!= NULL; + for( ; model != NULL; model = B1nextModel(model)) { + for(here = B1instances(model); here!= NULL; here = here->B1nextInstance) { if (here->B1mode >= 0) { diff --git a/src/spicelib/devices/bsim1/b1cvtest.c b/src/spicelib/devices/bsim1/b1cvtest.c index a17d7c0b1..08b4facc6 100644 --- a/src/spicelib/devices/bsim1/b1cvtest.c +++ b/src/spicelib/devices/bsim1/b1cvtest.c @@ -41,10 +41,10 @@ B1convTest(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the B1 device models */ - for( ; model != NULL; model = model->B1nextModel ) { + for( ; model != NULL; model = B1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { vbs = model->B1type * ( diff --git a/src/spicelib/devices/bsim1/b1dest.c b/src/spicelib/devices/bsim1/b1dest.c index 4b107ba59..fdefaf0b5 100644 --- a/src/spicelib/devices/bsim1/b1dest.c +++ b/src/spicelib/devices/bsim1/b1dest.c @@ -14,8 +14,8 @@ B1destroy(GENmodel **inModel) B1model *mod = *(B1model**) inModel; while (mod) { - B1model *next_mod = mod->B1nextModel; - B1instance *inst = mod->B1instances; + B1model *next_mod = B1nextModel(mod); + B1instance *inst = B1instances(mod); while (inst) { B1instance *next_inst = inst->B1nextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim1/b1disto.c b/src/spicelib/devices/bsim1/b1disto.c index 48ce2986f..e86cd93c6 100644 --- a/src/spicelib/devices/bsim1/b1disto.c +++ b/src/spicelib/devices/bsim1/b1disto.c @@ -46,10 +46,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the B1 models */ -for( ; model != NULL; model = model->B1nextModel ) { +for( ; model != NULL; model = B1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/bsim1/b1dset.c b/src/spicelib/devices/bsim1/b1dset.c index 820e555cb..a240305a7 100644 --- a/src/spicelib/devices/bsim1/b1dset.c +++ b/src/spicelib/devices/bsim1/b1dset.c @@ -125,10 +125,10 @@ B1dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the B1 device models */ - for( ; model != NULL; model = model->B1nextModel ) { + for( ; model != NULL; model = B1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { EffectiveLength=here->B1l - model->B1deltaL * 1.e-6;/* m */ diff --git a/src/spicelib/devices/bsim1/b1getic.c b/src/spicelib/devices/bsim1/b1getic.c index 71e073c82..6042bab28 100644 --- a/src/spicelib/devices/bsim1/b1getic.c +++ b/src/spicelib/devices/bsim1/b1getic.c @@ -23,8 +23,8 @@ B1getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->B1nextModel) { - for(here = model->B1instances; here ; here = here->B1nextInstance) { + for( ; model ; model = B1nextModel(model)) { + for(here = B1instances(model); here ; here = here->B1nextInstance) { if(!here->B1icVBSGiven) { here->B1icVBS = diff --git a/src/spicelib/devices/bsim1/b1ld.c b/src/spicelib/devices/bsim1/b1ld.c index 049b1a336..50db2d573 100644 --- a/src/spicelib/devices/bsim1/b1ld.c +++ b/src/spicelib/devices/bsim1/b1ld.c @@ -129,10 +129,10 @@ B1load(GENmodel *inModel, CKTcircuit *ckt) double m; /* parallel multiplier */ /* loop through all the B1 device models */ - for( ; model != NULL; model = model->B1nextModel ) { + for( ; model != NULL; model = B1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { EffectiveLength=here->B1l - model->B1deltaL * 1.e-6;/* m */ diff --git a/src/spicelib/devices/bsim1/b1noi.c b/src/spicelib/devices/bsim1/b1noi.c index 6b66b4f58..28052e22b 100644 --- a/src/spicelib/devices/bsim1/b1noi.c +++ b/src/spicelib/devices/bsim1/b1noi.c @@ -45,8 +45,8 @@ B1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->B1nextModel) { - for (inst=model->B1instances; inst != NULL; inst=inst->B1nextInstance) { + for (model=firstModel; model != NULL; model=B1nextModel(model)) { + for (inst=B1instances(model); inst != NULL; inst=inst->B1nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/bsim1/b1pzld.c b/src/spicelib/devices/bsim1/b1pzld.c index d97a7b848..f8ea202d3 100644 --- a/src/spicelib/devices/bsim1/b1pzld.c +++ b/src/spicelib/devices/bsim1/b1pzld.c @@ -53,8 +53,8 @@ B1pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->B1nextModel) { - for(here = model->B1instances; here!= NULL; + for( ; model != NULL; model = B1nextModel(model)) { + for(here = B1instances(model); here!= NULL; here = here->B1nextInstance) { if (here->B1mode >= 0) { diff --git a/src/spicelib/devices/bsim1/b1set.c b/src/spicelib/devices/bsim1/b1set.c index 58d1f2e41..f64472657 100644 --- a/src/spicelib/devices/bsim1/b1set.c +++ b/src/spicelib/devices/bsim1/b1set.c @@ -25,7 +25,7 @@ B1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, CKTnode *tmp; /* loop through all the B1 device models */ - for( ; model != NULL; model = model->B1nextModel ) { + for( ; model != NULL; model = B1nextModel(model) ) { /* Default value Processing for B1 MOSFET Models */ if( ! model->B1typeGiven) { @@ -270,7 +270,7 @@ B1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, } /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { CKTnode *tmpNode; @@ -407,9 +407,9 @@ B1unsetup(GENmodel *inModel, CKTcircuit *ckt) B1instance *here; for (model = (B1model *)inModel; model != NULL; - model = model->B1nextModel) + model = B1nextModel(model)) { - for (here = model->B1instances; here != NULL; + for (here = B1instances(model); here != NULL; here=here->B1nextInstance) { if (here->B1sNodePrime > 0 diff --git a/src/spicelib/devices/bsim1/b1temp.c b/src/spicelib/devices/bsim1/b1temp.c index 82415e5b2..df1ab910c 100644 --- a/src/spicelib/devices/bsim1/b1temp.c +++ b/src/spicelib/devices/bsim1/b1temp.c @@ -30,7 +30,7 @@ B1temp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the B1 device models */ - for( ; model != NULL; model = model->B1nextModel ) { + for( ; model != NULL; model = B1nextModel(model) ) { /* Default value Processing for B1 MOSFET Models */ /* Some Limiting for Model Parameters */ @@ -45,7 +45,7 @@ B1temp(GENmodel *inModel, CKTcircuit *ckt) model->B1Cox = Cox; /* unit: F/cm**2 */ /* loop through all the instances of the model */ - for (here = model->B1instances; here != NULL ; + for (here = B1instances(model); here != NULL ; here=here->B1nextInstance) { if( (EffChanLength = here->B1l - model->B1deltaL *1e-6 )<=0) { diff --git a/src/spicelib/devices/bsim1/b1trunc.c b/src/spicelib/devices/bsim1/b1trunc.c index 148cc6040..0703dabfc 100644 --- a/src/spicelib/devices/bsim1/b1trunc.c +++ b/src/spicelib/devices/bsim1/b1trunc.c @@ -19,8 +19,8 @@ B1trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double debugtemp; #endif /* STEPDEBUG */ - for( ; model != NULL; model = model->B1nextModel) { - for(here=model->B1instances;here!=NULL;here = here->B1nextInstance){ + for( ; model != NULL; model = B1nextModel(model)) { + for(here=B1instances(model);here!=NULL;here = here->B1nextInstance){ #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim1/bsim1def.h b/src/spicelib/devices/bsim1/bsim1def.h index 75540bbb3..27a967cb6 100644 --- a/src/spicelib/devices/bsim1/bsim1def.h +++ b/src/spicelib/devices/bsim1/bsim1def.h @@ -315,14 +315,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b2acld.c b/src/spicelib/devices/bsim2/b2acld.c index 1ba8a314d..c966c022e 100644 --- a/src/spicelib/devices/bsim2/b2acld.c +++ b/src/spicelib/devices/bsim2/b2acld.c @@ -54,8 +54,8 @@ B2acLoad(GENmodel *inModel, CKTcircuit *ckt) double m; /* parallel multiplier */ omega = ckt->CKTomega; - for( ; model != NULL; model = model->B2nextModel) { - for(here = model->B2instances; here!= NULL; + for( ; model != NULL; model = B2nextModel(model)) { + for(here = B2instances(model); here!= NULL; here = here->B2nextInstance) { if (here->B2mode >= 0) { diff --git a/src/spicelib/devices/bsim2/b2cvtest.c b/src/spicelib/devices/bsim2/b2cvtest.c index 4b896960a..649fa52dc 100644 --- a/src/spicelib/devices/bsim2/b2cvtest.c +++ b/src/spicelib/devices/bsim2/b2cvtest.c @@ -41,10 +41,10 @@ B2convTest(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the B2 device models */ - for( ; model != NULL; model = model->B2nextModel ) { + for( ; model != NULL; model = B2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B2instances; here != NULL ; + for (here = B2instances(model); here != NULL ; here=here->B2nextInstance) { vbs = model->B2type * ( diff --git a/src/spicelib/devices/bsim2/b2dest.c b/src/spicelib/devices/bsim2/b2dest.c index 20e1d99b2..4cf024c49 100644 --- a/src/spicelib/devices/bsim2/b2dest.c +++ b/src/spicelib/devices/bsim2/b2dest.c @@ -14,8 +14,8 @@ B2destroy(GENmodel **inModel) B2model *mod = *(B2model**) inModel; while (mod) { - B2model *next_mod = mod->B2nextModel; - B2instance *inst = mod->B2instances; + B2model *next_mod = B2nextModel(mod); + B2instance *inst = B2instances(mod); while (inst) { B2instance *next_inst = inst->B2nextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim2/b2getic.c b/src/spicelib/devices/bsim2/b2getic.c index 9b9fca5e9..97e6f4558 100644 --- a/src/spicelib/devices/bsim2/b2getic.c +++ b/src/spicelib/devices/bsim2/b2getic.c @@ -23,8 +23,8 @@ B2getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->B2nextModel) { - for(here = model->B2instances; here ; here = here->B2nextInstance) { + for( ; model ; model = B2nextModel(model)) { + for(here = B2instances(model); here ; here = here->B2nextInstance) { if(!here->B2icVBSGiven) { here->B2icVBS = diff --git a/src/spicelib/devices/bsim2/b2ld.c b/src/spicelib/devices/bsim2/b2ld.c index 1dca6b163..8844f1c42 100644 --- a/src/spicelib/devices/bsim2/b2ld.c +++ b/src/spicelib/devices/bsim2/b2ld.c @@ -130,10 +130,10 @@ B2load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the B2 device models */ - for( ; model != NULL; model = model->B2nextModel ) { + for( ; model != NULL; model = B2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B2instances; here != NULL ; + for (here = B2instances(model); here != NULL ; here=here->B2nextInstance) { EffectiveLength=here->B2l - model->B2deltaL * 1.e-6;/* m */ diff --git a/src/spicelib/devices/bsim2/b2noi.c b/src/spicelib/devices/bsim2/b2noi.c index 7ff1ac9f1..5042e678b 100644 --- a/src/spicelib/devices/bsim2/b2noi.c +++ b/src/spicelib/devices/bsim2/b2noi.c @@ -45,8 +45,8 @@ B2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->B2nextModel) { - for (inst=model->B2instances; inst != NULL; inst=inst->B2nextInstance) { + for (model=firstModel; model != NULL; model=B2nextModel(model)) { + for (inst=B2instances(model); inst != NULL; inst=inst->B2nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/bsim2/b2pzld.c b/src/spicelib/devices/bsim2/b2pzld.c index 6ee62b96c..f90d6e9d2 100644 --- a/src/spicelib/devices/bsim2/b2pzld.c +++ b/src/spicelib/devices/bsim2/b2pzld.c @@ -53,8 +53,8 @@ B2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->B2nextModel) { - for(here = model->B2instances; here!= NULL; + for( ; model != NULL; model = B2nextModel(model)) { + for(here = B2instances(model); here!= NULL; here = here->B2nextInstance) { if (here->B2mode >= 0) { diff --git a/src/spicelib/devices/bsim2/b2set.c b/src/spicelib/devices/bsim2/b2set.c index 9f3895234..068df7c54 100644 --- a/src/spicelib/devices/bsim2/b2set.c +++ b/src/spicelib/devices/bsim2/b2set.c @@ -24,7 +24,7 @@ B2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the B2 device models */ - for( ; model != NULL; model = model->B2nextModel ) { + for( ; model != NULL; model = B2nextModel(model) ) { /* Default value Processing for B2 MOSFET Models */ if( ! model->B2typeGiven) { @@ -431,7 +431,7 @@ B2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->B2instances; here != NULL ; + for (here = B2instances(model); here != NULL ; here=here->B2nextInstance) { /* allocate a chunk of the state vector */ @@ -576,9 +576,9 @@ B2unsetup( B2instance *here; for (model = (B2model *)inModel; model != NULL; - model = model->B2nextModel) + model = B2nextModel(model)) { - for (here = model->B2instances; here != NULL; + for (here = B2instances(model); here != NULL; here=here->B2nextInstance) { if (here->B2sNodePrime > 0 diff --git a/src/spicelib/devices/bsim2/b2temp.c b/src/spicelib/devices/bsim2/b2temp.c index 0d45b121b..d46e50b59 100644 --- a/src/spicelib/devices/bsim2/b2temp.c +++ b/src/spicelib/devices/bsim2/b2temp.c @@ -30,7 +30,7 @@ B2temp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the B2 device models */ - for( ; model != NULL; model = model->B2nextModel ) { + for( ; model != NULL; model = B2nextModel(model) ) { /* Default value Processing for B2 MOSFET Models */ /* Some Limiting for Model Parameters */ @@ -50,7 +50,7 @@ B2temp(GENmodel *inModel, CKTcircuit *ckt) pLastKnot = NULL; /* loop through all the instances of the model */ - for (here = model->B2instances; here != NULL ; + for (here = B2instances(model); here != NULL ; here=here->B2nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim2/b2trunc.c b/src/spicelib/devices/bsim2/b2trunc.c index bb186089e..74a448b2c 100644 --- a/src/spicelib/devices/bsim2/b2trunc.c +++ b/src/spicelib/devices/bsim2/b2trunc.c @@ -18,8 +18,8 @@ B2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double debugtemp; #endif /* STEPDEBUG */ - for( ; model != NULL; model = model->B2nextModel) { - for(here=model->B2instances;here!=NULL;here = here->B2nextInstance){ + for( ; model != NULL; model = B2nextModel(model)) { + for(here=B2instances(model);here!=NULL;here = here->B2nextInstance){ #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/bsim2/bsim2def.h b/src/spicelib/devices/bsim2/bsim2def.h index 94ec28ce2..b9fffd83b 100644 --- a/src/spicelib/devices/bsim2/bsim2def.h +++ b/src/spicelib/devices/bsim2/bsim2def.h @@ -237,14 +237,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b3acld.c b/src/spicelib/devices/bsim3/b3acld.c index b2fe4590c..e80047888 100644 --- a/src/spicelib/devices/bsim3/b3acld.c +++ b/src/spicelib/devices/bsim3/b3acld.c @@ -43,8 +43,8 @@ double xcsbbi, xcggbi, xcgdbi, xcgsbi, xcgbbi; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM3nextModel) - { for (here = model->BSIM3instances; here!= NULL; + for (; model != NULL; model = BSIM3nextModel(model)) + { for (here = BSIM3instances(model); here!= NULL; here = here->BSIM3nextInstance) { Csd = -(here->BSIM3cddb + here->BSIM3cgdb + here->BSIM3cbdb); diff --git a/src/spicelib/devices/bsim3/b3cvtest.c b/src/spicelib/devices/bsim3/b3cvtest.c index ee22a8a21..f616c3514 100644 --- a/src/spicelib/devices/bsim3/b3cvtest.c +++ b/src/spicelib/devices/bsim3/b3cvtest.c @@ -29,9 +29,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the BSIM3 device models */ - for (; model != NULL; model = model->BSIM3nextModel) + for (; model != NULL; model = BSIM3nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3instances; here != NULL ; + for (here = BSIM3instances(model); here != NULL ; here=here->BSIM3nextInstance) { vbs = model->BSIM3type diff --git a/src/spicelib/devices/bsim3/b3dest.c b/src/spicelib/devices/bsim3/b3dest.c index 27af1ba3b..f861b3cee 100644 --- a/src/spicelib/devices/bsim3/b3dest.c +++ b/src/spicelib/devices/bsim3/b3dest.c @@ -24,8 +24,8 @@ BSIM3destroy(GENmodel **inModel) #endif while (mod) { - BSIM3model *next_mod = mod->BSIM3nextModel; - BSIM3instance *inst = mod->BSIM3instances; + BSIM3model *next_mod = BSIM3nextModel(mod); + BSIM3instance *inst = BSIM3instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim3SizeDependParam *p = mod->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim3/b3getic.c b/src/spicelib/devices/bsim3/b3getic.c index 6bec0e56b..857faeaed 100644 --- a/src/spicelib/devices/bsim3/b3getic.c +++ b/src/spicelib/devices/bsim3/b3getic.c @@ -23,8 +23,8 @@ CKTcircuit *ckt) BSIM3model *model = (BSIM3model*)inModel; BSIM3instance *here; - for (; model ; model = model->BSIM3nextModel) - { for (here = model->BSIM3instances; here; here = here->BSIM3nextInstance) + for (; model ; model = BSIM3nextModel(model)) + { for (here = BSIM3instances(model); here; here = here->BSIM3nextInstance) { if (!here->BSIM3icVBSGiven) { here->BSIM3icVBS = *(ckt->CKTrhs + here->BSIM3bNode) diff --git a/src/spicelib/devices/bsim3/b3ld.c b/src/spicelib/devices/bsim3/b3ld.c index 8f55f0a0a..70a4853c9 100644 --- a/src/spicelib/devices/bsim3/b3ld.c +++ b/src/spicelib/devices/bsim3/b3ld.c @@ -179,8 +179,8 @@ ChargeComputationNeeded = ((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC))) ? 1 : 0; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM3nextModel) -{ for (here = model->BSIM3instances; here != NULL; +for (; model != NULL; model = BSIM3nextModel(model)) +{ for (here = BSIM3instances(model); here != NULL; here = here->BSIM3nextInstance) { #endif diff --git a/src/spicelib/devices/bsim3/b3noi.c b/src/spicelib/devices/bsim3/b3noi.c index f38db144e..6c7c62b09 100644 --- a/src/spicelib/devices/bsim3/b3noi.c +++ b/src/spicelib/devices/bsim3/b3noi.c @@ -139,8 +139,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM3nextModel) - { for (here = model->BSIM3instances; here != NULL; + for (; model != NULL; model = BSIM3nextModel(model)) + { for (here = BSIM3instances(model); here != NULL; here = here->BSIM3nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3/b3pzld.c b/src/spicelib/devices/bsim3/b3pzld.c index b5fcb35a0..5c03f2616 100644 --- a/src/spicelib/devices/bsim3/b3pzld.c +++ b/src/spicelib/devices/bsim3/b3pzld.c @@ -37,8 +37,8 @@ double T1, CoxWL, qcheq, Cdg, Cdd, Cds, Csg, Csd, Css; double ScalingFactor = 1.0e-9; double m; - for (; model != NULL; model = model->BSIM3nextModel) - { for (here = model->BSIM3instances; here!= NULL; + for (; model != NULL; model = BSIM3nextModel(model)) + { for (here = BSIM3instances(model); here!= NULL; here = here->BSIM3nextInstance) { if (here->BSIM3mode >= 0) diff --git a/src/spicelib/devices/bsim3/b3set.c b/src/spicelib/devices/bsim3/b3set.c index da14dd8dc..6479eacaa 100644 --- a/src/spicelib/devices/bsim3/b3set.c +++ b/src/spicelib/devices/bsim3/b3set.c @@ -49,7 +49,7 @@ BSIM3instance **InstArray; /* loop through all the BSIM3 device models */ - for( ; model != NULL; model = model->BSIM3nextModel ) + for( ; model != NULL; model = BSIM3nextModel(model) ) { /* Default value Processing for BSIM3 MOSFET Models */ if (!model->BSIM3typeGiven) @@ -920,7 +920,7 @@ BSIM3instance **InstArray; model->BSIM3vbdrMax = 1e99; /* loop through all the instances of the model */ - for (here = model->BSIM3instances; here != NULL ; + for (here = BSIM3instances(model); here != NULL ; here=here->BSIM3nextInstance) { /* allocate a chunk of the state vector */ @@ -1129,10 +1129,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ /* loop through all the BSIM3 device models to count the number of instances */ - for( ; model != NULL; model = model->BSIM3nextModel ) + for( ; model != NULL; model = BSIM3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM3instances; here != NULL ; + for (here = BSIM3instances(model); here != NULL ; here=here->BSIM3nextInstance) { InstCount++; @@ -1141,10 +1141,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ InstArray = TMALLOC(BSIM3instance*, InstCount); model = (BSIM3model*)inModel; idx = 0; - for( ; model != NULL; model = model->BSIM3nextModel ) + for( ; model != NULL; model = BSIM3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM3instances; here != NULL ; + for (here = BSIM3instances(model); here != NULL ; here=here->BSIM3nextInstance) { InstArray[idx] = here; @@ -1168,9 +1168,9 @@ BSIM3unsetup( BSIM3instance *here; for (model = (BSIM3model *)inModel; model != NULL; - model = model->BSIM3nextModel) + model = BSIM3nextModel(model)) { - for (here = model->BSIM3instances; here != NULL; + for (here = BSIM3instances(model); here != NULL; here=here->BSIM3nextInstance) { if (here->BSIM3qNode > 0) diff --git a/src/spicelib/devices/bsim3/b3soachk.c b/src/spicelib/devices/bsim3/b3soachk.c index 53d43467e..f6951fd1d 100644 --- a/src/spicelib/devices/bsim3/b3soachk.c +++ b/src/spicelib/devices/bsim3/b3soachk.c @@ -33,9 +33,9 @@ BSIM3soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM3nextModel) { + for (; model; model = BSIM3nextModel(model)) { - for (here = model->BSIM3instances; here; here = here->BSIM3nextInstance) { + for (here = BSIM3instances(model); here; here = here->BSIM3nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM3gNode] - ckt->CKTrhsOld [here->BSIM3sNodePrime]; diff --git a/src/spicelib/devices/bsim3/b3temp.c b/src/spicelib/devices/bsim3/b3temp.c index af20b4e3d..bccc0dc4b 100644 --- a/src/spicelib/devices/bsim3/b3temp.c +++ b/src/spicelib/devices/bsim3/b3temp.c @@ -44,7 +44,7 @@ double Nvtm, SourceSatCurrent, DrainSatCurrent; int Size_Not_Found, error; /* loop through all the BSIM3 device models */ - for (; model != NULL; model = model->BSIM3nextModel) + for (; model != NULL; model = BSIM3nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM3bulkJctPotential < 0.1) { model->BSIM3bulkJctPotential = 0.1; @@ -143,7 +143,7 @@ int Size_Not_Found, error; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->BSIM3instances; here != NULL; + for (here = BSIM3instances(model); here != NULL; here = here->BSIM3nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim3/b3trunc.c b/src/spicelib/devices/bsim3/b3trunc.c index 75e6ede60..a4d026d87 100644 --- a/src/spicelib/devices/bsim3/b3trunc.c +++ b/src/spicelib/devices/bsim3/b3trunc.c @@ -28,8 +28,8 @@ BSIM3instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM3nextModel) - { for (here = model->BSIM3instances; here != NULL; + for (; model != NULL; model = BSIM3nextModel(model)) + { for (here = BSIM3instances(model); here != NULL; here = here->BSIM3nextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3/bsim3def.h b/src/spicelib/devices/bsim3/bsim3def.h index c8fc235a1..b87720d7b 100644 --- a/src/spicelib/devices/bsim3/bsim3def.h +++ b/src/spicelib/devices/bsim3/bsim3def.h @@ -399,12 +399,12 @@ struct bsim3SizeDependParam typedef struct sBSIM3model { - int BSIM3modType; - struct sBSIM3model *BSIM3nextModel; - BSIM3instance *BSIM3instances; - IFuid BSIM3modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b3soiddacld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c index 38cffecbb..08a049342 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddacld.c @@ -48,10 +48,10 @@ FILE *fpdebug = NULL; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->B3SOIDDnextModel) + for (; model != NULL; model = B3SOIDDnextModel(model)) { - for (here = model->B3SOIDDinstances; here!= NULL; + for (here = B3SOIDDinstances(model); here!= NULL; here = here->B3SOIDDnextInstance) { selfheat = (model->B3SOIDDshMod == 1) && (here->B3SOIDDrth0 != 0.0); diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c b/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c index 4f2ca4446..9762b568c 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddcvtest.c @@ -29,9 +29,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the B3SOIDD device models */ - for (; model != NULL; model = model->B3SOIDDnextModel) + for (; model != NULL; model = B3SOIDDnextModel(model)) { /* loop through all the instances of the model */ - for (here = model->B3SOIDDinstances; here != NULL ; + for (here = B3SOIDDinstances(model); here != NULL ; here=here->B3SOIDDnextInstance) { vbs = model->B3SOIDDtype diff --git a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h index bc7a9cf7e..b2d92df28 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soidddef.h +++ b/src/spicelib/devices/bsim3soi_dd/b3soidddef.h @@ -597,12 +597,12 @@ struct b3soiddSizeDependParam typedef struct sB3SOIDDmodel { - int B3SOIDDmodType; - struct sB3SOIDDmodel *B3SOIDDnextModel; - B3SOIDDinstance *B3SOIDDinstances; - IFuid B3SOIDDmodName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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_dd/b3soidddest.c b/src/spicelib/devices/bsim3soi_dd/b3soidddest.c index bb0151fa6..6282f0ed4 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soidddest.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soidddest.c @@ -21,8 +21,8 @@ B3SOIDDdestroy(GENmodel **inModel) B3SOIDDmodel *mod = *(B3SOIDDmodel**) inModel; while (mod) { - B3SOIDDmodel *next_mod = mod->B3SOIDDnextModel; - B3SOIDDinstance *inst = mod->B3SOIDDinstances; + B3SOIDDmodel *next_mod = B3SOIDDnextModel(mod); + B3SOIDDinstance *inst = B3SOIDDinstances(mod); while (inst) { B3SOIDDinstance *next_inst = inst->B3SOIDDnextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c b/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c index c46293f24..739034bb6 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddgetic.c @@ -23,8 +23,8 @@ B3SOIDDgetic(GENmodel *inModel, CKTcircuit *ckt) B3SOIDDmodel *model = (B3SOIDDmodel*)inModel; B3SOIDDinstance *here; - for (; model ; model = model->B3SOIDDnextModel) - { for (here = model->B3SOIDDinstances; here; here = here->B3SOIDDnextInstance) + for (; model ; model = B3SOIDDnextModel(model)) + { for (here = B3SOIDDinstances(model); here; here = here->B3SOIDDnextInstance) { if(!here->B3SOIDDicVBSGiven) { here->B3SOIDDicVBS = *(ckt->CKTrhs + here->B3SOIDDbNode) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddld.c index e7c401d25..d1e76c16e 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddld.c @@ -304,8 +304,8 @@ char nanmessage [12]; double m; - for (; model != NULL; model = model->B3SOIDDnextModel) -{ for (here = model->B3SOIDDinstances; here != NULL; + for (; model != NULL; model = B3SOIDDnextModel(model)) +{ for (here = B3SOIDDinstances(model); here != NULL; here = here->B3SOIDDnextInstance) { Check = 0; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c b/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c index 41036ccdb..6d8785317 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddnoi.c @@ -127,8 +127,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->B3SOIDDnextModel) - { for (here = model->B3SOIDDinstances; here != NULL; + for (; model != NULL; model = B3SOIDDnextModel(model)) + { for (here = B3SOIDDinstances(model); here != NULL; here = here->B3SOIDDnextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c b/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c index 16980a795..92099124f 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddpzld.c @@ -34,8 +34,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->B3SOIDDnextModel) - { for (here = model->B3SOIDDinstances; here!= NULL; + for (; model != NULL; model = B3SOIDDnextModel(model)) + { for (here = B3SOIDDinstances(model); here!= NULL; here = here->B3SOIDDnextInstance) { if (here->B3SOIDDmode >= 0) diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddset.c b/src/spicelib/devices/bsim3soi_dd/b3soiddset.c index 069117c63..88dc788a7 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddset.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddset.c @@ -47,7 +47,7 @@ IFuid tmpName; /* loop through all the B3SOIDD device models */ - for( ; model != NULL; model = model->B3SOIDDnextModel ) + for( ; model != NULL; model = B3SOIDDnextModel(model) ) { /* Default value Processing for B3SOIDD MOSFET Models */ @@ -874,7 +874,7 @@ IFuid tmpName; model->B3SOIDDnoif = 1.0; /* loop through all the instances of the model */ - for (here = model->B3SOIDDinstances; here != NULL ; + for (here = B3SOIDDinstances(model); here != NULL ; here=here->B3SOIDDnextInstance) { /* allocate a chunk of the state vector */ @@ -1357,9 +1357,9 @@ B3SOIDDunsetup(GENmodel *inModel, CKTcircuit *ckt) B3SOIDDinstance *here; for (model = (B3SOIDDmodel *)inModel; model != NULL; - model = model->B3SOIDDnextModel) + model = B3SOIDDnextModel(model)) { - for (here = model->B3SOIDDinstances; here != NULL; + for (here = B3SOIDDinstances(model); here != NULL; here=here->B3SOIDDnextInstance) { /* here for debugging purpose only */ diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c b/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c index 148d3956b..614561e6e 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddtemp.c @@ -46,7 +46,7 @@ double SDphi, SDgamma; int Size_Not_Found; /* loop through all the B3SOIDD device models */ - for (; model != NULL; model = model->B3SOIDDnextModel) + for (; model != NULL; model = B3SOIDDnextModel(model)) { Temp = ckt->CKTtemp; if (model->B3SOIDDGatesidewallJctPotential < 0.1) model->B3SOIDDGatesidewallJctPotential = 0.1; @@ -72,7 +72,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->B3SOIDDinstances; here != NULL; + for (here = B3SOIDDinstances(model); here != NULL; here = here->B3SOIDDnextInstance) { here->B3SOIDDrbodyext = here->B3SOIDDbodySquares * diff --git a/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c b/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c index a55c9923a..29fd7ca69 100644 --- a/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c +++ b/src/spicelib/devices/bsim3soi_dd/b3soiddtrunc.c @@ -27,8 +27,8 @@ B3SOIDDinstance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->B3SOIDDnextModel) - { for (here = model->B3SOIDDinstances; here != NULL; + for (; model != NULL; model = B3SOIDDnextModel(model)) + { for (here = B3SOIDDinstances(model); here != NULL; here = here->B3SOIDDnextInstance) { diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c index acb9bcc79..8ab173a76 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdacld.c @@ -49,10 +49,10 @@ FILE *fpdebug = NULL; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->B3SOIFDnextModel) + for (; model != NULL; model = B3SOIFDnextModel(model)) { - for (here = model->B3SOIFDinstances; here!= NULL; + for (here = B3SOIFDinstances(model); here!= NULL; here = here->B3SOIFDnextInstance) { selfheat = (model->B3SOIFDshMod == 1) && (here->B3SOIFDrth0 != 0.0); diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c b/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c index 00e95f3a7..cc6788a36 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdcvtest.c @@ -29,9 +29,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the B3SOIFD device models */ - for (; model != NULL; model = model->B3SOIFDnextModel) + for (; model != NULL; model = B3SOIFDnextModel(model)) { /* loop through all the instances of the model */ - for (here = model->B3SOIFDinstances; here != NULL ; + for (here = B3SOIFDinstances(model); here != NULL ; here=here->B3SOIFDnextInstance) { vbs = model->B3SOIFDtype diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h index 6f1434e99..3a75e88ef 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifddef.h +++ b/src/spicelib/devices/bsim3soi_fd/b3soifddef.h @@ -597,12 +597,12 @@ struct b3soifdSizeDependParam typedef struct sB3SOIFDmodel { - int B3SOIFDmodType; - struct sB3SOIFDmodel *B3SOIFDnextModel; - B3SOIFDinstance *B3SOIFDinstances; - IFuid B3SOIFDmodName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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_fd/b3soifddest.c b/src/spicelib/devices/bsim3soi_fd/b3soifddest.c index f2c90a571..aac1caa30 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifddest.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifddest.c @@ -21,8 +21,8 @@ B3SOIFDdestroy(GENmodel **inModel) B3SOIFDmodel *mod = *(B3SOIFDmodel**) inModel; while (mod) { - B3SOIFDmodel *next_mod = mod->B3SOIFDnextModel; - B3SOIFDinstance *inst = mod->B3SOIFDinstances; + B3SOIFDmodel *next_mod = B3SOIFDnextModel(mod); + B3SOIFDinstance *inst = B3SOIFDinstances(mod); while (inst) { B3SOIFDinstance *next_inst = inst->B3SOIFDnextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c b/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c index 85e65b2e1..ac8dd04e1 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdgetic.c @@ -23,8 +23,8 @@ B3SOIFDgetic(GENmodel *inModel, CKTcircuit *ckt) B3SOIFDmodel *model = (B3SOIFDmodel*)inModel; B3SOIFDinstance *here; - for (; model ; model = model->B3SOIFDnextModel) - { for (here = model->B3SOIFDinstances; here; here = here->B3SOIFDnextInstance) + for (; model ; model = B3SOIFDnextModel(model)) + { for (here = B3SOIFDinstances(model); here; here = here->B3SOIFDnextInstance) { if(!here->B3SOIFDicVBSGiven) { here->B3SOIFDicVBS = *(ckt->CKTrhs + here->B3SOIFDbNode) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdld.c index cc1ca827f..26f8d8bb4 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdld.c @@ -274,8 +274,8 @@ char nanmessage [12]; double m; -for (; model != NULL; model = model->B3SOIFDnextModel) -{ for (here = model->B3SOIFDinstances; here != NULL; +for (; model != NULL; model = B3SOIFDnextModel(model)) +{ for (here = B3SOIFDinstances(model); here != NULL; here = here->B3SOIFDnextInstance) { Check = 0; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c b/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c index 746f74f76..3128176c4 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdnoi.c @@ -127,8 +127,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->B3SOIFDnextModel) - { for (here = model->B3SOIFDinstances; here != NULL; + for (; model != NULL; model = B3SOIFDnextModel(model)) + { for (here = B3SOIFDinstances(model); here != NULL; here = here->B3SOIFDnextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c b/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c index 60b921680..0617afaba 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdpzld.c @@ -33,8 +33,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->B3SOIFDnextModel) - { for (here = model->B3SOIFDinstances; here!= NULL; + for (; model != NULL; model = B3SOIFDnextModel(model)) + { for (here = B3SOIFDinstances(model); here!= NULL; here = here->B3SOIFDnextInstance) { if (here->B3SOIFDmode >= 0) diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdset.c b/src/spicelib/devices/bsim3soi_fd/b3soifdset.c index feaa79db6..2a516d4c4 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdset.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdset.c @@ -47,7 +47,7 @@ IFuid tmpName; /* loop through all the B3SOIFD device models */ - for( ; model != NULL; model = model->B3SOIFDnextModel ) + for( ; model != NULL; model = B3SOIFDnextModel(model) ) { /* Default value Processing for B3SOIFD MOSFET Models */ @@ -875,7 +875,7 @@ IFuid tmpName; model->B3SOIFDnoif = 1.0; /* loop through all the instances of the model */ - for (here = model->B3SOIFDinstances; here != NULL ; + for (here = B3SOIFDinstances(model); here != NULL ; here=here->B3SOIFDnextInstance) { /* allocate a chunk of the state vector */ @@ -1346,9 +1346,9 @@ B3SOIFDunsetup(GENmodel *inModel, CKTcircuit *ckt) B3SOIFDinstance *here; for (model = (B3SOIFDmodel *)inModel; model != NULL; - model = model->B3SOIFDnextModel) + model = B3SOIFDnextModel(model)) { - for (here = model->B3SOIFDinstances; here != NULL; + for (here = B3SOIFDinstances(model); here != NULL; here=here->B3SOIFDnextInstance) { /* here for debugging purpose only */ diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c b/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c index 09cd832c7..2b30c8108 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdtemp.c @@ -45,7 +45,7 @@ double SDphi, SDgamma; int Size_Not_Found; /* loop through all the B3SOIFD device models */ - for (; model != NULL; model = model->B3SOIFDnextModel) + for (; model != NULL; model = B3SOIFDnextModel(model)) { Temp = ckt->CKTtemp; if (model->B3SOIFDGatesidewallJctPotential < 0.1) model->B3SOIFDGatesidewallJctPotential = 0.1; @@ -71,7 +71,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->B3SOIFDinstances; here != NULL; + for (here = B3SOIFDinstances(model); here != NULL; here = here->B3SOIFDnextInstance) { here->B3SOIFDrbodyext = here->B3SOIFDbodySquares * diff --git a/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c b/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c index cd7a7f0f5..58d3e00dd 100644 --- a/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c +++ b/src/spicelib/devices/bsim3soi_fd/b3soifdtrunc.c @@ -27,8 +27,8 @@ B3SOIFDinstance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->B3SOIFDnextModel) - { for (here = model->B3SOIFDinstances; here != NULL; + for (; model != NULL; model = B3SOIFDnextModel(model)) + { for (here = B3SOIFDinstances(model); here != NULL; here = here->B3SOIFDnextInstance) { diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c index b1f17d4ab..8de72830f 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdacld.c @@ -49,10 +49,10 @@ double xcedb, xcesb; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->B3SOIPDnextModel) + for (; model != NULL; model = B3SOIPDnextModel(model)) { - for (here = model->B3SOIPDinstances; here!= NULL; + for (here = B3SOIPDinstances(model); here!= NULL; here = here->B3SOIPDnextInstance) { selfheat = (model->B3SOIPDshMod == 1) && (here->B3SOIPDrth0 != 0.0); diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c b/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c index bb31f52fd..74963385c 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdcvtest.c @@ -29,9 +29,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the B3SOIPD device models */ - for (; model != NULL; model = model->B3SOIPDnextModel) + for (; model != NULL; model = B3SOIPDnextModel(model)) { /* loop through all the instances of the model */ - for (here = model->B3SOIPDinstances; here != NULL ; + for (here = B3SOIPDinstances(model); here != NULL ; here=here->B3SOIPDnextInstance) { vbs = model->B3SOIPDtype diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h index d38c9ea78..687bb8bbb 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipddef.h +++ b/src/spicelib/devices/bsim3soi_pd/b3soipddef.h @@ -587,12 +587,12 @@ struct b3soipdSizeDependParam typedef struct sB3SOIPDmodel { - int B3SOIPDmodType; - struct sB3SOIPDmodel *B3SOIPDnextModel; - B3SOIPDinstance *B3SOIPDinstances; - IFuid B3SOIPDmodName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/bsim3soi_pd/b3soipddest.c b/src/spicelib/devices/bsim3soi_pd/b3soipddest.c index 8f6c65f50..a0cc84829 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipddest.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipddest.c @@ -21,8 +21,8 @@ B3SOIPDdestroy(GENmodel **inModel) B3SOIPDmodel *mod = *(B3SOIPDmodel**) inModel; while (mod) { - B3SOIPDmodel *next_mod = mod->B3SOIPDnextModel; - B3SOIPDinstance *inst = mod->B3SOIPDinstances; + B3SOIPDmodel *next_mod = B3SOIPDnextModel(mod); + B3SOIPDinstance *inst = B3SOIPDinstances(mod); while (inst) { B3SOIPDinstance *next_inst = inst->B3SOIPDnextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c b/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c index 665c65ebb..62beac77b 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdgetic.c @@ -23,8 +23,8 @@ B3SOIPDgetic(GENmodel *inModel, CKTcircuit *ckt) B3SOIPDmodel *model = (B3SOIPDmodel*)inModel; B3SOIPDinstance *here; - for (; model ; model = model->B3SOIPDnextModel) - { for (here = model->B3SOIPDinstances; here; here = here->B3SOIPDnextInstance) + for (; model ; model = B3SOIPDnextModel(model)) + { for (here = B3SOIPDinstances(model); here; here = here->B3SOIPDnextInstance) { if(!here->B3SOIPDicVBSGiven) { here->B3SOIPDicVBS = *(ckt->CKTrhs + here->B3SOIPDbNode) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdld.c index 996cfac93..ff5c8c73e 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdld.c @@ -291,8 +291,8 @@ double gigT; double m; -for (; model != NULL; model = model->B3SOIPDnextModel) -{ for (here = model->B3SOIPDinstances; here != NULL; +for (; model != NULL; model = B3SOIPDnextModel(model)) +{ for (here = B3SOIPDinstances(model); here != NULL; here = here->B3SOIPDnextInstance) { Check = 0; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c b/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c index 866b310a8..cdc962008 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdnoi.c @@ -131,8 +131,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->B3SOIPDnextModel) - { for (here = model->B3SOIPDinstances; here != NULL; + for (; model != NULL; model = B3SOIPDnextModel(model)) + { for (here = B3SOIPDinstances(model); here != NULL; here = here->B3SOIPDnextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c b/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c index 99e2e4ea1..7d93ff689 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdpzld.c @@ -33,8 +33,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->B3SOIPDnextModel) - { for (here = model->B3SOIPDinstances; here!= NULL; + for (; model != NULL; model = B3SOIPDnextModel(model)) + { for (here = B3SOIPDinstances(model); here!= NULL; here = here->B3SOIPDnextInstance) { if (here->B3SOIPDmode >= 0) diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdset.c b/src/spicelib/devices/bsim3soi_pd/b3soipdset.c index 674d2de97..6acb8b224 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdset.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdset.c @@ -47,7 +47,7 @@ IFuid tmpName; /* loop through all the B3SOIPD device models */ - for( ; model != NULL; model = model->B3SOIPDnextModel ) + for( ; model != NULL; model = B3SOIPDnextModel(model) ) { /* Default value Processing for B3SOIPD MOSFET Models */ @@ -1048,7 +1048,7 @@ IFuid tmpName; model->B3SOIPDnoif = 1.0; /* loop through all the instances of the model */ - for (here = model->B3SOIPDinstances; here != NULL ; + for (here = B3SOIPDinstances(model); here != NULL ; here=here->B3SOIPDnextInstance) { /* allocate a chunk of the state vector */ @@ -1461,9 +1461,9 @@ B3SOIPDunsetup( B3SOIPDinstance *here; for (model = (B3SOIPDmodel *)inModel; model != NULL; - model = model->B3SOIPDnextModel) + model = B3SOIPDnextModel(model)) { - for (here = model->B3SOIPDinstances; here != NULL; + for (here = B3SOIPDinstances(model); here != NULL; here=here->B3SOIPDnextInstance) { /* here for debugging purpose only */ diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c b/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c index 305275603..65e88a977 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdtemp.c @@ -64,7 +64,7 @@ double tmp3, T7; /* loop through all the B3SOIPD device models */ - for (; model != NULL; model = model->B3SOIPDnextModel) + for (; model != NULL; model = B3SOIPDnextModel(model)) { Temp = ckt->CKTtemp; if (model->B3SOIPDGatesidewallJctPotential < 0.1) model->B3SOIPDGatesidewallJctPotential = 0.1; @@ -90,7 +90,7 @@ double tmp3, T7; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->B3SOIPDinstances; here != NULL; + for (here = B3SOIPDinstances(model); here != NULL; here = here->B3SOIPDnextInstance) { here->B3SOIPDrbodyext = here->B3SOIPDbodySquares * diff --git a/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c b/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c index 84a3d46b9..4c1c669d3 100644 --- a/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c +++ b/src/spicelib/devices/bsim3soi_pd/b3soipdtrunc.c @@ -27,8 +27,8 @@ B3SOIPDinstance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->B3SOIPDnextModel) - { for (here = model->B3SOIPDinstances; here != NULL; + for (; model != NULL; model = B3SOIPDnextModel(model)) + { for (here = B3SOIPDinstances(model); here != NULL; here = here->B3SOIPDnextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3v0/b3v0acld.c b/src/spicelib/devices/bsim3v0/b3v0acld.c index 2c55b5c17..2248035b2 100644 --- a/src/spicelib/devices/bsim3v0/b3v0acld.c +++ b/src/spicelib/devices/bsim3v0/b3v0acld.c @@ -26,11 +26,11 @@ double dxpart, sxpart, cqgb, cqdb, cqsb, cqbb, xcqgb, xcqdb, xcqsb, xcqbb; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM3v0nextModel) + for (; model != NULL; model = BSIM3v0nextModel(model)) { - for (here = model->BSIM3v0instances; here!= NULL; + for (here = BSIM3v0instances(model); here!= NULL; here = here->BSIM3v0nextInstance) { if (here->BSIM3v0mode >= 0) diff --git a/src/spicelib/devices/bsim3v0/b3v0cvtest.c b/src/spicelib/devices/bsim3v0/b3v0cvtest.c index fe5997f5e..9bc3d82ef 100644 --- a/src/spicelib/devices/bsim3v0/b3v0cvtest.c +++ b/src/spicelib/devices/bsim3v0/b3v0cvtest.c @@ -23,9 +23,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the BSIM3v0 device models */ - for (; model != NULL; model = model->BSIM3v0nextModel) + for (; model != NULL; model = BSIM3v0nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3v0instances; here != NULL ; + for (here = BSIM3v0instances(model); here != NULL ; here=here->BSIM3v0nextInstance) { vbs = model->BSIM3v0type diff --git a/src/spicelib/devices/bsim3v0/b3v0dest.c b/src/spicelib/devices/bsim3v0/b3v0dest.c index 2188a5bb8..179bc4c59 100644 --- a/src/spicelib/devices/bsim3v0/b3v0dest.c +++ b/src/spicelib/devices/bsim3v0/b3v0dest.c @@ -15,8 +15,8 @@ BSIM3v0destroy(GENmodel **inModel) BSIM3v0model *mod = *(BSIM3v0model**) inModel; while (mod) { - BSIM3v0model *next_mod = mod->BSIM3v0nextModel; - BSIM3v0instance *inst = mod->BSIM3v0instances; + BSIM3v0model *next_mod = BSIM3v0nextModel(mod); + BSIM3v0instance *inst = BSIM3v0instances(mod); while (inst) { BSIM3v0instance *next_inst = inst->BSIM3v0nextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim3v0/b3v0getic.c b/src/spicelib/devices/bsim3v0/b3v0getic.c index b4840a9f2..20d9fa0bf 100644 --- a/src/spicelib/devices/bsim3v0/b3v0getic.c +++ b/src/spicelib/devices/bsim3v0/b3v0getic.c @@ -17,8 +17,8 @@ BSIM3v0getic(GENmodel *inModel, CKTcircuit *ckt) BSIM3v0model *model = (BSIM3v0model*)inModel; BSIM3v0instance *here; - for (; model ; model = model->BSIM3v0nextModel) - { for (here = model->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) + for (; model ; model = BSIM3v0nextModel(model)) + { for (here = BSIM3v0instances(model); here; here = here->BSIM3v0nextInstance) { if(!here->BSIM3v0icVBSGiven) { here->BSIM3v0icVBS = *(ckt->CKTrhs + here->BSIM3v0bNode) diff --git a/src/spicelib/devices/bsim3v0/b3v0ld.c b/src/spicelib/devices/bsim3v0/b3v0ld.c index be7cead62..a265dada6 100644 --- a/src/spicelib/devices/bsim3v0/b3v0ld.c +++ b/src/spicelib/devices/bsim3v0/b3v0ld.c @@ -119,8 +119,8 @@ struct bsim3v0SizeDependParam *pParam; int ByPass, Check, ChargeComputationNeeded = 0, error; double m = 1.0; -for (; model != NULL; model = model->BSIM3v0nextModel) -{ for (here = model->BSIM3v0instances; here != NULL; +for (; model != NULL; model = BSIM3v0nextModel(model)) +{ for (here = BSIM3v0instances(model); here != NULL; here = here->BSIM3v0nextInstance) { Check = 1; diff --git a/src/spicelib/devices/bsim3v0/b3v0noi.c b/src/spicelib/devices/bsim3v0/b3v0noi.c index d91bfe2d1..753746a1e 100644 --- a/src/spicelib/devices/bsim3v0/b3v0noi.c +++ b/src/spicelib/devices/bsim3v0/b3v0noi.c @@ -100,8 +100,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM3v0nextModel) - { for (here = model->BSIM3v0instances; here != NULL; + for (; model != NULL; model = BSIM3v0nextModel(model)) + { for (here = BSIM3v0instances(model); here != NULL; here = here->BSIM3v0nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim3v0/b3v0pzld.c b/src/spicelib/devices/bsim3v0/b3v0pzld.c index db0b2e1f4..b8c57d9e3 100644 --- a/src/spicelib/devices/bsim3v0/b3v0pzld.c +++ b/src/spicelib/devices/bsim3v0/b3v0pzld.c @@ -26,8 +26,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->BSIM3v0nextModel) - { for (here = model->BSIM3v0instances; here!= NULL; + for (; model != NULL; model = BSIM3v0nextModel(model)) + { for (here = BSIM3v0instances(model); here!= NULL; here = here->BSIM3v0nextInstance) { if (here->BSIM3v0mode >= 0) diff --git a/src/spicelib/devices/bsim3v0/b3v0set.c b/src/spicelib/devices/bsim3v0/b3v0set.c index b0574396d..058c1b8d6 100644 --- a/src/spicelib/devices/bsim3v0/b3v0set.c +++ b/src/spicelib/devices/bsim3v0/b3v0set.c @@ -35,7 +35,7 @@ CKTnode *tmpNode; IFuid tmpName; /* loop through all the BSIM3v0 device models */ - for( ; model != NULL; model = model->BSIM3v0nextModel ) + for( ; model != NULL; model = BSIM3v0nextModel(model) ) { /* Default value Processing for BSIM3v0 MOSFET Models */ if (!model->BSIM3v0typeGiven) @@ -749,7 +749,7 @@ IFuid tmpName; if (!model->BSIM3v0kfGiven) model->BSIM3v0kf = 0.0; /* loop through all the instances of the model */ - for (here = model->BSIM3v0instances; here != NULL ; + for (here = BSIM3v0instances(model); here != NULL ; here=here->BSIM3v0nextInstance) { /* allocate a chunk of the state vector */ @@ -899,9 +899,9 @@ BSIM3v0unsetup(GENmodel *inModel, CKTcircuit *ckt) BSIM3v0instance *here; for (model = (BSIM3v0model *)inModel; model != NULL; - model = model->BSIM3v0nextModel) + model = BSIM3v0nextModel(model)) { - for (here = model->BSIM3v0instances; here != NULL; + for (here = BSIM3v0instances(model); here != NULL; here=here->BSIM3v0nextInstance) { if (here->BSIM3v0qNode > 0) diff --git a/src/spicelib/devices/bsim3v0/b3v0temp.c b/src/spicelib/devices/bsim3v0/b3v0temp.c index 579289793..7f7184cfe 100644 --- a/src/spicelib/devices/bsim3v0/b3v0temp.c +++ b/src/spicelib/devices/bsim3v0/b3v0temp.c @@ -36,7 +36,7 @@ double Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom; int Size_Not_Found; /* loop through all the BSIM3v0 device models */ - for (; model != NULL; model = model->BSIM3v0nextModel) + for (; model != NULL; model = BSIM3v0nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM3v0bulkJctPotential < 0.1) model->BSIM3v0bulkJctPotential = 0.1; @@ -49,7 +49,7 @@ int Size_Not_Found; TRatio = Temp / Tnom; /* loop through all the instances of the model */ - for (here = model->BSIM3v0instances; here != NULL; + for (here = BSIM3v0instances(model); here != NULL; here=here->BSIM3v0nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim3v0/b3v0trunc.c b/src/spicelib/devices/bsim3v0/b3v0trunc.c index b06ae0ad0..0d98cd711 100644 --- a/src/spicelib/devices/bsim3v0/b3v0trunc.c +++ b/src/spicelib/devices/bsim3v0/b3v0trunc.c @@ -21,8 +21,8 @@ BSIM3v0instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM3v0nextModel) - { for (here = model->BSIM3v0instances; here != NULL; + for (; model != NULL; model = BSIM3v0nextModel(model)) + { for (here = BSIM3v0instances(model); here != NULL; here = here->BSIM3v0nextInstance) { diff --git a/src/spicelib/devices/bsim3v0/bsim3v0def.h b/src/spicelib/devices/bsim3v0/bsim3v0def.h index 2e14bed98..35ca31fe5 100644 --- a/src/spicelib/devices/bsim3v0/bsim3v0def.h +++ b/src/spicelib/devices/bsim3v0/bsim3v0def.h @@ -318,12 +318,12 @@ struct bsim3v0SizeDependParam typedef struct sBSIM3v0model { - int BSIM3v0modType; - struct sBSIM3v0model *BSIM3v0nextModel; - BSIM3v0instance *BSIM3v0instances; - IFuid BSIM3v0modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b3v1acld.c b/src/spicelib/devices/bsim3v1/b3v1acld.c index b60c780dd..8f5a9c736 100644 --- a/src/spicelib/devices/bsim3v1/b3v1acld.c +++ b/src/spicelib/devices/bsim3v1/b3v1acld.c @@ -32,11 +32,11 @@ BSIM3v1acLoad (GENmodel * inModel, CKTcircuit * ckt) double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM3v1nextModel) + for (; model != NULL; model = BSIM3v1nextModel(model)) { - for (here = model->BSIM3v1instances; here != NULL; + for (here = BSIM3v1instances(model); here != NULL; here = here->BSIM3v1nextInstance) { if (here->BSIM3v1mode >= 0) diff --git a/src/spicelib/devices/bsim3v1/b3v1cvtest.c b/src/spicelib/devices/bsim3v1/b3v1cvtest.c index 201a7be39..668b92c93 100644 --- a/src/spicelib/devices/bsim3v1/b3v1cvtest.c +++ b/src/spicelib/devices/bsim3v1/b3v1cvtest.c @@ -29,9 +29,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the BSIM3v1 device models */ - for (; model != NULL; model = model->BSIM3v1nextModel) + for (; model != NULL; model = BSIM3v1nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3v1instances; here != NULL ; + for (here = BSIM3v1instances(model); here != NULL ; here=here->BSIM3v1nextInstance) { vbs = model->BSIM3v1type diff --git a/src/spicelib/devices/bsim3v1/b3v1dest.c b/src/spicelib/devices/bsim3v1/b3v1dest.c index 6fa9a6c0d..5a3b11068 100644 --- a/src/spicelib/devices/bsim3v1/b3v1dest.c +++ b/src/spicelib/devices/bsim3v1/b3v1dest.c @@ -21,8 +21,8 @@ BSIM3v1destroy(GENmodel **inModel) BSIM3v1model *mod = *(BSIM3v1model**) inModel; while (mod) { - BSIM3v1model *next_mod = mod->BSIM3v1nextModel; - BSIM3v1instance *inst = mod->BSIM3v1instances; + BSIM3v1model *next_mod = BSIM3v1nextModel(mod); + BSIM3v1instance *inst = BSIM3v1instances(mod); while (inst) { BSIM3v1instance *next_inst = inst->BSIM3v1nextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsim3v1/b3v1getic.c b/src/spicelib/devices/bsim3v1/b3v1getic.c index 76a413607..40c759bcb 100644 --- a/src/spicelib/devices/bsim3v1/b3v1getic.c +++ b/src/spicelib/devices/bsim3v1/b3v1getic.c @@ -23,8 +23,8 @@ BSIM3v1getic(GENmodel *inModel, CKTcircuit *ckt) BSIM3v1model *model = (BSIM3v1model*)inModel; BSIM3v1instance *here; - for (; model ; model = model->BSIM3v1nextModel) - { for (here = model->BSIM3v1instances; here; here = here->BSIM3v1nextInstance) + for (; model ; model = BSIM3v1nextModel(model)) + { for (here = BSIM3v1instances(model); here; here = here->BSIM3v1nextInstance) { if(!here->BSIM3v1icVBSGiven) { here->BSIM3v1icVBS = *(ckt->CKTrhs + here->BSIM3v1bNode) diff --git a/src/spicelib/devices/bsim3v1/b3v1ld.c b/src/spicelib/devices/bsim3v1/b3v1ld.c index a83a784d0..fbca8308f 100644 --- a/src/spicelib/devices/bsim3v1/b3v1ld.c +++ b/src/spicelib/devices/bsim3v1/b3v1ld.c @@ -125,8 +125,8 @@ double m = 1.0; struct bsim3v1SizeDependParam *pParam; int ByPass, Check, ChargeComputationNeeded = 0, error; -for (; model != NULL; model = model->BSIM3v1nextModel) -{ for (here = model->BSIM3v1instances; here != NULL; +for (; model != NULL; model = BSIM3v1nextModel(model)) +{ for (here = BSIM3v1instances(model); here != NULL; here = here->BSIM3v1nextInstance) { Check = 1; diff --git a/src/spicelib/devices/bsim3v1/b3v1noi.c b/src/spicelib/devices/bsim3v1/b3v1noi.c index 1ac3e8f5f..4a6683f0c 100644 --- a/src/spicelib/devices/bsim3v1/b3v1noi.c +++ b/src/spicelib/devices/bsim3v1/b3v1noi.c @@ -123,8 +123,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM3v1nextModel) - { for (here = model->BSIM3v1instances; here != NULL; + for (; model != NULL; model = BSIM3v1nextModel(model)) + { for (here = BSIM3v1instances(model); here != NULL; here = here->BSIM3v1nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim3v1/b3v1pzld.c b/src/spicelib/devices/bsim3v1/b3v1pzld.c index 19e41f8a1..134b8def7 100644 --- a/src/spicelib/devices/bsim3v1/b3v1pzld.c +++ b/src/spicelib/devices/bsim3v1/b3v1pzld.c @@ -32,8 +32,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->BSIM3v1nextModel) - { for (here = model->BSIM3v1instances; here!= NULL; + for (; model != NULL; model = BSIM3v1nextModel(model)) + { for (here = BSIM3v1instances(model); here!= NULL; here = here->BSIM3v1nextInstance) { if (here->BSIM3v1mode >= 0) diff --git a/src/spicelib/devices/bsim3v1/b3v1set.c b/src/spicelib/devices/bsim3v1/b3v1set.c index a1818084e..331e04676 100644 --- a/src/spicelib/devices/bsim3v1/b3v1set.c +++ b/src/spicelib/devices/bsim3v1/b3v1set.c @@ -41,7 +41,7 @@ CKTnode *tmpNode; IFuid tmpName; /* loop through all the BSIM3v1 device models */ - for( ; model != NULL; model = model->BSIM3v1nextModel ) + for( ; model != NULL; model = BSIM3v1nextModel(model) ) { /* Default value Processing for BSIM3v1 MOSFET Models */ if (!model->BSIM3v1typeGiven) @@ -775,7 +775,7 @@ IFuid tmpName; if (!model->BSIM3v1kfGiven) model->BSIM3v1kf = 0.0; /* loop through all the instances of the model */ - for (here = model->BSIM3v1instances; here != NULL ; + for (here = BSIM3v1instances(model); here != NULL ; here=here->BSIM3v1nextInstance) { /* allocate a chunk of the state vector */ @@ -959,9 +959,9 @@ BSIM3v1unsetup(GENmodel *inModel, CKTcircuit *ckt) BSIM3v1instance *here; for (model = (BSIM3v1model *)inModel; model != NULL; - model = model->BSIM3v1nextModel) + model = BSIM3v1nextModel(model)) { - for (here = model->BSIM3v1instances; here != NULL; + for (here = BSIM3v1instances(model); here != NULL; here=here->BSIM3v1nextInstance) { if (here->BSIM3v1qNode > 0) diff --git a/src/spicelib/devices/bsim3v1/b3v1temp.c b/src/spicelib/devices/bsim3v1/b3v1temp.c index 0a5e089d6..a4cbb1d53 100644 --- a/src/spicelib/devices/bsim3v1/b3v1temp.c +++ b/src/spicelib/devices/bsim3v1/b3v1temp.c @@ -43,7 +43,7 @@ double Temp, TRatio, Inv_L, Inv_W, Inv_LW, Vtm0, Tnom; int Size_Not_Found; /* loop through all the BSIM3v1 device models */ - for (; model != NULL; model = model->BSIM3v1nextModel) + for (; model != NULL; model = BSIM3v1nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM3v1bulkJctPotential < 0.1) model->BSIM3v1bulkJctPotential = 0.1; @@ -89,7 +89,7 @@ int Size_Not_Found; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->BSIM3v1instances; here != NULL; + for (here = BSIM3v1instances(model); here != NULL; here = here->BSIM3v1nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim3v1/b3v1trunc.c b/src/spicelib/devices/bsim3v1/b3v1trunc.c index e18e67111..310c79c80 100644 --- a/src/spicelib/devices/bsim3v1/b3v1trunc.c +++ b/src/spicelib/devices/bsim3v1/b3v1trunc.c @@ -27,8 +27,8 @@ BSIM3v1instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM3v1nextModel) - { for (here = model->BSIM3v1instances; here != NULL; + for (; model != NULL; model = BSIM3v1nextModel(model)) + { for (here = BSIM3v1instances(model); here != NULL; here = here->BSIM3v1nextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3v1/bsim3v1def.h b/src/spicelib/devices/bsim3v1/bsim3v1def.h index 8aba22813..9767db169 100644 --- a/src/spicelib/devices/bsim3v1/bsim3v1def.h +++ b/src/spicelib/devices/bsim3v1/bsim3v1def.h @@ -320,12 +320,12 @@ struct bsim3v1SizeDependParam typedef struct sBSIM3v1model { - int BSIM3v1modType; - struct sBSIM3v1model *BSIM3v1nextModel; - BSIM3v1instance *BSIM3v1instances; - IFuid BSIM3v1modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b3v32acld.c b/src/spicelib/devices/bsim3v32/b3v32acld.c index e7870a4e5..03045a42a 100644 --- a/src/spicelib/devices/bsim3v32/b3v32acld.c +++ b/src/spicelib/devices/bsim3v32/b3v32acld.c @@ -36,8 +36,8 @@ double ScalingFactor = 1.0e-9; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM3v32nextModel) - { for (here = model->BSIM3v32instances; here!= NULL; + for (; model != NULL; model = BSIM3v32nextModel(model)) + { for (here = BSIM3v32instances(model); here!= NULL; here = here->BSIM3v32nextInstance) { if (here->BSIM3v32mode >= 0) diff --git a/src/spicelib/devices/bsim3v32/b3v32cvtest.c b/src/spicelib/devices/bsim3v32/b3v32cvtest.c index 8d0f717fe..fc6e9b6c1 100644 --- a/src/spicelib/devices/bsim3v32/b3v32cvtest.c +++ b/src/spicelib/devices/bsim3v32/b3v32cvtest.c @@ -28,9 +28,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the BSIM3v32 device models */ - for (; model != NULL; model = model->BSIM3v32nextModel) + for (; model != NULL; model = BSIM3v32nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3v32instances; here != NULL ; + for (here = BSIM3v32instances(model); here != NULL ; here=here->BSIM3v32nextInstance) { vbs = model->BSIM3v32type diff --git a/src/spicelib/devices/bsim3v32/b3v32dest.c b/src/spicelib/devices/bsim3v32/b3v32dest.c index b20736ffc..388c6a057 100644 --- a/src/spicelib/devices/bsim3v32/b3v32dest.c +++ b/src/spicelib/devices/bsim3v32/b3v32dest.c @@ -25,8 +25,8 @@ BSIM3v32destroy (GENmodel **inModel) #endif while (mod) { - BSIM3v32model *next_mod = mod->BSIM3v32nextModel; - BSIM3v32instance *inst = mod->BSIM3v32instances; + BSIM3v32model *next_mod = BSIM3v32nextModel(mod); + BSIM3v32instance *inst = BSIM3v32instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim3v32SizeDependParam *p = mod->pSizeDependParamKnot; while (p) { diff --git a/src/spicelib/devices/bsim3v32/b3v32getic.c b/src/spicelib/devices/bsim3v32/b3v32getic.c index 5c7bab523..168f57794 100644 --- a/src/spicelib/devices/bsim3v32/b3v32getic.c +++ b/src/spicelib/devices/bsim3v32/b3v32getic.c @@ -21,8 +21,8 @@ BSIM3v32getic (GENmodel *inModel, CKTcircuit *ckt) BSIM3v32model *model = (BSIM3v32model*)inModel; BSIM3v32instance *here; - for (; model ; model = model->BSIM3v32nextModel) - { for (here = model->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) + for (; model ; model = BSIM3v32nextModel(model)) + { for (here = BSIM3v32instances(model); here; here = here->BSIM3v32nextInstance) { if (!here->BSIM3v32icVBSGiven) { here->BSIM3v32icVBS = *(ckt->CKTrhs + here->BSIM3v32bNode) diff --git a/src/spicelib/devices/bsim3v32/b3v32ld.c b/src/spicelib/devices/bsim3v32/b3v32ld.c index 79e095b3a..339347a35 100644 --- a/src/spicelib/devices/bsim3v32/b3v32ld.c +++ b/src/spicelib/devices/bsim3v32/b3v32ld.c @@ -171,8 +171,8 @@ ChargeComputationNeeded = ((ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC))) ? 1 : 0; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM3v32nextModel) -{ for (here = model->BSIM3v32instances; here != NULL; +for (; model != NULL; model = BSIM3v32nextModel(model)) +{ for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { #endif diff --git a/src/spicelib/devices/bsim3v32/b3v32noi.c b/src/spicelib/devices/bsim3v32/b3v32noi.c index 07a8ca93f..dc711dcd9 100644 --- a/src/spicelib/devices/bsim3v32/b3v32noi.c +++ b/src/spicelib/devices/bsim3v32/b3v32noi.c @@ -208,8 +208,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM3v32nextModel) - { for (here = model->BSIM3v32instances; here != NULL; + for (; model != NULL; model = BSIM3v32nextModel(model)) + { for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim3v32/b3v32pzld.c b/src/spicelib/devices/bsim3v32/b3v32pzld.c index ddadb53af..3e8f59c16 100644 --- a/src/spicelib/devices/bsim3v32/b3v32pzld.c +++ b/src/spicelib/devices/bsim3v32/b3v32pzld.c @@ -36,8 +36,8 @@ double T1, CoxWL, qcheq, Cdg, Cdd, Cds, Csg, Csd, Css; double ScalingFactor = 1.0e-9; double m; - for (; model != NULL; model = model->BSIM3v32nextModel) - { for (here = model->BSIM3v32instances; here!= NULL; + for (; model != NULL; model = BSIM3v32nextModel(model)) + { for (here = BSIM3v32instances(model); here!= NULL; here = here->BSIM3v32nextInstance) { if (here->BSIM3v32mode >= 0) diff --git a/src/spicelib/devices/bsim3v32/b3v32set.c b/src/spicelib/devices/bsim3v32/b3v32set.c index 6025934ac..8158191e5 100644 --- a/src/spicelib/devices/bsim3v32/b3v32set.c +++ b/src/spicelib/devices/bsim3v32/b3v32set.c @@ -45,7 +45,7 @@ BSIM3v32instance **InstArray; #endif /* loop through all the BSIM3v32 device models */ - for( ; model != NULL; model = model->BSIM3v32nextModel ) + for( ; model != NULL; model = BSIM3v32nextModel(model) ) { /* Default value Processing for BSIM3v32 MOSFET Models */ if (!model->BSIM3v32typeGiven) @@ -936,7 +936,7 @@ BSIM3v32instance **InstArray; model->BSIM3v32vbdrMax = 1e99; /* loop through all the instances of the model */ - for (here = model->BSIM3v32instances; here != NULL ; + for (here = BSIM3v32instances(model); here != NULL ; here=here->BSIM3v32nextInstance) { /* allocate a chunk of the state vector */ @@ -1141,10 +1141,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ /* loop through all the BSIM3 device models to count the number of instances */ - for (; model != NULL; model = model->BSIM3v32nextModel) + for (; model != NULL; model = BSIM3v32nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3v32instances; here != NULL; + for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { InstCount++; @@ -1153,10 +1153,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ InstArray = TMALLOC(BSIM3v32instance*, InstCount); model = (BSIM3v32model*)inModel; idx = 0; - for (; model != NULL; model = model->BSIM3v32nextModel) + for (; model != NULL; model = BSIM3v32nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM3v32instances; here != NULL; + for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { InstArray[idx] = here; @@ -1180,9 +1180,9 @@ BSIM3v32unsetup( BSIM3v32instance *here; for (model = (BSIM3v32model *)inModel; model != NULL; - model = model->BSIM3v32nextModel) + model = BSIM3v32nextModel(model)) { - for (here = model->BSIM3v32instances; here != NULL; + for (here = BSIM3v32instances(model); here != NULL; here=here->BSIM3v32nextInstance) { if (here->BSIM3v32qNode > 0) diff --git a/src/spicelib/devices/bsim3v32/b3v32soachk.c b/src/spicelib/devices/bsim3v32/b3v32soachk.c index a4bf39a8f..8e212e6d4 100644 --- a/src/spicelib/devices/bsim3v32/b3v32soachk.c +++ b/src/spicelib/devices/bsim3v32/b3v32soachk.c @@ -33,9 +33,9 @@ BSIM3v32soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM3v32nextModel) { + for (; model; model = BSIM3v32nextModel(model)) { - for (here = model->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) { + for (here = BSIM3v32instances(model); here; here = here->BSIM3v32nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM3v32gNode] - ckt->CKTrhsOld [here->BSIM3v32sNodePrime]; diff --git a/src/spicelib/devices/bsim3v32/b3v32temp.c b/src/spicelib/devices/bsim3v32/b3v32temp.c index 7725f69b3..1b40caf87 100644 --- a/src/spicelib/devices/bsim3v32/b3v32temp.c +++ b/src/spicelib/devices/bsim3v32/b3v32temp.c @@ -41,7 +41,7 @@ double Nvtm, SourceSatCurrent, DrainSatCurrent; int Size_Not_Found, error; /* loop through all the BSIM3v32 device models */ - for (; model != NULL; model = model->BSIM3v32nextModel) + for (; model != NULL; model = BSIM3v32nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM3v32bulkJctPotential < 0.1) { model->BSIM3v32bulkJctPotential = 0.1; @@ -209,7 +209,7 @@ int Size_Not_Found, error; /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->BSIM3v32instances; here != NULL; + for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim3v32/b3v32trunc.c b/src/spicelib/devices/bsim3v32/b3v32trunc.c index 976377af6..17e60f689 100644 --- a/src/spicelib/devices/bsim3v32/b3v32trunc.c +++ b/src/spicelib/devices/bsim3v32/b3v32trunc.c @@ -26,8 +26,8 @@ BSIM3v32instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM3v32nextModel) - { for (here = model->BSIM3v32instances; here != NULL; + for (; model != NULL; model = BSIM3v32nextModel(model)) + { for (here = BSIM3v32instances(model); here != NULL; here = here->BSIM3v32nextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim3v32/bsim3v32def.h b/src/spicelib/devices/bsim3v32/bsim3v32def.h index 1a65860e6..51d1364d3 100644 --- a/src/spicelib/devices/bsim3v32/bsim3v32def.h +++ b/src/spicelib/devices/bsim3v32/bsim3v32def.h @@ -396,12 +396,12 @@ struct bsim3v32SizeDependParam typedef struct sBSIM3v32model { - int BSIM3v32modType; - struct sBSIM3v32model *BSIM3v32nextModel; - BSIM3v32instance *BSIM3v32instances; - IFuid BSIM3v32modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b4acld.c b/src/spicelib/devices/bsim4/b4acld.c index b7cd1eec9..e03a2161e 100644 --- a/src/spicelib/devices/bsim4/b4acld.c +++ b/src/spicelib/devices/bsim4/b4acld.c @@ -104,8 +104,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM4nextModel) - { for (here = model->BSIM4instances; here!= NULL; + for (; model != NULL; model = BSIM4nextModel(model)) + { for (here = BSIM4instances(model); here!= NULL; here = here->BSIM4nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4/b4cvtest.c b/src/spicelib/devices/bsim4/b4cvtest.c index 31d7f4d18..56ce48fb8 100644 --- a/src/spicelib/devices/bsim4/b4cvtest.c +++ b/src/spicelib/devices/bsim4/b4cvtest.c @@ -86,8 +86,8 @@ double Isestot, cseshat, Idedtot, cdedhat; double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; double tol0, tol1, tol2, tol3, tol4, tol5, tol6; - for (; model != NULL; model = model->BSIM4nextModel) - { for (here = model->BSIM4instances; here != NULL ; + for (; model != NULL; model = BSIM4nextModel(model)) + { for (here = BSIM4instances(model); here != NULL ; here=here->BSIM4nextInstance) { vds = model->BSIM4type diff --git a/src/spicelib/devices/bsim4/b4dest.c b/src/spicelib/devices/bsim4/b4dest.c index 66379be0d..8a91e603b 100644 --- a/src/spicelib/devices/bsim4/b4dest.c +++ b/src/spicelib/devices/bsim4/b4dest.c @@ -74,8 +74,8 @@ BSIM4destroy(GENmodel **inModel) #endif while (mod) { - BSIM4model *next_mod = mod->BSIM4nextModel; - BSIM4instance *inst = mod->BSIM4instances; + BSIM4model *next_mod = BSIM4nextModel(mod); + BSIM4instance *inst = BSIM4instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot; while (p) { diff --git a/src/spicelib/devices/bsim4/b4getic.c b/src/spicelib/devices/bsim4/b4getic.c index 62b5b5529..6167ed960 100644 --- a/src/spicelib/devices/bsim4/b4getic.c +++ b/src/spicelib/devices/bsim4/b4getic.c @@ -73,8 +73,8 @@ CKTcircuit *ckt) BSIM4model *model = (BSIM4model*)inModel; BSIM4instance *here; - for (; model ; model = model->BSIM4nextModel) - { for (here = model->BSIM4instances; here; here = here->BSIM4nextInstance) + for (; model ; model = BSIM4nextModel(model)) + { for (here = BSIM4instances(model); here; here = here->BSIM4nextInstance) { if (!here->BSIM4icVDSGiven) { here->BSIM4icVDS = *(ckt->CKTrhs + here->BSIM4dNode) diff --git a/src/spicelib/devices/bsim4/b4ld.c b/src/spicelib/devices/bsim4/b4ld.c index 5c5651ced..049738097 100644 --- a/src/spicelib/devices/bsim4/b4ld.c +++ b/src/spicelib/devices/bsim4/b4ld.c @@ -286,8 +286,8 @@ ChargeComputationNeeded = ? 1 : 0; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM4nextModel) -{ for (here = model->BSIM4instances; here != NULL; +for (; model != NULL; model = BSIM4nextModel(model)) +{ for (here = BSIM4instances(model); here != NULL; here = here->BSIM4nextInstance) { #endif diff --git a/src/spicelib/devices/bsim4/b4noi.c b/src/spicelib/devices/bsim4/b4noi.c index 5ef294244..63a98a318 100644 --- a/src/spicelib/devices/bsim4/b4noi.c +++ b/src/spicelib/devices/bsim4/b4noi.c @@ -168,13 +168,13 @@ double m; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM4nextModel) + for (; model != NULL; model = BSIM4nextModel(model)) { if(model->BSIM4tnoiMod != 2) { noizDens[BSIM4CORLNOIZ] = 0.0; lnNdens[BSIM4CORLNOIZ] = N_MINLOG; } - for (here = model->BSIM4instances; here != NULL; + for (here = BSIM4instances(model); here != NULL; here = here->BSIM4nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim4/b4pzld.c b/src/spicelib/devices/bsim4/b4pzld.c index 744e3bcfe..57ec67f75 100644 --- a/src/spicelib/devices/bsim4/b4pzld.c +++ b/src/spicelib/devices/bsim4/b4pzld.c @@ -99,8 +99,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; - for (; model != NULL; model = model->BSIM4nextModel) - { for (here = model->BSIM4instances; here!= NULL; + for (; model != NULL; model = BSIM4nextModel(model)) + { for (here = BSIM4instances(model); here!= NULL; here = here->BSIM4nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 7139ef8fc..b59b1b1e2 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -109,7 +109,7 @@ BSIM4instance **InstArray; } /* loop through all the BSIM4 device models */ - for( ; model != NULL; model = model->BSIM4nextModel ) + for( ; model != NULL; model = BSIM4nextModel(model) ) { /* process defaults of model parameters */ if (!model->BSIM4typeGiven) model->BSIM4type = NMOS; @@ -2335,7 +2335,7 @@ BSIM4instance **InstArray; * through all the instances of the model */ - for (here = model->BSIM4instances; here != NULL ; + for (here = BSIM4instances(model); here != NULL ; here=here->BSIM4nextInstance) { /* allocate a chunk of the state vector */ @@ -2720,10 +2720,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL /* loop through all the BSIM4 device models to count the number of instances */ - for( ; model != NULL; model = model->BSIM4nextModel ) + for( ; model != NULL; model = BSIM4nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4instances; here != NULL ; + for (here = BSIM4instances(model); here != NULL ; here=here->BSIM4nextInstance) { InstCount++; @@ -2732,10 +2732,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL InstArray = TMALLOC(BSIM4instance*, InstCount); model = (BSIM4model*)inModel; idx = 0; - for( ; model != NULL; model = model->BSIM4nextModel ) + for( ; model != NULL; model = BSIM4nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4instances; here != NULL ; + for (here = BSIM4instances(model); here != NULL ; here=here->BSIM4nextInstance) { InstArray[idx] = here; @@ -2760,9 +2760,9 @@ CKTcircuit *ckt) BSIM4instance *here; for (model = (BSIM4model *)inModel; model != NULL; - model = model->BSIM4nextModel) + model = BSIM4nextModel(model)) { - for (here = model->BSIM4instances; here != NULL; + for (here = BSIM4instances(model); here != NULL; here=here->BSIM4nextInstance) { if (here->BSIM4qNode > 0) diff --git a/src/spicelib/devices/bsim4/b4soachk.c b/src/spicelib/devices/bsim4/b4soachk.c index 6b7639878..edffb4657 100644 --- a/src/spicelib/devices/bsim4/b4soachk.c +++ b/src/spicelib/devices/bsim4/b4soachk.c @@ -33,9 +33,9 @@ BSIM4soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM4nextModel) { + for (; model; model = BSIM4nextModel(model)) { - for (here = model->BSIM4instances; here; here = here->BSIM4nextInstance) { + for (here = BSIM4instances(model); here; here = here->BSIM4nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM4gNodePrime] - ckt->CKTrhsOld [here->BSIM4sNodePrime]; diff --git a/src/spicelib/devices/bsim4/b4temp.c b/src/spicelib/devices/bsim4/b4temp.c index 8d8ce3934..7f367570c 100644 --- a/src/spicelib/devices/bsim4/b4temp.c +++ b/src/spicelib/devices/bsim4/b4temp.c @@ -128,7 +128,7 @@ double vtfbphi2eot, phieot, TempRatioeot, Vtm0eot, Vtmeot,vbieot; int Size_Not_Found, i; /* loop through all the BSIM4 device models */ - for (; model != NULL; model = model->BSIM4nextModel) + for (; model != NULL; model = BSIM4nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM4SbulkJctPotential < 0.1) { model->BSIM4SbulkJctPotential = 0.1; @@ -442,7 +442,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ - for (here = model->BSIM4instances; here != NULL; + for (here = BSIM4instances(model); here != NULL; here = here->BSIM4nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim4/b4trunc.c b/src/spicelib/devices/bsim4/b4trunc.c index 61d14a9e8..1578fc853 100644 --- a/src/spicelib/devices/bsim4/b4trunc.c +++ b/src/spicelib/devices/bsim4/b4trunc.c @@ -78,8 +78,8 @@ BSIM4instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM4nextModel) - { for (here = model->BSIM4instances; here != NULL; + for (; model != NULL; model = BSIM4nextModel(model)) + { for (here = BSIM4instances(model); here != NULL; here = here->BSIM4nextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim4/bsim4def.h b/src/spicelib/devices/bsim4/bsim4def.h index 2a10ea10b..adfe62fa8 100644 --- a/src/spicelib/devices/bsim4/bsim4def.h +++ b/src/spicelib/devices/bsim4/bsim4def.h @@ -857,12 +857,12 @@ struct bsim4SizeDependParam typedef struct sBSIM4model { - int BSIM4modType; - struct sBSIM4model *BSIM4nextModel; - BSIM4instance *BSIM4instances; - IFuid BSIM4modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b4v5acld.c b/src/spicelib/devices/bsim4v5/b4v5acld.c index 76fa8e5b0..230097a2b 100644 --- a/src/spicelib/devices/bsim4v5/b4v5acld.c +++ b/src/spicelib/devices/bsim4v5/b4v5acld.c @@ -55,8 +55,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here!= NULL; + for (; model != NULL; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here!= NULL; here = here->BSIM4v5nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v5/b4v5cvtest.c b/src/spicelib/devices/bsim4v5/b4v5cvtest.c index daebb4463..d86acb86b 100644 --- a/src/spicelib/devices/bsim4v5/b4v5cvtest.c +++ b/src/spicelib/devices/bsim4v5/b4v5cvtest.c @@ -39,8 +39,8 @@ double Isestot, cseshat, Idedtot, cdedhat; double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; double tol0, tol1, tol2, tol3, tol4, tol5, tol6; - for (; model != NULL; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here != NULL ; + for (; model != NULL; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here != NULL ; here=here->BSIM4v5nextInstance) { vds = model->BSIM4v5type diff --git a/src/spicelib/devices/bsim4v5/b4v5dest.c b/src/spicelib/devices/bsim4v5/b4v5dest.c index 876062d46..7dcd9e103 100644 --- a/src/spicelib/devices/bsim4v5/b4v5dest.c +++ b/src/spicelib/devices/bsim4v5/b4v5dest.c @@ -24,8 +24,8 @@ BSIM4v5destroy(GENmodel **inModel) #endif while (mod) { - BSIM4v5model *next_mod = mod->BSIM4v5nextModel; - BSIM4v5instance *inst = mod->BSIM4v5instances; + BSIM4v5model *next_mod = BSIM4v5nextModel(mod); + BSIM4v5instance *inst = BSIM4v5instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim4v5SizeDependParam *p = mod->pSizeDependParamKnot; while (p) { diff --git a/src/spicelib/devices/bsim4v5/b4v5getic.c b/src/spicelib/devices/bsim4v5/b4v5getic.c index 62cfaaafc..c7c5a956a 100644 --- a/src/spicelib/devices/bsim4v5/b4v5getic.c +++ b/src/spicelib/devices/bsim4v5/b4v5getic.c @@ -23,8 +23,8 @@ CKTcircuit *ckt) BSIM4v5model *model = (BSIM4v5model*)inModel; BSIM4v5instance *here; - for (; model ; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) + for (; model ; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here; here = here->BSIM4v5nextInstance) { if (!here->BSIM4v5icVDSGiven) { here->BSIM4v5icVDS = *(ckt->CKTrhs + here->BSIM4v5dNode) diff --git a/src/spicelib/devices/bsim4v5/b4v5ld.c b/src/spicelib/devices/bsim4v5/b4v5ld.c index 040b10a09..48b6cce96 100644 --- a/src/spicelib/devices/bsim4v5/b4v5ld.c +++ b/src/spicelib/devices/bsim4v5/b4v5ld.c @@ -237,8 +237,8 @@ ChargeComputationNeeded = ChargeComputationNeeded = 1; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM4v5nextModel) -{ for (here = model->BSIM4v5instances; here != NULL; +for (; model != NULL; model = BSIM4v5nextModel(model)) +{ for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { #endif diff --git a/src/spicelib/devices/bsim4v5/b4v5noi.c b/src/spicelib/devices/bsim4v5/b4v5noi.c index 58b7278b1..4da173302 100644 --- a/src/spicelib/devices/bsim4v5/b4v5noi.c +++ b/src/spicelib/devices/bsim4v5/b4v5noi.c @@ -119,8 +119,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here != NULL; + for (; model != NULL; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim4v5/b4v5pzld.c b/src/spicelib/devices/bsim4v5/b4v5pzld.c index c75586bde..a107f1781 100644 --- a/src/spicelib/devices/bsim4v5/b4v5pzld.c +++ b/src/spicelib/devices/bsim4v5/b4v5pzld.c @@ -50,8 +50,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; - for (; model != NULL; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here!= NULL; + for (; model != NULL; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here!= NULL; here = here->BSIM4v5nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v5/b4v5set.c b/src/spicelib/devices/bsim4v5/b4v5set.c index 6da70c71f..fa03b5724 100644 --- a/src/spicelib/devices/bsim4v5/b4v5set.c +++ b/src/spicelib/devices/bsim4v5/b4v5set.c @@ -66,7 +66,7 @@ BSIM4v5instance **InstArray; } /* loop through all the BSIM4v5 device models */ - for( ; model != NULL; model = model->BSIM4v5nextModel ) + for( ; model != NULL; model = BSIM4v5nextModel(model) ) { /* process defaults of model parameters */ if (!model->BSIM4v5typeGiven) model->BSIM4v5type = NMOS; @@ -1690,7 +1690,7 @@ BSIM4v5instance **InstArray; * through all the instances of the model */ - for (here = model->BSIM4v5instances; here != NULL ; + for (here = BSIM4v5instances(model); here != NULL ; here=here->BSIM4v5nextInstance) { /* allocate a chunk of the state vector */ @@ -2098,10 +2098,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ /* loop through all the BSIM4v6 device models to count the number of instances */ - for (; model != NULL; model = model->BSIM4v5nextModel) + for (; model != NULL; model = BSIM4v5nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM4v5instances; here != NULL; + for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { InstCount++; @@ -2110,10 +2110,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ InstArray = TMALLOC(BSIM4v5instance*, InstCount); model = (BSIM4v5model*)inModel; idx = 0; - for (; model != NULL; model = model->BSIM4v5nextModel) + for (; model != NULL; model = BSIM4v5nextModel(model)) { /* loop through all the instances of the model */ - for (here = model->BSIM4v5instances; here != NULL; + for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { InstArray[idx] = here; @@ -2138,9 +2138,9 @@ BSIM4v5unsetup( BSIM4v5instance *here; for (model = (BSIM4v5model *)inModel; model != NULL; - model = model->BSIM4v5nextModel) + model = BSIM4v5nextModel(model)) { - for (here = model->BSIM4v5instances; here != NULL; + for (here = BSIM4v5instances(model); here != NULL; here=here->BSIM4v5nextInstance) { if (here->BSIM4v5qNode > 0) diff --git a/src/spicelib/devices/bsim4v5/b4v5soachk.c b/src/spicelib/devices/bsim4v5/b4v5soachk.c index a9cba44f7..71468f0c2 100644 --- a/src/spicelib/devices/bsim4v5/b4v5soachk.c +++ b/src/spicelib/devices/bsim4v5/b4v5soachk.c @@ -33,9 +33,9 @@ BSIM4v5soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM4v5nextModel) { + for (; model; model = BSIM4v5nextModel(model)) { - for (here = model->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) { + for (here = BSIM4v5instances(model); here; here = here->BSIM4v5nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM4v5gNodePrime] - ckt->CKTrhsOld [here->BSIM4v5sNodePrime]; diff --git a/src/spicelib/devices/bsim4v5/b4v5temp.c b/src/spicelib/devices/bsim4v5/b4v5temp.c index 87a4bfac4..838767341 100644 --- a/src/spicelib/devices/bsim4v5/b4v5temp.c +++ b/src/spicelib/devices/bsim4v5/b4v5temp.c @@ -83,7 +83,7 @@ double kvsat, wlod, sceff, Wdrn; int Size_Not_Found, i; /* loop through all the BSIM4v5 device models */ - for (; model != NULL; model = model->BSIM4v5nextModel) + for (; model != NULL; model = BSIM4v5nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM4v5SbulkJctPotential < 0.1) { model->BSIM4v5SbulkJctPotential = 0.1; @@ -337,7 +337,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ - for (here = model->BSIM4v5instances; here != NULL; + for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim4v5/b4v5trunc.c b/src/spicelib/devices/bsim4v5/b4v5trunc.c index 63facdef3..69836faaf 100644 --- a/src/spicelib/devices/bsim4v5/b4v5trunc.c +++ b/src/spicelib/devices/bsim4v5/b4v5trunc.c @@ -28,8 +28,8 @@ BSIM4v5instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM4v5nextModel) - { for (here = model->BSIM4v5instances; here != NULL; + for (; model != NULL; model = BSIM4v5nextModel(model)) + { for (here = BSIM4v5instances(model); here != NULL; here = here->BSIM4v5nextInstance) { diff --git a/src/spicelib/devices/bsim4v5/bsim4v5def.h b/src/spicelib/devices/bsim4v5/bsim4v5def.h index 300900695..61f98c471 100644 --- a/src/spicelib/devices/bsim4v5/bsim4v5def.h +++ b/src/spicelib/devices/bsim4v5/bsim4v5def.h @@ -774,12 +774,12 @@ struct bsim4v5SizeDependParam typedef struct sBSIM4v5model { - int BSIM4v5modType; - struct sBSIM4v5model *BSIM4v5nextModel; - BSIM4v5instance *BSIM4v5instances; - IFuid BSIM4v5modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b4v6acld.c b/src/spicelib/devices/bsim4v6/b4v6acld.c index c23be59d9..f84c846a9 100644 --- a/src/spicelib/devices/bsim4v6/b4v6acld.c +++ b/src/spicelib/devices/bsim4v6/b4v6acld.c @@ -57,8 +57,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here!= NULL; + for (; model != NULL; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here!= NULL; here = here->BSIM4v6nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v6/b4v6cvtest.c b/src/spicelib/devices/bsim4v6/b4v6cvtest.c index 0dd071292..c4cb5afb3 100644 --- a/src/spicelib/devices/bsim4v6/b4v6cvtest.c +++ b/src/spicelib/devices/bsim4v6/b4v6cvtest.c @@ -41,8 +41,8 @@ double Isestot, cseshat, Idedtot, cdedhat; double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; double tol0, tol1, tol2, tol3, tol4, tol5, tol6; - for (; model != NULL; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here != NULL ; + for (; model != NULL; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here != NULL ; here=here->BSIM4v6nextInstance) { vds = model->BSIM4v6type diff --git a/src/spicelib/devices/bsim4v6/b4v6dest.c b/src/spicelib/devices/bsim4v6/b4v6dest.c index 0d1c5e64a..7e851f491 100644 --- a/src/spicelib/devices/bsim4v6/b4v6dest.c +++ b/src/spicelib/devices/bsim4v6/b4v6dest.c @@ -26,8 +26,8 @@ BSIM4v6destroy(GENmodel **inModel) #endif while (mod) { - BSIM4v6model *next_mod = mod->BSIM4v6nextModel; - BSIM4v6instance *inst = mod->BSIM4v6instances; + BSIM4v6model *next_mod = BSIM4v6nextModel(mod); + BSIM4v6instance *inst = BSIM4v6instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim4v6SizeDependParam *p = mod->pSizeDependParamKnot; while (p) { diff --git a/src/spicelib/devices/bsim4v6/b4v6getic.c b/src/spicelib/devices/bsim4v6/b4v6getic.c index c218763b4..318a33511 100644 --- a/src/spicelib/devices/bsim4v6/b4v6getic.c +++ b/src/spicelib/devices/bsim4v6/b4v6getic.c @@ -25,8 +25,8 @@ CKTcircuit *ckt) BSIM4v6model *model = (BSIM4v6model*)inModel; BSIM4v6instance *here; - for (; model ; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) + for (; model ; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here; here = here->BSIM4v6nextInstance) { if (!here->BSIM4v6icVDSGiven) { here->BSIM4v6icVDS = *(ckt->CKTrhs + here->BSIM4v6dNode) diff --git a/src/spicelib/devices/bsim4v6/b4v6ld.c b/src/spicelib/devices/bsim4v6/b4v6ld.c index 21c2aff85..f4068ce45 100644 --- a/src/spicelib/devices/bsim4v6/b4v6ld.c +++ b/src/spicelib/devices/bsim4v6/b4v6ld.c @@ -248,8 +248,8 @@ ChargeComputationNeeded = ? 1 : 0; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM4v6nextModel) -{ for (here = model->BSIM4v6instances; here != NULL; +for (; model != NULL; model = BSIM4v6nextModel(model)) +{ for (here = BSIM4v6instances(model); here != NULL; here = here->BSIM4v6nextInstance) { #endif diff --git a/src/spicelib/devices/bsim4v6/b4v6noi.c b/src/spicelib/devices/bsim4v6/b4v6noi.c index bb0fc455f..ff68e381d 100644 --- a/src/spicelib/devices/bsim4v6/b4v6noi.c +++ b/src/spicelib/devices/bsim4v6/b4v6noi.c @@ -120,8 +120,8 @@ int i; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here != NULL; + for (; model != NULL; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here != NULL; here = here->BSIM4v6nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim4v6/b4v6pzld.c b/src/spicelib/devices/bsim4v6/b4v6pzld.c index bdf9d5769..b7d2350cd 100644 --- a/src/spicelib/devices/bsim4v6/b4v6pzld.c +++ b/src/spicelib/devices/bsim4v6/b4v6pzld.c @@ -52,8 +52,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; - for (; model != NULL; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here!= NULL; + for (; model != NULL; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here!= NULL; here = here->BSIM4v6nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v6/b4v6set.c b/src/spicelib/devices/bsim4v6/b4v6set.c index 3d71a4c8a..de0744eb8 100644 --- a/src/spicelib/devices/bsim4v6/b4v6set.c +++ b/src/spicelib/devices/bsim4v6/b4v6set.c @@ -73,7 +73,7 @@ BSIM4v6instance **InstArray; } /* loop through all the BSIM4v6 device models */ - for( ; model != NULL; model = model->BSIM4v6nextModel ) + for( ; model != NULL; model = BSIM4v6nextModel(model) ) { /* process defaults of model parameters */ if (!model->BSIM4v6typeGiven) model->BSIM4v6type = NMOS; @@ -2051,7 +2051,7 @@ BSIM4v6instance **InstArray; * through all the instances of the model */ - for (here = model->BSIM4v6instances; here != NULL ; + for (here = BSIM4v6instances(model); here != NULL ; here=here->BSIM4v6nextInstance) { /* allocate a chunk of the state vector */ @@ -2433,10 +2433,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ /* loop through all the BSIM4v6 device models to count the number of instances */ - for( ; model != NULL; model = model->BSIM4v6nextModel ) + for( ; model != NULL; model = BSIM4v6nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4v6instances; here != NULL ; + for (here = BSIM4v6instances(model); here != NULL ; here=here->BSIM4v6nextInstance) { InstCount++; @@ -2445,10 +2445,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ InstArray = TMALLOC(BSIM4v6instance*, InstCount); model = (BSIM4v6model*)inModel; idx = 0; - for( ; model != NULL; model = model->BSIM4v6nextModel ) + for( ; model != NULL; model = BSIM4v6nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4v6instances; here != NULL ; + for (here = BSIM4v6instances(model); here != NULL ; here=here->BSIM4v6nextInstance) { InstArray[idx] = here; @@ -2471,9 +2471,9 @@ BSIM4v6unsetup(GENmodel *inModel, CKTcircuit *ckt) BSIM4v6instance *here; for (model = (BSIM4v6model *)inModel; model != NULL; - model = model->BSIM4v6nextModel) + model = BSIM4v6nextModel(model)) { - for (here = model->BSIM4v6instances; here != NULL; + for (here = BSIM4v6instances(model); here != NULL; here=here->BSIM4v6nextInstance) { if (here->BSIM4v6qNode > 0) diff --git a/src/spicelib/devices/bsim4v6/b4v6soachk.c b/src/spicelib/devices/bsim4v6/b4v6soachk.c index 9b71b2705..a0f8cf642 100644 --- a/src/spicelib/devices/bsim4v6/b4v6soachk.c +++ b/src/spicelib/devices/bsim4v6/b4v6soachk.c @@ -33,9 +33,9 @@ BSIM4v6soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM4v6nextModel) { + for (; model; model = BSIM4v6nextModel(model)) { - for (here = model->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) { + for (here = BSIM4v6instances(model); here; here = here->BSIM4v6nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM4v6gNodePrime] - ckt->CKTrhsOld [here->BSIM4v6sNodePrime]; diff --git a/src/spicelib/devices/bsim4v6/b4v6temp.c b/src/spicelib/devices/bsim4v6/b4v6temp.c index db06df735..745afb671 100644 --- a/src/spicelib/devices/bsim4v6/b4v6temp.c +++ b/src/spicelib/devices/bsim4v6/b4v6temp.c @@ -90,7 +90,7 @@ double vtfbphi2eot, phieot, TempRatioeot, Vtm0eot, Vtmeot,vbieot; int Size_Not_Found, i; /* loop through all the BSIM4v6 device models */ - for (; model != NULL; model = model->BSIM4v6nextModel) + for (; model != NULL; model = BSIM4v6nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM4v6SbulkJctPotential < 0.1) { model->BSIM4v6SbulkJctPotential = 0.1; @@ -385,7 +385,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ - for (here = model->BSIM4v6instances; here != NULL; + for (here = BSIM4v6instances(model); here != NULL; here = here->BSIM4v6nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim4v6/b4v6trunc.c b/src/spicelib/devices/bsim4v6/b4v6trunc.c index 4f9f935cf..39a079b8d 100644 --- a/src/spicelib/devices/bsim4v6/b4v6trunc.c +++ b/src/spicelib/devices/bsim4v6/b4v6trunc.c @@ -30,8 +30,8 @@ BSIM4v6instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM4v6nextModel) - { for (here = model->BSIM4v6instances; here != NULL; + for (; model != NULL; model = BSIM4v6nextModel(model)) + { for (here = BSIM4v6instances(model); here != NULL; here = here->BSIM4v6nextInstance) { diff --git a/src/spicelib/devices/bsim4v6/bsim4v6def.h b/src/spicelib/devices/bsim4v6/bsim4v6def.h index 5f2a94f28..11f589219 100644 --- a/src/spicelib/devices/bsim4v6/bsim4v6def.h +++ b/src/spicelib/devices/bsim4v6/bsim4v6def.h @@ -795,12 +795,12 @@ struct bsim4v6SizeDependParam typedef struct sBSIM4v6model { - int BSIM4v6modType; - struct sBSIM4v6model *BSIM4v6nextModel; - BSIM4v6instance *BSIM4v6instances; - IFuid BSIM4v6modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b4v7acld.c b/src/spicelib/devices/bsim4v7/b4v7acld.c index 00a16c107..968dc8567 100644 --- a/src/spicelib/devices/bsim4v7/b4v7acld.c +++ b/src/spicelib/devices/bsim4v7/b4v7acld.c @@ -57,8 +57,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->BSIM4v7nextModel) - { for (here = model->BSIM4v7instances; here!= NULL; + for (; model != NULL; model = BSIM4v7nextModel(model)) + { for (here = BSIM4v7instances(model); here!= NULL; here = here->BSIM4v7nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v7/b4v7cvtest.c b/src/spicelib/devices/bsim4v7/b4v7cvtest.c index da2fceb7f..97b4454d5 100644 --- a/src/spicelib/devices/bsim4v7/b4v7cvtest.c +++ b/src/spicelib/devices/bsim4v7/b4v7cvtest.c @@ -41,8 +41,8 @@ double Isestot, cseshat, Idedtot, cdedhat; double Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; double tol0, tol1, tol2, tol3, tol4, tol5, tol6; - for (; model != NULL; model = model->BSIM4v7nextModel) - { for (here = model->BSIM4v7instances; here != NULL ; + for (; model != NULL; model = BSIM4v7nextModel(model)) + { for (here = BSIM4v7instances(model); here != NULL ; here=here->BSIM4v7nextInstance) { vds = model->BSIM4v7type diff --git a/src/spicelib/devices/bsim4v7/b4v7dest.c b/src/spicelib/devices/bsim4v7/b4v7dest.c index 206708b27..7dfbc143c 100644 --- a/src/spicelib/devices/bsim4v7/b4v7dest.c +++ b/src/spicelib/devices/bsim4v7/b4v7dest.c @@ -26,8 +26,8 @@ BSIM4v7destroy(GENmodel **inModel) #endif while (mod) { - BSIM4v7model *next_mod = mod->BSIM4v7nextModel; - BSIM4v7instance *inst = mod->BSIM4v7instances; + BSIM4v7model *next_mod = BSIM4v7nextModel(mod); + BSIM4v7instance *inst = BSIM4v7instances(mod); /** added to get rid of link list pSizeDependParamKnot **/ struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot; while (p) { diff --git a/src/spicelib/devices/bsim4v7/b4v7getic.c b/src/spicelib/devices/bsim4v7/b4v7getic.c index 8d6e33c9c..2a9f319e4 100644 --- a/src/spicelib/devices/bsim4v7/b4v7getic.c +++ b/src/spicelib/devices/bsim4v7/b4v7getic.c @@ -25,8 +25,8 @@ CKTcircuit *ckt) BSIM4v7model *model = (BSIM4v7model*)inModel; BSIM4v7instance *here; - for (; model ; model = model->BSIM4v7nextModel) - { for (here = model->BSIM4v7instances; here; here = here->BSIM4v7nextInstance) + for (; model ; model = BSIM4v7nextModel(model)) + { for (here = BSIM4v7instances(model); here; here = here->BSIM4v7nextInstance) { if (!here->BSIM4v7icVDSGiven) { here->BSIM4v7icVDS = *(ckt->CKTrhs + here->BSIM4v7dNode) diff --git a/src/spicelib/devices/bsim4v7/b4v7ld.c b/src/spicelib/devices/bsim4v7/b4v7ld.c index 73108ee78..7fb4d252e 100644 --- a/src/spicelib/devices/bsim4v7/b4v7ld.c +++ b/src/spicelib/devices/bsim4v7/b4v7ld.c @@ -248,8 +248,8 @@ ChargeComputationNeeded = ? 1 : 0; #ifndef USE_OMP -for (; model != NULL; model = model->BSIM4v7nextModel) -{ for (here = model->BSIM4v7instances; here != NULL; +for (; model != NULL; model = BSIM4v7nextModel(model)) +{ for (here = BSIM4v7instances(model); here != NULL; here = here->BSIM4v7nextInstance) { #endif diff --git a/src/spicelib/devices/bsim4v7/b4v7noi.c b/src/spicelib/devices/bsim4v7/b4v7noi.c index 4ef0a2241..efca6c9f9 100644 --- a/src/spicelib/devices/bsim4v7/b4v7noi.c +++ b/src/spicelib/devices/bsim4v7/b4v7noi.c @@ -129,13 +129,13 @@ double m; "" /* total transistor noise */ }; - for (; model != NULL; model = model->BSIM4v7nextModel) + for (; model != NULL; model = BSIM4v7nextModel(model)) { if(model->BSIM4v7tnoiMod != 2) { noizDens[BSIM4v7CORLNOIZ] = 0.0; lnNdens[BSIM4v7CORLNOIZ] = N_MINLOG; } - for (here = model->BSIM4v7instances; here != NULL; + for (here = BSIM4v7instances(model); here != NULL; here = here->BSIM4v7nextInstance) { pParam = here->pParam; switch (operation) diff --git a/src/spicelib/devices/bsim4v7/b4v7pzld.c b/src/spicelib/devices/bsim4v7/b4v7pzld.c index 0d93ee1a4..39e099251 100644 --- a/src/spicelib/devices/bsim4v7/b4v7pzld.c +++ b/src/spicelib/devices/bsim4v7/b4v7pzld.c @@ -52,8 +52,8 @@ double ggidld, ggidlg, ggidlb, ggislg, ggislb, ggisls; double m; - for (; model != NULL; model = model->BSIM4v7nextModel) - { for (here = model->BSIM4v7instances; here!= NULL; + for (; model != NULL; model = BSIM4v7nextModel(model)) + { for (here = BSIM4v7instances(model); here!= NULL; here = here->BSIM4v7nextInstance) { pParam = here->pParam; diff --git a/src/spicelib/devices/bsim4v7/b4v7set.c b/src/spicelib/devices/bsim4v7/b4v7set.c index 107256bbf..7238a4565 100644 --- a/src/spicelib/devices/bsim4v7/b4v7set.c +++ b/src/spicelib/devices/bsim4v7/b4v7set.c @@ -72,7 +72,7 @@ BSIM4v7instance **InstArray; } /* loop through all the BSIM4v7 device models */ - for( ; model != NULL; model = model->BSIM4v7nextModel ) + for( ; model != NULL; model = BSIM4v7nextModel(model) ) { /* process defaults of model parameters */ if (!model->BSIM4v7typeGiven) model->BSIM4v7type = NMOS; @@ -2202,7 +2202,7 @@ BSIM4v7instance **InstArray; * through all the instances of the model */ - for (here = model->BSIM4v7instances; here != NULL ; + for (here = BSIM4v7instances(model); here != NULL ; here=here->BSIM4v7nextInstance) { /* allocate a chunk of the state vector */ @@ -2588,10 +2588,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL /* loop through all the BSIM4v7 device models to count the number of instances */ - for( ; model != NULL; model = model->BSIM4v7nextModel ) + for( ; model != NULL; model = BSIM4v7nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4v7instances; here != NULL ; + for (here = BSIM4v7instances(model); here != NULL ; here=here->BSIM4v7nextInstance) { InstCount++; @@ -2600,10 +2600,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL InstArray = TMALLOC(BSIM4v7instance*, InstCount); model = (BSIM4v7model*)inModel; idx = 0; - for( ; model != NULL; model = model->BSIM4v7nextModel ) + for( ; model != NULL; model = BSIM4v7nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->BSIM4v7instances; here != NULL ; + for (here = BSIM4v7instances(model); here != NULL ; here=here->BSIM4v7nextInstance) { InstArray[idx] = here; @@ -2628,9 +2628,9 @@ CKTcircuit *ckt) BSIM4v7instance *here; for (model = (BSIM4v7model *)inModel; model != NULL; - model = model->BSIM4v7nextModel) + model = BSIM4v7nextModel(model)) { - for (here = model->BSIM4v7instances; here != NULL; + for (here = BSIM4v7instances(model); here != NULL; here=here->BSIM4v7nextInstance) { if (here->BSIM4v7qNode > 0) diff --git a/src/spicelib/devices/bsim4v7/b4v7soachk.c b/src/spicelib/devices/bsim4v7/b4v7soachk.c index 0c327e295..ffe3a0767 100644 --- a/src/spicelib/devices/bsim4v7/b4v7soachk.c +++ b/src/spicelib/devices/bsim4v7/b4v7soachk.c @@ -33,9 +33,9 @@ BSIM4v7soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->BSIM4v7nextModel) { + for (; model; model = BSIM4v7nextModel(model)) { - for (here = model->BSIM4v7instances; here; here = here->BSIM4v7nextInstance) { + for (here = BSIM4v7instances(model); here; here = here->BSIM4v7nextInstance) { vgs = ckt->CKTrhsOld [here->BSIM4v7gNodePrime] - ckt->CKTrhsOld [here->BSIM4v7sNodePrime]; diff --git a/src/spicelib/devices/bsim4v7/b4v7temp.c b/src/spicelib/devices/bsim4v7/b4v7temp.c index 089de1aeb..4cf8cf5d0 100644 --- a/src/spicelib/devices/bsim4v7/b4v7temp.c +++ b/src/spicelib/devices/bsim4v7/b4v7temp.c @@ -92,7 +92,7 @@ double vtfbphi2eot, phieot, TempRatioeot, Vtm0eot, Vtmeot,vbieot; int Size_Not_Found, i; /* loop through all the BSIM4v7 device models */ - for (; model != NULL; model = model->BSIM4v7nextModel) + for (; model != NULL; model = BSIM4v7nextModel(model)) { Temp = ckt->CKTtemp; if (model->BSIM4v7SbulkJctPotential < 0.1) { model->BSIM4v7SbulkJctPotential = 0.1; @@ -406,7 +406,7 @@ int Size_Not_Found, i; /* loop through all the instances of the model */ - for (here = model->BSIM4v7instances; here != NULL; + for (here = BSIM4v7instances(model); here != NULL; here = here->BSIM4v7nextInstance) { pSizeDependParamKnot = model->pSizeDependParamKnot; diff --git a/src/spicelib/devices/bsim4v7/b4v7trunc.c b/src/spicelib/devices/bsim4v7/b4v7trunc.c index a851aaaf8..2cd4dd5df 100644 --- a/src/spicelib/devices/bsim4v7/b4v7trunc.c +++ b/src/spicelib/devices/bsim4v7/b4v7trunc.c @@ -30,8 +30,8 @@ BSIM4v7instance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->BSIM4v7nextModel) - { for (here = model->BSIM4v7instances; here != NULL; + for (; model != NULL; model = BSIM4v7nextModel(model)) + { for (here = BSIM4v7instances(model); here != NULL; here = here->BSIM4v7nextInstance) { #ifdef STEPDEBUG diff --git a/src/spicelib/devices/bsim4v7/bsim4v7def.h b/src/spicelib/devices/bsim4v7/bsim4v7def.h index 1803e0c4e..d8fad8307 100644 --- a/src/spicelib/devices/bsim4v7/bsim4v7def.h +++ b/src/spicelib/devices/bsim4v7/bsim4v7def.h @@ -813,12 +813,12 @@ struct bsim4SizeDependParam typedef struct sBSIM4v7model { - int BSIM4v7modType; - struct sBSIM4v7model *BSIM4v7nextModel; - BSIM4v7instance *BSIM4v7instances; - IFuid BSIM4v7modName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/b4soiacld.c b/src/spicelib/devices/bsimsoi/b4soiacld.c index aeb90c570..18cdc9f1e 100644 --- a/src/spicelib/devices/bsimsoi/b4soiacld.c +++ b/src/spicelib/devices/bsimsoi/b4soiacld.c @@ -75,10 +75,10 @@ double gdtot, gdtotd, gdtotg, gdtots, gdtotb; double m; omega = ckt->CKTomega; - for (; model != NULL; model = model->B4SOInextModel) + for (; model != NULL; model = B4SOInextModel(model)) { - for (here = model->B4SOIinstances; here!= NULL; + for (here = B4SOIinstances(model); here!= NULL; here = here->B4SOInextInstance) { selfheat = (model->B4SOIshMod == 1) && (here->B4SOIrth0 != 0.0); diff --git a/src/spicelib/devices/bsimsoi/b4soicvtest.c b/src/spicelib/devices/bsimsoi/b4soicvtest.c index 3b12bd9b1..ddb171e29 100644 --- a/src/spicelib/devices/bsimsoi/b4soicvtest.c +++ b/src/spicelib/devices/bsimsoi/b4soicvtest.c @@ -36,9 +36,9 @@ double delvbd, delvbs, delvds, delvgd, delvgs, vbd, vbs, vds; double cbd, cbhat, cbs, cd, cdhat, tol, vgd, vgdo, vgs; /* loop through all the B4SOI device models */ - for (; model != NULL; model = model->B4SOInextModel) + for (; model != NULL; model = B4SOInextModel(model)) { /* loop through all the instances of the model */ - for (here = model->B4SOIinstances; here != NULL ; + for (here = B4SOIinstances(model); here != NULL ; here=here->B4SOInextInstance) { vbs = model->B4SOItype diff --git a/src/spicelib/devices/bsimsoi/b4soidef.h b/src/spicelib/devices/bsimsoi/b4soidef.h index ce858a1a7..f223bb0e7 100644 --- a/src/spicelib/devices/bsimsoi/b4soidef.h +++ b/src/spicelib/devices/bsimsoi/b4soidef.h @@ -1080,12 +1080,12 @@ struct b4soiSizeDependParam typedef struct sB4SOImodel { - int B4SOImodType; - struct sB4SOImodel *B4SOInextModel; - B4SOIinstance *B4SOIinstances; - IFuid B4SOImodName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/bsimsoi/b4soidest.c b/src/spicelib/devices/bsimsoi/b4soidest.c index c66c177ce..9f89e84e1 100644 --- a/src/spicelib/devices/bsimsoi/b4soidest.c +++ b/src/spicelib/devices/bsimsoi/b4soidest.c @@ -25,8 +25,8 @@ B4SOIdestroy(GENmodel **inModel) B4SOImodel *mod = *(B4SOImodel**) inModel; while (mod) { - B4SOImodel *next_mod = mod->B4SOInextModel; - B4SOIinstance *inst = mod->B4SOIinstances; + B4SOImodel *next_mod = B4SOInextModel(mod); + B4SOIinstance *inst = B4SOIinstances(mod); while (inst) { B4SOIinstance *next_inst = inst->B4SOInextInstance; FREE(inst); diff --git a/src/spicelib/devices/bsimsoi/b4soigetic.c b/src/spicelib/devices/bsimsoi/b4soigetic.c index 2de1f3163..f4e5f75a0 100644 --- a/src/spicelib/devices/bsimsoi/b4soigetic.c +++ b/src/spicelib/devices/bsimsoi/b4soigetic.c @@ -30,8 +30,8 @@ CKTcircuit *ckt) B4SOImodel *model = (B4SOImodel*)inModel; B4SOIinstance *here; - for (; model ; model = model->B4SOInextModel) - { for (here = model->B4SOIinstances; here; here = here->B4SOInextInstance) + for (; model ; model = B4SOInextModel(model)) + { for (here = B4SOIinstances(model); here; here = here->B4SOInextInstance) { if(!here->B4SOIicVBSGiven) { here->B4SOIicVBS = *(ckt->CKTrhs + here->B4SOIbNode) diff --git a/src/spicelib/devices/bsimsoi/b4soild.c b/src/spicelib/devices/bsimsoi/b4soild.c index 4ccf7c9e5..5bccb32ef 100644 --- a/src/spicelib/devices/bsimsoi/b4soild.c +++ b/src/spicelib/devices/bsimsoi/b4soild.c @@ -489,8 +489,8 @@ int B4SOILoadOMP(B4SOIinstance *here, CKTcircuit *ckt) { double m; #ifndef USE_OMP - for (; model != NULL; model = model->B4SOInextModel) - { for (here = model->B4SOIinstances; here != NULL; + for (; model != NULL; model = B4SOInextModel(model)) + { for (here = B4SOIinstances(model); here != NULL; here = here->B4SOInextInstance) { diff --git a/src/spicelib/devices/bsimsoi/b4soinoi.c b/src/spicelib/devices/bsimsoi/b4soinoi.c index bd8964311..791d0205c 100644 --- a/src/spicelib/devices/bsimsoi/b4soinoi.c +++ b/src/spicelib/devices/bsimsoi/b4soinoi.c @@ -147,8 +147,8 @@ double m; "" /* total transistor noise */ }; - for (; model != NULL; model = model->B4SOInextModel) - { for (here = model->B4SOIinstances; here != NULL; + for (; model != NULL; model = B4SOInextModel(model)) + { for (here = B4SOIinstances(model); here != NULL; here = here->B4SOInextInstance) { m = here->B4SOIm; diff --git a/src/spicelib/devices/bsimsoi/b4soipzld.c b/src/spicelib/devices/bsimsoi/b4soipzld.c index d584f75f6..5418e51cb 100644 --- a/src/spicelib/devices/bsimsoi/b4soipzld.c +++ b/src/spicelib/devices/bsimsoi/b4soipzld.c @@ -40,8 +40,8 @@ double m; NG_IGNORE(ckt); - for (; model != NULL; model = model->B4SOInextModel) - { for (here = model->B4SOIinstances; here!= NULL; + for (; model != NULL; model = B4SOInextModel(model)) + { for (here = B4SOIinstances(model); here!= NULL; here = here->B4SOInextInstance) { if (here->B4SOImode >= 0) diff --git a/src/spicelib/devices/bsimsoi/b4soiset.c b/src/spicelib/devices/bsimsoi/b4soiset.c index 78c36a02c..8c501ca3b 100644 --- a/src/spicelib/devices/bsimsoi/b4soiset.c +++ b/src/spicelib/devices/bsimsoi/b4soiset.c @@ -59,7 +59,7 @@ B4SOIinstance **InstArray; #endif /* loop through all the B4SOI device models */ - for( ; model != NULL; model = model->B4SOInextModel ) + for( ; model != NULL; model = B4SOInextModel(model) ) { /* Default value Processing for B4SOI MOSFET Models */ @@ -2101,7 +2101,7 @@ B4SOIinstance **InstArray; if (!model->B4SOIpvoffcvGiven) model->B4SOIpvoffcv = 0.0; /* loop through all the instances of the model */ - for (here = model->B4SOIinstances; here != NULL ; + for (here = B4SOIinstances(model); here != NULL ; here=here->B4SOInextInstance) { /* allocate a chunk of the state vector */ here->B4SOIstates = *states; @@ -2725,10 +2725,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL /* loop through all the B4SOI device models to count the number of instances */ - for( ; model != NULL; model = model->B4SOInextModel ) + for( ; model != NULL; model = B4SOInextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B4SOIinstances; here != NULL ; + for (here = B4SOIinstances(model); here != NULL ; here=here->B4SOInextInstance) { InstCount++; @@ -2737,10 +2737,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL InstArray = TMALLOC(B4SOIinstance*, InstCount); model = (B4SOImodel*)inModel; idx = 0; - for( ; model != NULL; model = model->B4SOInextModel ) + for( ; model != NULL; model = B4SOInextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->B4SOIinstances; here != NULL ; + for (here = B4SOIinstances(model); here != NULL ; here=here->B4SOInextInstance) { InstArray[idx] = here; @@ -2765,9 +2765,9 @@ B4SOIunsetup( B4SOIinstance *here; for (model = (B4SOImodel *)inModel; model != NULL; - model = model->B4SOInextModel) + model = B4SOInextModel(model)) { - for (here = model->B4SOIinstances; here != NULL; + for (here = B4SOIinstances(model); here != NULL; here=here->B4SOInextInstance) { /* here for debugging purpose only */ diff --git a/src/spicelib/devices/bsimsoi/b4soisoachk.c b/src/spicelib/devices/bsimsoi/b4soisoachk.c index 998afbed0..573dab0d9 100644 --- a/src/spicelib/devices/bsimsoi/b4soisoachk.c +++ b/src/spicelib/devices/bsimsoi/b4soisoachk.c @@ -33,9 +33,9 @@ B4SOIsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->B4SOInextModel) { + for (; model; model = B4SOInextModel(model)) { - for (here = model->B4SOIinstances; here; here = here->B4SOInextInstance) { + for (here = B4SOIinstances(model); here; here = here->B4SOInextInstance) { vgs = ckt->CKTrhsOld [here->B4SOIgNode] - ckt->CKTrhsOld [here->B4SOIsNodePrime]; diff --git a/src/spicelib/devices/bsimsoi/b4soitemp.c b/src/spicelib/devices/bsimsoi/b4soitemp.c index 052748ba0..17f03ed7d 100644 --- a/src/spicelib/devices/bsimsoi/b4soitemp.c +++ b/src/spicelib/devices/bsimsoi/b4soitemp.c @@ -83,7 +83,7 @@ B4SOItemp( /* loop through all the B4SOI device models */ - for (; model != NULL; model = model->B4SOInextModel) + for (; model != NULL; model = B4SOInextModel(model)) { Temp = ckt->CKTtemp; if (model->B4SOIGatesidewallJctSPotential < 0.1) /* v4.0 */ model->B4SOIGatesidewallJctSPotential = 0.1; @@ -160,7 +160,7 @@ B4SOItemp( /* loop through all the instances of the model */ /* MCJ: Length and Width not initialized */ - for (here = model->B4SOIinstances; here != NULL; + for (here = B4SOIinstances(model); here != NULL; here = here->B4SOInextInstance) { here->B4SOIrbodyext = here->B4SOIbodySquares * diff --git a/src/spicelib/devices/bsimsoi/b4soitrunc.c b/src/spicelib/devices/bsimsoi/b4soitrunc.c index 57068002f..529cd599e 100644 --- a/src/spicelib/devices/bsimsoi/b4soitrunc.c +++ b/src/spicelib/devices/bsimsoi/b4soitrunc.c @@ -34,8 +34,8 @@ register B4SOIinstance *here; double debugtemp; #endif /* STEPDEBUG */ - for (; model != NULL; model = model->B4SOInextModel) - { for (here = model->B4SOIinstances; here != NULL; + for (; model != NULL; model = B4SOInextModel(model)) + { for (here = B4SOIinstances(model); here != NULL; here = here->B4SOInextInstance) { diff --git a/src/spicelib/devices/cap/capacld.c b/src/spicelib/devices/cap/capacld.c index 006eb694a..fa7d54a0c 100644 --- a/src/spicelib/devices/cap/capacld.c +++ b/src/spicelib/devices/cap/capacld.c @@ -21,8 +21,8 @@ CAPacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; CAPinstance *here; - for( ; model != NULL; model = model->CAPnextModel) { - for( here = model->CAPinstances; here != NULL; + for( ; model != NULL; model = CAPnextModel(model)) { + for( here = CAPinstances(model); here != NULL; here = here->CAPnextInstance) { m = here->CAPm; diff --git a/src/spicelib/devices/cap/capdefs.h b/src/spicelib/devices/cap/capdefs.h index 7a4e26307..7686d1b27 100644 --- a/src/spicelib/devices/cap/capdefs.h +++ b/src/spicelib/devices/cap/capdefs.h @@ -73,14 +73,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/cap/capdest.c b/src/spicelib/devices/cap/capdest.c index b02f0625f..74871c521 100644 --- a/src/spicelib/devices/cap/capdest.c +++ b/src/spicelib/devices/cap/capdest.c @@ -15,8 +15,8 @@ CAPdestroy(GENmodel **inModel) CAPmodel *mod = *(CAPmodel**) inModel; while (mod) { - CAPmodel *next_mod = mod->CAPnextModel; - CAPinstance *inst = mod->CAPinstances; + CAPmodel *next_mod = CAPnextModel(mod); + CAPinstance *inst = CAPinstances(mod); while (inst) { CAPinstance *next_inst = inst->CAPnextInstance; FREE(inst); diff --git a/src/spicelib/devices/cap/capgetic.c b/src/spicelib/devices/cap/capgetic.c index 66099d7c2..c7a9e9fff 100644 --- a/src/spicelib/devices/cap/capgetic.c +++ b/src/spicelib/devices/cap/capgetic.c @@ -22,8 +22,8 @@ CAPgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->CAPnextModel) { - for(here = model->CAPinstances; here ; here = here->CAPnextInstance) { + for( ; model ; model = CAPnextModel(model)) { + for(here = CAPinstances(model); here ; here = here->CAPnextInstance) { if(!here->CAPicGiven) { here->CAPinitCond = diff --git a/src/spicelib/devices/cap/capload.c b/src/spicelib/devices/cap/capload.c index dc26bb537..20916cb75 100644 --- a/src/spicelib/devices/cap/capload.c +++ b/src/spicelib/devices/cap/capload.c @@ -35,10 +35,10 @@ CAPload(GENmodel *inModel, CKTcircuit *ckt) || ( ( ckt->CKTmode & MODEUIC) && ( ckt->CKTmode & MODEINITTRAN) ) ) ; /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { m = here->CAPm; diff --git a/src/spicelib/devices/cap/cappzld.c b/src/spicelib/devices/cap/cappzld.c index bb46ac60a..85fd92999 100644 --- a/src/spicelib/devices/cap/cappzld.c +++ b/src/spicelib/devices/cap/cappzld.c @@ -26,8 +26,8 @@ CAPpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for( ; model != NULL; model = model->CAPnextModel) { - for( here = model->CAPinstances;here != NULL; + for( ; model != NULL; model = CAPnextModel(model)) { + for( here = CAPinstances(model);here != NULL; here = here->CAPnextInstance) { val = here->CAPcapac; diff --git a/src/spicelib/devices/cap/capsacl.c b/src/spicelib/devices/cap/capsacl.c index 159b8b247..1067da668 100644 --- a/src/spicelib/devices/cap/capsacl.c +++ b/src/spicelib/devices/cap/capsacl.c @@ -31,10 +31,10 @@ CAPsAcLoad(GENmodel *inModel, CKTcircuit *ckt) double ival; /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { if(here->CAPsenParmNo){ diff --git a/src/spicelib/devices/cap/capsetup.c b/src/spicelib/devices/cap/capsetup.c index f5f0e758b..c2230cb9b 100644 --- a/src/spicelib/devices/cap/capsetup.c +++ b/src/spicelib/devices/cap/capsetup.c @@ -25,7 +25,7 @@ CAPsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CAPinstance *here; /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /*Default Value Processing for Model Parameters */ if (!model->CAPmCapGiven) { @@ -88,7 +88,7 @@ CAPsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { /* Default Value Processing for Capacitor Instance */ diff --git a/src/spicelib/devices/cap/capsload.c b/src/spicelib/devices/cap/capsload.c index ca536c484..fab1468e9 100644 --- a/src/spicelib/devices/cap/capsload.c +++ b/src/spicelib/devices/cap/capsload.c @@ -52,10 +52,10 @@ CAPsLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/cap/capsoachk.c b/src/spicelib/devices/cap/capsoachk.c index 17172a832..bf40f8a84 100644 --- a/src/spicelib/devices/cap/capsoachk.c +++ b/src/spicelib/devices/cap/capsoachk.c @@ -28,9 +28,9 @@ CAPsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->CAPnextModel) { + for (; model; model = CAPnextModel(model)) { - for (here = model->CAPinstances; here; here = here->CAPnextInstance) { + for (here = CAPinstances(model); here; here = here->CAPnextInstance) { vc = fabs(ckt->CKTrhsOld [here->CAPposNode] - ckt->CKTrhsOld [here->CAPnegNode]); diff --git a/src/spicelib/devices/cap/capsprt.c b/src/spicelib/devices/cap/capsprt.c index f22d3e428..8a2042f48 100644 --- a/src/spicelib/devices/cap/capsprt.c +++ b/src/spicelib/devices/cap/capsprt.c @@ -28,12 +28,12 @@ CAPsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("CAPACITORS-----------------\n"); /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { printf("Model name:%s\n",model->CAPmodName); /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { printf(" Instance name:%s\n",here->CAPname); diff --git a/src/spicelib/devices/cap/capsset.c b/src/spicelib/devices/cap/capsset.c index 347dbe9ba..a707a043b 100644 --- a/src/spicelib/devices/cap/capsset.c +++ b/src/spicelib/devices/cap/capsset.c @@ -28,10 +28,10 @@ CAPsSetup(SENstruct *info, GENmodel *inModel) CAPinstance *here; /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { if(here->CAPsenParmNo){ diff --git a/src/spicelib/devices/cap/capsupd.c b/src/spicelib/devices/cap/capsupd.c index 64085d655..1ba304a90 100644 --- a/src/spicelib/devices/cap/capsupd.c +++ b/src/spicelib/devices/cap/capsupd.c @@ -40,10 +40,10 @@ CAPsUpdate(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { vcap = *(ckt->CKTrhsOld+here->CAPposNode) - diff --git a/src/spicelib/devices/cap/captemp.c b/src/spicelib/devices/cap/captemp.c index f6dcc371d..95fce3255 100644 --- a/src/spicelib/devices/cap/captemp.c +++ b/src/spicelib/devices/cap/captemp.c @@ -29,10 +29,10 @@ CAPtemp(GENmodel *inModel, CKTcircuit *ckt) double tc1, tc2; /* loop through all the capacitor models */ - for( ; model != NULL; model = model->CAPnextModel ) { + for( ; model != NULL; model = CAPnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CAPinstances; here != NULL ; + for (here = CAPinstances(model); here != NULL ; here=here->CAPnextInstance) { /* Default Value Processing for Capacitor Instance */ diff --git a/src/spicelib/devices/cap/captrunc.c b/src/spicelib/devices/cap/captrunc.c index add70b94a..eabc656b5 100644 --- a/src/spicelib/devices/cap/captrunc.c +++ b/src/spicelib/devices/cap/captrunc.c @@ -19,8 +19,8 @@ CAPtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) CAPmodel *model = (CAPmodel*)inModel; CAPinstance *here; - for( ; model!= NULL; model = model->CAPnextModel) { - for(here = model->CAPinstances ; here != NULL ; + for( ; model!= NULL; model = CAPnextModel(model)) { + for(here = CAPinstances(model) ; here != NULL ; here = here->CAPnextInstance) { CKTterr(here->CAPqcap,ckt,timeStep); diff --git a/src/spicelib/devices/cccs/cccsdefs.h b/src/spicelib/devices/cccs/cccsdefs.h index 0a5875927..bc78902ef 100644 --- a/src/spicelib/devices/cccs/cccsdefs.h +++ b/src/spicelib/devices/cccs/cccsdefs.h @@ -47,14 +47,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/cccs/cccsdest.c b/src/spicelib/devices/cccs/cccsdest.c index 5a88881f4..9721392ed 100644 --- a/src/spicelib/devices/cccs/cccsdest.c +++ b/src/spicelib/devices/cccs/cccsdest.c @@ -14,8 +14,8 @@ CCCSdestroy(GENmodel **inModel) CCCSmodel *mod = *(CCCSmodel**) inModel; while (mod) { - CCCSmodel *next_mod = mod->CCCSnextModel; - CCCSinstance *inst = mod->CCCSinstances; + CCCSmodel *next_mod = CCCSnextModel(mod); + CCCSinstance *inst = CCCSinstances(mod); while (inst) { CCCSinstance *next_inst = inst->CCCSnextInstance; FREE(inst); diff --git a/src/spicelib/devices/cccs/cccsload.c b/src/spicelib/devices/cccs/cccsload.c index 878494e6a..ad8179edb 100644 --- a/src/spicelib/devices/cccs/cccsload.c +++ b/src/spicelib/devices/cccs/cccsload.c @@ -26,10 +26,10 @@ CCCSload(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { *(here->CCCSposContBrPtr) += here->CCCScoeff ; diff --git a/src/spicelib/devices/cccs/cccspzld.c b/src/spicelib/devices/cccs/cccspzld.c index 7499d929d..4605cb885 100644 --- a/src/spicelib/devices/cccs/cccspzld.c +++ b/src/spicelib/devices/cccs/cccspzld.c @@ -28,10 +28,10 @@ CCCSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { *(here->CCCSposContBrPtr) += here->CCCScoeff ; diff --git a/src/spicelib/devices/cccs/cccssacl.c b/src/spicelib/devices/cccs/cccssacl.c index 89078110f..d7a57c53a 100644 --- a/src/spicelib/devices/cccs/cccssacl.c +++ b/src/spicelib/devices/cccs/cccssacl.c @@ -26,10 +26,10 @@ CCCSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) double i_ic; /* loop through all the CCCS models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { if(here->CCCSsenParmNo){ diff --git a/src/spicelib/devices/cccs/cccsset.c b/src/spicelib/devices/cccs/cccsset.c index be3dab93f..5c5e0ba3b 100644 --- a/src/spicelib/devices/cccs/cccsset.c +++ b/src/spicelib/devices/cccs/cccsset.c @@ -27,10 +27,10 @@ CCCSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { here->CCCScontBranch = CKTfndBranch(ckt,here->CCCScontName); diff --git a/src/spicelib/devices/cccs/cccssld.c b/src/spicelib/devices/cccs/cccssld.c index 933c03c83..ead9584b8 100644 --- a/src/spicelib/devices/cccs/cccssld.c +++ b/src/spicelib/devices/cccs/cccssld.c @@ -25,10 +25,10 @@ CCCSsLoad(GENmodel *inModel, CKTcircuit *ckt) double ic ; /* loop through all the CCCS models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { if(here->CCCSsenParmNo){ diff --git a/src/spicelib/devices/cccs/cccssprt.c b/src/spicelib/devices/cccs/cccssprt.c index 2fc0f5e1f..5409f4a04 100644 --- a/src/spicelib/devices/cccs/cccssprt.c +++ b/src/spicelib/devices/cccs/cccssprt.c @@ -25,12 +25,12 @@ CCCSsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("CURRENT CONTROLLED CURRENT SOURCES-----------------\n"); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { printf("Model name:%s\n",model->CCCSmodName); /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { printf(" Instance name:%s\n",here->CCCSname); diff --git a/src/spicelib/devices/cccs/cccssset.c b/src/spicelib/devices/cccs/cccssset.c index 8ad2bf362..18319f7b4 100644 --- a/src/spicelib/devices/cccs/cccssset.c +++ b/src/spicelib/devices/cccs/cccssset.c @@ -24,10 +24,10 @@ CCCSsSetup(SENstruct *info, GENmodel *inModel) CCCSinstance *here; /* loop through all the CCCS models */ - for( ; model != NULL; model = model->CCCSnextModel ) { + for( ; model != NULL; model = CCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCCSinstances; here != NULL ; + for (here = CCCSinstances(model); here != NULL ; here=here->CCCSnextInstance) { if(here->CCCSsenParmNo){ diff --git a/src/spicelib/devices/ccvs/ccvsdefs.h b/src/spicelib/devices/ccvs/ccvsdefs.h index 1c96890a6..e33a7eb7f 100644 --- a/src/spicelib/devices/ccvs/ccvsdefs.h +++ b/src/spicelib/devices/ccvs/ccvsdefs.h @@ -51,14 +51,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/ccvs/ccvsdest.c b/src/spicelib/devices/ccvs/ccvsdest.c index 479b8455a..c32ef9fdb 100644 --- a/src/spicelib/devices/ccvs/ccvsdest.c +++ b/src/spicelib/devices/ccvs/ccvsdest.c @@ -14,8 +14,8 @@ CCVSdestroy(GENmodel **inModel) CCVSmodel *mod = *(CCVSmodel**) inModel; while (mod) { - CCVSmodel *next_mod = mod->CCVSnextModel; - CCVSinstance *inst = mod->CCVSinstances; + CCVSmodel *next_mod = CCVSnextModel(mod); + CCVSinstance *inst = CCVSinstances(mod); while (inst) { CCVSinstance *next_inst = inst->CCVSnextInstance; FREE(inst); diff --git a/src/spicelib/devices/ccvs/ccvsfbr.c b/src/spicelib/devices/ccvs/ccvsfbr.c index 5f7c0ee57..1a5e35bbc 100644 --- a/src/spicelib/devices/ccvs/ccvsfbr.c +++ b/src/spicelib/devices/ccvs/ccvsfbr.c @@ -20,8 +20,8 @@ CCVSfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) int error; CKTnode *tmp; - for( ; model != NULL; model = model->CCVSnextModel) { - for (here = model->CCVSinstances; here != NULL; + for( ; model != NULL; model = CCVSnextModel(model)) { + for (here = CCVSinstances(model); here != NULL; here = here->CCVSnextInstance) { if(here->CCVSname == name) { if(here->CCVSbranch == 0) { diff --git a/src/spicelib/devices/ccvs/ccvsload.c b/src/spicelib/devices/ccvs/ccvsload.c index 88f3f8c34..3c98f301e 100644 --- a/src/spicelib/devices/ccvs/ccvsload.c +++ b/src/spicelib/devices/ccvs/ccvsload.c @@ -26,10 +26,10 @@ CCVSload(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { *(here->CCVSposIbrPtr) += 1.0 ; diff --git a/src/spicelib/devices/ccvs/ccvspzld.c b/src/spicelib/devices/ccvs/ccvspzld.c index 9e3053077..fa3ae730a 100644 --- a/src/spicelib/devices/ccvs/ccvspzld.c +++ b/src/spicelib/devices/ccvs/ccvspzld.c @@ -28,10 +28,10 @@ CCVSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { *(here->CCVSposIbrPtr) += 1.0 ; diff --git a/src/spicelib/devices/ccvs/ccvssacl.c b/src/spicelib/devices/ccvs/ccvssacl.c index bebbef73a..ba44fd354 100644 --- a/src/spicelib/devices/ccvs/ccvssacl.c +++ b/src/spicelib/devices/ccvs/ccvssacl.c @@ -24,10 +24,10 @@ CCVSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) double ic,i_ic; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { if(here->CCVSsenParmNo){ diff --git a/src/spicelib/devices/ccvs/ccvsset.c b/src/spicelib/devices/ccvs/ccvsset.c index 5521312b3..50b6d5c32 100644 --- a/src/spicelib/devices/ccvs/ccvsset.c +++ b/src/spicelib/devices/ccvs/ccvsset.c @@ -25,10 +25,10 @@ CCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { if(here->CCVSposNode == here->CCVSnegNode) { @@ -72,9 +72,9 @@ CCVSunsetup(GENmodel *inModel, CKTcircuit *ckt) CCVSinstance *here; for (model = (CCVSmodel *)inModel; model != NULL; - model = model->CCVSnextModel) + model = CCVSnextModel(model)) { - for (here = model->CCVSinstances; here != NULL; + for (here = CCVSinstances(model); here != NULL; here=here->CCVSnextInstance) { if (here->CCVSbranch) { diff --git a/src/spicelib/devices/ccvs/ccvssld.c b/src/spicelib/devices/ccvs/ccvssld.c index fd1b210cb..65289822e 100644 --- a/src/spicelib/devices/ccvs/ccvssld.c +++ b/src/spicelib/devices/ccvs/ccvssld.c @@ -24,10 +24,10 @@ CCVSsLoad(GENmodel *inModel, CKTcircuit *ckt) double ic; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { if(here->CCVSsenParmNo){ diff --git a/src/spicelib/devices/ccvs/ccvssprt.c b/src/spicelib/devices/ccvs/ccvssprt.c index 1115c0226..d16d05881 100644 --- a/src/spicelib/devices/ccvs/ccvssprt.c +++ b/src/spicelib/devices/ccvs/ccvssprt.c @@ -24,12 +24,12 @@ CCVSsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("CURRENT CONTROLLED VOLTAGE SOURCES-----------------\n"); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { printf("Model name:%s\n",model->CCVSmodName); /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { printf(" Instance name:%s\n",here->CCVSname); diff --git a/src/spicelib/devices/ccvs/ccvssset.c b/src/spicelib/devices/ccvs/ccvssset.c index ad1c3bb08..76b82c6b8 100644 --- a/src/spicelib/devices/ccvs/ccvssset.c +++ b/src/spicelib/devices/ccvs/ccvssset.c @@ -23,10 +23,10 @@ CCVSsSetup(SENstruct *info, GENmodel *inModel) CCVSinstance *here; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->CCVSnextModel ) { + for( ; model != NULL; model = CCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CCVSinstances; here != NULL ; + for (here = CCVSinstances(model); here != NULL ; here=here->CCVSnextInstance) { if(here->CCVSsenParmNo){ diff --git a/src/spicelib/devices/cpl/cpldefs.h b/src/spicelib/devices/cpl/cpldefs.h index 9c441a0da..923300ab9 100644 --- a/src/spicelib/devices/cpl/cpldefs.h +++ b/src/spicelib/devices/cpl/cpldefs.h @@ -63,14 +63,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/cpl/cpldest.c b/src/spicelib/devices/cpl/cpldest.c index 439e63068..375c55df9 100644 --- a/src/spicelib/devices/cpl/cpldest.c +++ b/src/spicelib/devices/cpl/cpldest.c @@ -15,8 +15,8 @@ CPLdestroy(GENmodel **inModel) CPLmodel *mod = *(CPLmodel **) inModel; while (mod) { - CPLmodel *next_mod = mod->CPLnextModel; - CPLinstance *inst = mod->CPLinstances; + CPLmodel *next_mod = CPLnextModel(mod); + CPLinstance *inst = CPLinstances(mod); while (inst) { CPLinstance *next_inst = inst->CPLnextInstance; FREE(inst); diff --git a/src/spicelib/devices/cpl/cplload.c b/src/spicelib/devices/cpl/cplload.c index b24de76cb..3402ebaab 100644 --- a/src/spicelib/devices/cpl/cplload.c +++ b/src/spicelib/devices/cpl/cplload.c @@ -70,8 +70,8 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) gmin = 0.1 * ckt->CKTgmin; /* dc solution */ - for( ; model != NULL; model = model->CPLnextModel ) { - for (here = model->CPLinstances; here != NULL ; + for( ; model != NULL; model = CPLnextModel(model) ) { + for (here = CPLinstances(model); here != NULL ; here=here->CPLnextInstance) { cp = here->cplines; @@ -123,10 +123,10 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) model = (CPLmodel *)inModel; /* loop through all the models */ - for( ; model != NULL; model = model->CPLnextModel ) { + for( ; model != NULL; model = CPLnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CPLinstances; here != NULL ; + for (here = CPLinstances(model); here != NULL ; here=here->CPLnextInstance) { double mintaul = 123456789.0; diff --git a/src/spicelib/devices/cpl/cplsetup.c b/src/spicelib/devices/cpl/cplsetup.c index ac5026aa4..30ab21924 100644 --- a/src/spicelib/devices/cpl/cplsetup.c +++ b/src/spicelib/devices/cpl/cplsetup.c @@ -147,7 +147,7 @@ CPLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) NG_IGNORE(state); /* loop through all the models */ - for( ; model != NULL; model = model->CPLnextModel ) { + for( ; model != NULL; model = CPLnextModel(model) ) { if (!model->Rmgiven) { SPfrontEnd->IFerrorf (ERR_FATAL, @@ -176,7 +176,7 @@ CPLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) } /* loop through all the instances of the model */ - for (here = model->CPLinstances; here != NULL ; + for (here = CPLinstances(model); here != NULL ; here=here->CPLnextInstance) { if (!here->CPLlengthGiven) @@ -299,8 +299,8 @@ CPLunsetup(GENmodel *inModel, CKTcircuit *ckt) int noL; for (model = (CPLmodel *) inModel; model != NULL; - model = model->CPLnextModel) { - for (here = model->CPLinstances; here != NULL; + model = CPLnextModel(model)) { + for (here = CPLinstances(model); here != NULL; here = here->CPLnextInstance) { noL = here->dimension; diff --git a/src/spicelib/devices/csw/cswacld.c b/src/spicelib/devices/csw/cswacld.c index d7b7daa40..529f3b916 100644 --- a/src/spicelib/devices/csw/cswacld.c +++ b/src/spicelib/devices/csw/cswacld.c @@ -26,10 +26,10 @@ CSWacLoad(GENmodel *inModel, CKTcircuit *ckt) int current_state; /* loop through all the switch models */ - for( ; model != NULL; model = model->CSWnextModel ) { + for( ; model != NULL; model = CSWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CSWinstances; here != NULL ; + for (here = CSWinstances(model); here != NULL ; here=here->CSWnextInstance) { current_state = (int)*(ckt->CKTstate0 + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswdefs.h b/src/spicelib/devices/csw/cswdefs.h index 59522dabb..1f2d97656 100644 --- a/src/spicelib/devices/csw/cswdefs.h +++ b/src/spicelib/devices/csw/cswdefs.h @@ -57,14 +57,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/csw/cswdest.c b/src/spicelib/devices/csw/cswdest.c index 60e08c486..9059653eb 100644 --- a/src/spicelib/devices/csw/cswdest.c +++ b/src/spicelib/devices/csw/cswdest.c @@ -14,8 +14,8 @@ CSWdestroy(GENmodel **inModel) CSWmodel *mod = *(CSWmodel**) inModel; while (mod) { - CSWmodel *next_mod = mod->CSWnextModel; - CSWinstance *inst = mod->CSWinstances; + CSWmodel *next_mod = CSWnextModel(mod); + CSWinstance *inst = CSWinstances(mod); while (inst) { CSWinstance *next_inst = inst->CSWnextInstance; FREE(inst); diff --git a/src/spicelib/devices/csw/cswload.c b/src/spicelib/devices/csw/cswload.c index dedd8f2f4..cc59c3a48 100644 --- a/src/spicelib/devices/csw/cswload.c +++ b/src/spicelib/devices/csw/cswload.c @@ -31,10 +31,10 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) /* switch is on or off while control value is in hysteresis region. */ /* loop through all the switch models */ - for( ; model != NULL; model = model->CSWnextModel ) { + for( ; model != NULL; model = CSWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CSWinstances; here != NULL ; + for (here = CSWinstances(model); here != NULL ; here=here->CSWnextInstance) { old_current_state = *(ckt->CKTstates[0] + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswnoise.c b/src/spicelib/devices/csw/cswnoise.c index a6969c499..1c79472c2 100644 --- a/src/spicelib/devices/csw/cswnoise.c +++ b/src/spicelib/devices/csw/cswnoise.c @@ -36,8 +36,8 @@ CSWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *d int current_state; - for (model=firstModel; model != NULL; model=model->CSWnextModel) { - for (inst=model->CSWinstances; inst != NULL; inst=inst->CSWnextInstance) { + for (model=firstModel; model != NULL; model=CSWnextModel(model)) { + for (inst=CSWinstances(model); inst != NULL; inst=inst->CSWnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/csw/cswpzld.c b/src/spicelib/devices/csw/cswpzld.c index 74641c641..d4253075f 100644 --- a/src/spicelib/devices/csw/cswpzld.c +++ b/src/spicelib/devices/csw/cswpzld.c @@ -30,10 +30,10 @@ CSWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); /* loop through all the switch models */ - for( ; model != NULL; model = model->CSWnextModel ) { + for( ; model != NULL; model = CSWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->CSWinstances; here != NULL ; + for (here = CSWinstances(model); here != NULL ; here=here->CSWnextInstance) { current_state = (int)*(ckt->CKTstate0 + here->CSWstate); diff --git a/src/spicelib/devices/csw/cswsetup.c b/src/spicelib/devices/csw/cswsetup.c index d334276c1..ee95f18c7 100644 --- a/src/spicelib/devices/csw/cswsetup.c +++ b/src/spicelib/devices/csw/cswsetup.c @@ -23,7 +23,7 @@ CSWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CSWinstance *here; /* loop through all the current source models */ - for( ; model != NULL; model = model->CSWnextModel ) { + for( ; model != NULL; model = CSWnextModel(model) ) { /* Default Value Processing for Switch Model */ if (!model->CSWthreshGiven) { model->CSWiThreshold = 0; @@ -41,7 +41,7 @@ CSWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->CSWinstances; here != NULL ; + for (here = CSWinstances(model); here != NULL ; here=here->CSWnextInstance) { /* Default Value Processing for Switch Instance */ diff --git a/src/spicelib/devices/csw/cswtrunc.c b/src/spicelib/devices/csw/cswtrunc.c index 415f57c16..394aca753 100644 --- a/src/spicelib/devices/csw/cswtrunc.c +++ b/src/spicelib/devices/csw/cswtrunc.c @@ -21,8 +21,8 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double lastChange, maxChange, maxStep, ref; - for( ; model!= NULL; model = model->CSWnextModel) { - for(here = model->CSWinstances ; here != NULL ; + for( ; model!= NULL; model = CSWnextModel(model)) { + for(here = CSWinstances(model) ; here != NULL ; here = here->CSWnextInstance) { lastChange = *(ckt->CKTstate0+(here->CSWstate+1)) - *(ckt->CKTstate1+(here->CSWstate+1)); diff --git a/src/spicelib/devices/dio/dioacld.c b/src/spicelib/devices/dio/dioacld.c index 9adfa80b7..8b330381c 100644 --- a/src/spicelib/devices/dio/dioacld.c +++ b/src/spicelib/devices/dio/dioacld.c @@ -23,10 +23,10 @@ DIOacLoad(GENmodel *inModel, CKTcircuit *ckt) DIOinstance *here; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { gspr=here->DIOtConductance*here->DIOarea; geq= *(ckt->CKTstate0 + here->DIOconduct); diff --git a/src/spicelib/devices/dio/dioconv.c b/src/spicelib/devices/dio/dioconv.c index faf84aae5..a78e7c151 100644 --- a/src/spicelib/devices/dio/dioconv.c +++ b/src/spicelib/devices/dio/dioconv.c @@ -22,10 +22,10 @@ DIOconvTest(GENmodel *inModel, CKTcircuit *ckt) double delvd,vd,cdhat,cd; double tol; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { /* diff --git a/src/spicelib/devices/dio/diodefs.h b/src/spicelib/devices/dio/diodefs.h index 65c0f869b..5992e2911 100644 --- a/src/spicelib/devices/dio/diodefs.h +++ b/src/spicelib/devices/dio/diodefs.h @@ -164,14 +164,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/dio/diodest.c b/src/spicelib/devices/dio/diodest.c index ef8b09508..5b84f6f3c 100644 --- a/src/spicelib/devices/dio/diodest.c +++ b/src/spicelib/devices/dio/diodest.c @@ -14,8 +14,8 @@ DIOdestroy(GENmodel **inModel) DIOmodel *mod = *(DIOmodel**) inModel; while (mod) { - DIOmodel *next_mod = mod->DIOnextModel; - DIOinstance *inst = mod->DIOinstances; + DIOmodel *next_mod = DIOnextModel(mod); + DIOinstance *inst = DIOinstances(mod); while (inst) { DIOinstance *next_inst = inst->DIOnextInstance; FREE(inst); diff --git a/src/spicelib/devices/dio/diodisto.c b/src/spicelib/devices/dio/diodisto.c index a0eed3f05..f708927b7 100644 --- a/src/spicelib/devices/dio/diodisto.c +++ b/src/spicelib/devices/dio/diodisto.c @@ -37,10 +37,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the DIO models */ -for( ; model != NULL; model = model->DIOnextModel ) { +for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/dio/diodset.c b/src/spicelib/devices/dio/diodset.c index ccf288d16..93ea78ad6 100644 --- a/src/spicelib/devices/dio/diodset.c +++ b/src/spicelib/devices/dio/diodset.c @@ -45,10 +45,10 @@ DIOdSetup(DIOmodel *model, CKTcircuit *ckt) double cjunc1SW,cjunc2SW,cjunc3SW; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { /* diff --git a/src/spicelib/devices/dio/diogetic.c b/src/spicelib/devices/dio/diogetic.c index f2c4ef0dc..d6cbfcbc4 100644 --- a/src/spicelib/devices/dio/diogetic.c +++ b/src/spicelib/devices/dio/diogetic.c @@ -22,8 +22,8 @@ DIOgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->DIOnextModel) { - for(here = model->DIOinstances; here ; here = here->DIOnextInstance) { + for( ; model ; model = DIOnextModel(model)) { + for(here = DIOinstances(model); here ; here = here->DIOnextInstance) { if(!here->DIOinitCondGiven) { here->DIOinitCond = diff --git a/src/spicelib/devices/dio/dioload.c b/src/spicelib/devices/dio/dioload.c index b39a1b0e6..944a9d269 100644 --- a/src/spicelib/devices/dio/dioload.c +++ b/src/spicelib/devices/dio/dioload.c @@ -63,10 +63,10 @@ DIOload(GENmodel *inModel, CKTcircuit *ckt) double diffcharge, diffchargeSW, deplcharge, deplchargeSW, diffcap, diffcapSW, deplcap, deplcapSW; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { /* diff --git a/src/spicelib/devices/dio/dionoise.c b/src/spicelib/devices/dio/dionoise.c index 3655266ca..35bd43447 100644 --- a/src/spicelib/devices/dio/dionoise.c +++ b/src/spicelib/devices/dio/dionoise.c @@ -46,8 +46,8 @@ DIOnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total diode noise */ }; - for (model=firstModel; model != NULL; model=model->DIOnextModel) { - for (inst=model->DIOinstances; inst != NULL; inst=inst->DIOnextInstance) { + for (model=firstModel; model != NULL; model=DIOnextModel(model)) { + for (inst=DIOinstances(model); inst != NULL; inst=inst->DIOnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/dio/diopzld.c b/src/spicelib/devices/dio/diopzld.c index 317009fa8..16a3df20f 100644 --- a/src/spicelib/devices/dio/diopzld.c +++ b/src/spicelib/devices/dio/diopzld.c @@ -24,10 +24,10 @@ DIOpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) DIOinstance *here; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { gspr=here->DIOtConductance*here->DIOarea; geq= *(ckt->CKTstate0 + here->DIOconduct); diff --git a/src/spicelib/devices/dio/diosacl.c b/src/spicelib/devices/dio/diosacl.c index 9ad2c6778..e6e13f2d3 100644 --- a/src/spicelib/devices/dio/diosacl.c +++ b/src/spicelib/devices/dio/diosacl.c @@ -72,10 +72,10 @@ DIOsAcLoad(GENmodel *inModel, CKTcircuit *ckt) info = ckt->CKTsenInfo; info->SENstatus = PERTURBATION; /* loop through all the models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/dio/diosetup.c b/src/spicelib/devices/dio/diosetup.c index 3ef214e74..b6fde6a79 100644 --- a/src/spicelib/devices/dio/diosetup.c +++ b/src/spicelib/devices/dio/diosetup.c @@ -25,7 +25,7 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { if(!model->DIOlevelGiven) { model->DIOlevel = 1; @@ -161,7 +161,7 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { if(!here->DIOareaGiven) { @@ -250,9 +250,9 @@ DIOunsetup( DIOinstance *here; for (model = (DIOmodel *)inModel; model != NULL; - model = model->DIOnextModel) + model = DIOnextModel(model)) { - for (here = model->DIOinstances; here != NULL; + for (here = DIOinstances(model); here != NULL; here=here->DIOnextInstance) { diff --git a/src/spicelib/devices/dio/diosload.c b/src/spicelib/devices/dio/diosload.c index 2a173501e..41d4cab98 100644 --- a/src/spicelib/devices/dio/diosload.c +++ b/src/spicelib/devices/dio/diosload.c @@ -63,10 +63,10 @@ DIOsLoad(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/dio/diosoachk.c b/src/spicelib/devices/dio/diosoachk.c index f1ed25980..710fb533b 100644 --- a/src/spicelib/devices/dio/diosoachk.c +++ b/src/spicelib/devices/dio/diosoachk.c @@ -29,9 +29,9 @@ DIOsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->DIOnextModel) { + for (; model; model = DIOnextModel(model)) { - for (here = model->DIOinstances; here; here = here->DIOnextInstance) { + for (here = DIOinstances(model); here; here = here->DIOnextInstance) { vd = ckt->CKTrhsOld [here->DIOposPrimeNode] - ckt->CKTrhsOld [here->DIOnegNode]; diff --git a/src/spicelib/devices/dio/diosprt.c b/src/spicelib/devices/dio/diosprt.c index 00bac9aa4..90e0a5d7c 100644 --- a/src/spicelib/devices/dio/diosprt.c +++ b/src/spicelib/devices/dio/diosprt.c @@ -27,12 +27,12 @@ DIOsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("DIOS-----------------\n"); /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { printf("Model name:%s\n",model->DIOmodName); /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { printf(" Instance name:%s\n",here->DIOname); diff --git a/src/spicelib/devices/dio/diosset.c b/src/spicelib/devices/dio/diosset.c index 90b0b5e89..9c37ee2c4 100644 --- a/src/spicelib/devices/dio/diosset.c +++ b/src/spicelib/devices/dio/diosset.c @@ -26,10 +26,10 @@ DIOsSetup(SENstruct *info, GENmodel *inModel) DIOinstance *here; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { if(here->DIOsenParmNo){ diff --git a/src/spicelib/devices/dio/diosupd.c b/src/spicelib/devices/dio/diosupd.c index a251196c9..dd35220b4 100644 --- a/src/spicelib/devices/dio/diosupd.c +++ b/src/spicelib/devices/dio/diosupd.c @@ -42,10 +42,10 @@ DIOsUpdate(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->DIOinstances; here != NULL ; + for (here = DIOinstances(model); here != NULL ; here=here->DIOnextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/dio/diotemp.c b/src/spicelib/devices/dio/diotemp.c index f29581189..fdc5bdfa3 100644 --- a/src/spicelib/devices/dio/diotemp.c +++ b/src/spicelib/devices/dio/diotemp.c @@ -33,7 +33,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt) double tBreakdownVoltage; /* loop through all the diode models */ - for( ; model != NULL; model = model->DIOnextModel ) { + for( ; model != NULL; model = DIOnextModel(model) ) { if(!model->DIOnomTempGiven) { model->DIOnomTemp = ckt->CKTnomTemp; } @@ -70,7 +70,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt) xfc=log(1-model->DIOdepletionCapCoeff); xfcs=log(1-model->DIOdepletionSWcapCoeff); - for(here=model->DIOinstances;here;here=here->DIOnextInstance) { + for(here=DIOinstances(model);here;here=here->DIOnextInstance) { double egfet1,arg1,fact1,pbfact1,pbo,gmaold,pboSW,gmaSWold; double fact2,pbfact,arg,egfet,gmanew,gmaSWnew; /* loop through all the instances */ diff --git a/src/spicelib/devices/dio/diotrunc.c b/src/spicelib/devices/dio/diotrunc.c index c61954e36..1c6880fa3 100644 --- a/src/spicelib/devices/dio/diotrunc.c +++ b/src/spicelib/devices/dio/diotrunc.c @@ -18,8 +18,8 @@ DIOtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) DIOmodel *model = (DIOmodel*)inModel; DIOinstance *here; - for( ; model != NULL; model = model->DIOnextModel) { - for(here=model->DIOinstances;here!=NULL;here = here->DIOnextInstance){ + for( ; model != NULL; model = DIOnextModel(model)) { + for(here=DIOinstances(model);here!=NULL;here = here->DIOnextInstance){ CKTterr(here->DIOcapCharge,ckt,timeStep); } } diff --git a/src/spicelib/devices/hfet1/hfetacl.c b/src/spicelib/devices/hfet1/hfetacl.c index 781f4822a..0ddf3c7e8 100644 --- a/src/spicelib/devices/hfet1/hfetacl.c +++ b/src/spicelib/devices/hfet1/hfetacl.c @@ -28,9 +28,9 @@ HFETAacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->HFETAnextModel ) + for( ; model != NULL; model = HFETAnextModel(model) ) { - for( here = model->HFETAinstances; here != NULL; + for( here = HFETAinstances(model); here != NULL; here = here->HFETAnextInstance) { gm = *(ckt->CKTstate0 + here->HFETAgm); diff --git a/src/spicelib/devices/hfet1/hfetdefs.h b/src/spicelib/devices/hfet1/hfetdefs.h index 61ed45403..a706a6917 100644 --- a/src/spicelib/devices/hfet1/hfetdefs.h +++ b/src/spicelib/devices/hfet1/hfetdefs.h @@ -128,12 +128,12 @@ typedef struct sHFETAinstance { /* per model data */ typedef struct sHFETAmodel { - int HFETAmodType; - struct sHFETAmodel *HFETAnextModel; - HFETAinstance *HFETAinstances; - IFuid HFETAmodName; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/hfet1/hfetdest.c b/src/spicelib/devices/hfet1/hfetdest.c index 4c06f9fdf..234c96a49 100644 --- a/src/spicelib/devices/hfet1/hfetdest.c +++ b/src/spicelib/devices/hfet1/hfetdest.c @@ -14,8 +14,8 @@ HFETAdestroy(GENmodel **inModel) HFETAmodel *mod = *(HFETAmodel**) inModel; while (mod) { - HFETAmodel *next_mod = mod->HFETAnextModel; - HFETAinstance *inst = mod->HFETAinstances; + HFETAmodel *next_mod = HFETAnextModel(mod); + HFETAinstance *inst = HFETAinstances(mod); while (inst) { HFETAinstance *next_inst = inst->HFETAnextInstance; FREE(inst); diff --git a/src/spicelib/devices/hfet1/hfetgetic.c b/src/spicelib/devices/hfet1/hfetgetic.c index 2397cea03..5d196681a 100644 --- a/src/spicelib/devices/hfet1/hfetgetic.c +++ b/src/spicelib/devices/hfet1/hfetgetic.c @@ -20,8 +20,8 @@ HFETAgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->HFETAnextModel) { - for(here = model->HFETAinstances; here ; here = here->HFETAnextInstance) { + for( ; model ; model = HFETAnextModel(model)) { + for(here = HFETAinstances(model); here ; here = here->HFETAnextInstance) { if(!here->HFETAicVDSGiven) { here->HFETAicVDS = diff --git a/src/spicelib/devices/hfet1/hfetload.c b/src/spicelib/devices/hfet1/hfetload.c index 4e93bb3ad..735f2056b 100644 --- a/src/spicelib/devices/hfet1/hfetload.c +++ b/src/spicelib/devices/hfet1/hfetload.c @@ -86,8 +86,8 @@ int HFETAload(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->HFETAnextModel ) { - for (here = model->HFETAinstances; here != NULL ; + for( ; model != NULL; model = HFETAnextModel(model) ) { + for (here = HFETAinstances(model); here != NULL ; here=here->HFETAnextInstance) { vcrit = here->HFETAvcrit; diff --git a/src/spicelib/devices/hfet1/hfetpzl.c b/src/spicelib/devices/hfet1/hfetpzl.c index 2bbae145d..ee5b0a5de 100644 --- a/src/spicelib/devices/hfet1/hfetpzl.c +++ b/src/spicelib/devices/hfet1/hfetpzl.c @@ -31,9 +31,9 @@ HFETApzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->HFETAnextModel ) + for( ; model != NULL; model = HFETAnextModel(model) ) { - for( here = model->HFETAinstances; here != NULL; + for( here = HFETAinstances(model); here != NULL; here = here->HFETAnextInstance) { gm = *(ckt->CKTstate0 + here->HFETAgm); diff --git a/src/spicelib/devices/hfet1/hfetsetup.c b/src/spicelib/devices/hfet1/hfetsetup.c index 845f67296..54cf23eed 100644 --- a/src/spicelib/devices/hfet1/hfetsetup.c +++ b/src/spicelib/devices/hfet1/hfetsetup.c @@ -29,7 +29,7 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the diode models */ - for( ; model != NULL; model = model->HFETAnextModel ) { + for( ; model != NULL; model = HFETAnextModel(model) ) { if( (model->HFETAtype != NHFET) && (model->HFETAtype != PHFET) ) { model->HFETAtype = NHFET; } @@ -229,7 +229,7 @@ HFETAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) KVTO = 0; /* loop through all the instances of the model */ - for (here = model->HFETAinstances; here != NULL ; + for (here = HFETAinstances(model); here != NULL ; here=here->HFETAnextInstance) { if(!here->HFETAlengthGiven) { @@ -407,9 +407,9 @@ HFETAunsetup(GENmodel *inModel, CKTcircuit *ckt) HFETAinstance *here; for (model = (HFETAmodel *)inModel; model != NULL; - model = model->HFETAnextModel) + model = HFETAnextModel(model)) { - for (here = model->HFETAinstances; here != NULL; + for (here = HFETAinstances(model); here != NULL; here=here->HFETAnextInstance) { if (here->HFETAsourcePrmPrmNode > 0 diff --git a/src/spicelib/devices/hfet1/hfettemp.c b/src/spicelib/devices/hfet1/hfettemp.c index 613d440cc..36e06defe 100644 --- a/src/spicelib/devices/hfet1/hfettemp.c +++ b/src/spicelib/devices/hfet1/hfettemp.c @@ -22,7 +22,7 @@ HFETAtemp(GENmodel *inModel, CKTcircuit *ckt) double temp; /* loop through all the diode models */ - for( ; model != NULL; model = model->HFETAnextModel ) { + for( ; model != NULL; model = HFETAnextModel(model) ) { if(model->HFETArd != 0) { model->HFETAdrainConduct = 1/model->HFETArd; } else { @@ -56,7 +56,7 @@ HFETAtemp(GENmodel *inModel, CKTcircuit *ckt) if(!model->HFETAvt1Given) IN_VT1 = VTO+CHARGE*NMAX*DI/EPSI; - for (here = model->HFETAinstances; here != NULL ; + for (here = HFETAinstances(model); here != NULL ; here=here->HFETAnextInstance) { if(!here->HFETAdtempGiven) { diff --git a/src/spicelib/devices/hfet1/hfettrunc.c b/src/spicelib/devices/hfet1/hfettrunc.c index afa39dc5f..3e6928e44 100644 --- a/src/spicelib/devices/hfet1/hfettrunc.c +++ b/src/spicelib/devices/hfet1/hfettrunc.c @@ -16,8 +16,8 @@ HFETAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) HFETAmodel *model = (HFETAmodel*)inModel; HFETAinstance *here; - for( ; model != NULL; model = model->HFETAnextModel) { - for(here=model->HFETAinstances;here!=NULL;here = here->HFETAnextInstance){ + for( ; model != NULL; model = HFETAnextModel(model)) { + for(here=HFETAinstances(model);here!=NULL;here = here->HFETAnextInstance){ CKTterr(here->HFETAqgs,ckt,timeStep); CKTterr(here->HFETAqgd,ckt,timeStep); diff --git a/src/spicelib/devices/hfet2/hfet2acl.c b/src/spicelib/devices/hfet2/hfet2acl.c index ec4151b8e..24cd041d3 100644 --- a/src/spicelib/devices/hfet2/hfet2acl.c +++ b/src/spicelib/devices/hfet2/hfet2acl.c @@ -26,9 +26,9 @@ int HFET2acLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->HFET2nextModel ) + for( ; model != NULL; model = HFET2nextModel(model) ) { - for( here = model->HFET2instances; here != NULL; + for( here = HFET2instances(model); here != NULL; here = here->HFET2nextInstance) { m = here->HFET2m; diff --git a/src/spicelib/devices/hfet2/hfet2defs.h b/src/spicelib/devices/hfet2/hfet2defs.h index d042e5886..a4b7247f9 100644 --- a/src/spicelib/devices/hfet2/hfet2defs.h +++ b/src/spicelib/devices/hfet2/hfet2defs.h @@ -86,13 +86,13 @@ typedef struct sHFET2instance { typedef struct sHFET2model { - int HFET2modType; - struct sHFET2model *HFET2nextModel; - HFET2instance * HFET2instances; + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#define HFET2modType gen.GENmodType +#define HFET2nextModel(inst) ((struct sHFET2model*)((inst)->gen.GENnextModel)) +#define HFET2instances(inst) ((HFET2instance*)((inst)->gen.GENinstances)) +#define HFET2modName gen.GENmodName - IFuid HFET2modName; int HFET2type; double HFET2cf; diff --git a/src/spicelib/devices/hfet2/hfet2dest.c b/src/spicelib/devices/hfet2/hfet2dest.c index 1ab7acd0f..20182cf01 100644 --- a/src/spicelib/devices/hfet2/hfet2dest.c +++ b/src/spicelib/devices/hfet2/hfet2dest.c @@ -14,8 +14,8 @@ HFET2destroy(GENmodel **inModel) HFET2model *mod = *(HFET2model**) inModel; while (mod) { - HFET2model *next_mod = mod->HFET2nextModel; - HFET2instance *inst = mod->HFET2instances; + HFET2model *next_mod = HFET2nextModel(mod); + HFET2instance *inst = HFET2instances(mod); while (inst) { HFET2instance *next_inst = inst->HFET2nextInstance; FREE(inst); diff --git a/src/spicelib/devices/hfet2/hfet2getic.c b/src/spicelib/devices/hfet2/hfet2getic.c index 6622953c1..905749d82 100644 --- a/src/spicelib/devices/hfet2/hfet2getic.c +++ b/src/spicelib/devices/hfet2/hfet2getic.c @@ -16,8 +16,8 @@ int HFET2getic(GENmodel *inModel, CKTcircuit *ckt) HFET2model *model = (HFET2model*)inModel; HFET2instance *here; - for( ; model ; model = model->HFET2nextModel) { - for(here = model->HFET2instances; here ; here = here->HFET2nextInstance) { + for( ; model ; model = HFET2nextModel(model)) { + for(here = HFET2instances(model); here ; here = here->HFET2nextInstance) { if(!here->HFET2icVDSGiven) { here->HFET2icVDS = *(ckt->CKTrhs + here->HFET2drainNode) - diff --git a/src/spicelib/devices/hfet2/hfet2load.c b/src/spicelib/devices/hfet2/hfet2load.c index b6b9a7eca..1a2bbc0f8 100644 --- a/src/spicelib/devices/hfet2/hfet2load.c +++ b/src/spicelib/devices/hfet2/hfet2load.c @@ -64,8 +64,8 @@ int HFET2load(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->HFET2nextModel ) { - for(here = model->HFET2instances; here != NULL; + for( ; model != NULL; model = HFET2nextModel(model) ) { + for(here = HFET2instances(model); here != NULL; here=here->HFET2nextInstance) { gdpr = model->HFET2drainConduct; diff --git a/src/spicelib/devices/hfet2/hfet2pzl.c b/src/spicelib/devices/hfet2/hfet2pzl.c index 10e5c6dc9..24a630fc6 100644 --- a/src/spicelib/devices/hfet2/hfet2pzl.c +++ b/src/spicelib/devices/hfet2/hfet2pzl.c @@ -28,9 +28,9 @@ int HFET2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->HFET2nextModel ) + for( ; model != NULL; model = HFET2nextModel(model) ) { - for( here = model->HFET2instances; here != NULL; + for( here = HFET2instances(model); here != NULL; here = here->HFET2nextInstance) { m = here->HFET2m; diff --git a/src/spicelib/devices/hfet2/hfet2setup.c b/src/spicelib/devices/hfet2/hfet2setup.c index dc267a3f1..7998ec540 100644 --- a/src/spicelib/devices/hfet2/hfet2setup.c +++ b/src/spicelib/devices/hfet2/hfet2setup.c @@ -20,7 +20,7 @@ int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state int error; CKTnode *tmp; - for( ; model != NULL; model = model->HFET2nextModel ) { + for( ; model != NULL; model = HFET2nextModel(model) ) { if((TYPE != NHFET) && (TYPE != PHFET) ) TYPE = NHFET; if(!model->HFET2cfGiven) @@ -120,7 +120,7 @@ int HFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state /* loop through all the instances of the model */ - for (here = model->HFET2instances; here != NULL; + for (here = HFET2instances(model); here != NULL; here=here->HFET2nextInstance) { CKTnode *tmpNode; @@ -211,9 +211,9 @@ HFET2unsetup(GENmodel *inModel, CKTcircuit *ckt) HFET2instance *here; for (model = (HFET2model *)inModel; model != NULL; - model = model->HFET2nextModel) + model = HFET2nextModel(model)) { - for (here = model->HFET2instances; here != NULL; + for (here = HFET2instances(model); here != NULL; here=here->HFET2nextInstance) { if (here->HFET2drainPrimeNode > 0 diff --git a/src/spicelib/devices/hfet2/hfet2temp.c b/src/spicelib/devices/hfet2/hfet2temp.c index 0e9d8b2a0..d804bc8e9 100644 --- a/src/spicelib/devices/hfet2/hfet2temp.c +++ b/src/spicelib/devices/hfet2/hfet2temp.c @@ -22,7 +22,7 @@ CKTcircuit *ckt) double vt; double tdiff; - for( ; model != NULL; model = model->HFET2nextModel ) { + for( ; model != NULL; model = HFET2nextModel(model) ) { if(model->HFET2rd != 0) model->HFET2drainConduct = 1/model->HFET2rd; else @@ -36,7 +36,7 @@ CKTcircuit *ckt) if(!model->HFET2vt2Given) VT2 = VTO; DELTA2 = DELTA*DELTA; - for (here = model->HFET2instances; here != NULL; + for (here = HFET2instances(model); here != NULL; here=here->HFET2nextInstance) { if(!here->HFET2dtempGiven) diff --git a/src/spicelib/devices/hfet2/hfet2trunc.c b/src/spicelib/devices/hfet2/hfet2trunc.c index aa7d0bfd6..cbfe31022 100644 --- a/src/spicelib/devices/hfet2/hfet2trunc.c +++ b/src/spicelib/devices/hfet2/hfet2trunc.c @@ -15,8 +15,8 @@ double *tiHFET2tep) HFET2model *model = (HFET2model*)inModel; HFET2instance *here; - for( ; model != NULL; model = model->HFET2nextModel) { - for(here=model->HFET2instances;here!=NULL; + for( ; model != NULL; model = HFET2nextModel(model)) { + for(here=HFET2instances(model);here!=NULL; here = here->HFET2nextInstance){ CKTterr(here->HFET2qgs,ckt,tiHFET2tep); diff --git a/src/spicelib/devices/hisim2/hsm2acld.c b/src/spicelib/devices/hisim2/hsm2acld.c index 1a8eda54b..d13ace236 100644 --- a/src/spicelib/devices/hisim2/hsm2acld.c +++ b/src/spicelib/devices/hisim2/hsm2acld.c @@ -110,8 +110,8 @@ int HSM2acLoad( double cdbs_imag, cgbs_imag, csbs_imag, cbbs_imag; omega = ckt->CKTomega; - for ( ; model != NULL; model = model->HSM2nextModel ) { - for ( here = model->HSM2instances; here!= NULL; here = here->HSM2nextInstance ) { + for ( ; model != NULL; model = HSM2nextModel(model) ) { + for ( here = HSM2instances(model); here!= NULL; here = here->HSM2nextInstance ) { gdpr = here->HSM2drainConductance; gspr = here->HSM2sourceConductance; diff --git a/src/spicelib/devices/hisim2/hsm2cvtest.c b/src/spicelib/devices/hisim2/hsm2cvtest.c index a847922fe..ff2554809 100644 --- a/src/spicelib/devices/hisim2/hsm2cvtest.c +++ b/src/spicelib/devices/hisim2/hsm2cvtest.c @@ -74,9 +74,9 @@ int HSM2convTest( double Ibtot, cbhat, Igstot, cgshat, Igdtot, cgdhat, Igbtot, cgbhat; /* loop through all the HSM2 device models */ - for ( ; model != NULL; model = model->HSM2nextModel ) { + for ( ; model != NULL; model = HSM2nextModel(model) ) { /* loop through all the instances of the model */ - for ( here = model->HSM2instances; here != NULL ; + for ( here = HSM2instances(model); here != NULL ; here = here->HSM2nextInstance ) { vbs = model->HSM2_type * (*(ckt->CKTrhsOld+here->HSM2bNode) - diff --git a/src/spicelib/devices/hisim2/hsm2def.h b/src/spicelib/devices/hisim2/hsm2def.h index 77e290735..ecf799219 100644 --- a/src/spicelib/devices/hisim2/hsm2def.h +++ b/src/spicelib/devices/hisim2/hsm2def.h @@ -681,14 +681,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/hisim2/hsm2dest.c b/src/spicelib/devices/hisim2/hsm2dest.c index 32fbb857f..18c73de39 100644 --- a/src/spicelib/devices/hisim2/hsm2dest.c +++ b/src/spicelib/devices/hisim2/hsm2dest.c @@ -70,8 +70,8 @@ HSM2destroy(GENmodel **inModel) #endif while (mod) { - HSM2model *next_mod = mod->HSM2nextModel; - HSM2instance *inst = mod->HSM2instances; + HSM2model *next_mod = HSM2nextModel(mod); + HSM2instance *inst = HSM2instances(mod); while (inst) { HSM2instance *next_inst = inst->HSM2nextInstance; FREE(inst); diff --git a/src/spicelib/devices/hisim2/hsm2getic.c b/src/spicelib/devices/hisim2/hsm2getic.c index 22a06a7ed..1ff76761c 100644 --- a/src/spicelib/devices/hisim2/hsm2getic.c +++ b/src/spicelib/devices/hisim2/hsm2getic.c @@ -71,8 +71,8 @@ int HSM2getic( * external nodes to get values */ - for ( ;model ;model = model->HSM2nextModel ) { - for ( here = model->HSM2instances; here ;here = here->HSM2nextInstance ) { + for ( ;model ;model = HSM2nextModel(model) ) { + for ( here = HSM2instances(model); here ;here = here->HSM2nextInstance ) { if (!here->HSM2_icVBS_Given) { here->HSM2_icVBS = *(ckt->CKTrhs + here->HSM2bNode) - diff --git a/src/spicelib/devices/hisim2/hsm2ld.c b/src/spicelib/devices/hisim2/hsm2ld.c index 3cc6f32c5..350a73305 100644 --- a/src/spicelib/devices/hisim2/hsm2ld.c +++ b/src/spicelib/devices/hisim2/hsm2ld.c @@ -307,7 +307,7 @@ tm0 = gtodsecld() ; model->HSM2_bypass_enable = BYPASS_enable ; #else /* loop through all the HSM2 device models */ - for ( ; model != NULL; model = model->HSM2nextModel ) { + for ( ; model != NULL; model = HSM2nextModel(model) ) { /* loop through all the instances of the model */ reltol = ckt->CKTreltol * BYP_TOL_FACTOR ; @@ -316,7 +316,7 @@ tm0 = gtodsecld() ; BYPASS_enable = (BYP_TOL_FACTOR > 0.0 && ckt->CKTbypass) ; model->HSM2_bypass_enable = BYPASS_enable ; - for (here = model->HSM2instances; here != NULL ; + for (here = HSM2instances(model); here != NULL ; here = here->HSM2nextInstance) { #endif /* pParam = &here->pParam ;*/ diff --git a/src/spicelib/devices/hisim2/hsm2noi.c b/src/spicelib/devices/hisim2/hsm2noi.c index 3746450b6..951466782 100644 --- a/src/spicelib/devices/hisim2/hsm2noi.c +++ b/src/spicelib/devices/hisim2/hsm2noi.c @@ -109,8 +109,8 @@ int HSM2noise ( "" /* total transistor noise */ }; - for ( ;model != NULL; model = model->HSM2nextModel ) { - for ( here = model->HSM2instances; here != NULL; + for ( ;model != NULL; model = HSM2nextModel(model) ) { + for ( here = HSM2instances(model); here != NULL; here = here->HSM2nextInstance ) { switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/hisim2/hsm2pzld.c b/src/spicelib/devices/hisim2/hsm2pzld.c index b40e9a3ec..2ce8dd7bb 100644 --- a/src/spicelib/devices/hisim2/hsm2pzld.c +++ b/src/spicelib/devices/hisim2/hsm2pzld.c @@ -44,8 +44,8 @@ int HSM2pzLoad( NG_IGNORE(ckt); - for ( ;model != NULL ;model = model->HSM2nextModel ) { - for ( here = model->HSM2instances ;here!= NULL ; + for ( ;model != NULL ;model = HSM2nextModel(model) ) { + for ( here = HSM2instances(model) ;here!= NULL ; here = here->HSM2nextInstance ) { if ( here->HSM2_mode >= 0 ) { gm = here->HSM2_gm; diff --git a/src/spicelib/devices/hisim2/hsm2set.c b/src/spicelib/devices/hisim2/hsm2set.c index d9f346241..24308cd42 100644 --- a/src/spicelib/devices/hisim2/hsm2set.c +++ b/src/spicelib/devices/hisim2/hsm2set.c @@ -120,7 +120,7 @@ int HSM2setup( #endif /* loop through all the HSM2 device models */ - for ( ;model != NULL ;model = model->HSM2nextModel ) { + for ( ;model != NULL ;model = HSM2nextModel(model) ) { /* Default value Processing for HSM2 MOSFET Models */ if ( !model->HSM2_type_Given ) model->HSM2_type = NMOS ; @@ -811,7 +811,7 @@ int HSM2setup( modelMKS = &model->modelMKS ; /* loop through all the instances of the model */ - for ( here = model->HSM2instances ;here != NULL ; + for ( here = HSM2instances(model) ;here != NULL ; here = here->HSM2nextInstance ) { /* allocate a chunk of the state vector */ here->HSM2states = *states; @@ -1267,10 +1267,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL /* loop through all the HSM2 device models to count the number of instances */ - for ( ; model != NULL; model = model->HSM2nextModel ) + for ( ; model != NULL; model = HSM2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->HSM2instances; here != NULL ; + for (here = HSM2instances(model); here != NULL ; here = here->HSM2nextInstance) { InstCount++; @@ -1279,10 +1279,10 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL InstArray = TMALLOC(HSM2instance*, InstCount); model = (HSM2model*)inModel; idx = 0; - for ( ; model != NULL; model = model->HSM2nextModel ) + for ( ; model != NULL; model = HSM2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->HSM2instances; here != NULL ; + for (here = HSM2instances(model); here != NULL ; here = here->HSM2nextInstance) { InstArray[idx] = here; @@ -1307,9 +1307,9 @@ HSM2unsetup( HSM2instance *here; for (model = (HSM2model *)inModel; model != NULL; - model = model->HSM2nextModel) + model = HSM2nextModel(model)) { - for (here = model->HSM2instances; here != NULL; + for (here = HSM2instances(model); here != NULL; here=here->HSM2nextInstance) { if (here->HSM2sbNode > 0 diff --git a/src/spicelib/devices/hisim2/hsm2soachk.c b/src/spicelib/devices/hisim2/hsm2soachk.c index a7652d810..9d77db581 100644 --- a/src/spicelib/devices/hisim2/hsm2soachk.c +++ b/src/spicelib/devices/hisim2/hsm2soachk.c @@ -33,9 +33,9 @@ HSM2soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->HSM2nextModel) { + for (; model; model = HSM2nextModel(model)) { - for (here = model->HSM2instances; here; here = here->HSM2nextInstance) { + for (here = HSM2instances(model); here; here = here->HSM2nextInstance) { vgs = ckt->CKTrhsOld [here->HSM2gNode] - ckt->CKTrhsOld [here->HSM2sNodePrime]; diff --git a/src/spicelib/devices/hisim2/hsm2temp.c b/src/spicelib/devices/hisim2/hsm2temp.c index 3728ffda9..e34e0a737 100644 --- a/src/spicelib/devices/hisim2/hsm2temp.c +++ b/src/spicelib/devices/hisim2/hsm2temp.c @@ -141,11 +141,11 @@ int HSM2temp( double T9, T9_dVb, Vgp, Vgs_min, Vfb, Vthp, Vth0; - for ( ;model ;model = model->HSM2nextModel ) { + for ( ;model ;model = HSM2nextModel(model) ) { modelMKS = &model->modelMKS ; - for ( here = model->HSM2instances; here; here = here->HSM2nextInstance ) { + for ( here = HSM2instances(model); here; here = here->HSM2nextInstance ) { pParam = &here->pParam ; hereMKS = &here->hereMKS ; diff --git a/src/spicelib/devices/hisim2/hsm2trunc.c b/src/spicelib/devices/hisim2/hsm2trunc.c index ea27086ac..7270a9648 100644 --- a/src/spicelib/devices/hisim2/hsm2trunc.c +++ b/src/spicelib/devices/hisim2/hsm2trunc.c @@ -71,8 +71,8 @@ int HSM2trunc( double debugtemp; #endif /* STEPDEBUG */ - for ( ;model != NULL ;model = model->HSM2nextModel ) { - for ( here=model->HSM2instances ;here!=NULL ; + for ( ;model != NULL ;model = HSM2nextModel(model) ) { + for ( here=HSM2instances(model) ;here!=NULL ; here = here->HSM2nextInstance ) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/hisimhv1/hsmhvacld.c b/src/spicelib/devices/hisimhv1/hsmhvacld.c index 9f2fcd180..0afa1f1ba 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvacld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvacld.c @@ -49,8 +49,8 @@ int HSMHVacLoad( omega = ckt->CKTomega; - for ( ; model != NULL; model = model->HSMHVnextModel ) { - for ( here = model->HSMHVinstances; here!= NULL; here = here->HSMHVnextInstance ) { + for ( ; model != NULL; model = HSMHVnextModel(model) ) { + for ( here = HSMHVinstances(model); here!= NULL; here = here->HSMHVnextInstance ) { flg_nqs = model->HSMHV_conqs ; flg_subNode = here->HSMHVsubNode ; /* if flg_subNode > 0, external(/internal) substrate node exists */ diff --git a/src/spicelib/devices/hisimhv1/hsmhvcvtest.c b/src/spicelib/devices/hisimhv1/hsmhvcvtest.c index 430d53b5b..af96cdc0a 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvcvtest.c +++ b/src/spicelib/devices/hisimhv1/hsmhvcvtest.c @@ -48,9 +48,9 @@ int HSMHVconvTest( /* loop through all the HSMHV device models */ - for ( ; model != NULL; model = model->HSMHVnextModel ) { + for ( ; model != NULL; model = HSMHVnextModel(model) ) { /* loop through all the instances of the model */ - for ( here = model->HSMHVinstances; here != NULL ; + for ( here = HSMHVinstances(model); here != NULL ; here = here->HSMHVnextInstance ) { vds = model->HSMHV_type * diff --git a/src/spicelib/devices/hisimhv1/hsmhvdef.h b/src/spicelib/devices/hisimhv1/hsmhvdef.h index 91db73d52..7e5cf1187 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvdef.h +++ b/src/spicelib/devices/hisimhv1/hsmhvdef.h @@ -911,14 +911,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/hisimhv1/hsmhvdest.c b/src/spicelib/devices/hisimhv1/hsmhvdest.c index 5e878018e..9466b275e 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvdest.c +++ b/src/spicelib/devices/hisimhv1/hsmhvdest.c @@ -26,8 +26,8 @@ HSMHVdestroy(GENmodel **inModel) HSMHVmodel *mod = *(HSMHVmodel**) inModel; while (mod) { - HSMHVmodel *next_mod = mod->HSMHVnextModel; - HSMHVinstance *inst = mod->HSMHVinstances; + HSMHVmodel *next_mod = HSMHVnextModel(mod); + HSMHVinstance *inst = HSMHVinstances(mod); while (inst) { HSMHVinstance *next_inst = inst->HSMHVnextInstance; FREE(inst); diff --git a/src/spicelib/devices/hisimhv1/hsmhvgetic.c b/src/spicelib/devices/hisimhv1/hsmhvgetic.c index 68b751e46..ae1374c0f 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvgetic.c +++ b/src/spicelib/devices/hisimhv1/hsmhvgetic.c @@ -32,8 +32,8 @@ int HSMHVgetic( * external nodes to get values */ - for ( ;model ;model = model->HSMHVnextModel ) { - for ( here = model->HSMHVinstances; here ;here = here->HSMHVnextInstance ) { + for ( ;model ;model = HSMHVnextModel(model) ) { + for ( here = HSMHVinstances(model); here ;here = here->HSMHVnextInstance ) { if (!here->HSMHV_icVBS_Given) { here->HSMHV_icVBS = *(ckt->CKTrhs + here->HSMHVbNode) - diff --git a/src/spicelib/devices/hisimhv1/hsmhvld.c b/src/spicelib/devices/hisimhv1/hsmhvld.c index 5aff325ef..91e9de916 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvld.c @@ -360,12 +360,12 @@ int HSMHVload( } /* loop through all the HSMHV device models */ - for ( ; model != NULL; model = model->HSMHVnextModel ) { + for ( ; model != NULL; model = HSMHVnextModel(model) ) { /* loop through all the instances of the model */ /* modelMKS = &model->modelMKS ;*/ - for (here = model->HSMHVinstances; here != NULL ; + for (here = HSMHVinstances(model); here != NULL ; here = here->HSMHVnextInstance) { /* hereMKS = &here->hereMKS ;*/ diff --git a/src/spicelib/devices/hisimhv1/hsmhvnoi.c b/src/spicelib/devices/hisimhv1/hsmhvnoi.c index 2c8e9f576..a7df4dd93 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvnoi.c +++ b/src/spicelib/devices/hisimhv1/hsmhvnoi.c @@ -64,8 +64,8 @@ int HSMHVnoise ( "" /* total transistor noise */ }; - for ( ;model != NULL; model = model->HSMHVnextModel ) { - for ( here = model->HSMHVinstances; here != NULL; + for ( ;model != NULL; model = HSMHVnextModel(model) ) { + for ( here = HSMHVinstances(model); here != NULL; here = here->HSMHVnextInstance ) { switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/hisimhv1/hsmhvpzld.c b/src/spicelib/devices/hisimhv1/hsmhvpzld.c index b657da4df..8f7ece4a7 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvpzld.c +++ b/src/spicelib/devices/hisimhv1/hsmhvpzld.c @@ -48,8 +48,8 @@ int HSMHVpzLoad( #define qbNode 12 - for ( ;model != NULL ;model = model->HSMHVnextModel ) { - for ( here = model->HSMHVinstances ;here!= NULL ; + for ( ;model != NULL ;model = HSMHVnextModel(model) ) { + for ( here = HSMHVinstances(model) ;here!= NULL ; here = here->HSMHVnextInstance ) { flg_nqs = model->HSMHV_conqs ; diff --git a/src/spicelib/devices/hisimhv1/hsmhvset.c b/src/spicelib/devices/hisimhv1/hsmhvset.c index 0dc67ae9b..3a6270838 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvset.c +++ b/src/spicelib/devices/hisimhv1/hsmhvset.c @@ -64,7 +64,7 @@ int HSMHVsetup( double Lbin=0.0, Wbin=0.0, LWbin =0.0; /* binning */ /* loop through all the HSMHV device models */ - for ( ;model != NULL ;model = model->HSMHVnextModel ) { + for ( ;model != NULL ;model = HSMHVnextModel(model) ) { /* Default value Processing for HVMOS Models */ if ( !model->HSMHV_type_Given ) model->HSMHV_type = NMOS ; @@ -779,7 +779,7 @@ int HSMHVsetup( modelMKS = &model->modelMKS ; /* loop through all the instances of the model */ - for ( here = model->HSMHVinstances ;here != NULL ; + for ( here = HSMHVinstances(model) ;here != NULL ; here = here->HSMHVnextInstance ) { /* allocate a chunk of the state vector */ here->HSMHVstates = *states; @@ -1470,9 +1470,9 @@ HSMHVunsetup( HSMHVinstance *here; for (model = (HSMHVmodel *)inModel; model != NULL; - model = model->HSMHVnextModel) + model = HSMHVnextModel(model)) { - for (here = model->HSMHVinstances; here != NULL; + for (here = HSMHVinstances(model); here != NULL; here=here->HSMHVnextInstance) { if (here->HSMHVqbNode > 0) diff --git a/src/spicelib/devices/hisimhv1/hsmhvsoachk.c b/src/spicelib/devices/hisimhv1/hsmhvsoachk.c index 5509d3aa8..ece18e8a7 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvsoachk.c +++ b/src/spicelib/devices/hisimhv1/hsmhvsoachk.c @@ -33,9 +33,9 @@ HSMHVsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->HSMHVnextModel) { + for (; model; model = HSMHVnextModel(model)) { - for (here = model->HSMHVinstances; here; here = here->HSMHVnextInstance) { + for (here = HSMHVinstances(model); here; here = here->HSMHVnextInstance) { vgs = ckt->CKTrhsOld [here->HSMHVgNode] - ckt->CKTrhsOld [here->HSMHVsNodePrime]; diff --git a/src/spicelib/devices/hisimhv1/hsmhvtemp.c b/src/spicelib/devices/hisimhv1/hsmhvtemp.c index 894e40863..db0baccc3 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvtemp.c +++ b/src/spicelib/devices/hisimhv1/hsmhvtemp.c @@ -81,7 +81,7 @@ int HSMHVtemp( const double dlt_rd23 = 1.0e-6 / C_m2cm ; const double large_arg = 80 ; - for ( ;model ;model = model->HSMHVnextModel ) { + for ( ;model ;model = HSMHVnextModel(model) ) { modelMKS = &model->modelMKS ; @@ -95,7 +95,7 @@ int HSMHVtemp( model->HSMHV_qme12 = model->HSMHV_qme1 / ( model->HSMHV_qme2 * model->HSMHV_qme2 ) ; } - for ( here = model->HSMHVinstances; here; here = here->HSMHVnextInstance ) { + for ( here = HSMHVinstances(model); here; here = here->HSMHVnextInstance ) { pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv1/hsmhvtrunc.c b/src/spicelib/devices/hisimhv1/hsmhvtrunc.c index cadfc00d3..439507ae0 100644 --- a/src/spicelib/devices/hisimhv1/hsmhvtrunc.c +++ b/src/spicelib/devices/hisimhv1/hsmhvtrunc.c @@ -33,8 +33,8 @@ int HSMHVtrunc( double debugtemp=0.0 ; #endif /* STEPDEBUG */ - for ( ;model != NULL ;model = model->HSMHVnextModel ) { - for ( here=model->HSMHVinstances ;here!=NULL ; + for ( ;model != NULL ;model = HSMHVnextModel(model) ) { + for ( here=HSMHVinstances(model) ;here!=NULL ; here = here->HSMHVnextInstance ) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2acld.c b/src/spicelib/devices/hisimhv2/hsmhv2acld.c index 06ff835aa..34aed48df 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2acld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2acld.c @@ -91,8 +91,8 @@ int HSMHV2acLoad( omega = ckt->CKTomega; - for ( ; model != NULL; model = model->HSMHV2nextModel ) { - for ( here = model->HSMHV2instances; here!= NULL; here = here->HSMHV2nextInstance ) { + for ( ; model != NULL; model = HSMHV2nextModel(model) ) { + for ( here = HSMHV2instances(model); here!= NULL; here = here->HSMHV2nextInstance ) { flg_nqs = model->HSMHV2_conqs ; flg_subNode = here->HSMHV2subNode ; /* if flg_subNode > 0, external(/internal) substrate node exists */ diff --git a/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c b/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c index 4832de7a8..35ad02949 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2cvtest.c @@ -90,9 +90,9 @@ int HSMHV2convTest( /* loop through all the HSMHV2 device models */ - for ( ; model != NULL; model = model->HSMHV2nextModel ) { + for ( ; model != NULL; model = HSMHV2nextModel(model) ) { /* loop through all the instances of the model */ - for ( here = model->HSMHV2instances; here != NULL ; + for ( here = HSMHV2instances(model); here != NULL ; here = here->HSMHV2nextInstance ) { vds = model->HSMHV2_type * diff --git a/src/spicelib/devices/hisimhv2/hsmhv2def.h b/src/spicelib/devices/hisimhv2/hsmhv2def.h index f13b4732c..cf0953281 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2def.h +++ b/src/spicelib/devices/hisimhv2/hsmhv2def.h @@ -1021,14 +1021,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/hisimhv2/hsmhv2dest.c b/src/spicelib/devices/hisimhv2/hsmhv2dest.c index 9a46c7db2..47aa5ad0c 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2dest.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2dest.c @@ -68,8 +68,8 @@ HSMHV2destroy(GENmodel **inModel) HSMHV2model *mod = *(HSMHV2model**) inModel; while (mod) { - HSMHV2model *next_mod = mod->HSMHV2nextModel; - HSMHV2instance *inst = mod->HSMHV2instances; + HSMHV2model *next_mod = HSMHV2nextModel(mod); + HSMHV2instance *inst = HSMHV2instances(mod); while (inst) { HSMHV2instance *next_inst = inst->HSMHV2nextInstance; FREE(inst); diff --git a/src/spicelib/devices/hisimhv2/hsmhv2getic.c b/src/spicelib/devices/hisimhv2/hsmhv2getic.c index 7c6adca28..4be8a7954 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2getic.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2getic.c @@ -74,8 +74,8 @@ int HSMHV2getic( * external nodes to get values */ - for ( ;model ;model = model->HSMHV2nextModel ) { - for ( here = model->HSMHV2instances; here ;here = here->HSMHV2nextInstance ) { + for ( ;model ;model = HSMHV2nextModel(model) ) { + for ( here = HSMHV2instances(model); here ;here = here->HSMHV2nextInstance ) { if (!here->HSMHV2_icVBS_Given) { here->HSMHV2_icVBS = *(ckt->CKTrhs + here->HSMHV2bNode) - diff --git a/src/spicelib/devices/hisimhv2/hsmhv2ld.c b/src/spicelib/devices/hisimhv2/hsmhv2ld.c index 13de99cbe..361309119 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2ld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2ld.c @@ -407,12 +407,12 @@ int HSMHV2load( } /* loop through all the HSMHV2 device models */ - for ( ; model != NULL; model = model->HSMHV2nextModel ) { + for ( ; model != NULL; model = HSMHV2nextModel(model) ) { /* loop through all the instances of the model */ modelMKS = &model->modelMKS ; - for (here = model->HSMHV2instances; here != NULL ; + for (here = HSMHV2instances(model); here != NULL ; here = here->HSMHV2nextInstance) { hereMKS = &here->hereMKS ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2noi.c b/src/spicelib/devices/hisimhv2/hsmhv2noi.c index 1c1736da4..fbe4842f9 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2noi.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2noi.c @@ -106,8 +106,8 @@ int HSMHV2noise ( "" /* total transistor noise */ }; - for ( ;model != NULL; model = model->HSMHV2nextModel ) { - for ( here = model->HSMHV2instances; here != NULL; + for ( ;model != NULL; model = HSMHV2nextModel(model) ) { + for ( here = HSMHV2instances(model); here != NULL; here = here->HSMHV2nextInstance ) { switch (operation) { case N_OPEN: diff --git a/src/spicelib/devices/hisimhv2/hsmhv2pzld.c b/src/spicelib/devices/hisimhv2/hsmhv2pzld.c index 8c8562fa4..0d50d1f83 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2pzld.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2pzld.c @@ -90,8 +90,8 @@ int HSMHV2pzLoad( #define qbNode 12 - for ( ;model != NULL ;model = model->HSMHV2nextModel ) { - for ( here = model->HSMHV2instances ;here!= NULL ; + for ( ;model != NULL ;model = HSMHV2nextModel(model) ) { + for ( here = HSMHV2instances(model) ;here!= NULL ; here = here->HSMHV2nextInstance ) { flg_nqs = model->HSMHV2_conqs ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2set.c b/src/spicelib/devices/hisimhv2/hsmhv2set.c index a434f0b5e..22ca27383 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2set.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2set.c @@ -124,7 +124,7 @@ int HSMHV2setup( /* loop through all the HSMHV2 device models */ - for ( ;model != NULL ;model = model->HSMHV2nextModel ) { + for ( ;model != NULL ;model = HSMHV2nextModel(model) ) { /* Default value Processing for HVMOS Models */ if ( !model->HSMHV2_type_Given ) model->HSMHV2_type = NMOS ; @@ -999,7 +999,7 @@ int HSMHV2setup( modelMKS = &model->modelMKS ; /* loop through all the instances of the model */ - for ( here = model->HSMHV2instances ;here != NULL ; + for ( here = HSMHV2instances(model) ;here != NULL ; here = here->HSMHV2nextInstance ) { /* allocate a chunk of the state vector */ here->HSMHV2states = *states; @@ -1739,9 +1739,9 @@ HSMHV2unsetup( HSMHV2instance *here; for (model = (HSMHV2model *)inModel; model != NULL; - model = model->HSMHV2nextModel) + model = HSMHV2nextModel(model)) { - for (here = model->HSMHV2instances; here != NULL; + for (here = HSMHV2instances(model); here != NULL; here=here->HSMHV2nextInstance) { if (here->HSMHV2tempNode > 0 && diff --git a/src/spicelib/devices/hisimhv2/hsmhv2soachk.c b/src/spicelib/devices/hisimhv2/hsmhv2soachk.c index de7f5d5d9..a3ad7ada3 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2soachk.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2soachk.c @@ -33,9 +33,9 @@ HSMHV2soaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->HSMHV2nextModel) { + for (; model; model = HSMHV2nextModel(model)) { - for (here = model->HSMHV2instances; here; here = here->HSMHV2nextInstance) { + for (here = HSMHV2instances(model); here; here = here->HSMHV2nextInstance) { vgs = ckt->CKTrhsOld [here->HSMHV2gNode] - ckt->CKTrhsOld [here->HSMHV2sNodePrime]; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2temp.c b/src/spicelib/devices/hisimhv2/hsmhv2temp.c index accd3d69c..d3daa57fd 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2temp.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2temp.c @@ -120,7 +120,7 @@ int HSMHV2temp( const double dlt_rd23 = 1.0e-6 / C_m2cm ; const double large_arg = 80 ; - for ( ;model ;model = model->HSMHV2nextModel ) { + for ( ;model ;model = HSMHV2nextModel(model) ) { modelMKS = &model->modelMKS ; @@ -134,7 +134,7 @@ int HSMHV2temp( model->HSMHV2_qme12 = model->HSMHV2_qme1 / ( model->HSMHV2_qme2 * model->HSMHV2_qme2 ) ; } - for ( here = model->HSMHV2instances; here; here = here->HSMHV2nextInstance ) { + for ( here = HSMHV2instances(model); here; here = here->HSMHV2nextInstance ) { pParam = &here->pParam ; diff --git a/src/spicelib/devices/hisimhv2/hsmhv2trunc.c b/src/spicelib/devices/hisimhv2/hsmhv2trunc.c index 55ebf8e0f..c6db3c1d8 100644 --- a/src/spicelib/devices/hisimhv2/hsmhv2trunc.c +++ b/src/spicelib/devices/hisimhv2/hsmhv2trunc.c @@ -74,8 +74,8 @@ int HSMHV2trunc( double debugtemp=0.0 ; #endif /* STEPDEBUG */ - for ( ;model != NULL ;model = model->HSMHV2nextModel ) { - for ( here=model->HSMHV2instances ;here!=NULL ; + for ( ;model != NULL ;model = HSMHV2nextModel(model) ) { + for ( here=HSMHV2instances(model) ;here!=NULL ; here = here->HSMHV2nextInstance ) { #ifdef STEPDEBUG debugtemp = *timeStep; diff --git a/src/spicelib/devices/ind/indacld.c b/src/spicelib/devices/ind/indacld.c index 7103dc9cd..573699e57 100644 --- a/src/spicelib/devices/ind/indacld.c +++ b/src/spicelib/devices/ind/indacld.c @@ -20,8 +20,8 @@ INDacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; INDinstance *here; - for( ; model != NULL; model = model->INDnextModel) { - for( here = model->INDinstances;here != NULL; + for( ; model != NULL; model = INDnextModel(model)) { + for( here = INDinstances(model);here != NULL; here = here->INDnextInstance) { m = (here->INDm); diff --git a/src/spicelib/devices/ind/inddefs.h b/src/spicelib/devices/ind/inddefs.h index c21c75466..2462fb616 100644 --- a/src/spicelib/devices/ind/inddefs.h +++ b/src/spicelib/devices/ind/inddefs.h @@ -84,14 +84,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ @@ -147,14 +145,13 @@ 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 */ + 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 -/* --- end of generic struct GENmodel --- */ }; diff --git a/src/spicelib/devices/ind/inddest.c b/src/spicelib/devices/ind/inddest.c index b1e286a43..b807531ae 100644 --- a/src/spicelib/devices/ind/inddest.c +++ b/src/spicelib/devices/ind/inddest.c @@ -14,8 +14,8 @@ INDdestroy(GENmodel **inModel) INDmodel *mod = *(INDmodel**) inModel; while (mod) { - INDmodel *next_mod = mod->INDnextModel; - INDinstance *inst = mod->INDinstances; + INDmodel *next_mod = INDnextModel(mod); + INDinstance *inst = INDinstances(mod); while (inst) { INDinstance *next_inst = inst->INDnextInstance; FREE(inst); diff --git a/src/spicelib/devices/ind/indload.c b/src/spicelib/devices/ind/indload.c index 63a47fa20..11d95d8ce 100644 --- a/src/spicelib/devices/ind/indload.c +++ b/src/spicelib/devices/ind/indload.c @@ -32,10 +32,10 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) #endif /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { m = (here->INDm); @@ -55,10 +55,10 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) ktype = CKTtypelook("mutual"); mutmodel = (MUTmodel *)(ckt->CKThead[ktype]); /* loop through all the mutual inductor models */ - for( ; mutmodel != NULL; mutmodel = mutmodel->MUTnextModel ) { + for( ; mutmodel != NULL; mutmodel = MUTnextModel(mutmodel) ) { /* loop through all the instances of the model */ - for (muthere = mutmodel->MUTinstances; muthere != NULL ; + for (muthere = MUTinstances(mutmodel); muthere != NULL ; muthere=muthere->MUTnextInstance) { if(!(ckt->CKTmode& (MODEDC|MODEINITPRED))) { @@ -78,10 +78,10 @@ INDload(GENmodel *inModel, CKTcircuit *ckt) itype = CKTtypelook("Inductor"); model = (INDmodel *)(ckt->CKThead[itype]); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #endif /*MUTUAL*/ diff --git a/src/spicelib/devices/ind/indpzld.c b/src/spicelib/devices/ind/indpzld.c index fe5fd9418..07fdbeadc 100644 --- a/src/spicelib/devices/ind/indpzld.c +++ b/src/spicelib/devices/ind/indpzld.c @@ -23,8 +23,8 @@ INDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for( ; model != NULL; model = model->INDnextModel) { - for( here = model->INDinstances;here != NULL; + for( ; model != NULL; model = INDnextModel(model)) { + for( here = INDinstances(model);here != NULL; here = here->INDnextInstance) { val = here->INDinduct / here->INDm; diff --git a/src/spicelib/devices/ind/indsacl.c b/src/spicelib/devices/ind/indsacl.c index 78fc36cc5..412fe3206 100644 --- a/src/spicelib/devices/ind/indsacl.c +++ b/src/spicelib/devices/ind/indsacl.c @@ -53,10 +53,10 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) info = ckt->CKTsenInfo; /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #ifdef MUTUAL @@ -65,10 +65,10 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) ktype = CKTtypelook("mutual"); mutmodel = (MUTmodel *)(ckt->CKThead[ktype]); /* loop through all the mutual inductor models */ - for( ; mutmodel != NULL; mutmodel = mutmodel->MUTnextModel ) { + for( ; mutmodel != NULL; mutmodel = MUTnextModel(mutmodel) ) { /* loop through all the instances of the model */ - for (muthere = mutmodel->MUTinstances; muthere != NULL ; + for (muthere = MUTinstances(mutmodel); muthere != NULL ; muthere=muthere->MUTnextInstance) { if(muthere->MUTsenParmNo || @@ -137,10 +137,10 @@ INDsAcLoad(GENmodel *inModel, CKTcircuit *ckt) itype = CKTtypelook("Inductor"); model = (INDmodel *)(ckt->CKThead[itype]); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #endif /* MUTUAL */ if(here->INDsenParmNo){ diff --git a/src/spicelib/devices/ind/indsetup.c b/src/spicelib/devices/ind/indsetup.c index 362064a96..a731ddf5b 100644 --- a/src/spicelib/devices/ind/indsetup.c +++ b/src/spicelib/devices/ind/indsetup.c @@ -22,7 +22,7 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* Default Value Processing for Model Parameters */ if (!model->INDmIndGiven) { @@ -72,7 +72,7 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { here->INDflux = *states; @@ -113,9 +113,9 @@ INDunsetup(GENmodel *inModel, CKTcircuit *ckt) INDinstance *here; for (model = (INDmodel *)inModel; model != NULL; - model = model->INDnextModel) + model = INDnextModel(model)) { - for (here = model->INDinstances; here != NULL; + for (here = INDinstances(model); here != NULL; here=here->INDnextInstance) { if (here->INDbrEq > 0) diff --git a/src/spicelib/devices/ind/indsload.c b/src/spicelib/devices/ind/indsload.c index 74f9f99cd..91b714a43 100644 --- a/src/spicelib/devices/ind/indsload.c +++ b/src/spicelib/devices/ind/indsload.c @@ -59,10 +59,10 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #ifdef MUTUAL @@ -71,10 +71,10 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) ktype = CKTtypelook("mutual"); mutmodel = (MUTmodel *)(ckt->CKThead[ktype]); /* loop through all the mutual inductor models */ - for( ; mutmodel != NULL; mutmodel = mutmodel->MUTnextModel ) { + for( ; mutmodel != NULL; mutmodel = MUTnextModel(mutmodel) ) { /* loop through all the instances of the model */ - for (muthere = mutmodel->MUTinstances; muthere != NULL ; + for (muthere = MUTinstances(mutmodel); muthere != NULL ; muthere=muthere->MUTnextInstance) { if(muthere->MUTsenParmNo || @@ -117,9 +117,9 @@ INDsLoad(GENmodel *inModel, CKTcircuit *ckt) itype = CKTtypelook("Inductor"); model = (INDmodel *)(ckt->CKThead[itype]); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #endif /* MUTUAL */ diff --git a/src/spicelib/devices/ind/indsprt.c b/src/spicelib/devices/ind/indsprt.c index 1d4fe5a84..d790f93a9 100644 --- a/src/spicelib/devices/ind/indsprt.c +++ b/src/spicelib/devices/ind/indsprt.c @@ -24,12 +24,12 @@ INDsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("INDUCTORS----------\n"); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { printf("Model name:%s\n",model->INDmodName); /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { printf(" Instance name:%s\n",here->INDname); diff --git a/src/spicelib/devices/ind/indsset.c b/src/spicelib/devices/ind/indsset.c index 7b2856da8..7a3bbb6c2 100644 --- a/src/spicelib/devices/ind/indsset.c +++ b/src/spicelib/devices/ind/indsset.c @@ -23,10 +23,10 @@ INDsSetup(SENstruct *info, GENmodel *inModel) INDinstance *here; /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { if(here->INDsenParmNo){ diff --git a/src/spicelib/devices/ind/indsupd.c b/src/spicelib/devices/ind/indsupd.c index 8ebddb552..76044b23f 100644 --- a/src/spicelib/devices/ind/indsupd.c +++ b/src/spicelib/devices/ind/indsupd.c @@ -43,10 +43,10 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) if(ckt->CKTmode & MODEINITTRAN) return(OK); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { for(iparmno = 1;iparmno<=info->SENparms;iparmno++){ @@ -73,10 +73,10 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) ktype = CKTtypelook("mutual"); mutmodel = (MUTmodel *)(ckt->CKThead[ktype]); /* loop through all the mutual inductor models */ - for( ; mutmodel != NULL; mutmodel = mutmodel->MUTnextModel ) { + for( ; mutmodel != NULL; mutmodel = MUTnextModel(mutmodel) ) { /* loop through all the instances of the model */ - for (muthere = mutmodel->MUTinstances; muthere != NULL ; + for (muthere = MUTinstances(mutmodel); muthere != NULL ; muthere=muthere->MUTnextInstance) { @@ -123,10 +123,10 @@ INDsUpdate(GENmodel *inModel, CKTcircuit *ckt) itype = CKTtypelook("Inductor"); model = (INDmodel *)(ckt->CKThead[itype]); /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { #endif /* MUTUAL */ for(iparmno = 1;iparmno<=info->SENparms;iparmno++){ diff --git a/src/spicelib/devices/ind/indtemp.c b/src/spicelib/devices/ind/indtemp.c index f08e8930b..b51c43061 100644 --- a/src/spicelib/devices/ind/indtemp.c +++ b/src/spicelib/devices/ind/indtemp.c @@ -24,10 +24,10 @@ INDtemp(GENmodel *inModel, CKTcircuit *ckt) double tc1, tc2; /* loop through all the inductor models */ - for( ; model != NULL; model = model->INDnextModel ) { + for( ; model != NULL; model = INDnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->INDinstances; here != NULL ; + for (here = INDinstances(model); here != NULL ; here=here->INDnextInstance) { /* Default Value Processing for Inductor Instance */ diff --git a/src/spicelib/devices/ind/indtrunc.c b/src/spicelib/devices/ind/indtrunc.c index 7d42cd895..ab67ba3ae 100644 --- a/src/spicelib/devices/ind/indtrunc.c +++ b/src/spicelib/devices/ind/indtrunc.c @@ -17,8 +17,8 @@ INDtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) { INDmodel *model = (INDmodel*)inModel; INDinstance *here; - for( ; model!= NULL; model = model->INDnextModel) { - for(here = model->INDinstances ; here != NULL ; + for( ; model!= NULL; model = INDnextModel(model)) { + for(here = INDinstances(model) ; here != NULL ; here = here->INDnextInstance) { CKTterr(here->INDflux,ckt,timeStep); diff --git a/src/spicelib/devices/ind/mutacld.c b/src/spicelib/devices/ind/mutacld.c index f5df904a2..20d9a4dba 100644 --- a/src/spicelib/devices/ind/mutacld.c +++ b/src/spicelib/devices/ind/mutacld.c @@ -20,8 +20,8 @@ MUTacLoad(GENmodel *inModel, CKTcircuit *ckt) double val; MUTinstance *here; - for( ; model != NULL; model = model->MUTnextModel) { - for( here = model->MUTinstances;here != NULL; + for( ; model != NULL; model = MUTnextModel(model)) { + for( here = MUTinstances(model);here != NULL; here = here->MUTnextInstance) { val = ckt->CKTomega * here->MUTfactor; diff --git a/src/spicelib/devices/ind/mutdest.c b/src/spicelib/devices/ind/mutdest.c index 9c556e6bc..eff50a817 100644 --- a/src/spicelib/devices/ind/mutdest.c +++ b/src/spicelib/devices/ind/mutdest.c @@ -16,8 +16,8 @@ MUTdestroy(GENmodel **inModel) MUTmodel *mod = *(MUTmodel**) inModel; while (mod) { - MUTmodel *next_mod = mod->MUTnextModel; - MUTinstance *inst = mod->MUTinstances; + MUTmodel *next_mod = MUTnextModel(mod); + MUTinstance *inst = MUTinstances(mod); while (inst) { MUTinstance *next_inst = inst->MUTnextInstance; FREE(inst); diff --git a/src/spicelib/devices/ind/mutpzld.c b/src/spicelib/devices/ind/mutpzld.c index 142f02415..84cba21a2 100644 --- a/src/spicelib/devices/ind/mutpzld.c +++ b/src/spicelib/devices/ind/mutpzld.c @@ -24,8 +24,8 @@ MUTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for( ; model != NULL; model = model->MUTnextModel) { - for( here = model->MUTinstances;here != NULL; + for( ; model != NULL; model = MUTnextModel(model)) { + for( here = MUTinstances(model);here != NULL; here = here->MUTnextInstance) { val = here->MUTfactor; diff --git a/src/spicelib/devices/ind/mutsetup.c b/src/spicelib/devices/ind/mutsetup.c index 083ff5a8f..539857e59 100644 --- a/src/spicelib/devices/ind/mutsetup.c +++ b/src/spicelib/devices/ind/mutsetup.c @@ -34,8 +34,8 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); - for (; model; model = model->MUTnextModel) - for (here = model->MUTinstances; here; here = here->MUTnextInstance) { + for (; model; model = MUTnextModel(model)) + for (here = MUTinstances(model); here; here = here->MUTnextInstance) { int ktype = CKTtypelook("Inductor"); diff --git a/src/spicelib/devices/ind/mutsprt.c b/src/spicelib/devices/ind/mutsprt.c index 629f91db7..e543e6dd9 100644 --- a/src/spicelib/devices/ind/mutsprt.c +++ b/src/spicelib/devices/ind/mutsprt.c @@ -29,12 +29,12 @@ MUTsPrint(GENmodel *inModel, CKTcircuit* ckt) printf("MUTUAL INDUCTORS-----------------\n"); /* loop through all the inductor models */ - for( ; model != NULL; model = model->MUTnextModel ) { + for( ; model != NULL; model = MUTnextModel(model) ) { printf("Model name:%s\n",model->MUTmodName); /* loop through all the instances of the model */ - for (here = model->MUTinstances; here != NULL ; + for (here = MUTinstances(model); here != NULL ; here=here->MUTnextInstance) { printf(" Instance name:%s\n",here->MUTname); diff --git a/src/spicelib/devices/ind/mutsset.c b/src/spicelib/devices/ind/mutsset.c index d65cfaa2d..b2df06ba7 100644 --- a/src/spicelib/devices/ind/mutsset.c +++ b/src/spicelib/devices/ind/mutsset.c @@ -26,10 +26,10 @@ MUTsSetup(SENstruct *info, GENmodel *inModel) MUTinstance *here; /* loop through all the inductor models */ - for( ; model != NULL; model = model->MUTnextModel ) { + for( ; model != NULL; model = MUTnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MUTinstances; here != NULL ; + for (here = MUTinstances(model); here != NULL ; here=here->MUTnextInstance) { if(here->MUTsenParmNo){ diff --git a/src/spicelib/devices/ind/muttemp.c b/src/spicelib/devices/ind/muttemp.c index 2dc41d2c7..3de593774 100644 --- a/src/spicelib/devices/ind/muttemp.c +++ b/src/spicelib/devices/ind/muttemp.c @@ -42,8 +42,8 @@ MUTtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); - for (; model; model = model->MUTnextModel) - for (here = model->MUTinstances; here; here = here->MUTnextInstance) { + for (; model; model = MUTnextModel(model)) + for (here = MUTinstances(model); here; here = here->MUTnextInstance) { /* Value Processing for mutual inductors */ diff --git a/src/spicelib/devices/isrc/isrcacct.c b/src/spicelib/devices/isrc/isrcacct.c index c56617569..c5127a061 100644 --- a/src/spicelib/devices/isrc/isrcacct.c +++ b/src/spicelib/devices/isrc/isrcacct.c @@ -30,10 +30,10 @@ ISRCaccept(CKTcircuit *ckt, GENmodel *inModel) int error; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->ISRCnextModel ) { + for( ; model != NULL; model = ISRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->ISRCinstances; here != NULL ; + for (here = ISRCinstances(model); here != NULL ; here=here->ISRCnextInstance) { if(!(ckt->CKTmode & (MODETRAN | MODETRANOP))) { diff --git a/src/spicelib/devices/isrc/isrcacld.c b/src/spicelib/devices/isrc/isrcacld.c index 48fa57402..acf01889d 100644 --- a/src/spicelib/devices/isrc/isrcacld.c +++ b/src/spicelib/devices/isrc/isrcacld.c @@ -17,10 +17,10 @@ ISRCacLoad(GENmodel *inModel, CKTcircuit *ckt) ISRCinstance *here; double m; - for( ; model != NULL; model = model->ISRCnextModel ) { + for( ; model != NULL; model = ISRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->ISRCinstances; here != NULL ; + for (here = ISRCinstances(model); here != NULL ; here=here->ISRCnextInstance) { double acReal, acImag; diff --git a/src/spicelib/devices/isrc/isrcdefs.h b/src/spicelib/devices/isrc/isrcdefs.h index 1519168da..839f9ed74 100644 --- a/src/spicelib/devices/isrc/isrcdefs.h +++ b/src/spicelib/devices/isrc/isrcdefs.h @@ -72,14 +72,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/isrc/isrcdest.c b/src/spicelib/devices/isrc/isrcdest.c index ca9cb3058..d874b7dc3 100644 --- a/src/spicelib/devices/isrc/isrcdest.c +++ b/src/spicelib/devices/isrc/isrcdest.c @@ -14,8 +14,8 @@ ISRCdestroy(GENmodel **inModel) ISRCmodel *mod = *(ISRCmodel**) inModel; while (mod) { - ISRCmodel *next_mod = mod->ISRCnextModel; - ISRCinstance *inst = mod->ISRCinstances; + ISRCmodel *next_mod = ISRCnextModel(mod); + ISRCinstance *inst = ISRCinstances(mod); while (inst) { ISRCinstance *next_inst = inst->ISRCnextInstance; FREE(inst->ISRCcoeffs); diff --git a/src/spicelib/devices/isrc/isrcload.c b/src/spicelib/devices/isrc/isrcload.c index f82f628d0..bcdbe0782 100644 --- a/src/spicelib/devices/isrc/isrcload.c +++ b/src/spicelib/devices/isrc/isrcload.c @@ -35,10 +35,10 @@ ISRCload(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the source models */ - for( ; model != NULL; model = model->ISRCnextModel ) { + for( ; model != NULL; model = ISRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->ISRCinstances; here != NULL ; + for (here = ISRCinstances(model); here != NULL ; here=here->ISRCnextInstance) { m = here->ISRCmValue; diff --git a/src/spicelib/devices/isrc/isrctemp.c b/src/spicelib/devices/isrc/isrctemp.c index 54aa10209..67e70f736 100644 --- a/src/spicelib/devices/isrc/isrctemp.c +++ b/src/spicelib/devices/isrc/isrctemp.c @@ -23,10 +23,10 @@ ISRCtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->ISRCnextModel ) { + for( ; model != NULL; model = ISRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->ISRCinstances; here != NULL ; + for (here = ISRCinstances(model); here != NULL ; here=here->ISRCnextInstance) { if(here->ISRCacGiven && !here->ISRCacMGiven) { diff --git a/src/spicelib/devices/jfet/jfetacld.c b/src/spicelib/devices/jfet/jfetacld.c index 390757f44..0f6c2a635 100644 --- a/src/spicelib/devices/jfet/jfetacld.c +++ b/src/spicelib/devices/jfet/jfetacld.c @@ -28,9 +28,9 @@ JFETacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { - for( here = model->JFETinstances; here != NULL; + for( here = JFETinstances(model); here != NULL; here = here->JFETnextInstance) { gdpr=model->JFETdrainConduct * here->JFETarea; diff --git a/src/spicelib/devices/jfet/jfetdefs.h b/src/spicelib/devices/jfet/jfetdefs.h index 9ec278104..41e4b6b48 100644 --- a/src/spicelib/devices/jfet/jfetdefs.h +++ b/src/spicelib/devices/jfet/jfetdefs.h @@ -168,14 +168,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/jfet/jfetdest.c b/src/spicelib/devices/jfet/jfetdest.c index 558dc1683..1614e3f34 100644 --- a/src/spicelib/devices/jfet/jfetdest.c +++ b/src/spicelib/devices/jfet/jfetdest.c @@ -14,8 +14,8 @@ JFETdestroy(GENmodel **inModel) JFETmodel *mod = *(JFETmodel**) inModel; while (mod) { - JFETmodel *next_mod = mod->JFETnextModel; - JFETinstance *inst = mod->JFETinstances; + JFETmodel *next_mod = JFETnextModel(mod); + JFETinstance *inst = JFETinstances(mod); while (inst) { JFETinstance *next_inst = inst->JFETnextInstance; FREE(inst); diff --git a/src/spicelib/devices/jfet/jfetdist.c b/src/spicelib/devices/jfet/jfetdist.c index b9517a38b..c7d243db3 100644 --- a/src/spicelib/devices/jfet/jfetdist.c +++ b/src/spicelib/devices/jfet/jfetdist.c @@ -40,10 +40,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the JFET models */ -for( ; model != NULL; model = model->JFETnextModel ) { +for( ; model != NULL; model = JFETnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->JFETinstances; here != NULL ; + for (here = JFETinstances(model); here != NULL ; here=here->JFETnextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/jfet/jfetdset.c b/src/spicelib/devices/jfet/jfetdset.c index 6189e7ef3..1e4397ad7 100644 --- a/src/spicelib/devices/jfet/jfetdset.c +++ b/src/spicelib/devices/jfet/jfetdset.c @@ -67,10 +67,10 @@ JFETdSetup(GENmodel *inModel, CKTcircuit *ckt) double vgst; /* loop through all the models */ - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->JFETinstances; here != NULL ; + for (here = JFETinstances(model); here != NULL ; here=here->JFETnextInstance) { /* diff --git a/src/spicelib/devices/jfet/jfetic.c b/src/spicelib/devices/jfet/jfetic.c index 30bc558fd..fd91b458b 100644 --- a/src/spicelib/devices/jfet/jfetic.c +++ b/src/spicelib/devices/jfet/jfetic.c @@ -22,8 +22,8 @@ JFETgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->JFETnextModel) { - for(here = model->JFETinstances; here ; here = here->JFETnextInstance) { + for( ; model ; model = JFETnextModel(model)) { + for(here = JFETinstances(model); here ; here = here->JFETnextInstance) { if(!here->JFETicVDSGiven) { here->JFETicVDS = diff --git a/src/spicelib/devices/jfet/jfetload.c b/src/spicelib/devices/jfet/jfetload.c index 2cf68c326..e30485261 100644 --- a/src/spicelib/devices/jfet/jfetload.c +++ b/src/spicelib/devices/jfet/jfetload.c @@ -80,10 +80,10 @@ JFETload(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the models */ - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->JFETinstances; here != NULL ; + for (here = JFETinstances(model); here != NULL ; here=here->JFETnextInstance) { /* diff --git a/src/spicelib/devices/jfet/jfetnoi.c b/src/spicelib/devices/jfet/jfetnoi.c index 1c35cefdd..1acd21c00 100644 --- a/src/spicelib/devices/jfet/jfetnoi.c +++ b/src/spicelib/devices/jfet/jfetnoi.c @@ -46,8 +46,8 @@ JFETnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata * "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->JFETnextModel) { - for (inst=model->JFETinstances; inst != NULL; inst=inst->JFETnextInstance) { + for (model=firstModel; model != NULL; model=JFETnextModel(model)) { + for (inst=JFETinstances(model); inst != NULL; inst=inst->JFETnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/jfet/jfetpzld.c b/src/spicelib/devices/jfet/jfetpzld.c index 6c9b79fa4..4b523e006 100644 --- a/src/spicelib/devices/jfet/jfetpzld.c +++ b/src/spicelib/devices/jfet/jfetpzld.c @@ -29,9 +29,9 @@ JFETpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { - for( here = model->JFETinstances; here != NULL; + for( here = JFETinstances(model); here != NULL; here = here->JFETnextInstance) { m = here->JFETm; diff --git a/src/spicelib/devices/jfet/jfetset.c b/src/spicelib/devices/jfet/jfetset.c index 1ee580749..272822b24 100644 --- a/src/spicelib/devices/jfet/jfetset.c +++ b/src/spicelib/devices/jfet/jfetset.c @@ -27,7 +27,7 @@ JFETsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the diode models */ - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { if( (model->JFETtype != NJF) && (model->JFETtype != PJF) ) { model->JFETtype = NJF; @@ -100,7 +100,7 @@ JFETsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->JFETinstances; here != NULL ; + for (here = JFETinstances(model); here != NULL ; here=here->JFETnextInstance) { if(!here->JFETareaGiven) { @@ -190,9 +190,9 @@ JFETunsetup(GENmodel *inModel, CKTcircuit *ckt) JFETinstance *here; for (model = (JFETmodel *)inModel; model != NULL; - model = model->JFETnextModel) + model = JFETnextModel(model)) { - for (here = model->JFETinstances; here != NULL; + for (here = JFETinstances(model); here != NULL; here=here->JFETnextInstance) { if (here->JFETdrainPrimeNode > 0 diff --git a/src/spicelib/devices/jfet/jfettemp.c b/src/spicelib/devices/jfet/jfettemp.c index f5fd2daf4..d0c7cc99e 100644 --- a/src/spicelib/devices/jfet/jfettemp.c +++ b/src/spicelib/devices/jfet/jfettemp.c @@ -35,7 +35,7 @@ JFETtemp(GENmodel *inModel, CKTcircuit *ckt) double cjfact,cjfact1; /* loop through all the diode models */ - for( ; model != NULL; model = model->JFETnextModel ) { + for( ; model != NULL; model = JFETnextModel(model) ) { if(!(model->JFETtnomGiven)) { model->JFETtnom = ckt->CKTnomTemp; @@ -77,7 +77,7 @@ JFETtemp(GENmodel *inModel, CKTcircuit *ckt) /* end Sydney University mod */ /* loop through all the instances of the model */ - for (here = model->JFETinstances; here != NULL ; + for (here = JFETinstances(model); here != NULL ; here=here->JFETnextInstance) { if(!(here->JFETdtempGiven)) { diff --git a/src/spicelib/devices/jfet/jfettrun.c b/src/spicelib/devices/jfet/jfettrun.c index e3259803e..e089705ed 100644 --- a/src/spicelib/devices/jfet/jfettrun.c +++ b/src/spicelib/devices/jfet/jfettrun.c @@ -18,8 +18,8 @@ JFETtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) JFETmodel *model = (JFETmodel*)inModel; JFETinstance *here; - for( ; model != NULL; model = model->JFETnextModel) { - for(here=model->JFETinstances;here!=NULL;here = here->JFETnextInstance){ + for( ; model != NULL; model = JFETnextModel(model)) { + for(here=JFETinstances(model);here!=NULL;here = here->JFETnextInstance){ CKTterr(here->JFETqgs,ckt,timeStep); CKTterr(here->JFETqgd,ckt,timeStep); diff --git a/src/spicelib/devices/jfet2/jfet2acld.c b/src/spicelib/devices/jfet2/jfet2acld.c index 0cb7bea2a..116961212 100644 --- a/src/spicelib/devices/jfet2/jfet2acld.c +++ b/src/spicelib/devices/jfet2/jfet2acld.c @@ -32,9 +32,9 @@ JFET2acLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->JFET2nextModel ) { + for( ; model != NULL; model = JFET2nextModel(model) ) { - for( here = model->JFET2instances; here != NULL; + for( here = JFET2instances(model); here != NULL; here = here->JFET2nextInstance) { gdpr=model->JFET2drainConduct * here->JFET2area; diff --git a/src/spicelib/devices/jfet2/jfet2defs.h b/src/spicelib/devices/jfet2/jfet2defs.h index 86f1dd798..7585639bf 100644 --- a/src/spicelib/devices/jfet2/jfet2defs.h +++ b/src/spicelib/devices/jfet2/jfet2defs.h @@ -180,14 +180,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/jfet2/jfet2dest.c b/src/spicelib/devices/jfet2/jfet2dest.c index 6d11d52d1..5b1c03d1a 100644 --- a/src/spicelib/devices/jfet2/jfet2dest.c +++ b/src/spicelib/devices/jfet2/jfet2dest.c @@ -18,8 +18,8 @@ JFET2destroy(GENmodel **inModel) JFET2model *mod = *(JFET2model**) inModel; while (mod) { - JFET2model *next_mod = mod->JFET2nextModel; - JFET2instance *inst = mod->JFET2instances; + JFET2model *next_mod = JFET2nextModel(mod); + JFET2instance *inst = JFET2instances(mod); while (inst) { JFET2instance *next_inst = inst->JFET2nextInstance; FREE(inst); diff --git a/src/spicelib/devices/jfet2/jfet2ic.c b/src/spicelib/devices/jfet2/jfet2ic.c index 35bd77418..b5a9eca80 100644 --- a/src/spicelib/devices/jfet2/jfet2ic.c +++ b/src/spicelib/devices/jfet2/jfet2ic.c @@ -26,8 +26,8 @@ JFET2getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->JFET2nextModel) { - for(here = model->JFET2instances; here ; here = here->JFET2nextInstance) { + for( ; model ; model = JFET2nextModel(model)) { + for(here = JFET2instances(model); here ; here = here->JFET2nextInstance) { if(!here->JFET2icVDSGiven) { here->JFET2icVDS = *(ckt->CKTrhs + here->JFET2drainNode) - diff --git a/src/spicelib/devices/jfet2/jfet2load.c b/src/spicelib/devices/jfet2/jfet2load.c index 4f5d0b08a..7e5951bbb 100644 --- a/src/spicelib/devices/jfet2/jfet2load.c +++ b/src/spicelib/devices/jfet2/jfet2load.c @@ -60,10 +60,10 @@ JFET2load(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the models */ - for( ; model != NULL; model = model->JFET2nextModel ) { + for( ; model != NULL; model = JFET2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->JFET2instances; here != NULL ; + for (here = JFET2instances(model); here != NULL ; here=here->JFET2nextInstance) { /* * dc model parameters diff --git a/src/spicelib/devices/jfet2/jfet2noi.c b/src/spicelib/devices/jfet2/jfet2noi.c index f3ff8b14a..60c964860 100644 --- a/src/spicelib/devices/jfet2/jfet2noi.c +++ b/src/spicelib/devices/jfet2/jfet2noi.c @@ -50,8 +50,8 @@ JFET2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->JFET2nextModel) { - for (inst=model->JFET2instances; inst != NULL; inst=inst->JFET2nextInstance) { + for (model=firstModel; model != NULL; model=JFET2nextModel(model)) { + for (inst=JFET2instances(model); inst != NULL; inst=inst->JFET2nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/jfet2/jfet2set.c b/src/spicelib/devices/jfet2/jfet2set.c index 9ba95678c..9b4574636 100644 --- a/src/spicelib/devices/jfet2/jfet2set.c +++ b/src/spicelib/devices/jfet2/jfet2set.c @@ -28,7 +28,7 @@ JFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the diode models */ - for( ; model != NULL; model = model->JFET2nextModel ) { + for( ; model != NULL; model = JFET2nextModel(model) ) { if( (model->JFET2type != NJF) && (model->JFET2type != PJF) ) { model->JFET2type = NJF; @@ -38,7 +38,7 @@ JFET2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) #include "jfet2parm.h" /* loop through all the instances of the model */ - for (here = model->JFET2instances; here != NULL ; + for (here = JFET2instances(model); here != NULL ; here=here->JFET2nextInstance) { if(!here->JFET2areaGiven) { @@ -130,9 +130,9 @@ JFET2unsetup(GENmodel *inModel, CKTcircuit *ckt) JFET2instance *here; for (model = (JFET2model *)inModel; model != NULL; - model = model->JFET2nextModel) + model = JFET2nextModel(model)) { - for (here = model->JFET2instances; here != NULL; + for (here = JFET2instances(model); here != NULL; here=here->JFET2nextInstance) { if (here->JFET2drainPrimeNode > 0 diff --git a/src/spicelib/devices/jfet2/jfet2temp.c b/src/spicelib/devices/jfet2/jfet2temp.c index 9ba4dc46f..cfbfc0faa 100644 --- a/src/spicelib/devices/jfet2/jfet2temp.c +++ b/src/spicelib/devices/jfet2/jfet2temp.c @@ -40,7 +40,7 @@ JFET2temp(GENmodel *inModel, CKTcircuit *ckt) double cjfact,cjfact1; /* loop through all the diode models */ - for( ; model != NULL; model = model->JFET2nextModel ) { + for( ; model != NULL; model = JFET2nextModel(model) ) { if(!(model->JFET2tnomGiven)) { model->JFET2tnom = ckt->CKTnomTemp; @@ -78,7 +78,7 @@ JFET2temp(GENmodel *inModel, CKTcircuit *ckt) model->JFET2f3 = 1 - model->JFET2fc * (1 + .5); /* loop through all the instances of the model */ - for (here = model->JFET2instances; here != NULL ; + for (here = JFET2instances(model); here != NULL ; here=here->JFET2nextInstance) { if(!(here->JFET2dtempGiven)) { diff --git a/src/spicelib/devices/jfet2/jfet2trun.c b/src/spicelib/devices/jfet2/jfet2trun.c index 19f9c7813..8e5288a9b 100644 --- a/src/spicelib/devices/jfet2/jfet2trun.c +++ b/src/spicelib/devices/jfet2/jfet2trun.c @@ -22,8 +22,8 @@ JFET2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) JFET2model *model = (JFET2model*)inModel; JFET2instance *here; - for( ; model != NULL; model = model->JFET2nextModel) { - for(here=model->JFET2instances;here!=NULL;here = here->JFET2nextInstance){ + for( ; model != NULL; model = JFET2nextModel(model)) { + for(here=JFET2instances(model);here!=NULL;here = here->JFET2nextInstance){ CKTterr(here->JFET2qgs,ckt,timeStep); CKTterr(here->JFET2qgd,ckt,timeStep); diff --git a/src/spicelib/devices/ltra/ltraacct.c b/src/spicelib/devices/ltra/ltraacct.c index e2b30b49c..a5404aeb6 100644 --- a/src/spicelib/devices/ltra/ltraacct.c +++ b/src/spicelib/devices/ltra/ltraacct.c @@ -22,7 +22,7 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { if (ckt->CKTmode & MODEINITTRAN) { @@ -46,7 +46,7 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel) model->LTRAh3dashCoeffs = TREALLOC(double, model->LTRAh3dashCoeffs, model->LTRAmodelListSize); } /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { if (ckt->CKTmode & MODEINITTRAN) { @@ -269,8 +269,8 @@ LTRAaccept(CKTcircuit *ckt, GENmodel *inModel) */ model = (LTRAmodel *) inModel; - for (; model != NULL; model = model->LTRAnextModel) { - for (here = model->LTRAinstances; here != NULL; + for (; model != NULL; model = LTRAnextModel(model)) { + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { *(here->LTRAv1 + ckt->CKTtimeIndex - 1) = *(here->LTRAv1 + ckt->CKTtimeIndex); diff --git a/src/spicelib/devices/ltra/ltraacld.c b/src/spicelib/devices/ltra/ltraacld.c index a1625f64f..39ecca245 100644 --- a/src/spicelib/devices/ltra/ltraacld.c +++ b/src/spicelib/devices/ltra/ltraacld.c @@ -44,7 +44,7 @@ LTRAacLoad(GENmodel *inModel, CKTcircuit *ckt) */ /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { switch (model->LTRAspecialCase) { @@ -103,7 +103,7 @@ LTRAacLoad(GENmodel *inModel, CKTcircuit *ckt) y0exp_i = y0_r * explambda_i + y0_i * explambda_r; /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { *(here->LTRAibr1Pos1Ptr + 0) += y0_r; diff --git a/src/spicelib/devices/ltra/ltradefs.h b/src/spicelib/devices/ltra/ltradefs.h index 33e9eb43d..14fb38793 100644 --- a/src/spicelib/devices/ltra/ltradefs.h +++ b/src/spicelib/devices/ltra/ltradefs.h @@ -73,14 +73,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/ltra/ltradest.c b/src/spicelib/devices/ltra/ltradest.c index 71ff8fa43..336336c29 100644 --- a/src/spicelib/devices/ltra/ltradest.c +++ b/src/spicelib/devices/ltra/ltradest.c @@ -14,8 +14,8 @@ LTRAdestroy(GENmodel **inModel) LTRAmodel *mod = *(LTRAmodel **) inModel; while (mod) { - LTRAmodel *next_mod = mod->LTRAnextModel; - LTRAinstance *inst = mod->LTRAinstances; + LTRAmodel *next_mod = LTRAnextModel(mod); + LTRAinstance *inst = LTRAinstances(mod); while (inst) { LTRAinstance *next_inst = inst->LTRAnextInstance; FREE(inst); diff --git a/src/spicelib/devices/ltra/ltraload.c b/src/spicelib/devices/ltra/ltraload.c index ec65e6ab8..65935162e 100644 --- a/src/spicelib/devices/ltra/ltraload.c +++ b/src/spicelib/devices/ltra/ltraload.c @@ -30,7 +30,7 @@ LTRAload(GENmodel *inModel, CKTcircuit *ckt) double max = 0.0, min = 0.0; /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { if (ckt->CKTmode & MODEDC) { switch (model->LTRAspecialCase) { @@ -219,7 +219,7 @@ LTRAload(GENmodel *inModel, CKTcircuit *ckt) } } /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { if ((ckt->CKTmode & MODEDC) || diff --git a/src/spicelib/devices/ltra/ltraset.c b/src/spicelib/devices/ltra/ltraset.c index 30f21b3a1..6b5ec0c6b 100644 --- a/src/spicelib/devices/ltra/ltraset.c +++ b/src/spicelib/devices/ltra/ltraset.c @@ -25,7 +25,7 @@ LTRAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) NG_IGNORE(state); /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { if (!model->LTRAnlGiven) { model->LTRAnl = .25; @@ -169,7 +169,7 @@ LTRAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) return (E_BADPARM); } /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { if (here->LTRAbrEq1 == 0) { @@ -226,8 +226,8 @@ LTRAunsetup(GENmodel *inModel, CKTcircuit *ckt) LTRAinstance *here; for (model = (LTRAmodel *) inModel; model != NULL; - model = model->LTRAnextModel) { - for (here = model->LTRAinstances; here != NULL; + model = LTRAnextModel(model)) { + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { if (here->LTRAbrEq2 > 0) CKTdltNNum(ckt, here->LTRAbrEq2); diff --git a/src/spicelib/devices/ltra/ltratemp.c b/src/spicelib/devices/ltra/ltratemp.c index eda23f03a..9ea9c0ac1 100644 --- a/src/spicelib/devices/ltra/ltratemp.c +++ b/src/spicelib/devices/ltra/ltratemp.c @@ -23,7 +23,7 @@ LTRAtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { /* * if(!model->LTRAtdGiven) { model->LTRAtd = model->LTRAnl/model->LTRAf; * } @@ -147,7 +147,7 @@ LTRAtemp(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { here->LTRAv1 = NULL; diff --git a/src/spicelib/devices/ltra/ltratrun.c b/src/spicelib/devices/ltra/ltratrun.c index 2b3a81db6..b3cb44d7a 100644 --- a/src/spicelib/devices/ltra/ltratrun.c +++ b/src/spicelib/devices/ltra/ltratrun.c @@ -24,9 +24,9 @@ LTRAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double x, y, change, deriv, deriv_delta; /* loop through all the transmission line models */ - for (; model != NULL; model = model->LTRAnextModel) { + for (; model != NULL; model = LTRAnextModel(model)) { /* loop through all the instances of the model */ - for (here = model->LTRAinstances; here != NULL; + for (here = LTRAinstances(model); here != NULL; here = here->LTRAnextInstance) { switch (model->LTRAspecialCase) { diff --git a/src/spicelib/devices/mes/mesacl.c b/src/spicelib/devices/mes/mesacl.c index 1a323743a..5bddff6f6 100644 --- a/src/spicelib/devices/mes/mesacl.c +++ b/src/spicelib/devices/mes/mesacl.c @@ -28,9 +28,9 @@ MESacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { - for( here = model->MESinstances; here != NULL; + for( here = MESinstances(model); here != NULL; here = here->MESnextInstance) { m = here->MESm; diff --git a/src/spicelib/devices/mes/mesdefs.h b/src/spicelib/devices/mes/mesdefs.h index 71ae13565..fb090acd5 100644 --- a/src/spicelib/devices/mes/mesdefs.h +++ b/src/spicelib/devices/mes/mesdefs.h @@ -161,14 +161,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mes/mesdest.c b/src/spicelib/devices/mes/mesdest.c index 0a557755f..40bfa0ab9 100644 --- a/src/spicelib/devices/mes/mesdest.c +++ b/src/spicelib/devices/mes/mesdest.c @@ -14,8 +14,8 @@ MESdestroy(GENmodel **inModel) MESmodel *mod = *(MESmodel**) inModel; while (mod) { - MESmodel *next_mod = mod->MESnextModel; - MESinstance *inst = mod->MESinstances; + MESmodel *next_mod = MESnextModel(mod); + MESinstance *inst = MESinstances(mod); while (inst) { MESinstance *next_inst = inst->MESnextInstance; FREE(inst); diff --git a/src/spicelib/devices/mes/mesdisto.c b/src/spicelib/devices/mes/mesdisto.c index b7ec3e248..e0c0e204e 100644 --- a/src/spicelib/devices/mes/mesdisto.c +++ b/src/spicelib/devices/mes/mesdisto.c @@ -40,10 +40,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the MES models */ -for( ; model != NULL; model = model->MESnextModel ) { +for( ; model != NULL; model = MESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MESinstances; here != NULL ; + for (here = MESinstances(model); here != NULL ; here=here->MESnextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/mes/mesdset.c b/src/spicelib/devices/mes/mesdset.c index 0b64e12ad..7540efe8f 100644 --- a/src/spicelib/devices/mes/mesdset.c +++ b/src/spicelib/devices/mes/mesdset.c @@ -55,10 +55,10 @@ MESdSetup(GENmodel *inModel, CKTcircuit *ckt) Dderivs d_p, d_q, d_r, d_zero; /* loop through all the models */ - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MESinstances; here != NULL ; + for (here = MESinstances(model); here != NULL ; here=here->MESnextInstance) { /* diff --git a/src/spicelib/devices/mes/mesgetic.c b/src/spicelib/devices/mes/mesgetic.c index 586962dab..11084dd5e 100644 --- a/src/spicelib/devices/mes/mesgetic.c +++ b/src/spicelib/devices/mes/mesgetic.c @@ -22,8 +22,8 @@ MESgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MESnextModel) { - for(here = model->MESinstances; here ; here = here->MESnextInstance) { + for( ; model ; model = MESnextModel(model)) { + for(here = MESinstances(model); here ; here = here->MESnextInstance) { if(!here->MESicVDSGiven) { here->MESicVDS = diff --git a/src/spicelib/devices/mes/mesload.c b/src/spicelib/devices/mes/mesload.c index 8eda10ef1..bbb8cf35b 100644 --- a/src/spicelib/devices/mes/mesload.c +++ b/src/spicelib/devices/mes/mesload.c @@ -85,10 +85,10 @@ MESload(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the models */ - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MESinstances; here != NULL ; + for (here = MESinstances(model); here != NULL ; here=here->MESnextInstance) { /* diff --git a/src/spicelib/devices/mes/mesnoise.c b/src/spicelib/devices/mes/mesnoise.c index e4193cece..1e7b94868 100644 --- a/src/spicelib/devices/mes/mesnoise.c +++ b/src/spicelib/devices/mes/mesnoise.c @@ -45,8 +45,8 @@ MESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *d "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->MESnextModel) { - for (inst=model->MESinstances; inst != NULL; inst=inst->MESnextInstance) { + for (model=firstModel; model != NULL; model=MESnextModel(model)) { + for (inst=MESinstances(model); inst != NULL; inst=inst->MESnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/mes/mespzld.c b/src/spicelib/devices/mes/mespzld.c index 81bd34c4d..91918cfaf 100644 --- a/src/spicelib/devices/mes/mespzld.c +++ b/src/spicelib/devices/mes/mespzld.c @@ -29,9 +29,9 @@ MESpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { - for( here = model->MESinstances; here != NULL; + for( here = MESinstances(model); here != NULL; here = here->MESnextInstance) { m = here->MESm; diff --git a/src/spicelib/devices/mes/messetup.c b/src/spicelib/devices/mes/messetup.c index e7c885361..176bc9228 100644 --- a/src/spicelib/devices/mes/messetup.c +++ b/src/spicelib/devices/mes/messetup.c @@ -24,7 +24,7 @@ MESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the diode models */ - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { if( (model->MEStype != NMF) && (model->MEStype != PMF) ) { model->MEStype = NMF; @@ -73,7 +73,7 @@ MESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->MESinstances; here != NULL ; + for (here = MESinstances(model); here != NULL ; here=here->MESnextInstance) { if(!here->MESareaGiven) { @@ -163,9 +163,9 @@ MESunsetup(GENmodel *inModel, CKTcircuit *ckt) MESinstance *here; for (model = (MESmodel *)inModel; model != NULL; - model = model->MESnextModel) + model = MESnextModel(model)) { - for (here = model->MESinstances; here != NULL; + for (here = MESinstances(model); here != NULL; here=here->MESnextInstance) { if (here->MESdrainPrimeNode > 0 diff --git a/src/spicelib/devices/mes/mestemp.c b/src/spicelib/devices/mes/mestemp.c index c82bf5f9e..e714fdd85 100644 --- a/src/spicelib/devices/mes/mestemp.c +++ b/src/spicelib/devices/mes/mestemp.c @@ -24,7 +24,7 @@ MEStemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the diode models */ - for( ; model != NULL; model = model->MESnextModel ) { + for( ; model != NULL; model = MESnextModel(model) ) { if(model->MESdrainResist != 0) { model->MESdrainConduct = 1/model->MESdrainResist; diff --git a/src/spicelib/devices/mes/mestrunc.c b/src/spicelib/devices/mes/mestrunc.c index 74b1ac89b..b262e6760 100644 --- a/src/spicelib/devices/mes/mestrunc.c +++ b/src/spicelib/devices/mes/mestrunc.c @@ -18,8 +18,8 @@ MEStrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MESmodel *model = (MESmodel*)inModel; MESinstance *here; - for( ; model != NULL; model = model->MESnextModel) { - for(here=model->MESinstances;here!=NULL;here = here->MESnextInstance){ + for( ; model != NULL; model = MESnextModel(model)) { + for(here=MESinstances(model);here!=NULL;here = here->MESnextInstance){ CKTterr(here->MESqgs,ckt,timeStep); CKTterr(here->MESqgd,ckt,timeStep); diff --git a/src/spicelib/devices/mesa/mesaacl.c b/src/spicelib/devices/mesa/mesaacl.c index 6ac5db842..85a767c5b 100644 --- a/src/spicelib/devices/mesa/mesaacl.c +++ b/src/spicelib/devices/mesa/mesaacl.c @@ -31,8 +31,8 @@ MESAacLoad(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->MESAnextModel ) { - for( here = model->MESAinstances; here != NULL; + for( ; model != NULL; model = MESAnextModel(model) ) { + for( here = MESAinstances(model); here != NULL; here = here->MESAnextInstance) { f = ckt->CKTomega/2/M_PI; diff --git a/src/spicelib/devices/mesa/mesadefs.h b/src/spicelib/devices/mesa/mesadefs.h index 13e8a046d..834801512 100644 --- a/src/spicelib/devices/mesa/mesadefs.h +++ b/src/spicelib/devices/mesa/mesadefs.h @@ -214,14 +214,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mesa/mesadest.c b/src/spicelib/devices/mesa/mesadest.c index 26dae198f..880edf492 100644 --- a/src/spicelib/devices/mesa/mesadest.c +++ b/src/spicelib/devices/mesa/mesadest.c @@ -14,8 +14,8 @@ MESAdestroy(GENmodel **inModel) MESAmodel *mod = *(MESAmodel**) inModel; while (mod) { - MESAmodel *next_mod = mod->MESAnextModel; - MESAinstance *inst = mod->MESAinstances; + MESAmodel *next_mod = MESAnextModel(mod); + MESAinstance *inst = MESAinstances(mod); while (inst) { MESAinstance *next_inst = inst->MESAnextInstance; FREE(inst); diff --git a/src/spicelib/devices/mesa/mesagetic.c b/src/spicelib/devices/mesa/mesagetic.c index 9b146db90..ec7906797 100644 --- a/src/spicelib/devices/mesa/mesagetic.c +++ b/src/spicelib/devices/mesa/mesagetic.c @@ -20,8 +20,8 @@ MESAgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MESAnextModel) { - for(here = model->MESAinstances; here ; here = here->MESAnextInstance) { + for( ; model ; model = MESAnextModel(model)) { + for(here = MESAinstances(model); here ; here = here->MESAnextInstance) { if(!here->MESAicVDSGiven) { here->MESAicVDS = diff --git a/src/spicelib/devices/mesa/mesaload.c b/src/spicelib/devices/mesa/mesaload.c index aaf23df6e..8d2b5789e 100644 --- a/src/spicelib/devices/mesa/mesaload.c +++ b/src/spicelib/devices/mesa/mesaload.c @@ -95,10 +95,10 @@ MESAload(GENmodel *inModel, CKTcircuit *ckt) double m; /* loop through all the models */ - for( ; model != NULL; model = model->MESAnextModel ) { + for( ; model != NULL; model = MESAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MESAinstances; here != NULL ; + for (here = MESAinstances(model); here != NULL ; here=here->MESAnextInstance) { /* diff --git a/src/spicelib/devices/mesa/mesapzl.c b/src/spicelib/devices/mesa/mesapzl.c index 830542256..eaf941a28 100644 --- a/src/spicelib/devices/mesa/mesapzl.c +++ b/src/spicelib/devices/mesa/mesapzl.c @@ -31,8 +31,8 @@ MESApzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double m; - for( ; model != NULL; model = model->MESAnextModel ) { - for( here = model->MESAinstances; here != NULL; + for( ; model != NULL; model = MESAnextModel(model) ) { + for( here = MESAinstances(model); here != NULL; here = here->MESAnextInstance) { f = ckt->CKTomega/2/M_PI; diff --git a/src/spicelib/devices/mesa/mesasetup.c b/src/spicelib/devices/mesa/mesasetup.c index b11ebac5b..f75a8554e 100644 --- a/src/spicelib/devices/mesa/mesasetup.c +++ b/src/spicelib/devices/mesa/mesasetup.c @@ -27,7 +27,7 @@ MESAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the diode models */ - for( ; model != NULL; model = model->MESAnextModel ) { + for( ; model != NULL; model = MESAnextModel(model) ) { if( (model->MESAtype != NMF) ) { fprintf(stderr, "Only nmf model type supported, set to nmf\n"); model->MESAtype = NMF; @@ -227,7 +227,7 @@ MESAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->MESAvcrit = 0.; /* until model has changed */ /* loop through all the instances of the model */ - for (here = model->MESAinstances; here != NULL ; + for (here = MESAinstances(model); here != NULL ; here=here->MESAnextInstance) { if(!here->MESAlengthGiven) { @@ -414,9 +414,9 @@ MESAunsetup(GENmodel *inModel, CKTcircuit *ckt) MESAinstance *here; for (model = (MESAmodel *)inModel; model != NULL; - model = model->MESAnextModel) + model = MESAnextModel(model)) { - for (here = model->MESAinstances; here != NULL; + for (here = MESAinstances(model); here != NULL; here=here->MESAnextInstance) { if (here->MESAdrainPrmPrmNode > 0 diff --git a/src/spicelib/devices/mesa/mesatemp.c b/src/spicelib/devices/mesa/mesatemp.c index 88c08e788..131d3f92c 100644 --- a/src/spicelib/devices/mesa/mesatemp.c +++ b/src/spicelib/devices/mesa/mesatemp.c @@ -25,7 +25,7 @@ MESAtemp(GENmodel *inModel, CKTcircuit *ckt) double d; - for( ; model != NULL; model = model->MESAnextModel ) { + for( ; model != NULL; model = MESAnextModel(model) ) { if(!model->MESAlambdahfGiven) model->MESAlambdahf = model->MESAlambda; if(model->MESAlevel == 2) @@ -40,7 +40,7 @@ MESAtemp(GENmodel *inModel, CKTcircuit *ckt) } model->MESAdeltaSqr = model->MESAdelta*model->MESAdelta; - for (here = model->MESAinstances; here != NULL ; + for (here = MESAinstances(model); here != NULL ; here=here->MESAnextInstance) { vt = CONSTKoverQ * here->MESAts; diff --git a/src/spicelib/devices/mesa/mesatrunc.c b/src/spicelib/devices/mesa/mesatrunc.c index e81909983..da9273677 100644 --- a/src/spicelib/devices/mesa/mesatrunc.c +++ b/src/spicelib/devices/mesa/mesatrunc.c @@ -16,8 +16,8 @@ MESAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MESAmodel *model = (MESAmodel*)inModel; MESAinstance *here; - for( ; model != NULL; model = model->MESAnextModel) { - for(here=model->MESAinstances;here!=NULL; + for( ; model != NULL; model = MESAnextModel(model)) { + for(here=MESAinstances(model);here!=NULL; here = here->MESAnextInstance){ CKTterr(here->MESAqgs,ckt,timeStep); diff --git a/src/spicelib/devices/mos1/mos1acld.c b/src/spicelib/devices/mos1/mos1acld.c index 92d8b372a..32181207a 100644 --- a/src/spicelib/devices/mos1/mos1acld.c +++ b/src/spicelib/devices/mos1/mos1acld.c @@ -33,8 +33,8 @@ MOS1acLoad(GENmodel *inModel, CKTcircuit *ckt) double GateSourceOverlapCap; double EffectiveLength; - for( ; model != NULL; model = model->MOS1nextModel) { - for(here = model->MOS1instances; here!= NULL; + for( ; model != NULL; model = MOS1nextModel(model)) { + for(here = MOS1instances(model); here!= NULL; here = here->MOS1nextInstance) { if (here->MOS1mode < 0) { diff --git a/src/spicelib/devices/mos1/mos1conv.c b/src/spicelib/devices/mos1/mos1conv.c index 66fdd5ef1..c10a5892b 100644 --- a/src/spicelib/devices/mos1/mos1conv.c +++ b/src/spicelib/devices/mos1/mos1conv.c @@ -29,8 +29,8 @@ MOS1convTest(GENmodel *inModel, CKTcircuit *ckt) double vgdo; double tol; - for( ; model != NULL; model = model->MOS1nextModel) { - for(here = model->MOS1instances; here!= NULL; + for( ; model != NULL; model = MOS1nextModel(model)) { + for(here = MOS1instances(model); here!= NULL; here = here->MOS1nextInstance) { vbs = model->MOS1type * ( diff --git a/src/spicelib/devices/mos1/mos1defs.h b/src/spicelib/devices/mos1/mos1defs.h index 6d99af876..83b77e202 100644 --- a/src/spicelib/devices/mos1/mos1defs.h +++ b/src/spicelib/devices/mos1/mos1defs.h @@ -312,14 +312,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mos1/mos1dest.c b/src/spicelib/devices/mos1/mos1dest.c index b862a7b60..a01c0ed4d 100644 --- a/src/spicelib/devices/mos1/mos1dest.c +++ b/src/spicelib/devices/mos1/mos1dest.c @@ -14,8 +14,8 @@ MOS1destroy(GENmodel **inModel) MOS1model *mod = *(MOS1model**) inModel; while (mod) { - MOS1model *next_mod = mod->MOS1nextModel; - MOS1instance *inst = mod->MOS1instances; + MOS1model *next_mod = MOS1nextModel(mod); + MOS1instance *inst = MOS1instances(mod); while (inst) { MOS1instance *next_inst = inst->MOS1nextInstance; FREE(inst->MOS1sens); diff --git a/src/spicelib/devices/mos1/mos1dist.c b/src/spicelib/devices/mos1/mos1dist.c index 437cf93f4..0d1b2373f 100644 --- a/src/spicelib/devices/mos1/mos1dist.c +++ b/src/spicelib/devices/mos1/mos1dist.c @@ -46,10 +46,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the MOS1 models */ -for( ; model != NULL; model = model->MOS1nextModel ) { +for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/mos1/mos1dset.c b/src/spicelib/devices/mos1/mos1dset.c index f90e85b19..ef3416832 100644 --- a/src/spicelib/devices/mos1/mos1dset.c +++ b/src/spicelib/devices/mos1/mos1dset.c @@ -80,9 +80,9 @@ MOS1dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the MOS1 device models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { vt = CONSTKoverQ * here->MOS1temp; diff --git a/src/spicelib/devices/mos1/mos1ic.c b/src/spicelib/devices/mos1/mos1ic.c index 31aa4a765..9e6347e8b 100644 --- a/src/spicelib/devices/mos1/mos1ic.c +++ b/src/spicelib/devices/mos1/mos1ic.c @@ -22,8 +22,8 @@ MOS1getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MOS1nextModel) { - for(here = model->MOS1instances; here ; here = here->MOS1nextInstance) { + for( ; model ; model = MOS1nextModel(model)) { + for(here = MOS1instances(model); here ; here = here->MOS1nextInstance) { if(!here->MOS1icVBSGiven) { here->MOS1icVBS = diff --git a/src/spicelib/devices/mos1/mos1load.c b/src/spicelib/devices/mos1/mos1load.c index 78904c25a..db4ef11e9 100644 --- a/src/spicelib/devices/mos1/mos1load.c +++ b/src/spicelib/devices/mos1/mos1load.c @@ -95,10 +95,10 @@ MOS1load(GENmodel *inModel, CKTcircuit *ckt) #endif /* CAPBYPASS */ /* loop through all the MOS1 device models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { vt = CONSTKoverQ * here->MOS1temp; diff --git a/src/spicelib/devices/mos1/mos1noi.c b/src/spicelib/devices/mos1/mos1noi.c index 31f171966..6539d4074 100644 --- a/src/spicelib/devices/mos1/mos1noi.c +++ b/src/spicelib/devices/mos1/mos1noi.c @@ -47,7 +47,7 @@ MOS1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->MOS1nextModel) { + for (model=firstModel; model != NULL; model=MOS1nextModel(model)) { /* Oxide capacitance can be zero in MOS level 1. Since this will give us problems in our 1/f */ /* noise model, we ASSUME an actual "tox" of 1e-7 */ @@ -58,7 +58,7 @@ MOS1noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, coxSquared = model->MOS1oxideCapFactor; } coxSquared *= coxSquared; - for (inst=model->MOS1instances; inst != NULL; inst=inst->MOS1nextInstance) { + for (inst=MOS1instances(model); inst != NULL; inst=inst->MOS1nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/mos1/mos1pzld.c b/src/spicelib/devices/mos1/mos1pzld.c index 721c539cd..a013ea166 100644 --- a/src/spicelib/devices/mos1/mos1pzld.c +++ b/src/spicelib/devices/mos1/mos1pzld.c @@ -34,8 +34,8 @@ MOS1pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double GateSourceOverlapCap; double EffectiveLength; - for( ; model != NULL; model = model->MOS1nextModel) { - for(here = model->MOS1instances; here!= NULL; + for( ; model != NULL; model = MOS1nextModel(model)) { + for(here = MOS1instances(model); here!= NULL; here = here->MOS1nextInstance) { if (here->MOS1mode < 0) { diff --git a/src/spicelib/devices/mos1/mos1sacl.c b/src/spicelib/devices/mos1/mos1sacl.c index c71101dc7..6ae3e2c43 100644 --- a/src/spicelib/devices/mos1/mos1sacl.c +++ b/src/spicelib/devices/mos1/mos1sacl.c @@ -128,8 +128,8 @@ MOS1sAcLoad(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ info = ckt->CKTsenInfo; info->SENstatus = PERTURBATION; - for( ; model != NULL; model = model->MOS1nextModel) { - for(here = model->MOS1instances; here!= NULL; + for( ; model != NULL; model = MOS1nextModel(model)) { + for(here = MOS1instances(model); here!= NULL; here = here->MOS1nextInstance) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/mos1/mos1set.c b/src/spicelib/devices/mos1/mos1set.c index 128c6769e..df352a08f 100644 --- a/src/spicelib/devices/mos1/mos1set.c +++ b/src/spicelib/devices/mos1/mos1set.c @@ -25,7 +25,7 @@ MOS1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, CKTnode *tmp; /* loop through all the MOS1 device models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { if(!model->MOS1typeGiven) { model->MOS1type = NMOS; @@ -89,7 +89,7 @@ MOS1setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, } /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { /* allocate a chunk of the state vector */ @@ -218,9 +218,9 @@ MOS1unsetup(GENmodel *inModel, CKTcircuit *ckt) MOS1instance *here; for (model = (MOS1model *)inModel; model != NULL; - model = model->MOS1nextModel) + model = MOS1nextModel(model)) { - for (here = model->MOS1instances; here != NULL; + for (here = MOS1instances(model); here != NULL; here=here->MOS1nextInstance) { if (here->MOS1sNodePrime > 0 diff --git a/src/spicelib/devices/mos1/mos1sld.c b/src/spicelib/devices/mos1/mos1sld.c index 97cb54754..2365f84cc 100644 --- a/src/spicelib/devices/mos1/mos1sld.c +++ b/src/spicelib/devices/mos1/mos1sld.c @@ -93,10 +93,10 @@ MOS1sLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos1/mos1sprt.c b/src/spicelib/devices/mos1/mos1sprt.c index c13e6078e..808fd05f9 100644 --- a/src/spicelib/devices/mos1/mos1sprt.c +++ b/src/spicelib/devices/mos1/mos1sprt.c @@ -28,12 +28,12 @@ MOS1sPrint(GENmodel *inModel, CKTcircuit *ckt) printf("LEVEL 1 MOSFETS-----------------\n"); /* loop through all the MOS1 models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { printf("Model name:%s\n",model->MOS1modName); /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { printf(" Instance name:%s\n",here->MOS1name); diff --git a/src/spicelib/devices/mos1/mos1sset.c b/src/spicelib/devices/mos1/mos1sset.c index 10bbc8789..9c2e38e2c 100644 --- a/src/spicelib/devices/mos1/mos1sset.c +++ b/src/spicelib/devices/mos1/mos1sset.c @@ -22,10 +22,10 @@ MOS1sSetup(SENstruct *info, GENmodel *inModel) MOS1instance *here; /* loop through all the models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { if(here->MOS1senParmNo){ diff --git a/src/spicelib/devices/mos1/mos1supd.c b/src/spicelib/devices/mos1/mos1supd.c index bee4c31c3..d565f0ba5 100644 --- a/src/spicelib/devices/mos1/mos1supd.c +++ b/src/spicelib/devices/mos1/mos1supd.c @@ -51,10 +51,10 @@ MOS1sUpdate(GENmodel *inModel, CKTcircuit *ckt) dummy2 = 0; /* loop through all the MOS1 models */ - for( ; model != NULL; model = model->MOS1nextModel ) { + for( ; model != NULL; model = MOS1nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS1instances; here != NULL ; + for (here = MOS1instances(model); here != NULL ; here=here->MOS1nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos1/mos1temp.c b/src/spicelib/devices/mos1/mos1temp.c index 2f0ecf2cc..e6b8e2b22 100644 --- a/src/spicelib/devices/mos1/mos1temp.c +++ b/src/spicelib/devices/mos1/mos1temp.c @@ -34,7 +34,7 @@ MOS1temp(GENmodel *inModel, CKTcircuit *ckt) double fermis; double vfb; /* loop through all the resistor models */ - for( ; model != NULL; model = model->MOS1nextModel) { + for( ; model != NULL; model = MOS1nextModel(model)) { /* perform model defaulting */ @@ -114,7 +114,7 @@ MOS1temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->MOS1instances; here!= NULL; + for(here = MOS1instances(model); here!= NULL; here = here->MOS1nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ diff --git a/src/spicelib/devices/mos1/mos1trun.c b/src/spicelib/devices/mos1/mos1trun.c index 2090b6bf8..c4d6c965c 100644 --- a/src/spicelib/devices/mos1/mos1trun.c +++ b/src/spicelib/devices/mos1/mos1trun.c @@ -18,8 +18,8 @@ MOS1trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS1model *model = (MOS1model *)inModel; MOS1instance *here; - for( ; model != NULL; model = model->MOS1nextModel) { - for(here=model->MOS1instances;here!=NULL;here = here->MOS1nextInstance){ + for( ; model != NULL; model = MOS1nextModel(model)) { + for(here=MOS1instances(model);here!=NULL;here = here->MOS1nextInstance){ CKTterr(here->MOS1qgs,ckt,timeStep); CKTterr(here->MOS1qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos2/mos2acld.c b/src/spicelib/devices/mos2/mos2acld.c index 6e24c7bde..1492d8735 100644 --- a/src/spicelib/devices/mos2/mos2acld.c +++ b/src/spicelib/devices/mos2/mos2acld.c @@ -33,8 +33,8 @@ MOS2acLoad(GENmodel *inModel, CKTcircuit *ckt) double GateSourceOverlapCap; double EffectiveLength; - for( ; model != NULL; model = model->MOS2nextModel) { - for(here = model->MOS2instances; here!= NULL; + for( ; model != NULL; model = MOS2nextModel(model)) { + for(here = MOS2instances(model); here!= NULL; here = here->MOS2nextInstance) { if (here->MOS2mode < 0) { diff --git a/src/spicelib/devices/mos2/mos2conv.c b/src/spicelib/devices/mos2/mos2conv.c index 7748f82a1..2ee444a45 100644 --- a/src/spicelib/devices/mos2/mos2conv.c +++ b/src/spicelib/devices/mos2/mos2conv.c @@ -29,8 +29,8 @@ MOS2convTest(GENmodel *inModel, CKTcircuit *ckt) double vgdo; double tol; - for( ; model != NULL; model = model->MOS2nextModel) { - for(here = model->MOS2instances; here!= NULL; + for( ; model != NULL; model = MOS2nextModel(model)) { + for(here = MOS2instances(model); here!= NULL; here = here->MOS2nextInstance) { vbs = model->MOS2type * ( diff --git a/src/spicelib/devices/mos2/mos2defs.h b/src/spicelib/devices/mos2/mos2defs.h index 8e2b38f37..802981f94 100644 --- a/src/spicelib/devices/mos2/mos2defs.h +++ b/src/spicelib/devices/mos2/mos2defs.h @@ -320,14 +320,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mos2/mos2dest.c b/src/spicelib/devices/mos2/mos2dest.c index eb78eca02..78c7b0004 100644 --- a/src/spicelib/devices/mos2/mos2dest.c +++ b/src/spicelib/devices/mos2/mos2dest.c @@ -14,8 +14,8 @@ MOS2destroy(GENmodel **inModel) MOS2model *mod = *(MOS2model **) inModel; while (mod) { - MOS2model *next_mod = mod->MOS2nextModel; - MOS2instance *inst = mod->MOS2instances; + MOS2model *next_mod = MOS2nextModel(mod); + MOS2instance *inst = MOS2instances(mod); while (inst) { MOS2instance *next_inst = inst->MOS2nextInstance; FREE(inst->MOS2sens); diff --git a/src/spicelib/devices/mos2/mos2dist.c b/src/spicelib/devices/mos2/mos2dist.c index 04ed67743..9eea4a9ac 100644 --- a/src/spicelib/devices/mos2/mos2dist.c +++ b/src/spicelib/devices/mos2/mos2dist.c @@ -45,10 +45,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the MOS2 models */ -for( ; model != NULL; model = model->MOS2nextModel ) { +for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/mos2/mos2dset.c b/src/spicelib/devices/mos2/mos2dset.c index 939dc4acd..ff9bb8683 100644 --- a/src/spicelib/devices/mos2/mos2dset.c +++ b/src/spicelib/devices/mos2/mos2dset.c @@ -70,10 +70,10 @@ double gmbds; Dderivs d_cdrain; /* loop through all the MOS2 device models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { vt = CONSTKoverQ * here->MOS2temp; diff --git a/src/spicelib/devices/mos2/mos2ic.c b/src/spicelib/devices/mos2/mos2ic.c index 9b85538b5..36ecfe219 100644 --- a/src/spicelib/devices/mos2/mos2ic.c +++ b/src/spicelib/devices/mos2/mos2ic.c @@ -22,8 +22,8 @@ MOS2getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MOS2nextModel) { - for(here = model->MOS2instances; here ; here = here->MOS2nextInstance) { + for( ; model ; model = MOS2nextModel(model)) { + for(here = MOS2instances(model); here ; here = here->MOS2nextInstance) { if(!here->MOS2icVBSGiven) { here->MOS2icVBS = diff --git a/src/spicelib/devices/mos2/mos2load.c b/src/spicelib/devices/mos2/mos2load.c index fb4683338..688199727 100644 --- a/src/spicelib/devices/mos2/mos2load.c +++ b/src/spicelib/devices/mos2/mos2load.c @@ -103,10 +103,10 @@ MOS2load(GENmodel *inModel, CKTcircuit *ckt) #endif /* CAPBYPASS */ /* loop through all the MOS2 device models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { vt = CONSTKoverQ * here->MOS2temp; diff --git a/src/spicelib/devices/mos2/mos2noi.c b/src/spicelib/devices/mos2/mos2noi.c index ecfbf01cc..a4f5face9 100644 --- a/src/spicelib/devices/mos2/mos2noi.c +++ b/src/spicelib/devices/mos2/mos2noi.c @@ -46,8 +46,8 @@ MOS2noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->MOS2nextModel) { - for (inst=model->MOS2instances; inst != NULL; inst=inst->MOS2nextInstance) { + for (model=firstModel; model != NULL; model=MOS2nextModel(model)) { + for (inst=MOS2instances(model); inst != NULL; inst=inst->MOS2nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/mos2/mos2pzld.c b/src/spicelib/devices/mos2/mos2pzld.c index 27363fa97..8057a167b 100644 --- a/src/spicelib/devices/mos2/mos2pzld.c +++ b/src/spicelib/devices/mos2/mos2pzld.c @@ -34,8 +34,8 @@ MOS2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double GateSourceOverlapCap; double EffectiveLength; - for( ; model != NULL; model = model->MOS2nextModel) { - for(here = model->MOS2instances; here!= NULL; + for( ; model != NULL; model = MOS2nextModel(model)) { + for(here = MOS2instances(model); here!= NULL; here = here->MOS2nextInstance) { if (here->MOS2mode < 0) { diff --git a/src/spicelib/devices/mos2/mos2sacl.c b/src/spicelib/devices/mos2/mos2sacl.c index efef2a5ae..324c91099 100644 --- a/src/spicelib/devices/mos2/mos2sacl.c +++ b/src/spicelib/devices/mos2/mos2sacl.c @@ -128,8 +128,8 @@ MOS2sAcLoad(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ info = ckt->CKTsenInfo; info->SENstatus = PERTURBATION; - for( ; model != NULL; model = model->MOS2nextModel) { - for(here = model->MOS2instances; here!= NULL; + for( ; model != NULL; model = MOS2nextModel(model)) { + for(here = MOS2instances(model); here!= NULL; here = here->MOS2nextInstance) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/mos2/mos2set.c b/src/spicelib/devices/mos2/mos2set.c index 5ed8d5ce8..41748ca78 100644 --- a/src/spicelib/devices/mos2/mos2set.c +++ b/src/spicelib/devices/mos2/mos2set.c @@ -24,7 +24,7 @@ MOS2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the MOS2 device models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { if(!model->MOS2typeGiven) { model->MOS2type = NMOS; @@ -118,7 +118,7 @@ MOS2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { CKTnode *tmpNode; @@ -241,9 +241,9 @@ MOS2unsetup(GENmodel *inModel, CKTcircuit *ckt) MOS2instance *here; for (model = (MOS2model *)inModel; model != NULL; - model = model->MOS2nextModel) + model = MOS2nextModel(model)) { - for (here = model->MOS2instances; here != NULL; + for (here = MOS2instances(model); here != NULL; here=here->MOS2nextInstance) { if (here->MOS2sNodePrime > 0 diff --git a/src/spicelib/devices/mos2/mos2sld.c b/src/spicelib/devices/mos2/mos2sld.c index 7e24d99b9..12105fa0d 100644 --- a/src/spicelib/devices/mos2/mos2sld.c +++ b/src/spicelib/devices/mos2/mos2sld.c @@ -93,10 +93,10 @@ MOS2sLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos2/mos2sprt.c b/src/spicelib/devices/mos2/mos2sprt.c index e92879391..6e7c39283 100644 --- a/src/spicelib/devices/mos2/mos2sprt.c +++ b/src/spicelib/devices/mos2/mos2sprt.c @@ -24,12 +24,12 @@ MOS2sPrint(GENmodel *inModel, CKTcircuit *ckt) printf("LEVEL 2 MOSFETS-----------------\n"); /* loop through all the MOS2 models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { printf("Model name:%s\n",model->MOS2modName); /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { printf(" Instance name:%s\n",here->MOS2name); diff --git a/src/spicelib/devices/mos2/mos2sset.c b/src/spicelib/devices/mos2/mos2sset.c index 838c34b86..01ebf7981 100644 --- a/src/spicelib/devices/mos2/mos2sset.c +++ b/src/spicelib/devices/mos2/mos2sset.c @@ -22,10 +22,10 @@ MOS2sSetup(SENstruct *info, GENmodel *inModel) MOS2instance *here; /* loop through all the models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { if(here->MOS2senParmNo){ diff --git a/src/spicelib/devices/mos2/mos2supd.c b/src/spicelib/devices/mos2/mos2supd.c index 275bb6eb9..9930bf858 100644 --- a/src/spicelib/devices/mos2/mos2supd.c +++ b/src/spicelib/devices/mos2/mos2supd.c @@ -51,10 +51,10 @@ MOS2sUpdate(GENmodel *inModel, CKTcircuit *ckt) dummy2 = 0; /* loop through all the MOS2 models */ - for( ; model != NULL; model = model->MOS2nextModel ) { + for( ; model != NULL; model = MOS2nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS2instances; here != NULL ; + for (here = MOS2instances(model); here != NULL ; here=here->MOS2nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos2/mos2temp.c b/src/spicelib/devices/mos2/mos2temp.c index 29a83122d..7162604ee 100644 --- a/src/spicelib/devices/mos2/mos2temp.c +++ b/src/spicelib/devices/mos2/mos2temp.c @@ -37,7 +37,7 @@ MOS2temp(GENmodel *inModel, CKTcircuit *ckt) double gmaold,gmanew; double capfact; /* loop through all the resistor models */ - for( ; model != NULL; model = model->MOS2nextModel) { + for( ; model != NULL; model = MOS2nextModel(model)) { /* perform model defaulting */ @@ -121,7 +121,7 @@ MOS2temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->MOS2instances; here!= NULL; + for(here = MOS2instances(model); here!= NULL; here = here->MOS2nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ double czbdsw; /* zero voltage bulk-drain sidewall capacitance */ diff --git a/src/spicelib/devices/mos2/mos2trun.c b/src/spicelib/devices/mos2/mos2trun.c index 76952bc01..ee849a2f7 100644 --- a/src/spicelib/devices/mos2/mos2trun.c +++ b/src/spicelib/devices/mos2/mos2trun.c @@ -18,8 +18,8 @@ MOS2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS2model *model = (MOS2model *)inModel; MOS2instance *here; - for( ; model != NULL; model = model->MOS2nextModel) { - for(here=model->MOS2instances;here!=NULL;here = here->MOS2nextInstance){ + for( ; model != NULL; model = MOS2nextModel(model)) { + for(here=MOS2instances(model);here!=NULL;here = here->MOS2nextInstance){ CKTterr(here->MOS2qgs,ckt,timeStep); CKTterr(here->MOS2qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos3/mos3acld.c b/src/spicelib/devices/mos3/mos3acld.c index 61670e929..84334ade6 100644 --- a/src/spicelib/devices/mos3/mos3acld.c +++ b/src/spicelib/devices/mos3/mos3acld.c @@ -34,8 +34,8 @@ MOS3acLoad(GENmodel *inModel, CKTcircuit *ckt) double GateDrainOverlapCap; double GateSourceOverlapCap; - for( ; model != NULL; model = model->MOS3nextModel) { - for(here = model->MOS3instances; here!= NULL; + for( ; model != NULL; model = MOS3nextModel(model)) { + for(here = MOS3instances(model); here!= NULL; here = here->MOS3nextInstance) { if (here->MOS3mode < 0) { diff --git a/src/spicelib/devices/mos3/mos3conv.c b/src/spicelib/devices/mos3/mos3conv.c index ae7419ab8..a6018103b 100644 --- a/src/spicelib/devices/mos3/mos3conv.c +++ b/src/spicelib/devices/mos3/mos3conv.c @@ -29,8 +29,8 @@ MOS3convTest(GENmodel *inModel, CKTcircuit *ckt) double vgdo; double tol; - for( ; model != NULL; model = model->MOS3nextModel) { - for(here = model->MOS3instances; here!= NULL; + for( ; model != NULL; model = MOS3nextModel(model)) { + for(here = MOS3instances(model); here!= NULL; here = here->MOS3nextInstance) { vbs = model->MOS3type * ( diff --git a/src/spicelib/devices/mos3/mos3defs.h b/src/spicelib/devices/mos3/mos3defs.h index 0089ef378..161388338 100644 --- a/src/spicelib/devices/mos3/mos3defs.h +++ b/src/spicelib/devices/mos3/mos3defs.h @@ -316,14 +316,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mos3/mos3dest.c b/src/spicelib/devices/mos3/mos3dest.c index 5adf9f786..5affd7a0f 100644 --- a/src/spicelib/devices/mos3/mos3dest.c +++ b/src/spicelib/devices/mos3/mos3dest.c @@ -14,8 +14,8 @@ MOS3destroy(GENmodel **inModel) MOS3model *mod = *(MOS3model **) inModel; while (mod) { - MOS3model *next_mod = mod->MOS3nextModel; - MOS3instance *inst = mod->MOS3instances; + MOS3model *next_mod = MOS3nextModel(mod); + MOS3instance *inst = MOS3instances(mod); while (inst) { MOS3instance *next_inst = inst->MOS3nextInstance; FREE(inst->MOS3sens); diff --git a/src/spicelib/devices/mos3/mos3dist.c b/src/spicelib/devices/mos3/mos3dist.c index 4e2b5f4ca..8b278fe90 100644 --- a/src/spicelib/devices/mos3/mos3dist.c +++ b/src/spicelib/devices/mos3/mos3dist.c @@ -45,10 +45,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the MOS3 models */ -for( ; model != NULL; model = model->MOS3nextModel ) { +for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/mos3/mos3dset.c b/src/spicelib/devices/mos3/mos3dset.c index 6365ff29e..13aef2097 100644 --- a/src/spicelib/devices/mos3/mos3dset.c +++ b/src/spicelib/devices/mos3/mos3dset.c @@ -61,10 +61,10 @@ MOS3dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the MOS3 device models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { vt = CONSTKoverQ * here->MOS3temp; diff --git a/src/spicelib/devices/mos3/mos3ic.c b/src/spicelib/devices/mos3/mos3ic.c index 95d4d35a7..fe576b0e1 100644 --- a/src/spicelib/devices/mos3/mos3ic.c +++ b/src/spicelib/devices/mos3/mos3ic.c @@ -22,8 +22,8 @@ MOS3getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MOS3nextModel) { - for(here = model->MOS3instances; here ; here = here->MOS3nextInstance) { + for( ; model ; model = MOS3nextModel(model)) { + for(here = MOS3instances(model); here ; here = here->MOS3nextInstance) { if(!here->MOS3icVBSGiven) { here->MOS3icVBS = diff --git a/src/spicelib/devices/mos3/mos3load.c b/src/spicelib/devices/mos3/mos3load.c index d9b2b1b37..9e6f6519c 100644 --- a/src/spicelib/devices/mos3/mos3load.c +++ b/src/spicelib/devices/mos3/mos3load.c @@ -102,10 +102,10 @@ MOS3load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the MOS3 device models */ next: - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { vt = CONSTKoverQ * here->MOS3temp; diff --git a/src/spicelib/devices/mos3/mos3noi.c b/src/spicelib/devices/mos3/mos3noi.c index 383c7a6f8..feefee3d0 100644 --- a/src/spicelib/devices/mos3/mos3noi.c +++ b/src/spicelib/devices/mos3/mos3noi.c @@ -46,8 +46,8 @@ MOS3noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->MOS3nextModel) { - for (inst=model->MOS3instances; inst != NULL; inst=inst->MOS3nextInstance) { + for (model=firstModel; model != NULL; model=MOS3nextModel(model)) { + for (inst=MOS3instances(model); inst != NULL; inst=inst->MOS3nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/mos3/mos3pzld.c b/src/spicelib/devices/mos3/mos3pzld.c index 744134e35..079dca693 100644 --- a/src/spicelib/devices/mos3/mos3pzld.c +++ b/src/spicelib/devices/mos3/mos3pzld.c @@ -35,8 +35,8 @@ MOS3pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double EffectiveLength; double EffectiveWidth; - for( ; model != NULL; model = model->MOS3nextModel) { - for(here = model->MOS3instances; here!= NULL; + for( ; model != NULL; model = MOS3nextModel(model)) { + for(here = MOS3instances(model); here!= NULL; here = here->MOS3nextInstance) { if (here->MOS3mode < 0) { diff --git a/src/spicelib/devices/mos3/mos3sacl.c b/src/spicelib/devices/mos3/mos3sacl.c index 4cb06a833..416796000 100644 --- a/src/spicelib/devices/mos3/mos3sacl.c +++ b/src/spicelib/devices/mos3/mos3sacl.c @@ -128,8 +128,8 @@ MOS3sAcLoad(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ info = ckt->CKTsenInfo; info->SENstatus = PERTURBATION; - for( ; model != NULL; model = model->MOS3nextModel) { - for(here = model->MOS3instances; here!= NULL; + for( ; model != NULL; model = MOS3nextModel(model)) { + for(here = MOS3instances(model); here!= NULL; here = here->MOS3nextInstance) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/mos3/mos3set.c b/src/spicelib/devices/mos3/mos3set.c index 1e8cac082..ff487acd8 100644 --- a/src/spicelib/devices/mos3/mos3set.c +++ b/src/spicelib/devices/mos3/mos3set.c @@ -28,7 +28,7 @@ MOS3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the MOS3 device models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* perform model defaulting */ if(!model->MOS3typeGiven) { @@ -141,7 +141,7 @@ MOS3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { CKTnode *tmpNode; @@ -266,9 +266,9 @@ MOS3unsetup(GENmodel *inModel, CKTcircuit *ckt) MOS3instance *here; for (model = (MOS3model *)inModel; model != NULL; - model = model->MOS3nextModel) + model = MOS3nextModel(model)) { - for (here = model->MOS3instances; here != NULL; + for (here = MOS3instances(model); here != NULL; here=here->MOS3nextInstance) { if (here->MOS3sNodePrime > 0 diff --git a/src/spicelib/devices/mos3/mos3sld.c b/src/spicelib/devices/mos3/mos3sld.c index 729fef2b0..854b47d39 100644 --- a/src/spicelib/devices/mos3/mos3sld.c +++ b/src/spicelib/devices/mos3/mos3sld.c @@ -95,10 +95,10 @@ MOS3sLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos3/mos3sprt.c b/src/spicelib/devices/mos3/mos3sprt.c index 24ddfc01c..f891e513d 100644 --- a/src/spicelib/devices/mos3/mos3sprt.c +++ b/src/spicelib/devices/mos3/mos3sprt.c @@ -25,12 +25,12 @@ MOS3sPrint(GENmodel *inModel, CKTcircuit *ckt) printf("LEVEL 3 MOSFETS-----------------\n"); /* loop through all the MOS3 models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { printf("Model name:%s\n",model->MOS3modName); /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { printf(" Instance name:%s\n",here->MOS3name); diff --git a/src/spicelib/devices/mos3/mos3sset.c b/src/spicelib/devices/mos3/mos3sset.c index b7a1f8899..cda65b83a 100644 --- a/src/spicelib/devices/mos3/mos3sset.c +++ b/src/spicelib/devices/mos3/mos3sset.c @@ -23,10 +23,10 @@ MOS3sSetup(SENstruct *info, GENmodel *inModel) MOS3instance *here; /* loop through all the models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { if(here->MOS3senParmNo){ diff --git a/src/spicelib/devices/mos3/mos3supd.c b/src/spicelib/devices/mos3/mos3supd.c index 0e1de533d..a25091d5b 100644 --- a/src/spicelib/devices/mos3/mos3supd.c +++ b/src/spicelib/devices/mos3/mos3supd.c @@ -49,10 +49,10 @@ MOS3sUpdate(GENmodel *inModel, CKTcircuit *ckt) dummy2 = 0; /* loop through all the MOS3 models */ - for( ; model != NULL; model = model->MOS3nextModel ) { + for( ; model != NULL; model = MOS3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS3instances; here != NULL ; + for (here = MOS3instances(model); here != NULL ; here=here->MOS3nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos3/mos3temp.c b/src/spicelib/devices/mos3/mos3temp.c index 9f0b8e809..e11c3d454 100644 --- a/src/spicelib/devices/mos3/mos3temp.c +++ b/src/spicelib/devices/mos3/mos3temp.c @@ -36,7 +36,7 @@ MOS3temp(GENmodel *inModel, CKTcircuit *ckt) double gmanew,gmaold; double ni_temp, nifact; /* loop through all the mosfet models */ - for( ; model != NULL; model = model->MOS3nextModel) { + for( ; model != NULL; model = MOS3nextModel(model)) { if(!model->MOS3tnomGiven) { model->MOS3tnom = ckt->CKTnomTemp; @@ -115,7 +115,7 @@ MOS3temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->MOS3instances; here!= NULL; + for(here = MOS3instances(model); here!= NULL; here = here->MOS3nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ diff --git a/src/spicelib/devices/mos3/mos3trun.c b/src/spicelib/devices/mos3/mos3trun.c index 20c7bd12e..c51b6624d 100644 --- a/src/spicelib/devices/mos3/mos3trun.c +++ b/src/spicelib/devices/mos3/mos3trun.c @@ -15,8 +15,8 @@ MOS3trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS3model *model = (MOS3model *)inModel; MOS3instance *here; - for( ; model != NULL; model = model->MOS3nextModel) { - for(here=model->MOS3instances;here!=NULL;here = here->MOS3nextInstance){ + for( ; model != NULL; model = MOS3nextModel(model)) { + for(here=MOS3instances(model);here!=NULL;here = here->MOS3nextInstance){ CKTterr(here->MOS3qgs,ckt,timeStep); CKTterr(here->MOS3qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos6/mos6conv.c b/src/spicelib/devices/mos6/mos6conv.c index 7fe542672..055ea7155 100644 --- a/src/spicelib/devices/mos6/mos6conv.c +++ b/src/spicelib/devices/mos6/mos6conv.c @@ -29,8 +29,8 @@ MOS6convTest(GENmodel *inModel, CKTcircuit *ckt) double vgdo; double tol; - for( ; model != NULL; model = model->MOS6nextModel) { - for(here = model->MOS6instances; here!= NULL; + for( ; model != NULL; model = MOS6nextModel(model)) { + for(here = MOS6instances(model); here!= NULL; here = here->MOS6nextInstance) { vbs = model->MOS6type * ( diff --git a/src/spicelib/devices/mos6/mos6defs.h b/src/spicelib/devices/mos6/mos6defs.h index b9f9438ea..edcbcbcd9 100644 --- a/src/spicelib/devices/mos6/mos6defs.h +++ b/src/spicelib/devices/mos6/mos6defs.h @@ -243,14 +243,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mos6/mos6dest.c b/src/spicelib/devices/mos6/mos6dest.c index 09af2c252..4cc4cb7b7 100644 --- a/src/spicelib/devices/mos6/mos6dest.c +++ b/src/spicelib/devices/mos6/mos6dest.c @@ -14,8 +14,8 @@ MOS6destroy(GENmodel **inModel) MOS6model *mod = *(MOS6model**) inModel; while (mod) { - MOS6model *next_mod = mod->MOS6nextModel; - MOS6instance *inst = mod->MOS6instances; + MOS6model *next_mod = MOS6nextModel(mod); + MOS6instance *inst = MOS6instances(mod); while (inst) { MOS6instance *next_inst = inst->MOS6nextInstance; FREE(inst->MOS6sens); diff --git a/src/spicelib/devices/mos6/mos6ic.c b/src/spicelib/devices/mos6/mos6ic.c index f89f7e8f3..908a54031 100644 --- a/src/spicelib/devices/mos6/mos6ic.c +++ b/src/spicelib/devices/mos6/mos6ic.c @@ -22,8 +22,8 @@ MOS6getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MOS6nextModel) { - for(here = model->MOS6instances; here ; here = here->MOS6nextInstance) { + for( ; model ; model = MOS6nextModel(model)) { + for(here = MOS6instances(model); here ; here = here->MOS6nextInstance) { if(!here->MOS6icVBSGiven) { here->MOS6icVBS = diff --git a/src/spicelib/devices/mos6/mos6load.c b/src/spicelib/devices/mos6/mos6load.c index 0f1eea531..d0e1deb9a 100644 --- a/src/spicelib/devices/mos6/mos6load.c +++ b/src/spicelib/devices/mos6/mos6load.c @@ -95,10 +95,10 @@ MOS6load(GENmodel *inModel, CKTcircuit *ckt) #endif /* CAPBYPASS */ /* loop through all the MOS6 device models */ - for( ; model != NULL; model = model->MOS6nextModel ) { + for( ; model != NULL; model = MOS6nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS6instances; here != NULL ; + for (here = MOS6instances(model); here != NULL ; here=here->MOS6nextInstance) { vt = CONSTKoverQ * here->MOS6temp; diff --git a/src/spicelib/devices/mos6/mos6set.c b/src/spicelib/devices/mos6/mos6set.c index 5e8a913b3..3155acf08 100644 --- a/src/spicelib/devices/mos6/mos6set.c +++ b/src/spicelib/devices/mos6/mos6set.c @@ -25,7 +25,7 @@ MOS6setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, CKTnode *tmp; /* loop through all the MOS6 device models */ - for( ; model != NULL; model = model->MOS6nextModel ) { + for( ; model != NULL; model = MOS6nextModel(model) ) { if(!model->MOS6typeGiven) { model->MOS6type = NMOS; @@ -110,7 +110,7 @@ MOS6setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, } /* loop through all the instances of the model */ - for (here = model->MOS6instances; here != NULL ; + for (here = MOS6instances(model); here != NULL ; here=here->MOS6nextInstance) { CKTnode *tmpNode; IFuid tmpName; @@ -228,9 +228,9 @@ MOS6unsetup(GENmodel *inModel, CKTcircuit *ckt) MOS6instance *here; for (model = (MOS6model *)inModel; model != NULL; - model = model->MOS6nextModel) + model = MOS6nextModel(model)) { - for (here = model->MOS6instances; here != NULL; + for (here = MOS6instances(model); here != NULL; here=here->MOS6nextInstance) { if (here->MOS6sNodePrime > 0 diff --git a/src/spicelib/devices/mos6/mos6temp.c b/src/spicelib/devices/mos6/mos6temp.c index fd509f226..4ef33b263 100644 --- a/src/spicelib/devices/mos6/mos6temp.c +++ b/src/spicelib/devices/mos6/mos6temp.c @@ -33,7 +33,7 @@ MOS6temp(GENmodel *inModel, CKTcircuit *ckt) double fermis; double vfb; /* loop through all the resistor models */ - for( ; model != NULL; model = model->MOS6nextModel) { + for( ; model != NULL; model = MOS6nextModel(model)) { /* perform model defaulting */ @@ -116,7 +116,7 @@ MOS6temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->MOS6instances; here!= NULL; + for(here = MOS6instances(model); here!= NULL; here = here->MOS6nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ diff --git a/src/spicelib/devices/mos6/mos6trun.c b/src/spicelib/devices/mos6/mos6trun.c index bb8da497f..a8b441297 100644 --- a/src/spicelib/devices/mos6/mos6trun.c +++ b/src/spicelib/devices/mos6/mos6trun.c @@ -18,8 +18,8 @@ MOS6trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) MOS6model *model = (MOS6model *)inModel; MOS6instance *here; - for( ; model != NULL; model = model->MOS6nextModel) { - for(here=model->MOS6instances;here!=NULL;here = here->MOS6nextInstance){ + for( ; model != NULL; model = MOS6nextModel(model)) { + for(here=MOS6instances(model);here!=NULL;here = here->MOS6nextInstance){ CKTterr(here->MOS6qgs,ckt,timeStep); CKTterr(here->MOS6qgd,ckt,timeStep); diff --git a/src/spicelib/devices/mos9/mos9acld.c b/src/spicelib/devices/mos9/mos9acld.c index 00c3b468f..e47e13781 100644 --- a/src/spicelib/devices/mos9/mos9acld.c +++ b/src/spicelib/devices/mos9/mos9acld.c @@ -34,8 +34,8 @@ MOS9acLoad(GENmodel *inModel, CKTcircuit *ckt) double GateDrainOverlapCap; double GateSourceOverlapCap; - for( ; model != NULL; model = model->MOS9nextModel) { - for(here = model->MOS9instances; here!= NULL; + for( ; model != NULL; model = MOS9nextModel(model)) { + for(here = MOS9instances(model); here!= NULL; here = here->MOS9nextInstance) { if (here->MOS9mode < 0) { diff --git a/src/spicelib/devices/mos9/mos9conv.c b/src/spicelib/devices/mos9/mos9conv.c index 7cdf4353e..7b5e898ea 100644 --- a/src/spicelib/devices/mos9/mos9conv.c +++ b/src/spicelib/devices/mos9/mos9conv.c @@ -31,8 +31,8 @@ MOS9convTest(GENmodel *inModel, CKTcircuit *ckt) double vgdo; double tol; - for( ; model != NULL; model = model->MOS9nextModel) { - for(here = model->MOS9instances; here!= NULL; + for( ; model != NULL; model = MOS9nextModel(model)) { + for(here = MOS9instances(model); here!= NULL; here = here->MOS9nextInstance) { vbs = model->MOS9type * ( diff --git a/src/spicelib/devices/mos9/mos9defs.h b/src/spicelib/devices/mos9/mos9defs.h index e40588b33..85db7e508 100644 --- a/src/spicelib/devices/mos9/mos9defs.h +++ b/src/spicelib/devices/mos9/mos9defs.h @@ -318,14 +318,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/mos9/mos9dest.c b/src/spicelib/devices/mos9/mos9dest.c index 9319181d6..3cde63a41 100644 --- a/src/spicelib/devices/mos9/mos9dest.c +++ b/src/spicelib/devices/mos9/mos9dest.c @@ -15,8 +15,8 @@ MOS9destroy(GENmodel **inModel) MOS9model *mod = *(MOS9model **) inModel; while (mod) { - MOS9model *next_mod = mod->MOS9nextModel; - MOS9instance *inst = mod->MOS9instances; + MOS9model *next_mod = MOS9nextModel(mod); + MOS9instance *inst = MOS9instances(mod); while (inst) { MOS9instance *next_inst = inst->MOS9nextInstance; FREE(inst->MOS9sens); diff --git a/src/spicelib/devices/mos9/mos9dist.c b/src/spicelib/devices/mos9/mos9dist.c index 8748d095d..7dfc05fc4 100644 --- a/src/spicelib/devices/mos9/mos9dist.c +++ b/src/spicelib/devices/mos9/mos9dist.c @@ -50,10 +50,10 @@ if ((mode == D_TWOF1) || (mode == D_THRF1) || (mode == D_2F1MF2)) { /* loop through all the MOS9 models */ -for( ; model != NULL; model = model->MOS9nextModel ) { +for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { /* loading starts here */ diff --git a/src/spicelib/devices/mos9/mos9dset.c b/src/spicelib/devices/mos9/mos9dset.c index 89991df90..c2b4f6925 100644 --- a/src/spicelib/devices/mos9/mos9dset.c +++ b/src/spicelib/devices/mos9/mos9dset.c @@ -61,10 +61,10 @@ MOS9dSetup(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the MOS9 device models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { vt = CONSTKoverQ * here->MOS9temp; diff --git a/src/spicelib/devices/mos9/mos9ic.c b/src/spicelib/devices/mos9/mos9ic.c index 52a22b33a..b89802066 100644 --- a/src/spicelib/devices/mos9/mos9ic.c +++ b/src/spicelib/devices/mos9/mos9ic.c @@ -23,8 +23,8 @@ MOS9getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->MOS9nextModel) { - for(here = model->MOS9instances; here ; here = here->MOS9nextInstance) { + for( ; model ; model = MOS9nextModel(model)) { + for(here = MOS9instances(model); here ; here = here->MOS9nextInstance) { if(!here->MOS9icVBSGiven) { here->MOS9icVBS = diff --git a/src/spicelib/devices/mos9/mos9load.c b/src/spicelib/devices/mos9/mos9load.c index 79aa257b9..a8919a5d1 100644 --- a/src/spicelib/devices/mos9/mos9load.c +++ b/src/spicelib/devices/mos9/mos9load.c @@ -103,10 +103,10 @@ MOS9load(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the MOS9 device models */ next: - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { vt = CONSTKoverQ * here->MOS9temp; diff --git a/src/spicelib/devices/mos9/mos9noi.c b/src/spicelib/devices/mos9/mos9noi.c index 92b750870..8f300df71 100644 --- a/src/spicelib/devices/mos9/mos9noi.c +++ b/src/spicelib/devices/mos9/mos9noi.c @@ -46,8 +46,8 @@ MOS9noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->MOS9nextModel) { - for (inst=model->MOS9instances; inst != NULL; inst=inst->MOS9nextInstance) { + for (model=firstModel; model != NULL; model=MOS9nextModel(model)) { + for (inst=MOS9instances(model); inst != NULL; inst=inst->MOS9nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/mos9/mos9pzld.c b/src/spicelib/devices/mos9/mos9pzld.c index e12a1aa9d..991534f95 100644 --- a/src/spicelib/devices/mos9/mos9pzld.c +++ b/src/spicelib/devices/mos9/mos9pzld.c @@ -35,8 +35,8 @@ MOS9pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) double EffectiveLength; double EffectiveWidth; - for( ; model != NULL; model = model->MOS9nextModel) { - for(here = model->MOS9instances; here!= NULL; + for( ; model != NULL; model = MOS9nextModel(model)) { + for(here = MOS9instances(model); here!= NULL; here = here->MOS9nextInstance) { if (here->MOS9mode < 0) { diff --git a/src/spicelib/devices/mos9/mos9sacl.c b/src/spicelib/devices/mos9/mos9sacl.c index ddcf36e2b..cf661de59 100644 --- a/src/spicelib/devices/mos9/mos9sacl.c +++ b/src/spicelib/devices/mos9/mos9sacl.c @@ -129,8 +129,8 @@ MOS9sAcLoad(GENmodel *inModel, CKTcircuit *ckt) #endif /* SENSDEBUG */ info = ckt->CKTsenInfo; info->SENstatus = PERTURBATION; - for( ; model != NULL; model = model->MOS9nextModel) { - for(here = model->MOS9instances; here!= NULL; + for( ; model != NULL; model = MOS9nextModel(model)) { + for(here = MOS9instances(model); here!= NULL; here = here->MOS9nextInstance) { /* save the unperturbed values in the state vector */ diff --git a/src/spicelib/devices/mos9/mos9set.c b/src/spicelib/devices/mos9/mos9set.c index 78d4abe47..937ce7a80 100644 --- a/src/spicelib/devices/mos9/mos9set.c +++ b/src/spicelib/devices/mos9/mos9set.c @@ -28,7 +28,7 @@ MOS9setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the MOS9 device models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* perform model defaulting */ if(!model->MOS9typeGiven) { @@ -141,7 +141,7 @@ MOS9setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { CKTnode *tmpNode; @@ -266,9 +266,9 @@ MOS9unsetup(GENmodel *inModel, CKTcircuit *ckt) MOS9instance *here; for (model = (MOS9model *)inModel; model != NULL; - model = model->MOS9nextModel) + model = MOS9nextModel(model)) { - for (here = model->MOS9instances; here != NULL; + for (here = MOS9instances(model); here != NULL; here=here->MOS9nextInstance) { if (here->MOS9sNodePrime > 0 diff --git a/src/spicelib/devices/mos9/mos9sld.c b/src/spicelib/devices/mos9/mos9sld.c index 93cf9aab6..6343dbfd9 100644 --- a/src/spicelib/devices/mos9/mos9sld.c +++ b/src/spicelib/devices/mos9/mos9sld.c @@ -95,10 +95,10 @@ MOS9sLoad(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos9/mos9sprt.c b/src/spicelib/devices/mos9/mos9sprt.c index 2ec2069f1..009f928a9 100644 --- a/src/spicelib/devices/mos9/mos9sprt.c +++ b/src/spicelib/devices/mos9/mos9sprt.c @@ -25,12 +25,12 @@ MOS9sPrint(GENmodel *inModel, CKTcircuit *ckt) printf("LEVEL 9 MOSFETS (AG) -----------------\n"); /* loop through all the MOS9 models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { printf("Model name:%s\n",model->MOS9modName); /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { printf(" Instance name:%s\n",here->MOS9name); diff --git a/src/spicelib/devices/mos9/mos9sset.c b/src/spicelib/devices/mos9/mos9sset.c index 25684571f..c71c2469b 100644 --- a/src/spicelib/devices/mos9/mos9sset.c +++ b/src/spicelib/devices/mos9/mos9sset.c @@ -24,10 +24,10 @@ MOS9sSetup(SENstruct *info, GENmodel *inModel) MOS9instance *here; /* loop through all the models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { if(here->MOS9senParmNo){ diff --git a/src/spicelib/devices/mos9/mos9supd.c b/src/spicelib/devices/mos9/mos9supd.c index 0d8e8a7f7..28ccb20cb 100644 --- a/src/spicelib/devices/mos9/mos9supd.c +++ b/src/spicelib/devices/mos9/mos9supd.c @@ -50,10 +50,10 @@ MOS9sUpdate(GENmodel *inModel, CKTcircuit *ckt) dummy2 = 0; /* loop through all the MOS9 models */ - for( ; model != NULL; model = model->MOS9nextModel ) { + for( ; model != NULL; model = MOS9nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->MOS9instances; here != NULL ; + for (here = MOS9instances(model); here != NULL ; here=here->MOS9nextInstance) { #ifdef SENSDEBUG diff --git a/src/spicelib/devices/mos9/mos9temp.c b/src/spicelib/devices/mos9/mos9temp.c index 6c479128d..9a75e3f83 100644 --- a/src/spicelib/devices/mos9/mos9temp.c +++ b/src/spicelib/devices/mos9/mos9temp.c @@ -36,7 +36,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) double gmanew,gmaold; double ni_temp, nifact; /* loop through all the mosfet models */ - for( ; model != NULL; model = model->MOS9nextModel) { + for( ; model != NULL; model = MOS9nextModel(model)) { if(!model->MOS9tnomGiven) { model->MOS9tnom = ckt->CKTnomTemp; @@ -119,7 +119,7 @@ MOS9temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->MOS9instances; here!= NULL; + for(here = MOS9instances(model); here!= NULL; here = here->MOS9nextInstance) { double czbd; /* zero voltage bulk-drain capacitance */ diff --git a/src/spicelib/devices/mos9/mos9trun.c b/src/spicelib/devices/mos9/mos9trun.c index d5724dad7..bdc2e401b 100644 --- a/src/spicelib/devices/mos9/mos9trun.c +++ b/src/spicelib/devices/mos9/mos9trun.c @@ -19,8 +19,8 @@ MOS9trunc( MOS9model *model = (MOS9model *)inModel; MOS9instance *here; - for( ; model != NULL; model = model->MOS9nextModel) { - for(here=model->MOS9instances;here!=NULL;here = here->MOS9nextInstance){ + for( ; model != NULL; model = MOS9nextModel(model)) { + for(here=MOS9instances(model);here!=NULL;here = here->MOS9nextInstance){ CKTterr(here->MOS9qgs,ckt,timeStep); CKTterr(here->MOS9qgd,ckt,timeStep); diff --git a/src/spicelib/devices/nbjt/nbjtacld.c b/src/spicelib/devices/nbjt/nbjtacld.c index 454386194..4ad824177 100644 --- a/src/spicelib/devices/nbjt/nbjtacld.c +++ b/src/spicelib/devices/nbjt/nbjtacld.c @@ -30,7 +30,7 @@ NBJTacLoad(GENmodel *inModel, CKTcircuit *ckt) SPcomplex yIcVce, yIcVbe; double startTime; - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { FieldDepMobility = model->NBJTmodels->MODLfieldDepMobility; Srh = model->NBJTmodels->MODLsrh; Auger = model->NBJTmodels->MODLauger; @@ -39,7 +39,7 @@ NBJTacLoad(GENmodel *inModel, CKTcircuit *ckt) MobDeriv = model->NBJTmethods->METHmobDeriv; ONEacDebug = model->NBJToutputs->OUTPacDebug; - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjtdefs.h b/src/spicelib/devices/nbjt/nbjtdefs.h index b012eca48..357c02d1b 100644 --- a/src/spicelib/devices/nbjt/nbjtdefs.h +++ b/src/spicelib/devices/nbjt/nbjtdefs.h @@ -87,15 +87,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ diff --git a/src/spicelib/devices/nbjt/nbjtdest.c b/src/spicelib/devices/nbjt/nbjtdest.c index 48c7bd749..2acea8f35 100644 --- a/src/spicelib/devices/nbjt/nbjtdest.c +++ b/src/spicelib/devices/nbjt/nbjtdest.c @@ -21,8 +21,8 @@ NBJTdestroy(GENmodel **inModel) NBJTmodel *mod = *(NBJTmodel **) inModel; while (mod) { - NBJTmodel *next_mod = mod->NBJTnextModel; - NBJTinstance *inst = mod->NBJTinstances; + NBJTmodel *next_mod = NBJTnextModel(mod); + NBJTinstance *inst = NBJTinstances(mod); while (inst) { NBJTinstance *next_inst = inst->NBJTnextInstance; ONEdestroy(inst->NBJTpDevice); diff --git a/src/spicelib/devices/nbjt/nbjtdump.c b/src/spicelib/devices/nbjt/nbjtdump.c index 4cc762986..a09676ac0 100644 --- a/src/spicelib/devices/nbjt/nbjtdump.c +++ b/src/spicelib/devices/nbjt/nbjtdump.c @@ -55,9 +55,9 @@ NBJTdump(GENmodel *inModel, CKTcircuit *ckt) return; } - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { output = model->NBJToutputs; - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { if (inst->NBJTprintGiven) { @@ -155,9 +155,9 @@ NBJTacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) NG_IGNORE(ckt); - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { output = model->NBJToutputs; - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { if (output->OUTPstats) { diff --git a/src/spicelib/devices/nbjt/nbjtload.c b/src/spicelib/devices/nbjt/nbjtload.c index 627b55b03..1bd15f994 100644 --- a/src/spicelib/devices/nbjt/nbjtload.c +++ b/src/spicelib/devices/nbjt/nbjtload.c @@ -55,7 +55,7 @@ NBJTload(GENmodel *inModel, CKTcircuit *ckt) char *initStateName; /* loop through all the models */ - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { FieldDepMobility = model->NBJTmodels->MODLfieldDepMobility; Srh = model->NBJTmodels->MODLsrh; Auger = model->NBJTmodels->MODLauger; @@ -91,7 +91,7 @@ NBJTload(GENmodel *inModel, CKTcircuit *ckt) model->NBJTpInfo->intCoeff, deltaNorm); } /* loop through all the instances of the model */ - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { pDevice = inst->NBJTpDevice; diff --git a/src/spicelib/devices/nbjt/nbjtpzld.c b/src/spicelib/devices/nbjt/nbjtpzld.c index 3d73d1e17..3e379d6f6 100644 --- a/src/spicelib/devices/nbjt/nbjtpzld.c +++ b/src/spicelib/devices/nbjt/nbjtpzld.c @@ -31,7 +31,7 @@ NBJTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { FieldDepMobility = model->NBJTmodels->MODLfieldDepMobility; Srh = model->NBJTmodels->MODLsrh; Auger = model->NBJTmodels->MODLauger; @@ -40,7 +40,7 @@ NBJTpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) MobDeriv = model->NBJTmethods->METHmobDeriv; ONEacDebug = model->NBJToutputs->OUTPacDebug; - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjtset.c b/src/spicelib/devices/nbjt/nbjtset.c index 2d723c087..491da88cc 100644 --- a/src/spicelib/devices/nbjt/nbjtset.c +++ b/src/spicelib/devices/nbjt/nbjtset.c @@ -46,7 +46,7 @@ NBJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the diode models */ - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { if (!model->NBJTpInfo) { TSCALLOC(model->NBJTpInfo, 1, ONEtranInfo); } @@ -146,7 +146,7 @@ NBJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->NBJTdopTables = dopTableList; /* loop through all the instances of the model */ - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjttemp.c b/src/spicelib/devices/nbjt/nbjttemp.c index 5620fec2c..4848846e6 100644 --- a/src/spicelib/devices/nbjt/nbjttemp.c +++ b/src/spicelib/devices/nbjt/nbjttemp.c @@ -35,7 +35,7 @@ NBJTtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the bjt models */ - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { methods = model->NBJTmethods; models = model->NBJTmodels; options = model->NBJToptions; @@ -53,7 +53,7 @@ NBJTtemp(GENmodel *inModel, CKTcircuit *ckt) TempDepMobility = models->MODLtempDepMobility; ConcDepMobility = models->MODLconcDepMobility; - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt/nbjttrun.c b/src/spicelib/devices/nbjt/nbjttrun.c index 9c7c87300..8a5dee844 100644 --- a/src/spicelib/devices/nbjt/nbjttrun.c +++ b/src/spicelib/devices/nbjt/nbjttrun.c @@ -30,11 +30,11 @@ NBJTtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for (i = 0; i <= ckt->CKTmaxOrder; i++) { deltaNorm[i] = ckt->CKTdeltaOld[i] / TNorm; } - for (; model != NULL; model = model->NBJTnextModel) { + for (; model != NULL; model = NBJTnextModel(model)) { model->NBJTpInfo->order = ckt->CKTorder; model->NBJTpInfo->delta = deltaNorm; model->NBJTpInfo->lteCoeff = computeLTECoeff(model->NBJTpInfo); - for (inst = model->NBJTinstances; inst != NULL; + for (inst = NBJTinstances(model); inst != NULL; inst = inst->NBJTnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbjt2def.h b/src/spicelib/devices/nbjt2/nbjt2def.h index fcd58f839..b75e361ae 100644 --- a/src/spicelib/devices/nbjt2/nbjt2def.h +++ b/src/spicelib/devices/nbjt2/nbjt2def.h @@ -89,15 +89,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ diff --git a/src/spicelib/devices/nbjt2/nbt2acld.c b/src/spicelib/devices/nbjt2/nbt2acld.c index fae45ddd0..9ae40ad44 100644 --- a/src/spicelib/devices/nbjt2/nbt2acld.c +++ b/src/spicelib/devices/nbjt2/nbt2acld.c @@ -28,7 +28,7 @@ NBJT2acLoad(GENmodel *inModel, CKTcircuit *ckt) SPcomplex yIcVce, yIcVbe; double startTime; - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { FieldDepMobility = model->NBJT2models->MODLfieldDepMobility; TransDepMobility = model->NBJT2models->MODLtransDepMobility; SurfaceMobility = model->NBJT2models->MODLsurfaceMobility; @@ -40,7 +40,7 @@ NBJT2acLoad(GENmodel *inModel, CKTcircuit *ckt) MobDeriv = model->NBJT2methods->METHmobDeriv; TWOacDebug = model->NBJT2outputs->OUTPacDebug; - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2dest.c b/src/spicelib/devices/nbjt2/nbt2dest.c index 24853a594..edb5aac1e 100644 --- a/src/spicelib/devices/nbjt2/nbt2dest.c +++ b/src/spicelib/devices/nbjt2/nbt2dest.c @@ -21,8 +21,8 @@ NBJT2destroy(GENmodel **inModel) NBJT2model *mod = *(NBJT2model **) inModel; while (mod) { - NBJT2model *next_mod = mod->NBJT2nextModel; - NBJT2instance *inst = mod->NBJT2instances; + NBJT2model *next_mod = NBJT2nextModel(mod); + NBJT2instance *inst = NBJT2instances(mod); while (inst) { NBJT2instance *next_inst = inst->NBJT2nextInstance; TWOdestroy(inst->NBJT2pDevice); diff --git a/src/spicelib/devices/nbjt2/nbt2dump.c b/src/spicelib/devices/nbjt2/nbt2dump.c index 0954f401f..042da76ae 100644 --- a/src/spicelib/devices/nbjt2/nbt2dump.c +++ b/src/spicelib/devices/nbjt2/nbt2dump.c @@ -56,9 +56,9 @@ NBJT2dump(GENmodel *inModel, CKTcircuit *ckt) return; } - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { output = model->NBJT2outputs; - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { if (inst->NBJT2printGiven) { @@ -156,9 +156,9 @@ NBJT2acct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) NG_IGNORE(ckt); - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { output = model->NBJT2outputs; - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { if (output->OUTPstats) { diff --git a/src/spicelib/devices/nbjt2/nbt2load.c b/src/spicelib/devices/nbjt2/nbt2load.c index 93dcd5bed..2eecaceb3 100644 --- a/src/spicelib/devices/nbjt2/nbt2load.c +++ b/src/spicelib/devices/nbjt2/nbt2load.c @@ -55,7 +55,7 @@ NBJT2load(GENmodel *inModel, CKTcircuit *ckt) char *initStateName; /* loop through all the models */ - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { FieldDepMobility = model->NBJT2models->MODLfieldDepMobility; TransDepMobility = model->NBJT2models->MODLtransDepMobility; SurfaceMobility = model->NBJT2models->MODLsurfaceMobility; @@ -94,7 +94,7 @@ NBJT2load(GENmodel *inModel, CKTcircuit *ckt) model->NBJT2pInfo->intCoeff, deltaNorm); } /* loop through all the instances of the model */ - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { pDevice = inst->NBJT2pDevice; diff --git a/src/spicelib/devices/nbjt2/nbt2pzld.c b/src/spicelib/devices/nbjt2/nbt2pzld.c index 2fddc07f5..d5d086048 100644 --- a/src/spicelib/devices/nbjt2/nbt2pzld.c +++ b/src/spicelib/devices/nbjt2/nbt2pzld.c @@ -25,7 +25,7 @@ NBJT2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { FieldDepMobility = model->NBJT2models->MODLfieldDepMobility; TransDepMobility = model->NBJT2models->MODLtransDepMobility; SurfaceMobility = model->NBJT2models->MODLsurfaceMobility; @@ -37,7 +37,7 @@ NBJT2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) MobDeriv = model->NBJT2methods->METHmobDeriv; TWOacDebug = model->NBJT2outputs->OUTPacDebug; - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2set.c b/src/spicelib/devices/nbjt2/nbt2set.c index c0b584da5..d0eba4e5d 100644 --- a/src/spicelib/devices/nbjt2/nbt2set.c +++ b/src/spicelib/devices/nbjt2/nbt2set.c @@ -50,7 +50,7 @@ NBJT2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the models */ - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { if (!model->NBJT2pInfo) { TSCALLOC(model->NBJT2pInfo, 1, TWOtranInfo); } @@ -162,7 +162,7 @@ NBJT2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->NBJT2dopTables = dopTableList; /* loop through all the instances of the model */ - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2temp.c b/src/spicelib/devices/nbjt2/nbt2temp.c index e0b52b08a..cac117208 100644 --- a/src/spicelib/devices/nbjt2/nbt2temp.c +++ b/src/spicelib/devices/nbjt2/nbt2temp.c @@ -33,7 +33,7 @@ NBJT2temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the models */ - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { methods = model->NBJT2methods; models = model->NBJT2models; options = model->NBJT2options; @@ -55,7 +55,7 @@ NBJT2temp(GENmodel *inModel, CKTcircuit *ckt) MatchingMobility = models->MODLmatchingMobility; OneCarrier = methods->METHoneCarrier; - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/nbjt2/nbt2trun.c b/src/spicelib/devices/nbjt2/nbt2trun.c index a9e02ff2a..a57887d28 100644 --- a/src/spicelib/devices/nbjt2/nbt2trun.c +++ b/src/spicelib/devices/nbjt2/nbt2trun.c @@ -32,12 +32,12 @@ NBJT2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) deltaNorm[i] = ckt->CKTdeltaOld[i] / TNorm; } - for (; model != NULL; model = model->NBJT2nextModel) { + for (; model != NULL; model = NBJT2nextModel(model)) { OneCarrier = model->NBJT2methods->METHoneCarrier; model->NBJT2pInfo->order = ckt->CKTorder; model->NBJT2pInfo->delta = deltaNorm; model->NBJT2pInfo->lteCoeff = computeLTECoeff(model->NBJT2pInfo); - for (inst = model->NBJT2instances; inst != NULL; + for (inst = NBJT2instances(model); inst != NULL; inst = inst->NBJT2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/ndev/ndevaccept.c b/src/spicelib/devices/ndev/ndevaccept.c index 88c1da922..43288c1a2 100644 --- a/src/spicelib/devices/ndev/ndevaccept.c +++ b/src/spicelib/devices/ndev/ndevaccept.c @@ -20,10 +20,10 @@ int NDEVaccept(CKTcircuit *ckt, GENmodel *inModel) NDEVmodel *model = (NDEVmodel *)inModel; NDEVinstance *here; /* loop through all the ndev models */ - for( ; model != NULL; model = model->NDEVnextModel ) + for( ; model != NULL; model = NDEVnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->NDEVinstances; here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) { /* set ckt accept_flag */ here->CKTInfo.DEV_CALL = NDEV_ACCEPT; @@ -45,8 +45,8 @@ int NDEVconvTest(GENmodel *inModel, CKTcircuit *ckt) NDEVmodel *model = (NDEVmodel *)inModel; NDEVinstance *here; - for( ; model != NULL; model = model->NDEVnextModel) { - for(here=model->NDEVinstances;here!=NULL;here = here->NDEVnextInstance){ + for( ; model != NULL; model = NDEVnextModel(model)) { + for(here=NDEVinstances(model);here!=NULL;here = here->NDEVnextInstance){ /* * get convergence information from ndev diff --git a/src/spicelib/devices/ndev/ndevdefs.h b/src/spicelib/devices/ndev/ndevdefs.h index 2415cb9c0..798c4986a 100644 --- a/src/spicelib/devices/ndev/ndevdefs.h +++ b/src/spicelib/devices/ndev/ndevdefs.h @@ -43,17 +43,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 */ +typedef struct sNDEVmodel { + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/ndev/ndevdest.c b/src/spicelib/devices/ndev/ndevdest.c index 6b1774e30..b10f773bf 100644 --- a/src/spicelib/devices/ndev/ndevdest.c +++ b/src/spicelib/devices/ndev/ndevdest.c @@ -15,8 +15,8 @@ NDEVdestroy(GENmodel **inModel) NDEVmodel *mod = *(NDEVmodel **) inModel; while (mod) { - NDEVmodel *next_mod = mod->NDEVnextModel; - NDEVinstance *inst = mod->NDEVinstances; + NDEVmodel *next_mod = NDEVnextModel(mod); + NDEVinstance *inst = NDEVinstances(mod); while (inst) { NDEVinstance *next_inst = inst->NDEVnextInstance; FREE(inst); diff --git a/src/spicelib/devices/ndev/ndevload.c b/src/spicelib/devices/ndev/ndevload.c index eb76fa327..1e69d9a77 100644 --- a/src/spicelib/devices/ndev/ndevload.c +++ b/src/spicelib/devices/ndev/ndevload.c @@ -23,11 +23,11 @@ NDEVload(GENmodel * inModel, CKTcircuit * ckt) int i,j; /* loop through all the ndev models */ - for( ; model != NULL; model = model->NDEVnextModel ) + for( ; model != NULL; model = NDEVnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->NDEVinstances; here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) { /* sent ckt information to device simulator */ here->CKTInfo.DEV_CALL = NDEV_LOAD; @@ -50,11 +50,11 @@ NDEVload(GENmodel * inModel, CKTcircuit * ckt) /* loop through all the ndev models */ - for(model = (NDEVmodel *)inModel; model != NULL; model = model->NDEVnextModel ) + for(model = (NDEVmodel *)inModel; model != NULL; model = NDEVnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->NDEVinstances; here != NULL ; here=here->NDEVnextInstance) + for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) { /* reveive terminal current and conductional matrix from device simulator */ for(i=0;iterm;i++) @@ -84,8 +84,8 @@ int NDEVgetic(GENmodel *inModel, CKTcircuit *ckt) printf("set ic\n"); - for( ; model ; model = model->NDEVnextModel) { - for(here = model->NDEVinstances; here ; here = here->NDEVnextInstance) { + for( ; model ; model = NDEVnextModel(model)) { + for(here = NDEVinstances(model); here ; here = here->NDEVnextInstance) { /* if(!here->DIOinitCondGiven) { here->DIOinitCond = diff --git a/src/spicelib/devices/ndev/ndevset.c b/src/spicelib/devices/ndev/ndevset.c index 2b55ae89e..a2b3d194f 100644 --- a/src/spicelib/devices/ndev/ndevset.c +++ b/src/spicelib/devices/ndev/ndevset.c @@ -36,13 +36,13 @@ int NDEVsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states NG_IGNORE(states); /* loop through all the ndev models */ - for( ; model != NULL; model = model->NDEVnextModel ) { + for( ; model != NULL; model = NDEVnextModel(model) ) { /* connect to remote device simulator */ if(NDEVmodelConnect(model)) return E_PRIVATE; /* loop through all the instances of the model */ - for (here = model->NDEVinstances; here != NULL ; + for (here = NDEVinstances(model); here != NULL ; here=here->NDEVnextInstance) { here->Ndevinfo.term = here->term; diff --git a/src/spicelib/devices/numd/numdacld.c b/src/spicelib/devices/numd/numdacld.c index 5bbc0d470..c93991a5f 100644 --- a/src/spicelib/devices/numd/numdacld.c +++ b/src/spicelib/devices/numd/numdacld.c @@ -30,7 +30,7 @@ NUMDacLoad(GENmodel *inModel, CKTcircuit *ckt) double startTime; /* loop through all the diode models */ - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { FieldDepMobility = model->NUMDmodels->MODLfieldDepMobility; Srh = model->NUMDmodels->MODLsrh; Auger = model->NUMDmodels->MODLauger; @@ -39,7 +39,7 @@ NUMDacLoad(GENmodel *inModel, CKTcircuit *ckt) MobDeriv = model->NUMDmethods->METHmobDeriv; ONEacDebug = model->NUMDoutputs->OUTPacDebug; - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numddefs.h b/src/spicelib/devices/numd/numddefs.h index 080d49aaf..17bca5261 100644 --- a/src/spicelib/devices/numd/numddefs.h +++ b/src/spicelib/devices/numd/numddefs.h @@ -68,15 +68,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ diff --git a/src/spicelib/devices/numd/numddest.c b/src/spicelib/devices/numd/numddest.c index b3422a8ee..437c33481 100644 --- a/src/spicelib/devices/numd/numddest.c +++ b/src/spicelib/devices/numd/numddest.c @@ -21,8 +21,8 @@ NUMDdestroy(GENmodel **inModel) NUMDmodel *mod = *(NUMDmodel **) inModel; while (mod) { - NUMDmodel *next_mod = mod->NUMDnextModel; - NUMDinstance *inst = mod->NUMDinstances; + NUMDmodel *next_mod = NUMDnextModel(mod); + NUMDinstance *inst = NUMDinstances(mod); while (inst) { NUMDinstance *next_inst = inst->NUMDnextInstance; ONEdestroy(inst->NUMDpDevice); diff --git a/src/spicelib/devices/numd/numddump.c b/src/spicelib/devices/numd/numddump.c index 0b55e6992..4b53f08b8 100644 --- a/src/spicelib/devices/numd/numddump.c +++ b/src/spicelib/devices/numd/numddump.c @@ -55,9 +55,9 @@ NUMDdump(GENmodel *inModel, CKTcircuit *ckt) return; } - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { output = model->NUMDoutputs; - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { if (inst->NUMDprintGiven) { @@ -142,9 +142,9 @@ NUMDacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) NG_IGNORE(ckt); - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { output = model->NUMDoutputs; - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { if (output->OUTPstats) { diff --git a/src/spicelib/devices/numd/numdload.c b/src/spicelib/devices/numd/numdload.c index aabb6de61..7cde49811 100644 --- a/src/spicelib/devices/numd/numdload.c +++ b/src/spicelib/devices/numd/numdload.c @@ -52,7 +52,7 @@ NUMDload(GENmodel *inModel, CKTcircuit *ckt) char *initStateName; /* loop through all the diode models */ - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { /* Do model things */ FieldDepMobility = model->NUMDmodels->MODLfieldDepMobility; Srh = model->NUMDmodels->MODLsrh; @@ -89,7 +89,7 @@ NUMDload(GENmodel *inModel, CKTcircuit *ckt) model->NUMDpInfo->intCoeff, deltaNorm); } /* Now do instance things */ - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { pDevice = inst->NUMDpDevice; diff --git a/src/spicelib/devices/numd/numdpzld.c b/src/spicelib/devices/numd/numdpzld.c index 695c9b20c..de3f238e6 100644 --- a/src/spicelib/devices/numd/numdpzld.c +++ b/src/spicelib/devices/numd/numdpzld.c @@ -26,7 +26,7 @@ NUMDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); /* loop through all the diode models */ - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { FieldDepMobility = model->NUMDmodels->MODLfieldDepMobility; Srh = model->NUMDmodels->MODLsrh; Auger = model->NUMDmodels->MODLauger; @@ -35,7 +35,7 @@ NUMDpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) MobDeriv = model->NUMDmethods->METHmobDeriv; ONEacDebug = model->NUMDoutputs->OUTPacDebug; - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numdset.c b/src/spicelib/devices/numd/numdset.c index 310db3045..d441fc205 100644 --- a/src/spicelib/devices/numd/numdset.c +++ b/src/spicelib/devices/numd/numdset.c @@ -47,7 +47,7 @@ NUMDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the models */ - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { if (!model->NUMDpInfo) { TSCALLOC(model->NUMDpInfo, 1, ONEtranInfo); } @@ -141,7 +141,7 @@ NUMDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->NUMDdopTables = dopTableList; /* loop through all the instances of the model */ - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numdtemp.c b/src/spicelib/devices/numd/numdtemp.c index d31d20acd..b1b3fd9dd 100644 --- a/src/spicelib/devices/numd/numdtemp.c +++ b/src/spicelib/devices/numd/numdtemp.c @@ -32,7 +32,7 @@ NUMDtemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the diode models */ - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { methods = model->NUMDmethods; models = model->NUMDmodels; options = model->NUMDoptions; @@ -50,7 +50,7 @@ NUMDtemp(GENmodel *inModel, CKTcircuit *ckt) TempDepMobility = models->MODLtempDepMobility; ConcDepMobility = models->MODLconcDepMobility; - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd/numdtrun.c b/src/spicelib/devices/numd/numdtrun.c index 9e8e20085..cd4f4388b 100644 --- a/src/spicelib/devices/numd/numdtrun.c +++ b/src/spicelib/devices/numd/numdtrun.c @@ -26,11 +26,11 @@ NUMDtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) for (i = 0; i <= ckt->CKTmaxOrder; i++) { deltaNorm[i] = ckt->CKTdeltaOld[i] / TNorm; } - for (; model != NULL; model = model->NUMDnextModel) { + for (; model != NULL; model = NUMDnextModel(model)) { model->NUMDpInfo->order = ckt->CKTorder; model->NUMDpInfo->delta = deltaNorm; model->NUMDpInfo->lteCoeff = computeLTECoeff(model->NUMDpInfo); - for (inst = model->NUMDinstances; inst != NULL; + for (inst = NUMDinstances(model); inst != NULL; inst = inst->NUMDnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2acld.c b/src/spicelib/devices/numd2/nud2acld.c index 4c61c03cf..a3e51dca5 100644 --- a/src/spicelib/devices/numd2/nud2acld.c +++ b/src/spicelib/devices/numd2/nud2acld.c @@ -29,7 +29,7 @@ NUMD2acLoad(GENmodel *inModel, CKTcircuit *ckt) double startTime; /* loop through all the diode models */ - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { FieldDepMobility = model->NUMD2models->MODLfieldDepMobility; TransDepMobility = model->NUMD2models->MODLtransDepMobility; SurfaceMobility = model->NUMD2models->MODLsurfaceMobility; @@ -41,7 +41,7 @@ NUMD2acLoad(GENmodel *inModel, CKTcircuit *ckt) MobDeriv = model->NUMD2methods->METHmobDeriv; TWOacDebug = model->NUMD2outputs->OUTPacDebug; - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2dest.c b/src/spicelib/devices/numd2/nud2dest.c index 1ad97f0bc..83a3edb72 100644 --- a/src/spicelib/devices/numd2/nud2dest.c +++ b/src/spicelib/devices/numd2/nud2dest.c @@ -22,8 +22,8 @@ NUMD2destroy(GENmodel **inModel) NUMD2model *mod = *(NUMD2model **) inModel; while (mod) { - NUMD2model *next_mod = mod->NUMD2nextModel; - NUMD2instance *inst = mod->NUMD2instances; + NUMD2model *next_mod = NUMD2nextModel(mod); + NUMD2instance *inst = NUMD2instances(mod); while (inst) { NUMD2instance *next_inst = inst->NUMD2nextInstance; TWOdestroy(inst->NUMD2pDevice); diff --git a/src/spicelib/devices/numd2/nud2dump.c b/src/spicelib/devices/numd2/nud2dump.c index b2ddf1925..aecc1cc6a 100644 --- a/src/spicelib/devices/numd2/nud2dump.c +++ b/src/spicelib/devices/numd2/nud2dump.c @@ -56,9 +56,9 @@ NUMD2dump(GENmodel *inModel, CKTcircuit *ckt) return; } - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { output = model->NUMD2outputs; - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { if (inst->NUMD2printGiven) { @@ -143,9 +143,9 @@ NUMD2acct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) NG_IGNORE(ckt); - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { output = model->NUMD2outputs; - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { if (output->OUTPstats) { diff --git a/src/spicelib/devices/numd2/nud2load.c b/src/spicelib/devices/numd2/nud2load.c index 83bdd59b9..4681fb57b 100644 --- a/src/spicelib/devices/numd2/nud2load.c +++ b/src/spicelib/devices/numd2/nud2load.c @@ -50,7 +50,7 @@ NUMD2load(GENmodel *inModel, CKTcircuit *ckt) char *initStateName; /* loop through all the diode models */ - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { FieldDepMobility = model->NUMD2models->MODLfieldDepMobility; TransDepMobility = model->NUMD2models->MODLtransDepMobility; SurfaceMobility = model->NUMD2models->MODLsurfaceMobility; @@ -90,7 +90,7 @@ NUMD2load(GENmodel *inModel, CKTcircuit *ckt) model->NUMD2pInfo->intCoeff, deltaNorm); } /* loop through all the instances of the model */ - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { pDevice = inst->NUMD2pDevice; diff --git a/src/spicelib/devices/numd2/nud2pzld.c b/src/spicelib/devices/numd2/nud2pzld.c index 3f7febdc1..4e7c5b934 100644 --- a/src/spicelib/devices/numd2/nud2pzld.c +++ b/src/spicelib/devices/numd2/nud2pzld.c @@ -25,7 +25,7 @@ NUMD2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); /* loop through all the diode models */ - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { FieldDepMobility = model->NUMD2models->MODLfieldDepMobility; TransDepMobility = model->NUMD2models->MODLtransDepMobility; SurfaceMobility = model->NUMD2models->MODLsurfaceMobility; @@ -37,7 +37,7 @@ NUMD2pzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) MobDeriv = model->NUMD2methods->METHmobDeriv; TWOacDebug = model->NUMD2outputs->OUTPacDebug; - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2set.c b/src/spicelib/devices/numd2/nud2set.c index 126696d41..35a362364 100644 --- a/src/spicelib/devices/numd2/nud2set.c +++ b/src/spicelib/devices/numd2/nud2set.c @@ -49,7 +49,7 @@ NUMD2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /* loop through all the models */ - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { if (!model->NUMD2pInfo) { TSCALLOC(model->NUMD2pInfo, 1, TWOtranInfo); } @@ -161,7 +161,7 @@ NUMD2setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->NUMD2dopTables = dopTableList; /* loop through all the instances of the model */ - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2temp.c b/src/spicelib/devices/numd2/nud2temp.c index bf68328fa..c09edd109 100644 --- a/src/spicelib/devices/numd2/nud2temp.c +++ b/src/spicelib/devices/numd2/nud2temp.c @@ -32,7 +32,7 @@ NUMD2temp(GENmodel *inModel, CKTcircuit *ckt) double startTime; /* loop through all the models */ - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { methods = model->NUMD2methods; models = model->NUMD2models; options = model->NUMD2options; @@ -53,7 +53,7 @@ NUMD2temp(GENmodel *inModel, CKTcircuit *ckt) MatchingMobility = models->MODLmatchingMobility; OneCarrier = methods->METHoneCarrier; - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/nud2trun.c b/src/spicelib/devices/numd2/nud2trun.c index 4443861fd..e52063070 100644 --- a/src/spicelib/devices/numd2/nud2trun.c +++ b/src/spicelib/devices/numd2/nud2trun.c @@ -26,12 +26,12 @@ NUMD2trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) deltaNorm[i] = ckt->CKTdeltaOld[i] / TNorm; } - for (; model != NULL; model = model->NUMD2nextModel) { + for (; model != NULL; model = NUMD2nextModel(model)) { OneCarrier = model->NUMD2methods->METHoneCarrier; model->NUMD2pInfo->order = ckt->CKTorder; model->NUMD2pInfo->delta = deltaNorm; model->NUMD2pInfo->lteCoeff = computeLTECoeff(model->NUMD2pInfo); - for (inst = model->NUMD2instances; inst != NULL; + for (inst = NUMD2instances(model); inst != NULL; inst = inst->NUMD2nextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numd2/numd2def.h b/src/spicelib/devices/numd2/numd2def.h index 3aeffa568..169371a65 100644 --- a/src/spicelib/devices/numd2/numd2def.h +++ b/src/spicelib/devices/numd2/numd2def.h @@ -70,15 +70,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ diff --git a/src/spicelib/devices/numos/nummacld.c b/src/spicelib/devices/numos/nummacld.c index 174d89f93..fa62cd174 100644 --- a/src/spicelib/devices/numos/nummacld.c +++ b/src/spicelib/devices/numos/nummacld.c @@ -27,7 +27,7 @@ NUMOSacLoad(GENmodel *inModel, CKTcircuit *ckt) struct mosAdmittances yAc; double startTime; - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { FieldDepMobility = model->NUMOSmodels->MODLfieldDepMobility; TransDepMobility = model->NUMOSmodels->MODLtransDepMobility; SurfaceMobility = model->NUMOSmodels->MODLsurfaceMobility; @@ -39,7 +39,7 @@ NUMOSacLoad(GENmodel *inModel, CKTcircuit *ckt) MobDeriv = model->NUMOSmethods->METHmobDeriv; TWOacDebug = model->NUMOSoutputs->OUTPacDebug; - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummdest.c b/src/spicelib/devices/numos/nummdest.c index 887208312..56124c19c 100644 --- a/src/spicelib/devices/numos/nummdest.c +++ b/src/spicelib/devices/numos/nummdest.c @@ -21,8 +21,8 @@ NUMOSdestroy(GENmodel **inModel) NUMOSmodel *mod = *(NUMOSmodel **) inModel; while (mod) { - NUMOSmodel *next_mod = mod->NUMOSnextModel; - NUMOSinstance *inst = mod->NUMOSinstances; + NUMOSmodel *next_mod = NUMOSnextModel(mod); + NUMOSinstance *inst = NUMOSinstances(mod); while (inst) { NUMOSinstance *next_inst = inst->NUMOSnextInstance; TWOdestroy(inst->NUMOSpDevice); diff --git a/src/spicelib/devices/numos/nummdump.c b/src/spicelib/devices/numos/nummdump.c index 0d96526dd..fabcccefb 100644 --- a/src/spicelib/devices/numos/nummdump.c +++ b/src/spicelib/devices/numos/nummdump.c @@ -56,9 +56,9 @@ NUMOSdump(GENmodel *inModel, CKTcircuit *ckt) return; } - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { output = model->NUMOSoutputs; - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { if (inst->NUMOSprintGiven) { @@ -157,9 +157,9 @@ NUMOSacct(GENmodel *inModel, CKTcircuit *ckt, FILE *file) NG_IGNORE(ckt); - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { output = model->NUMOSoutputs; - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { if (output->OUTPstats) { diff --git a/src/spicelib/devices/numos/nummload.c b/src/spicelib/devices/numos/nummload.c index 1502a226e..b04eb48d8 100644 --- a/src/spicelib/devices/numos/nummload.c +++ b/src/spicelib/devices/numos/nummload.c @@ -52,7 +52,7 @@ NUMOSload(GENmodel *inModel, CKTcircuit *ckt) char *initStateName; /* loop through all the models */ - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { FieldDepMobility = model->NUMOSmodels->MODLfieldDepMobility; TransDepMobility = model->NUMOSmodels->MODLtransDepMobility; SurfaceMobility = model->NUMOSmodels->MODLsurfaceMobility; @@ -91,7 +91,7 @@ NUMOSload(GENmodel *inModel, CKTcircuit *ckt) model->NUMOSpInfo->intCoeff, deltaNorm); } /* loop through all the instances of the model */ - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { pDevice = inst->NUMOSpDevice; diff --git a/src/spicelib/devices/numos/nummpzld.c b/src/spicelib/devices/numos/nummpzld.c index f5cd3c433..b02a90506 100644 --- a/src/spicelib/devices/numos/nummpzld.c +++ b/src/spicelib/devices/numos/nummpzld.c @@ -24,7 +24,7 @@ NUMOSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { FieldDepMobility = model->NUMOSmodels->MODLfieldDepMobility; TransDepMobility = model->NUMOSmodels->MODLtransDepMobility; SurfaceMobility = model->NUMOSmodels->MODLsurfaceMobility; @@ -36,7 +36,7 @@ NUMOSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) MobDeriv = model->NUMOSmethods->METHmobDeriv; TWOacDebug = model->NUMOSoutputs->OUTPacDebug; - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummset.c b/src/spicelib/devices/numos/nummset.c index c4c1d26c1..5ed80ce75 100644 --- a/src/spicelib/devices/numos/nummset.c +++ b/src/spicelib/devices/numos/nummset.c @@ -48,7 +48,7 @@ NUMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) double startTime; /* loop through all the models */ - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { if (!model->NUMOSpInfo) { TSCALLOC(model->NUMOSpInfo, 1, TWOtranInfo); } @@ -160,7 +160,7 @@ NUMOSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) model->NUMOSdopTables = dopTableList; /* loop through all the instances of the model */ - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummtemp.c b/src/spicelib/devices/numos/nummtemp.c index 7765d5fa2..84990f999 100644 --- a/src/spicelib/devices/numos/nummtemp.c +++ b/src/spicelib/devices/numos/nummtemp.c @@ -33,7 +33,7 @@ NUMOStemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the models */ - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { methods = model->NUMOSmethods; models = model->NUMOSmodels; options = model->NUMOSoptions; @@ -54,7 +54,7 @@ NUMOStemp(GENmodel *inModel, CKTcircuit *ckt) MatchingMobility = models->MODLmatchingMobility; OneCarrier = methods->METHoneCarrier; - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/nummtrun.c b/src/spicelib/devices/numos/nummtrun.c index b44bd04f5..87c1ddbe7 100644 --- a/src/spicelib/devices/numos/nummtrun.c +++ b/src/spicelib/devices/numos/nummtrun.c @@ -32,12 +32,12 @@ NUMOStrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) deltaNorm[i] = ckt->CKTdeltaOld[i] / TNorm; } - for (; model != NULL; model = model->NUMOSnextModel) { + for (; model != NULL; model = NUMOSnextModel(model)) { OneCarrier = model->NUMOSmethods->METHoneCarrier; model->NUMOSpInfo->order = ckt->CKTorder; model->NUMOSpInfo->delta = deltaNorm; model->NUMOSpInfo->lteCoeff = computeLTECoeff(model->NUMOSpInfo); - for (inst = model->NUMOSinstances; inst != NULL; + for (inst = NUMOSinstances(model); inst != NULL; inst = inst->NUMOSnextInstance) { startTime = SPfrontEnd->IFseconds(); diff --git a/src/spicelib/devices/numos/numosdef.h b/src/spicelib/devices/numos/numosdef.h index 18de61139..fb24bdcc4 100644 --- a/src/spicelib/devices/numos/numosdef.h +++ b/src/spicelib/devices/numos/numosdef.h @@ -118,12 +118,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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 */ diff --git a/src/spicelib/devices/res/resdefs.h b/src/spicelib/devices/res/resdefs.h index b92922bde..fb92819f3 100644 --- a/src/spicelib/devices/res/resdefs.h +++ b/src/spicelib/devices/res/resdefs.h @@ -92,14 +92,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/res/resdest.c b/src/spicelib/devices/res/resdest.c index 7e227b7d7..4f9bb9937 100644 --- a/src/spicelib/devices/res/resdest.c +++ b/src/spicelib/devices/res/resdest.c @@ -14,8 +14,8 @@ RESdestroy(GENmodel **inModel) RESmodel *mod = *(RESmodel **) inModel; while (mod) { - RESmodel *next_mod = mod->RESnextModel; - RESinstance *inst = mod->RESinstances; + RESmodel *next_mod = RESnextModel(mod); + RESinstance *inst = RESinstances(mod); while (inst) { RESinstance *next_inst = inst->RESnextInstance; FREE(inst); diff --git a/src/spicelib/devices/res/resload.c b/src/spicelib/devices/res/resload.c index 20463235f..600546415 100644 --- a/src/spicelib/devices/res/resload.c +++ b/src/spicelib/devices/res/resload.c @@ -18,11 +18,11 @@ RESload(GENmodel *inModel, CKTcircuit *ckt) RESmodel *model = (RESmodel *)inModel; /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { RESinstance *here; /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here = here->RESnextInstance) { here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) - @@ -49,11 +49,11 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { RESinstance *here; /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here = here->RESnextInstance) { if (here->RESacresGiven) diff --git a/src/spicelib/devices/res/resnoise.c b/src/spicelib/devices/res/resnoise.c index defdb1ceb..2e7aa5033 100644 --- a/src/spicelib/devices/res/resnoise.c +++ b/src/spicelib/devices/res/resnoise.c @@ -52,8 +52,8 @@ RESnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, }; - for (model = firstModel; model != NULL; model = model->RESnextModel) { - for (inst = model->RESinstances; inst != NULL; + for (model = firstModel; model != NULL; model = RESnextModel(model)) { + for (inst = RESinstances(model); inst != NULL; inst = inst->RESnextInstance) { if(!inst->RESnoisy) continue; /* Quiet resistors are skipped */ diff --git a/src/spicelib/devices/res/respzld.c b/src/spicelib/devices/res/respzld.c index d3a2c1518..7462c93a4 100644 --- a/src/spicelib/devices/res/respzld.c +++ b/src/spicelib/devices/res/respzld.c @@ -27,10 +27,10 @@ RESpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { if (here->RESacresGiven) diff --git a/src/spicelib/devices/res/ressacl.c b/src/spicelib/devices/res/ressacl.c index 9c33df955..cb92d1790 100644 --- a/src/spicelib/devices/res/ressacl.c +++ b/src/spicelib/devices/res/ressacl.c @@ -25,10 +25,10 @@ RESsAcLoad(GENmodel *inModel, CKTcircuit *ckt) double ivalue; /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { if(here->RESsenParmNo){ diff --git a/src/spicelib/devices/res/ressetup.c b/src/spicelib/devices/res/ressetup.c index 412467c9d..5b57acf70 100644 --- a/src/spicelib/devices/res/ressetup.c +++ b/src/spicelib/devices/res/ressetup.c @@ -23,7 +23,7 @@ RESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) NG_IGNORE(ckt); /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* Default Value Processing for Resistor Models */ if(!model->REStnomGiven) model->REStnom = ckt->CKTnomTemp; @@ -45,7 +45,7 @@ RESsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) model->RESbv_max = 1e99; /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { if(!here->RESwidthGiven) here->RESwidth = model->RESdefWidth; diff --git a/src/spicelib/devices/res/ressload.c b/src/spicelib/devices/res/ressload.c index 56976cee7..2b90f43e7 100644 --- a/src/spicelib/devices/res/ressload.c +++ b/src/spicelib/devices/res/ressload.c @@ -23,10 +23,10 @@ RESsLoad(GENmodel *inModel, CKTcircuit *ckt) RESinstance *here; /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { if(here->RESsenParmNo){ diff --git a/src/spicelib/devices/res/ressoachk.c b/src/spicelib/devices/res/ressoachk.c index 846a7fc3d..46b425756 100644 --- a/src/spicelib/devices/res/ressoachk.c +++ b/src/spicelib/devices/res/ressoachk.c @@ -28,9 +28,9 @@ RESsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->RESnextModel) { + for (; model; model = RESnextModel(model)) { - for (here = model->RESinstances; here; here = here->RESnextInstance) { + for (here = RESinstances(model); here; here = here->RESnextInstance) { vr = fabs(ckt->CKTrhsOld [here->RESposNode] - ckt->CKTrhsOld [here->RESnegNode]); diff --git a/src/spicelib/devices/res/ressprt.c b/src/spicelib/devices/res/ressprt.c index cec815e44..77093d126 100644 --- a/src/spicelib/devices/res/ressprt.c +++ b/src/spicelib/devices/res/ressprt.c @@ -24,12 +24,12 @@ RESsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("RESISTORS-----------------\n"); /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { printf("Model name:%s\n",model->RESmodName); /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { printf(" Instance name:%s\n",here->RESname); diff --git a/src/spicelib/devices/res/ressset.c b/src/spicelib/devices/res/ressset.c index f8b61a3d8..b7c1946c6 100644 --- a/src/spicelib/devices/res/ressset.c +++ b/src/spicelib/devices/res/ressset.c @@ -23,10 +23,10 @@ RESsSetup(SENstruct *info, GENmodel *inModel) RESinstance *here; /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { if(here->RESsenParmNo){ diff --git a/src/spicelib/devices/res/restemp.c b/src/spicelib/devices/res/restemp.c index 5ee91b792..9b26d8fa8 100644 --- a/src/spicelib/devices/res/restemp.c +++ b/src/spicelib/devices/res/restemp.c @@ -24,10 +24,10 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the resistor models */ - for( ; model != NULL; model = model->RESnextModel ) { + for( ; model != NULL; model = RESnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->RESinstances; here != NULL ; + for (here = RESinstances(model); here != NULL ; here=here->RESnextInstance) { /* Default Value Processing for Resistor Instance */ diff --git a/src/spicelib/devices/soi3/soi3acld.c b/src/spicelib/devices/soi3/soi3acld.c index 1997798f9..633ab1570 100644 --- a/src/spicelib/devices/soi3/soi3acld.c +++ b/src/spicelib/devices/soi3/soi3acld.c @@ -75,9 +75,9 @@ SOI3acLoad(GENmodel *inModel, CKTcircuit *ckt) omega = ckt->CKTomega; - for( ; model != NULL; model = model->SOI3nextModel) + for( ; model != NULL; model = SOI3nextModel(model)) { - for(here = model->SOI3instances; here!= NULL; + for(here = SOI3instances(model); here!= NULL; here = here->SOI3nextInstance) { diff --git a/src/spicelib/devices/soi3/soi3conv.c b/src/spicelib/devices/soi3/soi3conv.c index 9c1753fb8..bc455e68b 100644 --- a/src/spicelib/devices/soi3/soi3conv.c +++ b/src/spicelib/devices/soi3/soi3conv.c @@ -57,8 +57,8 @@ SOI3convTest(GENmodel *inModel, CKTcircuit *ckt) /* debug stuff */ /* FILE *fp,*fopen(); */ - for( ; model != NULL; model = model->SOI3nextModel) { - for(here = model->SOI3instances; here!= NULL; + for( ; model != NULL; model = SOI3nextModel(model)) { + for(here = SOI3instances(model); here!= NULL; here = here->SOI3nextInstance) { vbs = model->SOI3type * ( diff --git a/src/spicelib/devices/soi3/soi3defs.h b/src/spicelib/devices/soi3/soi3defs.h index 24cf30fb6..d111c885d 100644 --- a/src/spicelib/devices/soi3/soi3defs.h +++ b/src/spicelib/devices/soi3/soi3defs.h @@ -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/soi3/soi3dest.c b/src/spicelib/devices/soi3/soi3dest.c index 4f0195426..fbda9eba5 100644 --- a/src/spicelib/devices/soi3/soi3dest.c +++ b/src/spicelib/devices/soi3/soi3dest.c @@ -31,8 +31,8 @@ SOI3destroy(GENmodel **inModel) SOI3model *mod = *(SOI3model**) inModel; while (mod) { - SOI3model *next_mod = mod->SOI3nextModel; - SOI3instance *inst = mod->SOI3instances; + SOI3model *next_mod = SOI3nextModel(mod); + SOI3instance *inst = SOI3instances(mod); while (inst) { SOI3instance *next_inst = inst->SOI3nextInstance; /* FREE(inst->SOI3sens); */ diff --git a/src/spicelib/devices/soi3/soi3ic.c b/src/spicelib/devices/soi3/soi3ic.c index bad6a2f82..83e581e49 100644 --- a/src/spicelib/devices/soi3/soi3ic.c +++ b/src/spicelib/devices/soi3/soi3ic.c @@ -37,8 +37,8 @@ SOI3getic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->SOI3nextModel) { - for(here = model->SOI3instances; here ; here = here->SOI3nextInstance) { + for( ; model ; model = SOI3nextModel(model)) { + for(here = SOI3instances(model); here ; here = here->SOI3nextInstance) { if(!here->SOI3icVBSGiven) { here->SOI3icVBS = diff --git a/src/spicelib/devices/soi3/soi3load.c b/src/spicelib/devices/soi3/soi3load.c index 6e019f9b0..18aa28d0e 100644 --- a/src/spicelib/devices/soi3/soi3load.c +++ b/src/spicelib/devices/soi3/soi3load.c @@ -157,10 +157,10 @@ SOI3load(GENmodel *inModel, CKTcircuit *ckt) double m; - for( ; model != NULL; model = model->SOI3nextModel ) { + for( ; model != NULL; model = SOI3nextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->SOI3instances; here != NULL ; + for (here = SOI3instances(model); here != NULL ; here=here->SOI3nextInstance) { vt = CONSTKoverQ * here->SOI3temp; diff --git a/src/spicelib/devices/soi3/soi3nois.c b/src/spicelib/devices/soi3/soi3nois.c index 6f54bf596..9d06d50fe 100644 --- a/src/spicelib/devices/soi3/soi3nois.c +++ b/src/spicelib/devices/soi3/soi3nois.c @@ -69,8 +69,8 @@ SOI3noise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->SOI3nextModel) { - for (inst=model->SOI3instances; inst != NULL; inst=inst->SOI3nextInstance) { + for (model=firstModel; model != NULL; model=SOI3nextModel(model)) { + for (inst=SOI3instances(model); inst != NULL; inst=inst->SOI3nextInstance) { switch (operation) { diff --git a/src/spicelib/devices/soi3/soi3set.c b/src/spicelib/devices/soi3/soi3set.c index fa526700d..b20c40efd 100644 --- a/src/spicelib/devices/soi3/soi3set.c +++ b/src/spicelib/devices/soi3/soi3set.c @@ -53,7 +53,7 @@ SOI3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /****** the netlist to default values. ******/ /* loop through all the SOI3 device models */ - for( ; model != NULL; model = model->SOI3nextModel ) { + for( ; model != NULL; model = SOI3nextModel(model) ) { if(!model->SOI3typeGiven) { model->SOI3type = NSOI3; @@ -288,7 +288,7 @@ SOI3setup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) /****** in the netlist to default values. ******/ /* loop through all the instances of the model */ - for (here = model->SOI3instances; here != NULL ; + for (here = SOI3instances(model); here != NULL ; here=here->SOI3nextInstance) { @@ -669,9 +669,9 @@ SOI3unsetup(GENmodel *inModel, CKTcircuit *ckt) SOI3instance *here; for (model = (SOI3model *)inModel; model != NULL; - model = model->SOI3nextModel) + model = SOI3nextModel(model)) { - for (here = model->SOI3instances; here != NULL; + for (here = SOI3instances(model); here != NULL; here=here->SOI3nextInstance) { if (here->SOI3tout4Node > 0) diff --git a/src/spicelib/devices/soi3/soi3temp.c b/src/spicelib/devices/soi3/soi3temp.c index 47865911d..7d1eb0218 100644 --- a/src/spicelib/devices/soi3/soi3temp.c +++ b/src/spicelib/devices/soi3/soi3temp.c @@ -64,7 +64,7 @@ SOI3temp(GENmodel *inModel, CKTcircuit *ckt) double psi_delta0; /* loop through all the transistor models */ - for( ; model != NULL; model = model->SOI3nextModel) + for( ; model != NULL; model = SOI3nextModel(model)) { /* perform model defaulting */ @@ -299,7 +299,7 @@ SOI3temp(GENmodel *inModel, CKTcircuit *ckt) /* loop through all instances of the model */ - for(here = model->SOI3instances; here!= NULL; + for(here = SOI3instances(model); here!= NULL; here = here->SOI3nextInstance) { diff --git a/src/spicelib/devices/soi3/soi3trun.c b/src/spicelib/devices/soi3/soi3trun.c index 36d603cc9..b1e4b8c58 100644 --- a/src/spicelib/devices/soi3/soi3trun.c +++ b/src/spicelib/devices/soi3/soi3trun.c @@ -33,9 +33,9 @@ SOI3trunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) SOI3model *model = (SOI3model *)inModel; SOI3instance *here; - for( ; model != NULL; model = model->SOI3nextModel) + for( ; model != NULL; model = SOI3nextModel(model)) { - for(here=model->SOI3instances;here!=NULL;here = here->SOI3nextInstance) + for(here=SOI3instances(model);here!=NULL;here = here->SOI3nextInstance) { CKTterr(here->SOI3qgf,ckt,timeStep); CKTterr(here->SOI3qd,ckt,timeStep); diff --git a/src/spicelib/devices/sw/swacload.c b/src/spicelib/devices/sw/swacload.c index 025c307c5..d1c50a6df 100644 --- a/src/spicelib/devices/sw/swacload.c +++ b/src/spicelib/devices/sw/swacload.c @@ -25,10 +25,10 @@ SWacLoad(GENmodel *inModel, CKTcircuit *ckt) int current_state; /* loop through all the switch models */ - for( ; model != NULL; model = model->SWnextModel ) { + for( ; model != NULL; model = SWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->SWinstances; here != NULL ; + for (here = SWinstances(model); here != NULL ; here=here->SWnextInstance) { /* In AC analysis, just propogate the state... */ diff --git a/src/spicelib/devices/sw/swdefs.h b/src/spicelib/devices/sw/swdefs.h index ff6c995af..1116b9929 100644 --- a/src/spicelib/devices/sw/swdefs.h +++ b/src/spicelib/devices/sw/swdefs.h @@ -56,14 +56,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/sw/swdest.c b/src/spicelib/devices/sw/swdest.c index 844012127..a309dd041 100644 --- a/src/spicelib/devices/sw/swdest.c +++ b/src/spicelib/devices/sw/swdest.c @@ -14,8 +14,8 @@ SWdestroy(GENmodel **inModel) SWmodel *mod = *(SWmodel**) inModel; while (mod) { - SWmodel *next_mod = mod->SWnextModel; - SWinstance *inst = mod->SWinstances; + SWmodel *next_mod = SWnextModel(mod); + SWinstance *inst = SWinstances(mod); while (inst) { SWinstance *next_inst = inst->SWnextInstance; FREE(inst); diff --git a/src/spicelib/devices/sw/swload.c b/src/spicelib/devices/sw/swload.c index d551c2850..b6ee38f01 100644 --- a/src/spicelib/devices/sw/swload.c +++ b/src/spicelib/devices/sw/swload.c @@ -31,10 +31,10 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) // double current_region = -1; /* loop through all the switch models */ - for( ; model != NULL; model = model->SWnextModel ) { + for( ; model != NULL; model = SWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->SWinstances; here != NULL ; + for (here = SWinstances(model); here != NULL ; here=here->SWnextInstance) { old_current_state = *(ckt->CKTstates[0] + here->SWstate); diff --git a/src/spicelib/devices/sw/swnoise.c b/src/spicelib/devices/sw/swnoise.c index 1d6e79e5a..01ad53727 100644 --- a/src/spicelib/devices/sw/swnoise.c +++ b/src/spicelib/devices/sw/swnoise.c @@ -36,8 +36,8 @@ SWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *da int current_state; - for (model=firstModel; model != NULL; model=model->SWnextModel) { - for (inst=model->SWinstances; inst != NULL; inst=inst->SWnextInstance) { + for (model=firstModel; model != NULL; model=SWnextModel(model)) { + for (inst=SWinstances(model); inst != NULL; inst=inst->SWnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/sw/swpzload.c b/src/spicelib/devices/sw/swpzload.c index bdf0a7469..362d3be3e 100644 --- a/src/spicelib/devices/sw/swpzload.c +++ b/src/spicelib/devices/sw/swpzload.c @@ -29,10 +29,10 @@ SWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); /* loop through all the switch models */ - for( ; model != NULL; model = model->SWnextModel ) { + for( ; model != NULL; model = SWnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->SWinstances; here != NULL ; + for (here = SWinstances(model); here != NULL ; here=here->SWnextInstance) { /* In AC analysis, just propogate the state... */ diff --git a/src/spicelib/devices/sw/swsetup.c b/src/spicelib/devices/sw/swsetup.c index 7ba4a4905..47619340e 100644 --- a/src/spicelib/devices/sw/swsetup.c +++ b/src/spicelib/devices/sw/swsetup.c @@ -23,7 +23,7 @@ SWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) SWinstance *here; /* loop through all the current source models */ - for( ; model != NULL; model = model->SWnextModel ) { + for( ; model != NULL; model = SWnextModel(model) ) { /* Default Value Processing for Switch Model */ if (!model->SWthreshGiven) { model->SWvThreshold = 0; @@ -41,7 +41,7 @@ SWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->SWinstances; here != NULL ; + for (here = SWinstances(model); here != NULL ; here=here->SWnextInstance) { here->SWstate = *states; diff --git a/src/spicelib/devices/sw/swtrunc.c b/src/spicelib/devices/sw/swtrunc.c index cf19501b0..68b1d3dd4 100644 --- a/src/spicelib/devices/sw/swtrunc.c +++ b/src/spicelib/devices/sw/swtrunc.c @@ -19,8 +19,8 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) SWinstance *here; double lastChange, maxChange, maxStep, ref; - for( ; model!= NULL; model = model->SWnextModel) { - for(here = model->SWinstances ; here != NULL ; + for( ; model!= NULL; model = SWnextModel(model)) { + for(here = SWinstances(model) ; here != NULL ; here = here->SWnextInstance) { lastChange = *(ckt->CKTstate0+(here->SWstate+1)) - *(ckt->CKTstate1+(here->SWstate+1)); diff --git a/src/spicelib/devices/tra/traacct.c b/src/spicelib/devices/tra/traacct.c index 465e7c8b4..71de15304 100644 --- a/src/spicelib/devices/tra/traacct.c +++ b/src/spicelib/devices/tra/traacct.c @@ -25,10 +25,10 @@ TRAaccept(CKTcircuit *ckt, GENmodel *inModel) /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { if( (ckt->CKTtime - here->TRAtd) > *(here->TRAdelays+6)) { diff --git a/src/spicelib/devices/tra/traacld.c b/src/spicelib/devices/tra/traacld.c index 44d429a8f..a40200cef 100644 --- a/src/spicelib/devices/tra/traacld.c +++ b/src/spicelib/devices/tra/traacld.c @@ -21,10 +21,10 @@ TRAacLoad(GENmodel *inModel, CKTcircuit *ckt) double imag; /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { real = cos(-ckt->CKTomega*here->TRAtd); diff --git a/src/spicelib/devices/tra/tradefs.h b/src/spicelib/devices/tra/tradefs.h index 817f289a6..d399d6a69 100644 --- a/src/spicelib/devices/tra/tradefs.h +++ b/src/spicelib/devices/tra/tradefs.h @@ -86,14 +86,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/tra/tradest.c b/src/spicelib/devices/tra/tradest.c index 44f8a8781..478ad04b0 100644 --- a/src/spicelib/devices/tra/tradest.c +++ b/src/spicelib/devices/tra/tradest.c @@ -14,8 +14,8 @@ TRAdestroy(GENmodel **inModel) TRAmodel *mod = *(TRAmodel **) inModel; while (mod) { - TRAmodel *next_mod = mod->TRAnextModel; - TRAinstance *inst = mod->TRAinstances; + TRAmodel *next_mod = TRAnextModel(mod); + TRAinstance *inst = TRAinstances(mod); while (inst) { TRAinstance *next_inst = inst->TRAnextInstance; FREE(inst); diff --git a/src/spicelib/devices/tra/traload.c b/src/spicelib/devices/tra/traload.c index e13615030..50e38098b 100644 --- a/src/spicelib/devices/tra/traload.c +++ b/src/spicelib/devices/tra/traload.c @@ -27,10 +27,10 @@ TRAload(GENmodel *inModel, CKTcircuit *ckt) int i; /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { *(here->TRApos1Pos1Ptr) += here->TRAconduct; diff --git a/src/spicelib/devices/tra/trasetup.c b/src/spicelib/devices/tra/trasetup.c index bdf83a243..450f3a444 100644 --- a/src/spicelib/devices/tra/trasetup.c +++ b/src/spicelib/devices/tra/trasetup.c @@ -28,10 +28,10 @@ TRAsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) NG_IGNORE(state); /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { if(here->TRAbrEq1==0) { @@ -121,9 +121,9 @@ TRAunsetup(GENmodel *inModel, CKTcircuit *ckt) TRAinstance *here; for (model = (TRAmodel *)inModel; model != NULL; - model = model->TRAnextModel) + model = TRAnextModel(model)) { - for (here = model->TRAinstances; here != NULL; + for (here = TRAinstances(model); here != NULL; here=here->TRAnextInstance) { if (here->TRAintNode2 > 0) diff --git a/src/spicelib/devices/tra/tratemp.c b/src/spicelib/devices/tra/tratemp.c index ed0885d14..ad5cb2a35 100644 --- a/src/spicelib/devices/tra/tratemp.c +++ b/src/spicelib/devices/tra/tratemp.c @@ -26,10 +26,10 @@ TRAtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { if(!here->TRAtdGiven) { diff --git a/src/spicelib/devices/tra/tratrunc.c b/src/spicelib/devices/tra/tratrunc.c index 291687e39..41ee726a9 100644 --- a/src/spicelib/devices/tra/tratrunc.c +++ b/src/spicelib/devices/tra/tratrunc.c @@ -23,10 +23,10 @@ TRAtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) double tmp; /* loop through all the transmission line models */ - for( ; model != NULL; model = model->TRAnextModel ) { + for( ; model != NULL; model = TRAnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TRAinstances; here != NULL ; + for (here = TRAinstances(model); here != NULL ; here=here->TRAnextInstance) { v1 = ( *(ckt->CKTrhsOld + here->TRAposNode2) diff --git a/src/spicelib/devices/txl/txlacct.c b/src/spicelib/devices/txl/txlacct.c index 0e4367f73..b32cf20e1 100644 --- a/src/spicelib/devices/txl/txlacct.c +++ b/src/spicelib/devices/txl/txlacct.c @@ -26,10 +26,10 @@ TXLaccept(CKTcircuit *ckt, GENmodel *inModel) TXLine *tx; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->TXLnextModel ) { + for( ; model != NULL; model = TXLnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->TXLinstances; here != NULL ; + for (here = TXLinstances(model); here != NULL ; here=here->TXLnextInstance) { h = ckt->CKTdelta; @@ -59,8 +59,8 @@ TXLaccept(CKTcircuit *ckt, GENmodel *inModel) } } model = (TXLmodel *)inModel; - for( ; model != NULL; model = model->TXLnextModel ) { - for (here = model->TXLinstances; here != NULL ; + for( ; model != NULL; model = TXLnextModel(model) ) { + for (here = TXLinstances(model); here != NULL ; here=here->TXLnextInstance) { nd = here->txline->in_node; nd->dvtag = 0; diff --git a/src/spicelib/devices/txl/txldefs.h b/src/spicelib/devices/txl/txldefs.h index aa054b4a2..8f031e60c 100644 --- a/src/spicelib/devices/txl/txldefs.h +++ b/src/spicelib/devices/txl/txldefs.h @@ -55,14 +55,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/txl/txldest.c b/src/spicelib/devices/txl/txldest.c index 76228dcff..b41d5f638 100644 --- a/src/spicelib/devices/txl/txldest.c +++ b/src/spicelib/devices/txl/txldest.c @@ -15,8 +15,8 @@ TXLdestroy(GENmodel **inModel) TXLmodel *mod = *(TXLmodel **) inModel; while (mod) { - TXLmodel *next_mod = mod->TXLnextModel; - TXLinstance *inst = mod->TXLinstances; + TXLmodel *next_mod = TXLnextModel(mod); + TXLinstance *inst = TXLinstances(mod); while (inst) { TXLinstance *next_inst = inst->TXLnextInstance; FREE(inst); diff --git a/src/spicelib/devices/txl/txlfbr.c b/src/spicelib/devices/txl/txlfbr.c index be6f423a6..2ef905aa4 100644 --- a/src/spicelib/devices/txl/txlfbr.c +++ b/src/spicelib/devices/txl/txlfbr.c @@ -20,8 +20,8 @@ TXLfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) int error; CKTnode *tmp; - for( ; model != NULL; model = model->TXLnextModel) { - for (here = model->TXLinstances; here != NULL; + for( ; model != NULL; model = TXLnextModel(model)) { + for (here = TXLinstances(model); here != NULL; here = here->TXLnextInstance) { if(here->TXLname == name) { if(here->TXLbranch == 0) { diff --git a/src/spicelib/devices/txl/txlload.c b/src/spicelib/devices/txl/txlload.c index a76bb0923..2cd49abed 100644 --- a/src/spicelib/devices/txl/txlload.c +++ b/src/spicelib/devices/txl/txlload.c @@ -61,8 +61,8 @@ TXLload(GENmodel *inModel, CKTcircuit *ckt) gmin = 0.1 * ckt->CKTgmin; /* dc solution */ - for( ; model != NULL; model = model->TXLnextModel ) { - for (here = model->TXLinstances; here != NULL ; + for( ; model != NULL; model = TXLnextModel(model) ) { + for (here = TXLinstances(model); here != NULL ; here=here->TXLnextInstance) { tx = here->txline; @@ -108,8 +108,8 @@ TXLload(GENmodel *inModel, CKTcircuit *ckt) } model = (TXLmodel *)inModel; - for( ; model != NULL; model = model->TXLnextModel ) { - for (here = model->TXLinstances; here != NULL ; + for( ; model != NULL; model = TXLnextModel(model) ) { + for (here = TXLinstances(model); here != NULL ; here=here->TXLnextInstance) { tx = here->txline; diff --git a/src/spicelib/devices/txl/txlsetup.c b/src/spicelib/devices/txl/txlsetup.c index 0eea24240..807ddb8d0 100644 --- a/src/spicelib/devices/txl/txlsetup.c +++ b/src/spicelib/devices/txl/txlsetup.c @@ -85,7 +85,7 @@ TXLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) NG_IGNORE(state); /* loop through all the models */ - for( ; model != NULL; model = model->TXLnextModel ) { + for( ; model != NULL; model = TXLnextModel(model) ) { if (!model->Rgiven) { SPfrontEnd->IFerrorf (ERR_FATAL, @@ -114,7 +114,7 @@ TXLsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit*ckt, int *state) } /* loop through all the instances of the model */ - for (here = model->TXLinstances; here != NULL ; + for (here = TXLinstances(model); here != NULL ; here=here->TXLnextInstance) { /* macro to make elements with built in test for out of memory */ @@ -166,8 +166,8 @@ TXLunsetup(GENmodel *inModel, CKTcircuit *ckt) TXLinstance *here; for (model = (TXLmodel *) inModel; model != NULL; - model = model->TXLnextModel) { - for (here = model->TXLinstances; here != NULL; + model = TXLnextModel(model)) { + for (here = TXLinstances(model); here != NULL; here = here->TXLnextInstance) { if (here->TXLibr2) { diff --git a/src/spicelib/devices/urc/urcdefs.h b/src/spicelib/devices/urc/urcdefs.h index 4adbb88c4..106d4b07f 100644 --- a/src/spicelib/devices/urc/urcdefs.h +++ b/src/spicelib/devices/urc/urcdefs.h @@ -37,14 +37,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/urc/urcdest.c b/src/spicelib/devices/urc/urcdest.c index cdfdc21f7..7061473ec 100644 --- a/src/spicelib/devices/urc/urcdest.c +++ b/src/spicelib/devices/urc/urcdest.c @@ -14,8 +14,8 @@ URCdestroy(GENmodel **inModel) URCmodel *mod = *(URCmodel **) inModel; while (mod) { - URCmodel *next_mod = mod->URCnextModel; - URCinstance *inst = mod->URCinstances; + URCmodel *next_mod = URCnextModel(mod); + URCinstance *inst = URCinstances(mod); while (inst) { URCinstance *next_inst = inst->URCnextInstance; FREE(inst); diff --git a/src/spicelib/devices/urc/urcsetup.c b/src/spicelib/devices/urc/urcsetup.c index 2df4ef01f..405deb416 100644 --- a/src/spicelib/devices/urc/urcsetup.c +++ b/src/spicelib/devices/urc/urcsetup.c @@ -61,7 +61,7 @@ URCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) ctype = CKTtypelook("Capacitor"); dtype = CKTtypelook("Diode"); /* loop through all the URC models */ - for( ; model != NULL; model = model->URCnextModel ) { + for( ; model != NULL; model = URCnextModel(model) ) { if(!model->URCkGiven) model->URCk = 1.5; if(!model->URCfmaxGiven) @@ -74,7 +74,7 @@ URCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) /* may need to put in limits: k>=1.1, freq <=1e9, rperl >=.1 */ /* loop through all the instances of the model */ - for (here = model->URCinstances; here != NULL ; + for (here = URCinstances(model); here != NULL ; here=here->URCnextInstance) { p = model->URCk; @@ -275,8 +275,8 @@ URCunsetup(GENmodel *inModel, CKTcircuit *ckt) /* Delete models, devices, and intermediate nodes; */ - for ( ; model; model = model->URCnextModel) { - for (here = model->URCinstances; here; + for ( ; model; model = URCnextModel(model)) { + for (here = URCinstances(model); here; here = here->URCnextInstance) { if(model->URCisPerLGiven) { diff --git a/src/spicelib/devices/vbic/vbicacld.c b/src/spicelib/devices/vbic/vbicacld.c index fb4fab30c..64ccef745 100644 --- a/src/spicelib/devices/vbic/vbicacld.c +++ b/src/spicelib/devices/vbic/vbicacld.c @@ -33,10 +33,10 @@ VBICacLoad(GENmodel *inModel, CKTcircuit *ckt) XQbcp_Vbcp; /* loop through all the models */ - for( ; model != NULL; model = model->VBICnextModel) { + for( ; model != NULL; model = VBICnextModel(model)) { /* loop through all the instances of the model */ - for( here = model->VBICinstances; here!= NULL; + for( here = VBICinstances(model); here!= NULL; here = here->VBICnextInstance) { Ibe_Vbei = *(ckt->CKTstate0 + here->VBICibe_Vbei); diff --git a/src/spicelib/devices/vbic/vbicconv.c b/src/spicelib/devices/vbic/vbicconv.c index 0118caa40..f686aaff8 100644 --- a/src/spicelib/devices/vbic/vbicconv.c +++ b/src/spicelib/devices/vbic/vbicconv.c @@ -45,8 +45,8 @@ VBICconvTest(GENmodel *inModel, CKTcircuit *ckt) double Vbei, Vbex, Vbci, Vbcx, Vbep, Vrci, Vrbi, Vrbp, Vbcp; double Ibe, Ibex, Itzf, Itzr, Ibc, Ibep, Irci, Irbi, Irbp, Ibcp, Iccp; - for( ; model != NULL; model = model->VBICnextModel) { - for(here=model->VBICinstances;here!=NULL;here = here->VBICnextInstance) { + for( ; model != NULL; model = VBICnextModel(model)) { + for(here=VBICinstances(model);here!=NULL;here = here->VBICnextInstance) { Vbei=model->VBICtype*( *(ckt->CKTrhsOld+here->VBICbaseBINode)- diff --git a/src/spicelib/devices/vbic/vbicdefs.h b/src/spicelib/devices/vbic/vbicdefs.h index 65032f91e..247757d9b 100644 --- a/src/spicelib/devices/vbic/vbicdefs.h +++ b/src/spicelib/devices/vbic/vbicdefs.h @@ -350,15 +350,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/vbic/vbicdest.c b/src/spicelib/devices/vbic/vbicdest.c index b3d50045e..3731ff1e0 100644 --- a/src/spicelib/devices/vbic/vbicdest.c +++ b/src/spicelib/devices/vbic/vbicdest.c @@ -21,8 +21,8 @@ VBICdestroy(GENmodel **inModel) VBICmodel *mod = *(VBICmodel**) inModel; while (mod) { - VBICmodel *next_mod = mod->VBICnextModel; - VBICinstance *inst = mod->VBICinstances; + VBICmodel *next_mod = VBICnextModel(mod); + VBICinstance *inst = VBICinstances(mod); while (inst) { VBICinstance *next_inst = inst->VBICnextInstance; FREE(inst->VBICsens); diff --git a/src/spicelib/devices/vbic/vbicgetic.c b/src/spicelib/devices/vbic/vbicgetic.c index 4d2db6dd1..5659d159f 100644 --- a/src/spicelib/devices/vbic/vbicgetic.c +++ b/src/spicelib/devices/vbic/vbicgetic.c @@ -28,8 +28,8 @@ VBICgetic(GENmodel *inModel, CKTcircuit *ckt) * external nodes to get values */ - for( ; model ; model = model->VBICnextModel) { - for(here = model->VBICinstances; here ; here = here->VBICnextInstance) { + for( ; model ; model = VBICnextModel(model)) { + for(here = VBICinstances(model); here ; here = here->VBICnextInstance) { if(!here->VBICicVBEGiven) { here->VBICicVBE = diff --git a/src/spicelib/devices/vbic/vbicload.c b/src/spicelib/devices/vbic/vbicload.c index 1bf534eb0..d1208a46e 100644 --- a/src/spicelib/devices/vbic/vbicload.c +++ b/src/spicelib/devices/vbic/vbicload.c @@ -85,10 +85,10 @@ VBICload(GENmodel *inModel, CKTcircuit *ckt) double gqbeo, cqbeo, gqbco, cqbco, gbcx, cbcx; /* loop through all the models */ - for( ; model != NULL; model = model->VBICnextModel ) { + for( ; model != NULL; model = VBICnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VBICinstances; here != NULL ; + for (here = VBICinstances(model); here != NULL ; here=here->VBICnextInstance) { vt = here->VBICtemp * CONSTKoverQ; diff --git a/src/spicelib/devices/vbic/vbicnoise.c b/src/spicelib/devices/vbic/vbicnoise.c index 04383cab3..4b9eb4bce 100644 --- a/src/spicelib/devices/vbic/vbicnoise.c +++ b/src/spicelib/devices/vbic/vbicnoise.c @@ -58,8 +58,8 @@ VBICnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata * "" /* total transistor noise */ }; - for (model=firstModel; model != NULL; model=model->VBICnextModel) { - for (inst=model->VBICinstances; inst != NULL; + for (model=firstModel; model != NULL; model=VBICnextModel(model)) { + for (inst=VBICinstances(model); inst != NULL; inst=inst->VBICnextInstance) { switch (operation) { diff --git a/src/spicelib/devices/vbic/vbicpzld.c b/src/spicelib/devices/vbic/vbicpzld.c index a70387a0f..20de08419 100644 --- a/src/spicelib/devices/vbic/vbicpzld.c +++ b/src/spicelib/devices/vbic/vbicpzld.c @@ -33,10 +33,10 @@ VBICpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) XQbcp_Vbcp; /* loop through all the models */ - for( ; model != NULL; model = model->VBICnextModel) { + for( ; model != NULL; model = VBICnextModel(model)) { /* loop through all the instances of the model */ - for( here = model->VBICinstances; here!= NULL; + for( here = VBICinstances(model); here!= NULL; here = here->VBICnextInstance) { Ibe_Vbei = *(ckt->CKTstate0 + here->VBICibe_Vbei); diff --git a/src/spicelib/devices/vbic/vbicsetup.c b/src/spicelib/devices/vbic/vbicsetup.c index 7c483a8aa..6322bfbcc 100644 --- a/src/spicelib/devices/vbic/vbicsetup.c +++ b/src/spicelib/devices/vbic/vbicsetup.c @@ -33,7 +33,7 @@ VBICsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) CKTnode *tmp; /* loop through all the transistor models */ - for( ; model != NULL; model = model->VBICnextModel ) { + for( ; model != NULL; model = VBICnextModel(model) ) { if(model->VBICtype != NPN && model->VBICtype != PNP) { model->VBICtype = NPN; @@ -380,7 +380,7 @@ VBICsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } /* loop through all the instances of the model */ - for (here = model->VBICinstances; here != NULL ; + for (here = VBICinstances(model); here != NULL ; here=here->VBICnextInstance) { CKTnode *tmpNode; IFuid tmpName; @@ -553,9 +553,9 @@ VBICunsetup( VBICinstance *here; for (model = (VBICmodel *)inModel; model != NULL; - model = model->VBICnextModel) + model = VBICnextModel(model)) { - for (here = model->VBICinstances; here != NULL; + for (here = VBICinstances(model); here != NULL; here=here->VBICnextInstance) { if (here->VBICbaseBINode > 0) diff --git a/src/spicelib/devices/vbic/vbicsoachk.c b/src/spicelib/devices/vbic/vbicsoachk.c index f534e5aff..5fce97e9a 100644 --- a/src/spicelib/devices/vbic/vbicsoachk.c +++ b/src/spicelib/devices/vbic/vbicsoachk.c @@ -30,9 +30,9 @@ VBICsoaCheck(CKTcircuit *ckt, GENmodel *inModel) maxwarns = ckt->CKTsoaMaxWarns; - for (; model; model = model->VBICnextModel) { + for (; model; model = VBICnextModel(model)) { - for (here = model->VBICinstances; here; here=here->VBICnextInstance) { + for (here = VBICinstances(model); here; here=here->VBICnextInstance) { vbe = fabs(ckt->CKTrhsOld [here->VBICbaseNode] - ckt->CKTrhsOld [here->VBICemitNode]); diff --git a/src/spicelib/devices/vbic/vbictemp.c b/src/spicelib/devices/vbic/vbictemp.c index c97114273..6af5b19f4 100644 --- a/src/spicelib/devices/vbic/vbictemp.c +++ b/src/spicelib/devices/vbic/vbictemp.c @@ -30,7 +30,7 @@ VBICtemp(GENmodel *inModel, CKTcircuit *ckt) double vt; /* loop through all the bipolar models */ - for( ; model != NULL; model = model->VBICnextModel ) { + for( ; model != NULL; model = VBICnextModel(model) ) { if(!model->VBICtnomGiven) model->VBICtnom = ckt->CKTnomTemp - CONSTCtoK; @@ -69,7 +69,7 @@ VBICtemp(GENmodel *inModel, CKTcircuit *ckt) } /* loop through all the instances of the model */ - for (here = model->VBICinstances; here != NULL ; + for (here = VBICinstances(model); here != NULL ; here=here->VBICnextInstance) { if(!here->VBICtempGiven) here->VBICtemp = ckt->CKTtemp; diff --git a/src/spicelib/devices/vbic/vbictrunc.c b/src/spicelib/devices/vbic/vbictrunc.c index ecda4b98b..be9d1b553 100644 --- a/src/spicelib/devices/vbic/vbictrunc.c +++ b/src/spicelib/devices/vbic/vbictrunc.c @@ -23,8 +23,8 @@ VBICtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) VBICmodel *model = (VBICmodel*)inModel; VBICinstance *here; - for( ; model != NULL; model = model->VBICnextModel) { - for(here=model->VBICinstances;here!=NULL; + for( ; model != NULL; model = VBICnextModel(model)) { + for(here=VBICinstances(model);here!=NULL; here = here->VBICnextInstance){ CKTterr(here->VBICqbe,ckt,timeStep); diff --git a/src/spicelib/devices/vccs/vccsdefs.h b/src/spicelib/devices/vccs/vccsdefs.h index 2f2f6e040..f39daa54f 100644 --- a/src/spicelib/devices/vccs/vccsdefs.h +++ b/src/spicelib/devices/vccs/vccsdefs.h @@ -55,14 +55,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/vccs/vccsdest.c b/src/spicelib/devices/vccs/vccsdest.c index d93b54f77..0ea257ee8 100644 --- a/src/spicelib/devices/vccs/vccsdest.c +++ b/src/spicelib/devices/vccs/vccsdest.c @@ -14,8 +14,8 @@ VCCSdestroy(GENmodel **inModel) VCCSmodel *mod = *(VCCSmodel**) inModel; while (mod) { - VCCSmodel *next_mod = mod->VCCSnextModel; - VCCSinstance *inst = mod->VCCSinstances; + VCCSmodel *next_mod = VCCSnextModel(mod); + VCCSinstance *inst = VCCSinstances(mod); while (inst) { VCCSinstance *next_inst = inst->VCCSnextInstance; FREE(inst); diff --git a/src/spicelib/devices/vccs/vccsload.c b/src/spicelib/devices/vccs/vccsload.c index 341b9ed78..a75e561b2 100644 --- a/src/spicelib/devices/vccs/vccsload.c +++ b/src/spicelib/devices/vccs/vccsload.c @@ -25,10 +25,10 @@ VCCSload(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { *(here->VCCSposContPosPtr) += here->VCCScoeff ; diff --git a/src/spicelib/devices/vccs/vccspzld.c b/src/spicelib/devices/vccs/vccspzld.c index 0bb2b75d6..9d2cede77 100644 --- a/src/spicelib/devices/vccs/vccspzld.c +++ b/src/spicelib/devices/vccs/vccspzld.c @@ -27,10 +27,10 @@ VCCSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); /* loop through all the source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { *(here->VCCSposContPosPtr) += here->VCCScoeff ; diff --git a/src/spicelib/devices/vccs/vccssacl.c b/src/spicelib/devices/vccs/vccssacl.c index 3889fbb82..d6f26f6d0 100644 --- a/src/spicelib/devices/vccs/vccssacl.c +++ b/src/spicelib/devices/vccs/vccssacl.c @@ -27,10 +27,10 @@ VCCSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { if (here->VCCSsenParmNo){ diff --git a/src/spicelib/devices/vccs/vccsset.c b/src/spicelib/devices/vccs/vccsset.c index 374b2e926..63b9ec6af 100644 --- a/src/spicelib/devices/vccs/vccsset.c +++ b/src/spicelib/devices/vccs/vccsset.c @@ -28,10 +28,10 @@ VCCSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(ckt); /* loop through all the current source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { /* macro to make elements with built in test for out of memory */ diff --git a/src/spicelib/devices/vccs/vccssld.c b/src/spicelib/devices/vccs/vccssld.c index c177628ed..5331c9158 100644 --- a/src/spicelib/devices/vccs/vccssld.c +++ b/src/spicelib/devices/vccs/vccssld.c @@ -25,10 +25,10 @@ VCCSsLoad(GENmodel *inModel, CKTcircuit *ckt) double vc; /* loop through all the source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { if(here->VCCSsenParmNo){ diff --git a/src/spicelib/devices/vccs/vccssprt.c b/src/spicelib/devices/vccs/vccssprt.c index eeab21cfa..387517a1a 100644 --- a/src/spicelib/devices/vccs/vccssprt.c +++ b/src/spicelib/devices/vccs/vccssprt.c @@ -25,12 +25,12 @@ VCCSsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("VOLTAGE CONTROLLED CURRENT SOURCES-----------------\n"); /* loop through all the source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { printf("Model name:%s\n",model->VCCSmodName); /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { printf(" Instance name:%s\n",here->VCCSname); diff --git a/src/spicelib/devices/vccs/vccssset.c b/src/spicelib/devices/vccs/vccssset.c index 84c261bc0..93772cd28 100644 --- a/src/spicelib/devices/vccs/vccssset.c +++ b/src/spicelib/devices/vccs/vccssset.c @@ -24,10 +24,10 @@ VCCSsSetup(SENstruct *info, GENmodel *inModel) VCCSinstance *here; /* loop through all the current source models */ - for( ; model != NULL; model = model->VCCSnextModel ) { + for( ; model != NULL; model = VCCSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCCSinstances; here != NULL ; + for (here = VCCSinstances(model); here != NULL ; here=here->VCCSnextInstance) { if(here->VCCSsenParmNo){ diff --git a/src/spicelib/devices/vcvs/vcvsdefs.h b/src/spicelib/devices/vcvs/vcvsdefs.h index 92880c992..8e1462afe 100644 --- a/src/spicelib/devices/vcvs/vcvsdefs.h +++ b/src/spicelib/devices/vcvs/vcvsdefs.h @@ -59,14 +59,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#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/vcvs/vcvsdest.c b/src/spicelib/devices/vcvs/vcvsdest.c index d183ec2ee..4997ae09b 100644 --- a/src/spicelib/devices/vcvs/vcvsdest.c +++ b/src/spicelib/devices/vcvs/vcvsdest.c @@ -14,8 +14,8 @@ VCVSdestroy(GENmodel **inModel) VCVSmodel *mod = *(VCVSmodel **) inModel; while (mod) { - VCVSmodel *next_mod = mod->VCVSnextModel; - VCVSinstance *inst = mod->VCVSinstances; + VCVSmodel *next_mod = VCVSnextModel(mod); + VCVSinstance *inst = VCVSinstances(mod); while (inst) { VCVSinstance *next_inst = inst->VCVSnextInstance; FREE(inst); diff --git a/src/spicelib/devices/vcvs/vcvsfbr.c b/src/spicelib/devices/vcvs/vcvsfbr.c index d26275129..ad4bbe54d 100644 --- a/src/spicelib/devices/vcvs/vcvsfbr.c +++ b/src/spicelib/devices/vcvs/vcvsfbr.c @@ -21,8 +21,8 @@ VCVSfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) int error; CKTnode *tmp; - for( ; model != NULL; model = model->VCVSnextModel) { - for (here = model->VCVSinstances; here != NULL; + for( ; model != NULL; model = VCVSnextModel(model)) { + for (here = VCVSinstances(model); here != NULL; here = here->VCVSnextInstance) { if(here->VCVSname == name) { if(here->VCVSbranch == 0) { diff --git a/src/spicelib/devices/vcvs/vcvsload.c b/src/spicelib/devices/vcvs/vcvsload.c index f321caf1c..0598a915a 100644 --- a/src/spicelib/devices/vcvs/vcvsload.c +++ b/src/spicelib/devices/vcvs/vcvsload.c @@ -25,10 +25,10 @@ VCVSload(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { *(here->VCVSposIbrPtr) += 1.0 ; diff --git a/src/spicelib/devices/vcvs/vcvspzld.c b/src/spicelib/devices/vcvs/vcvspzld.c index f9e5556a3..d581f8914 100644 --- a/src/spicelib/devices/vcvs/vcvspzld.c +++ b/src/spicelib/devices/vcvs/vcvspzld.c @@ -27,10 +27,10 @@ VCVSpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { *(here->VCVSposIbrPtr) += 1.0 ; diff --git a/src/spicelib/devices/vcvs/vcvssacl.c b/src/spicelib/devices/vcvs/vcvssacl.c index 614925d1a..73542790b 100644 --- a/src/spicelib/devices/vcvs/vcvssacl.c +++ b/src/spicelib/devices/vcvs/vcvssacl.c @@ -25,10 +25,10 @@ VCVSsAcLoad(GENmodel *inModel, CKTcircuit *ckt) double ivc; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { if(here->VCVSsenParmNo){ diff --git a/src/spicelib/devices/vcvs/vcvsset.c b/src/spicelib/devices/vcvs/vcvsset.c index 981f8af79..3dcebc587 100644 --- a/src/spicelib/devices/vcvs/vcvsset.c +++ b/src/spicelib/devices/vcvs/vcvsset.c @@ -26,10 +26,10 @@ VCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) NG_IGNORE(states); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { if(here->VCVSposNode == here->VCVSnegNode) { @@ -68,9 +68,9 @@ VCVSunsetup(GENmodel *inModel, CKTcircuit *ckt) VCVSinstance *here; for (model = (VCVSmodel *)inModel; model != NULL; - model = model->VCVSnextModel) + model = VCVSnextModel(model)) { - for (here = model->VCVSinstances; here != NULL; + for (here = VCVSinstances(model); here != NULL; here=here->VCVSnextInstance) { if (here->VCVSbranch > 0) diff --git a/src/spicelib/devices/vcvs/vcvssld.c b/src/spicelib/devices/vcvs/vcvssld.c index 4541aafc1..51dd81b31 100644 --- a/src/spicelib/devices/vcvs/vcvssld.c +++ b/src/spicelib/devices/vcvs/vcvssld.c @@ -24,10 +24,10 @@ VCVSsLoad(GENmodel *inModel, CKTcircuit *ckt) double vc; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { if(here->VCVSsenParmNo){ diff --git a/src/spicelib/devices/vcvs/vcvssprt.c b/src/spicelib/devices/vcvs/vcvssprt.c index 81789c5de..01f68ce7b 100644 --- a/src/spicelib/devices/vcvs/vcvssprt.c +++ b/src/spicelib/devices/vcvs/vcvssprt.c @@ -24,12 +24,12 @@ VCVSsPrint(GENmodel *inModel, CKTcircuit *ckt) printf("VOLTAGE CONTROLLED VOLTAGE SOURCES-----------------\n"); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { printf("Model name:%s\n",model->VCVSmodName); /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { printf(" Instance name:%s\n",here->VCVSname); diff --git a/src/spicelib/devices/vcvs/vcvssset.c b/src/spicelib/devices/vcvs/vcvssset.c index 0d5d1f645..37ef88196 100644 --- a/src/spicelib/devices/vcvs/vcvssset.c +++ b/src/spicelib/devices/vcvs/vcvssset.c @@ -24,10 +24,10 @@ VCVSsSetup(SENstruct *info, GENmodel *inModel) VCVSinstance *here; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VCVSnextModel ) { + for( ; model != NULL; model = VCVSnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VCVSinstances; here != NULL ; + for (here = VCVSinstances(model); here != NULL ; here=here->VCVSnextInstance) { if(here->VCVSsenParmNo){ diff --git a/src/spicelib/devices/vsrc/vsrcacct.c b/src/spicelib/devices/vsrc/vsrcacct.c index d1aacacc6..c1af69bec 100644 --- a/src/spicelib/devices/vsrc/vsrcacct.c +++ b/src/spicelib/devices/vsrc/vsrcacct.c @@ -30,10 +30,10 @@ VSRCaccept(CKTcircuit *ckt, GENmodel *inModel) int error; /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { if(!(ckt->CKTmode & (MODETRAN | MODETRANOP))) { diff --git a/src/spicelib/devices/vsrc/vsrcacld.c b/src/spicelib/devices/vsrc/vsrcacld.c index c7ae3dfe3..839030728 100644 --- a/src/spicelib/devices/vsrc/vsrcacld.c +++ b/src/spicelib/devices/vsrc/vsrcacld.c @@ -16,10 +16,10 @@ VSRCacLoad(GENmodel *inModel, CKTcircuit *ckt) VSRCmodel *model = (VSRCmodel *) inModel; VSRCinstance *here; - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { double acReal, acImag; diff --git a/src/spicelib/devices/vsrc/vsrcdefs.h b/src/spicelib/devices/vsrc/vsrcdefs.h index 1c28fee5e..2b29365b3 100644 --- a/src/spicelib/devices/vsrc/vsrcdefs.h +++ b/src/spicelib/devices/vsrc/vsrcdefs.h @@ -81,14 +81,12 @@ 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 */ + struct GENmodel gen; - /* --- end of generic struct GENmodel --- */ +#define VSRCmodType gen.GENmodType +#define VSRCnextModel(inst) ((struct sVSRCmodel*)((inst)->gen.GENnextModel)) +#define VSRCinstances(inst) ((VSRCinstance*)((inst)->gen.GENinstances)) +#define VSRCmodName gen.GENmodName } VSRCmodel; diff --git a/src/spicelib/devices/vsrc/vsrcdest.c b/src/spicelib/devices/vsrc/vsrcdest.c index 308a85792..853eec9a6 100644 --- a/src/spicelib/devices/vsrc/vsrcdest.c +++ b/src/spicelib/devices/vsrc/vsrcdest.c @@ -14,8 +14,8 @@ VSRCdestroy(GENmodel **inModel) VSRCmodel *mod = *(VSRCmodel**) inModel; while (mod) { - VSRCmodel *next_mod = mod->VSRCnextModel; - VSRCinstance *inst = mod->VSRCinstances; + VSRCmodel *next_mod = VSRCnextModel(mod); + VSRCinstance *inst = VSRCinstances(mod); while (inst) { VSRCinstance *next_inst = inst->VSRCnextInstance; FREE(inst->VSRCcoeffs); diff --git a/src/spicelib/devices/vsrc/vsrcfbr.c b/src/spicelib/devices/vsrc/vsrcfbr.c index 05f9d356a..ff8773977 100644 --- a/src/spicelib/devices/vsrc/vsrcfbr.c +++ b/src/spicelib/devices/vsrc/vsrcfbr.c @@ -20,8 +20,8 @@ VSRCfindBr(CKTcircuit *ckt, GENmodel *inModel, IFuid name) int error; CKTnode *tmp; - for( ; model != NULL; model = model->VSRCnextModel) { - for (here = model->VSRCinstances; here != NULL; + for( ; model != NULL; model = VSRCnextModel(model)) { + for (here = VSRCinstances(model); here != NULL; here = here->VSRCnextInstance) { if(here->VSRCname == name) { if(here->VSRCbranch == 0) { diff --git a/src/spicelib/devices/vsrc/vsrcload.c b/src/spicelib/devices/vsrc/vsrcload.c index 7f3097a7a..d0786ea7b 100644 --- a/src/spicelib/devices/vsrc/vsrcload.c +++ b/src/spicelib/devices/vsrc/vsrcload.c @@ -34,10 +34,10 @@ VSRCload(GENmodel *inModel, CKTcircuit *ckt) double value = 0.0; /* loop through all the source models */ - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { *(here->VSRCposIbrPtr) += 1.0 ; diff --git a/src/spicelib/devices/vsrc/vsrcpzld.c b/src/spicelib/devices/vsrc/vsrcpzld.c index 76d5fac2e..2349d9794 100644 --- a/src/spicelib/devices/vsrc/vsrcpzld.c +++ b/src/spicelib/devices/vsrc/vsrcpzld.c @@ -20,10 +20,10 @@ VSRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) NG_IGNORE(s); NG_IGNORE(ckt); - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { if (!(here->VSRCacGiven)) { diff --git a/src/spicelib/devices/vsrc/vsrcpzs.c b/src/spicelib/devices/vsrc/vsrcpzs.c index 0729559a7..df4848b9d 100644 --- a/src/spicelib/devices/vsrc/vsrcpzs.c +++ b/src/spicelib/devices/vsrc/vsrcpzs.c @@ -24,10 +24,10 @@ VSRCpzSetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, NG_IGNORE(state); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here = here->VSRCnextInstance) { if (here->VSRCbranch == 0) { diff --git a/src/spicelib/devices/vsrc/vsrcset.c b/src/spicelib/devices/vsrc/vsrcset.c index 32d8de3b8..8a901a33d 100644 --- a/src/spicelib/devices/vsrc/vsrcset.c +++ b/src/spicelib/devices/vsrc/vsrcset.c @@ -25,10 +25,10 @@ VSRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state) NG_IGNORE(state); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { if(here->VSRCposNode == here->VSRCnegNode) { @@ -65,9 +65,9 @@ VSRCunsetup(GENmodel *inModel, CKTcircuit *ckt) VSRCinstance *here; for (model = (VSRCmodel *)inModel; model != NULL; - model = model->VSRCnextModel) + model = VSRCnextModel(model)) { - for (here = model->VSRCinstances; here != NULL; + for (here = VSRCinstances(model); here != NULL; here=here->VSRCnextInstance) { if (here->VSRCbranch > 0) diff --git a/src/spicelib/devices/vsrc/vsrctemp.c b/src/spicelib/devices/vsrc/vsrctemp.c index ccc125a90..7cfb1e24f 100644 --- a/src/spicelib/devices/vsrc/vsrctemp.c +++ b/src/spicelib/devices/vsrc/vsrctemp.c @@ -23,10 +23,10 @@ VSRCtemp(GENmodel *inModel, CKTcircuit *ckt) NG_IGNORE(ckt); /* loop through all the voltage source models */ - for( ; model != NULL; model = model->VSRCnextModel ) { + for( ; model != NULL; model = VSRCnextModel(model) ) { /* loop through all the instances of the model */ - for (here = model->VSRCinstances; here != NULL ; + for (here = VSRCinstances(model); here != NULL ; here=here->VSRCnextInstance) { if(here->VSRCacGiven && !here->VSRCacMGiven) { diff --git a/src/xspice/cm/cmmeters.c b/src/xspice/cm/cmmeters.c index 8f398b341..6f05ed144 100644 --- a/src/xspice/cm/cmmeters.c +++ b/src/xspice/cm/cmmeters.c @@ -109,8 +109,8 @@ double cm_netlist_get_c(void) /* Scan through all capacitor instances and add in values */ /* of any capacitors connected to cmeter input */ - for(cap_model = cap_head; cap_model; cap_model = cap_model->CAPnextModel) { - for(cap_inst = cap_model->CAPinstances; + for(cap_model = cap_head; cap_model; cap_model = CAPnextModel(cap_model)) { + for(cap_inst = CAPinstances(cap_model); cap_inst; cap_inst = cap_inst->CAPnextInstance) { if((cmeter_node == cap_inst->CAPposNode) || @@ -136,8 +136,8 @@ double cm_netlist_get_c(void) /* Scan through all voltage source instances and add in values */ /* of any capacitors connected to cmeter input through voltage source */ - for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = vsrc_model->VSRCnextModel) { - for(vsrc_inst = vsrc_model->VSRCinstances; + for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = VSRCnextModel(vsrc_model)) { + for(vsrc_inst = VSRCinstances(vsrc_model); vsrc_inst; vsrc_inst = vsrc_inst->VSRCnextInstance) { @@ -160,8 +160,8 @@ double cm_netlist_get_c(void) /* Scan through all capacitor instances and add in values */ /* of any capacitors connected to the voltage source node */ - for(cap_model = cap_head; cap_model; cap_model = cap_model->CAPnextModel) { - for(cap_inst = cap_model->CAPinstances; + for(cap_model = cap_head; cap_model; cap_model = CAPnextModel(cap_model)) { + for(cap_inst = CAPinstances(cap_model); cap_inst; cap_inst = cap_inst->CAPnextInstance) { if((vsrc_node == cap_inst->CAPposNode) || @@ -240,8 +240,8 @@ double cm_netlist_get_l(void) /* Scan through all inductor instances and add in values */ /* of any inductors connected to lmeter input */ - for(ind_model = ind_head; ind_model; ind_model = ind_model->INDnextModel) { - for(ind_inst = ind_model->INDinstances; + for(ind_model = ind_head; ind_model; ind_model = INDnextModel(ind_model)) { + for(ind_inst = INDinstances(ind_model); ind_inst; ind_inst = ind_inst->INDnextInstance) { if((lmeter_node == ind_inst->INDposNode) || @@ -267,8 +267,8 @@ double cm_netlist_get_l(void) /* Scan through all voltage source instances and add in values */ /* of any inductors connected to lmeter input through voltage source */ - for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = vsrc_model->VSRCnextModel) { - for(vsrc_inst = vsrc_model->VSRCinstances; + for(vsrc_model = vsrc_head; vsrc_model; vsrc_model = VSRCnextModel(vsrc_model)) { + for(vsrc_inst = VSRCinstances(vsrc_model); vsrc_inst; vsrc_inst = vsrc_inst->VSRCnextInstance) { @@ -291,8 +291,8 @@ double cm_netlist_get_l(void) /* Scan through all inductor instances and add in values */ /* of any inductors connected to the voltage source node */ - for(ind_model = ind_head; ind_model; ind_model = ind_model->INDnextModel) { - for(ind_inst = ind_model->INDinstances; + for(ind_model = ind_head; ind_model; ind_model = INDnextModel(ind_model)) { + for(ind_inst = INDinstances(ind_model); ind_inst; ind_inst = ind_inst->INDnextInstance) { if((vsrc_node == ind_inst->INDposNode) || diff --git a/src/xspice/mif/mifconvt.c b/src/xspice/mif/mifconvt.c index 3077d83af..c07fb6031 100644 --- a/src/xspice/mif/mifconvt.c +++ b/src/xspice/mif/mifconvt.c @@ -104,10 +104,10 @@ int MIFconvTest( model = (MIFmodel *) inModel; /* loop through all models of this type */ - for( ; model != NULL; model = model->MIFnextModel) { + for( ; model != NULL; model = MIFnextModel(model)) { /* Loop through all instances of this model */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* Loop through all items registered for convergence */ for(i = 0; i < here->num_conv; i++) { diff --git a/src/xspice/mif/mifload.c b/src/xspice/mif/mifload.c index 3ceebe0d9..9080262e2 100644 --- a/src/xspice/mif/mifload.c +++ b/src/xspice/mif/mifload.c @@ -219,7 +219,7 @@ MIFload( /* ***************************************************************** */ /* loop through all models of this type */ /* ***************************************************************** */ - for( ; model != NULL; model = model->MIFnextModel) { + for( ; model != NULL; model = MIFnextModel(model)) { /* If not an analog or hybrid model, continue to next */ if(! model->analog) @@ -228,7 +228,7 @@ MIFload( /* ***************************************************************** */ /* loop through all instances of this model */ /* ***************************************************************** */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* If not an analog or hybrid instance, continue to next */ if(! here->analog) continue; diff --git a/src/xspice/mif/mifsetup.c b/src/xspice/mif/mifsetup.c index 4a943f220..863a97763 100644 --- a/src/xspice/mif/mifsetup.c +++ b/src/xspice/mif/mifsetup.c @@ -134,7 +134,7 @@ MIFsetup( /* loop through all models of this type */ - for( ; model != NULL; model = model->MIFnextModel) { + for( ; model != NULL; model = MIFnextModel(model)) { /* For each parameter not given explicitly on the .model */ @@ -157,7 +157,7 @@ MIFsetup( /* Since several instances may share this model, we have to create an array */ /* big enough for the instance with the biggest connection array */ max_size = 0; - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { size = here->conn[param_info->conn_ref]->size; if(size > max_size) max_size = size; @@ -204,7 +204,7 @@ MIFsetup( /* For each instance, initialize stuff used by cm_... functions */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { here->num_state = 0; here->state = NULL; @@ -220,7 +220,7 @@ MIFsetup( /* For each instance, allocate runtime structs for output connections/ports */ /* and grab a place in the state vector for all input connections/ports */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; @@ -267,7 +267,7 @@ MIFsetup( /* Loop through all instances of this model and for each port of each connection */ /* create current equations, matrix entries, and matrix pointers as necessary. */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; @@ -455,9 +455,9 @@ MIFunsetup(GENmodel *inModel,CKTcircuit *ckt) for (model = (MIFmodel *)inModel; model != NULL; - model = model->MIFnextModel) + model = MIFnextModel(model)) { - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* Skip these expensive allocations if the instance is not analog */ if(! here->analog) continue; diff --git a/src/xspice/mif/miftrunc.c b/src/xspice/mif/miftrunc.c index 99ed55379..57cd6ab44 100644 --- a/src/xspice/mif/miftrunc.c +++ b/src/xspice/mif/miftrunc.c @@ -92,10 +92,10 @@ MIFtrunc( /* loop through all models of this type */ - for( ; model != NULL; model = model->MIFnextModel) { + for( ; model != NULL; model = MIFnextModel(model)) { /* Loop through all instances of this model */ - for(here = model->MIFinstances; here != NULL; here = here->MIFnextInstance) { + for(here = MIFinstances(model); here != NULL; here = here->MIFnextInstance) { /* Loop through all integration states on the instance */ for(i = 0; i < here->num_intgr; i++) {