K&R function definitions and GENmodel and GENinstance usage for the NDEV device

This commit is contained in:
rlar 2010-07-24 17:40:26 +00:00
parent 62afa50a1c
commit 689c7662f8
13 changed files with 60 additions and 45 deletions

View File

@ -1,3 +1,19 @@
2010-07-24 Robert Larice
* src/include/inpdefs.h ,
* src/spicelib/devices/ndev/ndevacld.c ,
* src/spicelib/devices/ndev/ndevask.c ,
* src/spicelib/devices/ndev/ndevdel.c ,
* src/spicelib/devices/ndev/ndevdump.c ,
* src/spicelib/devices/ndev/ndevmdel.c ,
* src/spicelib/devices/ndev/ndevparm.c ,
* src/spicelib/devices/ndev/ndevpzld.c ,
* src/spicelib/devices/ndev/ndevset.c ,
* src/spicelib/devices/ndev/ndevtemp.c ,
* src/spicelib/devices/ndev/ndevtrun.c ,
* src/spicelib/parser/inp2n.c :
convert K&R function definitions to ansi style
use the GENmodel and GENinstance type instead of void*
2010-07-24 Robert Larice
fix dangerous things, potential bugs, at least for big endian machines
* src/frontend/inp.c ,
@ -6,7 +22,7 @@
should fail on a big endian machine
* src/frontend/spiceif.c ,
the value of an union, made of a bool (unsigned char), an int, etc,
is silently cast into an int.
is silently cast into an int.
This can introduce stack noise, in the CP_BOOL case
* src/frontend/variable.c :
a `variable' is created with type CP_NUM,

View File

@ -132,6 +132,7 @@ void INP2J(CKTcircuit *, INPtables *, card *);
void INP2K(CKTcircuit *, INPtables *, card *);
void INP2L(CKTcircuit *, INPtables *, card *);
void INP2M(CKTcircuit *, INPtables *, card *);
void INP2N(CKTcircuit *, INPtables *, card *);
void INP2O(CKTcircuit *, INPtables *, card *);
void INP2P(CKTcircuit *, INPtables *, card *);
void INP2Q(CKTcircuit *, INPtables *, card *, void *);

View File

@ -17,9 +17,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
int
NDEVacLoad(inModel, ckt)
GENmodel *inModel;
CKTcircuit *ckt;
NDEVacLoad(GENmodel *inModel, CKTcircuit *ckt)
{
return (OK);

View File

@ -16,12 +16,12 @@ Author: 1987 Thomas L. Quarles
/* ARGSUSED */
int
NDEVask(ckt, inInst, which, value, select)
CKTcircuit *ckt;
GENinstance *inInst;
int which;
IFvalue *value;
IFvalue *select;
NDEVask(
CKTcircuit *ckt,
GENinstance *inInst,
int which,
IFvalue *value,
IFvalue *select )
{
return (OK);
/* NOTREACHED */

View File

@ -10,10 +10,10 @@ University of Science and Technology of China
#include "suffix.h"
int
NDEVdelete(inModel, name, kill)
GENmodel *inModel;
IFuid name;
GENinstance **kill;
NDEVdelete(
GENmodel *inModel,
IFuid name,
GENinstance **kill )
{
NDEVmodel *model = (NDEVmodel *)inModel;

View File

@ -21,9 +21,9 @@ static int state_numDC = 0;
static int state_numTR = 0;
void
NDEV_dump(inModel, ckt)
GENmodel *inModel;
CKTcircuit *ckt;
NDEV_dump(
GENmodel *inModel,
CKTcircuit *ckt )
{
}
@ -31,10 +31,10 @@ NDEV_dump(inModel, ckt)
void
NDEV_acct(inModel, ckt, file)
GENmodel *inModel;
CKTcircuit *ckt;
FILE *file;
NDEV_acct(
GENmodel *inModel,
CKTcircuit *ckt,
FILE *file )
{
}

View File

@ -9,10 +9,10 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "suffix.h"
int
NDEVmDelete(inModel, modname, kill)
GENmodel **inModel;
IFuid modname;
GENmodel *kill;
NDEVmDelete(
GENmodel **inModel,
IFuid modname,
GENmodel *kill )
{

View File

@ -11,11 +11,11 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "suffix.h"
int
NDEVparam(param, value, inInst, select)
int param;
IFvalue *value;
GENinstance *inInst;
IFvalue *select;
NDEVparam(
int param,
IFvalue *value,
GENinstance *inInst,
IFvalue *select )
{
NDEVinstance *inst = (NDEVinstance *) inInst;
switch (param) {

View File

@ -12,10 +12,10 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
int
NDEVpzLoad(inModel, ckt, s)
GENmodel *inModel;
register CKTcircuit *ckt;
SPcomplex *s;
NDEVpzLoad(
GENmodel *inModel,
register CKTcircuit *ckt,
SPcomplex *s )
{
return (OK);

View File

@ -19,7 +19,7 @@ if (size && (!(var =(type *)calloc(1, (unsigned)(size)*sizeof(type))))) {\
return(E_NOMEM);\
}
int NDEVmodelConnect(GENmodel *inModel);
int NDEVmodelConnect(NDEVmodel *inModel);
int NDEVsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
@ -73,9 +73,9 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
}
int NDEVmodelConnect(GENmodel *inModel)
int NDEVmodelConnect(NDEVmodel *inModel)
{
NDEVmodel *model = (NDEVmodel *)inModel;
NDEVmodel *model = inModel;
struct hostent *hostlist; /* List of hosts returned by gethostbyname. */
char dotted_ip[15]; /* Buffer for converting
the resolved address to

View File

@ -15,9 +15,9 @@ Author: 1992 David A. Gates, U. C. Berkeley CAD Group
#define NIL(type) ((type *)0)
int
NDEVtemp(inModel, ckt)
GENmodel *inModel;
register CKTcircuit *ckt;
NDEVtemp(
GENmodel *inModel,
register CKTcircuit *ckt )
/*
* perform the temperature update to the diode
*/

View File

@ -12,10 +12,10 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
int
NDEVtrunc(inModel, ckt, timeStep)
GENmodel *inModel;
register CKTcircuit *ckt;
double *timeStep;
NDEVtrunc(
GENmodel *inModel,
register CKTcircuit *ckt,
double *timeStep )
{

View File

@ -40,7 +40,7 @@ void INP2N(CKTcircuit *ckt, INPtables * tab, card * current)
int error1; /* secondary error code temporary */
int i;
INPmodel *thismodel; /* pointer to model structure describing our model */
void *mdfast = NULL; /* pointer to the actual model */
GENmodel *mdfast = NULL; /* pointer to the actual model */
GENinstance *fast; /* pointer to the actual instance */
NDEVinstance *pinst;
IFvalue ptemp; /* a value structure to package resistance into */