Browse Source

rewrite INPlookMod(), return INPmodel*/NULL instead of int 1/0

rlar 14 years ago
parent
commit
a716572233
  1. 5
      ChangeLog
  2. 2
      src/include/ngspice/inpdefs.h
  3. 31
      src/spicelib/parser/inplkmod.c

5
ChangeLog

@ -1,3 +1,8 @@
2012-02-06 Robert Larice
* src/include/ngspice/inpdefs.h ,
* src/spicelib/parser/inplkmod.c :
rewrite INPlookMod(), return INPmodel*/NULL instead of int 1/0
2012-02-06 Robert Larice 2012-02-06 Robert Larice
* src/frontend/com_compose.c , * src/frontend/com_compose.c ,
* src/frontend/define.c , * src/frontend/define.c ,

2
src/include/ngspice/inpdefs.h

@ -110,7 +110,7 @@ int INPinsertNofree(char **token, INPtables *tab);
int INPinsert(char **, INPtables *); int INPinsert(char **, INPtables *);
int INPretrieve(char **, INPtables *); int INPretrieve(char **, INPtables *);
int INPremove(char *, INPtables *); int INPremove(char *, INPtables *);
int INPlookMod(char *);
INPmodel *INPlookMod(const char *);
int INPmakeMod(char *, int, card *); int INPmakeMod(char *, int, card *);
char *INPmkTemp(char *); char *INPmkTemp(char *);
void INPpas1(CKTcircuit *, card *, INPtables *); void INPpas1(CKTcircuit *, card *, INPtables *);

31
src/spicelib/parser/inplkmod.c

@ -2,32 +2,27 @@
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 <stdio.h>
#include "ngspice/inpdefs.h" #include "ngspice/inpdefs.h"
#include "inp.h"
#include <string.h>
extern INPmodel *modtab; extern INPmodel *modtab;
/*----------------------------------------------------------------- /*-----------------------------------------------------------------
* This fcn accepts a pointer to the model name, and returns 1 if
* the model exists in the model table, and returns 0 if hte model
* doesn't exist in the model table.
* This fcn accepts a pointer to the model name, and returns
* the INPmodel * if it exist in the model table.
*----------------------------------------------------------------*/ *----------------------------------------------------------------*/
int INPlookMod(char *name)
INPmodel *
INPlookMod(const char *name)
{ {
register INPmodel **i;
INPmodel *i;
for (i = modtab; i; i = i->INPnextModel)
if (strcmp(i->INPmodName, name) == 0)
return i;
for (i = &modtab; *i != NULL; i = &((*i)->INPnextModel)) {
if (strcmp((*i)->INPmodName, name) == 0) {
/* found the model in question - return TRUE */
return (1);
}
}
/* didn't find model - return FALSE */
return (0);
return NULL;
} }
Loading…
Cancel
Save