Browse Source

whitespace cleanup, comments cleanup, line wrap

pre-master-46
rlar 8 years ago
parent
commit
a8e440eabe
  1. 41
      src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml
  2. 42
      src/spicelib/devices/adms/admst/ngspiceMODULEmdel.c.xml
  3. 9
      src/spicelib/devices/asrc/asrcdel.c
  4. 4
      src/spicelib/devices/asrc/asrcmdel.c
  5. 15
      src/spicelib/devices/bjt/bjtdel.c
  6. 20
      src/spicelib/devices/bjt/bjtmdel.c
  7. 17
      src/spicelib/devices/bsim1/b1del.c
  8. 23
      src/spicelib/devices/bsim1/b1mdel.c
  9. 16
      src/spicelib/devices/bsim2/b2del.c
  10. 24
      src/spicelib/devices/bsim2/b2mdel.c
  11. 37
      src/spicelib/devices/bsim3/b3del.c
  12. 41
      src/spicelib/devices/bsim3/b3mdel.c
  13. 33
      src/spicelib/devices/bsim3soi_dd/b3soidddel.c
  14. 35
      src/spicelib/devices/bsim3soi_dd/b3soiddmdel.c
  15. 33
      src/spicelib/devices/bsim3soi_fd/b3soifddel.c
  16. 35
      src/spicelib/devices/bsim3soi_fd/b3soifdmdel.c
  17. 33
      src/spicelib/devices/bsim3soi_pd/b3soipddel.c
  18. 35
      src/spicelib/devices/bsim3soi_pd/b3soipdmdel.c
  19. 33
      src/spicelib/devices/bsim3v0/b3v0del.c
  20. 33
      src/spicelib/devices/bsim3v0/b3v0mdel.c
  21. 40
      src/spicelib/devices/bsim3v1/b3v1del.c
  22. 41
      src/spicelib/devices/bsim3v1/b3v1mdel.c
  23. 31
      src/spicelib/devices/bsim3v32/b3v32del.c
  24. 34
      src/spicelib/devices/bsim3v32/b3v32mdel.c
  25. 35
      src/spicelib/devices/bsim4/b4del.c
  26. 36
      src/spicelib/devices/bsim4/b4mdel.c
  27. 35
      src/spicelib/devices/bsim4v5/b4v5del.c
  28. 36
      src/spicelib/devices/bsim4v5/b4v5mdel.c
  29. 35
      src/spicelib/devices/bsim4v6/b4v6del.c
  30. 36
      src/spicelib/devices/bsim4v6/b4v6mdel.c
  31. 35
      src/spicelib/devices/bsim4v7/b4v7del.c
  32. 36
      src/spicelib/devices/bsim4v7/b4v7mdel.c
  33. 41
      src/spicelib/devices/bsimsoi/b4soidel.c
  34. 37
      src/spicelib/devices/bsimsoi/b4soimdel.c
  35. 18
      src/spicelib/devices/cap/capdel.c
  36. 25
      src/spicelib/devices/cap/capmdel.c
  37. 16
      src/spicelib/devices/cccs/cccsdel.c
  38. 24
      src/spicelib/devices/cccs/cccsmdel.c
  39. 15
      src/spicelib/devices/ccvs/ccvsdel.c
  40. 23
      src/spicelib/devices/ccvs/ccvsmdel.c
  41. 14
      src/spicelib/devices/cpl/cpldel.c
  42. 22
      src/spicelib/devices/cpl/cplmdel.c
  43. 16
      src/spicelib/devices/csw/cswdel.c
  44. 23
      src/spicelib/devices/csw/cswmdel.c
  45. 15
      src/spicelib/devices/dio/diodel.c
  46. 23
      src/spicelib/devices/dio/diomdel.c
  47. 18
      src/spicelib/devices/hfet1/hfetdel.c
  48. 26
      src/spicelib/devices/hfet1/hfetmdel.c
  49. 18
      src/spicelib/devices/hfet2/hfet2del.c
  50. 26
      src/spicelib/devices/hfet2/hfet2mdel.c
  51. 51
      src/spicelib/devices/hisim2/hsm2del.c
  52. 60
      src/spicelib/devices/hisim2/hsm2mdel.c
  53. 47
      src/spicelib/devices/hisimhv1/hsmhvdel.c
  54. 56
      src/spicelib/devices/hisimhv1/hsmhvmdel.c
  55. 55
      src/spicelib/devices/hisimhv2/hsmhv2del.c
  56. 64
      src/spicelib/devices/hisimhv2/hsmhv2mdel.c
  57. 15
      src/spicelib/devices/ind/inddel.c
  58. 23
      src/spicelib/devices/ind/indmdel.c
  59. 15
      src/spicelib/devices/ind/mutdel.c
  60. 23
      src/spicelib/devices/ind/mutmdel.c
  61. 11
      src/spicelib/devices/isrc/isrcdel.c
  62. 19
      src/spicelib/devices/isrc/isrcmdel.c
  63. 15
      src/spicelib/devices/jfet/jfetdel.c
  64. 23
      src/spicelib/devices/jfet/jfetmdel.c
  65. 13
      src/spicelib/devices/jfet2/jfet2del.c
  66. 23
      src/spicelib/devices/jfet2/jfet2mdel.c
  67. 32
      src/spicelib/devices/ltra/ltradel.c
  68. 48
      src/spicelib/devices/ltra/ltramdel.c
  69. 15
      src/spicelib/devices/mes/mesdel.c
  70. 23
      src/spicelib/devices/mes/mesmdel.c
  71. 18
      src/spicelib/devices/mesa/mesadel.c
  72. 26
      src/spicelib/devices/mesa/mesamdel.c
  73. 15
      src/spicelib/devices/mos1/mos1del.c
  74. 23
      src/spicelib/devices/mos1/mos1mdel.c
  75. 15
      src/spicelib/devices/mos2/mos2del.c
  76. 23
      src/spicelib/devices/mos2/mos2mdel.c
  77. 15
      src/spicelib/devices/mos3/mos3del.c
  78. 23
      src/spicelib/devices/mos3/mos3mdel.c
  79. 15
      src/spicelib/devices/mos6/mos6del.c
  80. 23
      src/spicelib/devices/mos6/mos6mdel.c
  81. 15
      src/spicelib/devices/mos9/mos9del.c
  82. 23
      src/spicelib/devices/mos9/mos9mdel.c
  83. 34
      src/spicelib/devices/nbjt/nbjtdel.c
  84. 35
      src/spicelib/devices/nbjt/nbjtmdel.c
  85. 35
      src/spicelib/devices/nbjt2/nbt2del.c
  86. 35
      src/spicelib/devices/nbjt2/nbt2mdel.c
  87. 28
      src/spicelib/devices/ndev/ndevdel.c
  88. 18
      src/spicelib/devices/ndev/ndevmdel.c
  89. 35
      src/spicelib/devices/numd/numddel.c
  90. 48
      src/spicelib/devices/numd/numdmdel.c
  91. 34
      src/spicelib/devices/numd2/nud2del.c
  92. 50
      src/spicelib/devices/numd2/nud2mdel.c
  93. 35
      src/spicelib/devices/numos/nummdel.c
  94. 35
      src/spicelib/devices/numos/nummmdel.c
  95. 15
      src/spicelib/devices/res/resdel.c
  96. 21
      src/spicelib/devices/res/resmdel.c
  97. 15
      src/spicelib/devices/soi3/soi3del.c
  98. 27
      src/spicelib/devices/soi3/soi3mdel.c
  99. 15
      src/spicelib/devices/sw/swdelete.c
  100. 23
      src/spicelib/devices/sw/swmdel.c

41
src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml

@ -40,36 +40,33 @@
<admst:template match="code"> <admst:template match="code">
<admst:value-of select="attribute[name='ngspicename']/value"/> <admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:variable name="module" select="%s"/> <admst:variable name="module" select="%s"/>
#include &quot;ngspice/ngspice.h&quot; #include &quot;ngspice/ngspice.h&quot;
#include &quot;$(module)defs.h&quot; #include &quot;$(module)defs.h&quot;
#include &quot;ngspice/sperror.h&quot; #include &quot;ngspice/sperror.h&quot;
#include &quot;ngspice/suffix.h&quot; #include &quot;ngspice/suffix.h&quot;
int $(module)delete(GENmodel *inModel, IFuid name, GENinstance **inInst) int $(module)delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
$(module)model *model = ($(module)model*)inModel;
$(module)instance **fast =($(module)instance**)inInst;
$(module)instance **prev = NULL;
$(module)instance *here;
for ( ; model ; model = model->$(module)nextModel ) {
prev = &amp;(model->$(module)instances);
for (here = *prev; here ; here = *prev) {
if(here->$(module)name == name || (fast &amp;&amp; here==*fast) ) {
*prev = here->$(module)nextInstance;
FREE(here);
return(OK);
}
prev = &amp;(here->$(module)nextInstance);
}
}
return(E_NODEV);
}
$(module)model *model = ($(module)model*)inModel;
$(module)instance **fast =($(module)instance**)inInst;
$(module)instance **prev = NULL;
$(module)instance *here;
for (; model; model = model->$(module)nextModel) {
prev = &amp;(model->$(module)instances);
for (here = *prev; here; here = *prev) {
if (here->$(module)name == name || (fast &amp;&amp; here == *fast)) {
*prev = here->$(module)nextInstance;
FREE(here);
return(OK);
}
prev = &amp;(here->$(module)nextInstance);
}
}
return(E_NODEV);
}
</admst:template> </admst:template>
<admst:for-each select="/module"> <admst:for-each select="/module">

42
src/spicelib/devices/adms/admst/ngspiceMODULEmdel.c.xml

@ -40,41 +40,39 @@
<admst:template match="code"> <admst:template match="code">
<admst:value-of select="attribute[name='ngspicename']/value"/> <admst:value-of select="attribute[name='ngspicename']/value"/>
<admst:variable name="module" select="%s"/> <admst:variable name="module" select="%s"/>
#include &quot;ngspice/ngspice.h&quot; #include &quot;ngspice/ngspice.h&quot;
#include &quot;$(module)defs.h&quot; #include &quot;$(module)defs.h&quot;
#include &quot;ngspice/sperror.h&quot; #include &quot;ngspice/sperror.h&quot;
#include &quot;ngspice/suffix.h&quot; #include &quot;ngspice/suffix.h&quot;
int $(module)mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) int $(module)mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
$(module)model **model = ($(module)model**)inModel;
$(module)model *modfast =($(module)model*)kill;
$(module)instance *here;
$(module)instance *prev = NULL;
$(module)model **oldmod;
oldmod = model;
for ( ; *model ; model = &amp;((*model)->$(module)nextModel)) {
if ((*model)->$(module)modName == modname ||
(modfast &amp;&amp; *model == modfast))
goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot:
$(module)model **model = ($(module)model**)inModel;
$(module)model *modfast =($(module)model*)kill;
$(module)instance *here;
$(module)instance *prev = NULL;
$(module)model **oldmod;
oldmod = model;
for (; *model; model = &amp;((*model)->$(module)nextModel)) {
if ((*model)->$(module)modName == modname ||
(modfast &amp;&amp; *model == modfast))
goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot:
*oldmod = (*model)->$(module)nextModel; /* cut deleted device out of list */ *oldmod = (*model)->$(module)nextModel; /* cut deleted device out of list */
for (here = (*model)->$(module)instances; here; here = here->$(module)nextInstance) for (here = (*model)->$(module)instances; here; here = here->$(module)nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }
</admst:template> </admst:template>
<admst:for-each select="/module"> <admst:for-each select="/module">

9
src/spicelib/devices/asrc/asrcdel.c

@ -12,15 +12,14 @@ Author: 1987 Kanwar Jit Singh
int int
ASRCdelete(GENmodel *model, IFuid name, GENinstance **fast) ASRCdelete(GENmodel *model, IFuid name, GENinstance **fast)
{ {
ASRCinstance **instPtr = (ASRCinstance**) fast;
ASRCmodel *modPtr = (ASRCmodel*) model;
ASRCinstance **instPtr = (ASRCinstance **) fast;
ASRCmodel *modPtr = (ASRCmodel *) model;
ASRCinstance **prev = NULL; ASRCinstance **prev = NULL;
ASRCinstance *here; ASRCinstance *here;
for (; modPtr ; modPtr = modPtr->ASRCnextModel) {
for (; modPtr; modPtr = modPtr->ASRCnextModel) {
prev = &(modPtr->ASRCinstances); prev = &(modPtr->ASRCinstances);
for (here = *prev; here ; here = *prev) {
for (here = *prev; here; here = *prev) {
if (here->ASRCname == name || (instPtr && here == *instPtr)) { if (here->ASRCname == name || (instPtr && here == *instPtr)) {
*prev = here->ASRCnextInstance; *prev = here->ASRCnextInstance;
FREE(here); FREE(here);

4
src/spicelib/devices/asrc/asrcmdel.c

@ -12,8 +12,8 @@ Author: 1987 Kanwar Jit Singh
int int
ASRCmDelete(GENmodel **modList, IFuid modname, GENmodel *killModel) ASRCmDelete(GENmodel **modList, IFuid modname, GENmodel *killModel)
{ {
ASRCmodel **model = (ASRCmodel**) modList;
ASRCmodel *modfast = (ASRCmodel*) killModel;
ASRCmodel **model = (ASRCmodel **) modList;
ASRCmodel *modfast = (ASRCmodel *) killModel;
ASRCinstance *here; ASRCinstance *here;
ASRCinstance *prev = NULL; ASRCinstance *prev = NULL;
ASRCmodel **oldmod; ASRCmodel **oldmod;

15
src/spicelib/devices/bjt/bjtdel.c

@ -16,24 +16,23 @@ Author: 1985 Thomas L. Quarles
int int
BJTdelete(GENmodel *inModel, IFuid name, GENinstance **kill) BJTdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
BJTmodel *model = (BJTmodel*)inModel;
BJTinstance **fast = (BJTinstance**)kill;
BJTmodel *model = (BJTmodel *) inModel;
BJTinstance **fast = (BJTinstance **) kill;
BJTinstance **prev = NULL; BJTinstance **prev = NULL;
BJTinstance *here; BJTinstance *here;
for( ; model ; model = model->BJTnextModel) {
for (; model; model = model->BJTnextModel) {
prev = &(model->BJTinstances); prev = &(model->BJTinstances);
for(here = *prev; here ; here = *prev) {
if(here->BJTname == name || (fast && here==*fast) ) {
*prev= here->BJTnextInstance;
for (here = *prev; here; here = *prev) {
if (here->BJTname == name || (fast && here == *fast)) {
*prev = here->BJTnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->BJTnextInstance); prev = &(here->BJTnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

20
src/spicelib/devices/bjt/bjtmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
/* /*
* This routine deletes a BJT model from the circuit and frees * This routine deletes a BJT model from the circuit and frees
@ -20,22 +18,22 @@ Author: 1985 Thomas L. Quarles
int int
BJTmDelete(GENmodel **inModels, IFuid modname, GENmodel *kill) BJTmDelete(GENmodel **inModels, IFuid modname, GENmodel *kill)
{ {
BJTmodel **model = (BJTmodel**)inModels;
BJTmodel *modfast = (BJTmodel*)kill;
BJTmodel **model = (BJTmodel **) inModels;
BJTmodel *modfast = (BJTmodel *) kill;
BJTmodel **oldmod; BJTmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->BJTnextModel)) {
if( (*model)->BJTmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->BJTnextModel)) {
if ((*model)->BJTmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
if( (*model)->BJTinstances ) return(E_NOTEMPTY);
delgot:
if ((*model)->BJTinstances) return(E_NOTEMPTY);
*oldmod = (*model)->BJTnextModel; /* cut deleted device out of list */ *oldmod = (*model)->BJTnextModel; /* cut deleted device out of list */
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

17
src/spicelib/devices/bsim1/b1del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim1def.h" #include "bsim1def.h"
@ -14,24 +12,23 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
int int
B1delete(GENmodel *inModel, IFuid name, GENinstance **inInst) B1delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
B1instance **fast = (B1instance**)inInst;
B1model *model = (B1model*)inModel;
B1instance **fast = (B1instance **) inInst;
B1model *model = (B1model *) inModel;
B1instance **prev = NULL; B1instance **prev = NULL;
B1instance *here; B1instance *here;
for( ; model ; model = model->B1nextModel) {
for (; model; model = model->B1nextModel) {
prev = &(model->B1instances); prev = &(model->B1instances);
for(here = *prev; here ; here = *prev) {
if(here->B1name == name || (fast && here==*fast) ) {
*prev= here->B1nextInstance;
for (here = *prev; here; here = *prev) {
if (here->B1name == name || (fast && here == *fast)) {
*prev = here->B1nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->B1nextInstance); prev = &(here->B1nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/bsim1/b1mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim1def.h" #include "bsim1def.h"
@ -14,27 +12,28 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
int int
B1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) B1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
B1model **model = (B1model**)inModel;
B1model *modfast = (B1model*)kill;
B1model **model = (B1model **) inModel;
B1model *modfast = (B1model *) kill;
B1instance *here; B1instance *here;
B1instance *prev = NULL; B1instance *prev = NULL;
B1model **oldmod; B1model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->B1nextModel)) {
if( (*model)->B1modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->B1nextModel)) {
if ((*model)->B1modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B1nextModel; /* cut deleted device out of list */ *oldmod = (*model)->B1nextModel; /* cut deleted device out of list */
for(here = (*model)->B1instances ; here ; here = here->B1nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->B1instances; here; here = here->B1nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

16
src/spicelib/devices/bsim2/b2del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim2def.h" #include "bsim2def.h"
@ -15,22 +13,22 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
int int
B2delete(GENmodel *inModel, IFuid name, GENinstance **inInst) B2delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
B2instance **fast = (B2instance**)inInst;
B2model *model = (B2model*)inModel;
B2instance **fast = (B2instance **) inInst;
B2model *model = (B2model *) inModel;
B2instance **prev = NULL; B2instance **prev = NULL;
B2instance *here; B2instance *here;
for( ; model ; model = model->B2nextModel) {
for (; model; model = model->B2nextModel) {
prev = &(model->B2instances); prev = &(model->B2instances);
for(here = *prev; here ; here = *prev) {
if(here->B2name == name || (fast && here==*fast) ) {
*prev= here->B2nextInstance;
for (here = *prev; here; here = *prev) {
if (here->B2name == name || (fast && here == *fast)) {
*prev = here->B2nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->B2nextInstance); prev = &(here->B2nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

24
src/spicelib/devices/bsim2/b2mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim2def.h" #include "bsim2def.h"
@ -14,28 +12,28 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
int int
B2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) B2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
B2model **model = (B2model**)inModel;
B2model *modfast = (B2model*)kill;
B2model **model = (B2model **) inModel;
B2model *modfast = (B2model *) kill;
B2instance *here; B2instance *here;
B2instance *prev = NULL; B2instance *prev = NULL;
B2model **oldmod; B2model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->B2nextModel)) {
if( (*model)->B2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->B2nextModel)) {
if ((*model)->B2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B2nextModel; /* cut deleted device out of list */ *oldmod = (*model)->B2nextModel; /* cut deleted device out of list */
for(here = (*model)->B2instances ; here ; here = here->B2nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->B2instances; here; here = here->B2nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

37
src/spicelib/devices/bsim3/b3del.c

@ -18,27 +18,26 @@
int int
BSIM3delete( BSIM3delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
BSIM3instance **fast = (BSIM3instance**)inInst;
BSIM3model *model = (BSIM3model*)inModel;
BSIM3instance **prev = NULL;
BSIM3instance *here;
BSIM3instance **fast = (BSIM3instance **) inInst;
BSIM3model *model = (BSIM3model *) inModel;
BSIM3instance **prev = NULL;
BSIM3instance *here;
for (; model ; model = model->BSIM3nextModel)
{ prev = &(model->BSIM3instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM3name == name || (fast && here==*fast))
{ *prev= here->BSIM3nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3nextInstance);
}
for (; model; model = model->BSIM3nextModel)
{ prev = &(model->BSIM3instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM3name == name || (fast && here == *fast))
{ *prev = here->BSIM3nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

41
src/spicelib/devices/bsim3/b3mdel.c

@ -3,7 +3,7 @@
/********** /**********
* Copyright 2004 Regents of the University of California. All rights reserved. * Copyright 2004 Regents of the University of California. All rights reserved.
* File: b3mdel.c of BSIM3v3.3.0 * File: b3mdel.c of BSIM3v3.3.0
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1997-1999 Weidong Liu. * Author: 1997-1999 Weidong Liu.
* Author: 2001 Xuemei Xi * Author: 2001 Xuemei Xi
**********/ **********/
@ -13,37 +13,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM3mDelete( BSIM3mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
BSIM3model **model = (BSIM3model**)inModel;
BSIM3model *modfast = (BSIM3model*)kill;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model **oldmod;
BSIM3model **model = (BSIM3model **) inModel;
BSIM3model *modfast = (BSIM3model *) kill;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM3nextModel))
{ if ((*model)->BSIM3modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM3nextModel))
{ if ((*model)->BSIM3modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM3nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM3nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM3instances; here; here = here->BSIM3nextInstance) for (here = (*model)->BSIM3instances; here; here = here->BSIM3nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

33
src/spicelib/devices/bsim3soi_dd/b3soidddel.c

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMDD2.1 release * BSIMDD2.1 release
*/ */
@ -20,23 +20,22 @@ Modified by Paolo Nenzi 2002
int int
B3SOIDDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst) B3SOIDDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
B3SOIDDinstance **fast = (B3SOIDDinstance**)inInst;
B3SOIDDmodel *model = (B3SOIDDmodel*)inModel;
B3SOIDDinstance **prev = NULL;
B3SOIDDinstance *here;
B3SOIDDinstance **fast = (B3SOIDDinstance **) inInst;
B3SOIDDmodel *model = (B3SOIDDmodel *) inModel;
B3SOIDDinstance **prev = NULL;
B3SOIDDinstance *here;
for (; model ; model = model->B3SOIDDnextModel)
{ prev = &(model->B3SOIDDinstances);
for (here = *prev; here ; here = *prev)
{ if (here->B3SOIDDname == name || (fast && here==*fast))
{ *prev= here->B3SOIDDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIDDnextInstance);
}
for (; model; model = model->B3SOIDDnextModel)
{ prev = &(model->B3SOIDDinstances);
for (here = *prev; here; here = *prev)
{ if (here->B3SOIDDname == name || (fast && here == *fast))
{ *prev = here->B3SOIDDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIDDnextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

35
src/spicelib/devices/bsim3soi_dd/b3soiddmdel.c

@ -7,7 +7,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMDD2.1 release * BSIMDD2.1 release
*/ */
@ -16,34 +16,33 @@ Modified by Paolo Nenzi 2002
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
B3SOIDDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) B3SOIDDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
B3SOIDDmodel **model = (B3SOIDDmodel**)inModel;
B3SOIDDmodel *modfast = (B3SOIDDmodel*)kill;
B3SOIDDinstance *here;
B3SOIDDinstance *prev = NULL;
B3SOIDDmodel **oldmod;
B3SOIDDmodel **model = (B3SOIDDmodel **) inModel;
B3SOIDDmodel *modfast = (B3SOIDDmodel *) kill;
B3SOIDDinstance *here;
B3SOIDDinstance *prev = NULL;
B3SOIDDmodel **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->B3SOIDDnextModel))
{ if ((*model)->B3SOIDDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->B3SOIDDnextModel))
{ if ((*model)->B3SOIDDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B3SOIDDnextModel; /* cut deleted device out of list */ *oldmod = (*model)->B3SOIDDnextModel; /* cut deleted device out of list */
for (here = (*model)->B3SOIDDinstances; here; here = here->B3SOIDDnextInstance) for (here = (*model)->B3SOIDDinstances; here; here = here->B3SOIDDnextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

33
src/spicelib/devices/bsim3soi_fd/b3soifddel.c

@ -6,7 +6,7 @@ File: b3soifddel.c 98/5/01
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMFD2.1 release * BSIMFD2.1 release
*/ */
@ -20,23 +20,22 @@ File: b3soifddel.c 98/5/01
int int
B3SOIFDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst) B3SOIFDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
B3SOIFDinstance **fast = (B3SOIFDinstance**)inInst;
B3SOIFDmodel *model = (B3SOIFDmodel*)inModel;
B3SOIFDinstance **prev = NULL;
B3SOIFDinstance *here;
B3SOIFDinstance **fast = (B3SOIFDinstance **) inInst;
B3SOIFDmodel *model = (B3SOIFDmodel *) inModel;
B3SOIFDinstance **prev = NULL;
B3SOIFDinstance *here;
for (; model ; model = model->B3SOIFDnextModel)
{ prev = &(model->B3SOIFDinstances);
for (here = *prev; here ; here = *prev)
{ if (here->B3SOIFDname == name || (fast && here==*fast))
{ *prev= here->B3SOIFDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIFDnextInstance);
}
for (; model; model = model->B3SOIFDnextModel)
{ prev = &(model->B3SOIFDinstances);
for (here = *prev; here; here = *prev)
{ if (here->B3SOIFDname == name || (fast && here == *fast))
{ *prev = here->B3SOIFDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIFDnextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

35
src/spicelib/devices/bsim3soi_fd/b3soifdmdel.c

@ -6,7 +6,7 @@ File: b3soifdmdel.c 98/5/01
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su
* Revision 2.1 99/9/27 Pin Su
* BSIMFD2.1 release * BSIMFD2.1 release
*/ */
@ -15,34 +15,33 @@ File: b3soifdmdel.c 98/5/01
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
B3SOIFDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) B3SOIFDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
B3SOIFDmodel **model = (B3SOIFDmodel**)inModel;
B3SOIFDmodel *modfast = (B3SOIFDmodel*)kill;
B3SOIFDinstance *here;
B3SOIFDinstance *prev = NULL;
B3SOIFDmodel **oldmod;
B3SOIFDmodel **model = (B3SOIFDmodel **) inModel;
B3SOIFDmodel *modfast = (B3SOIFDmodel *) kill;
B3SOIFDinstance *here;
B3SOIFDinstance *prev = NULL;
B3SOIFDmodel **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->B3SOIFDnextModel))
{ if ((*model)->B3SOIFDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->B3SOIFDnextModel))
{ if ((*model)->B3SOIFDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B3SOIFDnextModel; /* cut deleted device out of list */ *oldmod = (*model)->B3SOIFDnextModel; /* cut deleted device out of list */
for (here = (*model)->B3SOIFDinstances; here; here = here->B3SOIFDnextInstance) for (here = (*model)->B3SOIFDinstances; here; here = here->B3SOIFDnextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

33
src/spicelib/devices/bsim3soi_pd/b3soipddel.c

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.2.3 02/3/5 Pin Su
* Revision 2.2.3 02/3/5 Pin Su
* BSIMPD2.2.3 release * BSIMPD2.2.3 release
*/ */
@ -20,23 +20,22 @@ Modified by Paolo Nenzi 2002
int int
B3SOIPDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst) B3SOIPDdelete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
B3SOIPDinstance **fast = (B3SOIPDinstance**)inInst;
B3SOIPDmodel *model = (B3SOIPDmodel*)inModel;
B3SOIPDinstance **prev = NULL;
B3SOIPDinstance *here;
B3SOIPDinstance **fast = (B3SOIPDinstance **) inInst;
B3SOIPDmodel *model = (B3SOIPDmodel *) inModel;
B3SOIPDinstance **prev = NULL;
B3SOIPDinstance *here;
for (; model ; model = model->B3SOIPDnextModel)
{ prev = &(model->B3SOIPDinstances);
for (here = *prev; here ; here = *prev)
{ if (here->B3SOIPDname == name || (fast && here==*fast))
{ *prev= here->B3SOIPDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIPDnextInstance);
}
for (; model; model = model->B3SOIPDnextModel)
{ prev = &(model->B3SOIPDinstances);
for (here = *prev; here; here = *prev)
{ if (here->B3SOIPDname == name || (fast && here == *fast))
{ *prev = here->B3SOIPDnextInstance;
FREE(here);
return(OK);
}
prev = &(here->B3SOIPDnextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

35
src/spicelib/devices/bsim3soi_pd/b3soipdmdel.c

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.2.3 02/3/5 Pin Su
* Revision 2.2.3 02/3/5 Pin Su
* BSIMPD2.2.3 release * BSIMPD2.2.3 release
*/ */
@ -15,34 +15,33 @@ Modified by Paolo Nenzi 2002
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
B3SOIPDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) B3SOIPDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
B3SOIPDmodel **model = (B3SOIPDmodel**)inModel;
B3SOIPDmodel *modfast = (B3SOIPDmodel*)kill;
B3SOIPDinstance *here;
B3SOIPDinstance *prev = NULL;
B3SOIPDmodel **oldmod;
B3SOIPDmodel **model = (B3SOIPDmodel **) inModel;
B3SOIPDmodel *modfast = (B3SOIPDmodel *) kill;
B3SOIPDinstance *here;
B3SOIPDinstance *prev = NULL;
B3SOIPDmodel **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->B3SOIPDnextModel))
{ if ((*model)->B3SOIPDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->B3SOIPDnextModel))
{ if ((*model)->B3SOIPDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B3SOIPDnextModel; /* cut deleted device out of list */ *oldmod = (*model)->B3SOIPDnextModel; /* cut deleted device out of list */
for (here = (*model)->B3SOIPDinstances; here; here = here->B3SOIPDnextInstance) for (here = (*model)->B3SOIPDinstances; here; here = here->B3SOIPDnextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

33
src/spicelib/devices/bsim3v0/b3v0del.c

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1995 Min-Chie Jeng and Mansun Chan. Author: 1995 Min-Chie Jeng and Mansun Chan.
File: b3v0del.c File: b3v0del.c
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim3v0def.h" #include "bsim3v0def.h"
@ -16,23 +14,22 @@ File: b3v0del.c
int int
BSIM3v0delete(GENmodel *inModel, IFuid name, GENinstance **inInst) BSIM3v0delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
BSIM3v0instance **fast = (BSIM3v0instance**)inInst;
BSIM3v0model *model = (BSIM3v0model*)inModel;
BSIM3v0instance **prev = NULL;
BSIM3v0instance *here;
BSIM3v0instance **fast = (BSIM3v0instance **) inInst;
BSIM3v0model *model = (BSIM3v0model *) inModel;
BSIM3v0instance **prev = NULL;
BSIM3v0instance *here;
for (; model ; model = model->BSIM3v0nextModel)
{ prev = &(model->BSIM3v0instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM3v0name == name || (fast && here==*fast))
{ *prev= here->BSIM3v0nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v0nextInstance);
}
for (; model; model = model->BSIM3v0nextModel)
{ prev = &(model->BSIM3v0instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM3v0name == name || (fast && here == *fast))
{ *prev = here->BSIM3v0nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v0nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

33
src/spicelib/devices/bsim3v0/b3v0mdel.c

@ -9,34 +9,33 @@ File: b3v0mdel.c
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM3v0mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) BSIM3v0mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
BSIM3v0model **model = (BSIM3v0model**)inModel;
BSIM3v0model *modfast = (BSIM3v0model*)kill;
BSIM3v0instance *here;
BSIM3v0instance *prev = NULL;
BSIM3v0model **oldmod;
BSIM3v0model **model = (BSIM3v0model **) inModel;
BSIM3v0model *modfast = (BSIM3v0model *) kill;
BSIM3v0instance *here;
BSIM3v0instance *prev = NULL;
BSIM3v0model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM3v0nextModel))
{ if ((*model)->BSIM3v0modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM3v0nextModel))
{ if ((*model)->BSIM3v0modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM3v0nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM3v0nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) for (here = (*model)->BSIM3v0instances; here; here = here->BSIM3v0nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

40
src/spicelib/devices/bsim3v1/b3v1del.c

@ -1,16 +1,15 @@
/********** /**********
* Copyright 1990 Regents of the University of California. All rights reserved. * Copyright 1990 Regents of the University of California. All rights reserved.
* File: b3v1del.c * File: b3v1del.c
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Modified by Paolo Nenzi 2002 * Modified by Paolo Nenzi 2002
**********/ **********/
/*
* Release Notes:
/*
* Release Notes:
* BSIM3v3.1, Released by yuhua 96/12/08 * BSIM3v3.1, Released by yuhua 96/12/08
*/ */
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim3v1def.h" #include "bsim3v1def.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
@ -21,23 +20,22 @@
int int
BSIM3v1delete(GENmodel *inModel, IFuid name, GENinstance **inInst) BSIM3v1delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
BSIM3v1instance **fast = (BSIM3v1instance**)inInst;
BSIM3v1model *model = (BSIM3v1model*)inModel;
BSIM3v1instance **prev = NULL;
BSIM3v1instance *here;
BSIM3v1instance **fast = (BSIM3v1instance **) inInst;
BSIM3v1model *model = (BSIM3v1model *) inModel;
BSIM3v1instance **prev = NULL;
BSIM3v1instance *here;
for (; model ; model = model->BSIM3v1nextModel)
{ prev = &(model->BSIM3v1instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM3v1name == name || (fast && here==*fast))
{ *prev= here->BSIM3v1nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v1nextInstance);
}
for (; model; model = model->BSIM3v1nextModel)
{ prev = &(model->BSIM3v1instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM3v1name == name || (fast && here == *fast))
{ *prev = here->BSIM3v1nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v1nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

41
src/spicelib/devices/bsim3v1/b3v1mdel.c

@ -1,12 +1,12 @@
/********** /**********
* Copyright 1990 Regents of the University of California. All rights reserved. * Copyright 1990 Regents of the University of California. All rights reserved.
* File: b3v1mdel.c * File: b3v1mdel.c
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Author: 1995 Min-Chie Jeng and Mansun Chan.
* Modified by Paolo Nenzi 2002 * Modified by Paolo Nenzi 2002
**********/ **********/
/*
* Release Notes:
/*
* Release Notes:
* BSIM3v3.1, Released by yuhua 96/12/08 * BSIM3v3.1, Released by yuhua 96/12/08
*/ */
@ -15,34 +15,33 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM3v1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) BSIM3v1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
BSIM3v1model **model = (BSIM3v1model**)inModel;
BSIM3v1model *modfast = (BSIM3v1model*)kill;
BSIM3v1instance *here;
BSIM3v1instance *prev = NULL;
BSIM3v1model **oldmod;
BSIM3v1model **model = (BSIM3v1model **) inModel;
BSIM3v1model *modfast = (BSIM3v1model *) kill;
BSIM3v1instance *here;
BSIM3v1instance *prev = NULL;
BSIM3v1model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM3v1nextModel))
{ if ((*model)->BSIM3v1modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM3v1nextModel))
{ if ((*model)->BSIM3v1modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM3v1nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM3v1nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM3v1instances; here; here = here->BSIM3v1nextInstance) for (here = (*model)->BSIM3v1instances; here; here = here->BSIM3v1nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

31
src/spicelib/devices/bsim3v32/b3v32del.c

@ -18,23 +18,24 @@
int int
BSIM3v32delete (GENmodel *inModel, IFuid name, GENinstance **inInst)
BSIM3v32delete(GENmodel *inModel, IFuid name, GENinstance **inInst)
{ {
BSIM3v32instance **fast = (BSIM3v32instance**)inInst;
BSIM3v32model *model = (BSIM3v32model*)inModel;
BSIM3v32instance **prev = NULL;
BSIM3v32instance *here;
BSIM3v32instance **fast = (BSIM3v32instance **) inInst;
BSIM3v32model *model = (BSIM3v32model *) inModel;
BSIM3v32instance **prev = NULL;
BSIM3v32instance *here;
for (; model ; model = model->BSIM3v32nextModel)
{ prev = &(model->BSIM3v32instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM3v32name == name || (fast && here==*fast))
{ *prev= here->BSIM3v32nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v32nextInstance);
}
for (; model; model = model->BSIM3v32nextModel)
{ prev = &(model->BSIM3v32instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM3v32name == name || (fast && here == *fast))
{ *prev = here->BSIM3v32nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM3v32nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

34
src/spicelib/devices/bsim3v32/b3v32mdel.c

@ -14,33 +14,33 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM3v32mDelete (GENmodel **inModel, IFuid modname, GENmodel *kill)
BSIM3v32mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
BSIM3v32model **model = (BSIM3v32model**)inModel;
BSIM3v32model *modfast = (BSIM3v32model*)kill;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model **oldmod;
BSIM3v32model **model = (BSIM3v32model **) inModel;
BSIM3v32model *modfast = (BSIM3v32model *) kill;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM3v32nextModel))
{ if ((*model)->BSIM3v32modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM3v32nextModel))
{ if ((*model)->BSIM3v32modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM3v32nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM3v32nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) for (here = (*model)->BSIM3v32instances; here; here = here->BSIM3v32nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

35
src/spicelib/devices/bsim4/b4del.c

@ -67,25 +67,26 @@
int int
BSIM4delete( BSIM4delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
BSIM4instance **fast = (BSIM4instance**)inInst;
BSIM4model *model = (BSIM4model*)inModel;
BSIM4instance **prev = NULL;
BSIM4instance *here;
BSIM4instance **fast = (BSIM4instance **) inInst;
BSIM4model *model = (BSIM4model *) inModel;
BSIM4instance **prev = NULL;
BSIM4instance *here;
for (; model ; model = model->BSIM4nextModel)
{ prev = &(model->BSIM4instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM4name == name || (fast && here==*fast))
{ *prev= here->BSIM4nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4nextInstance);
}
for (; model; model = model->BSIM4nextModel)
{ prev = &(model->BSIM4instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM4name == name || (fast && here == *fast))
{ *prev = here->BSIM4nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

36
src/spicelib/devices/bsim4/b4mdel.c

@ -63,34 +63,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM4mDelete( BSIM4mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
BSIM4model **model = (BSIM4model**)inModel;
BSIM4model *modfast = (BSIM4model*)kill;
BSIM4instance *here;
BSIM4instance *prev = NULL;
BSIM4model **oldmod;
BSIM4model **model = (BSIM4model **) inModel;
BSIM4model *modfast = (BSIM4model *) kill;
BSIM4instance *here;
BSIM4instance *prev = NULL;
BSIM4model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM4nextModel))
{ if ((*model)->BSIM4modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM4nextModel))
{ if ((*model)->BSIM4modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM4nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM4nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM4instances; here; here = here->BSIM4nextInstance) for (here = (*model)->BSIM4instances; here; here = here->BSIM4nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

35
src/spicelib/devices/bsim4v5/b4v5del.c

@ -17,25 +17,26 @@
int int
BSIM4v5delete( BSIM4v5delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
BSIM4v5instance **fast = (BSIM4v5instance**)inInst;
BSIM4v5model *model = (BSIM4v5model*)inModel;
BSIM4v5instance **prev = NULL;
BSIM4v5instance *here;
BSIM4v5instance **fast = (BSIM4v5instance **) inInst;
BSIM4v5model *model = (BSIM4v5model *) inModel;
BSIM4v5instance **prev = NULL;
BSIM4v5instance *here;
for (; model ; model = model->BSIM4v5nextModel)
{ prev = &(model->BSIM4v5instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM4v5name == name || (fast && here==*fast))
{ *prev= here->BSIM4v5nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v5nextInstance);
}
for (; model; model = model->BSIM4v5nextModel)
{ prev = &(model->BSIM4v5instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM4v5name == name || (fast && here == *fast))
{ *prev = here->BSIM4v5nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v5nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

36
src/spicelib/devices/bsim4v5/b4v5mdel.c

@ -13,34 +13,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM4v5mDelete( BSIM4v5mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
BSIM4v5model **model = (BSIM4v5model**)inModel;
BSIM4v5model *modfast = (BSIM4v5model*)kill;
BSIM4v5instance *here;
BSIM4v5instance *prev = NULL;
BSIM4v5model **oldmod;
BSIM4v5model **model = (BSIM4v5model **) inModel;
BSIM4v5model *modfast = (BSIM4v5model *) kill;
BSIM4v5instance *here;
BSIM4v5instance *prev = NULL;
BSIM4v5model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM4v5nextModel))
{ if ((*model)->BSIM4v5modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM4v5nextModel))
{ if ((*model)->BSIM4v5modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM4v5nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM4v5nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) for (here = (*model)->BSIM4v5instances; here; here = here->BSIM4v5nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

35
src/spicelib/devices/bsim4v6/b4v6del.c

@ -19,25 +19,26 @@
int int
BSIM4v6delete( BSIM4v6delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
BSIM4v6instance **fast = (BSIM4v6instance**)inInst;
BSIM4v6model *model = (BSIM4v6model*)inModel;
BSIM4v6instance **prev = NULL;
BSIM4v6instance *here;
BSIM4v6instance **fast = (BSIM4v6instance **) inInst;
BSIM4v6model *model = (BSIM4v6model *) inModel;
BSIM4v6instance **prev = NULL;
BSIM4v6instance *here;
for (; model ; model = model->BSIM4v6nextModel)
{ prev = &(model->BSIM4v6instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM4v6name == name || (fast && here==*fast))
{ *prev= here->BSIM4v6nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v6nextInstance);
}
for (; model; model = model->BSIM4v6nextModel)
{ prev = &(model->BSIM4v6instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM4v6name == name || (fast && here == *fast))
{ *prev = here->BSIM4v6nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v6nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

36
src/spicelib/devices/bsim4v6/b4v6mdel.c

@ -15,34 +15,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM4v6mDelete( BSIM4v6mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
BSIM4v6model **model = (BSIM4v6model**)inModel;
BSIM4v6model *modfast = (BSIM4v6model*)kill;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model **oldmod;
BSIM4v6model **model = (BSIM4v6model **) inModel;
BSIM4v6model *modfast = (BSIM4v6model *) kill;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM4v6nextModel))
{ if ((*model)->BSIM4v6modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM4v6nextModel))
{ if ((*model)->BSIM4v6modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM4v6nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM4v6nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) for (here = (*model)->BSIM4v6instances; here; here = here->BSIM4v6nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

35
src/spicelib/devices/bsim4v7/b4v7del.c

@ -19,25 +19,26 @@
int int
BSIM4v7delete( BSIM4v7delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
BSIM4v7instance **fast = (BSIM4v7instance**)inInst;
BSIM4v7model *model = (BSIM4v7model*)inModel;
BSIM4v7instance **prev = NULL;
BSIM4v7instance *here;
BSIM4v7instance **fast = (BSIM4v7instance **) inInst;
BSIM4v7model *model = (BSIM4v7model *) inModel;
BSIM4v7instance **prev = NULL;
BSIM4v7instance *here;
for (; model ; model = model->BSIM4v7nextModel)
{ prev = &(model->BSIM4v7instances);
for (here = *prev; here ; here = *prev)
{ if (here->BSIM4v7name == name || (fast && here==*fast))
{ *prev= here->BSIM4v7nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v7nextInstance);
}
for (; model; model = model->BSIM4v7nextModel)
{ prev = &(model->BSIM4v7instances);
for (here = *prev; here; here = *prev)
{ if (here->BSIM4v7name == name || (fast && here == *fast))
{ *prev = here->BSIM4v7nextInstance;
FREE(here);
return(OK);
}
prev = &(here->BSIM4v7nextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

36
src/spicelib/devices/bsim4v7/b4v7mdel.c

@ -15,34 +15,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
BSIM4v7mDelete( BSIM4v7mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
BSIM4v7model **model = (BSIM4v7model**)inModel;
BSIM4v7model *modfast = (BSIM4v7model*)kill;
BSIM4v7instance *here;
BSIM4v7instance *prev = NULL;
BSIM4v7model **oldmod;
BSIM4v7model **model = (BSIM4v7model **) inModel;
BSIM4v7model *modfast = (BSIM4v7model *) kill;
BSIM4v7instance *here;
BSIM4v7instance *prev = NULL;
BSIM4v7model **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->BSIM4v7nextModel))
{ if ((*model)->BSIM4v7modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->BSIM4v7nextModel))
{ if ((*model)->BSIM4v7modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->BSIM4v7nextModel; /* cut deleted device out of list */ *oldmod = (*model)->BSIM4v7nextModel; /* cut deleted device out of list */
for (here = (*model)->BSIM4v7instances; here; here = here->BSIM4v7nextInstance) for (here = (*model)->BSIM4v7instances; here; here = here->BSIM4v7nextInstance)
{ if(prev) FREE(prev);
prev = here;
{ if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

41
src/spicelib/devices/bsimsoi/b4soidel.c

@ -1,6 +1,5 @@
/*** B4SOI 12/16/2010 Released by Tanvir Morshed ***/ /*** B4SOI 12/16/2010 Released by Tanvir Morshed ***/
/********** /**********
* Copyright 2010 Regents of the University of California. All rights reserved. * Copyright 2010 Regents of the University of California. All rights reserved.
* Authors: 1998 Samuel Fung, Dennis Sinitsky and Stephen Tang * Authors: 1998 Samuel Fung, Dennis Sinitsky and Stephen Tang
@ -15,7 +14,6 @@
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "b4soidef.h" #include "b4soidef.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/gendefs.h" #include "ngspice/gendefs.h"
@ -24,27 +22,26 @@
int int
B4SOIdelete( B4SOIdelete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
B4SOIinstance **fast = (B4SOIinstance**)inInst;
B4SOImodel *model = (B4SOImodel*)inModel;
B4SOIinstance **prev = NULL;
B4SOIinstance *here;
for (; model ; model = model->B4SOInextModel)
{ prev = &(model->B4SOIinstances);
for (here = *prev; here ; here = *prev)
{ if (here->B4SOIname == name || (fast && here==*fast))
{ *prev= here->B4SOInextInstance;
FREE(here);
return(OK);
}
prev = &(here->B4SOInextInstance);
}
B4SOIinstance **fast = (B4SOIinstance **) inInst;
B4SOImodel *model = (B4SOImodel *) inModel;
B4SOIinstance **prev = NULL;
B4SOIinstance *here;
for (; model; model = model->B4SOInextModel)
{ prev = &(model->B4SOIinstances);
for (here = *prev; here; here = *prev)
{ if (here->B4SOIname == name || (fast && here == *fast))
{ *prev = here->B4SOInextInstance;
FREE(here);
return(OK);
}
prev = &(here->B4SOInextInstance);
}
} }
return(E_NODEV); return(E_NODEV);
} }

37
src/spicelib/devices/bsimsoi/b4soimdel.c

@ -15,40 +15,41 @@
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "b4soidef.h" #include "b4soidef.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
B4SOImDelete( B4SOImDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
B4SOImodel **model = (B4SOImodel**)inModel;
B4SOImodel *modfast = (B4SOImodel*)kill;
B4SOIinstance *here;
B4SOIinstance *prev = NULL;
B4SOImodel **oldmod;
B4SOImodel **model = (B4SOImodel **) inModel;
B4SOImodel *modfast = (B4SOImodel *) kill;
B4SOIinstance *here;
B4SOIinstance *prev = NULL;
B4SOImodel **oldmod;
oldmod = model; oldmod = model;
for (; *model ; model = &((*model)->B4SOInextModel))
{ if ((*model)->B4SOImodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
for (; *model; model = &((*model)->B4SOInextModel))
{ if ((*model)->B4SOImodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->B4SOInextModel; /* cut deleted device out of list */ *oldmod = (*model)->B4SOInextModel; /* cut deleted device out of list */
for (here = (*model)->B4SOIinstances; here; here = here->B4SOInextInstance) for (here = (*model)->B4SOIinstances; here; here = here->B4SOInextInstance)
{ {
if(prev) FREE(prev);
prev = here;
if (prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

18
src/spicelib/devices/cap/capdel.c

@ -1,10 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: September 2003 Paolo Nenzi
Modified: September 2003 Paolo Nenzi
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "capdefs.h" #include "capdefs.h"
@ -15,22 +13,22 @@ Modified: September 2003 Paolo Nenzi
int int
CAPdelete(GENmodel *inModel, IFuid name, GENinstance **inst) CAPdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
CAPinstance **fast = (CAPinstance**)inst;
CAPmodel *model = (CAPmodel*)inModel;
CAPinstance **fast = (CAPinstance **) inst;
CAPmodel *model = (CAPmodel *) inModel;
CAPinstance **prev = NULL; CAPinstance **prev = NULL;
CAPinstance *here; CAPinstance *here;
for( ; model ; model = model->CAPnextModel) {
for (; model; model = model->CAPnextModel) {
prev = &(model->CAPinstances); prev = &(model->CAPinstances);
for(here = *prev; here ; here = *prev) {
if(here->CAPname == name || (fast && here==*fast) ) {
*prev= here->CAPnextInstance;
for (here = *prev; here; here = *prev) {
if (here->CAPname == name || (fast && here == *fast)) {
*prev = here->CAPnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->CAPnextInstance); prev = &(here->CAPnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

25
src/spicelib/devices/cap/capmdel.c

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Spetember 2003 Paolo Nenzi Modified: Spetember 2003 Paolo Nenzi
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "capdefs.h" #include "capdefs.h"
@ -15,29 +13,28 @@ Modified: Spetember 2003 Paolo Nenzi
int int
CAPmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) CAPmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
CAPmodel *modfast = (CAPmodel*)kill;
CAPmodel **model = (CAPmodel**)inModel;
CAPmodel *modfast = (CAPmodel *) kill;
CAPmodel **model = (CAPmodel **) inModel;
CAPinstance *here; CAPinstance *here;
CAPinstance *prev = NULL; CAPinstance *prev = NULL;
CAPmodel **oldmod; CAPmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->CAPnextModel)) {
if( (*model)->CAPmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->CAPnextModel)) {
if ((*model)->CAPmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->CAPnextModel; /* cut deleted device out of list */ *oldmod = (*model)->CAPnextModel; /* cut deleted device out of list */
for(here = (*model)->CAPinstances ; here ; here = here->CAPnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->CAPinstances; here; here = here->CAPnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

16
src/spicelib/devices/cccs/cccsdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cccsdefs.h" #include "cccsdefs.h"
@ -14,22 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
CCCSdelete(GENmodel *inModel, IFuid name, GENinstance **inst) CCCSdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
CCCSmodel *model = (CCCSmodel*)inModel;
CCCSinstance **fast = (CCCSinstance**)inst;
CCCSmodel *model = (CCCSmodel *) inModel;
CCCSinstance **fast = (CCCSinstance **) inst;
CCCSinstance **prev = NULL; CCCSinstance **prev = NULL;
CCCSinstance *here; CCCSinstance *here;
for( ; model ; model = model->CCCSnextModel) {
for (; model; model = model->CCCSnextModel) {
prev = &(model->CCCSinstances); prev = &(model->CCCSinstances);
for(here = *prev; here ; here = *prev) {
if(here->CCCSname == name || (fast && here==*fast) ) {
*prev= here->CCCSnextInstance;
for (here = *prev; here; here = *prev) {
if (here->CCCSname == name || (fast && here == *fast)) {
*prev = here->CCCSnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->CCCSnextInstance); prev = &(here->CCCSnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

24
src/spicelib/devices/cccs/cccsmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cccsdefs.h" #include "cccsdefs.h"
@ -14,28 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
CCCSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) CCCSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
CCCSmodel **model = (CCCSmodel**)inModel;
CCCSmodel *modfast = (CCCSmodel*)kill;
CCCSmodel **model = (CCCSmodel **) inModel;
CCCSmodel *modfast = (CCCSmodel *) kill;
CCCSinstance *here; CCCSinstance *here;
CCCSinstance *prev = NULL; CCCSinstance *prev = NULL;
CCCSmodel **oldmod; CCCSmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->CCCSnextModel)) {
if( (*model)->CCCSmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->CCCSnextModel)) {
if ((*model)->CCCSmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->CCCSnextModel; /* cut deleted device out of list */ *oldmod = (*model)->CCCSnextModel; /* cut deleted device out of list */
for(here = (*model)->CCCSinstances ; here ; here = here->CCCSnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->CCCSinstances; here; here = here->CCCSnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/ccvs/ccvsdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ccvsdefs.h" #include "ccvsdefs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
CCVSdelete(GENmodel *inModel, IFuid name, GENinstance **kill) CCVSdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
CCVSmodel *model = (CCVSmodel*)inModel;
CCVSinstance **fast = (CCVSinstance**)kill;
CCVSmodel *model = (CCVSmodel *) inModel;
CCVSinstance **fast = (CCVSinstance **) kill;
CCVSinstance **prev = NULL; CCVSinstance **prev = NULL;
CCVSinstance *here; CCVSinstance *here;
for( ; model ; model = model->CCVSnextModel) {
for (; model; model = model->CCVSnextModel) {
prev = &(model->CCVSinstances); prev = &(model->CCVSinstances);
for(here = *prev; here ; here = *prev) {
if(here->CCVSname == name || (fast && here==*fast) ) {
*prev= here->CCVSnextInstance;
for (here = *prev; here; here = *prev) {
if (here->CCVSname == name || (fast && here == *fast)) {
*prev = here->CCVSnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->CCVSnextInstance); prev = &(here->CCVSnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/ccvs/ccvsmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ccvsdefs.h" #include "ccvsdefs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
CCVSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) CCVSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
CCVSmodel **model = (CCVSmodel**)inModel;
CCVSmodel *modfast = (CCVSmodel*)kill;
CCVSmodel **model = (CCVSmodel **) inModel;
CCVSmodel *modfast = (CCVSmodel *) kill;
CCVSinstance *here; CCVSinstance *here;
CCVSinstance *prev = NULL; CCVSinstance *prev = NULL;
CCVSmodel **oldmod; CCVSmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->CCVSnextModel)) {
if( (*model)->CCVSmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->CCVSnextModel)) {
if ((*model)->CCVSmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->CCVSnextModel; /* cut deleted device out of list */ *oldmod = (*model)->CCVSnextModel; /* cut deleted device out of list */
for(here = (*model)->CCVSinstances ; here ; here = here->CCVSnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->CCVSinstances; here; here = here->CCVSnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

14
src/spicelib/devices/cpl/cpldel.c

@ -4,7 +4,6 @@ reserved.
Author: 1992 Charles Hough Author: 1992 Charles Hough
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cpldefs.h" #include "cpldefs.h"
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
@ -14,21 +13,22 @@ Author: 1992 Charles Hough
int int
CPLdelete(GENmodel *inModel, IFuid name, GENinstance **inst) CPLdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
CPLmodel *model = (CPLmodel *)inModel;
CPLinstance **fast = (CPLinstance **)inst;
CPLmodel *model = (CPLmodel *) inModel;
CPLinstance **fast = (CPLinstance **) inst;
CPLinstance **prev = NULL; CPLinstance **prev = NULL;
CPLinstance *here; CPLinstance *here;
for( ; model ; model = model->CPLnextModel) {
for (; model; model = model->CPLnextModel) {
prev = &(model->CPLinstances); prev = &(model->CPLinstances);
for(here = *prev; here ; here = *prev) {
if(here->CPLname == name || (fast && here==*fast) ) {
*prev= here->CPLnextInstance;
for (here = *prev; here; here = *prev) {
if (here->CPLname == name || (fast && here == *fast)) {
*prev = here->CPLnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->CPLnextInstance); prev = &(here->CPLnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

22
src/spicelib/devices/cpl/cplmdel.c

@ -14,28 +14,28 @@ Author: 1992 Charles Hough
int int
CPLmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) CPLmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
CPLmodel **model = (CPLmodel **)inModel;
CPLmodel *modfast = (CPLmodel *)kill;
CPLmodel **model = (CPLmodel **) inModel;
CPLmodel *modfast = (CPLmodel *) kill;
CPLinstance *here; CPLinstance *here;
CPLinstance *prev = NULL; CPLinstance *prev = NULL;
CPLmodel **oldmod; CPLmodel **oldmod;
oldmod = model;
for( ; *model ; model = &((*model)->CPLnextModel)) {
if( (*model)->CPLmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
oldmod = model;
for (; *model; model = &((*model)->CPLnextModel)) {
if ((*model)->CPLmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->CPLnextModel; /* cut deleted device out of list */ *oldmod = (*model)->CPLnextModel; /* cut deleted device out of list */
for(here = (*model)->CPLinstances ; here ; here = here->CPLnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->CPLinstances; here; here = here->CPLnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

16
src/spicelib/devices/csw/cswdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cswdefs.h" #include "cswdefs.h"
@ -13,23 +11,23 @@ Author: 1985 Gordon Jacobs
int int
CSWdelete(GENmodel *inModel, IFuid name, GENinstance **inst) CSWdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
CSWmodel *model = (CSWmodel*)inModel;
CSWinstance **fast = (CSWinstance**)inst;
CSWmodel *model = (CSWmodel *) inModel;
CSWinstance **fast = (CSWinstance **) inst;
CSWinstance **prev = NULL; CSWinstance **prev = NULL;
CSWinstance *here; CSWinstance *here;
for( ; model ; model = model->CSWnextModel) {
for (; model; model = model->CSWnextModel) {
prev = &(model->CSWinstances); prev = &(model->CSWinstances);
for(here = *prev; here ; here = *prev) {
if(here->CSWname == name || (fast && here==*fast) ) {
*prev= here->CSWnextInstance;
for (here = *prev; here; here = *prev) {
if (here->CSWname == name || (fast && here == *fast)) {
*prev = here->CSWnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->CSWnextInstance); prev = &(here->CSWnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/csw/cswmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cswdefs.h" #include "cswdefs.h"
@ -14,27 +12,28 @@ Author: 1985 Gordon Jacobs
int int
CSWmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) CSWmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
CSWmodel **model = (CSWmodel**)inModel;
CSWmodel *modfast = (CSWmodel*)kill;
CSWmodel **model = (CSWmodel **) inModel;
CSWmodel *modfast = (CSWmodel *) kill;
CSWinstance *here; CSWinstance *here;
CSWinstance *prev = NULL; CSWinstance *prev = NULL;
CSWmodel **oldmod; CSWmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->CSWnextModel)) {
if( (*model)->CSWmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->CSWnextModel)) {
if ((*model)->CSWmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->CSWnextModel; /* cut deleted device out of list */ *oldmod = (*model)->CSWnextModel; /* cut deleted device out of list */
for(here = (*model)->CSWinstances ; here ; here = here->CSWnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->CSWinstances; here; here = here->CSWnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/dio/diodel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "diodefs.h" #include "diodefs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
DIOdelete(GENmodel *inModel, IFuid name, GENinstance **kill) DIOdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
DIOmodel *model = (DIOmodel*)inModel;
DIOinstance **fast = (DIOinstance**)kill;
DIOmodel *model = (DIOmodel *) inModel;
DIOinstance **fast = (DIOinstance **) kill;
DIOinstance **prev = NULL; DIOinstance **prev = NULL;
DIOinstance *here; DIOinstance *here;
for( ; model ; model = model->DIOnextModel) {
for (; model; model = model->DIOnextModel) {
prev = &(model->DIOinstances); prev = &(model->DIOinstances);
for(here = *prev; here ; here = *prev) {
if(here->DIOname == name || (fast && here==*fast) ) {
*prev= here->DIOnextInstance;
for (here = *prev; here; here = *prev) {
if (here->DIOname == name || (fast && here == *fast)) {
*prev = here->DIOnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->DIOnextInstance); prev = &(here->DIOnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/dio/diomdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "diodefs.h" #include "diodefs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
DIOmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) DIOmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
DIOmodel **model = (DIOmodel**)inModel;
DIOmodel *modfast = (DIOmodel*)kill;
DIOmodel **model = (DIOmodel **) inModel;
DIOmodel *modfast = (DIOmodel *) kill;
DIOinstance *here; DIOinstance *here;
DIOinstance *prev = NULL; DIOinstance *prev = NULL;
DIOmodel **oldmod; DIOmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->DIOnextModel)) {
if( (*model)->DIOmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->DIOnextModel)) {
if ((*model)->DIOmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->DIOnextModel; /* cut deleted device out of list */ *oldmod = (*model)->DIOnextModel; /* cut deleted device out of list */
for(here = (*model)->DIOinstances ; here ; here = here->DIOnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->DIOinstances; here; here = here->DIOnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

18
src/spicelib/devices/hfet1/hfetdel.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into hfeta model: Paolo Nenzi 2001
*/
Imported into hfeta model: Paolo Nenzi 2001
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "hfetdefs.h" #include "hfetdefs.h"
@ -15,21 +16,22 @@ Imported into hfeta model: Paolo Nenzi 2001
int int
HFETAdelete(GENmodel *inModel, IFuid name, GENinstance **inst) HFETAdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
HFETAmodel *model = (HFETAmodel*)inModel;
HFETAinstance **fast = (HFETAinstance**)inst;
HFETAmodel *model = (HFETAmodel *) inModel;
HFETAinstance **fast = (HFETAinstance **) inst;
HFETAinstance **prev = NULL; HFETAinstance **prev = NULL;
HFETAinstance *here; HFETAinstance *here;
for( ; model ; model = model->HFETAnextModel) {
for (; model; model = model->HFETAnextModel) {
prev = &(model->HFETAinstances); prev = &(model->HFETAinstances);
for(here = *prev; here ; here = *prev) {
if(here->HFETAname == name || (fast && here==*fast) ) {
*prev= here->HFETAnextInstance;
for (here = *prev; here; here = *prev) {
if (here->HFETAname == name || (fast && here == *fast)) {
*prev = here->HFETAnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->HFETAnextInstance); prev = &(here->HFETAnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

26
src/spicelib/devices/hfet1/hfetmdel.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into hfeta model: Paolo Nenzi 2001
*/
Imported into hfeta model: Paolo Nenzi 2001
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "hfetdefs.h" #include "hfetdefs.h"
@ -15,27 +16,28 @@ Imported into hfeta model: Paolo Nenzi 2001
int int
HFETAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) HFETAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
HFETAmodel **model = (HFETAmodel**)inModel;
HFETAmodel *modfast = (HFETAmodel*)kill;
HFETAmodel **model = (HFETAmodel **) inModel;
HFETAmodel *modfast = (HFETAmodel *) kill;
HFETAinstance *here; HFETAinstance *here;
HFETAinstance *prev = NULL; HFETAinstance *prev = NULL;
HFETAmodel **oldmod; HFETAmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->HFETAnextModel)) {
if( (*model)->HFETAmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->HFETAnextModel)) {
if ((*model)->HFETAmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->HFETAnextModel; /* cut deleted device out of list */ *oldmod = (*model)->HFETAnextModel; /* cut deleted device out of list */
for(here = (*model)->HFETAinstances ; here ; here = here->HFETAnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->HFETAinstances; here; here = here->HFETAnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

18
src/spicelib/devices/hfet2/hfet2del.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into hfet2 model: Paolo Nenzi 2001
*/
Imported into hfet2 model: Paolo Nenzi 2001
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "hfet2defs.h" #include "hfet2defs.h"
@ -15,21 +16,22 @@ Imported into hfet2 model: Paolo Nenzi 2001
int int
HFET2delete(GENmodel *inModel, IFuid name, GENinstance **inst) HFET2delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
HFET2model *model = (HFET2model*)inModel;
HFET2instance **fast = (HFET2instance**)inst;
HFET2model *model = (HFET2model *) inModel;
HFET2instance **fast = (HFET2instance **) inst;
HFET2instance **prev = NULL; HFET2instance **prev = NULL;
HFET2instance *here; HFET2instance *here;
for( ; model ; model = model->HFET2nextModel) {
for (; model; model = model->HFET2nextModel) {
prev = &(model->HFET2instances); prev = &(model->HFET2instances);
for(here = *prev; here ; here = *prev) {
if(here->HFET2name == name || (fast && here==*fast) ) {
*prev= here->HFET2nextInstance;
for (here = *prev; here; here = *prev) {
if (here->HFET2name == name || (fast && here == *fast)) {
*prev = here->HFET2nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->HFET2nextInstance); prev = &(here->HFET2nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

26
src/spicelib/devices/hfet2/hfet2mdel.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into hfet2 model: Paolo Nenzi 2001
*/
Imported into hfet2 model: Paolo Nenzi 2001
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "hfet2defs.h" #include "hfet2defs.h"
@ -15,27 +16,28 @@ Imported into hfet2 model: Paolo Nenzi 2001
int int
HFET2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) HFET2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
HFET2model **model = (HFET2model**)inModel;
HFET2model *modfast = (HFET2model*)kill;
HFET2model **model = (HFET2model **) inModel;
HFET2model *modfast = (HFET2model *) kill;
HFET2instance *here; HFET2instance *here;
HFET2instance *prev = NULL; HFET2instance *prev = NULL;
HFET2model **oldmod; HFET2model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->HFET2nextModel)) {
if( (*model)->HFET2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->HFET2nextModel)) {
if ((*model)->HFET2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->HFET2nextModel; /* cut deleted device out of list */ *oldmod = (*model)->HFET2nextModel; /* cut deleted device out of list */
for(here = (*model)->HFET2instances ; here ; here = here->HFET2nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->HFET2instances; here; here = here->HFET2nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

51
src/spicelib/devices/hisim2/hsm2del.c

@ -5,12 +5,12 @@
MODEL NAME : HiSIM MODEL NAME : HiSIM
( VERSION : 2 SUBVERSION : 8 REVISION : 0 ) ( VERSION : 2 SUBVERSION : 8 REVISION : 0 )
FILE : hsm2del.c FILE : hsm2del.c
Date : 2014.6.5 Date : 2014.6.5
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaim all implied warranties. Hiroshima University and STARC hereby disclaim all implied warranties.
@ -60,26 +60,29 @@ to others."
#include "ngspice/gendefs.h" #include "ngspice/gendefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSM2delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
int
HSM2delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
HSM2instance **fast = (HSM2instance**)inInst;
HSM2model *model = (HSM2model*)inModel;
HSM2instance **prev = NULL;
HSM2instance *here;
for( ;model ;model = model->HSM2nextModel ) {
prev = &(model->HSM2instances);
for ( here = *prev ;here ;here = *prev ) {
if ( here->HSM2name == name || (fast && here==*fast) ) {
*prev= here->HSM2nextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSM2nextInstance);
HSM2instance **fast = (HSM2instance **) inInst;
HSM2model *model = (HSM2model *) inModel;
HSM2instance **prev = NULL;
HSM2instance *here;
for (; model; model = model->HSM2nextModel) {
prev = &(model->HSM2instances);
for (here = *prev; here; here = *prev) {
if (here->HSM2name == name || (fast && here == *fast)) {
*prev = here->HSM2nextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSM2nextInstance);
}
} }
}
return(E_NODEV);
return(E_NODEV);
} }

60
src/spicelib/devices/hisim2/hsm2mdel.c

@ -5,12 +5,12 @@
MODEL NAME : HiSIM MODEL NAME : HiSIM
( VERSION : 2 SUBVERSION : 8 REVISION : 0 ) ( VERSION : 2 SUBVERSION : 8 REVISION : 0 )
FILE : hsm2mdel.c FILE : hsm2mdel.c
Date : 2014.6.5 Date : 2014.6.5
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaim all implied warranties. Hiroshima University and STARC hereby disclaim all implied warranties.
@ -59,34 +59,36 @@ to others."
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSM2mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
int
HSM2mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
HSM2model **model = (HSM2model**)inModel;
HSM2model *modfast = (HSM2model*)kill;
HSM2instance *here;
HSM2instance *prev = NULL;
HSM2model **oldmod;
oldmod = model;
for ( ;*model ;model = &((*model)->HSM2nextModel) ) {
if ( (*model)->HSM2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
HSM2model **model = (HSM2model **) inModel;
HSM2model *modfast = (HSM2model *) kill;
HSM2instance *here;
HSM2instance *prev = NULL;
HSM2model **oldmod;
oldmod = model; oldmod = model;
}
return(E_NOMOD);
for (; *model; model = &((*model)->HSM2nextModel)) {
if ((*model)->HSM2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot: delgot:
*oldmod = (*model)->HSM2nextModel; /* cut deleted device out of list */
for ( here = (*model)->HSM2instances ;
here ;here = here->HSM2nextInstance ) {
*oldmod = (*model)->HSM2nextModel; /* cut deleted device out of list */
for (here = (*model)->HSM2instances;
here; here = here->HSM2nextInstance) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev); if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
FREE(*model);
return(OK);
FREE(*model);
return(OK);
} }

47
src/spicelib/devices/hisimhv1/hsmhvdel.c

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2012 Hiroshima University & STARC Copyright (C) 2012 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
MODEL NAME : HiSIM_HV
( VERSION : 1 SUBVERSION : 2 REVISION : 4 ) ( VERSION : 1 SUBVERSION : 2 REVISION : 4 )
Model Parameter VERSION : 1.23 Model Parameter VERSION : 1.23
FILE : hsmhvdel.c FILE : hsmhvdel.c
DATE : 2013.04.30 DATE : 2013.04.30
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -21,26 +21,29 @@
#include "ngspice/gendefs.h" #include "ngspice/gendefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSMHVdelete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
int
HSMHVdelete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
HSMHVinstance **fast = (HSMHVinstance**)inInst;
HSMHVmodel *model = (HSMHVmodel*)inModel;
HSMHVinstance **prev = NULL;
HSMHVinstance *here;
for( ;model ;model = model->HSMHVnextModel ) {
prev = &(model->HSMHVinstances);
for ( here = *prev ;here ;here = *prev ) {
if ( here->HSMHVname == name || (fast && here==*fast) ) {
*prev= here->HSMHVnextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSMHVnextInstance);
HSMHVinstance **fast = (HSMHVinstance **) inInst;
HSMHVmodel *model = (HSMHVmodel *) inModel;
HSMHVinstance **prev = NULL;
HSMHVinstance *here;
for (; model; model = model->HSMHVnextModel) {
prev = &(model->HSMHVinstances);
for (here = *prev; here; here = *prev) {
if (here->HSMHVname == name || (fast && here == *fast)) {
*prev = here->HSMHVnextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSMHVnextInstance);
}
} }
}
return(E_NODEV);
return(E_NODEV);
} }

56
src/spicelib/devices/hisimhv1/hsmhvmdel.c

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2012 Hiroshima University & STARC Copyright (C) 2012 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
MODEL NAME : HiSIM_HV
( VERSION : 1 SUBVERSION : 2 REVISION : 4 ) ( VERSION : 1 SUBVERSION : 2 REVISION : 4 )
Model Parameter VERSION : 1.23 Model Parameter VERSION : 1.23
FILE : hsmhvmdel.c FILE : hsmhvmdel.c
DATE : 2013.04.30 DATE : 2013.04.30
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -20,34 +20,36 @@
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSMHVmDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
int
HSMHVmDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
HSMHVmodel **model = (HSMHVmodel**)inModel;
HSMHVmodel *modfast = (HSMHVmodel*)kill;
HSMHVinstance *here;
HSMHVinstance *prev = NULL;
HSMHVmodel **oldmod;
oldmod = model;
for ( ;*model ;model = &((*model)->HSMHVnextModel) ) {
if ( (*model)->HSMHVmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
HSMHVmodel **model = (HSMHVmodel **) inModel;
HSMHVmodel *modfast = (HSMHVmodel *) kill;
HSMHVinstance *here;
HSMHVinstance *prev = NULL;
HSMHVmodel **oldmod;
oldmod = model; oldmod = model;
}
return(E_NOMOD);
for (; *model; model = &((*model)->HSMHVnextModel)) {
if ((*model)->HSMHVmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot: delgot:
*oldmod = (*model)->HSMHVnextModel; /* cut deleted device out of list */
for ( here = (*model)->HSMHVinstances ;
here ;here = here->HSMHVnextInstance ) {
*oldmod = (*model)->HSMHVnextModel; /* cut deleted device out of list */
for (here = (*model)->HSMHVinstances;
here; here = here->HSMHVnextInstance) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev); if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
FREE(*model);
return(OK);
FREE(*model);
return(OK);
} }

55
src/spicelib/devices/hisimhv2/hsmhv2del.c

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2014 Hiroshima University & STARC Copyright (C) 2014 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
Model Parameter 'VERSION' : 2.20 Model Parameter 'VERSION' : 2.20
FILE : hsmhvdel.c FILE : hsmhvdel.c
DATE : 2014.6.11 DATE : 2014.6.11
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaims all implied warranties. Hiroshima University and STARC hereby disclaims all implied warranties.
@ -54,7 +54,7 @@ to others."
Toshimasa Asahara, President, Hiroshima University Toshimasa Asahara, President, Hiroshima University
Mitiko Miura-Mattausch, Professor, Hiroshima University Mitiko Miura-Mattausch, Professor, Hiroshima University
Katsuhiro Shimohigashi, President&CEO, STARC Katsuhiro Shimohigashi, President&CEO, STARC
June 2008 (revised October 2011)
June 2008 (revised October 2011)
*************************************************************************/ *************************************************************************/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -63,26 +63,29 @@ June 2008 (revised October 2011)
#include "ngspice/gendefs.h" #include "ngspice/gendefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSMHV2delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
int
HSMHV2delete(
GENmodel *inModel,
IFuid name,
GENinstance **inInst)
{ {
HSMHV2instance **fast = (HSMHV2instance**)inInst;
HSMHV2model *model = (HSMHV2model*)inModel;
HSMHV2instance **prev = NULL;
HSMHV2instance *here;
for( ;model ;model = model->HSMHV2nextModel ) {
prev = &(model->HSMHV2instances);
for ( here = *prev ;here ;here = *prev ) {
if ( here->HSMHV2name == name || (fast && here==*fast) ) {
*prev= here->HSMHV2nextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSMHV2nextInstance);
HSMHV2instance **fast = (HSMHV2instance **) inInst;
HSMHV2model *model = (HSMHV2model *) inModel;
HSMHV2instance **prev = NULL;
HSMHV2instance *here;
for (; model; model = model->HSMHV2nextModel) {
prev = &(model->HSMHV2instances);
for (here = *prev; here; here = *prev) {
if (here->HSMHV2name == name || (fast && here == *fast)) {
*prev = here->HSMHV2nextInstance;
FREE(here);
return(OK);
}
prev = &(here->HSMHV2nextInstance);
}
} }
}
return(E_NODEV);
return(E_NODEV);
} }

64
src/spicelib/devices/hisimhv2/hsmhv2mdel.c

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2014 Hiroshima University & STARC Copyright (C) 2014 Hiroshima University & STARC
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
Model Parameter 'VERSION' : 2.20 Model Parameter 'VERSION' : 2.20
FILE : hsmhvmdel.c FILE : hsmhvmdel.c
DATE : 2014.6.11 DATE : 2014.6.11
released by
released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below.
Hiroshima University and STARC hereby disclaims all implied warranties. Hiroshima University and STARC hereby disclaims all implied warranties.
@ -54,7 +54,7 @@ to others."
Toshimasa Asahara, President, Hiroshima University Toshimasa Asahara, President, Hiroshima University
Mitiko Miura-Mattausch, Professor, Hiroshima University Mitiko Miura-Mattausch, Professor, Hiroshima University
Katsuhiro Shimohigashi, President&CEO, STARC Katsuhiro Shimohigashi, President&CEO, STARC
June 2008 (revised October 2011)
June 2008 (revised October 2011)
*************************************************************************/ *************************************************************************/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -62,34 +62,36 @@ June 2008 (revised October 2011)
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int HSMHV2mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
int
HSMHV2mDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
HSMHV2model **model = (HSMHV2model**)inModel;
HSMHV2model *modfast = (HSMHV2model*)kill;
HSMHV2instance *here;
HSMHV2instance *prev = NULL;
HSMHV2model **oldmod;
oldmod = model;
for ( ;*model ;model = &((*model)->HSMHV2nextModel) ) {
if ( (*model)->HSMHV2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
HSMHV2model **model = (HSMHV2model **) inModel;
HSMHV2model *modfast = (HSMHV2model *) kill;
HSMHV2instance *here;
HSMHV2instance *prev = NULL;
HSMHV2model **oldmod;
oldmod = model; oldmod = model;
}
return(E_NOMOD);
for (; *model; model = &((*model)->HSMHV2nextModel)) {
if ((*model)->HSMHV2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot: delgot:
*oldmod = (*model)->HSMHV2nextModel; /* cut deleted device out of list */
for ( here = (*model)->HSMHV2instances ;
here ;here = here->HSMHV2nextInstance ) {
*oldmod = (*model)->HSMHV2nextModel; /* cut deleted device out of list */
for (here = (*model)->HSMHV2instances;
here; here = here->HSMHV2nextInstance) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev); if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
FREE(*model);
return(OK);
FREE(*model);
return(OK);
} }

15
src/spicelib/devices/ind/inddel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
INDdelete(GENmodel *inModel, IFuid name, GENinstance **kill) INDdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
INDmodel *model = (INDmodel*)inModel;
INDinstance **fast = (INDinstance**)kill;
INDmodel *model = (INDmodel *) inModel;
INDinstance **fast = (INDinstance **) kill;
INDinstance **prev = NULL; INDinstance **prev = NULL;
INDinstance *here; INDinstance *here;
for( ; model ; model = model->INDnextModel) {
for (; model; model = model->INDnextModel) {
prev = &(model->INDinstances); prev = &(model->INDinstances);
for(here = *prev; here ; here = *prev) {
if(here->INDname == name || (fast && here==*fast) ) {
*prev= here->INDnextInstance;
for (here = *prev; here; here = *prev) {
if (here->INDname == name || (fast && here == *fast)) {
*prev = here->INDnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->INDnextInstance); prev = &(here->INDnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/ind/indmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
INDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) INDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
INDmodel **model = (INDmodel**)inModel;
INDmodel *modfast = (INDmodel*)kill;
INDmodel **model = (INDmodel **) inModel;
INDmodel *modfast = (INDmodel *) kill;
INDinstance *here; INDinstance *here;
INDinstance *prev = NULL; INDinstance *prev = NULL;
INDmodel **oldmod; INDmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->INDnextModel)) {
if( (*model)->INDmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->INDnextModel)) {
if ((*model)->INDmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->INDnextModel; /* cut deleted device out of list */ *oldmod = (*model)->INDnextModel; /* cut deleted device out of list */
for(here = (*model)->INDinstances ; here ; here = here->INDnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->INDinstances; here; here = here->INDnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/ind/mutdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -15,22 +13,23 @@ Author: 1985 Thomas L. Quarles
int int
MUTdelete(GENmodel *inModel, IFuid name, GENinstance **kill) MUTdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
MUTmodel *model = (MUTmodel*)inModel;
MUTinstance **fast = (MUTinstance**)kill;
MUTmodel *model = (MUTmodel *) inModel;
MUTinstance **fast = (MUTinstance **) kill;
MUTinstance **prev = NULL; MUTinstance **prev = NULL;
MUTinstance *here; MUTinstance *here;
for( ; model ; model = model->MUTnextModel) {
for (; model; model = model->MUTnextModel) {
prev = &(model->MUTinstances); prev = &(model->MUTinstances);
for(here = *prev; here ; here = *prev) {
if(here->MUTname == name || (fast && here==*fast) ) {
*prev= here->MUTnextInstance;
for (here = *prev; here; here = *prev) {
if (here->MUTname == name || (fast && here == *fast)) {
*prev = here->MUTnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MUTnextInstance); prev = &(here->MUTnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }
#endif /*MUTUAL*/ #endif /*MUTUAL*/

23
src/spicelib/devices/ind/mutmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -15,28 +13,29 @@ Author: 1985 Thomas L. Quarles
int int
MUTmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MUTmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MUTmodel **model = (MUTmodel**)inModel;
MUTmodel *modfast = (MUTmodel*)kill;
MUTmodel **model = (MUTmodel **) inModel;
MUTmodel *modfast = (MUTmodel *) kill;
MUTinstance *here; MUTinstance *here;
MUTinstance *prev = NULL; MUTinstance *prev = NULL;
MUTmodel **oldmod; MUTmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MUTnextModel)) {
if( (*model)->MUTmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MUTnextModel)) {
if ((*model)->MUTmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MUTnextModel; /* cut deleted device out of list */ *oldmod = (*model)->MUTnextModel; /* cut deleted device out of list */
for(here = (*model)->MUTinstances ; here ; here = here->MUTnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MUTinstances; here; here = here->MUTnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }
#endif /* MUTUAL */ #endif /* MUTUAL */

11
src/spicelib/devices/isrc/isrcdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "isrcdefs.h" #include "isrcdefs.h"
@ -19,16 +17,17 @@ ISRCdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
ISRCinstance **prev = NULL; ISRCinstance **prev = NULL;
ISRCinstance *here; ISRCinstance *here;
for( ; model ; model = model->ISRCnextModel) {
for (; model; model = model->ISRCnextModel) {
prev = &(model->ISRCinstances); prev = &(model->ISRCinstances);
for(here = *prev; here ; here = *prev) {
if(here->ISRCname == name || (fast && here==*fast) ) {
*prev= here->ISRCnextInstance;
for (here = *prev; here; here = *prev) {
if (here->ISRCname == name || (fast && here == *fast)) {
*prev = here->ISRCnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->ISRCnextInstance); prev = &(here->ISRCnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

19
src/spicelib/devices/isrc/isrcmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "isrcdefs.h" #include "isrcdefs.h"
@ -19,22 +17,23 @@ ISRCmDelete(GENmodel **inModel, IFuid modname, GENmodel *fast)
ISRCinstance *here; ISRCinstance *here;
ISRCinstance *prev = NULL; ISRCinstance *prev = NULL;
ISRCmodel **oldmod; ISRCmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->ISRCnextModel)) {
if( (*model)->ISRCmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->ISRCnextModel)) {
if ((*model)->ISRCmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->ISRCnextModel; /* cut deleted device out of list */ *oldmod = (*model)->ISRCnextModel; /* cut deleted device out of list */
for(here = (*model)->ISRCinstances ; here ; here = here->ISRCnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->ISRCinstances; here; here = here->ISRCnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/jfet/jfetdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "jfetdefs.h" #include "jfetdefs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
JFETdelete(GENmodel *inModel, IFuid name, GENinstance **inst) JFETdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
JFETmodel *model = (JFETmodel*)inModel;
JFETinstance **fast = (JFETinstance**)inst;
JFETmodel *model = (JFETmodel *) inModel;
JFETinstance **fast = (JFETinstance **) inst;
JFETinstance **prev = NULL; JFETinstance **prev = NULL;
JFETinstance *here; JFETinstance *here;
for( ; model ; model = model->JFETnextModel) {
for (; model; model = model->JFETnextModel) {
prev = &(model->JFETinstances); prev = &(model->JFETinstances);
for(here = *prev; here ; here = *prev) {
if(here->JFETname == name || (fast && here==*fast) ) {
*prev= here->JFETnextInstance;
for (here = *prev; here; here = *prev) {
if (here->JFETname == name || (fast && here == *fast)) {
*prev = here->JFETnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->JFETnextInstance); prev = &(here->JFETnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/jfet/jfetmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "jfetdefs.h" #include "jfetdefs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
JFETmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) JFETmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
JFETmodel **model = (JFETmodel**)inModel;
JFETmodel *modfast = (JFETmodel*)kill;
JFETmodel **model = (JFETmodel **) inModel;
JFETmodel *modfast = (JFETmodel *) kill;
JFETinstance *here; JFETinstance *here;
JFETinstance *prev = NULL; JFETinstance *prev = NULL;
JFETmodel **oldmod; JFETmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->JFETnextModel)) {
if( (*model)->JFETmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->JFETnextModel)) {
if ((*model)->JFETmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->JFETnextModel; /* cut deleted device out of list */ *oldmod = (*model)->JFETnextModel; /* cut deleted device out of list */
for(here = (*model)->JFETinstances ; here ; here = here->JFETnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->JFETinstances; here; here = here->JFETnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

13
src/spicelib/devices/jfet2/jfet2del.c

@ -16,21 +16,22 @@ Modified to jfet2 for PS model definition ( Anthony E. Parker )
int int
JFET2delete(GENmodel *inModel, IFuid name, GENinstance **inst) JFET2delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
JFET2model *model = (JFET2model*)inModel;
JFET2instance **fast = (JFET2instance**)inst;
JFET2model *model = (JFET2model *) inModel;
JFET2instance **fast = (JFET2instance **) inst;
JFET2instance **prev = NULL; JFET2instance **prev = NULL;
JFET2instance *here; JFET2instance *here;
for( ; model ; model = model->JFET2nextModel) {
for (; model; model = model->JFET2nextModel) {
prev = &(model->JFET2instances); prev = &(model->JFET2instances);
for(here = *prev; here ; here = *prev) {
if(here->JFET2name == name || (fast && here==*fast) ) {
*prev= here->JFET2nextInstance;
for (here = *prev; here; here = *prev) {
if (here->JFET2name == name || (fast && here == *fast)) {
*prev = here->JFET2nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->JFET2nextInstance); prev = &(here->JFET2nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/jfet2/jfet2mdel.c

@ -6,8 +6,6 @@ Author: 1985 Thomas L. Quarles
Modified to jfet2 for PS model definition ( Anthony E. Parker ) Modified to jfet2 for PS model definition ( Anthony E. Parker )
Copyright 1994 Macquarie University, Sydney Australia. Copyright 1994 Macquarie University, Sydney Australia.
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "jfet2defs.h" #include "jfet2defs.h"
@ -18,27 +16,28 @@ Modified to jfet2 for PS model definition ( Anthony E. Parker )
int int
JFET2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) JFET2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
JFET2model **model = (JFET2model**)inModel;
JFET2model *modfast = (JFET2model*)kill;
JFET2model **model = (JFET2model **) inModel;
JFET2model *modfast = (JFET2model *) kill;
JFET2instance *here; JFET2instance *here;
JFET2instance *prev = NULL; JFET2instance *prev = NULL;
JFET2model **oldmod; JFET2model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->JFET2nextModel)) {
if( (*model)->JFET2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->JFET2nextModel)) {
if ((*model)->JFET2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->JFET2nextModel; /* cut deleted device out of list */ *oldmod = (*model)->JFET2nextModel; /* cut deleted device out of list */
for(here = (*model)->JFET2instances ; here ; here = here->JFET2nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->JFET2instances; here; here = here->JFET2nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

32
src/spicelib/devices/ltra/ltradel.c

@ -8,24 +8,26 @@ Author: 1990 Jaijeet S. Roychowdhury
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
LTRAdelete(GENmodel *inModel, IFuid name, GENinstance **kill) LTRAdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
LTRAinstance **fast = (LTRAinstance **) kill;
LTRAmodel *model = (LTRAmodel *) inModel;
LTRAinstance **prev = NULL;
LTRAinstance *here;
LTRAinstance **fast = (LTRAinstance **) kill;
LTRAmodel *model = (LTRAmodel *) inModel;
LTRAinstance **prev = NULL;
LTRAinstance *here;
for (; model; model = model->LTRAnextModel) {
prev = &(model->LTRAinstances);
for (here = *prev; here; here = *prev) {
if (here->LTRAname == name || (fast && here == *fast)) {
*prev = here->LTRAnextInstance;
FREE(here);
return (OK);
}
prev = &(here->LTRAnextInstance);
for (; model; model = model->LTRAnextModel) {
prev = &(model->LTRAinstances);
for (here = *prev; here; here = *prev) {
if (here->LTRAname == name || (fast && here == *fast)) {
*prev = here->LTRAnextInstance;
FREE(here);
return(OK);
}
prev = &(here->LTRAnextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

48
src/spicelib/devices/ltra/ltramdel.c

@ -8,33 +8,35 @@ Author: 1990 Jaijeet S. Roychowdhury
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
LTRAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) LTRAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
LTRAmodel **model = (LTRAmodel **) inModel;
LTRAmodel *modfast = (LTRAmodel *) kill;
LTRAinstance *here;
LTRAinstance *prev = NULL;
LTRAmodel **oldmod;
oldmod = model;
for (; *model; model = &((*model)->LTRAnextModel)) {
if ((*model)->LTRAmodName == modname ||
(modfast && *model == modfast))
goto delgot;
LTRAmodel **model = (LTRAmodel **) inModel;
LTRAmodel *modfast = (LTRAmodel *) kill;
LTRAinstance *here;
LTRAinstance *prev = NULL;
LTRAmodel **oldmod;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->LTRAnextModel)) {
if ((*model)->LTRAmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
delgot:
*oldmod = (*model)->LTRAnextModel; /* cut deleted device out of list */
for (here = (*model)->LTRAinstances; here; here = here->LTRAnextInstance) {
if (prev)
FREE(prev);
prev = here;
}
if (prev)
FREE(prev);
FREE(*model);
return (OK);
return(E_NOMOD);
delgot:
*oldmod = (*model)->LTRAnextModel; /* cut deleted device out of list */
for (here = (*model)->LTRAinstances; here; here = here->LTRAnextInstance) {
if (prev)
FREE(prev);
prev = here;
}
if (prev)
FREE(prev);
FREE(*model);
return(OK);
} }

15
src/spicelib/devices/mes/mesdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mesdefs.h" #include "mesdefs.h"
@ -14,21 +12,22 @@ Author: 1985 S. Hwang
int int
MESdelete(GENmodel *inModel, IFuid name, GENinstance **inst) MESdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MESmodel *model = (MESmodel*)inModel;
MESinstance **fast = (MESinstance**)inst;
MESmodel *model = (MESmodel *) inModel;
MESinstance **fast = (MESinstance **) inst;
MESinstance **prev = NULL; MESinstance **prev = NULL;
MESinstance *here; MESinstance *here;
for( ; model ; model = model->MESnextModel) {
for (; model; model = model->MESnextModel) {
prev = &(model->MESinstances); prev = &(model->MESinstances);
for(here = *prev; here ; here = *prev) {
if(here->MESname == name || (fast && here==*fast) ) {
*prev= here->MESnextInstance;
for (here = *prev; here; here = *prev) {
if (here->MESname == name || (fast && here == *fast)) {
*prev = here->MESnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MESnextInstance); prev = &(here->MESnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mes/mesmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mesdefs.h" #include "mesdefs.h"
@ -14,27 +12,28 @@ Author: 1985 S. Hwang
int int
MESmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MESmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MESmodel **model = (MESmodel**)inModel;
MESmodel *modfast = (MESmodel*)kill;
MESmodel **model = (MESmodel **) inModel;
MESmodel *modfast = (MESmodel *) kill;
MESinstance *here; MESinstance *here;
MESinstance *prev = NULL; MESinstance *prev = NULL;
MESmodel **oldmod; MESmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MESnextModel)) {
if( (*model)->MESmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MESnextModel)) {
if ((*model)->MESmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MESnextModel; /* cut deleted device out of list */ *oldmod = (*model)->MESnextModel; /* cut deleted device out of list */
for(here = (*model)->MESinstances ; here ; here = here->MESnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MESinstances; here; here = here->MESnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

18
src/spicelib/devices/mesa/mesadel.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into mesa model: 2001 Paolo Nenzi
*/
Imported into mesa model: 2001 Paolo Nenzi
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mesadefs.h" #include "mesadefs.h"
@ -15,21 +16,22 @@ Imported into mesa model: 2001 Paolo Nenzi
int int
MESAdelete(GENmodel *inModel, IFuid name, GENinstance **inst) MESAdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MESAmodel *model = (MESAmodel*)inModel;
MESAinstance **fast = (MESAinstance**)inst;
MESAmodel *model = (MESAmodel *) inModel;
MESAinstance **fast = (MESAinstance **) inst;
MESAinstance **prev = NULL; MESAinstance **prev = NULL;
MESAinstance *here; MESAinstance *here;
for( ; model ; model = model->MESAnextModel) {
for (; model; model = model->MESAnextModel) {
prev = &(model->MESAinstances); prev = &(model->MESAinstances);
for(here = *prev; here ; here = *prev) {
if(here->MESAname == name || (fast && here==*fast) ) {
*prev= here->MESAnextInstance;
for (here = *prev; here; here = *prev) {
if (here->MESAname == name || (fast && here == *fast)) {
*prev = here->MESAnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MESAnextInstance); prev = &(here->MESAnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

26
src/spicelib/devices/mesa/mesamdel.c

@ -2,9 +2,10 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/* /*
Imported into mesa model: 2001 Paolo Nenzi
*/
Imported into mesa model: 2001 Paolo Nenzi
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mesadefs.h" #include "mesadefs.h"
@ -15,27 +16,28 @@ Author: 1985 S. Hwang
int int
MESAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MESAmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MESAmodel **model = (MESAmodel**)inModel;
MESAmodel *modfast = (MESAmodel*)kill;
MESAmodel **model = (MESAmodel **) inModel;
MESAmodel *modfast = (MESAmodel *) kill;
MESAinstance *here; MESAinstance *here;
MESAinstance *prev = NULL; MESAinstance *prev = NULL;
MESAmodel **oldmod; MESAmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MESAnextModel)) {
if( (*model)->MESAmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MESAnextModel)) {
if ((*model)->MESAmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MESAnextModel; /* cut deleted device out of list */ *oldmod = (*model)->MESAnextModel; /* cut deleted device out of list */
for(here = (*model)->MESAinstances ; here ; here = here->MESAnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MESAinstances; here; here = here->MESAnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/mos1/mos1del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos1defs.h" #include "mos1defs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
MOS1delete(GENmodel *inModel, IFuid name, GENinstance **inst) MOS1delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MOS1model *model = (MOS1model *)inModel;
MOS1instance **fast = (MOS1instance **)inst;
MOS1model *model = (MOS1model *) inModel;
MOS1instance **fast = (MOS1instance **) inst;
MOS1instance **prev = NULL; MOS1instance **prev = NULL;
MOS1instance *here; MOS1instance *here;
for( ; model ; model = model->MOS1nextModel) {
for (; model; model = model->MOS1nextModel) {
prev = &(model->MOS1instances); prev = &(model->MOS1instances);
for(here = *prev; here ; here = *prev) {
if(here->MOS1name == name || (fast && here==*fast) ) {
*prev= here->MOS1nextInstance;
for (here = *prev; here; here = *prev) {
if (here->MOS1name == name || (fast && here == *fast)) {
*prev = here->MOS1nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MOS1nextInstance); prev = &(here->MOS1nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mos1/mos1mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos1defs.h" #include "mos1defs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
MOS1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MOS1mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MOS1model **model = (MOS1model **)inModel;
MOS1model *modfast = (MOS1model *)kill;
MOS1model **model = (MOS1model **) inModel;
MOS1model *modfast = (MOS1model *) kill;
MOS1instance *here; MOS1instance *here;
MOS1instance *prev = NULL; MOS1instance *prev = NULL;
MOS1model **oldmod; MOS1model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MOS1nextModel)) {
if( (*model)->MOS1modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MOS1nextModel)) {
if ((*model)->MOS1modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MOS1nextModel; /* cut deleted device out of list */ *oldmod = (*model)->MOS1nextModel; /* cut deleted device out of list */
for(here = (*model)->MOS1instances ; here ; here = here->MOS1nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MOS1instances; here; here = here->MOS1nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/mos2/mos2del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos2defs.h" #include "mos2defs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
MOS2delete(GENmodel *inModel, IFuid name, GENinstance **inst) MOS2delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MOS2model *model = (MOS2model *)inModel;
MOS2instance **fast = (MOS2instance **)inst;
MOS2model *model = (MOS2model *) inModel;
MOS2instance **fast = (MOS2instance **) inst;
MOS2instance **prev = NULL; MOS2instance **prev = NULL;
MOS2instance *here; MOS2instance *here;
for( ; model ; model = model->MOS2nextModel) {
for (; model; model = model->MOS2nextModel) {
prev = &(model->MOS2instances); prev = &(model->MOS2instances);
for(here = *prev; here ; here = *prev) {
if(here->MOS2name == name || (fast && here==*fast) ) {
*prev= here->MOS2nextInstance;
for (here = *prev; here; here = *prev) {
if (here->MOS2name == name || (fast && here == *fast)) {
*prev = here->MOS2nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MOS2nextInstance); prev = &(here->MOS2nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mos2/mos2mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos2defs.h" #include "mos2defs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
MOS2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MOS2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MOS2model **model = (MOS2model **)inModel;
MOS2model *modfast = (MOS2model *)kill;
MOS2model **model = (MOS2model **) inModel;
MOS2model *modfast = (MOS2model *) kill;
MOS2instance *here; MOS2instance *here;
MOS2instance *prev = NULL; MOS2instance *prev = NULL;
MOS2model **oldmod; MOS2model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MOS2nextModel)) {
if( (*model)->MOS2modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MOS2nextModel)) {
if ((*model)->MOS2modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MOS2nextModel; /* cut deleted device out of list */ *oldmod = (*model)->MOS2nextModel; /* cut deleted device out of list */
for(here = (*model)->MOS2instances ; here ; here = here->MOS2nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MOS2instances; here; here = here->MOS2nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/mos3/mos3del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos3defs.h" #include "mos3defs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
MOS3delete(GENmodel *inModel, IFuid name, GENinstance **inst) MOS3delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MOS3model *model = (MOS3model *)inModel;
MOS3instance **fast = (MOS3instance **)inst;
MOS3model *model = (MOS3model *) inModel;
MOS3instance **fast = (MOS3instance **) inst;
MOS3instance **prev = NULL; MOS3instance **prev = NULL;
MOS3instance *here; MOS3instance *here;
for( ; model ; model = model->MOS3nextModel) {
for (; model; model = model->MOS3nextModel) {
prev = &(model->MOS3instances); prev = &(model->MOS3instances);
for(here = *prev; here ; here = *prev) {
if(here->MOS3name == name || (fast && here==*fast) ) {
*prev= here->MOS3nextInstance;
for (here = *prev; here; here = *prev) {
if (here->MOS3name == name || (fast && here == *fast)) {
*prev = here->MOS3nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MOS3nextInstance); prev = &(here->MOS3nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mos3/mos3mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos3defs.h" #include "mos3defs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
MOS3mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MOS3mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MOS3model **model = (MOS3model **)inModel;
MOS3model *modfast = (MOS3model *)kill;
MOS3model **model = (MOS3model **) inModel;
MOS3model *modfast = (MOS3model *) kill;
MOS3instance *here; MOS3instance *here;
MOS3instance *prev = NULL; MOS3instance *prev = NULL;
MOS3model **oldmod; MOS3model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MOS3nextModel)) {
if( (*model)->MOS3modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MOS3nextModel)) {
if ((*model)->MOS3modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MOS3nextModel; /* cut deleted device out of list */ *oldmod = (*model)->MOS3nextModel; /* cut deleted device out of list */
for(here = (*model)->MOS3instances ; here ; here = here->MOS3nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MOS3instances; here; here = here->MOS3nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/mos6/mos6del.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos6defs.h" #include "mos6defs.h"
@ -14,21 +12,22 @@ Author: 1985 Thomas L. Quarles
int int
MOS6delete(GENmodel *inModel, IFuid name, GENinstance **inst) MOS6delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MOS6model *model = (MOS6model *)inModel;
MOS6instance **fast = (MOS6instance **)inst;
MOS6model *model = (MOS6model *) inModel;
MOS6instance **fast = (MOS6instance **) inst;
MOS6instance **prev = NULL; MOS6instance **prev = NULL;
MOS6instance *here; MOS6instance *here;
for( ; model ; model = model->MOS6nextModel) {
for (; model; model = model->MOS6nextModel) {
prev = &(model->MOS6instances); prev = &(model->MOS6instances);
for(here = *prev; here ; here = *prev) {
if(here->MOS6name == name || (fast && here==*fast) ) {
*prev= here->MOS6nextInstance;
for (here = *prev; here; here = *prev) {
if (here->MOS6name == name || (fast && here == *fast)) {
*prev = here->MOS6nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MOS6nextInstance); prev = &(here->MOS6nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mos6/mos6mdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos6defs.h" #include "mos6defs.h"
@ -14,27 +12,28 @@ Author: 1985 Thomas L. Quarles
int int
MOS6mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MOS6mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MOS6model **model = (MOS6model **)inModel;
MOS6model *modfast = (MOS6model *)kill;
MOS6model **model = (MOS6model **) inModel;
MOS6model *modfast = (MOS6model *) kill;
MOS6instance *here; MOS6instance *here;
MOS6instance *prev = NULL; MOS6instance *prev = NULL;
MOS6model **oldmod; MOS6model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MOS6nextModel)) {
if( (*model)->MOS6modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MOS6nextModel)) {
if ((*model)->MOS6modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MOS6nextModel; /* cut deleted device out of list */ *oldmod = (*model)->MOS6nextModel; /* cut deleted device out of list */
for(here = (*model)->MOS6instances ; here ; here = here->MOS6nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MOS6instances; here; here = here->MOS6nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/mos9/mos9del.c

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Alan Gillespie Modified: Alan Gillespie
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos9defs.h" #include "mos9defs.h"
@ -15,21 +13,22 @@ Modified: Alan Gillespie
int int
MOS9delete(GENmodel *inModel, IFuid name, GENinstance **inst) MOS9delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
MOS9model *model = (MOS9model *)inModel;
MOS9instance **fast = (MOS9instance **)inst;
MOS9model *model = (MOS9model *) inModel;
MOS9instance **fast = (MOS9instance **) inst;
MOS9instance **prev = NULL; MOS9instance **prev = NULL;
MOS9instance *here; MOS9instance *here;
for( ; model ; model = model->MOS9nextModel) {
for (; model; model = model->MOS9nextModel) {
prev = &(model->MOS9instances); prev = &(model->MOS9instances);
for(here = *prev; here ; here = *prev) {
if(here->MOS9name == name || (fast && here==*fast) ) {
*prev= here->MOS9nextInstance;
for (here = *prev; here; here = *prev) {
if (here->MOS9name == name || (fast && here == *fast)) {
*prev = here->MOS9nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->MOS9nextInstance); prev = &(here->MOS9nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/mos9/mos9mdel.c

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Alan Gillespie Modified: Alan Gillespie
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos9defs.h" #include "mos9defs.h"
@ -15,27 +13,28 @@ Modified: Alan Gillespie
int int
MOS9mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) MOS9mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
MOS9model **model = (MOS9model **)inModel;
MOS9model *modfast = (MOS9model *)kill;
MOS9model **model = (MOS9model **) inModel;
MOS9model *modfast = (MOS9model *) kill;
MOS9instance *here; MOS9instance *here;
MOS9instance *prev = NULL; MOS9instance *prev = NULL;
MOS9model **oldmod; MOS9model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->MOS9nextModel)) {
if( (*model)->MOS9modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->MOS9nextModel)) {
if ((*model)->MOS9modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->MOS9nextModel; /* cut deleted device out of list */ *oldmod = (*model)->MOS9nextModel; /* cut deleted device out of list */
for(here = (*model)->MOS9instances ; here ; here = here->MOS9nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->MOS9instances; here; here = here->MOS9nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

34
src/spicelib/devices/nbjt/nbjtdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,24 +13,26 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NBJTdelete(GENmodel *inModel, IFuid name, GENinstance **kill) NBJTdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
NBJTmodel *model = (NBJTmodel *) inModel;
NBJTinstance **fast = (NBJTinstance **) kill;
NBJTinstance **prev = NULL;
NBJTinstance *inst;
NBJTmodel *model = (NBJTmodel *) inModel;
NBJTinstance **fast = (NBJTinstance **) kill;
NBJTinstance **prev = NULL;
NBJTinstance *inst;
for (; model; model = model->NBJTnextModel) {
prev = &(model->NBJTinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NBJTname == name || (fast && inst == *fast)) {
*prev = inst->NBJTnextInstance;
FREE(inst);
return (OK);
}
prev = &(inst->NBJTnextInstance);
for (; model; model = model->NBJTnextModel) {
prev = &(model->NBJTinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NBJTname == name || (fast && inst == *fast)) {
*prev = inst->NBJTnextInstance;
FREE(inst);
return(OK);
}
prev = &(inst->NBJTnextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

35
src/spicelib/devices/nbjt/nbjtmdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,27 +13,28 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NBJTmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) NBJTmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
NBJTmodel **model = (NBJTmodel **) inModel;
NBJTmodel *modfast = (NBJTmodel *) kill;
NBJTmodel **oldmod;
NBJTmodel **model = (NBJTmodel **) inModel;
NBJTmodel *modfast = (NBJTmodel *) kill;
NBJTmodel **oldmod;
oldmod = model;
for (; *model; model = &((*model)->NBJTnextModel)) {
if ((*model)->NBJTmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->NBJTnextModel)) {
if ((*model)->NBJTmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
delgot:
if ((*model)->NBJTinstances)
return (E_NOTEMPTY);
*oldmod = (*model)->NBJTnextModel; /* cut deleted device out of list */
FREE(*model);
return (OK);
return(E_NOMOD);
delgot:
if ((*model)->NBJTinstances)
return(E_NOTEMPTY);
*oldmod = (*model)->NBJTnextModel; /* cut deleted device out of list */
FREE(*model);
return(OK);
} }

35
src/spicelib/devices/nbjt2/nbt2del.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,25 +13,26 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NBJT2delete(GENmodel *inModel, IFuid name, GENinstance **kill) NBJT2delete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
NBJT2model *model = (NBJT2model *) inModel;
NBJT2instance **fast = (NBJT2instance **) kill;
NBJT2instance **prev = NULL;
NBJT2instance *inst;
NBJT2model *model = (NBJT2model *) inModel;
NBJT2instance **fast = (NBJT2instance **) kill;
NBJT2instance **prev = NULL;
NBJT2instance *inst;
for (; model; model = model->NBJT2nextModel) {
prev = &(model->NBJT2instances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NBJT2name == name || (fast && inst == *fast)) {
*prev = inst->NBJT2nextInstance;
FREE(inst);
return (OK);
}
prev = &(inst->NBJT2nextInstance);
for (; model; model = model->NBJT2nextModel) {
prev = &(model->NBJT2instances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NBJT2name == name || (fast && inst == *fast)) {
*prev = inst->NBJT2nextInstance;
FREE(inst);
return(OK);
}
prev = &(inst->NBJT2nextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

35
src/spicelib/devices/nbjt2/nbt2mdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,27 +13,28 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NBJT2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) NBJT2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
NBJT2model **model = (NBJT2model **) inModel;
NBJT2model *modfast = (NBJT2model *) kill;
NBJT2model **oldmod;
NBJT2model **model = (NBJT2model **) inModel;
NBJT2model *modfast = (NBJT2model *) kill;
NBJT2model **oldmod;
oldmod = model;
for (; *model; model = &((*model)->NBJT2nextModel)) {
if ((*model)->NBJT2modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->NBJT2nextModel)) {
if ((*model)->NBJT2modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
delgot:
if ((*model)->NBJT2instances)
return (E_NOTEMPTY);
*oldmod = (*model)->NBJT2nextModel; /* cut deleted device out of list */
FREE(*model);
return (OK);
return(E_NOMOD);
delgot:
if ((*model)->NBJT2instances)
return(E_NOTEMPTY);
*oldmod = (*model)->NBJT2nextModel; /* cut deleted device out of list */
FREE(*model);
return(OK);
} }

28
src/spicelib/devices/ndev/ndevdel.c

@ -1,7 +1,7 @@
/********** /**********
Permit to use it as your wish. Permit to use it as your wish.
Author: 2007 Gong Ding, gdiso@ustc.edu
University of Science and Technology of China
Author: 2007 Gong Ding, gdiso@ustc.edu
University of Science and Technology of China
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -9,29 +9,29 @@ University of Science and Technology of China
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NDEVdelete( NDEVdelete(
GENmodel *inModel,
IFuid name,
GENinstance **kill )
GENmodel *inModel,
IFuid name,
GENinstance **kill)
{ {
NDEVmodel *model = (NDEVmodel *)inModel;
NDEVinstance **fast = (NDEVinstance **)kill;
NDEVmodel *model = (NDEVmodel *) inModel;
NDEVinstance **fast = (NDEVinstance **) kill;
NDEVinstance **prev = NULL; NDEVinstance **prev = NULL;
NDEVinstance *here; NDEVinstance *here;
for( ; model ; model = model->NDEVnextModel) {
for (; model; model = model->NDEVnextModel) {
prev = &(model->NDEVinstances); prev = &(model->NDEVinstances);
for(here = *prev; here ; here = *prev) {
if(here->NDEVname == name || (fast && here==*fast) ) {
*prev= here->NDEVnextInstance;
for (here = *prev; here; here = *prev) {
if (here->NDEVname == name || (fast && here == *fast)) {
*prev = here->NDEVnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->NDEVnextInstance); prev = &(here->NDEVnextInstance);
} }
} }
return (E_NODEV);
return(E_NODEV);
} }

18
src/spicelib/devices/ndev/ndevmdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -8,16 +8,16 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NDEVmDelete( NDEVmDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill )
GENmodel **inModel,
IFuid modname,
GENmodel *kill)
{ {
NG_IGNORE(inModel);
NG_IGNORE(modname);
NG_IGNORE(kill);
NG_IGNORE(inModel);
NG_IGNORE(modname);
NG_IGNORE(kill);
return (OK);
return(OK);
} }

35
src/spicelib/devices/numd/numddel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -8,25 +8,26 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMDdelete(GENmodel *inModel, IFuid name, GENinstance **kill) NUMDdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
NUMDmodel *model = (NUMDmodel *) inModel;
NUMDinstance **fast = (NUMDinstance **) kill;
NUMDinstance **prev = NULL;
NUMDinstance *inst;
NUMDmodel *model = (NUMDmodel *) inModel;
NUMDinstance **fast = (NUMDinstance **) kill;
NUMDinstance **prev = NULL;
NUMDinstance *inst;
for (; model; model = model->NUMDnextModel) {
prev = &(model->NUMDinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMDname == name || (fast && inst == *fast)) {
*prev = inst->NUMDnextInstance;
FREE(inst);
return (OK);
}
prev = &(inst->NUMDnextInstance);
for (; model; model = model->NUMDnextModel) {
prev = &(model->NUMDinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMDname == name || (fast && inst == *fast)) {
*prev = inst->NUMDnextInstance;
FREE(inst);
return(OK);
}
prev = &(inst->NUMDnextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

48
src/spicelib/devices/numd/numdmdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -8,33 +8,35 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) NUMDmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
NUMDmodel **model = (NUMDmodel **) inModel;
NUMDmodel *modfast = (NUMDmodel *) kill;
NUMDinstance *inst;
NUMDinstance *prev = NULL;
NUMDmodel **oldmod;
NUMDmodel **model = (NUMDmodel **) inModel;
NUMDmodel *modfast = (NUMDmodel *) kill;
NUMDinstance *inst;
NUMDinstance *prev = NULL;
NUMDmodel **oldmod;
oldmod = model;
for (; *model; model = &((*model)->NUMDnextModel)) {
if ((*model)->NUMDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->NUMDnextModel)) {
if ((*model)->NUMDmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
return(E_NOMOD);
delgot:
*oldmod = (*model)->NUMDnextModel; /* cut deleted device out of list */
for (inst = (*model)->NUMDinstances; inst; inst = inst->NUMDnextInstance) {
delgot:
*oldmod = (*model)->NUMDnextModel; /* cut deleted device out of list */
for (inst = (*model)->NUMDinstances; inst; inst = inst->NUMDnextInstance) {
if (prev)
FREE(prev);
prev = inst;
}
if (prev) if (prev)
FREE(prev);
prev = inst;
}
if (prev)
FREE(prev);
FREE(*model);
return (OK);
FREE(prev);
FREE(*model);
return(OK);
} }

34
src/spicelib/devices/numd2/nud2del.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -8,24 +8,26 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMD2delete(GENmodel *inModel, IFuid name, GENinstance **kill) NUMD2delete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
NUMD2model *model = (NUMD2model *) inModel;
NUMD2instance **fast = (NUMD2instance **) kill;
NUMD2instance **prev = NULL;
NUMD2instance *inst;
NUMD2model *model = (NUMD2model *) inModel;
NUMD2instance **fast = (NUMD2instance **) kill;
NUMD2instance **prev = NULL;
NUMD2instance *inst;
for (; model; model = model->NUMD2nextModel) {
prev = &(model->NUMD2instances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMD2name == name || (fast && inst == *fast)) {
*prev = inst->NUMD2nextInstance;
FREE(inst);
return (OK);
}
prev = &(inst->NUMD2nextInstance);
for (; model; model = model->NUMD2nextModel) {
prev = &(model->NUMD2instances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMD2name == name || (fast && inst == *fast)) {
*prev = inst->NUMD2nextInstance;
FREE(inst);
return(OK);
}
prev = &(inst->NUMD2nextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

50
src/spicelib/devices/numd2/nud2mdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -8,33 +8,35 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMD2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) NUMD2mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
NUMD2model **model = (NUMD2model **) inModel;
NUMD2model *modfast = (NUMD2model *) kill;
NUMD2instance *inst;
NUMD2instance *prev = NULL;
NUMD2model **oldmod;
oldmod = model;
for (; *model; model = &((*model)->NUMD2nextModel)) {
if ((*model)->NUMD2modName == modname ||
(modfast && *model == modfast))
goto delgot;
NUMD2model **model = (NUMD2model **) inModel;
NUMD2model *modfast = (NUMD2model *) kill;
NUMD2instance *inst;
NUMD2instance *prev = NULL;
NUMD2model **oldmod;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->NUMD2nextModel)) {
if ((*model)->NUMD2modName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
delgot:
*oldmod = (*model)->NUMD2nextModel; /* cut deleted device out of list */
for (inst = (*model)->NUMD2instances; inst; inst = inst->NUMD2nextInstance) {
if (prev)
FREE(prev);
prev = inst;
}
if (prev)
FREE(prev);
FREE(*model);
return (OK);
return(E_NOMOD);
delgot:
*oldmod = (*model)->NUMD2nextModel; /* cut deleted device out of list */
for (inst = (*model)->NUMD2instances; inst; inst = inst->NUMD2nextInstance) {
if (prev)
FREE(prev);
prev = inst;
}
if (prev)
FREE(prev);
FREE(*model);
return(OK);
} }

35
src/spicelib/devices/numos/nummdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1991 Regents of the University of California. All rights reserved. Copyright 1991 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,25 +13,26 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMOSdelete(GENmodel *inModel, IFuid name, GENinstance **kill) NUMOSdelete(GENmodel *inModel, IFuid name, GENinstance **kill)
{ {
NUMOSmodel *model = (NUMOSmodel *) inModel;
NUMOSinstance **fast = (NUMOSinstance **) kill;
NUMOSinstance **prev = NULL;
NUMOSinstance *inst;
NUMOSmodel *model = (NUMOSmodel *) inModel;
NUMOSinstance **fast = (NUMOSinstance **) kill;
NUMOSinstance **prev = NULL;
NUMOSinstance *inst;
for (; model; model = model->NUMOSnextModel) {
prev = &(model->NUMOSinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMOSname == name || (fast && inst == *fast)) {
*prev = inst->NUMOSnextInstance;
FREE(inst);
return (OK);
}
prev = &(inst->NUMOSnextInstance);
for (; model; model = model->NUMOSnextModel) {
prev = &(model->NUMOSinstances);
for (inst = *prev; inst; inst = *prev) {
if (inst->NUMOSname == name || (fast && inst == *fast)) {
*prev = inst->NUMOSnextInstance;
FREE(inst);
return(OK);
}
prev = &(inst->NUMOSnextInstance);
}
} }
}
return (E_NODEV);
return(E_NODEV);
} }

35
src/spicelib/devices/numos/nummmdel.c

@ -1,6 +1,6 @@
/********** /**********
Copyright 1991 Regents of the University of California. All rights reserved. Copyright 1991 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -13,27 +13,28 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/sperror.h" #include "ngspice/sperror.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
int int
NUMOSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) NUMOSmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
NUMOSmodel **model = (NUMOSmodel **) inModel;
NUMOSmodel *modfast = (NUMOSmodel *) kill;
NUMOSmodel **oldmod;
NUMOSmodel **model = (NUMOSmodel **) inModel;
NUMOSmodel *modfast = (NUMOSmodel *) kill;
NUMOSmodel **oldmod;
oldmod = model;
for (; *model; model = &((*model)->NUMOSnextModel)) {
if ((*model)->NUMOSmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model; oldmod = model;
}
return (E_NOMOD);
for (; *model; model = &((*model)->NUMOSnextModel)) {
if ((*model)->NUMOSmodName == modname ||
(modfast && *model == modfast))
goto delgot;
oldmod = model;
}
delgot:
if ((*model)->NUMOSinstances)
return (E_NOTEMPTY);
*oldmod = (*model)->NUMOSnextModel; /* cut deleted device out of list */
FREE(*model);
return (OK);
return(E_NOMOD);
delgot:
if ((*model)->NUMOSinstances)
return(E_NOTEMPTY);
*oldmod = (*model)->NUMOSnextModel; /* cut deleted device out of list */
FREE(*model);
return(OK);
} }

15
src/spicelib/devices/res/resdel.c

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Apr 2000 - Paolo Nenzi Modified: Apr 2000 - Paolo Nenzi
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "resdefs.h" #include "resdefs.h"
@ -14,21 +12,22 @@ Modified: Apr 2000 - Paolo Nenzi
int int
RESdelete(GENmodel *inModel, IFuid name, GENinstance **inst) RESdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
RESmodel *model = (RESmodel *)inModel;
RESinstance **fast = (RESinstance **)inst;
RESmodel *model = (RESmodel *) inModel;
RESinstance **fast = (RESinstance **) inst;
RESinstance **prev = NULL; RESinstance **prev = NULL;
RESinstance *here; RESinstance *here;
for( ; model ; model = model->RESnextModel) {
for (; model; model = model->RESnextModel) {
prev = &(model->RESinstances); prev = &(model->RESinstances);
for(here = *prev; here ; here = *prev) {
if(here->RESname == name || (fast && here==*fast) ) {
*prev= here->RESnextInstance;
for (here = *prev; here; here = *prev) {
if (here->RESname == name || (fast && here == *fast)) {
*prev = here->RESnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->RESnextInstance); prev = &(here->RESnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

21
src/spicelib/devices/res/resmdel.c

@ -12,27 +12,28 @@ Modified: Apr 2000 - Paolo Nenzi
int int
RESmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) RESmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
RESmodel **model = (RESmodel **)inModel;
RESmodel *modfast = (RESmodel *)kill;
RESmodel **model = (RESmodel **) inModel;
RESmodel *modfast = (RESmodel *) kill;
RESinstance *here; RESinstance *here;
RESinstance *prev = NULL; RESinstance *prev = NULL;
RESmodel **oldmod; RESmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->RESnextModel)) {
if( (*model)->RESmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->RESnextModel)) {
if ((*model)->RESmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->RESnextModel; /* cut deleted device out of list */ *oldmod = (*model)->RESnextModel; /* cut deleted device out of list */
for(here = (*model)->RESinstances ; here ; here = here->RESnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->RESinstances; here; here = here->RESnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/soi3/soi3del.c

@ -15,7 +15,7 @@ With help from : Bernard Tenbroek, Bill Redman-White, Mike Uren, Chris Edwards
Acknowledgements : Rupert Howes and Pete Mole. Acknowledgements : Rupert Howes and Pete Mole.
**********/ **********/
/**********
/**********
Modified by Paolo Nenzi 2002 Modified by Paolo Nenzi 2002
ngspice integration ngspice integration
**********/ **********/
@ -29,21 +29,22 @@ ngspice integration
int int
SOI3delete(GENmodel *inModel, IFuid name, GENinstance **inst) SOI3delete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
SOI3model *model = (SOI3model *)inModel;
SOI3instance **fast = (SOI3instance **)inst;
SOI3model *model = (SOI3model *) inModel;
SOI3instance **fast = (SOI3instance **) inst;
SOI3instance **prev = NULL; SOI3instance **prev = NULL;
SOI3instance *here; SOI3instance *here;
for( ; model ; model = model->SOI3nextModel) {
for (; model; model = model->SOI3nextModel) {
prev = &(model->SOI3instances); prev = &(model->SOI3instances);
for(here = *prev; here ; here = *prev) {
if(here->SOI3name == name || (fast && here==*fast) ) {
*prev= here->SOI3nextInstance;
for (here = *prev; here; here = *prev) {
if (here->SOI3name == name || (fast && here == *fast)) {
*prev = here->SOI3nextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->SOI3nextInstance); prev = &(here->SOI3nextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

27
src/spicelib/devices/soi3/soi3mdel.c

@ -15,9 +15,9 @@ With help from : Bernard Tenbroek, Bill Redman-White, Mike Uren, Chris Edwards
Acknowledgements : Rupert Howes and Pete Mole. Acknowledgements : Rupert Howes and Pete Mole.
**********/ **********/
/**********
Modified by Paolo Nenzi 2002
ngspice integration
/**********
Modified by Paolo Nenzi 2002
ngspice integration
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -29,27 +29,28 @@ ngspice integration
int int
SOI3mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) SOI3mDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
SOI3model **model = (SOI3model **)inModel;
SOI3model *modfast = (SOI3model *)kill;
SOI3model **model = (SOI3model **) inModel;
SOI3model *modfast = (SOI3model *) kill;
SOI3instance *here; SOI3instance *here;
SOI3instance *prev = NULL; SOI3instance *prev = NULL;
SOI3model **oldmod; SOI3model **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->SOI3nextModel)) {
if( (*model)->SOI3modName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->SOI3nextModel)) {
if ((*model)->SOI3modName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->SOI3nextModel; /* cut deleted device out of list */ *oldmod = (*model)->SOI3nextModel; /* cut deleted device out of list */
for(here = (*model)->SOI3instances ; here ; here = here->SOI3nextInstance) {
if(prev) FREE(prev);
for (here = (*model)->SOI3instances; here; here = here->SOI3nextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

15
src/spicelib/devices/sw/swdelete.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "swdefs.h" #include "swdefs.h"
@ -14,21 +12,22 @@ Author: 1985 Gordon Jacobs
int int
SWdelete(GENmodel *inModel, IFuid name, GENinstance **inst) SWdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
{ {
SWmodel *model = (SWmodel *)inModel;
SWinstance **fast = (SWinstance **)inst;
SWmodel *model = (SWmodel *) inModel;
SWinstance **fast = (SWinstance **) inst;
SWinstance **prev = NULL; SWinstance **prev = NULL;
SWinstance *here; SWinstance *here;
for( ; model ; model = model->SWnextModel) {
for (; model; model = model->SWnextModel) {
prev = &(model->SWinstances); prev = &(model->SWinstances);
for(here = *prev; here ; here = *prev) {
if(here->SWname == name || (fast && here==*fast) ) {
*prev= here->SWnextInstance;
for (here = *prev; here; here = *prev) {
if (here->SWname == name || (fast && here == *fast)) {
*prev = here->SWnextInstance;
FREE(here); FREE(here);
return(OK); return(OK);
} }
prev = &(here->SWnextInstance); prev = &(here->SWnextInstance);
} }
} }
return(E_NODEV); return(E_NODEV);
} }

23
src/spicelib/devices/sw/swmdel.c

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "swdefs.h" #include "swdefs.h"
@ -14,27 +12,28 @@ Author: 1985 Gordon Jacobs
int int
SWmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill) SWmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
{ {
SWmodel **model = (SWmodel **)inModel;
SWmodel *modfast = (SWmodel *)kill;
SWmodel **model = (SWmodel **) inModel;
SWmodel *modfast = (SWmodel *) kill;
SWinstance *here; SWinstance *here;
SWinstance *prev = NULL; SWinstance *prev = NULL;
SWmodel **oldmod; SWmodel **oldmod;
oldmod = model; oldmod = model;
for( ; *model ; model = &((*model)->SWnextModel)) {
if( (*model)->SWmodName == modname ||
(modfast && *model == modfast) ) goto delgot;
for (; *model; model = &((*model)->SWnextModel)) {
if ((*model)->SWmodName == modname ||
(modfast && *model == modfast)) goto delgot;
oldmod = model; oldmod = model;
} }
return(E_NOMOD); return(E_NOMOD);
delgot:
delgot:
*oldmod = (*model)->SWnextModel; /* cut deleted device out of list */ *oldmod = (*model)->SWnextModel; /* cut deleted device out of list */
for(here = (*model)->SWinstances ; here ; here = here->SWnextInstance) {
if(prev) FREE(prev);
for (here = (*model)->SWinstances; here; here = here->SWnextInstance) {
if (prev) FREE(prev);
prev = here; prev = here;
} }
if(prev) FREE(prev);
if (prev) FREE(prev);
FREE(*model); FREE(*model);
return(OK); return(OK);
} }

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save