Browse Source

variables, lift plot_cur->pl_env up to the invoker of cp_usrvars()

pre-master-46
rlar 10 years ago
parent
commit
bc325b17c5
  1. 4
      src/frontend/options.c
  2. 18
      src/frontend/variable.c
  3. 1
      src/ngsconvert.c

4
src/frontend/options.c

@ -100,14 +100,14 @@ cp_enqvar(char *word)
} }
/* Return the plot and ckt env vars, $plots, and $curplot{name,title,date,} */
/* Return $plots, $curplot, $curplottitle, $curplotname, $curplotdate */
struct variable * struct variable *
cp_usrvars(void) cp_usrvars(void)
{ {
struct variable *v, *tv; struct variable *v, *tv;
v = plot_cur ? plot_cur->pl_env : NULL;
v = NULL;
if ((tv = cp_enqvar("plots")) != NULL) { if ((tv = cp_enqvar("plots")) != NULL) {
tv->va_next = v; tv->va_next = v;

18
src/frontend/variable.c

@ -418,6 +418,11 @@ cp_remvar(char *varname)
if (eq((*p)->va_name, varname)) if (eq((*p)->va_name, varname))
break; break;
if (*p == NULL && plot_cur)
for (p = &plot_cur->pl_env; *p; p = &(*p)->va_next)
if (eq((*p)->va_name, varname))
break;
if (*p == NULL && ft_curckt) if (*p == NULL && ft_curckt)
for (p = &ft_curckt->ci_vars; *p; p = &(*p)->va_next) for (p = &ft_curckt->ci_vars; *p; p = &(*p)->va_next)
if (eq((*p)->va_name, varname)) if (eq((*p)->va_name, varname))
@ -525,6 +530,11 @@ cp_getvar(char *name, enum cp_types type, void *retval)
if (eq(name, v->va_name)) if (eq(name, v->va_name))
break; break;
if (!v && plot_cur)
for (v = plot_cur->pl_env; v; v = v->va_next)
if (eq(name, v->va_name))
break;
if (!v && ft_curckt) if (!v && ft_curckt)
for (v = ft_curckt->ci_vars; v; v = v->va_next) for (v = ft_curckt->ci_vars; v; v = v->va_next)
if (eq(name, v->va_name)) if (eq(name, v->va_name))
@ -882,6 +892,9 @@ cp_vprint(void)
i++; i++;
for (v = uv1; v; v = v->va_next) for (v = uv1; v; v = v->va_next)
i++; i++;
if (plot_cur)
for (v = plot_cur->pl_env; v; v = v->va_next)
i++;
if (ft_curckt) if (ft_curckt)
for (v = ft_curckt->ci_vars; v; v = v->va_next) for (v = ft_curckt->ci_vars; v; v = v->va_next)
i++; i++;
@ -897,6 +910,11 @@ cp_vprint(void)
vars[i].x_v = v; vars[i].x_v = v;
vars[i].x_char = '*'; vars[i].x_char = '*';
} }
if (plot_cur)
for (v = plot_cur->pl_env; v; v = v->va_next, i++) {
vars[i].x_v = v;
vars[i].x_char = '*';
}
if (ft_curckt) if (ft_curckt)
for (v = ft_curckt->ci_vars; v; v = v->va_next, i++) { for (v = ft_curckt->ci_vars; v; v = v->va_next, i++) {
vars[i].x_v = v; vars[i].x_v = v;

1
src/ngsconvert.c

@ -31,6 +31,7 @@ bool cp_nocc = TRUE;
bool ft_stricterror = FALSE; bool ft_stricterror = FALSE;
bool ft_parsedb = FALSE; bool ft_parsedb = FALSE;
struct circ *ft_curckt = NULL; struct circ *ft_curckt = NULL;
struct plot *plot_cur = NULL;
char *cp_program = "sconvert"; char *cp_program = "sconvert";

Loading…
Cancel
Save