* ifeval.c ifnewuid.c inp.h inp2b.c inp2c.c inp2d.c
inp2e.c inp2f.c inp2g.c inp2h.c inp2i.c inp2j.c inp2k.c inp2l.c inp2m.c inp2o.c inp2q.c inp2r.c inp2s.c inp2t.c inp2u.c inp2v.c inp2w.c inp2z.c inpaname.c inpapnam.c inpcfix.c inpdomod.c inpdpar.c inperrc.c inperror.c inpeval.c inpfindl.c inpgmod.c inpgstr.c inpgtitl.c inpgtok.c inpgval.c inpkmods.c inplist.c inplkmod.c inpmkmod.c inpmktmp.c inppas1.c inppas2.c inppname.c inpptree.c inpsymt.c inptyplk.c ptfuncs.c: Cosmetic updates. * sperror.c: Removed clutter and MALLOC() call. * Makefile.am inp2dot.c inpdoopt.c: Paolo commented out all of inpdoopt.c, I removed it from the repository. Updated inp2dot.c and Makefile.am as well.
This commit is contained in:
parent
1dcc3ea6ff
commit
c4e2e82d42
|
|
@ -31,7 +31,6 @@ libinp_a_SOURCES = \
|
|||
inpapnam.c \
|
||||
inpcfix.c \
|
||||
inpdomod.c \
|
||||
inpdoopt.c \
|
||||
inpdpar.c \
|
||||
inperrc.c \
|
||||
inperror.c \
|
||||
|
|
|
|||
|
|
@ -17,15 +17,17 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
extern double PTfudge_factor;
|
||||
|
||||
static int PTeval(INPparseNode *tree, double gmin, double *res, double *vals);
|
||||
static int PTeval(INPparseNode * tree, double gmin, double *res,
|
||||
double *vals);
|
||||
|
||||
|
||||
|
||||
int
|
||||
IFeval(IFparseTree *tree, double gmin, double *result, double *vals, double *derivs)
|
||||
IFeval(IFparseTree * tree, double gmin, double *result, double *vals,
|
||||
double *derivs)
|
||||
{
|
||||
int i, err;
|
||||
INPparseTree *myTree = (INPparseTree*) tree;;
|
||||
INPparseTree *myTree = (INPparseTree *) tree;;
|
||||
|
||||
/*
|
||||
INPptPrint("calling PTeval, tree = ", myTree);
|
||||
|
|
@ -35,11 +37,11 @@ printf("\tvar%d = %lg\n", i, vals[i]);
|
|||
*/
|
||||
|
||||
if ((err = PTeval(myTree->tree, gmin, result, vals)) != OK)
|
||||
return (err);
|
||||
return (err);
|
||||
|
||||
for (i = 0; i < myTree->p.numVars; i++)
|
||||
if ((err = PTeval(myTree->derivs[i], gmin, &derivs[i], vals)) != OK)
|
||||
return (err);
|
||||
if ((err = PTeval(myTree->derivs[i], gmin, &derivs[i], vals)) !=
|
||||
OK) return (err);
|
||||
|
||||
/*
|
||||
printf("results: function = %lg\n", *result);
|
||||
|
|
@ -51,7 +53,7 @@ printf("\td / d var%d = %lg\n", i, derivs[i]);
|
|||
}
|
||||
|
||||
static int
|
||||
PTeval(INPparseNode *tree, double gmin, double *res, double *vals)
|
||||
PTeval(INPparseNode * tree, double gmin, double *res, double *vals)
|
||||
{
|
||||
double r1, r2;
|
||||
int err;
|
||||
|
|
@ -59,50 +61,48 @@ PTeval(INPparseNode *tree, double gmin, double *res, double *vals)
|
|||
PTfudge_factor = gmin;
|
||||
switch (tree->type) {
|
||||
case PT_CONSTANT:
|
||||
*res = tree->constant;
|
||||
break;
|
||||
*res = tree->constant;
|
||||
break;
|
||||
|
||||
case PT_VAR:
|
||||
*res = vals[tree->valueIndex];
|
||||
break;
|
||||
|
||||
*res = vals[tree->valueIndex];
|
||||
break;
|
||||
|
||||
case PT_FUNCTION:
|
||||
err = PTeval(tree->left, gmin, &r1, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
*res = (*tree->function)(r1);
|
||||
if (*res == HUGE) {
|
||||
fprintf(stderr, "Error: %g out of range for %s\n",
|
||||
r1, tree->funcname);
|
||||
return (E_PARMVAL);
|
||||
}
|
||||
break;
|
||||
err = PTeval(tree->left, gmin, &r1, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
*res = (*tree->function) (r1);
|
||||
if (*res == HUGE) {
|
||||
fprintf(stderr, "Error: %g out of range for %s\n",
|
||||
r1, tree->funcname);
|
||||
return (E_PARMVAL);
|
||||
}
|
||||
break;
|
||||
|
||||
case PT_PLUS:
|
||||
case PT_MINUS:
|
||||
case PT_TIMES:
|
||||
case PT_DIVIDE:
|
||||
case PT_POWER:
|
||||
err = PTeval(tree->left, gmin, &r1, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
err = PTeval(tree->right, gmin, &r2, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
*res = (*tree->function)(r1, r2);
|
||||
if (*res == HUGE) {
|
||||
fprintf(stderr, "Error: %g, %g out of range for %s\n",
|
||||
r1, r2, tree->funcname);
|
||||
return (E_PARMVAL);
|
||||
}
|
||||
break;
|
||||
|
||||
err = PTeval(tree->left, gmin, &r1, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
err = PTeval(tree->right, gmin, &r2, vals);
|
||||
if (err != OK)
|
||||
return (err);
|
||||
*res = (*tree->function) (r1, r2);
|
||||
if (*res == HUGE) {
|
||||
fprintf(stderr, "Error: %g, %g out of range for %s\n",
|
||||
r1, r2, tree->funcname);
|
||||
return (E_PARMVAL);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Internal Error: bad node type %d\n",
|
||||
tree->type);
|
||||
return (E_PANIC);
|
||||
fprintf(stderr, "Internal Error: bad node type %d\n", tree->type);
|
||||
return (E_PANIC);
|
||||
}
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,69 +14,72 @@ Author: 1988 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
IFnewUid(void *ckt, IFuid *newuid, IFuid olduid, char *suffix, int type, void **nodedata)
|
||||
IFnewUid(void *ckt, IFuid * newuid, IFuid olduid, char *suffix, int type,
|
||||
void **nodedata)
|
||||
{
|
||||
char *newname;
|
||||
int error;
|
||||
|
||||
if(olduid) {
|
||||
newname=(char *)
|
||||
MALLOC(sizeof(char)*(strlen(suffix)+strlen((char*)olduid)+2));
|
||||
/* 2 = '#' + '\0' */
|
||||
sprintf(newname,"%s#%s",(char*)olduid,suffix);
|
||||
if (olduid) {
|
||||
newname = (char *)
|
||||
MALLOC(sizeof(char) *
|
||||
(strlen(suffix) + strlen((char *) olduid) + 2));
|
||||
/* 2 = '#' + '\0' */
|
||||
sprintf(newname, "%s#%s", (char *) olduid, suffix);
|
||||
} else {
|
||||
newname=(char *)MALLOC(sizeof(char)*
|
||||
(strlen(suffix)+1)); /* 1 = '\0' */
|
||||
sprintf(newname,"%s",suffix);
|
||||
newname = (char *) MALLOC(sizeof(char) * (strlen(suffix) + 1)); /* 1 = '\0' */
|
||||
sprintf(newname, "%s", suffix);
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case UID_ANALYSIS:
|
||||
case UID_TASK:
|
||||
case UID_INSTANCE:
|
||||
case UID_OTHER:
|
||||
case UID_MODEL:
|
||||
error = INPinsert(&newname,
|
||||
(INPtables *)ft_curckt->ci_symtab);
|
||||
if(error && error != E_EXISTS) return(error);
|
||||
*newuid = (IFuid) newname;
|
||||
break;
|
||||
switch (type) {
|
||||
case UID_ANALYSIS:
|
||||
case UID_TASK:
|
||||
case UID_INSTANCE:
|
||||
case UID_OTHER:
|
||||
case UID_MODEL:
|
||||
error = INPinsert(&newname, (INPtables *) ft_curckt->ci_symtab);
|
||||
if (error && error != E_EXISTS)
|
||||
return (error);
|
||||
*newuid = (IFuid) newname;
|
||||
break;
|
||||
|
||||
case UID_SIGNAL:
|
||||
error = INPmkTerm(ckt,&newname,
|
||||
(INPtables *)ft_curckt->ci_symtab,nodedata);
|
||||
if(error && error != E_EXISTS) return(error);
|
||||
*newuid = (IFuid) newname;
|
||||
break;
|
||||
case UID_SIGNAL:
|
||||
error = INPmkTerm(ckt, &newname,
|
||||
(INPtables *) ft_curckt->ci_symtab, nodedata);
|
||||
if (error && error != E_EXISTS)
|
||||
return (error);
|
||||
*newuid = (IFuid) newname;
|
||||
break;
|
||||
|
||||
default:
|
||||
return(E_BADPARM);
|
||||
default:
|
||||
return (E_BADPARM);
|
||||
}
|
||||
return(OK);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
int
|
||||
IFdelUid(void *ckt, IFuid uid, int type)
|
||||
int IFdelUid(void *ckt, IFuid uid, int type)
|
||||
{
|
||||
int error;
|
||||
|
||||
switch(type) {
|
||||
case UID_ANALYSIS:
|
||||
case UID_TASK:
|
||||
case UID_INSTANCE:
|
||||
case UID_OTHER:
|
||||
case UID_MODEL:
|
||||
error = INPremove(uid, (INPtables *)ft_curckt->ci_symtab);
|
||||
if(error && error != E_EXISTS) return(error);
|
||||
break;
|
||||
switch (type) {
|
||||
case UID_ANALYSIS:
|
||||
case UID_TASK:
|
||||
case UID_INSTANCE:
|
||||
case UID_OTHER:
|
||||
case UID_MODEL:
|
||||
error = INPremove(uid, (INPtables *) ft_curckt->ci_symtab);
|
||||
if (error && error != E_EXISTS)
|
||||
return (error);
|
||||
break;
|
||||
|
||||
case UID_SIGNAL:
|
||||
error = INPremTerm(uid, (INPtables *)ft_curckt->ci_symtab);
|
||||
if(error && error != E_EXISTS) return(error);
|
||||
break;
|
||||
case UID_SIGNAL:
|
||||
error = INPremTerm(uid, (INPtables *) ft_curckt->ci_symtab);
|
||||
if (error && error != E_EXISTS)
|
||||
return (error);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(E_BADPARM);
|
||||
default:
|
||||
return (E_BADPARM);
|
||||
}
|
||||
return(OK);
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,4 @@ double PTuminus(double arg);
|
|||
|
||||
/* sperror.c */
|
||||
|
||||
char * SPerror(int type);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11,49 +11,48 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2B(void *ckt, INPtables *tab, card *current)
|
||||
void INP2B(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Bname <node> <node> [V=expr] [I=expr] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model name */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model name */
|
||||
|
||||
/* Arbitrary source. */
|
||||
type = INPtypelook("ASRC");
|
||||
if (type < 0) {
|
||||
LITERR("Device type Asource not supported by this binary\n")
|
||||
return;
|
||||
LITERR("Device type Asource not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
|
||||
INPgetTok(&line,&nname1,1);
|
||||
error = INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
error = INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
|
||||
INPgetTok(&line,&nname2,1);
|
||||
error = INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
error = INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
|
||||
if(!tab->defBmod) {
|
||||
/* create default B model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"B",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defBmod),uid))
|
||||
if (!tab->defBmod) {
|
||||
/* create default B model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "B", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defBmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defBmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
IFC(newInstance, (ckt, tab->defBmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,81 +11,82 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2C(void *ckt, INPtables *tab, card *current)
|
||||
void INP2C(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* parse a capacitor card */
|
||||
/* Cname <node> <node> <val> [IC=<val>] */
|
||||
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
double val; /* temp to held resistance */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default cap model */
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
double val; /* temp to held resistance */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default cap model */
|
||||
|
||||
mytype = INPtypelook("Capacitor");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type Capacitor not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type Capacitor not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
val = INPevaluate(&line,&error,1);
|
||||
if(error == 0) { /* Looks like a number */
|
||||
type = mytype;
|
||||
ptemp.rValue = val;
|
||||
if(!tab->defCmod) {
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"C",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defCmod),uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defCmod,&fast,name))
|
||||
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast))
|
||||
} else { /* looks like character strings */
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
thismodel = (INPmodel *)NULL;
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = thismodel->INPmodfast;
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defCmod) {
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"C",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defCmod),uid))
|
||||
}
|
||||
mdfast = tab->defCmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
val = INPevaluate(&line, &error, 1);
|
||||
if (error == 0) { /* Looks like a number */
|
||||
type = mytype;
|
||||
ptemp.rValue = val;
|
||||
if (!tab->defCmod) {
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "C", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defCmod), uid))
|
||||
}
|
||||
IFC(newInstance, (ckt, tab->defCmod, &fast, name))
|
||||
GCA(INPpName, ("capacitance", &ptemp, ckt, type, fast))
|
||||
} else { /* looks like character strings */
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
thismodel = (INPmodel *) NULL;
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = thismodel->INPmodfast;
|
||||
} else {
|
||||
type = mytype;
|
||||
if (!tab->defCmod) {
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "C", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defCmod), uid))
|
||||
}
|
||||
mdfast = tab->defCmod;
|
||||
}
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
}
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("capacitance",&ptemp,ckt,type,fast))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("capacitance", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,67 +11,67 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2D(void *ckt, INPtables *tab, card *current)
|
||||
void INP2D(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Dname <node> <node> <model> [<val>] [OFF] [IC=<val>] */
|
||||
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
|
||||
mytype = INPtypelook("Diode");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type Diode not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type Diode not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defDmod) {
|
||||
/* create default D model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"D",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defDmod),uid))
|
||||
}
|
||||
mdfast = tab->defDmod;
|
||||
type = mytype;
|
||||
if (!tab->defDmod) {
|
||||
/* create default D model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "D", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defDmod), uid))
|
||||
}
|
||||
mdfast = tab->defDmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("area",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("area", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -11,59 +11,58 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2E(void *ckt, INPtables *tab, card *current)
|
||||
void INP2E(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Ename <node> <node> <node> <node> <val> */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
type = INPtypelook("VCVS");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type VCVS not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type VCVS not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
if(!tab->defEmod) {
|
||||
/* create default E model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"E",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defEmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
if (!tab->defEmod) {
|
||||
/* create default E model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "E", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defEmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defEmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("gain",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defEmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("gain", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,52 +11,51 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2F(void *ckt, INPtables *tab, card *current)
|
||||
void INP2F(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Fname <node> <node> <vname> <val> */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* a pointer to a value structure to pick things up into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* a pointer to a value structure to pick things up into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
type = INPtypelook("CCCS");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type CCCS not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type CCCS not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
if(!tab->defFmod) {
|
||||
/* create default F model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"F",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defFmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
if (!tab->defFmod) {
|
||||
/* create default F model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "F", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defFmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defFmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
parm=INPgetValue(ckt,&line,IF_INSTANCE,tab);
|
||||
GCA(INPpName,("control",parm,ckt,type,fast))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("gain",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defFmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
parm = INPgetValue(ckt, &line, IF_INSTANCE, tab);
|
||||
GCA(INPpName, ("control", parm, ckt, type, fast))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("gain", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,59 +11,58 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2G(void *ckt, INPtables *tab, card *current)
|
||||
void INP2G(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Gname <node> <node> <node> <node> <val> */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid of default model to be created */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid of default model to be created */
|
||||
|
||||
type = INPtypelook("VCCS");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type VCCS not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type VCCS not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
if(!tab->defGmod) {
|
||||
/* create default G model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"G",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defGmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
if (!tab->defGmod) {
|
||||
/* create default G model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "G", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defGmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defGmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("gain",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defGmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("gain", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,52 +11,51 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2H(void *ckt, INPtables *tab, card *current)
|
||||
void INP2H(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Hname <node> <node> <vname> <val> */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* pointer to a value structure for functions which return one*/
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model to be created */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* pointer to a value structure for functions which return one */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model to be created */
|
||||
|
||||
type = INPtypelook("CCVS");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type CCVS not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type CCVS not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
if(!tab->defHmod) {
|
||||
/* create default H model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"H",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defHmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
if (!tab->defHmod) {
|
||||
/* create default H model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "H", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defHmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defHmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
parm=INPgetValue(ckt,&line,IF_INSTANCE,tab);
|
||||
GCA(INPpName,("control",parm,ckt,type,fast))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("gain",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defHmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
parm = INPgetValue(ckt, &line, IF_INSTANCE, tab);
|
||||
GCA(INPpName, ("control", parm, ckt, type, fast))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("gain", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,50 +11,49 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2I(void *ckt, INPtables *tab, card *current)
|
||||
void INP2I(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Iname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
type = INPtypelook("Isource");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type Isource not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type Isource not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
if(!tab->defImod) {
|
||||
/* create default I model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"I",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defImod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
if (!tab->defImod) {
|
||||
/* create default I model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "I", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defImod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defImod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("dc",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defImod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("dc", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,74 +11,73 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2J(void *ckt, INPtables *tab, card *current)
|
||||
void INP2J(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Jname <node> <node> <node> <model> [<val>] [OFF] [IC=<val>,<val>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
thismodel = (INPmodel *)NULL;
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if (thismodel->INPmodType != INPtypelook("JFET")
|
||||
&& thismodel->INPmodType != INPtypelook("JFET2")
|
||||
)
|
||||
{
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = thismodel->INPmodType;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
thismodel = (INPmodel *) NULL;
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (thismodel->INPmodType != INPtypelook("JFET")
|
||||
&& thismodel->INPmodType != INPtypelook("JFET2")
|
||||
) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = thismodel->INPmodType;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = INPtypelook("JFET");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type JFET not supported by this binary\n")
|
||||
return;
|
||||
}
|
||||
if(!tab->defJmod) {
|
||||
/* create default J model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"J",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defJmod),uid))
|
||||
}
|
||||
mdfast = tab->defJmod;
|
||||
type = INPtypelook("JFET");
|
||||
if (type < 0) {
|
||||
LITERR("Device type JFET not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
if (!tab->defJmod) {
|
||||
/* create default J model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "J", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defJmod), uid))
|
||||
}
|
||||
mdfast = tab->defJmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("area",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("area", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,46 +11,45 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2K(void *ckt, INPtables *tab, card *current)
|
||||
void INP2K(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Kname Lname Lname <val> */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* ptr to a value structure for function return values */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* ptr to a value structure for function return values */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
line = current->line;
|
||||
type = INPtypelook("mutual");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type mutual not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type mutual not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
if(!tab->defKmod) {
|
||||
/* create deafult K model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"K",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defKmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
if (!tab->defKmod) {
|
||||
/* create deafult K model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "K", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defKmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defKmod,&fast,name))
|
||||
IFC(newInstance, (ckt, tab->defKmod, &fast, name))
|
||||
|
||||
parm = INPgetValue(ckt,&line,IF_INSTANCE,tab);
|
||||
GCA(INPpName,("inductor1",parm,ckt,type,fast))
|
||||
parm = INPgetValue(ckt,&line,IF_INSTANCE,tab);
|
||||
GCA(INPpName,("inductor2",parm,ckt,type,fast))
|
||||
parm = INPgetValue(ckt, &line, IF_INSTANCE, tab);
|
||||
GCA(INPpName, ("inductor1", parm, ckt, type, fast))
|
||||
parm = INPgetValue(ckt, &line, IF_INSTANCE, tab);
|
||||
GCA(INPpName, ("inductor2", parm, ckt, type, fast))
|
||||
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("coefficient",&ptemp,ckt,type,fast))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("coefficient", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,49 +11,48 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2L(void *ckt, INPtables *tab, card *current)
|
||||
void INP2L(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
/* parse an inductor card */
|
||||
/* Lname <node> <node> <val> [IC=<val>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
type = INPtypelook("Inductor");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type Inductor not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type Inductor not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
if(!tab->defLmod) {
|
||||
/* create default L model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"L",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defLmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
if (!tab->defLmod) {
|
||||
/* create default L model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "L", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defLmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defLmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("inductance",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defLmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("inductance", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2M(void *ckt, INPtables *tab, card *current)
|
||||
void INP2M(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Mname <node> <node> <node> <node> <model> [L=<val>]
|
||||
|
|
@ -21,81 +20,81 @@ INP2M(void *ckt, INPtables *tab, card *current)
|
|||
* [IC=<val>,<val>,<val>]
|
||||
*/
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
thismodel = (INPmodel *)NULL;
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if (thismodel->INPmodType != INPtypelook("Mos1")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos2")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos3")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos5")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos6")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos8")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM1")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM2")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM4")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3V1")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3V2")
|
||||
)
|
||||
{
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = thismodel->INPmodType;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = INPtypelook("Mos1");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type MOS1 not supported by this binary\n")
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
thismodel = (INPmodel *) NULL;
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (thismodel->INPmodType != INPtypelook("Mos1")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos2")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos3")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos5")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos6")
|
||||
&& thismodel->INPmodType != INPtypelook("Mos8")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM1")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM2")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM4")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3V1")
|
||||
&& thismodel->INPmodType != INPtypelook("BSIM3V2")
|
||||
) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
if(!tab->defMmod) {
|
||||
/* create default M model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"M",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defMmod),uid))
|
||||
}
|
||||
mdfast = tab->defMmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
LITERR(" error: no unlabeled parameter permitted on mosfet\n")
|
||||
type = thismodel->INPmodType;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = INPtypelook("Mos1");
|
||||
if (type < 0) {
|
||||
LITERR("Device type MOS1 not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
if (!tab->defMmod) {
|
||||
/* create default M model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "M", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defMmod), uid))
|
||||
}
|
||||
mdfast = tab->defMmod;
|
||||
}
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
LITERR(" error: no unlabeled parameter permitted on mosfet\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,80 +12,80 @@ Author: 1990 Jaijeet S. Roychowdhury
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
void
|
||||
INP2O(void *ckt, INPtables *tab, card *current)
|
||||
void INP2O(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Oname <node> <node> <node> <node> [IC=<val>,<val>,<val>,<val>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
|
||||
type = INPtypelook("LTRA");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type LossyXmissionLine not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type LossyXmissionLine not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
if( INPlookMod(model) ) {
|
||||
/* do nothing for now */
|
||||
/* no action required */
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
INPgetTok(&line, &model, 1);
|
||||
if (INPlookMod(model)) {
|
||||
/* do nothing for now */
|
||||
/* no action required */
|
||||
} else {
|
||||
/*
|
||||
nname4 = model;
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
*/
|
||||
/*
|
||||
nname4 = model;
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
*/
|
||||
}
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(type != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (type != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
if(!tab->defOmod) {
|
||||
/* create default O model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"O",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defOmod),uid))
|
||||
}
|
||||
mdfast = tab->defOmod;
|
||||
if (!tab->defOmod) {
|
||||
/* create default O model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "O", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defOmod), uid))
|
||||
}
|
||||
mdfast = tab->defOmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,85 +11,85 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2Q(void *ckt, INPtables *tab, card *current, void *gnode)
|
||||
void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode)
|
||||
{
|
||||
|
||||
/* Qname <node> <node> <node> [<node>] <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid of default model */
|
||||
|
||||
mytype = INPtypelook("BJT");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type BJT not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type BJT not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&model,1);
|
||||
if( INPlookMod(model) ) {
|
||||
/* do nothing for now */
|
||||
node4 = gnode;
|
||||
/* no action required */
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &model, 1);
|
||||
if (INPlookMod(model)) {
|
||||
/* do nothing for now */
|
||||
node4 = gnode;
|
||||
/* no action required */
|
||||
} else {
|
||||
nname4 = model;
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
nname4 = model;
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
INPgetTok(&line, &model, 1);
|
||||
}
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defQmod) {
|
||||
/* create default Q model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"Q",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defQmod),uid))
|
||||
}
|
||||
mdfast = tab->defQmod;
|
||||
type = mytype;
|
||||
if (!tab->defQmod) {
|
||||
/* create default Q model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "Q", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defQmod), uid))
|
||||
}
|
||||
mdfast = tab->defQmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("area",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("area", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,100 +15,101 @@ Remarks: This code is based on a version written by Serban Popescu which
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2R(void *ckt, INPtables *tab, card *current)
|
||||
void INP2R(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
/* parse a resistor card */
|
||||
/* Rname <node> <node> [<val>][<mname>][w=<val>][l=<val>][ac=<val>] */
|
||||
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *saveline; /* ... just in case we need to go back... */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
double val; /* temp to held resistance */
|
||||
int error; /* error code temporary */
|
||||
int error1; /* secondary error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast=NULL; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *saveline; /* ... just in case we need to go back... */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
double val; /* temp to held resistance */
|
||||
int error; /* error code temporary */
|
||||
int error1; /* secondary error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast = NULL; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
mytype = INPtypelook("Resistor");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type Resistor not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type Resistor not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
val = INPevaluate(&line,&error1,1);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
val = INPevaluate(&line, &error1, 1);
|
||||
/* either not a number -> model, or
|
||||
* follows a number, so must be a model name
|
||||
* -> MUST be a model name (or null)
|
||||
*/
|
||||
|
||||
saveline = line; /* save then old pointer */
|
||||
saveline = line; /* save then old pointer */
|
||||
|
||||
INPgetTok(&line,&model,1);
|
||||
|
||||
if(*model) { /* token isn't null */
|
||||
if( INPlookMod(model) ) { /* If this is a valid model connect it */
|
||||
INPinsert(&model,tab);
|
||||
thismodel = (INPmodel *)NULL;
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
INPgetTok(&line, &model, 1);
|
||||
|
||||
if (*model) { /* token isn't null */
|
||||
if (INPlookMod(model)) { /* If this is a valid model connect it */
|
||||
INPinsert(&model, tab);
|
||||
thismodel = (INPmodel *) NULL;
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
mdfast = thismodel->INPmodfast;
|
||||
type = thismodel->INPmodType;
|
||||
}
|
||||
|
||||
} else { /* It is not a model */
|
||||
line = saveline; /* go back */
|
||||
type = mytype;
|
||||
if(!tab->defRmod) { /* create default R model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"R",UID_MODEL,(void **)NULL);
|
||||
IFC(newModel, (ckt,type,&(tab->defRmod),uid))
|
||||
}
|
||||
mdfast = tab->defRmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
} else { /* The token is null and a default model will be created */
|
||||
type = mytype;
|
||||
if(!tab->defRmod) {
|
||||
/* create default R model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"R",UID_MODEL,(void **)NULL);
|
||||
IFC(newModel, (ckt,type,&(tab->defRmod),uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defRmod,&fast,name))
|
||||
}
|
||||
|
||||
} else { /* It is not a model */
|
||||
line = saveline; /* go back */
|
||||
type = mytype;
|
||||
if (!tab->defRmod) { /* create default R model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "R", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defRmod), uid))
|
||||
}
|
||||
mdfast = tab->defRmod;
|
||||
}
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
} else { /* The token is null and a default model will be created */
|
||||
type = mytype;
|
||||
if (!tab->defRmod) {
|
||||
/* create default R model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "R", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defRmod), uid))
|
||||
}
|
||||
IFC(newInstance, (ckt, tab->defRmod, &fast, name))
|
||||
}
|
||||
|
||||
if(error1 == 0) { /* got a resistance above */
|
||||
ptemp.rValue = val;
|
||||
GCA(INPpName,("resistance",&ptemp,ckt,type,fast))
|
||||
if (error1 == 0) { /* got a resistance above */
|
||||
ptemp.rValue = val;
|
||||
GCA(INPpName, ("resistance", &ptemp, ckt, type, fast))
|
||||
}
|
||||
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("resistance",&ptemp,ckt,type,fast))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("resistance", &ptemp, ckt, type, fast))
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,76 +11,76 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2S(void *ckt, INPtables *tab, card *current)
|
||||
void INP2S(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Sname <node> <node> <node> <node> [<modname>] [IC] */
|
||||
/* VOLTAGE CONTROLLED SWITCH */
|
||||
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid of default model */
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid of default model */
|
||||
|
||||
mytype = INPtypelook("Switch");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type Switch not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type Switch not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defSmod) {
|
||||
/* create deafult S model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"S",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defSmod),uid))
|
||||
}
|
||||
mdfast = tab->defSmod;
|
||||
type = mytype;
|
||||
if (!tab->defSmod) {
|
||||
/* create deafult S model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "S", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defSmod), uid))
|
||||
}
|
||||
mdfast = tab->defSmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
/* ignore a number */
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
/* ignore a number */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,56 +11,55 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2T(void *ckt, INPtables *tab, card *current)
|
||||
void INP2T(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Tname <node> <node> <node> <node> [TD=<val>]
|
||||
* [F=<val> [NL=<val>]][IC=<val>,<val>,<val>,<val>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
char *nname4; /* the fourth node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
void *node4; /* the fourth node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
|
||||
type = INPtypelook("Tranline");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type Tranline not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type Tranline not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&nname4,1);
|
||||
INPtermInsert(ckt,&nname4,tab,&node4);
|
||||
if(!tab->defTmod) {
|
||||
/* create deafult T model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"T",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defTmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &nname4, 1);
|
||||
INPtermInsert(ckt, &nname4, tab, &node4);
|
||||
if (!tab->defTmod) {
|
||||
/* create deafult T model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "T", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defTmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defTmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
IFC(bindNode,(ckt,fast,4,node4))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
IFC(newInstance, (ckt, tab->defTmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
IFC(bindNode, (ckt, fast, 4, node4))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,67 +11,67 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2U(void *ckt, INPtables *tab, card *current)
|
||||
void INP2U(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Uname <node> <node> <model> [l=<val>] [n=<val>] */
|
||||
|
||||
int mytype; /* the type my lookup says URC is */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* name of the model */
|
||||
INPmodel *thismodel; /* pointer to our model descriptor */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
int mytype; /* the type my lookup says URC is */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* name of the model */
|
||||
INPmodel *thismodel; /* pointer to our model descriptor */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
mytype = INPtypelook("URC");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type URC not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type URC not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defUmod) {
|
||||
/* create deafult U model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"U",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defUmod),uid))
|
||||
}
|
||||
mdfast = tab->defUmod;
|
||||
type = mytype;
|
||||
if (!tab->defUmod) {
|
||||
/* create deafult U model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "U", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defUmod), uid))
|
||||
}
|
||||
mdfast = tab->defUmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,50 +11,49 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2V(void *ckt, INPtables *tab, card *current)
|
||||
void INP2V(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Vname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
/* Vname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
type = INPtypelook("Vsource");
|
||||
if(type < 0 ) {
|
||||
LITERR("Device type Vsource not supported by this binary\n")
|
||||
return;
|
||||
if (type < 0) {
|
||||
LITERR("Device type Vsource not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
if(!tab->defVmod) {
|
||||
/* create default V model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"V",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defVmod),uid))
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
if (!tab->defVmod) {
|
||||
/* create default V model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "V", UID_MODEL, (void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defVmod), uid))
|
||||
}
|
||||
IFC(newInstance,(ckt,tab->defVmod,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("dc",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, tab->defVmod, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("dc", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,73 +11,73 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2W(void *ckt, INPtables *tab, card *current)
|
||||
void INP2W(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Wname <node> <node> <vctrl> [<modname>] [IC] */
|
||||
/* CURRENT CONTROLLED SWITCH */
|
||||
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* pointer to a value structure for functions to return */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
int mytype; /* the type we determine resistors are */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *model; /* the name of the resistor's model */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
INPmodel *thismodel; /* pointer to model structure describing our model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
IFvalue *parm; /* pointer to a value structure for functions to return */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
mytype = INPtypelook("CSwitch");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type CSwitch not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type CSwitch not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
parm=INPgetValue(ckt,&line,IF_INSTANCE,tab);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
parm = INPgetValue(ckt, &line, IF_INSTANCE, tab);
|
||||
ptemp.uValue = parm->uValue;
|
||||
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defWmod) {
|
||||
/* create deafult W model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"W",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defWmod),uid))
|
||||
}
|
||||
mdfast = tab->defWmod;
|
||||
type = mytype;
|
||||
if (!tab->defWmod) {
|
||||
/* create deafult W model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "W", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defWmod), uid))
|
||||
}
|
||||
mdfast = tab->defWmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
|
||||
GCA(INPpName,("control",&ptemp,ckt,type,fast))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
/* ignore a number */
|
||||
GCA(INPpName, ("control", &ptemp, ckt, type, fast))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
/* ignore a number */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,73 +11,73 @@ Author: 1988 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
void
|
||||
INP2Z(void *ckt, INPtables *tab, card *current)
|
||||
void INP2Z(void *ckt, INPtables * tab, card * current)
|
||||
{
|
||||
|
||||
/* Zname <node> <node> <node> <model> [<val>] [OFF] [IC=<val>,<val>] */
|
||||
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
int mytype; /* the type we looked up */
|
||||
int type; /* the type the model says it is */
|
||||
char *line; /* the part of the current line left to parse */
|
||||
char *name; /* the resistor's name */
|
||||
char *nname1; /* the first node's name */
|
||||
char *nname2; /* the second node's name */
|
||||
char *nname3; /* the third node's name */
|
||||
void *node1; /* the first node's node pointer */
|
||||
void *node2; /* the second node's node pointer */
|
||||
void *node3; /* the third node's node pointer */
|
||||
int error; /* error code temporary */
|
||||
void *fast; /* pointer to the actual instance */
|
||||
IFvalue ptemp; /* a value structure to package resistance into */
|
||||
int waslead; /* flag to indicate that funny unlabeled number was found */
|
||||
double leadval; /* actual value of unlabeled number */
|
||||
char *model; /* the name of the model */
|
||||
INPmodel *thismodel; /* pointer to model description for user's model */
|
||||
void *mdfast; /* pointer to the actual model */
|
||||
IFuid uid; /* uid for default model */
|
||||
|
||||
mytype = INPtypelook("MES");
|
||||
if(mytype < 0 ) {
|
||||
LITERR("Device type MES not supported by this binary\n")
|
||||
return;
|
||||
if (mytype < 0) {
|
||||
LITERR("Device type MES not supported by this binary\n");
|
||||
return;
|
||||
}
|
||||
line = current->line;
|
||||
INPgetTok(&line,&name,1);
|
||||
INPinsert(&name,tab);
|
||||
INPgetTok(&line,&nname1,1);
|
||||
INPtermInsert(ckt,&nname1,tab,&node1);
|
||||
INPgetTok(&line,&nname2,1);
|
||||
INPtermInsert(ckt,&nname2,tab,&node2);
|
||||
INPgetTok(&line,&nname3,1);
|
||||
INPtermInsert(ckt,&nname3,tab,&node3);
|
||||
INPgetTok(&line,&model,1);
|
||||
INPinsert(&model,tab);
|
||||
thismodel = (INPmodel *)NULL;
|
||||
current->error = INPgetMod(ckt,model,&thismodel,tab);
|
||||
if(thismodel != NULL) {
|
||||
if(mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type")
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
INPgetTok(&line, &name, 1);
|
||||
INPinsert(&name, tab);
|
||||
INPgetTok(&line, &nname1, 1);
|
||||
INPtermInsert(ckt, &nname1, tab, &node1);
|
||||
INPgetTok(&line, &nname2, 1);
|
||||
INPtermInsert(ckt, &nname2, tab, &node2);
|
||||
INPgetTok(&line, &nname3, 1);
|
||||
INPtermInsert(ckt, &nname3, tab, &node3);
|
||||
INPgetTok(&line, &model, 1);
|
||||
INPinsert(&model, tab);
|
||||
thismodel = (INPmodel *) NULL;
|
||||
current->error = INPgetMod(ckt, model, &thismodel, tab);
|
||||
if (thismodel != NULL) {
|
||||
if (mytype != thismodel->INPmodType) {
|
||||
LITERR("incorrect model type");
|
||||
return;
|
||||
}
|
||||
type = mytype;
|
||||
mdfast = (thismodel->INPmodfast);
|
||||
} else {
|
||||
type = mytype;
|
||||
if(!tab->defZmod) {
|
||||
/* create default Z model */
|
||||
IFnewUid(ckt,&uid,(IFuid)NULL,"Z",UID_MODEL,(void**)NULL);
|
||||
IFC(newModel,(ckt,type,&(tab->defZmod),uid))
|
||||
}
|
||||
mdfast = tab->defZmod;
|
||||
type = mytype;
|
||||
if (!tab->defZmod) {
|
||||
/* create default Z model */
|
||||
IFnewUid(ckt, &uid, (IFuid) NULL, "Z", UID_MODEL,
|
||||
(void **) NULL);
|
||||
IFC(newModel, (ckt, type, &(tab->defZmod), uid))
|
||||
}
|
||||
mdfast = tab->defZmod;
|
||||
}
|
||||
IFC(newInstance,(ckt,mdfast,&fast,name))
|
||||
IFC(bindNode,(ckt,fast,1,node1))
|
||||
IFC(bindNode,(ckt,fast,2,node2))
|
||||
IFC(bindNode,(ckt,fast,3,node3))
|
||||
PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
|
||||
if(waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName,("area",&ptemp,ckt,type,fast))
|
||||
IFC(newInstance, (ckt, mdfast, &fast, name))
|
||||
IFC(bindNode, (ckt, fast, 1, node1))
|
||||
IFC(bindNode, (ckt, fast, 2, node2))
|
||||
IFC(bindNode, (ckt, fast, 3, node3))
|
||||
PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab))
|
||||
if (waslead) {
|
||||
ptemp.rValue = leadval;
|
||||
GCA(INPpName, ("area", &ptemp, ckt, type, fast))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPaName(char *parm, IFvalue *val, void *ckt, int *dev, char *devnam, void **fast, IFsimulator *sim, int *dataType, IFvalue *selector)
|
||||
/* the name of the parameter to set */
|
||||
/* the parameter union containing the value to set */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* the name of the device */
|
||||
/* direct pointer to device being parsed */
|
||||
/* the simulator data structure */
|
||||
/* the datatype of the returned value structure */
|
||||
/* data sub-selector for questions */
|
||||
|
||||
INPaName(char *parm, IFvalue * val, void *ckt, int *dev, char *devnam,
|
||||
void **fast, IFsimulator * sim, int *dataType, IFvalue * selector)
|
||||
/* the name of the parameter to set */
|
||||
/* the parameter union containing the value to set */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* the name of the device */
|
||||
/* direct pointer to device being parsed */
|
||||
/* the simulator data structure */
|
||||
/* the datatype of the returned value structure */
|
||||
/* data sub-selector for questions */
|
||||
{
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
int i;
|
||||
|
||||
/* find the instance - don't know about model, so use null there,
|
||||
|
|
@ -40,29 +40,33 @@ INPaName(char *parm, IFvalue *val, void *ckt, int *dev, char *devnam, void **fas
|
|||
* (name, type, direct pointer) - the type and direct pointer
|
||||
* WILL be set on return unless error is not OK
|
||||
*/
|
||||
error = (*(sim->findInstance))(ckt,dev,fast,devnam,(void *)NULL,
|
||||
(char *)NULL);
|
||||
if(error) return(error);
|
||||
error = (*(sim->findInstance)) (ckt, dev, fast, devnam, (void *) NULL,
|
||||
(char *) NULL);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
/* now find the parameter - hunt through the parameter tables for
|
||||
* this device type and look for a name match of an 'ask'able
|
||||
* parameter.
|
||||
*/
|
||||
for(i=0;i<(*(*(sim->devices)[*dev]).numInstanceParms);i++) {
|
||||
if(strcmp(parm,
|
||||
((*(sim->devices)[*dev]).instanceParms[i].keyword))==0 &&
|
||||
(((*(sim->devices)[*dev]).instanceParms[i].dataType)&IF_ASK)) {
|
||||
/* found it, so we ask the question using the device info we got
|
||||
* above and put the results in the IFvalue structure our caller
|
||||
* gave us originally
|
||||
*/
|
||||
error = (*(sim->askInstanceQuest))(ckt,*fast,
|
||||
(*(sim->devices)[*dev]).instanceParms[i].id,val,
|
||||
selector);
|
||||
if(dataType) *dataType =
|
||||
(*(sim->devices)[*dev]).instanceParms[i].dataType;
|
||||
return(error);
|
||||
}
|
||||
for (i = 0; i < (*(*(sim->devices)[*dev]).numInstanceParms); i++) {
|
||||
if (strcmp(parm,
|
||||
((*(sim->devices)[*dev]).instanceParms[i].keyword)) == 0
|
||||
&& (((*(sim->devices)[*dev]).instanceParms[i].dataType) &
|
||||
IF_ASK)) {
|
||||
/* found it, so we ask the question using the device info we got
|
||||
* above and put the results in the IFvalue structure our caller
|
||||
* gave us originally
|
||||
*/
|
||||
error = (*(sim->askInstanceQuest)) (ckt, *fast,
|
||||
(*(sim->devices)[*dev]).
|
||||
instanceParms[i].id, val,
|
||||
selector);
|
||||
if (dataType)
|
||||
*dataType =
|
||||
(*(sim->devices)[*dev]).instanceParms[i].dataType;
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
return(E_BADPARM);
|
||||
return (E_BADPARM);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,23 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPapName(void *ckt, int type, void *analPtr, char *parmname, IFvalue *value)
|
||||
INPapName(void *ckt, int type, void *analPtr, char *parmname,
|
||||
IFvalue * value)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (parmname && ft_sim->analyses[type]) {
|
||||
for(i=0;i<ft_sim->analyses[type]->numParms;i++)
|
||||
for (i = 0; i < ft_sim->analyses[type]->numParms; i++)
|
||||
if (strcmp(parmname,
|
||||
ft_sim->analyses[type]->analysisParms[i].keyword) == 0)
|
||||
{
|
||||
return (*(ft_sim->setAnalysisParm))(ckt, analPtr,
|
||||
ft_sim->analyses[type]->analysisParms[i].id,
|
||||
value, (IFvalue*)NULL);
|
||||
ft_sim->analyses[type]->analysisParms[i].keyword) ==
|
||||
0) {
|
||||
return (*(ft_sim->setAnalysisParm)) (ckt, analPtr,
|
||||
ft_sim->
|
||||
analyses[type]->
|
||||
analysisParms[i].id,
|
||||
value,
|
||||
(IFvalue *) NULL);
|
||||
}
|
||||
}
|
||||
return(E_BADPARM);
|
||||
return (E_BADPARM);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
void
|
||||
INPcaseFix(register char *string)
|
||||
void INPcaseFix(register char *string)
|
||||
{
|
||||
|
||||
while(*string) {
|
||||
if(isupper(*string)) {
|
||||
*string = tolower(*string);
|
||||
}
|
||||
string++;
|
||||
while (*string) {
|
||||
if (isupper(*string)) {
|
||||
*string = tolower(*string);
|
||||
}
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,218 +10,251 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
char *
|
||||
INPdomodel(void *ckt, card *image, INPtables *tab)
|
||||
char *INPdomodel(void *ckt, card * image, INPtables * tab)
|
||||
{
|
||||
|
||||
char *modname;
|
||||
int type=-1;
|
||||
int type = -1;
|
||||
int lev;
|
||||
char *typename;
|
||||
char *err = (char *)NULL;
|
||||
char *err = (char *) NULL;
|
||||
char *line;
|
||||
|
||||
line = image->line;
|
||||
INPgetTok(&line,&modname,1); /* throw away '.model' */
|
||||
INPgetTok(&line,&modname,1);
|
||||
INPinsert(&modname,tab);
|
||||
INPgetTok(&line,&typename,1);
|
||||
if( (strcmp(typename,"npn") == 0)||(strcmp(typename,"pnp")==0) ) {
|
||||
type = INPtypelook("BJT");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp("Device type BJT not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"d") == 0) {
|
||||
type = INPtypelook("Diode");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp("Device type Diode not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if( (strcmp(typename,"njf") == 0) || (strcmp(typename,"pjf") == 0)){
|
||||
err = INPfindLev(line,&lev);
|
||||
switch(lev) {
|
||||
case 0:
|
||||
case 1:
|
||||
type = INPtypelook("JFET");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type JFET not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
type = INPtypelook("JFET2");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type JFET2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
default: /* placeholder; use level 3 for the next model */
|
||||
err = INPmkTemp(
|
||||
"Only JFET device levels 1-2 are supported in this binary\n");
|
||||
break;
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if( (strcmp(typename,"nmf") == 0) || (strcmp(typename,"pmf")==0) ) {
|
||||
type = INPtypelook("MES");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp("Device type MES not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"urc") == 0) {
|
||||
type = INPtypelook("URC");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp("Device type URC not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if( (strcmp(typename,"nmos")==0) || (strcmp(typename,"pmos")==0) ) {
|
||||
err = INPfindLev(line,&lev);
|
||||
switch(lev) {
|
||||
case 0:
|
||||
case 1:
|
||||
type = INPtypelook("Mos1");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type MOS1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
type = INPtypelook("Mos2");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type MOS2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
type = INPtypelook("Mos3");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type MOS3 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
type = INPtypelook("BSIM1");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
type = INPtypelook("BSIM2");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
type = INPtypelook("Mos6");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type MOS6 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
type = INPtypelook("MOS7");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type MOS7 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
type = INPtypelook("BSIM3");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM3 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
type = INPtypelook("BSIMsoi");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIMsoi not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
type = INPtypelook("BSIM4");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM4 not available in this binary\n"); }
|
||||
break;
|
||||
case 15:
|
||||
type = INPtypelook("BSIM5");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Placeholder: Device type BSIM5 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
type = INPtypelook("BSIM6");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Placeholder: Device type BSIM6 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
INPgetTok(&line, &modname, 1); /* throw away '.model' */
|
||||
INPgetTok(&line, &modname, 1);
|
||||
INPinsert(&modname, tab);
|
||||
INPgetTok(&line, &typename, 1);
|
||||
if ((strcmp(typename, "npn") == 0) || (strcmp(typename, "pnp") == 0)) {
|
||||
type = INPtypelook("BJT");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BJT not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "d") == 0) {
|
||||
type = INPtypelook("Diode");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type Diode not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if ((strcmp(typename, "njf") == 0)
|
||||
|| (strcmp(typename, "pjf") == 0)) {
|
||||
err = INPfindLev(line, &lev);
|
||||
switch (lev) {
|
||||
case 0:
|
||||
case 1:
|
||||
type = INPtypelook("JFET");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type JFET not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
type = INPtypelook("JFET2");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type JFET2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
default: /* placeholder; use level 3 for the next model */
|
||||
err =
|
||||
INPmkTemp
|
||||
("Only JFET device levels 1-2 are supported in this binary\n");
|
||||
break;
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if ((strcmp(typename, "nmf") == 0)
|
||||
|| (strcmp(typename, "pmf") == 0)) {
|
||||
type = INPtypelook("MES");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MES not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "urc") == 0) {
|
||||
type = INPtypelook("URC");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type URC not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if ((strcmp(typename, "nmos") == 0)
|
||||
|| (strcmp(typename, "pmos") == 0)) {
|
||||
err = INPfindLev(line, &lev);
|
||||
switch (lev) {
|
||||
case 0:
|
||||
case 1:
|
||||
type = INPtypelook("Mos1");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MOS1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
type = INPtypelook("Mos2");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MOS2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
type = INPtypelook("Mos3");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MOS3 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
type = INPtypelook("BSIM1");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
type = INPtypelook("BSIM2");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
type = INPtypelook("Mos6");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MOS6 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
type = INPtypelook("MOS7");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type MOS7 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
type = INPtypelook("BSIM3");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM3 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
type = INPtypelook("BSIMsoi");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIMsoi not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
type = INPtypelook("BSIM4");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM4 not available in this binary\n");}
|
||||
break;
|
||||
case 15:
|
||||
type = INPtypelook("BSIM5");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Placeholder: Device type BSIM5 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
type = INPtypelook("BSIM6");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Placeholder: Device type BSIM6 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
case 49:
|
||||
type = INPtypelook("BSIM3V1");
|
||||
if (type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM3V1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 50:
|
||||
type = INPtypelook("BSIM3V2");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type BSIM3V2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
default: /* placeholder; use level xxx for the next model */
|
||||
err = INPmkTemp(
|
||||
"Only MOS device levels 1-6,8,14 are supported in this binary\n");
|
||||
break;
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"r") == 0) {
|
||||
type = INPtypelook("Resistor");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type Resistor not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"c") == 0) {
|
||||
type = INPtypelook("Capacitor");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type Capacitor not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"sw") == 0) {
|
||||
type = INPtypelook("Switch");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type Switch not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"csw") == 0) {
|
||||
type = INPtypelook("CSwitch");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type CSwitch not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
} else if(strcmp(typename,"ltra") == 0) {
|
||||
type = INPtypelook("LTRA");
|
||||
if(type < 0) {
|
||||
err = INPmkTemp(
|
||||
"Device type LTRA not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname,type,image);
|
||||
type = INPtypelook("BSIM3V1");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM3V1 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 50:
|
||||
type = INPtypelook("BSIM3V2");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type BSIM3V2 not available in this binary\n");
|
||||
}
|
||||
break;
|
||||
default: /* placeholder; use level xxx for the next model */
|
||||
err =
|
||||
INPmkTemp
|
||||
("Only MOS device levels 1-6,8,14 are supported in this binary\n");
|
||||
break;
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "r") == 0) {
|
||||
type = INPtypelook("Resistor");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type Resistor not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "c") == 0) {
|
||||
type = INPtypelook("Capacitor");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type Capacitor not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "sw") == 0) {
|
||||
type = INPtypelook("Switch");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type Switch not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "csw") == 0) {
|
||||
type = INPtypelook("CSwitch");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type CSwitch not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else if (strcmp(typename, "ltra") == 0) {
|
||||
type = INPtypelook("LTRA");
|
||||
if (type < 0) {
|
||||
err =
|
||||
INPmkTemp
|
||||
("Device type LTRA not available in this binary\n");
|
||||
}
|
||||
INPmakeMod(modname, type, image);
|
||||
} else {
|
||||
type = -1;
|
||||
err = (char *)MALLOC(35 + strlen(typename));
|
||||
(void)sprintf(err,"unknown model type %s - ignored\n",typename);
|
||||
type = -1;
|
||||
err = (char *) MALLOC(35 + strlen(typename));
|
||||
(void) sprintf(err, "unknown model type %s - ignored\n", typename);
|
||||
}
|
||||
return(err);
|
||||
return (err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 1985 Thomas L. Quarles
|
||||
**********/
|
||||
|
||||
/* INPdoOpts(ckt,option card)
|
||||
* parse the options off of the given option card and add them to
|
||||
* the given circuit
|
||||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "inpdefs.h"
|
||||
#include "ifsim.h"
|
||||
#include "cpdefs.h"
|
||||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
/* MW. this is never called - look at inp2dot.c
|
||||
void
|
||||
INPdoOpts(void *ckt, void *anal, card *optCard, INPtables *tab)
|
||||
{
|
||||
char *line;
|
||||
char *token;
|
||||
char *errmsg;
|
||||
IFvalue *val;
|
||||
int error;
|
||||
int i;
|
||||
int which;
|
||||
IFanalysis *prm=NULL;
|
||||
|
||||
which = -1;
|
||||
i=0;
|
||||
for(i=0;i<ft_sim->numAnalyses;i++) {
|
||||
prm = ft_sim->analyses[i];
|
||||
if(strcmp(prm->name,"options")==0) {
|
||||
which = i;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(which == -1) {
|
||||
optCard->error = INPerrCat(optCard->error,INPmkTemp(
|
||||
"errr: analysis options table not found\n"));
|
||||
return;
|
||||
}
|
||||
line = optCard->line;
|
||||
INPgetTok(&line,&token,1); * throw away '.option' *
|
||||
while (*line) {
|
||||
INPgetTok(&line,&token,1);
|
||||
for(i=0;i<prm->numParms;i++) {
|
||||
if(strcmp(token,prm->analysisParms[i].keyword) == 0) {
|
||||
if(!(prm->analysisParms[i].dataType & IF_UNIMP_MASK)) {
|
||||
errmsg = (char *)MALLOC((45+strlen(token)) * sizeof(char));
|
||||
(void) sprintf(errmsg,
|
||||
" Warning: %s not yet implemented - ignored \n",token);
|
||||
optCard->error = INPerrCat(optCard->error,errmsg);
|
||||
val = INPgetValue(ckt,&line,
|
||||
prm->analysisParms[i].dataType, tab);
|
||||
break;
|
||||
}
|
||||
if(prm->analysisParms[i].dataType & IF_SET) {
|
||||
val = INPgetValue(ckt,&line,
|
||||
prm->analysisParms[i].dataType&IF_VARTYPES, tab);
|
||||
error = (*(ft_sim->setAnalysisParm))(ckt,anal,
|
||||
prm->analysisParms[i].id,val,(IFvalue*)NULL);
|
||||
if(error) {
|
||||
errmsg =(char *)MALLOC((35+strlen(token))*sizeof(char));
|
||||
(void) sprintf(errmsg,
|
||||
"Warning: can't set optione %s\n", token);
|
||||
optCard->error = INPerrCat(optCard->error, errmsg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(i == prm->numParms) {
|
||||
errmsg = (char *)MALLOC(100 * sizeof(char));
|
||||
(void) strcpy(errmsg," Error: unknown option - ignored\n");
|
||||
optCard->error = INPerrCat(optCard->error,errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -20,18 +20,16 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
char *
|
||||
INPdevParse(char **line, void *ckt, int dev, void *fast, double *leading, int *waslead, INPtables *tab)
|
||||
/* the line to parse */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* direct pointer to device being parsed */
|
||||
/* the optional leading numeric parameter */
|
||||
/* flag - 1 if leading double given, 0 otherwise */
|
||||
|
||||
|
||||
char *INPdevParse(char **line, void *ckt, int dev, void *fast,
|
||||
double *leading, int *waslead, INPtables * tab)
|
||||
/* the line to parse */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* direct pointer to device being parsed */
|
||||
/* the optional leading numeric parameter */
|
||||
/* flag - 1 if leading double given, 0 otherwise */
|
||||
{
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
char *parm;
|
||||
char *errbuf;
|
||||
int i;
|
||||
|
|
@ -39,36 +37,44 @@ INPdevParse(char **line, void *ckt, int dev, void *fast, double *leading, int *w
|
|||
|
||||
/* check for leading value */
|
||||
*waslead = 0;
|
||||
*leading = INPevaluate(line,&error,1);
|
||||
if(error == 0) { /* found a good leading number */
|
||||
*waslead = 1;
|
||||
} else *leading=0.0;
|
||||
*leading = INPevaluate(line, &error, 1);
|
||||
if (error == 0) { /* found a good leading number */
|
||||
*waslead = 1;
|
||||
} else
|
||||
*leading = 0.0;
|
||||
while (**line != (char) 0) {
|
||||
error = INPgetTok(line,&parm,1);
|
||||
error = INPgetTok(line, &parm, 1);
|
||||
if (!*parm)
|
||||
continue;
|
||||
if(error) return(INPerror(error));
|
||||
for(i=0;i<(*(*(ft_sim->devices)[dev]).numInstanceParms);i++) {
|
||||
if(strcmp(parm,
|
||||
((*(ft_sim->devices)[dev]).instanceParms[i].keyword)) ==0) {
|
||||
val = INPgetValue(ckt,line,
|
||||
((*(ft_sim->devices)[dev]).instanceParms[i].dataType),
|
||||
tab);
|
||||
if (!val)
|
||||
return (INPerror(E_PARMVAL));
|
||||
error = (*(ft_sim->setInstanceParm))(ckt,fast,
|
||||
(*(ft_sim->devices)[dev]).instanceParms[i].id,
|
||||
val,(IFvalue*)NULL);
|
||||
if(error) return(INPerror(error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==(*(*(ft_sim->devices)[dev]).numInstanceParms)) {
|
||||
errbuf = MALLOC(strlen(parm)+25);
|
||||
(void)sprintf(errbuf," unknown parameter (%s) \n",parm);
|
||||
return(errbuf);
|
||||
}
|
||||
FREE(parm);
|
||||
if (error)
|
||||
return (INPerror(error));
|
||||
for (i = 0; i < (*(*(ft_sim->devices)[dev]).numInstanceParms); i++) {
|
||||
if (strcmp(parm,
|
||||
((*(ft_sim->devices)[dev]).instanceParms[i].
|
||||
keyword)) == 0) {
|
||||
val =
|
||||
INPgetValue(ckt, line,
|
||||
((*(ft_sim->devices)[dev]).
|
||||
instanceParms[i].dataType), tab);
|
||||
if (!val)
|
||||
return (INPerror(E_PARMVAL));
|
||||
error = (*(ft_sim->setInstanceParm)) (ckt, fast,
|
||||
(*(ft_sim->devices)
|
||||
[dev]).
|
||||
instanceParms[i].id,
|
||||
val,
|
||||
(IFvalue *) NULL);
|
||||
if (error)
|
||||
return (INPerror(error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == (*(*(ft_sim->devices)[dev]).numInstanceParms)) {
|
||||
errbuf = MALLOC(strlen(parm) + 25);
|
||||
(void) sprintf(errbuf, " unknown parameter (%s) \n", parm);
|
||||
return (errbuf);
|
||||
}
|
||||
FREE(parm);
|
||||
}
|
||||
return((char *)NULL);
|
||||
return ((char *) NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,24 +11,25 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
char *
|
||||
INPerrCat(char *a, char *b)
|
||||
char *INPerrCat(char *a, char *b)
|
||||
{
|
||||
|
||||
if(a != (char *)NULL) {
|
||||
if(b == (char *)NULL) { /* a valid, b null, return a */
|
||||
return(a);
|
||||
} else { /* both valid - hard work...*/
|
||||
register char *errtmp;
|
||||
errtmp = (char *)MALLOC( (strlen(a) + strlen(b)+2)*sizeof(char));
|
||||
(void) strcpy(errtmp,a);
|
||||
(void) strcat(errtmp,"\n");
|
||||
(void) strcat(errtmp,b);
|
||||
FREE(a);
|
||||
FREE(b);
|
||||
return(errtmp);
|
||||
}
|
||||
} else { /* a null, so return b */
|
||||
return(b);
|
||||
if (a != (char *) NULL) {
|
||||
if (b == (char *) NULL) { /* a valid, b null, return a */
|
||||
return (a);
|
||||
} else { /* both valid - hard work... */
|
||||
register char *errtmp;
|
||||
errtmp =
|
||||
(char *) MALLOC((strlen(a) + strlen(b) + 2) *
|
||||
sizeof(char));
|
||||
(void) strcpy(errtmp, a);
|
||||
(void) strcat(errtmp, "\n");
|
||||
(void) strcat(errtmp, b);
|
||||
FREE(a);
|
||||
FREE(b);
|
||||
return (errtmp);
|
||||
}
|
||||
} else { /* a null, so return b */
|
||||
return (b);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "sperror.h"
|
||||
#include "inp.h"
|
||||
|
||||
char *
|
||||
INPerror(int type)
|
||||
char *INPerror(int type)
|
||||
{
|
||||
char *val;
|
||||
char ebuf[513];
|
||||
|
|
@ -24,9 +23,9 @@ INPerror(int type)
|
|||
val = SPerror(type);
|
||||
|
||||
if (!val)
|
||||
return(val);
|
||||
return (val);
|
||||
|
||||
if(errRtn)
|
||||
if (errRtn)
|
||||
sprintf(ebuf, "%s detected in routine \"%s\"\n", val, errRtn);
|
||||
else
|
||||
sprintf(ebuf, "%s\n", val);
|
||||
|
|
@ -36,6 +35,5 @@ INPerror(int type)
|
|||
if (val)
|
||||
strcpy(val, ebuf);
|
||||
|
||||
return(val);
|
||||
return (val);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,164 +9,197 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inpdefs.h"
|
||||
#include "inp.h"
|
||||
|
||||
double
|
||||
INPevaluate(char **line, int *error, int gobble)
|
||||
/* non-zero to gobble rest of token, zero to leave it alone */
|
||||
double INPevaluate(char **line, int *error, int gobble)
|
||||
/* non-zero to gobble rest of token, zero to leave it alone */
|
||||
{
|
||||
char * token;
|
||||
char * here;
|
||||
char *token;
|
||||
char *here;
|
||||
double mantis;
|
||||
int expo1;
|
||||
int expo2;
|
||||
int sign;
|
||||
int expsgn;
|
||||
char * tmpline;
|
||||
char *tmpline;
|
||||
|
||||
/* setup */
|
||||
tmpline = *line;
|
||||
if(gobble) {
|
||||
*error = INPgetUTok(line,&token,1);
|
||||
if(*error) return((double)0.0);
|
||||
if (gobble) {
|
||||
*error = INPgetUTok(line, &token, 1);
|
||||
if (*error)
|
||||
return ((double) 0.0);
|
||||
} else {
|
||||
token = *line;
|
||||
*error = 0;
|
||||
token = *line;
|
||||
*error = 0;
|
||||
}
|
||||
mantis=0;
|
||||
expo1=0;
|
||||
expo2=0;
|
||||
sign=1;
|
||||
expsgn=1;
|
||||
mantis = 0;
|
||||
expo1 = 0;
|
||||
expo2 = 0;
|
||||
sign = 1;
|
||||
expsgn = 1;
|
||||
/* loop through all of the input token */
|
||||
here = token;
|
||||
if(*here == '+') here++; /* plus, so do nothing except skip it */
|
||||
if(*here == '-') { /* minus, so skip it, and change sign */
|
||||
here++;
|
||||
sign = -1;
|
||||
if (*here == '+')
|
||||
here++; /* plus, so do nothing except skip it */
|
||||
if (*here == '-') { /* minus, so skip it, and change sign */
|
||||
here++;
|
||||
sign = -1;
|
||||
}
|
||||
if( (*here == 0) || ((!(isdigit(*here))) && (*here != '.'))) {
|
||||
/* number looks like just a sign! */
|
||||
*error = 1;
|
||||
/* back out the 'gettok' operation */
|
||||
*line = tmpline;
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return(0);
|
||||
if ((*here == 0) || ((!(isdigit(*here))) && (*here != '.'))) {
|
||||
/* number looks like just a sign! */
|
||||
*error = 1;
|
||||
/* back out the 'gettok' operation */
|
||||
*line = tmpline;
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
while(isdigit(*here)) {
|
||||
/* digit, so accumulate it. */
|
||||
mantis=10*mantis+*here-'0';
|
||||
here++;
|
||||
while (isdigit(*here)) {
|
||||
/* digit, so accumulate it. */
|
||||
mantis = 10 * mantis + *here - '0';
|
||||
here++;
|
||||
}
|
||||
if(*here == 0) {
|
||||
/* reached the end of token - done. */
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return ((double)mantis*sign);
|
||||
if (*here == 0) {
|
||||
/* reached the end of token - done. */
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return ((double) mantis * sign);
|
||||
}
|
||||
if(*here == ':') {
|
||||
if (*here == ':') {
|
||||
/* hack for subcircuit node numbering */
|
||||
*error = 1;
|
||||
*line = tmpline;
|
||||
return 0.0;
|
||||
}
|
||||
/* after decimal point! */
|
||||
if(*here == '.') {
|
||||
/* found a decimal point! */
|
||||
here++; /* skip to next character */
|
||||
if(*here == 0) {
|
||||
/* number ends in the decimal point */
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return ((double)mantis*sign);
|
||||
}
|
||||
while(isdigit(*here)) {
|
||||
/* digit, so accumulate it. */
|
||||
mantis=10*mantis+*here - '0';
|
||||
expo1=expo1-1;
|
||||
if(*here == 0) {
|
||||
/* reached the end of token - done. */
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return (mantis*sign*pow(10.,(double)expo1));
|
||||
}
|
||||
here++;
|
||||
}
|
||||
if (*here == '.') {
|
||||
/* found a decimal point! */
|
||||
here++; /* skip to next character */
|
||||
if (*here == 0) {
|
||||
/* number ends in the decimal point */
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return ((double) mantis * sign);
|
||||
}
|
||||
while (isdigit(*here)) {
|
||||
/* digit, so accumulate it. */
|
||||
mantis = 10 * mantis + *here - '0';
|
||||
expo1 = expo1 - 1;
|
||||
if (*here == 0) {
|
||||
/* reached the end of token - done. */
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return (mantis * sign * pow(10., (double) expo1));
|
||||
}
|
||||
here++;
|
||||
}
|
||||
}
|
||||
/* now look for "E","e",etc to indicate an exponent */
|
||||
if((*here == 'E') || (*here == 'e') || (*here == 'D') || (*here == 'd') ) {
|
||||
/* have an exponent, so skip the e */
|
||||
here++;
|
||||
/* now look for exponent sign */
|
||||
if(*here == '+') here++; /* just skip + */
|
||||
if(*here == '-') {
|
||||
here++; /* skip over minus sign */
|
||||
expsgn = -1; /* and make a negative exponent */
|
||||
/* now look for the digits of the exponent */
|
||||
}
|
||||
while (isdigit(*here)) {
|
||||
expo2=10*expo2+*here - '0';
|
||||
here++;
|
||||
}
|
||||
if ((*here == 'E') || (*here == 'e') || (*here == 'D')
|
||||
|| (*here == 'd')) {
|
||||
/* have an exponent, so skip the e */
|
||||
here++;
|
||||
/* now look for exponent sign */
|
||||
if (*here == '+')
|
||||
here++; /* just skip + */
|
||||
if (*here == '-') {
|
||||
here++; /* skip over minus sign */
|
||||
expsgn = -1; /* and make a negative exponent */
|
||||
/* now look for the digits of the exponent */
|
||||
}
|
||||
while (isdigit(*here)) {
|
||||
expo2 = 10 * expo2 + *here - '0';
|
||||
here++;
|
||||
}
|
||||
}
|
||||
/* now we have all of the numeric part of the number, time to
|
||||
* look for the scale factor (alphabetic)
|
||||
*/
|
||||
switch(*here) {
|
||||
case 't':
|
||||
case 'T':
|
||||
expo1=expo1+12;
|
||||
break;
|
||||
case 'g':
|
||||
case 'G':
|
||||
expo1=expo1+9;
|
||||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
expo1=expo1+3;
|
||||
break;
|
||||
case 'u':
|
||||
case 'U':
|
||||
expo1=expo1-6;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
expo1=expo1-9;
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
expo1=expo1-12;
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
expo1=expo1-15;
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
{
|
||||
/* special case for m - may be m or mil or meg */
|
||||
if(*(here+1) != 0 && *(here+2) != 0) {
|
||||
/* at least 2 characters, so check them. */
|
||||
if((*(here+1) == 'E') || (*(here+1) == 'e')) {
|
||||
if((*(here+2) == 'G') || (*(here+2) == 'g')) {
|
||||
expo1=expo1+6;
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return (sign*mantis*
|
||||
pow((double)10,(double)(expo1+expsgn*expo2)));
|
||||
}
|
||||
}
|
||||
else if ((*(here+1) == 'I') || (*(here+1) == 'i')) {
|
||||
if( (*(here+2) == 'L') || (*(here+2) == 'l')) {
|
||||
expo1=expo1-6;
|
||||
mantis=mantis*25.4;
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return (sign*mantis*
|
||||
pow((double)10,(double)(expo1+expsgn*expo2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* not either special case, so just m => 1e-3 */
|
||||
expo1=expo1-3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (*here) {
|
||||
case 't':
|
||||
case 'T':
|
||||
expo1 = expo1 + 12;
|
||||
break;
|
||||
case 'g':
|
||||
case 'G':
|
||||
expo1 = expo1 + 9;
|
||||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
expo1 = expo1 + 3;
|
||||
break;
|
||||
case 'u':
|
||||
case 'U':
|
||||
expo1 = expo1 - 6;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
expo1 = expo1 - 9;
|
||||
break;
|
||||
case 'p':
|
||||
case 'P':
|
||||
expo1 = expo1 - 12;
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
expo1 = expo1 - 15;
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
{
|
||||
/* special case for m - may be m or mil or meg */
|
||||
if (*(here + 1) != 0 && *(here + 2) != 0) {
|
||||
/* at least 2 characters, so check them. */
|
||||
if ((*(here + 1) == 'E') || (*(here + 1) == 'e')) {
|
||||
if ((*(here + 2) == 'G') || (*(here + 2) == 'g')) {
|
||||
expo1 = expo1 + 6;
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return (sign * mantis *
|
||||
pow((double) 10,
|
||||
(double) (expo1 + expsgn * expo2)));
|
||||
}
|
||||
} else if ((*(here + 1) == 'I') || (*(here + 1) == 'i')) {
|
||||
if ((*(here + 2) == 'L') || (*(here + 2) == 'l')) {
|
||||
expo1 = expo1 - 6;
|
||||
mantis = mantis * 25.4;
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return (sign * mantis *
|
||||
pow((double) 10,
|
||||
(double) (expo1 + expsgn * expo2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* not either special case, so just m => 1e-3 */
|
||||
expo1 = expo1 - 3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(gobble) { FREE(token); }else{ *line=here;}
|
||||
return (sign*mantis*pow((double)10,(double)(expo1+expsgn*expo2)));
|
||||
if (gobble) {
|
||||
FREE(token);
|
||||
} else {
|
||||
*line = here;
|
||||
}
|
||||
return (sign * mantis *
|
||||
pow((double) 10, (double) (expo1 + expsgn * expo2)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,52 +16,53 @@ Modified: 1999 Paolo Nenzi - Now we can use a two digits level code -
|
|||
#include "inpdefs.h"
|
||||
#include "inp.h"
|
||||
|
||||
char *
|
||||
INPfindLev(char *line, int *level)
|
||||
char *INPfindLev(char *line, int *level)
|
||||
{
|
||||
char *where;
|
||||
|
||||
|
||||
where = line;
|
||||
|
||||
where=strstr(line, "level");
|
||||
|
||||
if (where!=NULL) { /* found a level keyword on the line */
|
||||
|
||||
where += 5; /* skip the level keyword */
|
||||
while( (*where == ' ') || (*where == '\t') || (*where == '=') ||
|
||||
(*where == ',') || (*where == '(') || (*where == ')') ||
|
||||
(*where == '+') ) { /* legal white space - ignore */
|
||||
where++;
|
||||
}
|
||||
|
||||
/* now the magic number */
|
||||
sscanf(where,"%2d",level); /* We get the level number */
|
||||
if (*level<0) {
|
||||
*level=1;
|
||||
printf("Illegal value for level.\n");
|
||||
printf("Level must be >0 (Setting level to 1)\n");
|
||||
return(INPmkTemp(" illegal (negative) argument to level parameter - level=1 assumed"));
|
||||
}
|
||||
|
||||
if (*level>99) { /* Limit to change in the future */
|
||||
*level=1;
|
||||
|
||||
where = strstr(line, "level");
|
||||
|
||||
if (where != NULL) { /* found a level keyword on the line */
|
||||
|
||||
where += 5; /* skip the level keyword */
|
||||
while ((*where == ' ') || (*where == '\t') || (*where == '=') ||
|
||||
(*where == ',') || (*where == '(') || (*where == ')') ||
|
||||
(*where == '+')) { /* legal white space - ignore */
|
||||
where++;
|
||||
}
|
||||
|
||||
/* now the magic number */
|
||||
sscanf(where, "%2d", level); /* We get the level number */
|
||||
if (*level < 0) {
|
||||
*level = 1;
|
||||
printf("Illegal value for level.\n");
|
||||
printf("Level must be >0 (Setting level to 1)\n");
|
||||
return (INPmkTemp
|
||||
(" illegal (negative) argument to level parameter - level=1 assumed"));
|
||||
}
|
||||
|
||||
if (*level > 99) { /* Limit to change in the future */
|
||||
*level = 1;
|
||||
printf("Illegal value for level.\n");
|
||||
printf("Level must be <99 (Setting Level to 1)\n");
|
||||
return(INPmkTemp(" illegal (too high) argument to level parameter - level=1 assumed"));
|
||||
}
|
||||
|
||||
return((char *)NULL);
|
||||
}
|
||||
|
||||
return (INPmkTemp
|
||||
(" illegal (too high) argument to level parameter - level=1 assumed"));
|
||||
}
|
||||
|
||||
return ((char *) NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
else { /* no level on the line => default */
|
||||
*level = 1;
|
||||
printf("Level not specified: Using level 1.\n");
|
||||
return ((char *) NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else { /* no level on the line => default */
|
||||
*level = 1;
|
||||
printf("Level not specified: Using level 1.\n");
|
||||
return((char *)NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,86 +13,109 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
extern INPmodel *modtab;
|
||||
|
||||
char *
|
||||
INPgetMod(void *ckt, char *name, INPmodel **model, INPtables *tab)
|
||||
char *INPgetMod(void *ckt, char *name, INPmodel ** model, INPtables * tab)
|
||||
{
|
||||
INPmodel *modtmp;
|
||||
IFvalue * val;
|
||||
IFvalue *val;
|
||||
register int j;
|
||||
char * line;
|
||||
char *line;
|
||||
char *parm;
|
||||
char *err = NULL;
|
||||
char *temp;
|
||||
int error;
|
||||
|
||||
for (modtmp = modtab;modtmp != (INPmodel *)NULL;modtmp =
|
||||
((modtmp)->INPnextModel)) {
|
||||
if (strcmp((modtmp)->INPmodName,name) == 0) {
|
||||
/* found the model in question - now instantiate if necessary */
|
||||
/* and return an appropriate pointer to it */
|
||||
if(modtmp->INPmodType<0) {
|
||||
/* illegal device type, so can't handle */
|
||||
*model = (INPmodel *)NULL;
|
||||
err = (char *)MALLOC((35+strlen(name)) * sizeof(char));
|
||||
(void) sprintf(err,
|
||||
"Unknown device type for model %s \n",name);
|
||||
return(err);
|
||||
}
|
||||
if(! ((modtmp)->INPmodUsed )) {
|
||||
/* not already defined, so create & give parameters */
|
||||
error = (*(ft_sim->newModel))( ckt,(modtmp)->INPmodType,
|
||||
&((modtmp)->INPmodfast), (modtmp)->INPmodName);
|
||||
if(error) return(INPerror(error));
|
||||
/* parameter isolation, identification, binding */
|
||||
line = ((modtmp)->INPmodLine)->line;
|
||||
INPgetTok(&line,&parm,1); /* throw away '.model' */
|
||||
INPgetTok(&line,&parm,1); /* throw away 'modname' */
|
||||
while(*line != 0) {
|
||||
INPgetTok(&line,&parm,1);
|
||||
for (modtmp = modtab; modtmp != (INPmodel *) NULL; modtmp =
|
||||
((modtmp)->INPnextModel)) {
|
||||
if (strcmp((modtmp)->INPmodName, name) == 0) {
|
||||
/* found the model in question - now instantiate if necessary */
|
||||
/* and return an appropriate pointer to it */
|
||||
if (modtmp->INPmodType < 0) {
|
||||
/* illegal device type, so can't handle */
|
||||
*model = (INPmodel *) NULL;
|
||||
err = (char *) MALLOC((35 + strlen(name)) * sizeof(char));
|
||||
(void) sprintf(err,
|
||||
"Unknown device type for model %s \n",
|
||||
name);
|
||||
return (err);
|
||||
}
|
||||
if (!((modtmp)->INPmodUsed)) {
|
||||
/* not already defined, so create & give parameters */
|
||||
error = (*(ft_sim->newModel)) (ckt, (modtmp)->INPmodType,
|
||||
&((modtmp)->INPmodfast),
|
||||
(modtmp)->INPmodName);
|
||||
if (error)
|
||||
return (INPerror(error));
|
||||
/* parameter isolation, identification, binding */
|
||||
line = ((modtmp)->INPmodLine)->line;
|
||||
INPgetTok(&line, &parm, 1); /* throw away '.model' */
|
||||
INPgetTok(&line, &parm, 1); /* throw away 'modname' */
|
||||
while (*line != 0) {
|
||||
INPgetTok(&line, &parm, 1);
|
||||
if (!*parm)
|
||||
continue;
|
||||
for(j=0;j<(*(*(ft_sim->devices)[(modtmp)->INPmodType]).
|
||||
numModelParms); j++) {
|
||||
if (strcmp(parm,((*(ft_sim->devices) [ (modtmp)->
|
||||
INPmodType ]).modelParms[j].keyword)) == 0) {
|
||||
val = INPgetValue(ckt,&line,
|
||||
((*(ft_sim->devices)[(modtmp)->
|
||||
INPmodType ]).modelParms[j].
|
||||
dataType),tab);
|
||||
error = (*(ft_sim->setModelParm))(ckt,
|
||||
((modtmp)->INPmodfast),
|
||||
(*(ft_sim->devices)[(modtmp)->INPmodType ]).
|
||||
modelParms[j].id,val,(IFvalue*)NULL);
|
||||
if(error) return(INPerror(error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strcmp(parm,"level")==0) {
|
||||
/* just grab the level number and throw away */
|
||||
/* since we already have that info from pass1 */
|
||||
val = INPgetValue(ckt,&line,IF_REAL,tab);
|
||||
} else if(j >=
|
||||
(*(*(ft_sim->devices)[(modtmp)->INPmodType]).
|
||||
numModelParms)) {
|
||||
temp = (char *)MALLOC((40+strlen(parm)) * sizeof(char));
|
||||
(void)sprintf(temp,
|
||||
"unrecognized parameter (%s) - ignored\n", parm);
|
||||
err = INPerrCat(err,temp);
|
||||
}
|
||||
FREE(parm);
|
||||
}
|
||||
(modtmp)->INPmodUsed=1;
|
||||
(modtmp)->INPmodLine->error = err;
|
||||
}
|
||||
*model = modtmp;
|
||||
return((char *)NULL);
|
||||
}
|
||||
for (j = 0;
|
||||
j <
|
||||
(*
|
||||
(*(ft_sim->devices)
|
||||
[(modtmp)->INPmodType]).numModelParms); j++) {
|
||||
if (strcmp
|
||||
(parm,
|
||||
((*(ft_sim->devices)[(modtmp)->INPmodType]).
|
||||
modelParms[j].keyword)) == 0) {
|
||||
val =
|
||||
INPgetValue(ckt, &line,
|
||||
((*
|
||||
(ft_sim->
|
||||
devices)[
|
||||
(modtmp)->INPmodType]).
|
||||
modelParms[j].dataType), tab);
|
||||
error =
|
||||
(*(ft_sim->setModelParm)) (ckt,
|
||||
((modtmp)->
|
||||
INPmodfast),
|
||||
(*
|
||||
(ft_sim->
|
||||
devices)[
|
||||
(modtmp)->
|
||||
INPmodType]).modelParms
|
||||
[j].id, val,
|
||||
(IFvalue *)
|
||||
NULL);
|
||||
if (error)
|
||||
return (INPerror(error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strcmp(parm, "level") == 0) {
|
||||
/* just grab the level number and throw away */
|
||||
/* since we already have that info from pass1 */
|
||||
val = INPgetValue(ckt, &line, IF_REAL, tab);
|
||||
} else if (j >=
|
||||
(*
|
||||
(*(ft_sim->devices)
|
||||
[(modtmp)->INPmodType]).numModelParms)) {
|
||||
temp =
|
||||
(char *) MALLOC((40 + strlen(parm)) *
|
||||
sizeof(char));
|
||||
(void) sprintf(temp,
|
||||
"unrecognized parameter (%s) - ignored\n",
|
||||
parm);
|
||||
err = INPerrCat(err, temp);
|
||||
}
|
||||
FREE(parm);
|
||||
}
|
||||
(modtmp)->INPmodUsed = 1;
|
||||
(modtmp)->INPmodLine->error = err;
|
||||
}
|
||||
*model = modtmp;
|
||||
return ((char *) NULL);
|
||||
}
|
||||
}
|
||||
/* didn't find model - ERROR - return model */
|
||||
*model = (INPmodel *)NULL;
|
||||
err = (char *)MALLOC((60+strlen(name)) * sizeof(char));
|
||||
*model = (INPmodel *) NULL;
|
||||
err = (char *) MALLOC((60 + strlen(name)) * sizeof(char));
|
||||
(void) sprintf(err,
|
||||
" unable to find definition of model %s - default assumed \n",name);
|
||||
return(err);
|
||||
" unable to find definition of model %s - default assumed \n",
|
||||
name);
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,61 +13,62 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inpdefs.h"
|
||||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPgetStr(char **line, char **token, int gobble)
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
int INPgetStr(char **line, char **token, int gobble)
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
{
|
||||
char *point;
|
||||
char separator = '\0';
|
||||
char *point;
|
||||
char separator = '\0';
|
||||
|
||||
/* Scan along throwing away garbage characters. */
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if ( (*point == ' ') ||
|
||||
(*point == '\t') ||
|
||||
(*point == '=') ||
|
||||
(*point == '(') ||
|
||||
(*point == ')') ||
|
||||
(*point == ',') ) continue;
|
||||
break;
|
||||
}
|
||||
if (*point == '"') {
|
||||
separator = '"';
|
||||
point++;
|
||||
} else if (*point == '\'') {
|
||||
separator = '\'';
|
||||
point++;
|
||||
}
|
||||
/* mark beginning of token */
|
||||
*line = point;
|
||||
/* now find all good characters */
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if ( (*point == ' ') ||
|
||||
(*point == '\t') ||
|
||||
(*point == '=') ||
|
||||
(*point == '(') ||
|
||||
(*point == ')') ||
|
||||
(*point == ',') ||
|
||||
(*point == separator) ) break;
|
||||
}
|
||||
/* Scan along throwing away garbage characters. */
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if ((*point == ' ') ||
|
||||
(*point == '\t') ||
|
||||
(*point == '=') ||
|
||||
(*point == '(') || (*point == ')') || (*point == ','))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (*point == '"') {
|
||||
separator = '"';
|
||||
point++;
|
||||
} else if (*point == '\'') {
|
||||
separator = '\'';
|
||||
point++;
|
||||
}
|
||||
/* mark beginning of token */
|
||||
*line = point;
|
||||
/* now find all good characters */
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if ((*point == ' ') ||
|
||||
(*point == '\t') ||
|
||||
(*point == '=') ||
|
||||
(*point == '(') ||
|
||||
(*point == ')') || (*point == ',') || (*point == separator))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Create token */
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
*line = point;
|
||||
/* Create token */
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
*line = point;
|
||||
|
||||
/* Gobble garbage to next token. */
|
||||
if (separator && **line == separator) {
|
||||
(*line)++; /* Skip one closing separator */
|
||||
}
|
||||
for (; **line != '\0'; (*line)++) {
|
||||
if(**line == ' ') continue;
|
||||
if(**line == '\t') continue;
|
||||
if((**line == '=') && gobble) continue;
|
||||
if((**line == ',') && gobble) continue;
|
||||
break;
|
||||
}
|
||||
return (OK);
|
||||
/* Gobble garbage to next token. */
|
||||
if (separator && **line == separator) {
|
||||
(*line)++; /* Skip one closing separator */
|
||||
}
|
||||
for (; **line != '\0'; (*line)++) {
|
||||
if (**line == ' ')
|
||||
continue;
|
||||
if (**line == '\t')
|
||||
continue;
|
||||
if ((**line == '=') && gobble)
|
||||
continue;
|
||||
if ((**line == ',') && gobble)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,13 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "fteext.h"
|
||||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPgetTitle(void **ckt, card **data)
|
||||
int INPgetTitle(void **ckt, card ** data)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = (*(ft_sim->newCircuit))(ckt);
|
||||
if(error) return(error);
|
||||
error = (*(ft_sim->newCircuit)) (ckt);
|
||||
if (error)
|
||||
return (error);
|
||||
*data = (*data)->nextcard;
|
||||
return(OK);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,87 +18,113 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inpdefs.h"
|
||||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPgetTok(char **line, char **token, int gobble)
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
int INPgetTok(char **line, char **token, int gobble)
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
{
|
||||
char * point;
|
||||
char *point;
|
||||
int signstate;
|
||||
|
||||
/* scan along throwing away garbage characters */
|
||||
for(point = *line;*point != '\0' ; point++ ) {
|
||||
if(*point == ' ') continue;
|
||||
if(*point == '\t') continue;
|
||||
if(*point == '=') continue;
|
||||
if(*point == '(') continue;
|
||||
if(*point == ')') continue;
|
||||
if(*point == ',') continue;
|
||||
break;
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if (*point == ' ')
|
||||
continue;
|
||||
if (*point == '\t')
|
||||
continue;
|
||||
if (*point == '=')
|
||||
continue;
|
||||
if (*point == '(')
|
||||
continue;
|
||||
if (*point == ')')
|
||||
continue;
|
||||
if (*point == ',')
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
/* mark beginning of token */
|
||||
*line = point;
|
||||
/* now find all good characters */
|
||||
signstate = 0;
|
||||
for(point = *line;*point!='\0';point++) {
|
||||
if(*point == ' ') break;
|
||||
if(*point == '\t') break;
|
||||
if(*point == '=') break;
|
||||
if(*point == '(') break;
|
||||
if(*point == ')') break;
|
||||
if(*point == ',') break;
|
||||
/* This is not complex enough to catch all errors, but it will get the "good" parses */
|
||||
if(*point == '+' && (signstate == 1 || signstate == 3)) break;
|
||||
if(*point == '-' && (signstate == 1 || signstate == 3)) break;
|
||||
if(*point == '*') break;
|
||||
if(*point == '/') break;
|
||||
if(*point == '^') break;
|
||||
if (isdigit(*point) || *point == '.') {
|
||||
if (signstate > 1)
|
||||
signstate = 3;
|
||||
else
|
||||
signstate = 1;
|
||||
} else if (tolower(*point) == 'e' && signstate == 1)
|
||||
signstate = 2;
|
||||
else
|
||||
signstate = 3;
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if (*point == ' ')
|
||||
break;
|
||||
if (*point == '\t')
|
||||
break;
|
||||
if (*point == '=')
|
||||
break;
|
||||
if (*point == '(')
|
||||
break;
|
||||
if (*point == ')')
|
||||
break;
|
||||
if (*point == ',')
|
||||
break;
|
||||
/* This is not complex enough to catch all errors, but it will get the "good" parses */
|
||||
if (*point == '+' && (signstate == 1 || signstate == 3))
|
||||
break;
|
||||
if (*point == '-' && (signstate == 1 || signstate == 3))
|
||||
break;
|
||||
if (*point == '*')
|
||||
break;
|
||||
if (*point == '/')
|
||||
break;
|
||||
if (*point == '^')
|
||||
break;
|
||||
if (isdigit(*point) || *point == '.') {
|
||||
if (signstate > 1)
|
||||
signstate = 3;
|
||||
else
|
||||
signstate = 1;
|
||||
} else if (tolower(*point) == 'e' && signstate == 1)
|
||||
signstate = 2;
|
||||
else
|
||||
signstate = 3;
|
||||
|
||||
}
|
||||
if (point == *line && *point) /* Weird items, 1 char */
|
||||
point++;
|
||||
*token=(char *)MALLOC(1+point-*line);
|
||||
if(!*token) return(E_NOMEM);
|
||||
(void) strncpy(*token,*line,point-*line);
|
||||
*(*token + (point-*line)) = '\0';
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
*line = point;
|
||||
/* gobble garbage to next token */
|
||||
for( ;**line != '\0' ; (*line)++ ) {
|
||||
if(**line == ' ') continue;
|
||||
if(**line == '\t') continue;
|
||||
if((**line == '=') && gobble) continue;
|
||||
if((**line == ',') && gobble) continue;
|
||||
break;
|
||||
for (; **line != '\0'; (*line)++) {
|
||||
if (**line == ' ')
|
||||
continue;
|
||||
if (**line == '\t')
|
||||
continue;
|
||||
if ((**line == '=') && gobble)
|
||||
continue;
|
||||
if ((**line == ',') && gobble)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
/*printf("found token (%s) and rest of line (%s)\n",*token,*line);*/
|
||||
return(OK);
|
||||
/*printf("found token (%s) and rest of line (%s)\n",*token,*line); */
|
||||
return (OK);
|
||||
}
|
||||
|
||||
int
|
||||
INPgetUTok(char **line, char **token, int gobble)
|
||||
|
||||
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
int INPgetUTok(char **line, char **token, int gobble)
|
||||
|
||||
|
||||
/* eat non-whitespace trash AFTER token? */
|
||||
{
|
||||
char * point, separator;
|
||||
char *point, separator;
|
||||
int signstate;
|
||||
/* scan along throwing away garbage characters */
|
||||
for(point = *line;*point != '\0' ; point++ ) {
|
||||
if(*point == ' ') continue;
|
||||
if(*point == '\t') continue;
|
||||
if(*point == '=') continue;
|
||||
if(*point == '(') continue;
|
||||
if(*point == ')') continue;
|
||||
if(*point == ',') continue;
|
||||
break;
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if (*point == ' ')
|
||||
continue;
|
||||
if (*point == '\t')
|
||||
continue;
|
||||
if (*point == '=')
|
||||
continue;
|
||||
if (*point == '(')
|
||||
continue;
|
||||
if (*point == ')')
|
||||
continue;
|
||||
if (*point == ',')
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (*point == '"') {
|
||||
separator = '"';
|
||||
|
|
@ -114,30 +140,41 @@ INPgetUTok(char **line, char **token, int gobble)
|
|||
|
||||
/* now find all good characters */
|
||||
signstate = 0;
|
||||
for(point = *line;*point!='\0';point++) {
|
||||
for (point = *line; *point != '\0'; point++) {
|
||||
if (separator) {
|
||||
if (*point == separator)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if(*point == ' ') break;
|
||||
if(*point == '\t') break;
|
||||
if(*point == '=') break;
|
||||
if(*point == '(') break;
|
||||
if(*point == ')') break;
|
||||
if(*point == ',') break;
|
||||
if (*point == ' ')
|
||||
break;
|
||||
if (*point == '\t')
|
||||
break;
|
||||
if (*point == '=')
|
||||
break;
|
||||
if (*point == '(')
|
||||
break;
|
||||
if (*point == ')')
|
||||
break;
|
||||
if (*point == ',')
|
||||
break;
|
||||
/* This is not complex enough to catch all errors, but it will
|
||||
get the "good" parses */
|
||||
if(*point == '+' && (signstate == 1 || signstate == 3)) break;
|
||||
if(*point == '-') {
|
||||
if (signstate == 1 || signstate == 3) break;
|
||||
if (*point == '+' && (signstate == 1 || signstate == 3))
|
||||
break;
|
||||
if (*point == '-') {
|
||||
if (signstate == 1 || signstate == 3)
|
||||
break;
|
||||
signstate += 1;
|
||||
continue;
|
||||
}
|
||||
if(*point == '*') break;
|
||||
if(*point == '/') break;
|
||||
if(*point == '^') break;
|
||||
if (*point == '*')
|
||||
break;
|
||||
if (*point == '/')
|
||||
break;
|
||||
if (*point == '^')
|
||||
break;
|
||||
if (isdigit(*point) || *point == '.') {
|
||||
if (signstate > 1)
|
||||
signstate = 3;
|
||||
|
|
@ -152,21 +189,26 @@ INPgetUTok(char **line, char **token, int gobble)
|
|||
point--;
|
||||
if (point == *line && *point) /* Weird items, 1 char */
|
||||
point++;
|
||||
*token=(char *)MALLOC(1+point-*line);
|
||||
if(!*token) return(E_NOMEM);
|
||||
(void) strncpy(*token,*line,point-*line);
|
||||
*(*token + (point-*line)) = '\0';
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
/* gobble garbage to next token */
|
||||
for( ;*point != '\0' ; point++ ) {
|
||||
for (; *point != '\0'; point++) {
|
||||
if (*point == separator)
|
||||
continue;
|
||||
if(*point == ' ') continue;
|
||||
if(*point == '\t') continue;
|
||||
if((*point == '=') && gobble) continue;
|
||||
if((*point == ',') && gobble) continue;
|
||||
break;
|
||||
if (*point == ' ')
|
||||
continue;
|
||||
if (*point == '\t')
|
||||
continue;
|
||||
if ((*point == '=') && gobble)
|
||||
continue;
|
||||
if ((*point == ',') && gobble)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
*line = point;
|
||||
/* printf("found token (%s) and rest of line (%s)\n",*token,*line); */
|
||||
return(OK);
|
||||
/* printf("found token (%s) and rest of line (%s)\n",*token,*line); */
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inpptree.h"
|
||||
#include "inp.h"
|
||||
|
||||
IFvalue *
|
||||
INPgetValue(void *ckt, char **line, int type, INPtables *tab)
|
||||
IFvalue *INPgetValue(void *ckt, char **line, int type, INPtables * tab)
|
||||
{
|
||||
double *list;
|
||||
int *ilist;
|
||||
|
|
@ -23,56 +22,60 @@ INPgetValue(void *ckt, char **line, int type, INPtables *tab)
|
|||
|
||||
/* make sure we get rid of extra bits in type */
|
||||
type &= IF_VARTYPES;
|
||||
if(type == IF_INTEGER) {
|
||||
temp.iValue = INPevaluate(line,&error,1);
|
||||
/*printf(" returning integer value %d\n",temp.iValue);*/
|
||||
if (type == IF_INTEGER) {
|
||||
temp.iValue = INPevaluate(line, &error, 1);
|
||||
/*printf(" returning integer value %d\n",temp.iValue); */
|
||||
} else if (type == IF_REAL) {
|
||||
temp.rValue = INPevaluate(line,&error,1);
|
||||
/*printf(" returning real value %e\n",temp.rValue);*/
|
||||
temp.rValue = INPevaluate(line, &error, 1);
|
||||
/*printf(" returning real value %e\n",temp.rValue); */
|
||||
} else if (type == IF_REALVEC) {
|
||||
temp.v.numValue = 0;
|
||||
list = (double *)MALLOC(sizeof(double));
|
||||
tmp = INPevaluate(line,&error,1);
|
||||
while (error == 0) {
|
||||
/*printf(" returning vector value %g\n",tmp); */
|
||||
temp.v.numValue++;
|
||||
list=(double *)REALLOC((char *)list,temp.v.numValue*sizeof(double));
|
||||
*(list+temp.v.numValue-1) = tmp;
|
||||
tmp = INPevaluate(line,&error,1);
|
||||
}
|
||||
temp.v.vec.rVec=list;
|
||||
temp.v.numValue = 0;
|
||||
list = (double *) MALLOC(sizeof(double));
|
||||
tmp = INPevaluate(line, &error, 1);
|
||||
while (error == 0) {
|
||||
/*printf(" returning vector value %g\n",tmp); */
|
||||
temp.v.numValue++;
|
||||
list =
|
||||
(double *) REALLOC((char *) list,
|
||||
temp.v.numValue * sizeof(double));
|
||||
*(list + temp.v.numValue - 1) = tmp;
|
||||
tmp = INPevaluate(line, &error, 1);
|
||||
}
|
||||
temp.v.vec.rVec = list;
|
||||
} else if (type == IF_INTVEC) {
|
||||
temp.v.numValue = 0;
|
||||
ilist = (int *)MALLOC(sizeof(int));
|
||||
tmp = INPevaluate(line,&error,1);
|
||||
while (error == 0) {
|
||||
/*printf(" returning vector value %g\n",tmp); */
|
||||
temp.v.numValue++;
|
||||
ilist=(int *)REALLOC((char *)ilist,temp.v.numValue*sizeof(int));
|
||||
*(ilist+temp.v.numValue-1) = tmp;
|
||||
tmp = INPevaluate(line,&error,1);
|
||||
}
|
||||
temp.v.vec.iVec=ilist;
|
||||
temp.v.numValue = 0;
|
||||
ilist = (int *) MALLOC(sizeof(int));
|
||||
tmp = INPevaluate(line, &error, 1);
|
||||
while (error == 0) {
|
||||
/*printf(" returning vector value %g\n",tmp); */
|
||||
temp.v.numValue++;
|
||||
ilist =
|
||||
(int *) REALLOC((char *) ilist,
|
||||
temp.v.numValue * sizeof(int));
|
||||
*(ilist + temp.v.numValue - 1) = tmp;
|
||||
tmp = INPevaluate(line, &error, 1);
|
||||
}
|
||||
temp.v.vec.iVec = ilist;
|
||||
} else if (type == IF_FLAG) {
|
||||
temp.iValue = 1;
|
||||
temp.iValue = 1;
|
||||
} else if (type == IF_NODE) {
|
||||
INPgetTok(line,&word,1);
|
||||
INPtermInsert(ckt,&word,tab,&(temp.nValue));
|
||||
INPgetTok(line, &word, 1);
|
||||
INPtermInsert(ckt, &word, tab, &(temp.nValue));
|
||||
} else if (type == IF_INSTANCE) {
|
||||
INPgetTok(line,&word,1);
|
||||
INPinsert(&word,tab);
|
||||
temp.nValue = word;
|
||||
INPgetTok(line, &word, 1);
|
||||
INPinsert(&word, tab);
|
||||
temp.nValue = word;
|
||||
} else if (type == IF_STRING) {
|
||||
INPgetStr(line,&word,1);
|
||||
temp.sValue = word;
|
||||
INPgetStr(line, &word, 1);
|
||||
temp.sValue = word;
|
||||
} else if (type == IF_PARSETREE) {
|
||||
INPgetTree(line, &pt, ckt, tab);
|
||||
if (!pt)
|
||||
return((IFvalue *)NULL);
|
||||
temp.tValue = (IFparseTree *) pt;
|
||||
/*INPptPrint("Parse tree is: ", temp.tValue);*/
|
||||
} else { /* don't know what type of parameter caller is talking about! */
|
||||
return((IFvalue *)NULL);
|
||||
INPgetTree(line, &pt, ckt, tab);
|
||||
if (!pt)
|
||||
return ((IFvalue *) NULL);
|
||||
temp.tValue = (IFparseTree *) pt;
|
||||
/*INPptPrint("Parse tree is: ", temp.tValue); */
|
||||
} else { /* don't know what type of parameter caller is talking about! */
|
||||
return ((IFvalue *) NULL);
|
||||
}
|
||||
return(&temp);
|
||||
return (&temp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,18 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
extern INPmodel *modtab;
|
||||
|
||||
void
|
||||
INPkillMods(void)
|
||||
void INPkillMods(void)
|
||||
{
|
||||
INPmodel *modtmp;
|
||||
INPmodel *prev = NULL;
|
||||
|
||||
for (modtmp = modtab;modtmp != (INPmodel *)NULL;modtmp =
|
||||
modtmp->INPnextModel) {
|
||||
if(prev) FREE(prev);
|
||||
prev = modtmp;
|
||||
for (modtmp = modtab; modtmp != (INPmodel *) NULL; modtmp =
|
||||
modtmp->INPnextModel) {
|
||||
if (prev)
|
||||
FREE(prev);
|
||||
prev = modtmp;
|
||||
}
|
||||
if(prev) FREE(prev);
|
||||
modtab = (INPmodel *)NULL;
|
||||
if (prev)
|
||||
FREE(prev);
|
||||
modtab = (INPmodel *) NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,38 +17,36 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
void
|
||||
INPlist(FILE *file, card *deck, int type)
|
||||
void INPlist(FILE * file, card * deck, int type)
|
||||
{
|
||||
|
||||
card *here;
|
||||
card *there;
|
||||
|
||||
if(type == LOGICAL) {
|
||||
for(here = deck;here != NULL;here = here->nextcard) {
|
||||
fprintf(file,"%6d : %s\n",here->linenum, here->line);
|
||||
if(here->error != (char *)NULL) {
|
||||
fprintf(file,"%s",here->error);
|
||||
}
|
||||
}
|
||||
if (type == LOGICAL) {
|
||||
for (here = deck; here != NULL; here = here->nextcard) {
|
||||
fprintf(file, "%6d : %s\n", here->linenum, here->line);
|
||||
if (here->error != (char *) NULL) {
|
||||
fprintf(file, "%s", here->error);
|
||||
}
|
||||
}
|
||||
} else if (type == PHYSICAL) {
|
||||
for(here = deck;here != NULL;here = here->nextcard) {
|
||||
if(here->actualLine == (card *)NULL) {
|
||||
fprintf(file,"%6d : %s\n",here->linenum,here->line);
|
||||
if(here->error != (char *)NULL) {
|
||||
fprintf(file,"%s",here->error);
|
||||
}
|
||||
} else {
|
||||
for(there = here->actualLine;there != NULL;
|
||||
there=there->nextcard) {
|
||||
fprintf(file,"%6d : %s\n",there->linenum, there->line);
|
||||
if(there->error != (char *)NULL) {
|
||||
fprintf(file,"%s",there->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (here = deck; here != NULL; here = here->nextcard) {
|
||||
if (here->actualLine == (card *) NULL) {
|
||||
fprintf(file, "%6d : %s\n", here->linenum, here->line);
|
||||
if (here->error != (char *) NULL) {
|
||||
fprintf(file, "%s", here->error);
|
||||
}
|
||||
} else {
|
||||
for (there = here->actualLine; there != NULL;
|
||||
there = there->nextcard) {
|
||||
fprintf(file, "%6d : %s\n", there->linenum,
|
||||
there->line);
|
||||
if (there->error != (char *) NULL) {
|
||||
fprintf(file, "%s", there->error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,18 +14,16 @@ Author: 1985 Thomas L. Quarles
|
|||
extern INPmodel *modtab;
|
||||
|
||||
|
||||
int
|
||||
INPlookMod(char *name)
|
||||
int INPlookMod(char *name)
|
||||
{
|
||||
register INPmodel **i;
|
||||
|
||||
for (i = &modtab;*i != (INPmodel *)NULL;i = &((*i)->INPnextModel)) {
|
||||
if (strcmp((*i)->INPmodName,name) == 0) {
|
||||
/* found the model in question - return TRUE */
|
||||
return(1);
|
||||
}
|
||||
for (i = &modtab; *i != (INPmodel *) 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 (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,23 +13,23 @@ INPmodel *modtab;
|
|||
|
||||
/* create/lookup a 'model' entry */
|
||||
|
||||
int
|
||||
INPmakeMod(char *token, int type, card *line)
|
||||
int INPmakeMod(char *token, int type, card * line)
|
||||
{
|
||||
register INPmodel **i;
|
||||
|
||||
for (i = &modtab;*i != (INPmodel *)NULL;i = &((*i)->INPnextModel)) {
|
||||
if (strcmp((*i)->INPmodName,token) == 0) {
|
||||
return(OK);
|
||||
}
|
||||
for (i = &modtab; *i != (INPmodel *) NULL; i = &((*i)->INPnextModel)) {
|
||||
if (strcmp((*i)->INPmodName, token) == 0) {
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
*i = (INPmodel *)MALLOC(sizeof(INPmodel));
|
||||
if(*i==NULL) return(E_NOMEM);
|
||||
*i = (INPmodel *) MALLOC(sizeof(INPmodel));
|
||||
if (*i == NULL)
|
||||
return (E_NOMEM);
|
||||
(*i)->INPmodName = token;
|
||||
(*i)->INPmodType = type;
|
||||
(*i)->INPnextModel = (INPmodel *)NULL;
|
||||
(*i)->INPnextModel = (INPmodel *) NULL;
|
||||
(*i)->INPmodUsed = 0;
|
||||
(*i)->INPmodLine = line;
|
||||
(*i)->INPmodfast = NULL;
|
||||
return(OK);
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "inp.h"
|
||||
|
||||
|
||||
char *
|
||||
INPmkTemp(char *string)
|
||||
char *INPmkTemp(char *string)
|
||||
{
|
||||
int len;
|
||||
char *temp;
|
||||
|
||||
int len;
|
||||
char *temp;
|
||||
|
||||
len = strlen(string);
|
||||
temp = MALLOC(len+1);
|
||||
if(temp!=(char *)NULL) (void)strcpy(temp,string);
|
||||
return(temp);
|
||||
temp = MALLOC(len + 1);
|
||||
if (temp != (char *) NULL)
|
||||
(void) strcpy(temp, string);
|
||||
return (temp);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,25 +14,24 @@ Author: 1985 Thomas L. Quarles
|
|||
* The first pass of the circuit parser just looks for '.model' lines
|
||||
*/
|
||||
|
||||
void
|
||||
INPpas1(void *ckt, card *deck, INPtables *tab)
|
||||
void INPpas1(void *ckt, card * deck, INPtables * tab)
|
||||
{
|
||||
card *current;
|
||||
char *INPdomodel(void *ckt, card *image, INPtables *tab);
|
||||
char *INPdomodel(void *ckt, card * image, INPtables * tab);
|
||||
char *temp, *thisline;
|
||||
|
||||
for(current = deck;current != NULL;current = current->nextcard) {
|
||||
/* SPICE-2 keys off of the first character of the line */
|
||||
for (current = deck; current != NULL; current = current->nextcard) {
|
||||
/* SPICE-2 keys off of the first character of the line */
|
||||
thisline = current->line;
|
||||
|
||||
while (*thisline && ((*thisline == ' ') || (*thisline == '\t')))
|
||||
thisline++;
|
||||
|
||||
if (*thisline == '.') {
|
||||
if(strncmp(thisline,".model",6)==0) {
|
||||
temp = INPdomodel(ckt,current,tab);
|
||||
current->error = INPerrCat(current->error,temp);
|
||||
}
|
||||
if (strncmp(thisline, ".model", 6) == 0) {
|
||||
temp = INPdomodel(ckt, current, tab);
|
||||
current->error = INPerrCat(current->error, temp);
|
||||
}
|
||||
}
|
||||
|
||||
/* for now, we do nothing with the other cards - just
|
||||
|
|
|
|||
|
|
@ -14,138 +14,143 @@ Author: 1985 Thomas L. Quarles
|
|||
* in pass1 and are ignored here.
|
||||
*/
|
||||
|
||||
void
|
||||
INPpas2(void *ckt, card *data, INPtables *tab, void *task)
|
||||
void INPpas2(void *ckt, card * data, INPtables * tab, void *task)
|
||||
{
|
||||
|
||||
card *current;
|
||||
char c;
|
||||
char * groundname="0";
|
||||
char * gname;
|
||||
void *gnode;
|
||||
int error; /* used by the macros defined above */
|
||||
card *current;
|
||||
char c;
|
||||
char *groundname = "0";
|
||||
char *gname;
|
||||
void *gnode;
|
||||
int error; /* used by the macros defined above */
|
||||
|
||||
error = INPgetTok(&groundname,&gname,1);
|
||||
if(error) data->error = INPerrCat(data->error,INPmkTemp(
|
||||
"can't read internal ground node name!\n"));
|
||||
error = INPgetTok(&groundname, &gname, 1);
|
||||
if (error)
|
||||
data->error =
|
||||
INPerrCat(data->error,
|
||||
INPmkTemp
|
||||
("can't read internal ground node name!\n"));
|
||||
|
||||
error = INPgndInsert(ckt,&gname,tab,&gnode);
|
||||
if(error && error!=E_EXISTS)data->error = INPerrCat(data->error,INPmkTemp(
|
||||
"can't insert internal ground node in symbol table!\n"));
|
||||
error = INPgndInsert(ckt, &gname, tab, &gnode);
|
||||
if (error && error != E_EXISTS)
|
||||
data->error =
|
||||
INPerrCat(data->error,
|
||||
INPmkTemp
|
||||
("can't insert internal ground node in symbol table!\n"));
|
||||
|
||||
for(current = data; current != NULL; current = current->nextcard) {
|
||||
for (current = data; current != NULL; current = current->nextcard) {
|
||||
|
||||
c = *(current->line);
|
||||
c = islower(c) ? toupper(c) : c;
|
||||
c = *(current->line);
|
||||
c = islower(c) ? toupper(c) : c;
|
||||
|
||||
switch(c) {
|
||||
switch (c) {
|
||||
|
||||
case ' ': /* blank line (space leading) */
|
||||
case '\t': /* blank line (tab leading) */
|
||||
break;
|
||||
|
||||
case 'R': /* Rname <node> <node> [<val>][<mname>][w=<val>][l=<val>] */
|
||||
INP2R(ckt,tab,current);
|
||||
break;
|
||||
case 'C': /* Cname <node> <node> <val> [IC=<val>] */
|
||||
INP2C(ckt,tab,current);
|
||||
break;
|
||||
case 'L': /* Lname <node> <node> <val> [IC=<val>] */
|
||||
INP2L(ckt,tab,current);
|
||||
break;
|
||||
case 'G': /* Gname <node> <node> <node> <node> <val> */
|
||||
INP2G(ckt,tab,current);
|
||||
break;
|
||||
case 'E': /* Ename <node> <node> <node> <node> <val> */
|
||||
INP2E(ckt,tab,current);
|
||||
break;
|
||||
case 'F': /* Fname <node> <node> <vname> <val> */
|
||||
INP2F(ckt,tab,current);
|
||||
break;
|
||||
case 'H': /* Hname <node> <node> <vname> <val> */
|
||||
INP2H(ckt,tab,current);
|
||||
break;
|
||||
case 'D': /* Dname <node> <node> <model> [<val>] [OFF] [IC=<val>] */
|
||||
INP2D(ckt,tab,current);
|
||||
break;
|
||||
case 'J': /* Jname <node> <node> <node> <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2J(ckt,tab,current);
|
||||
break;
|
||||
case 'Z': /* Zname <node> <node> <node> <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2Z(ckt,tab,current);
|
||||
break;
|
||||
case 'M': /* Mname <node> <node> <node> <node> <model> [L=<val>]
|
||||
* [W=<val>] [AD=<val>] [AS=<val>] [PD=<val>]
|
||||
* [PS=<val>] [NRD=<val>] [NRS=<val>] [OFF]
|
||||
* [IC=<val>,<val>,<val>] */
|
||||
INP2M(ckt,tab,current);
|
||||
break;
|
||||
|
||||
case 'O': /* Oname <node> <node> <node> <node> <model>
|
||||
* [IC=<val>,<val>,<val>,<val>] */
|
||||
INP2O(ckt,tab,current);
|
||||
case ' ': /* blank line (space leading) */
|
||||
case '\t': /* blank line (tab leading) */
|
||||
break;
|
||||
|
||||
case 'V': /* Vname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
INP2V(ckt,tab,current);
|
||||
break;
|
||||
case 'I': /* Iname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
INP2I(ckt,tab,current);
|
||||
break;
|
||||
case 'R': /* Rname <node> <node> [<val>][<mname>][w=<val>][l=<val>] */
|
||||
INP2R(ckt, tab, current);
|
||||
break;
|
||||
case 'C': /* Cname <node> <node> <val> [IC=<val>] */
|
||||
INP2C(ckt, tab, current);
|
||||
break;
|
||||
case 'L': /* Lname <node> <node> <val> [IC=<val>] */
|
||||
INP2L(ckt, tab, current);
|
||||
break;
|
||||
case 'G': /* Gname <node> <node> <node> <node> <val> */
|
||||
INP2G(ckt, tab, current);
|
||||
break;
|
||||
case 'E': /* Ename <node> <node> <node> <node> <val> */
|
||||
INP2E(ckt, tab, current);
|
||||
break;
|
||||
case 'F': /* Fname <node> <node> <vname> <val> */
|
||||
INP2F(ckt, tab, current);
|
||||
break;
|
||||
case 'H': /* Hname <node> <node> <vname> <val> */
|
||||
INP2H(ckt, tab, current);
|
||||
break;
|
||||
case 'D': /* Dname <node> <node> <model> [<val>] [OFF] [IC=<val>] */
|
||||
INP2D(ckt, tab, current);
|
||||
break;
|
||||
case 'J': /* Jname <node> <node> <node> <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2J(ckt, tab, current);
|
||||
break;
|
||||
case 'Z': /* Zname <node> <node> <node> <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2Z(ckt, tab, current);
|
||||
break;
|
||||
case 'M': /* Mname <node> <node> <node> <node> <model> [L=<val>]
|
||||
* [W=<val>] [AD=<val>] [AS=<val>] [PD=<val>]
|
||||
* [PS=<val>] [NRD=<val>] [NRS=<val>] [OFF]
|
||||
* [IC=<val>,<val>,<val>] */
|
||||
INP2M(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'Q': /* Qname <node> <node> <node> [<node>] <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2Q(ckt,tab,current,gnode);
|
||||
break;
|
||||
case 'O': /* Oname <node> <node> <node> <node> <model>
|
||||
* [IC=<val>,<val>,<val>,<val>] */
|
||||
INP2O(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'T': /* Tname <node> <node> <node> <node> [TD=<val>]
|
||||
* [F=<val> [NL=<val>]][IC=<val>,<val>,<val>,<val>] */
|
||||
INP2T(ckt,tab,current);
|
||||
break;
|
||||
case 'V': /* Vname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
INP2V(ckt, tab, current);
|
||||
break;
|
||||
case 'I': /* Iname <node> <node> [ [DC] <val>] [AC [<val> [<val> ] ] ]
|
||||
* [<tran function>] */
|
||||
INP2I(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'S': /* Sname <node> <node> <node> <node> [<modname>] [IC] */
|
||||
INP2S(ckt,tab,current);
|
||||
break;
|
||||
case 'Q': /* Qname <node> <node> <node> [<node>] <model> [<val>] [OFF]
|
||||
* [IC=<val>,<val>] */
|
||||
INP2Q(ckt, tab, current, gnode);
|
||||
break;
|
||||
|
||||
case 'W': /* Wname <node> <node> <vctrl> [<modname>] [IC] */
|
||||
/* CURRENT CONTROLLED SWITCH */
|
||||
INP2W(ckt,tab,current);
|
||||
break;
|
||||
case 'T': /* Tname <node> <node> <node> <node> [TD=<val>]
|
||||
* [F=<val> [NL=<val>]][IC=<val>,<val>,<val>,<val>] */
|
||||
INP2T(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'U': /* Uname <node> <node> <model> [l=<val>] [n=<val>] */
|
||||
INP2U(ckt,tab,current);
|
||||
break;
|
||||
case 'S': /* Sname <node> <node> <node> <node> [<modname>] [IC] */
|
||||
INP2S(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'K': /* Kname Lname Lname <val> */
|
||||
INP2K(ckt,tab,current);
|
||||
break;
|
||||
case 'W': /* Wname <node> <node> <vctrl> [<modname>] [IC] */
|
||||
/* CURRENT CONTROLLED SWITCH */
|
||||
INP2W(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case '*': /* *<anything> - a comment - ignore */
|
||||
break;
|
||||
case 'U': /* Uname <node> <node> <model> [l=<val>] [n=<val>] */
|
||||
INP2U(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case 'B': /* Bname <node> <node> [V=expr] [I=expr] */
|
||||
/* Arbitrary source. */
|
||||
INP2B(ckt,tab,current);
|
||||
break;
|
||||
case 'K': /* Kname Lname Lname <val> */
|
||||
INP2K(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case '.': /* .<something> Many possibilities */
|
||||
if (INP2dot(ckt,tab,current,task,gnode)) goto end;
|
||||
break;
|
||||
case '*': /* *<anything> - a comment - ignore */
|
||||
break;
|
||||
|
||||
case 'B': /* Bname <node> <node> [V=expr] [I=expr] */
|
||||
/* Arbitrary source. */
|
||||
INP2B(ckt, tab, current);
|
||||
break;
|
||||
|
||||
case '.': /* .<something> Many possibilities */
|
||||
if (INP2dot(ckt, tab, current, task, gnode))
|
||||
goto end;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
/* the un-implemented device */
|
||||
LITERR(" unknown device type - error \n")
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* the un-implemented device */
|
||||
LITERR(" unknown device type - error \n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
end:
|
||||
end:
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,29 +17,32 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "iferrmsg.h"
|
||||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPpName(char *parm, IFvalue *val, void *ckt, int dev, void *fast)
|
||||
/* the name of the parameter to set */
|
||||
/* the parameter union containing the value to set */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* direct pointer to device being parsed */
|
||||
|
||||
int INPpName(char *parm, IFvalue * val, void *ckt, int dev, void *fast)
|
||||
/* the name of the parameter to set */
|
||||
/* the parameter union containing the value to set */
|
||||
/* the circuit this device is a member of */
|
||||
/* the device type code to the device being parsed */
|
||||
/* direct pointer to device being parsed */
|
||||
{
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
int error; /* int to store evaluate error return codes in */
|
||||
int i;
|
||||
|
||||
for(i=0;i<(*(*(ft_sim->devices)[dev]).numInstanceParms);i++) {
|
||||
if(strcmp(parm,
|
||||
((*(ft_sim->devices)[dev]).instanceParms[i].keyword))==0) {
|
||||
error = (*(ft_sim->setInstanceParm))(ckt,fast, (*(ft_sim->
|
||||
devices)[dev]).instanceParms[i].id,val,(IFvalue*)NULL);
|
||||
if(error) return(error);
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < (*(*(ft_sim->devices)[dev]).numInstanceParms); i++) {
|
||||
if (strcmp(parm,
|
||||
((*(ft_sim->devices)[dev]).instanceParms[i].keyword)) ==
|
||||
0) {
|
||||
error =
|
||||
(*(ft_sim->setInstanceParm)) (ckt, fast,
|
||||
(*(ft_sim->devices)[dev]).
|
||||
instanceParms[i].id, val,
|
||||
(IFvalue *) NULL);
|
||||
if (error)
|
||||
return (error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i==(*(*(ft_sim->devices)[dev]).numInstanceParms)) {
|
||||
return(E_BADPARM);
|
||||
if (i == (*(*(ft_sim->devices)[dev]).numInstanceParms)) {
|
||||
return (E_BADPARM);
|
||||
}
|
||||
return(OK);
|
||||
return (OK);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -10,7 +10,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
/* MW. Special INPinsertNofree for routines from spiceif.c and outif.c */
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h> /* Take this out soon. */
|
||||
#include <stdio.h> /* Take this out soon. */
|
||||
#include "ifsim.h"
|
||||
#include "iferrmsg.h"
|
||||
#include "inpdefs.h"
|
||||
|
|
@ -23,52 +23,55 @@ static int hash(char *name, int tsize);
|
|||
|
||||
/* Initialize the symbol tables. */
|
||||
|
||||
INPtables *
|
||||
INPtabInit(int numlines)
|
||||
INPtables *INPtabInit(int numlines)
|
||||
{
|
||||
INPtables *tab;
|
||||
|
||||
tab = (INPtables *)tmalloc(sizeof(INPtables));
|
||||
tab->INPsymtab = (struct INPtab **) tmalloc((numlines / 4 + 1) *
|
||||
sizeof (struct INPtab *));
|
||||
ZERO(tab->INPsymtab, (numlines / 4 + 1) * sizeof (struct INPtab *));
|
||||
tab->INPtermsymtab = (struct INPnTab **) tmalloc(numlines *
|
||||
sizeof (struct INPnTab *));
|
||||
ZERO(tab->INPtermsymtab, numlines * sizeof (struct INPnTab *));
|
||||
tab = (INPtables *) tmalloc(sizeof(INPtables));
|
||||
tab->INPsymtab = (struct INPtab **) tmalloc((numlines / 4 + 1) *
|
||||
sizeof(struct INPtab *));
|
||||
ZERO(tab->INPsymtab, (numlines / 4 + 1) * sizeof(struct INPtab *));
|
||||
tab->INPtermsymtab = (struct INPnTab **) tmalloc(numlines *
|
||||
sizeof(struct INPnTab
|
||||
*));
|
||||
ZERO(tab->INPtermsymtab, numlines * sizeof(struct INPnTab *));
|
||||
tab->INPsize = numlines / 4 + 1;
|
||||
tab->INPtermsize = numlines;
|
||||
return(tab);
|
||||
return (tab);
|
||||
}
|
||||
|
||||
/* insert 'token' into the terminal symbol table */
|
||||
/* create a NEW NODE and return a pointer to it in *node */
|
||||
|
||||
int
|
||||
INPtermInsert(void *ckt, char **token, INPtables *tab, void **node)
|
||||
int INPtermInsert(void *ckt, char **token, INPtables * tab, void **node)
|
||||
{
|
||||
int key;
|
||||
int error;
|
||||
struct INPnTab *t;
|
||||
int key;
|
||||
int error;
|
||||
struct INPnTab *t;
|
||||
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if(node) *node = t->t_node;
|
||||
return(E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof (struct INPnTab));
|
||||
if(t == (struct INPnTab*)NULL) return(E_NOMEM);
|
||||
ZERO(t,struct INPnTab);
|
||||
error = (*(ft_sim->newNode))(ckt,&t->t_node,*token);
|
||||
if(error) return(error);
|
||||
if(node) *node = t->t_node;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return(OK);
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if (node)
|
||||
*node = t->t_node;
|
||||
return (E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof(struct INPnTab));
|
||||
if (t == (struct INPnTab *) NULL)
|
||||
return (E_NOMEM);
|
||||
ZERO(t, struct INPnTab);
|
||||
error = (*(ft_sim->newNode)) (ckt, &t->t_node, *token);
|
||||
if (error)
|
||||
return (error);
|
||||
if (node)
|
||||
*node = t->t_node;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -76,205 +79,203 @@ INPtermInsert(void *ckt, char **token, INPtables *tab, void **node)
|
|||
/* USE node as the node pointer */
|
||||
|
||||
|
||||
int
|
||||
INPmkTerm(void *ckt, char **token, INPtables *tab, void **node)
|
||||
int INPmkTerm(void *ckt, char **token, INPtables * tab, void **node)
|
||||
{
|
||||
int key;
|
||||
struct INPnTab *t;
|
||||
int key;
|
||||
struct INPnTab *t;
|
||||
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if(node) *node = t->t_node;
|
||||
return(E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof (struct INPnTab));
|
||||
if(t == (struct INPnTab*)NULL) return(E_NOMEM);
|
||||
ZERO(t,struct INPnTab);
|
||||
t->t_node = *node ;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return(OK);
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if (node)
|
||||
*node = t->t_node;
|
||||
return (E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof(struct INPnTab));
|
||||
if (t == (struct INPnTab *) NULL)
|
||||
return (E_NOMEM);
|
||||
ZERO(t, struct INPnTab);
|
||||
t->t_node = *node;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* insert 'token' into the terminal symbol table as a name for ground*/
|
||||
|
||||
int
|
||||
INPgndInsert(void *ckt, char **token, INPtables *tab, void **node)
|
||||
int INPgndInsert(void *ckt, char **token, INPtables * tab, void **node)
|
||||
{
|
||||
int key;
|
||||
int error;
|
||||
struct INPnTab *t;
|
||||
int key;
|
||||
int error;
|
||||
struct INPnTab *t;
|
||||
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if(node) *node = t->t_node;
|
||||
return(E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof (struct INPnTab));
|
||||
if(t == (struct INPnTab*)NULL) return(E_NOMEM);
|
||||
ZERO(t,struct INPnTab);
|
||||
error = (*(ft_sim->groundNode))(ckt,&t->t_node,*token);
|
||||
if(error) return(error);
|
||||
if(node) *node = t->t_node;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return(OK);
|
||||
key = hash(*token, tab->INPtermsize);
|
||||
for (t = tab->INPtermsymtab[key]; t; t = t->t_next) {
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
if (node)
|
||||
*node = t->t_node;
|
||||
return (E_EXISTS);
|
||||
}
|
||||
}
|
||||
t = (struct INPnTab *) tmalloc(sizeof(struct INPnTab));
|
||||
if (t == (struct INPnTab *) NULL)
|
||||
return (E_NOMEM);
|
||||
ZERO(t, struct INPnTab);
|
||||
error = (*(ft_sim->groundNode)) (ckt, &t->t_node, *token);
|
||||
if (error)
|
||||
return (error);
|
||||
if (node)
|
||||
*node = t->t_node;
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPtermsymtab[key];
|
||||
tab->INPtermsymtab[key] = t;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* retrieve 'token' from the symbol table */
|
||||
|
||||
int
|
||||
INPretrieve(char **token, INPtables *tab)
|
||||
int INPretrieve(char **token, INPtables * tab)
|
||||
{
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
*token = t->t_ent;
|
||||
return(OK);
|
||||
}
|
||||
return(E_BADPARM);
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
*token = t->t_ent;
|
||||
return (OK);
|
||||
}
|
||||
return (E_BADPARM);
|
||||
}
|
||||
|
||||
|
||||
/* insert 'token' into the symbol table */
|
||||
|
||||
int
|
||||
INPinsert(char **token, INPtables *tab)
|
||||
int INPinsert(char **token, INPtables * tab)
|
||||
{
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
return(E_EXISTS);
|
||||
}
|
||||
t = (struct INPtab *) tmalloc(sizeof (struct INPtab));
|
||||
if(t == (struct INPtab*)NULL) return(E_NOMEM);
|
||||
ZERO(t,struct INPtab);
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPsymtab[key];
|
||||
tab->INPsymtab[key] = t;
|
||||
return(OK);
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
FREE(*token);
|
||||
*token = t->t_ent;
|
||||
return (E_EXISTS);
|
||||
}
|
||||
t = (struct INPtab *) tmalloc(sizeof(struct INPtab));
|
||||
if (t == (struct INPtab *) NULL)
|
||||
return (E_NOMEM);
|
||||
ZERO(t, struct INPtab);
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPsymtab[key];
|
||||
tab->INPsymtab[key] = t;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
/* MW. insert 'token' into the symbol table but no free() token pointer.
|
||||
* Calling routine should take care for this */
|
||||
|
||||
int
|
||||
INPinsertNofree(char **token, INPtables *tab)
|
||||
int INPinsertNofree(char **token, INPtables * tab)
|
||||
{
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
struct INPtab *t;
|
||||
int key;
|
||||
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
|
||||
/* MW. We can't touch memory pointed by token now */
|
||||
*token = t->t_ent;
|
||||
return(E_EXISTS);
|
||||
}
|
||||
t = (struct INPtab *) tmalloc(sizeof (struct INPtab));
|
||||
if(t == (struct INPtab*)NULL) return(E_NOMEM);
|
||||
ZERO(t,struct INPtab);
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPsymtab[key];
|
||||
tab->INPsymtab[key] = t;
|
||||
return(OK);
|
||||
key = hash(*token, tab->INPsize);
|
||||
for (t = tab->INPsymtab[key]; t; t = t->t_next)
|
||||
if (!strcmp(*token, t->t_ent)) {
|
||||
|
||||
/* MW. We can't touch memory pointed by token now */
|
||||
*token = t->t_ent;
|
||||
return (E_EXISTS);
|
||||
}
|
||||
t = (struct INPtab *) tmalloc(sizeof(struct INPtab));
|
||||
if (t == (struct INPtab *) NULL)
|
||||
return (E_NOMEM);
|
||||
ZERO(t, struct INPtab);
|
||||
t->t_ent = *token;
|
||||
t->t_next = tab->INPsymtab[key];
|
||||
tab->INPsymtab[key] = t;
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* remove 'token' from the symbol table */
|
||||
int
|
||||
INPremove(char *token, INPtables *tab)
|
||||
int INPremove(char *token, INPtables * tab)
|
||||
{
|
||||
struct INPtab *t, **prevp;
|
||||
int key;
|
||||
|
||||
key = hash(token, tab->INPsize);
|
||||
prevp = &tab->INPsymtab[key];
|
||||
for (t = *prevp; t && token != t->t_ent; t = t->t_next)
|
||||
prevp = &t->t_next;
|
||||
if (!t)
|
||||
return OK;
|
||||
|
||||
*prevp = t->t_next;
|
||||
tfree(t->t_ent);
|
||||
tfree(t);
|
||||
struct INPtab *t, **prevp;
|
||||
int key;
|
||||
|
||||
key = hash(token, tab->INPsize);
|
||||
prevp = &tab->INPsymtab[key];
|
||||
for (t = *prevp; t && token != t->t_ent; t = t->t_next)
|
||||
prevp = &t->t_next;
|
||||
if (!t)
|
||||
return OK;
|
||||
|
||||
*prevp = t->t_next;
|
||||
tfree(t->t_ent);
|
||||
tfree(t);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* remove 'token' from the symbol table */
|
||||
int
|
||||
INPremTerm(char *token, INPtables *tab)
|
||||
int INPremTerm(char *token, INPtables * tab)
|
||||
{
|
||||
struct INPnTab *t, **prevp;
|
||||
int key;
|
||||
|
||||
key = hash(token, tab->INPtermsize);
|
||||
prevp = &tab->INPtermsymtab[key];
|
||||
for (t = *prevp; t && token != t->t_ent; t = t->t_next)
|
||||
prevp = &t->t_next;
|
||||
if (!t)
|
||||
return OK;
|
||||
|
||||
*prevp = t->t_next;
|
||||
tfree(t->t_ent);
|
||||
tfree(t);
|
||||
struct INPnTab *t, **prevp;
|
||||
int key;
|
||||
|
||||
key = hash(token, tab->INPtermsize);
|
||||
prevp = &tab->INPtermsymtab[key];
|
||||
for (t = *prevp; t && token != t->t_ent; t = t->t_next)
|
||||
prevp = &t->t_next;
|
||||
if (!t)
|
||||
return OK;
|
||||
|
||||
*prevp = t->t_next;
|
||||
tfree(t->t_ent);
|
||||
tfree(t);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Free the space used by the symbol tables. */
|
||||
|
||||
void
|
||||
INPtabEnd(INPtables *tab)
|
||||
void INPtabEnd(INPtables * tab)
|
||||
{
|
||||
struct INPtab *t, *lt;
|
||||
struct INPnTab *n, *ln;
|
||||
int i;
|
||||
struct INPtab *t, *lt;
|
||||
struct INPnTab *n, *ln;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tab->INPsize; i++)
|
||||
for (t = tab->INPsymtab[i]; t; t = lt) {
|
||||
lt = t->t_next;
|
||||
FREE(t); /* But not t_ent ! */
|
||||
}
|
||||
FREE(tab->INPsymtab);
|
||||
for (i = 0; i < tab->INPtermsize; i++)
|
||||
for (n = tab->INPtermsymtab[i]; n; n = ln) {
|
||||
ln = n->t_next;
|
||||
FREE(n); /* But not t_ent ! */
|
||||
}
|
||||
FREE(tab->INPtermsymtab);
|
||||
FREE(tab);
|
||||
return;
|
||||
for (i = 0; i < tab->INPsize; i++)
|
||||
for (t = tab->INPsymtab[i]; t; t = lt) {
|
||||
lt = t->t_next;
|
||||
FREE(t); /* But not t_ent ! */
|
||||
}
|
||||
FREE(tab->INPsymtab);
|
||||
for (i = 0; i < tab->INPtermsize; i++)
|
||||
for (n = tab->INPtermsymtab[i]; n; n = ln) {
|
||||
ln = n->t_next;
|
||||
FREE(n); /* But not t_ent ! */
|
||||
}
|
||||
FREE(tab->INPtermsymtab);
|
||||
FREE(tab);
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
hash(char *name, int tsize)
|
||||
static int hash(char *name, int tsize)
|
||||
{
|
||||
char *s;
|
||||
register int i = 0;
|
||||
char *s;
|
||||
register int i = 0;
|
||||
|
||||
for (s = name; *s; s++)
|
||||
i += *s;
|
||||
return (i % tsize);
|
||||
for (s = name; *s; s++)
|
||||
i += *s;
|
||||
return (i % tsize);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,15 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "ifsim.h"
|
||||
#include "inp.h"
|
||||
|
||||
int
|
||||
INPtypelook(char *type)
|
||||
int INPtypelook(char *type)
|
||||
{
|
||||
|
||||
int i;
|
||||
for(i = 0; i < ft_sim->numDevices; i++) {
|
||||
if(strcmp(type, (*(ft_sim->devices)[i]).name) == 0) {
|
||||
/*found the device - return it */
|
||||
return i;
|
||||
}
|
||||
for (i = 0; i < ft_sim->numDevices; i++) {
|
||||
if (strcmp(type, (*(ft_sim->devices)[i]).name) == 0) {
|
||||
/*found the device - return it */
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,44 +21,38 @@ Author: 1987 Wayne A. Christopher, U. C. Berkeley CAD Group
|
|||
|
||||
#ifndef HAVE_ATANH
|
||||
extern double asinh(), acosh(), atanh();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
double PTfudge_factor;
|
||||
|
||||
#define MODULUS(NUM,LIMIT) ((NUM) - ((int) ((NUM) / (LIMIT))) * (LIMIT))
|
||||
|
||||
double
|
||||
PTabs(double arg)
|
||||
double PTabs(double arg)
|
||||
{
|
||||
return arg >= 0.0 ? arg : -arg;
|
||||
}
|
||||
|
||||
double
|
||||
PTsgn(double arg)
|
||||
double PTsgn(double arg)
|
||||
{
|
||||
return arg > 0.0 ? 1.0 : arg < 0.0 ? -1.0 : 0.0;
|
||||
}
|
||||
|
||||
double
|
||||
PTplus(double arg1, double arg2)
|
||||
double PTplus(double arg1, double arg2)
|
||||
{
|
||||
return (arg1 + arg2);
|
||||
}
|
||||
|
||||
double
|
||||
PTminus(double arg1, double arg2)
|
||||
double PTminus(double arg1, double arg2)
|
||||
{
|
||||
return (arg1 - arg2);
|
||||
}
|
||||
|
||||
double
|
||||
PTtimes(double arg1, double arg2)
|
||||
double PTtimes(double arg1, double arg2)
|
||||
{
|
||||
return (arg1 * arg2);
|
||||
}
|
||||
|
||||
double
|
||||
PTdivide(double arg1, double arg2)
|
||||
double PTdivide(double arg1, double arg2)
|
||||
{
|
||||
if (arg2 >= 0.0)
|
||||
arg2 += PTfudge_factor;
|
||||
|
|
@ -66,13 +60,12 @@ PTdivide(double arg1, double arg2)
|
|||
arg2 -= PTfudge_factor;
|
||||
|
||||
if (arg2 == 0.0)
|
||||
return (HUGE);
|
||||
return (HUGE);
|
||||
|
||||
return (arg1 / arg2);
|
||||
}
|
||||
|
||||
double
|
||||
PTpower(double arg1, double arg2)
|
||||
double PTpower(double arg1, double arg2)
|
||||
{
|
||||
if (arg1 < 0.0) {
|
||||
if (fabs(arg2 - ((int) arg2)) / (arg2 + 0.001) < 0.000001) {
|
||||
|
|
@ -84,48 +77,42 @@ PTpower(double arg1, double arg2)
|
|||
return (pow(arg1, arg2));
|
||||
}
|
||||
|
||||
double
|
||||
PTacos(double arg)
|
||||
double PTacos(double arg)
|
||||
{
|
||||
return (acos(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTacosh(double arg)
|
||||
double PTacosh(double arg)
|
||||
{
|
||||
#ifdef HAVE_ACOSH
|
||||
return (acosh(arg));
|
||||
#else
|
||||
if (arg < 1.0)
|
||||
arg = 1.0;
|
||||
return (log(arg + sqrt(arg*arg-1.0)));
|
||||
#endif
|
||||
return (log(arg + sqrt(arg * arg - 1.0)));
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
PTasin(double arg)
|
||||
double PTasin(double arg)
|
||||
{
|
||||
return (asin(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTasinh(double arg)
|
||||
double PTasinh(double arg)
|
||||
{
|
||||
#ifdef HAVE_ASINH
|
||||
return (asinh(arg));
|
||||
#else
|
||||
return log(arg + sqrt(arg * arg + 1.0));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
PTatan(double arg)
|
||||
double PTatan(double arg)
|
||||
{
|
||||
return (atan(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTatanh(double arg)
|
||||
double PTatanh(double arg)
|
||||
{
|
||||
#ifdef HAVE_ATANH
|
||||
return (atanh(arg));
|
||||
|
|
@ -135,22 +122,20 @@ PTatanh(double arg)
|
|||
else if (arg > 1.0)
|
||||
arg = 1.0 - PTfudge_factor - 1e-10;
|
||||
return (log((1.0 + arg) / (1.0 - arg)) / 2.0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
PTustep(double arg)
|
||||
double PTustep(double arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
return 0.0;
|
||||
else if (arg > 0.0)
|
||||
return 1.0;
|
||||
else
|
||||
return 0.5; /* Ick! */
|
||||
return 0.5; /* Ick! */
|
||||
}
|
||||
|
||||
double
|
||||
PTuramp(double arg)
|
||||
double PTuramp(double arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
return 0.0;
|
||||
|
|
@ -158,87 +143,75 @@ PTuramp(double arg)
|
|||
return arg;
|
||||
}
|
||||
|
||||
double
|
||||
PTcos(double arg)
|
||||
double PTcos(double arg)
|
||||
{
|
||||
return (cos(MODULUS(arg, 2 * M_PI)));
|
||||
}
|
||||
|
||||
double
|
||||
PTcosh(double arg)
|
||||
double PTcosh(double arg)
|
||||
{
|
||||
return (cosh(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTexp(double arg)
|
||||
double PTexp(double arg)
|
||||
{
|
||||
return (exp(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTln(double arg)
|
||||
double PTln(double arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
#ifdef EXPERIMENTAL_CODE
|
||||
return (HUGE);
|
||||
#else
|
||||
return (HUGE);
|
||||
#else
|
||||
arg = -arg;
|
||||
#endif
|
||||
return (log(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTlog(double arg)
|
||||
double PTlog(double arg)
|
||||
{
|
||||
if (arg <= 0.0)
|
||||
#ifdef EXPERIMENTAL_CODE
|
||||
return (HUGE);
|
||||
#else
|
||||
return (HUGE);
|
||||
#else
|
||||
arg = -arg;
|
||||
#endif
|
||||
return (log10(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTsin(double arg)
|
||||
double PTsin(double arg)
|
||||
{
|
||||
return (sin(MODULUS(arg, 2 * M_PI)));
|
||||
}
|
||||
|
||||
double
|
||||
PTsinh(double arg)
|
||||
double PTsinh(double arg)
|
||||
{
|
||||
return (sinh(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTsqrt(double arg)
|
||||
double PTsqrt(double arg)
|
||||
{
|
||||
if (arg < 0.0)
|
||||
#ifdef EXPERIMENTAL_CODE
|
||||
return (HUGE);
|
||||
return (HUGE);
|
||||
#else
|
||||
arg = -arg;
|
||||
#endif
|
||||
return (sqrt(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTtan(double arg)
|
||||
double PTtan(double arg)
|
||||
{
|
||||
return (tan(MODULUS(arg, M_PI)));
|
||||
}
|
||||
|
||||
double
|
||||
PTtanh(double arg)
|
||||
double PTtanh(double arg)
|
||||
{
|
||||
return (tanh(arg));
|
||||
}
|
||||
|
||||
double
|
||||
PTuminus(double arg)
|
||||
double PTuminus(double arg)
|
||||
{
|
||||
return (- arg);
|
||||
return (-arg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,119 +15,105 @@ Author: 1985 Thomas L. Quarles
|
|||
#include "ifsim.h"
|
||||
#include "inp.h"
|
||||
|
||||
#define MSG(a) \
|
||||
msg = a; \
|
||||
break;
|
||||
|
||||
static char *unknownError = "Unknown error code";
|
||||
static char *Pause = "Pause requested";
|
||||
static char *intern = "Impossible error - can't occur";
|
||||
static char *exists = "Device already exists, existing one being used";
|
||||
static char *nodev = "No such device";
|
||||
static char *noterm = "No such terminal on this device";
|
||||
static char *nomod = "No such model";
|
||||
static char *badparm = "No such parameter on this device";
|
||||
static char *nomem = "Out of Memory";
|
||||
static char *nodecon = "Node already connected; connection replaced";
|
||||
static char *unsupp = "operation not supported";
|
||||
static char *parmval = "parameter value out of range or the wrong type";
|
||||
static char *badmatrix = "Matrix can't be decomposed as is";
|
||||
static char *singular = "Matrix is singular";
|
||||
static char *iterlim = "Iteration limit reached";
|
||||
static char *order = "Unsupported integration order";
|
||||
static char *method = "Unsupported integration method";
|
||||
static char *timestep = "Timestep too small";
|
||||
static char *xmission = "transmission lines not supported by pole-zero";
|
||||
static char *toobig = "magnitude overflow";
|
||||
static char *isshort = "input or output shorted";
|
||||
static char *inisout = "transfer function is 1";
|
||||
static char *nodisto = "Distortion analysis not present";
|
||||
static char *nonoise = "Noise analysis not present";
|
||||
static char *noacinput = "AC input not found";
|
||||
static char *noanal = "No such analysis type";
|
||||
static char *nochange = "Unsupported action; no change made";
|
||||
static char *notfound = "Not found";
|
||||
static char *nof2src = "No F2 source for IM disto analysis";
|
||||
#ifdef PARALLEL_ARCH
|
||||
static char *multierr = "Multiple errors detected by parallel machine";
|
||||
#endif /* PARALLEL_ARCH */
|
||||
|
||||
char *
|
||||
SPerror(int type)
|
||||
const char *SPerror(int type)
|
||||
{
|
||||
char *val;
|
||||
char *msg;
|
||||
|
||||
switch(type) {
|
||||
default:
|
||||
MSG(unknownError)
|
||||
case E_PAUSE:
|
||||
MSG(Pause)
|
||||
case OK:
|
||||
return(NULL);
|
||||
case E_INTERN:
|
||||
MSG(intern)
|
||||
case E_EXISTS:
|
||||
MSG(exists)
|
||||
case E_NODEV:
|
||||
MSG(nodev)
|
||||
case E_NOMOD:
|
||||
MSG(nomod)
|
||||
case E_NOTERM:
|
||||
MSG(noterm)
|
||||
case E_BADPARM:
|
||||
MSG(badparm)
|
||||
case E_NOMEM:
|
||||
MSG(nomem)
|
||||
case E_NODECON:
|
||||
MSG(nodecon)
|
||||
case E_UNSUPP:
|
||||
MSG(unsupp)
|
||||
case E_PARMVAL:
|
||||
MSG(parmval)
|
||||
case E_BADMATRIX:
|
||||
MSG(badmatrix)
|
||||
case E_SINGULAR:
|
||||
MSG(singular)
|
||||
case E_ITERLIM:
|
||||
MSG(iterlim)
|
||||
case E_ORDER:
|
||||
MSG(order)
|
||||
case E_METHOD:
|
||||
MSG(method)
|
||||
case E_TIMESTEP:
|
||||
MSG(timestep)
|
||||
case E_XMISSIONLINE:
|
||||
MSG(xmission)
|
||||
case E_MAGEXCEEDED:
|
||||
MSG(toobig)
|
||||
case E_SHORT:
|
||||
MSG(isshort)
|
||||
case E_INISOUT:
|
||||
MSG(inisout)
|
||||
case E_NODISTO:
|
||||
MSG(nodisto)
|
||||
case E_NONOISE:
|
||||
MSG(nonoise)
|
||||
case E_NOANAL:
|
||||
MSG(noanal)
|
||||
case E_NOCHANGE:
|
||||
MSG(nochange)
|
||||
case E_NOTFOUND:
|
||||
MSG(notfound)
|
||||
case E_NOACINPUT:
|
||||
MSG(noacinput)
|
||||
case E_NOF2SRC:
|
||||
MSG(nof2src)
|
||||
switch (type) {
|
||||
case E_PAUSE:
|
||||
msg = "pause requested";
|
||||
break;
|
||||
case E_INTERN:
|
||||
msg = "impossible error - can't occur";
|
||||
break;
|
||||
case E_EXISTS:
|
||||
msg = "device already exists, existing one being used";
|
||||
break;
|
||||
case E_NODEV:
|
||||
msg = "no such device";
|
||||
break;
|
||||
case E_NOMOD:
|
||||
msg = "no such model";
|
||||
break;
|
||||
case E_NOTERM:
|
||||
msg = "no such terminal on this device";
|
||||
break;
|
||||
case E_BADPARM:
|
||||
msg = "no such parameter on this device";
|
||||
break;
|
||||
case E_NOMEM:
|
||||
msg = "out of memory";
|
||||
break;
|
||||
case E_NODECON:
|
||||
msg = "node already connected; connection replaced";
|
||||
break;
|
||||
case E_UNSUPP:
|
||||
msg = "operation not supported";
|
||||
break;
|
||||
case E_PARMVAL:
|
||||
msg = "parameter value out of range or the wrong type";
|
||||
break;
|
||||
case E_BADMATRIX:
|
||||
msg = "matrix can't be decomposed as is";
|
||||
break;
|
||||
case E_SINGULAR:
|
||||
msg = "matrix is singular";
|
||||
break;
|
||||
case E_ITERLIM:
|
||||
msg = "iteration limit reached";
|
||||
break;
|
||||
case E_ORDER:
|
||||
msg = "unsupported integration order";
|
||||
break;
|
||||
case E_METHOD:
|
||||
msg = "unsupported integration method";
|
||||
break;
|
||||
case E_TIMESTEP:
|
||||
msg = "timestep too small";
|
||||
break;
|
||||
case E_XMISSIONLINE:
|
||||
msg = "transmission lines not supported by pole-zero";
|
||||
break;
|
||||
case E_MAGEXCEEDED:
|
||||
msg = "magnitude overflow";
|
||||
break;
|
||||
case E_SHORT:
|
||||
msg = "input or output shorted";
|
||||
break;
|
||||
case E_INISOUT:
|
||||
msg = "transfer function is 1";
|
||||
break;
|
||||
case E_NODISTO:
|
||||
msg = "distortion analysis not present";
|
||||
break;
|
||||
case E_NONOISE:
|
||||
msg = "noise analysis not present";
|
||||
break;
|
||||
case E_NOANAL:
|
||||
msg = "no such analysis type";
|
||||
break;
|
||||
case E_NOCHANGE:
|
||||
msg = "unsupported action; no change made";
|
||||
break;
|
||||
case E_NOTFOUND:
|
||||
msg = "not found";
|
||||
break;
|
||||
case E_NOACINPUT:
|
||||
msg = "ac input not found";
|
||||
break;
|
||||
case E_NOF2SRC:
|
||||
msg = "no F2 source for IM disto analysis";
|
||||
break;
|
||||
#ifdef PARALLEL_ARCH
|
||||
case E_MULTIERR:
|
||||
MSG(multierr)
|
||||
case E_MULTIERR:
|
||||
msg = "Multiple errors detected by parallel machine";
|
||||
break;
|
||||
#endif /* PARALLEL_ARCH */
|
||||
case OK:
|
||||
return (NULL);
|
||||
default:
|
||||
msg = "Unknown error code";
|
||||
}
|
||||
|
||||
val = MALLOC(strlen(msg) + 1);
|
||||
if (val) {
|
||||
(void) strcpy(val, msg);
|
||||
}
|
||||
return(val);
|
||||
return msg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue