rlar 14 years ago
parent
commit
fee664bc19
  1. 32
      src/frontend/cpitf.c
  2. 26
      src/frontend/mw_coms.c

32
src/frontend/cpitf.c

@ -155,21 +155,21 @@ ft_cpinit(void)
/* Make the prompt use only the last component of the path... */ /* Make the prompt use only the last component of the path... */
if (DIR_TERM) { if (DIR_TERM) {
for (s = cp_program; s && *s; s++)
;
s--;
while ((s > cp_program) && (*s != DIR_TERM))
s--;
if (*s == DIR_TERM)
s++;
(void) strcpy(buf, s);
for (s = buf; *s && (*s != '.'); s++)
;
*s = '\0';
(void) strcat(buf, " ! -> ");
for (s = cp_program; s && *s; s++)
;
s--;
while ((s > cp_program) && (*s != DIR_TERM))
s--;
if (*s == DIR_TERM)
s++;
(void) strcpy(buf, s);
for (s = buf; *s && (*s != '.'); s++)
;
*s = '\0';
(void) strcat(buf, " ! -> ");
} else { } else {
(void) sprintf(buf, "%s ! -> ", cp_program);
(void) sprintf(buf, "%s ! -> ", cp_program);
} }
cp_vset("prompt", CP_STRING, buf); cp_vset("prompt", CP_STRING, buf);
@ -318,14 +318,14 @@ cp_istrue(wordlist *wl)
if (v->v_realdata[i] != 0.0) { if (v->v_realdata[i] != 0.0) {
free_pnode(pn); free_pnode(pn);
return (TRUE); return (TRUE);
}
}
} else { } else {
for (i = 0; i < v->v_length; i++) for (i = 0; i < v->v_length; i++)
if ((realpart(v->v_compdata[i]) != 0.0) || if ((realpart(v->v_compdata[i]) != 0.0) ||
(imagpart(v->v_compdata[i]) != 0.0)) { (imagpart(v->v_compdata[i]) != 0.0)) {
free_pnode(pn);
free_pnode(pn);
return (TRUE); return (TRUE);
}
}
} }
free_pnode(pn); free_pnode(pn);

26
src/frontend/mw_coms.c

@ -1,4 +1,4 @@
/* Michael Widlok 2 Jun 1999 */
/* Michael Widlok 2 Jun 1999 */
/* New commands for unloading circuits */ /* New commands for unloading circuits */
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
@ -41,8 +41,8 @@ com_removecirc(wordlist *wl)
if_cktfree(ct->ci_ckt, ct->ci_symtab); if_cktfree(ct->ci_ckt, ct->ci_symtab);
for (v = ct->ci_vars; v; v = next) { for (v = ct->ci_vars; v; v = next) {
next = v->va_next;
tfree(v);
next = v->va_next;
tfree(v);
} }
/* PN FTESTATS*/ /* PN FTESTATS*/
@ -54,7 +54,7 @@ com_removecirc(wordlist *wl)
/* The circuit being removed is the first loaded and you have more circuits */ /* The circuit being removed is the first loaded and you have more circuits */
if (ft_curckt == ft_circuits && ft_circuits->ci_next) if (ft_curckt == ft_circuits && ft_circuits->ci_next)
ft_circuits = ft_circuits->ci_next;
ft_circuits = ft_circuits->ci_next;
/* The circuit being removed id the first loaded and there are no more circuits */ /* The circuit being removed id the first loaded and there are no more circuits */
else if (ft_circuits->ci_next == NULL) else if (ft_circuits->ci_next == NULL)
@ -85,21 +85,21 @@ com_removecirc(wordlist *wl)
plot_list = NULL; plot_list = NULL;
else if (plot_list && plot_list->pl_next) { else if (plot_list && plot_list->pl_next) {
p = plot_list;
while (p) {
p = plot_list;
while (p) {
auxPlot = 1; auxPlot = 1;
/* If the plot is in the first position */ /* If the plot is in the first position */
if (plot_list->pl_next && strcmp(plot_list->pl_title, namecircuit) == 0) if (plot_list->pl_next && strcmp(plot_list->pl_title, namecircuit) == 0)
plot_list = plot_list->pl_next; plot_list = plot_list->pl_next;
/* otherwise we run over the list of plots */
/* otherwise we run over the list of plots */
else { else {
for (; strcmp(p->pl_title, namecircuit) != 0 && p->pl_next; p = p->pl_next) for (; strcmp(p->pl_title, namecircuit) != 0 && p->pl_next; p = p->pl_next)
auxPlot++; auxPlot++;
if (strcmp(p->pl_title, namecircuit) == 0) { if (strcmp(p->pl_title, namecircuit) == 0) {
paux = plot_list; paux = plot_list;
for (i = 1; i < auxPlot-1; i++)
for (i = 1; i < auxPlot-1; i++)
paux = paux->pl_next; paux = paux->pl_next;
paux->pl_next = paux->pl_next->pl_next;
paux->pl_next = paux->pl_next->pl_next;
} }
} }
p = p->pl_next; p = p->pl_next;
@ -113,18 +113,18 @@ com_removecirc(wordlist *wl)
if (ft_circuits && caux->ci_next) { if (ft_circuits && caux->ci_next) {
struct wordlist *wlist; struct wordlist *wlist;
sprintf(buf, "%d", auxCir);
sprintf(buf, "%d", auxCir);
wlist = wl_cons(copy(buf), NULL); wlist = wl_cons(copy(buf), NULL);
com_scirc(wlist);
com_scirc(wlist);
wl_free(wlist); wl_free(wlist);
} }
else if (ft_circuits) { else if (ft_circuits) {
struct wordlist *wlist; struct wordlist *wlist;
sprintf(buf, "%d", auxCir-1); sprintf(buf, "%d", auxCir-1);
wlist = wl_cons(copy(buf), NULL); wlist = wl_cons(copy(buf), NULL);
com_scirc(wlist);
com_scirc(wlist);
wl_free(wlist); wl_free(wlist);
} }
else else
ft_curckt = NULL;
ft_curckt = NULL;
} }
Loading…
Cancel
Save