Browse Source

various cleanups

pre-master-46
rlar 15 years ago
parent
commit
55638c8023
  1. 8
      ChangeLog
  2. 6
      src/frontend/com_ghelp.c
  3. 4
      src/frontend/device.c
  4. 6
      src/frontend/diff.c
  5. 8
      src/frontend/fourier.c
  6. 2
      src/frontend/inp.c
  7. 2
      src/frontend/inpcom.c
  8. 1
      src/frontend/numparam/general.h
  9. 4
      src/frontend/plotting/agraf.c
  10. 4
      src/frontend/plotting/graf.c
  11. 6
      src/frontend/plotting/plotcurv.c
  12. 4
      src/frontend/postcoms.c
  13. 4
      src/frontend/terminal.c
  14. 2
      src/frontend/wdisp/windisp.c
  15. 4
      src/maths/cmaths/cmath4.c
  16. 3
      src/spicelib/devices/bsim3/b3par.c
  17. 2
      src/spicelib/devices/bsim3/b3set.c
  18. 2
      src/spicelib/devices/bsim3soi/b4soiset.c
  19. 3
      src/spicelib/devices/bsim3v0/b3v0par.c
  20. 3
      src/spicelib/devices/bsim3v1/b3v1par.c
  21. 3
      src/spicelib/devices/bsim3v32/b3v32par.c
  22. 3
      src/spicelib/devices/bsim4/b4par.c
  23. 2
      src/spicelib/devices/bsim4/b4set.c
  24. 3
      src/spicelib/devices/bsim4v2/b4v2par.c
  25. 3
      src/spicelib/devices/bsim4v3/b4v3par.c
  26. 3
      src/spicelib/devices/bsim4v4/b4v4par.c
  27. 3
      src/spicelib/devices/bsim4v5/b4v5par.c
  28. 3
      src/spicelib/devices/cktbindnode.c
  29. 2
      src/spicelib/devices/dev.c
  30. 3
      src/spicelib/parser/inpgmod.c

8
ChangeLog

@ -1,3 +1,11 @@
2011-04-30 Robert Larice
* **/* :
various cleanups
- usage of cp_getvar(), receives a void* in the third arg, thus remove casts
FIXME, this function signature is error prone
- use NG_IGNORE()
- casts and prototypes
2011-04-29 Robert Larice
* src/spicelib/devices/hisimhv/hsmhvnoi.c ,
* src/spicelib/devices/hisimhv/hsmhvset.c :

6
src/frontend/com_ghelp.c

@ -48,9 +48,9 @@ com_ghelp(wordlist *wl)
hlp_titlefontname = copy(buf);
if (cp_getvar("helpbuttonfont", CP_STRING, buf))
hlp_buttonfontname = copy(buf);
if (cp_getvar("helpinitxpos", CP_NUM, (char *) &i))
if (cp_getvar("helpinitxpos", CP_NUM, &i))
hlp_initxpos = i;
if (cp_getvar("helpinitypos", CP_NUM, (char *) &i))
if (cp_getvar("helpinitypos", CP_NUM, &i))
hlp_initypos = i;
if (cp_getvar("helpbuttonstyle", CP_STRING, buf)) {
if (cieq(buf, "left"))
@ -63,7 +63,7 @@ com_ghelp(wordlist *wl)
fprintf(cp_err, "Warning: no such button style %s\n",
buf);
}
if (cp_getvar("width", CP_NUM, (char *) &i))
if (cp_getvar("width", CP_NUM, &i))
hlp_width = i;
if (cp_getvar("display", CP_STRING, buf))
hlp_displayname = copy(buf);

4
src/frontend/device.c

@ -79,7 +79,7 @@ all_show(wordlist *wl, int mode)
return;
}
if (!cp_getvar("width", CP_NUM, (char *) &screen_width))
if (!cp_getvar("width", CP_NUM, &screen_width))
screen_width = DEF_WIDTH;
count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1);
count = 1;
@ -243,7 +243,7 @@ all_show_old(wordlist *wl, int mode)
return;
}
if (!cp_getvar("width", CP_NUM, (char *) &screen_width))
if (!cp_getvar("width", CP_NUM, &screen_width))
screen_width = DEF_WIDTH;
count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1);

6
src/frontend/diff.c

@ -76,11 +76,11 @@ com_diff(wordlist *wl)
wordlist *tw;
char numbuf[BSIZE_SP],numbuf2[BSIZE_SP] ,numbuf3[BSIZE_SP], numbuf4[BSIZE_SP]; /* For printnum */
if (!cp_getvar("diff_vntol", CP_REAL, (char *) &vntol))
if (!cp_getvar("diff_vntol", CP_REAL, &vntol))
vntol = 1.0e-6;
if (!cp_getvar("diff_abstol", CP_REAL, (char *) &abstol))
if (!cp_getvar("diff_abstol", CP_REAL, &abstol))
abstol = 1.0e-12;
if (!cp_getvar("diff_reltol", CP_REAL, (char *) &reltol))
if (!cp_getvar("diff_reltol", CP_REAL, &reltol))
reltol = 0.001;
/* Let's try to be clever about defaults. This code is ugly. */

8
src/frontend/fourier.c

@ -62,13 +62,11 @@ fourier(wordlist *wl, struct plot *current_plot)
return 1;
}
if ((!cp_getvar("nfreqs", CP_NUM, (char *) &nfreqs)) || (nfreqs < 1))
if (!cp_getvar("nfreqs", CP_NUM, &nfreqs) || nfreqs < 1)
nfreqs = 10;
if ((!cp_getvar("polydegree", CP_NUM, (char *) &polydegree)) ||
(polydegree < 0))
if (!cp_getvar("polydegree", CP_NUM, &polydegree) || polydegree < 0)
polydegree = 1;
if ((!cp_getvar("fourgridsize", CP_NUM, (char *) &fourgridsize)) ||
(fourgridsize < 1))
if (!cp_getvar("fourgridsize", CP_NUM, &fourgridsize) || fourgridsize < 1)
fourgridsize = DEF_FOURGRIDSIZE;
time = current_plot->pl_scale;

2
src/frontend/inp.c

@ -513,7 +513,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
cp_vset("pretemp", CP_REAL, &temperature_value );
}
if (ft_ngdebug) {
cp_getvar( "pretemp", CP_REAL, (double *) &testemp );
cp_getvar("pretemp", CP_REAL, &testemp);
printf("test temperature %f\n", testemp);
}
/* We are done handling the control stuff. Now process remainder of deck.

2
src/frontend/inpcom.c

@ -199,7 +199,7 @@ inp_pathopen(char *name, char *mode)
* do an fopen.
*/
if (index(name, DIR_TERM)
|| !cp_getvar("sourcepath", CP_LIST, (char *) &v))
|| !cp_getvar("sourcepath", CP_LIST, &v))
return (fopen(name, mode));
while (v) {

1
src/frontend/numparam/general.h

@ -33,7 +33,6 @@ int length(char * s);
bool steq(char * s, char * t);
bool stne(char * s, char * t);
void stri(long n, SPICE_DSTRINGPTR s);
int posi (char *sub, char *s, int opt);
char upcase(char c);
char lowcase(char c);

4
src/frontend/plotting/agraf.c

@ -67,10 +67,10 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
if ((xscale->v_gridtype == GRID_YLOG) ||
(xscale->v_gridtype == GRID_LOGLOG))
ylogscale = TRUE;
if (!cp_getvar("width", CP_NUM, (char *) &maxy)) {
if (!cp_getvar("width", CP_NUM, &maxy)) {
maxy = DEF_WIDTH;
}
if (!cp_getvar("height", CP_NUM, (char *) &height))
if (!cp_getvar("height", CP_NUM, &height))
height = DEF_HEIGHT;
if (ft_nopage)
nobreakp = TRUE;

4
src/frontend/plotting/graf.c

@ -107,7 +107,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
if (!cp_getvar("pointchars", CP_STRING, pointchars))
(void) strcpy(pointchars, DEFPOINTCHARS);
if (!cp_getvar("ticmarks", CP_NUM, (char *) &graph->ticmarks)) {
if (!cp_getvar("ticmarks", CP_NUM, &graph->ticmarks)) {
if (cp_getvar("ticmarks", CP_BOOL, NULL))
graph->ticmarks = 10;
else
@ -313,7 +313,7 @@ gr_point(struct dvec *dv,
break;
case PLOT_POINT:
/* Here, gi_linestyle is the character used for the point. */
pointc[0] = dv->v_linestyle;
pointc[0] = (char) dv->v_linestyle;
pointc[1] = '\0';
DevDrawText(pointc, (int) (tox - currentgraph->fontwidth / 2),
(int) (toy - currentgraph->fontheight / 2));

6
src/frontend/plotting/plotcurv.c

@ -41,7 +41,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
if (nostart) {
degree = currentgraph->degree;
} else {
if (!cp_getvar("polydegree", CP_NUM, (char *) &degree))
if (!cp_getvar("polydegree", CP_NUM, &degree))
degree = 1;
currentgraph->degree = degree;
}
@ -53,7 +53,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
return;
}
if (!cp_getvar("gridsize", CP_NUM, (char *) &gridsize))
if (!cp_getvar("gridsize", CP_NUM, &gridsize))
gridsize = 0;
if ((gridsize < 0) || (gridsize > 10000)) {
fprintf(cp_err, "Error: bad grid size %d\n", gridsize);
@ -318,7 +318,7 @@ plotinterval(struct dvec *v, double lo, double hi, register double *coeffs, int
/* This is a problem -- how do we know what granularity to use? If
* the guy cares about this he will use gridsize.
*/
if (!cp_getvar("polysteps", CP_NUM, (char *) &steps))
if (!cp_getvar("polysteps", CP_NUM, &steps))
steps = GRANULARITY;
incr = (hi - lo) / (double) (steps + 1);

4
src/frontend/postcoms.c

@ -215,7 +215,7 @@ com_print(wordlist *wl)
} //end if (v->v_rlength == 1)
}
} else { /* Print in columns. */
if (cp_getvar("width", CP_NUM, (char *) &i))
if (cp_getvar("width", CP_NUM, &i))
width = i;
if (width < 40)
width = 40;
@ -223,7 +223,7 @@ com_print(wordlist *wl)
buf = TREALLOC(char, buf, width + 1);
buf2 = TREALLOC(char, buf2, width + 1);
}
if (cp_getvar("height", CP_NUM, (char *) &i))
if (cp_getvar("height", CP_NUM, &i))
height = i;
if (height < 20)
height = 20;

4
src/frontend/terminal.c

@ -114,9 +114,9 @@ out_init(void)
#endif
if (!xsize)
(void) cp_getvar("width", CP_NUM, (char *) &xsize);
(void) cp_getvar("width", CP_NUM, &xsize);
if (!ysize)
(void) cp_getvar("height", CP_NUM, (char *) &ysize);
(void) cp_getvar("height", CP_NUM, &ysize);
if (!xsize)
xsize = DEF_SCRWIDTH;

2
src/frontend/wdisp/windisp.c

@ -821,7 +821,7 @@ int WIN_Text( char * text, int x, int y)
if (!cp_getvar("wfont", CP_STRING, lf.lfFaceName)) {
(void) lstrcpy(lf.lfFaceName, DEF_FONTW);
}
if (!cp_getvar("wfont_size", CP_NUM, (char *) &(lf.lfHeight))) {
if (!cp_getvar("wfont_size", CP_NUM, &(lf.lfHeight))) {
lf.lfHeight = (int) (1.1 * currentgraph->fontheight) ;
}

4
src/maths/cmaths/cmath4.c

@ -207,7 +207,7 @@ cx_interpolate(void *data, short int type, int length, int *newlength, short int
*newlength = ns->v_length;
d = alloc_d(ns->v_length);
if (!cp_getvar("polydegree", CP_NUM, (void *) &degree))
if (!cp_getvar("polydegree", CP_NUM, &degree))
degree = 1;
for (base = 0; base < length; base += grouping) {
@ -241,7 +241,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt
return (NULL);
}
if (!cp_getvar("dpolydegree", CP_NUM, (void *) &degree))
if (!cp_getvar("dpolydegree", CP_NUM, &degree))
degree = 2; /* default quadratic */
n = degree + 1;

3
src/spicelib/devices/bsim3/b3par.c

@ -28,7 +28,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM3_W:

2
src/spicelib/devices/bsim3/b3set.c

@ -1014,7 +1014,7 @@ if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
}
}
#ifdef USE_OMP3
if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads))
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);

2
src/spicelib/devices/bsim3soi/b4soiset.c

@ -2671,7 +2671,7 @@ if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
}
#ifdef USE_OMP4SOI
if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads))
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);

3
src/spicelib/devices/bsim3v0/b3v0par.c

@ -20,7 +20,8 @@ BSIM3v0param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM3v0_W:

3
src/spicelib/devices/bsim3v1/b3v1par.c

@ -26,7 +26,8 @@ BSIM3v1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM3v1_W:

3
src/spicelib/devices/bsim3v32/b3v32par.c

@ -25,7 +25,8 @@ BSIM3v32param (int param, IFvalue *value, GENinstance *inst, IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM3v32_W:

3
src/spicelib/devices/bsim4/b4par.c

@ -34,7 +34,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM4_W:

2
src/spicelib/devices/bsim4/b4set.c

@ -2386,7 +2386,7 @@ if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
} /* end of loop through all the BSIM4 device models */
#ifdef USE_OMP4
if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads))
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
nthreads = 2;
omp_set_num_threads(nthreads);

3
src/spicelib/devices/bsim4v2/b4v2par.c

@ -27,7 +27,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM4v2_W:

3
src/spicelib/devices/bsim4v3/b4v3par.c

@ -30,7 +30,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM4v3_W:

3
src/spicelib/devices/bsim4v4/b4v4par.c

@ -31,7 +31,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM4v4_W:

3
src/spicelib/devices/bsim4v5/b4v5par.c

@ -32,7 +32,8 @@ IFvalue *select)
NG_IGNORE(select);
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
switch(param)
{ case BSIM4v5_W:

3
src/spicelib/devices/cktbindnode.c

@ -8,6 +8,7 @@ Author: 1985 Thomas L. Quarles
* bind a node of the specified device of the given type to its place
* in the specified circuit. */
#include "ngspice.h"
#include <config.h>
#include <stdio.h>
#include <devdefs.h>
@ -18,6 +19,8 @@ Author: 1985 Thomas L. Quarles
int
CKTbindNode(CKTcircuit *ckt, GENinstance *fast, int term, CKTnode *node)
{
NG_IGNORE(ckt);
int mappednode;
SPICEdev **devs;
GENinstance *instance = /*fixme*/ fast;

2
src/spicelib/devices/dev.c

@ -29,6 +29,7 @@
* HAVE NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS. */
#include "ngspice.h"
#include "config.h"
#include "assert.h"
@ -483,6 +484,7 @@ int load_opus(char *name){
void *dlopen(const char *name,int type)
{
NG_IGNORE(type);
return LoadLibrary(name);
}

3
src/spicelib/parser/inpgmod.c

@ -204,7 +204,8 @@ INPgetModBin( CKTcircuit* ckt, char* name, INPmodel** model, INPtables* tab, cha
int error;
double scale;
if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1;
if (!cp_getvar("scale", CP_REAL, &scale))
scale = 1;
*model = NULL;

Loading…
Cancel
Save