options.c, whitespace

This commit is contained in:
rlar 2012-08-12 12:43:09 +02:00
parent e93960f9ed
commit a2f58da0d0
1 changed files with 73 additions and 61 deletions

View File

@ -9,7 +9,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
* variables, though, and a few commonly used ones are dealt with here. * variables, though, and a few commonly used ones are dealt with here.
*/ */
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ngspice/cpdefs.h" #include "ngspice/cpdefs.h"
#include "ngspice/ftedefs.h" #include "ngspice/ftedefs.h"
@ -30,6 +29,7 @@ bool ft_acctprint = FALSE, ft_noacctprint = FALSE, ft_listprint = FALSE;
bool ft_nodesprint = FALSE, ft_optsprint = FALSE, ft_noinitprint = FALSE; bool ft_nodesprint = FALSE, ft_optsprint = FALSE, ft_noinitprint = FALSE;
bool ft_ngdebug = FALSE, ft_stricterror = FALSE; bool ft_ngdebug = FALSE, ft_stricterror = FALSE;
/* The user-supplied routine to query the values of variables. This /* The user-supplied routine to query the values of variables. This
* recognises the $&varname notation, and also searches the values of * recognises the $&varname notation, and also searches the values of
* plot and circuit environment variables. * plot and circuit environment variables.
@ -44,7 +44,9 @@ cp_enqvar(char *word)
int i; int i;
if (*word == '&') { if (*word == '&') {
word++; word++;
d = vec_get(word); d = vec_get(word);
if (d) { if (d) {
if (d->v_length == 1) { if (d->v_length == 1) {
@ -84,6 +86,7 @@ cp_enqvar(char *word)
} else } else
return (NULL); return (NULL);
} }
if (plot_cur) { if (plot_cur) {
for (vv = plot_cur->pl_env; vv; vv = vv->va_next) for (vv = plot_cur->pl_env; vv; vv = vv->va_next)
if (eq(vv->va_name, word)) if (eq(vv->va_name, word))
@ -133,6 +136,7 @@ cp_enqvar(char *word)
return (vv); return (vv);
} }
} }
if (ft_curckt) { if (ft_curckt) {
for (vv = ft_curckt->ci_vars; vv; vv = vv->va_next) for (vv = ft_curckt->ci_vars; vv; vv = vv->va_next)
if (eq(vv->va_name, word)) if (eq(vv->va_name, word))
@ -140,9 +144,11 @@ cp_enqvar(char *word)
if (vv) if (vv)
return (vv); return (vv);
} }
return (NULL); return (NULL);
} }
/* Return the plot and ckt env vars, $plots, and $curplot{name,title,date,} */ /* Return the plot and ckt env vars, $plots, and $curplot{name,title,date,} */
void void
@ -154,6 +160,7 @@ cp_usrvars(struct variable **v1, struct variable **v2)
v = plot_cur->pl_env; v = plot_cur->pl_env;
else else
v = NULL; v = NULL;
if ((tv = cp_enqvar("plots")) != NULL) { if ((tv = cp_enqvar("plots")) != NULL) {
tv->va_next = v; tv->va_next = v;
v = tv; v = tv;
@ -174,6 +181,7 @@ cp_usrvars(struct variable **v1, struct variable **v2)
tv->va_next = v; tv->va_next = v;
v = tv; v = tv;
} }
*v1 = v; *v1 = v;
if (ft_curckt) if (ft_curckt)
*v2 = ft_curckt->ci_vars; *v2 = ft_curckt->ci_vars;
@ -203,9 +211,11 @@ inp_getopts(struct line *deck)
} else } else
last = dd; last = dd;
} }
return (opts); return (opts);
} }
/* Extract the option lines from a comfile (spinit, .spiceinit) */ /* Extract the option lines from a comfile (spinit, .spiceinit) */
struct line * struct line *
inp_getoptsc(char *in_line, struct line *com_options) inp_getoptsc(char *in_line, struct line *com_options)
@ -224,6 +234,7 @@ inp_getoptsc(char *in_line, struct line *com_options)
next->li_linenum = 0; next->li_linenum = 0;
next->li_error = NULL; next->li_error = NULL;
next->li_actual = NULL; next->li_actual = NULL;
/* put new line in front */ /* put new line in front */
if (com_options != NULL) if (com_options != NULL)
next->li_next = com_options; next->li_next = com_options;
@ -311,7 +322,6 @@ cp_usrset(struct variable *var, bool isset)
else else
fprintf(cp_err, "Excuse me??\n"); fprintf(cp_err, "Excuse me??\n");
} else if (eq(var->va_name, "unixcom")) { } else if (eq(var->va_name, "unixcom")) {
cp_dounixcom = isset; cp_dounixcom = isset;
if (isset) { if (isset) {
s = getenv("PATH"); s = getenv("PATH");
@ -320,7 +330,6 @@ cp_usrset(struct variable *var, bool isset)
else else
fprintf(cp_err, "Warning: no PATH in environment.\n"); fprintf(cp_err, "Warning: no PATH in environment.\n");
} }
} else if (eq(var->va_name, "units") && (var->va_type == CP_STRING)) { } else if (eq(var->va_name, "units") && (var->va_type == CP_STRING)) {
if (isset && ((*var->va_string == 'd') || if (isset && ((*var->va_string == 'd') ||
(*var->va_string == 'D'))) (*var->va_string == 'D')))
@ -359,6 +368,7 @@ cp_usrset(struct variable *var, bool isset)
for (tv = plot_cur->pl_env; tv; tv = tv->va_next) for (tv = plot_cur->pl_env; tv; tv = tv->va_next)
if (eq(tv->va_name, var->va_name)) if (eq(tv->va_name, var->va_name))
return (US_READONLY); return (US_READONLY);
/* /*
if (ft_curckt) if (ft_curckt)
for (tv = ft_curckt->ci_vars; tv; tv = tv->va_next) for (tv = ft_curckt->ci_vars; tv; tv = tv->va_next)
@ -411,9 +421,11 @@ cp_usrset(struct variable *var, bool isset)
return US_SIMVAR; return US_SIMVAR;
} else if (if_option(NULL, var->va_name, var->va_type, vv)) } else if (if_option(NULL, var->va_name, var->va_type, vv))
return US_NOSIMVAR; return US_NOSIMVAR;
return (US_OK); return (US_OK);
} }
static void static void
setdb(char *str) setdb(char *str)
{ {