use CKTcircuit instead of void*, #1/4

This commit is contained in:
rlar 2010-07-07 17:26:05 +00:00
parent 12dc45118b
commit 72fc1a0186
23 changed files with 82 additions and 56 deletions

View File

@ -1,3 +1,29 @@
2010-07-07 Robert Larice
* src/tclspice.c ,
* src/frontend/com_option.c ,
* src/frontend/inp.c ,
* src/frontend/resource.c ,
* src/frontend/shyu.c ,
* src/frontend/spiceif.c ,
* src/include/cktdefs.h ,
* src/include/ftedefs.h ,
* src/include/ifsim.h ,
* src/include/inpdefs.h ,
* src/spicelib/analysis/ckt.h ,
* src/spicelib/analysis/cktsetap.c ,
* src/spicelib/devices/cktinit.c ,
* src/spicelib/parser/inp.h ,
* src/spicelib/parser/inp2dot.c ,
* src/spicelib/parser/inpapnam.c ,
* src/spicelib/parser/inpdoopt.c ,
* src/spicelib/parser/inpgtitl.c ,
* src/spicelib/parser/inppas1.c ,
* src/spicelib/parser/inppas1.h ,
* src/spicelib/parser/inppas2.c ,
* src/spicelib/parser/inppas2.h :
the first of a series of four patches, which will change the code
to use the CKTcircuit type instead of the current mixed void*/char*
2010-07-06 Robert Larice
* src/include/fteext.h :
ansi function declarations (prototypes) for some functions

View File

@ -25,7 +25,7 @@ struct variable *vars;
return;
}
circuit = (CKTcircuit *)(ft_curckt->ci_ckt);
circuit = (ft_curckt->ci_ckt);
if (wl == NULL) {

View File

@ -667,7 +667,7 @@ inp_dodeck(
) {
struct circ *ct;
struct line *dd;
char *ckt, *s;
CKTcircuit *ckt; char *s;
INPtables *tab = NULL;
struct variable *eev = NULL;
wordlist *wl;

View File

@ -442,7 +442,7 @@ printres(char *name)
/* begin cider integration */
/* Now print out interesting stuff about numerical devices. */
if (!name || eq(name, "devices")) {
(void) NDEVacct((CKTcircuit*)ft_curckt->ci_ckt, cp_out);
(void) NDEVacct(ft_curckt->ci_ckt, cp_out);
yy = TRUE;
}
/* end cider integration */

View File

@ -27,7 +27,7 @@ Copyright 1990 Regents of the University of California. All rights reserved.
int
if_sens_run(CKTcircuit *t, wordlist *args, INPtables *tab)
{
void *ckt = (void *) t;
CKTcircuit *ckt = (CKTcircuit * /*fixme*/) t;
void *senseJob;
void *acJob;
void *opJob;

View File

@ -89,7 +89,7 @@ static int finddev_special(CKTcircuit *ck, char *name, GENinstance **devptr, GEN
CKTcircuit *
if_inpdeck(struct line *deck, INPtables **tab)
{
void *ckt;
CKTcircuit *ckt;
int err, i, j;
struct line *ll;
IFuid taskUid;
@ -161,8 +161,8 @@ if_inpdeck(struct line *deck, INPtables **tab)
ft_curckt->ci_curTask = ft_curckt->ci_defTask;
INPpas1((void *) ckt, (card *) deck->li_next,(INPtables *)*tab);
INPpas2((void *) ckt, (card *) deck->li_next,
INPpas1( ckt, (card *) deck->li_next,(INPtables *)*tab);
INPpas2( ckt, (card *) deck->li_next,
(INPtables *) *tab,ft_curckt->ci_defTask);
INPkillMods();
@ -197,7 +197,7 @@ if_inpdeck(struct line *deck, INPtables **tab)
int
if_run(CKTcircuit *t, char *what, wordlist *args, INPtables *tab)
{
void *ckt = (void *) t;
CKTcircuit *ckt = (CKTcircuit *) t;
int err;
struct line deck;
char buf[BSIZE_SP];
@ -386,7 +386,7 @@ if_option(CKTcircuit *ckt, char *name, int type, char *value)
{
IFvalue pval;
int err, i;
void *cc = (void *) ckt;
CKTcircuit *cc = (CKTcircuit * /*fixme*/) ckt;
char **vv;
int which = -1;
@ -1326,9 +1326,9 @@ void com_loadsnap(wordlist *wl) {
/* allocate all the vectors, with luck! */
if (!error)
error = CKTsetup((CKTcircuit *)ft_curckt->ci_ckt);
error = CKTsetup(ft_curckt->ci_ckt);
if (!error)
error = CKTtemp((CKTcircuit *)ft_curckt->ci_ckt);
error = CKTtemp(ft_curckt->ci_ckt);
if(error) {
fprintf(cp_err,"Some error in the CKT setup fncts!\n");
@ -1342,7 +1342,7 @@ void com_loadsnap(wordlist *wl) {
/* now load the binary file */
ckt = (CKTcircuit *)ft_curckt->ci_ckt;
ckt = ft_curckt->ci_ckt;
file = fopen(wl->wl_next->wl_word,"rb");
@ -1557,7 +1557,7 @@ void com_savesnap(wordlist *wl) {
/* save the data */
ckt = (CKTcircuit *)ft_curckt->ci_ckt;
ckt = ft_curckt->ci_ckt;
task = (TSKtask *)ft_curckt->ci_curTask;

View File

@ -305,7 +305,7 @@ extern int CKTfndNode(void *, void **, IFuid);
extern int CKTfndTask(void *, void **, IFuid );
extern int CKTground(void *, void **, IFuid);
extern int CKTic(CKTcircuit *);
extern int CKTinit(void **);
extern int CKTinit(CKTcircuit **);
extern int CKTinst2Node(void *, void *, int , CKTnode **, IFuid *);
extern int CKTlinkEq(CKTcircuit *, CKTnode *);
extern int CKTload(CKTcircuit *);
@ -340,7 +340,7 @@ extern int CKTsenLoad(CKTcircuit *);
extern void CKTsenPrint(CKTcircuit *);
extern int CKTsenSetup(CKTcircuit *);
extern int CKTsenUpdate(CKTcircuit *);
extern int CKTsetAnalPm(void *, void *, int , IFvalue *, IFvalue *);
extern int CKTsetAnalPm(CKTcircuit *, void *, int , IFvalue *, IFvalue *);
extern int CKTsetBreak(CKTcircuit *, double);
extern int CKTsetNodPm(void *, void *, int , IFvalue *, IFvalue *);
extern int CKTsetOpt(CKTcircuit *, void *, int , IFvalue *);

View File

@ -26,7 +26,7 @@ struct save_info {
struct circ {
char *ci_name; /* What the circuit can be called. */
char *ci_ckt; /* The CKTcircuit structure. */
CKTcircuit *ci_ckt; /* The CKTcircuit structure. */
INPtables *ci_symtab; /* The INP symbol table. */
struct line *ci_deck; /* The input deck. */
struct line *ci_origdeck;/* The input deck, before subckt expansion. */

View File

@ -345,7 +345,7 @@ struct IFsimulator {
char *description; /* description of this simulator */
char *version; /* version or revision level of simulator*/
int (*newCircuit) (void **);
int (*newCircuit) (CKTcircuit **);
/* create new circuit */
int (*deleteCircuit) (void *);
/* destroy old circuit's data structures*/
@ -393,7 +393,7 @@ struct IFsimulator {
/* create a new task */
int (*newAnalysis) (void *, int, IFuid, void **, void *);
/* create new analysis within a task */
int (*setAnalysisParm) (void *, void *, int, IFvalue *, IFvalue *);
int (*setAnalysisParm) (CKTcircuit *, void *, int, IFvalue *, IFvalue *);
/* set a parameter on an analysis */
int (*askAnalysisQuest) (void *, void *, int, IFvalue *, IFvalue *);
/* ask a question about an analysis */

View File

@ -90,11 +90,11 @@ int IFnewUid(void *, IFuid *, IFuid, char *, int, void **);
int IFdelUid(void *, IFuid, int);
int INPaName(char *, IFvalue *, void *, int *, char *, void **, IFsimulator *, int *,
IFvalue *);
int INPapName(void *, int, void *, char *, IFvalue *);
int INPapName(CKTcircuit *, int, void *, char *, IFvalue *);
void INPcaseFix(char *);
char *INPdevParse(char **, void *, int, void *, double *, int *, INPtables *);
char *INPdomodel(void *, card *, INPtables *);
void INPdoOpts(void *, void *, card *, INPtables *);
void INPdoOpts(CKTcircuit *, void *, card *, INPtables *);
char *INPerrCat(char *, char *);
char *INPerror(int);
double INPevaluate(char **, int *, int);
@ -113,8 +113,8 @@ int INPremove(char *, INPtables *);
int INPlookMod(char *);
int INPmakeMod(char *, int, card *);
char *INPmkTemp(char *);
void INPpas1(void *, card *, INPtables *);
void INPpas2(void *, card *, INPtables *, void *);
void INPpas1(CKTcircuit *, card *, INPtables *);
void INPpas2(CKTcircuit *, card *, INPtables *, void *);
void INPpas3(void *, card *, INPtables *, void *, IFparm *, int);
int INPpName(char *, IFvalue *, void *, int, void *);
int INPtermInsert(void *, char **, INPtables *, void **);
@ -143,7 +143,7 @@ void INP2V(void *, INPtables *, card *);
void INP2W(void *, INPtables *, card *);
void INP2Y(void *, INPtables *, card *);
void INP2Z(void *, INPtables *, card *);
int INP2dot(void *, INPtables *, card *, void *, void *);
int INP2dot(CKTcircuit *, INPtables *, card *, void *, void *);
INPtables *INPtabInit(int);
void INPkillMods(void);
void INPtabEnd(INPtables *);

View File

@ -42,7 +42,7 @@ int CKTfndNode( void *, void **, IFuid );
int CKTfndTask( void *, void **, IFuid );
int CKTground( void *, void **, IFuid );
int CKTic( CKTcircuit *);
int CKTinit( void **);
int CKTinit( CKTcircuit **);
int CKTinst2Node( void *, void *, int , CKTnode **, IFuid *);
int CKTlinkEq(CKTcircuit*,CKTnode*);
int CKTload( CKTcircuit *);
@ -75,7 +75,7 @@ int CKTsenLoad( CKTcircuit *);
void CKTsenPrint( CKTcircuit *);
int CKTsenSetup( CKTcircuit *);
int CKTsenUpdate( CKTcircuit *);
int CKTsetAnalPm( void *, void *, int , IFvalue *, IFvalue *);
int CKTsetAnalPm( CKTcircuit *, void *, int , IFvalue *, IFvalue *);
int CKTsetBreak( CKTcircuit *, double );
int CKTsetNodPm( void *, void *, int , IFvalue *, IFvalue *);
int CKTsetOpt( CKTcircuit *, void *, int , IFvalue *);

View File

@ -16,7 +16,7 @@ extern SPICEanalysis *analInfo[];
/* ARGSUSED */
int
CKTsetAnalPm(void *ckt, void *analPtr, int parm, IFvalue *value, IFvalue *selector)
CKTsetAnalPm(CKTcircuit *ckt, void *analPtr, int parm, IFvalue *value, IFvalue *selector)
{
int type = ((JOB *)analPtr)->JOBtype;
if((analInfo[type]->setParm)==NULL) return(E_BADPARM);

View File

@ -21,12 +21,12 @@ Modifed: 2000 AlansFixes
#endif
int
CKTinit(void **ckt) /* new circuit to create */
CKTinit(CKTcircuit **ckt) /* new circuit to create */
{
int i;
CKTcircuit *sckt;
*ckt = (void *) tmalloc(sizeof(CKTcircuit));
sckt = (CKTcircuit *)(*ckt);
*ckt = (CKTcircuit *) tmalloc(sizeof(CKTcircuit));
sckt = (CKTcircuit * /*fixme*/)(*ckt);
if (sckt == NULL)
return(E_NOMEM);
/* gtri - begin - dynamically allocate the array of model lists */

View File

@ -42,16 +42,16 @@ void INP2V(void *ckt, INPtables *tab, card *current);
void INP2W(void *ckt, INPtables *tab, card *current);
void INP2Y(void *ckt, INPtables *tab, card *current);
void INP2Z(void *ckt, INPtables *tab, card *current);
int INP2dot(void *ckt, INPtables *tab, card *current, void *task, void *gnode);
int INP2dot(CKTcircuit *ckt, INPtables *tab, card *current, void *task, void *gnode);
/* inpxxxx.c */
int INPaName(char *parm, IFvalue *val, void *ckt, int *dev, char *devnam,
void **fast, IFsimulator *sim, int *dataType, IFvalue *selector);
int INPapName(void *ckt, int type, void *analPtr, char *parmname, IFvalue *value);
int INPapName(CKTcircuit *ckt, int type, void *analPtr, char *parmname, IFvalue *value);
void INPcaseFix(register char *string);
char * INPdomodel(void *ckt, card *image, INPtables *tab);
void INPdoOpts(void *ckt, void *anal, card *optCard, INPtables *tab);
void INPdoOpts(CKTcircuit *ckt, void *anal, card *optCard, INPtables *tab);
char * INPdevParse(char **line, void *ckt, int dev, void *fast, double *leading,
int *waslead, INPtables *tab);
char * INPerrCat(char *a, char *b);
@ -61,7 +61,7 @@ char * INPfindLev(char *line, int *level);
char * INPfindVer(char *line, char *version);
char * INPgetMod(void *ckt, char *name, INPmodel **model, INPtables *tab);
int INPgetStr(char **line, char **token, int gobble);
int INPgetTitle(void **ckt, card **data);
int INPgetTitle(CKTcircuit **ckt, card **data);
int INPgetTok(char **line, char **token, int gobble);
int INPgetUTok(char **line, char **token, int gobble);
IFvalue * INPgetValue(void *ckt, char **line, int type, INPtables *tab);
@ -70,8 +70,8 @@ void INPlist(FILE *file, card *deck, int type);
int INPlookMod(char *name);
int INPmakeMod(char *token, int type, card *line);
char * INPmkTemp(char *string);
void INPpas1(void *ckt, card *deck, INPtables *tab);
void INPpas2(void *ckt, card *data, INPtables *tab, void *task);
void INPpas1(CKTcircuit *ckt, card *deck, INPtables *tab);
void INPpas2(CKTcircuit *ckt, card *data, INPtables *tab, void *task);
int INPpName(char *parm, IFvalue *val, void *ckt, int dev, void *fast);
/* inpptree.c */

View File

@ -15,7 +15,7 @@ Modified: 2000 AlansFixes
static int
dot_noise(char *line, void *ckt, INPtables *tab, card *current,
dot_noise(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
int which; /* which analysis we are performing */
@ -148,7 +148,7 @@ dot_op(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_disto(char *line, void *ckt, INPtables *tab, card *current,
dot_disto(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
int which; /* which analysis we are performing */
@ -189,7 +189,7 @@ dot_disto(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_ac(char *line, void *ckt, INPtables *tab, card *current,
dot_ac(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
int error; /* error code temporary */
@ -226,7 +226,7 @@ dot_ac(char *line, void *ckt, INPtables *tab, card *current,
}
static int
dot_pz(char *line, void *ckt, INPtables *tab, card *current,
dot_pz(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
int error; /* error code temporary */
@ -268,7 +268,7 @@ dot_pz(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_dc(char *line, void *ckt, INPtables *tab, card *current,
dot_dc(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
char *name; /* the resistor's name */
@ -319,7 +319,7 @@ dot_dc(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_tf(char *line, void *ckt, INPtables *tab, card *current,
dot_tf(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
char *name; /* the resistor's name */
@ -392,7 +392,7 @@ dot_tf(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_tran(char *line, void *ckt, INPtables *tab, card *current,
dot_tran(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
int error; /* error code temporary */
@ -446,7 +446,7 @@ dot_tran(char *line, void *ckt, INPtables *tab, card *current,
static int
dot_sens(char *line, void *ckt, INPtables *tab, card *current,
dot_sens(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
char *name; /* the resistor's name */
@ -620,7 +620,7 @@ dot_sens2(char *line, void *ckt, INPtables *tab, card *current,
#endif
static int
dot_options(char *line, void *ckt, INPtables *tab, card *current,
dot_options(char *line, CKTcircuit *ckt, INPtables *tab, card *current,
void *task, void *gnode, void *foo)
{
/* .option - specify program options - rather complicated */
@ -633,7 +633,7 @@ dot_options(char *line, void *ckt, INPtables *tab, card *current,
int
INP2dot(void *ckt, INPtables *tab, card *current, void *task, void *gnode)
INP2dot(CKTcircuit *ckt, INPtables *tab, card *current, void *task, void *gnode)
{
/* .<something> Many possibilities */
@ -721,7 +721,7 @@ INP2dot(void *ckt, INPtables *tab, card *current, void *task, void *gnode)
else if ((strcmp(token, ".options") == 0)||
(strcmp(token,".option")==0) ||
(strcmp(token,".opt")==0)) {
rtn = dot_options(line, ckt, tab, current, task, gnode, foo);
rtn = dot_options(line, (CKTcircuit * /*fixme*/) ckt, tab, current, task, gnode, foo);
goto quit;
}
/* Added by H.Tanaka to find .global option */

View File

@ -12,7 +12,7 @@ Author: 1985 Thomas L. Quarles
#include "inp.h"
int
INPapName(void *ckt, int type, void *analPtr, char *parmname,
INPapName(CKTcircuit *ckt, int type, void *analPtr, char *parmname,
IFvalue * value)
{
int i;

View File

@ -19,7 +19,7 @@ Modified: 2000 AlansFixes
void
INPdoOpts(
void *ckt,
CKTcircuit *ckt,
void *anal,
card *optCard,
INPtables *tab)

View File

@ -16,7 +16,7 @@ Author: 1985 Thomas L. Quarles
#include "fteext.h"
#include "inp.h"
int INPgetTitle(void **ckt, card ** data)
int INPgetTitle(CKTcircuit **ckt, card ** data)
{
int error;

View File

@ -14,7 +14,7 @@ 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(CKTcircuit *ckt, card * deck, INPtables * tab)
{
card *current;
char *temp, *thisline;

View File

@ -3,6 +3,6 @@
#include <inpdefs.h>
void INPpas1(void *ckt, card *deck, INPtables *tab);
void INPpas1(CKTcircuit *ckt, card *deck, INPtables *tab);
#endif

View File

@ -26,7 +26,7 @@ extern void SetAnalyse( char * Analyse, int Percent);
/* pass 2 - Scan through the lines. ".model" cards have processed in
* pass1 and are ignored here. */
void INPpas2(void *ckt, card * data, INPtables * tab, void *task)
void INPpas2(CKTcircuit *ckt, card * data, INPtables * tab, void *task)
{
card *current;

View File

@ -3,7 +3,7 @@
#include <inpdefs.h>
void INPpas2(void *ckt, card *data, INPtables *tab, void *task);
void INPpas2(CKTcircuit *ckt, card *data, INPtables *tab, void *task);
#endif

View File

@ -1289,10 +1289,10 @@ static int delta TCL_CMDPROCARGS(clientData,interp,argc,argv) {
}
if(argc == 2) {
((CKTcircuit *)ft_curckt->ci_ckt)->CKTdelta = atof(argv[1]);
(ft_curckt->ci_ckt)->CKTdelta = atof(argv[1]);
}
/*Ok, as log as string less than 200 chars*/
sprintf(interp->result,"%G",((CKTcircuit *)ft_curckt->ci_ckt)->CKTdelta);
sprintf(interp->result,"%G",(ft_curckt->ci_ckt)->CKTdelta);
return TCL_OK;
}
@ -1311,7 +1311,7 @@ static int maxstep TCL_CMDPROCARGS(clientData,interp,argc,argv) {
return TCL_ERROR;
}
job = (TRANan*)((CKTcircuit *)ft_curckt->ci_ckt)->CKTcurJob;
job = (TRANan*)(ft_curckt->ci_ckt)->CKTcurJob;
if(argc == 2) {
job->TRANmaxStep = atof(argv[1]);
}