Browse Source

command 'remcirc'

h_vogt 15 years ago
parent
commit
dea300d88d
  1. 4
      ChangeLog
  2. 4
      src/frontend/commands.c
  3. 4
      src/frontend/plotting/plotting.c
  4. 60
      src/frontend/runcoms2.c
  5. 2
      src/frontend/runcoms2.h

4
ChangeLog

@ -1,3 +1,7 @@
2011-07-20 Holger Vogt
* commands.c, runcoms2.c, runcoms2.h:
command 'remcirc': remove the current circuit
2011-07-17 Robert Larice 2011-07-17 Robert Larice
* src/frontend/plotting/plotit.c : * src/frontend/plotting/plotit.c :
cleanup, `getlims()' has to be used with number arg >= 1 cleanup, `getlims()' has to be used with number arg >= 1

4
src/frontend/commands.c

@ -389,6 +389,10 @@ struct comm spcp_coms[] = {
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 1, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 1,
NULL, NULL,
"[number] : Iterate number times, or one." } , "[number] : Iterate number times, or one." } ,
{ "remcirc", com_remcirc, TRUE, TRUE,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL,
": Remove current citcuit." } ,
{ "reset", com_rset, TRUE, TRUE, { "reset", com_rset, TRUE, TRUE,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL, NULL,

4
src/frontend/plotting/plotting.c

@ -1,11 +1,13 @@
#include <ngspice.h> #include <ngspice.h>
#include "plotting.h" #include "plotting.h"
#include "../../conf.h"
/* Where 'constants' go when defined on initialization. */ /* Where 'constants' go when defined on initialization. */
struct plot constantplot = { struct plot constantplot = {
"Constant values", "Sat Aug 16 10:55:15 PDT 1986", "constants",
// "Constant values", "Sat Aug 16 10:55:15 PDT 1986", "constants",
"Constant values", Spice_Build_Date, "constants",
"const", NULL, NULL, NULL, NULL, NULL, NULL, TRUE, 0 "const", NULL, NULL, NULL, NULL, NULL, NULL, TRUE, 0
} ; } ;

60
src/frontend/runcoms2.c

@ -27,13 +27,13 @@ $Id$
#define RAWBUF_SIZE 32768 #define RAWBUF_SIZE 32768
extern char rawfileBuf[RAWBUF_SIZE]; extern char rawfileBuf[RAWBUF_SIZE];
extern void line_free_x(struct line * deck, bool recurse);
#define line_free(line,flag) { line_free_x(line,flag); line = NULL; }
/* Continue a simulation. If there is non in progress, this is the /* Continue a simulation. If there is non in progress, this is the
* equivalent of "run". * equivalent of "run".
*/ */
/* ARGSUSED */
/* This is a hack to tell iplot routine to redraw the grid and initialize /* This is a hack to tell iplot routine to redraw the grid and initialize
the display device the display device
*/ */
@ -168,7 +168,6 @@ com_resume(wordlist *wl)
* should be obsolete. * should be obsolete.
*/ */
/* ARGSUSED */
void void
com_rset(wordlist *wl) com_rset(wordlist *wl)
{ {
@ -193,3 +192,58 @@ com_rset(wordlist *wl)
TRUE, ft_curckt->ci_options, ft_curckt->ci_filename); TRUE, ft_curckt->ci_options, ft_curckt->ci_filename);
return; return;
} }
void
com_remcirc(wordlist *wl)
{
struct variable *v, *next;
struct line *dd; /*in: the spice deck */
struct circ *p, *prev = NULL;
NG_IGNORE(wl);
if (ft_curckt == NULL) {
fprintf(cp_err, "Error: there is no circuit loaded.\n");
return;
}
/* The next lines stem from com_rset */
INPkillMods();
if_cktfree(ft_curckt->ci_ckt, ft_curckt->ci_symtab);
for (v = ft_curckt->ci_vars; v; v = next) {
next = v->va_next;
tfree(v);
}
ft_curckt->ci_vars = NULL;
/* delete the deck in ft_curckt */
dd = ft_curckt->ci_deck;
line_free(dd,TRUE);
if (ft_curckt->ci_name)
tfree(ft_curckt->ci_name);
if (ft_curckt->ci_filename)
tfree(ft_curckt->ci_filename);
/* delete the actual circuit entry from ft_circuits */
for (p = ft_circuits; p; p = p->ci_next) {
if (ft_curckt == p) {
if (prev == NULL) {
ft_circuits = p->ci_next;
tfree(p);
p = NULL;
break;
}
else {
prev->ci_next = p->ci_next;
tfree(p);
p = NULL;
break;
}
}
prev = p;
}
/* make first entry in ft_circuits the actual circuit (or NULL) */
ft_curckt = ft_circuits;
return;
}

2
src/frontend/runcoms2.h

@ -8,6 +8,6 @@
void com_resume(wordlist *wl); void com_resume(wordlist *wl);
void com_rset(wordlist *wl); void com_rset(wordlist *wl);
void com_remcirc(wordlist *wl);
#endif #endif
Loading…
Cancel
Save