diff --git a/ChangeLog b/ChangeLog index 3a7b8843c..3f7f25908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-07-17 Robert Larice + * src/main.c , + * src/frontend/inp.c , + * src/frontend/options.c , + * src/frontend/spiceif.c , + * src/frontend/spiceif.h , + * src/include/fteext.h : + use type void* to pass anonymous data to function if_option() + indicate its actual type with an enum cp_types argument + 2010-07-17 Robert Larice * src/frontend/variable.c , * src/frontend/variable.h , diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 5e790711a..96217ccca 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -894,11 +894,11 @@ inp_dodeck( break; case CP_NUM: if_option(ct->ci_ckt, eev->va_name, - eev->va_type, (char *) &eev->va_num); + eev->va_type, &eev->va_num); break; case CP_REAL: if_option(ct->ci_ckt, eev->va_name, - eev->va_type, (char *) &eev->va_real); + eev->va_type, &eev->va_real); break; case CP_STRING: if_option(ct->ci_ckt, eev->va_name, diff --git a/src/frontend/options.c b/src/frontend/options.c index 73a47a7c9..bcaa1aaa5 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -243,7 +243,8 @@ int cp_usrset(struct variable *var, bool isset) { char val[BSIZE_SP]; - char *vv, *s; + void *vv; + char *s; struct variable *tv; int iv; double dv; @@ -375,11 +376,11 @@ cp_usrset(struct variable *var, bool isset) if (var->va_bool) { /*val[0] = '\0';*/ bv = TRUE; - vv = (char *) &bv; + vv = &bv; /*break;*/ } else { bv = FALSE; - vv = (char *) &bv; + vv = &bv; } break; case CP_STRING: @@ -389,12 +390,12 @@ cp_usrset(struct variable *var, bool isset) case CP_NUM: /*(void) sprintf(val, "%d", var->va_num);*/ iv = var->va_num; - vv = (char *) &iv; + vv = &iv; break; case CP_REAL: /*(void) strcpy(val, printnum(var->va_real));*/ dv = var->va_real; - vv = (char *) &dv; + vv = &dv; break; case CP_LIST: /* if_option can't handle lists anyway. */ diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 31fab1f49..ef651c14c 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -382,7 +382,7 @@ static char *obsolete[] = { } ; int -if_option(CKTcircuit *ckt, char *name, int type, char *value) +if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value) { IFvalue pval; int err, i; @@ -467,7 +467,7 @@ if_option(CKTcircuit *ckt, char *name, int type, char *value) break; case IF_STRING: if (type == CP_STRING) - pval.sValue = copy(value); + pval.sValue = copy((char*) value); else goto badtype; break; diff --git a/src/frontend/spiceif.h b/src/frontend/spiceif.h index e9be12da2..f41ccf2cf 100644 --- a/src/frontend/spiceif.h +++ b/src/frontend/spiceif.h @@ -9,7 +9,7 @@ CKTcircuit * if_inpdeck(struct line *deck, INPtables **tab); int if_run(CKTcircuit *t, char *what, wordlist *args, INPtables *tab); -int if_option(CKTcircuit *ckt, char *name, int type, char *value); +int if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value); void if_dump(CKTcircuit *ckt, FILE *file); void if_cktfree(CKTcircuit *ckt, INPtables *tab); char * if_errstring(int code); diff --git a/src/include/fteext.h b/src/include/fteext.h index 0762226e3..a3f102f82 100644 --- a/src/include/fteext.h +++ b/src/include/fteext.h @@ -433,7 +433,7 @@ extern struct variable *spif_getparam(CKTcircuit *ckt, char **name, char *param, extern struct variable *spif_getparam_special(CKTcircuit *ckt, char **name, char *param, int ind, int do_model); extern void if_cktfree(CKTcircuit *ckt, INPtables *tab); extern void if_dump(CKTcircuit *ckt, FILE *file); -extern int if_option(CKTcircuit *ckt, char *name, int type, char *value); +extern int if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value); extern void if_setndnames(char *line); extern void if_setparam_model(CKTcircuit *ckt, char **name, char *val ); extern void if_setparam(CKTcircuit *ckt, char **name, char *param, struct dvec *val, int do_model); diff --git a/src/main.c b/src/main.c index 60140ab3e..6c8fa855e 100644 --- a/src/main.c +++ b/src/main.c @@ -252,7 +252,7 @@ if_inpdeck(struct line *deck, INPtables **tab) /* -------------------------------------------------------------------------- */ int -if_option(CKTcircuit *ckt, char *name, int type, char *value) +if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value) { return 0; }