Browse Source

use type void* to pass anonymous data to function if_option()

indicate its actual type with an enum cp_types argument
pre-master-46
rlar 16 years ago
parent
commit
2990821053
  1. 10
      ChangeLog
  2. 4
      src/frontend/inp.c
  3. 11
      src/frontend/options.c
  4. 4
      src/frontend/spiceif.c
  5. 2
      src/frontend/spiceif.h
  6. 2
      src/include/fteext.h
  7. 2
      src/main.c

10
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 ,

4
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,

11
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. */

4
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;

2
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);

2
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);

2
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;
}

Loading…
Cancel
Save