From e952500be3c84abadee0ef72c1ded4f203918e43 Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 10 Aug 2014 20:21:34 +0200 Subject: [PATCH] numparam, rename `tdico' --> `dico_t' --- src/frontend/numparam/numparam.h | 24 ++++++++--------- src/frontend/numparam/nupatest.c | 8 +++--- src/frontend/numparam/spicenum.c | 28 ++++++++++---------- src/frontend/numparam/xpressn.c | 44 ++++++++++++++++---------------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/frontend/numparam/numparam.h b/src/frontend/numparam/numparam.h index eeb3fe08c..c6c44579e 100644 --- a/src/frontend/numparam/numparam.h +++ b/src/frontend/numparam/numparam.h @@ -46,19 +46,19 @@ typedef struct { /* the input scanner data structure */ char **dynrefptr; char *dyncategory; int hs_compatibility; /* allow extra keywords */ -} tdico; +} dico_t; -void initdico(tdico *dico); -int donedico(tdico *dico); +void initdico(dico_t *dico); +int donedico(dico_t *dico); void dico_free_entry(entry_t *entry_p); -bool defsubckt(tdico *dico, char *s, int w, char categ); -int findsubckt(tdico *dico, char *s, SPICE_DSTRINGPTR subname); -bool nupa_substitute(tdico *dico, char *s, char *r, bool err); -bool nupa_assignment(tdico *dico, char *s, char mode); -bool nupa_subcktcall(tdico *dico, char *s, char *x, bool err); -void nupa_subcktexit(tdico *dico); -tdico *nupa_fetchinstance(void); -char getidtype(tdico *d, char *s); -entry_t *attrib(tdico *d, NGHASHPTR htable, char *t, char op); +bool defsubckt(dico_t *dico, char *s, int w, char categ); +int findsubckt(dico_t *dico, char *s, SPICE_DSTRINGPTR subname); +bool nupa_substitute(dico_t *dico, char *s, char *r, bool err); +bool nupa_assignment(dico_t *dico, char *s, char mode); +bool nupa_subcktcall(dico_t *dico, char *s, char *x, bool err); +void nupa_subcktexit(dico_t *dico); +dico_t *nupa_fetchinstance(void); +char getidtype(dico_t *d, char *s); +entry_t *attrib(dico_t *d, NGHASHPTR htable, char *t, char op); void del_attrib(void *); diff --git a/src/frontend/numparam/nupatest.c b/src/frontend/numparam/nupatest.c index 8c57e1d06..187cc1c95 100644 --- a/src/frontend/numparam/nupatest.c +++ b/src/frontend/numparam/nupatest.c @@ -48,7 +48,7 @@ and substitute node/device name arguments. */ - int runscript( tdico *dico, char * prefix, + int runscript( dico_t *dico, char * prefix, int istart, int istop, int maxnest) /* recursive top-down expansion: circuit --> list of line numbers */ /* keep it simple,stupid compared to Spice's code */ @@ -233,7 +233,7 @@ char * nbofnodes = "222222444443222240334"; char * nbsubdevice = "000000000000111002000"; void prefixing(char * s, char * p, char * formals, char * actuals, - char categ, tdico *dic) + char categ, dico_t *dic) /* s is a line in expanded subcircuit. p is the prefix to be glued anywhere . assume that everything except first and last word in s may be a node. @@ -303,7 +303,7 @@ Reminder on Numparam symbols: } } -void getnodelist(char * form, char * act, char * s, tdico *dic, int k) +void getnodelist(char * form, char * act, char * s, dico_t *dic, int k) /* the line s contains the actual node parameters, between 1st & last word */ { int j,ls, idef; @@ -337,7 +337,7 @@ void nupa_test(char * fname, char mode) /* bugs in nupa_eval(), and for nested subckt definitions !?! */ { FILE * tf, fout; - tdico * dic; /* dictionary data pointer */ + dico_t * dic; /* dictionary data pointer */ Strbig(Llen,s); Str(80, prefix); /* Strbig(Llen, formals); Strbig(Llen,actuals); */ diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index ffc2fce77..0f7728239 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -31,7 +31,7 @@ Todo: extern bool ft_batchmode; -void dump_symbols(tdico *dico_p); +void dump_symbols(dico_t *dico_p); char *nupa_inst_name; @@ -166,7 +166,7 @@ stripbraces(SPICE_DSTRINGPTR dstr_p) static int -findsubname(tdico *dico, SPICE_DSTRINGPTR dstr_p) +findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p) /* truncate the parameterized subckt call to regular old Spice */ /* scan a string from the end, skipping non-idents and {expressions} */ /* then truncate s after the last subckt(?) identifier */ @@ -290,7 +290,7 @@ modernizeex(SPICE_DSTRINGPTR dstr_p) static char -transform(tdico *dico, SPICE_DSTRINGPTR dstr_p, unsigned char nostripping, +transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, unsigned char nostripping, SPICE_DSTRINGPTR u_p) /* line s is categorized and crippled down to basic Spice * returns in u control word following dot, if any @@ -390,7 +390,7 @@ transform(tdico *dico, SPICE_DSTRINGPTR dstr_p, unsigned char nostripping, /************ core of numparam **************/ -/* some day, all these nasty globals will go into the tdico structure +/* some day, all these nasty globals will go into the dico_t structure and everything will get hidden behind some "handle" ... For the time being we will rename this variable to end in S so we know they are statics within this file for easier reading of the code. @@ -404,7 +404,7 @@ static unsigned char incontrolS = 0; /* flag control code sections */ static unsigned char dologfileS = 0; /* for debugging */ static unsigned char firstsignalS = 1; static FILE *logfileS = NULL; -static tdico *dicoS = NULL; +static dico_t *dicoS = NULL; /* already part of dico : */ @@ -440,7 +440,7 @@ nupa_init(char *srcfile) linecountS = 0; incontrolS = 0; placeholder = 0; - dicoS = (tdico *) new(sizeof(tdico)); + dicoS = (dico_t *) new(sizeof(dico_t)); initdico(dicoS); dicoS->dynrefptr = TMALLOC(char*, dynmaxline + 1); @@ -532,7 +532,7 @@ nupa_scan(char *s, int linenum, int is_subckt) * Dump the contents of a symbol table. * ----------------------------------------------------------------- */ static void -dump_symbol_table(tdico *dico_p, NGHASHPTR htable_p, FILE *cp_out) +dump_symbol_table(dico_t *dico_p, NGHASHPTR htable_p, FILE *cp_out) { char *name; /* current symbol */ entry_t *entry_p; /* current entry */ @@ -561,7 +561,7 @@ void nupa_list_params(FILE *cp_out) { int depth; /* nested subcircit depth */ - tdico *dico_p; /* local copy for speed */ + dico_t *dico_p; /* local copy for speed */ dico_p = dicoS; if (dico_p == NULL) { @@ -598,7 +598,7 @@ nupa_get_param(char *param_name, int *found) int depth; /* nested subcircit depth */ char *up_name; /* current parameter upper case */ entry_t *entry_p; /* current entry */ - tdico *dico_p; /* local copy for speed */ + dico_t *dico_p; /* local copy for speed */ double result = 0; /* parameter value */ dico_p = dicoS; @@ -629,7 +629,7 @@ nupa_add_param(char *param_name, double value) { char *up_name; /* current parameter upper case */ entry_t *entry_p; /* current entry */ - tdico *dico_p; /* local copy for speed */ + dico_t *dico_p; /* local copy for speed */ NGHASHPTR htable_p; /* hash table of interest */ dico_p = dicoS; @@ -664,7 +664,7 @@ nupa_add_inst_param(char *param_name, double value) { char *up_name; /* current parameter upper case */ entry_t *entry_p; /* current entry */ - tdico *dico_p; /* local copy for speed */ + dico_t *dico_p; /* local copy for speed */ dico_p = dicoS; spice_dstring_reinit(& dico_p->lookup_buf); @@ -695,7 +695,7 @@ void nupa_copy_inst_dico(void) { entry_t *entry_p; /* current entry */ - tdico *dico_p; /* local copy for speed */ + dico_t *dico_p; /* local copy for speed */ NGHASHITER iter; /* hash iterator - thread safe */ dico_p = dicoS; @@ -884,7 +884,7 @@ nupa_signal(int sig, char *info) #ifdef USING_NUPATEST /* This is use only by the nupatest program */ -tdico * +dico_t * nupa_fetchinstance(void) { return dico; @@ -892,7 +892,7 @@ nupa_fetchinstance(void) #endif -void dump_symbols(tdico *dico_p) +void dump_symbols(dico_t *dico_p) { NG_IGNORE(dico_p); diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index f8cbbda4e..9201300fa 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -205,13 +205,13 @@ mathfunction(int f, double z, double x) #ifdef __GNUC__ -static bool message(tdico *dic, const char *fmt, ...) +static bool message(dico_t *dic, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3))); #endif static bool -message(tdico *dic, const char *fmt, ...) +message(dico_t *dic, const char *fmt, ...) { va_list ap; @@ -239,7 +239,7 @@ message(tdico *dic, const char *fmt, ...) /************ the input text symbol table (dictionary) *************/ void -initdico(tdico *dico) +initdico(dico_t *dico) { int asize = 10; /* default allocation depth of the synbol stack */ COMPATMODE_T compat_mode; @@ -289,7 +289,7 @@ dico_free_entry(entry_t *entry_p) */ static void -dicostack_push(tdico *dico) +dicostack_push(dico_t *dico) /* push operation for nested subcircuit locals */ { dico->stack_depth++; @@ -307,7 +307,7 @@ dicostack_push(tdico *dico) static void -dicostack_pop(tdico *dico) +dicostack_pop(dico_t *dico) /* pop operation for nested subcircuit locals */ { char *inst_name; /* name of subcircuit instance */ @@ -354,7 +354,7 @@ dicostack_pop(tdico *dico) int -donedico(tdico *dico) +donedico(dico_t *dico) { int sze = nghash_get_size(dico->symbols[0]); return sze; @@ -367,7 +367,7 @@ donedico(tdico *dico) * symbols in that order. * ----------------------------------------------------------------- */ static entry_t * -entrynb(tdico *d, char *s) +entrynb(dico_t *d, char *s) { int depth; /* stack depth */ entry_t *entry_p; /* search hash table */ @@ -388,7 +388,7 @@ entrynb(tdico *d, char *s) char -getidtype(tdico *d, char *s) +getidtype(dico_t *d, char *s) /* test if identifier s is known. Answer its type, or '?' if not in table */ { entry_t *entry_p; /* hash table entry */ @@ -403,7 +403,7 @@ getidtype(tdico *d, char *s) static double -fetchnumentry(tdico *dico, char *t, bool *perr) +fetchnumentry(dico_t *dico, char *t, bool *perr) { bool err = *perr; double u; @@ -435,7 +435,7 @@ fetchnumentry(tdico *dico, char *t, bool *perr) /******* writing dictionary entries *********/ entry_t * -attrib(tdico *dico_p, NGHASHPTR htable_p, char *t, char op) +attrib(dico_t *dico_p, NGHASHPTR htable_p, char *t, char op) { /* seek or attribute dico entry number for string t. Option op='N' : force a new entry, if tos>level and old is valid. @@ -478,7 +478,7 @@ del_attrib(void *e_p) static bool -nupa_define(tdico *dico, +nupa_define(dico_t *dico, char *t, /* identifier to define */ char op, /* option */ char tpe, /* type marker */ @@ -555,7 +555,7 @@ nupa_define(tdico *dico, bool -defsubckt(tdico *dico, char *s, int w, char categ) +defsubckt(dico_t *dico, char *s, int w, char categ) /* called on 1st pass of spice source code, to enter subcircuit (categ=U) and model (categ=O) names */ @@ -595,7 +595,7 @@ defsubckt(tdico *dico, char *s, int w, char categ) int -findsubckt(tdico *dico, char *s, SPICE_DSTRINGPTR subname) +findsubckt(dico_t *dico, char *s, SPICE_DSTRINGPTR subname) /* input: s is a subcircuit invocation line. returns 0 if not found, else the stored definition line number value and the name in string subname */ @@ -729,7 +729,7 @@ fetchid(SPICE_DSTRINGPTR t, const char *s_end, const char *iptr) static double -fetchnumber(tdico *dico, const char **pi, bool *perror) +fetchnumber(dico_t *dico, const char **pi, bool *perror) /* parse a Spice number in string s */ { double u; @@ -762,7 +762,7 @@ fetchnumber(tdico *dico, const char **pi, bool *perror) static char -fetchoperator(tdico *dico, +fetchoperator(dico_t *dico, const char *s_end, const char **pi, unsigned char *pstate, unsigned char *plevel, @@ -941,7 +941,7 @@ operate(char op, double x, double y) static double -formula(tdico *dico, const char *s, const char *s_end, bool *perror) +formula(dico_t *dico, const char *s, const char *s_end, bool *perror) { /* Expression parser. s is a formula with parentheses and math ops +-* / ... @@ -1163,7 +1163,7 @@ formula(tdico *dico, const char *s, const char *s_end, bool *perror) static bool -evaluate(tdico *dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode) +evaluate(dico_t *dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode) { /* transform t to result q. mode 0: expression, mode 1: simple variable */ double u = 0.0; @@ -1249,7 +1249,7 @@ evaluate(tdico *dico, SPICE_DSTRINGPTR qstr_p, char *t, unsigned char mode) /********* interface functions for spice3f5 extension ***********/ static int -insertnumber(tdico *dico, int i, char *s, SPICE_DSTRINGPTR ustr_p) +insertnumber(dico_t *dico, int i, char *s, SPICE_DSTRINGPTR ustr_p) /* insert u in string s in place of the next placeholder number */ { const char *u = spice_dstring_value(ustr_p); @@ -1283,7 +1283,7 @@ insertnumber(tdico *dico, int i, char *s, SPICE_DSTRINGPTR ustr_p) bool -nupa_substitute(tdico *dico, char *s, char *r, bool err) +nupa_substitute(dico_t *dico, char *s, char *r, bool err) /* s: pointer to original source line. r: pointer to result line, already heavily modified wrt s anywhere we find a 10-char numstring in r, substitute it. @@ -1528,7 +1528,7 @@ getexpress(char *s, SPICE_DSTRINGPTR tstr_p, int *pi) bool -nupa_assignment(tdico *dico, char *s, char mode) +nupa_assignment(dico_t *dico, char *s, char mode) /* is called for all 'Param' lines of the input file. is also called for the params: section of a subckt . mode='N' define new local variable, else global... @@ -1608,7 +1608,7 @@ nupa_assignment(tdico *dico, char *s, char mode) bool -nupa_subcktcall(tdico *dico, char *s, char *x, bool err) +nupa_subcktcall(dico_t *dico, char *s, char *x, bool err) /* s= a subckt define line, with formal params. x= a matching subckt call line, with actual params */ @@ -1832,7 +1832,7 @@ nupa_subcktcall(tdico *dico, char *s, char *x, bool err) void -nupa_subcktexit(tdico *dico) +nupa_subcktexit(dico_t *dico) { dicostack_pop(dico); }