Add const to some parameters, made function static
This commit is contained in:
parent
aee256e211
commit
33bb874678
|
|
@ -17,7 +17,9 @@ Author: 1987 Jeffrey M. Hsu
|
||||||
#include "variable.h"
|
#include "variable.h"
|
||||||
|
|
||||||
|
|
||||||
static void common(char *string, struct wordlist *wl, struct comm *command);
|
static void common(const char *string, const struct wordlist *wl,
|
||||||
|
const struct comm *command);
|
||||||
|
static int countargs(const wordlist *wl);
|
||||||
|
|
||||||
|
|
||||||
/* returns a private copy of the string */
|
/* returns a private copy of the string */
|
||||||
|
|
@ -39,11 +41,10 @@ prompt(FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int countargs(const wordlist *wl)
|
||||||
countargs(wordlist *wl)
|
|
||||||
{
|
{
|
||||||
int number = 0;
|
int number = 0;
|
||||||
wordlist *w;
|
const wordlist *w;
|
||||||
|
|
||||||
for (w = wl; w; w = w->wl_next)
|
for (w = wl; w; w = w->wl_next)
|
||||||
number++;
|
number++;
|
||||||
|
|
@ -63,42 +64,42 @@ process(wordlist *wlist)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arg_print(wordlist *wl, struct comm *command)
|
arg_print(const wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
common("which variable", wl, command);
|
common("which variable", wl, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arg_plot(wordlist *wl, struct comm *command)
|
arg_plot(const wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
common("which variable", wl, command);
|
common("which variable", wl, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arg_load(wordlist *wl, struct comm *command)
|
arg_load(wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
/* just call com_load */
|
/* just call com_load */
|
||||||
command->co_func(wl);
|
command->co_func(wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void arg_let(wordlist *wl, struct comm *command)
|
void arg_let(const wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
common("which vector", wl, command);
|
common("which vector", wl, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arg_set(wordlist *wl, struct comm *command)
|
arg_set(const wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
common("which variable", wl, command);
|
common("which variable", wl, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
arg_display(wordlist *wl, struct comm *command)
|
arg_display(const wordlist *wl, const struct comm *command)
|
||||||
{
|
{
|
||||||
NG_IGNORE(wl);
|
NG_IGNORE(wl);
|
||||||
NG_IGNORE(command);
|
NG_IGNORE(command);
|
||||||
|
|
@ -108,8 +109,8 @@ arg_display(wordlist *wl, struct comm *command)
|
||||||
|
|
||||||
|
|
||||||
/* a common prompt routine */
|
/* a common prompt routine */
|
||||||
static void
|
static void common(const char *string, const struct wordlist *wl,
|
||||||
common(char *string, struct wordlist *wl, struct comm *command)
|
const struct comm *command)
|
||||||
{
|
{
|
||||||
struct wordlist *w;
|
struct wordlist *w;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
@ -125,11 +126,11 @@ common(char *string, struct wordlist *wl, struct comm *command)
|
||||||
/* O.K. now call fn */
|
/* O.K. now call fn */
|
||||||
command->co_func(w);
|
command->co_func(w);
|
||||||
}
|
}
|
||||||
}
|
} /* end of function common */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
outmenuprompt(char *string)
|
outmenuprompt(const char *string)
|
||||||
{
|
{
|
||||||
fprintf(cp_out, "%s: ", string);
|
fprintf(cp_out, "%s: ", string);
|
||||||
fflush(cp_out);
|
fflush(cp_out);
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,14 @@
|
||||||
#define ngspice_ARG_H
|
#define ngspice_ARG_H
|
||||||
|
|
||||||
char *prompt(FILE *fp);
|
char *prompt(FILE *fp);
|
||||||
int countargs(wordlist *wl);
|
|
||||||
wordlist *process(wordlist *wlist);
|
wordlist *process(wordlist *wlist);
|
||||||
void arg_print(wordlist *wl, struct comm *command);
|
void arg_print(const wordlist *wl, const struct comm *command);
|
||||||
void arg_plot(wordlist *wl, struct comm *command);
|
void arg_plot(const wordlist *wl, const struct comm *command);
|
||||||
void arg_load(wordlist *wl, struct comm *command);
|
void arg_load(wordlist *wl, const struct comm *command);
|
||||||
void arg_let(wordlist *wl, struct comm *command);
|
void arg_let(const wordlist *wl, const struct comm *command);
|
||||||
void arg_set(wordlist *wl, struct comm *command);
|
void arg_set(const wordlist *wl, const struct comm *command);
|
||||||
void arg_display(wordlist *wl, struct comm *command);
|
void arg_display(const wordlist *wl, const struct comm *command);
|
||||||
void outmenuprompt(char *string);
|
void outmenuprompt(const char *string);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ typedef enum AnalysisType {
|
||||||
AT_ERR, AT_ERR1, AT_ERR2, AT_ERR3, AT_MIN_AT, AT_MAX_AT
|
AT_ERR, AT_ERR1, AT_ERR2, AT_ERR3, AT_MIN_AT, AT_MAX_AT
|
||||||
} ANALYSIS_TYPE_T;
|
} ANALYSIS_TYPE_T;
|
||||||
|
|
||||||
|
static void measure_errMessage(const char *mName, const char *mFunction,
|
||||||
|
const char *trigTarg, const char *errMsg, int chk_only);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** return precision (either 5 or value of environment variable NGSPICE_MEAS_PRECISION) */
|
/** return precision (either 5 or value of environment variable NGSPICE_MEAS_PRECISION) */
|
||||||
int
|
int
|
||||||
|
|
@ -69,8 +73,8 @@ measure_get_precision(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void measure_errMessage(const char *mName, const char *mFunction,
|
||||||
measure_errMessage(char *mName, char *mFunction, char *trigTarg, char *errMsg, int chk_only)
|
const char *trigTarg, const char *errMsg, int chk_only)
|
||||||
{
|
{
|
||||||
if (!chk_only) {
|
if (!chk_only) {
|
||||||
printf("\nError: measure %s %s(%s) : ", mName, mFunction, trigTarg);
|
printf("\nError: measure %s %s(%s) : ", mName, mFunction, trigTarg);
|
||||||
|
|
|
||||||
|
|
@ -328,9 +328,9 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
||||||
|
|
||||||
out_printf("%s\n%s\n", line1, line2);
|
out_printf("%s\n%s\n", line1, line2);
|
||||||
|
|
||||||
tfree(field);
|
txfree(field);
|
||||||
tfree(line1);
|
txfree(line1);
|
||||||
tfree(line2);
|
txfree(line2);
|
||||||
if (!novalue)
|
if (!novalue)
|
||||||
tfree(values);
|
txfree(values);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ f_alpha(int n_pts, int n_exp, double X[], double Q_d, double alpha)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tfree(hfa);
|
txfree(hfa);
|
||||||
tfree(wfa);
|
txfree(wfa);
|
||||||
/* fft tables will be freed in vsrcaccept.c and isrcaccept.c
|
/* fft tables will be freed in vsrcaccept.c and isrcaccept.c
|
||||||
fftFree(); */
|
fftFree(); */
|
||||||
fprintf(stdout, "%d 1/f noise values in time domain created\n", n_pts);
|
fprintf(stdout, "%d 1/f noise values in time domain created\n", n_pts);
|
||||||
|
|
@ -247,6 +247,6 @@ trnoise_state_free(struct trnoise_state *this)
|
||||||
{
|
{
|
||||||
if (!this)
|
if (!this)
|
||||||
return;
|
return;
|
||||||
tfree(this->oneof);
|
txfree(this->oneof);
|
||||||
tfree(this);
|
txfree(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ ACan(CKTcircuit *ckt, int restart)
|
||||||
NULL, IF_REAL,
|
NULL, IF_REAL,
|
||||||
numNames, nameList, IF_REAL,
|
numNames, nameList, IF_REAL,
|
||||||
&acPlot);
|
&acPlot);
|
||||||
tfree(nameList);
|
txfree(nameList);
|
||||||
|
|
||||||
ipc_send_dcop_prefix();
|
ipc_send_dcop_prefix();
|
||||||
CKTdump(ckt, 0.0, acPlot);
|
CKTdump(ckt, 0.0, acPlot);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ extern int ASRCload(GENmodel *, CKTcircuit *);
|
||||||
extern int ASRCparam(int, IFvalue *, GENinstance *, IFvalue *);
|
extern int ASRCparam(int, IFvalue *, GENinstance *, IFvalue *);
|
||||||
extern int ASRCpzLoad(GENmodel *, CKTcircuit *, SPcomplex *);
|
extern int ASRCpzLoad(GENmodel *, CKTcircuit *, SPcomplex *);
|
||||||
extern int ASRCacLoad(GENmodel *, CKTcircuit *);
|
extern int ASRCacLoad(GENmodel *, CKTcircuit *);
|
||||||
extern int ASRCsetup(SMPmatrix *, GENmodel *, CKTcircuit *, int *);
|
extern int ASRCsetup(SMPmatrix *, GENmodel *, CKTcircuit *, const int *);
|
||||||
extern int ASRCunsetup(GENmodel *, CKTcircuit *);
|
extern int ASRCunsetup(GENmodel *, CKTcircuit *);
|
||||||
extern int ASRCtemp(GENmodel *, CKTcircuit *);
|
extern int ASRCtemp(GENmodel *, CKTcircuit *);
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ Author: 1987 Kanwar Jit Singh
|
||||||
* pointers needed later for fast matrix loading
|
* pointers needed later for fast matrix loading
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
|
||||||
ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
const int *states)
|
||||||
{
|
{
|
||||||
ASRCinstance *here;
|
ASRCinstance *here;
|
||||||
ASRCmodel *model = (ASRCmodel*) inModel;
|
ASRCmodel *model = (ASRCmodel*) inModel;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue