command 'remcirc'

This commit is contained in:
h_vogt 2011-07-19 23:06:29 +00:00
parent b998b92720
commit dea300d88d
5 changed files with 69 additions and 5 deletions

View File

@ -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
* src/frontend/plotting/plotit.c :
cleanup, `getlims()' has to be used with number arg >= 1

View File

@ -389,6 +389,10 @@ struct comm spcp_coms[] = {
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 1,
NULL,
"[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,
{ 0, 0, 0, 0 }, E_DEFHMASK, 0, 0,
NULL,

View File

@ -1,11 +1,13 @@
#include <ngspice.h>
#include "plotting.h"
#include "../../conf.h"
/* Where 'constants' go when defined on initialization. */
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
} ;

View File

@ -27,13 +27,13 @@ $Id$
#define RAWBUF_SIZE 32768
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
* equivalent of "run".
*/
/* ARGSUSED */
/* This is a hack to tell iplot routine to redraw the grid and initialize
the display device
*/
@ -168,7 +168,6 @@ com_resume(wordlist *wl)
* should be obsolete.
*/
/* ARGSUSED */
void
com_rset(wordlist *wl)
{
@ -193,3 +192,58 @@ com_rset(wordlist *wl)
TRUE, ft_curckt->ci_options, ft_curckt->ci_filename);
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;
}

View File

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