From 55638c8023d294db9c67f190c29a9f1120b97c17 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 30 Apr 2011 12:29:19 +0000 Subject: [PATCH] various cleanups --- ChangeLog | 8 ++++++++ src/frontend/com_ghelp.c | 6 +++--- src/frontend/device.c | 4 ++-- src/frontend/diff.c | 6 +++--- src/frontend/fourier.c | 8 +++----- src/frontend/inp.c | 2 +- src/frontend/inpcom.c | 2 +- src/frontend/numparam/general.h | 1 - src/frontend/plotting/agraf.c | 4 ++-- src/frontend/plotting/graf.c | 4 ++-- src/frontend/plotting/plotcurv.c | 6 +++--- src/frontend/postcoms.c | 4 ++-- src/frontend/terminal.c | 4 ++-- src/frontend/wdisp/windisp.c | 2 +- src/maths/cmaths/cmath4.c | 4 ++-- src/spicelib/devices/bsim3/b3par.c | 3 ++- src/spicelib/devices/bsim3/b3set.c | 2 +- src/spicelib/devices/bsim3soi/b4soiset.c | 2 +- src/spicelib/devices/bsim3v0/b3v0par.c | 3 ++- src/spicelib/devices/bsim3v1/b3v1par.c | 3 ++- src/spicelib/devices/bsim3v32/b3v32par.c | 3 ++- src/spicelib/devices/bsim4/b4par.c | 3 ++- src/spicelib/devices/bsim4/b4set.c | 2 +- src/spicelib/devices/bsim4v2/b4v2par.c | 3 ++- src/spicelib/devices/bsim4v3/b4v3par.c | 3 ++- src/spicelib/devices/bsim4v4/b4v4par.c | 3 ++- src/spicelib/devices/bsim4v5/b4v5par.c | 3 ++- src/spicelib/devices/cktbindnode.c | 3 +++ src/spicelib/devices/dev.c | 2 ++ src/spicelib/parser/inpgmod.c | 3 ++- 30 files changed, 63 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7799c7ba..55c880dd7 100644 --- a/ChangeLog +++ b/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 : diff --git a/src/frontend/com_ghelp.c b/src/frontend/com_ghelp.c index 2506e65cb..f194d05af 100644 --- a/src/frontend/com_ghelp.c +++ b/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); diff --git a/src/frontend/device.c b/src/frontend/device.c index fa25aa8e3..0c2a35039 100644 --- a/src/frontend/device.c +++ b/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); diff --git a/src/frontend/diff.c b/src/frontend/diff.c index be242426c..cac326c6f 100644 --- a/src/frontend/diff.c +++ b/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. */ diff --git a/src/frontend/fourier.c b/src/frontend/fourier.c index 89842f49a..150507a90 100644 --- a/src/frontend/fourier.c +++ b/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; diff --git a/src/frontend/inp.c b/src/frontend/inp.c index a04d0695b..090a81362 100644 --- a/src/frontend/inp.c +++ b/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. diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index ad7012feb..369c908ae 100644 --- a/src/frontend/inpcom.c +++ b/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) { diff --git a/src/frontend/numparam/general.h b/src/frontend/numparam/general.h index 242a716b0..fb7d84fc4 100644 --- a/src/frontend/numparam/general.h +++ b/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); diff --git a/src/frontend/plotting/agraf.c b/src/frontend/plotting/agraf.c index 630551c26..e0cd0ef9d 100644 --- a/src/frontend/plotting/agraf.c +++ b/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; diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index ca32290fe..4da043057 100644 --- a/src/frontend/plotting/graf.c +++ b/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)); diff --git a/src/frontend/plotting/plotcurv.c b/src/frontend/plotting/plotcurv.c index a56b87030..70d751a4e 100644 --- a/src/frontend/plotting/plotcurv.c +++ b/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 *) °ree)) + if (!cp_getvar("polydegree", CP_NUM, °ree)) 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); diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index b5cfb26cc..aba9c0b62 100644 --- a/src/frontend/postcoms.c +++ b/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; diff --git a/src/frontend/terminal.c b/src/frontend/terminal.c index 20375ea46..907014b09 100644 --- a/src/frontend/terminal.c +++ b/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; diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index f20291976..dfd8a285c 100644 --- a/src/frontend/wdisp/windisp.c +++ b/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) ; } diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 06209b069..02a0590d9 100644 --- a/src/maths/cmaths/cmath4.c +++ b/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 *) °ree)) + if (!cp_getvar("polydegree", CP_NUM, °ree)) 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 *) °ree)) + if (!cp_getvar("dpolydegree", CP_NUM, °ree)) degree = 2; /* default quadratic */ n = degree + 1; diff --git a/src/spicelib/devices/bsim3/b3par.c b/src/spicelib/devices/bsim3/b3par.c index cc105174b..2b06cf40d 100644 --- a/src/spicelib/devices/bsim3/b3par.c +++ b/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: diff --git a/src/spicelib/devices/bsim3/b3set.c b/src/spicelib/devices/bsim3/b3set.c index 1ba68adbd..16fd6c8e6 100644 --- a/src/spicelib/devices/bsim3/b3set.c +++ b/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); diff --git a/src/spicelib/devices/bsim3soi/b4soiset.c b/src/spicelib/devices/bsim3soi/b4soiset.c index b1a3f8f24..1db61c5af 100644 --- a/src/spicelib/devices/bsim3soi/b4soiset.c +++ b/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); diff --git a/src/spicelib/devices/bsim3v0/b3v0par.c b/src/spicelib/devices/bsim3v0/b3v0par.c index 63907b7e3..a3314d4f4 100644 --- a/src/spicelib/devices/bsim3v0/b3v0par.c +++ b/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: diff --git a/src/spicelib/devices/bsim3v1/b3v1par.c b/src/spicelib/devices/bsim3v1/b3v1par.c index 7d1349acb..e5d396e3a 100644 --- a/src/spicelib/devices/bsim3v1/b3v1par.c +++ b/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: diff --git a/src/spicelib/devices/bsim3v32/b3v32par.c b/src/spicelib/devices/bsim3v32/b3v32par.c index 951465868..aa5a9e269 100644 --- a/src/spicelib/devices/bsim3v32/b3v32par.c +++ b/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: diff --git a/src/spicelib/devices/bsim4/b4par.c b/src/spicelib/devices/bsim4/b4par.c index 166cfc948..2cb309ede 100644 --- a/src/spicelib/devices/bsim4/b4par.c +++ b/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: diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 029d00488..4279263b1 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/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); diff --git a/src/spicelib/devices/bsim4v2/b4v2par.c b/src/spicelib/devices/bsim4v2/b4v2par.c index 77e55ad01..d2638f637 100644 --- a/src/spicelib/devices/bsim4v2/b4v2par.c +++ b/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: diff --git a/src/spicelib/devices/bsim4v3/b4v3par.c b/src/spicelib/devices/bsim4v3/b4v3par.c index a11fc5ce0..9cc901af9 100644 --- a/src/spicelib/devices/bsim4v3/b4v3par.c +++ b/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: diff --git a/src/spicelib/devices/bsim4v4/b4v4par.c b/src/spicelib/devices/bsim4v4/b4v4par.c index e28c5cc13..4c88cc977 100644 --- a/src/spicelib/devices/bsim4v4/b4v4par.c +++ b/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: diff --git a/src/spicelib/devices/bsim4v5/b4v5par.c b/src/spicelib/devices/bsim4v5/b4v5par.c index 2f7b7969f..428888605 100644 --- a/src/spicelib/devices/bsim4v5/b4v5par.c +++ b/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: diff --git a/src/spicelib/devices/cktbindnode.c b/src/spicelib/devices/cktbindnode.c index 88effcbd2..d5f55bbee 100644 --- a/src/spicelib/devices/cktbindnode.c +++ b/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 #include #include @@ -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; diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index dafcf508c..7598c86c3 100644 --- a/src/spicelib/devices/dev.c +++ b/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); } diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index 760eda5ec..cea929f13 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/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;