Fixed stringutil missing bug.

This commit is contained in:
pnenzi 2001-02-11 20:13:45 +00:00
parent 317c6a2415
commit fd6d0b0723
9 changed files with 156 additions and 6 deletions

View File

@ -33,6 +33,8 @@ libfte_a_SOURCES = \
com_history.h \
com_let.c \
com_let.h \
com_option.c \
com_option.h \
com_plot.c \
com_plot.h \
com_rehash.c \

117
src/frontend/com_option.c Normal file
View File

@ -0,0 +1,117 @@
#include <config.h>
#include "ngspice.h"
#include "cktdefs.h"
#include "ftedefs.h"
#include <bool.h>
#include "circuits.h"
#include <wordlist.h>
#include "variable.h"
/* The option command. Syntax is option [opt ...] [opt = val ...].
* Val may be a string, an int, a float, or a list of the
* form (elt1 elt2 ...). */
void
com_option(wordlist *wl)
{
struct variable *vars;
char *s;
CKTcircuit *circuit = NULL;
if (!ft_curckt) {
fprintf(cp_err, "Error: no circuit loaded\n");
return;
}
circuit = (CKTcircuit *)(ft_curckt->ci_ckt);
if (wl == NULL) {
printf("******************************\n");
printf("* Current simulation options *\n");
printf("******************************\n\n");
printf("Temperatures:\n");
printf("temp = %f\n",circuit->CKTtemp);
printf("tnom = %f\n",circuit->CKTnomTemp);
printf("\nIntegration method summary:\n");
switch (circuit->CKTintegrateMethod)
{
case TRAPEZOIDAL:
printf("Integration Method = TRAPEZOIDAL\n");
break;
case GEAR:
printf("Integration Method = GEAR\n");
break;
default:
printf("Unknown integration method\n");
}
printf("MaxOrder = %d\n", circuit->CKTmaxOrder);
printf("\nTolerances (absolute):\n");
printf("abstol (current) = %f\n", circuit->CKTabstol);
printf("chgtol (charge) = %f\n", circuit->CKTchgtol);
printf("volttol (voltage) = %f\n", circuit->CKTvoltTol);
printf("pivotabstol (pivot) = %f\n", circuit->CKTpivotAbsTol);
printf("\nTolerances (relative):\n");
printf("reltol (current) = %f\n", circuit->CKTreltol);
printf("pivotreltol (pivot) = %f\n", circuit->CKTpivotRelTol);
printf("\nTruncation error:\n");
printf("trtol = %f\n", circuit->CKTtrtol);
#ifdef NEWTRUNC
printf("ltereltol = %f\n", circuit->CKTlteReltol);
printf("lteabstol = %f\n", circuit->CKTlteAbstol);
#endif /* NEWTRUNC */
printf("\nConductances:\n");
printf("gmin (devices) = %f\n", circuit->CKTgmin);
printf("diaggmin (stepping) = %f\n", circuit->CKTdiagGmin);
printf("gshunt = %f\n", circuit->CKTgshunt);
printf("delmin = %f\n", circuit->CKTdelmin);
printf("\nDefault parameters for MOS devices\n");
printf("Default M: %f\n", circuit->CKTdefaultMosM);
printf("Default L: %f\n", circuit->CKTdefaultMosL);
printf("Default W: %f\n", circuit->CKTdefaultMosW);
printf("Default AD: %f\n", circuit->CKTdefaultMosAD);
printf("Default AS: %f\n", circuit->CKTdefaultMosAS);
return;
}
vars = cp_setparse(wl);
/* This is sort of a hassle... */
while (vars) {
switch (vars->va_type) {
case VT_BOOL:
s = (char *) &vars->va_bool;
break;
case VT_NUM:
s = (char *) &vars->va_num;
break;
case VT_REAL:
s = (char *) &vars->va_real;
break;
case VT_STRING:
s = vars->va_string;
break;
case VT_LIST:
s = (char *) vars->va_vlist;
break;
default:
s = (char *) NULL;
}
/* qui deve settare le opzioni di simulazione */
cp_vset(vars->va_name, vars->va_type, s);
vars = vars->va_next;
}
return;
}

View File

@ -0,0 +1,6 @@
#ifndef _COM_OPTION_H
#define _COM_OPTION_H
void com_option(wordlist *wl);
#endif

View File

@ -47,8 +47,13 @@
#include "com_plot.h"
#include "com_setscale.h"
#include "com_xgraph.h"
#include "com_state.h"
#include "fourier.h"
#ifdef EXPERIMENTAL_CODE
#include "com_option.h"
#endif
/* FIXME: Integrate spcp_coms and nutcp_coms into one variable. */
@ -66,11 +71,20 @@ struct comm spcp_coms[] = {
{ "define", com_define, FALSE, FALSE, TRUE,
{ 010000, 040000, 040000, 040000 }, E_DEFHMASK, 0, LOTS,
(void (*)()) NULL,
"[[func (args)] stuff] : Define a user-definable function." } ,
"[[func (args)] stuff] : Define a user-definable function." } ,
{ "set", com_set, FALSE, FALSE, TRUE,
{ 020000, 020000, 020000, 020000 }, E_DEFHMASK, 0, LOTS,
arg_set,
"[option] [option = value] ... : Set a variable." } ,
#ifdef EXPERIMENTAL_CODE
/* PN support for altering options in interactive mode */
{ "option", com_option, FALSE, TRUE, TRUE,
{ 020000, 020000, 020000, 020000 }, E_DEFHMASK, 0, LOTS,
arg_set,
"[option] [option = value] ... : Set a simulator option." } ,
#endif
{ "alias", com_alias, FALSE, FALSE, FALSE,
{ 02, 04, 04, 04 }, E_ADVANCED, 0, LOTS,
(void (*)()) NULL,
@ -435,6 +449,15 @@ struct comm nutcp_coms[] = {
{ 020000, 020000, 020000, 020000 }, E_DEFHMASK, 0, LOTS,
arg_set,
"[option] [option = value] ... : Set a variable." } ,
#ifdef EXPERIMENTAL_CODE
/* PN support for altering options in interactive mode */
{ "option", com_option, FALSE, TRUE, TRUE,
{ 020000, 020000, 020000, 020000 }, E_DEFHMASK, 0, LOTS,
arg_set,
"[option] [option = value] ... : Set a simulator option." } ,
#endif
{ "alias", com_alias, FALSE, FALSE, FALSE,
{ 02, 04, 04, 04 }, E_ADVANCED, 0, LOTS,
(void (*)()) NULL,

View File

@ -165,6 +165,8 @@ extern struct variable *cp_setparse(wordlist *wl);
/* var2.c */
extern void cp_vprint(void);
extern void com_set(wordlist *wl);
extern void com_option(wordlist *wl);
extern void com_state(wordlist *wl);
extern void com_unset(wordlist *wl);
extern void com_shift(wordlist *wl);
extern bool cp_getvar(char *name, int type, void *retval);

View File

@ -16,12 +16,12 @@ int ciprefix(register char *p, register char *s);
void strtolower(char *str);
char * gettok(char **s);
#ifndef HAVE_INDEX
#if !defined(HAVE_INDEX) && !defined(HAVE_STRCHR)
char * index(register char *s, register char c);
char * rindex(register char *s,register char c );
#endif /* HAVE_INDEX */
#endif /* !defined(HAVE_INDEX) && !defined(HAVE_STRCHR) */
#ifndef HAVE_BCOPY

View File

@ -21,7 +21,7 @@ void INP2R(void *ckt, INPtables * tab, card * current)
/* Rname <node> <node> [<val>][<mname>][w=<val>][l=<val>][ac=<val>] */
int mytype; /* the type we determine resistors are */
int type; /* the type the model says it is */
int type = 0; /* the type the model says it is */
char *line; /* the part of the current line left to parse */
char *saveline; /* ... just in case we need to go back... */
char *name; /* the resistor's name */

View File

@ -31,7 +31,7 @@ INPdoOpts(ckt,anal,optCard,tab)
int error;
int i;
int which;
IFanalysis *prm;
IFanalysis *prm = NULL;
which = -1;
i=0;

View File

@ -153,7 +153,7 @@ INPgetTree(char **line, INPparseTree ** pt, void *ckt, INPtables * tab)
static INPparseNode *PTdifferentiate(INPparseNode * p, int varnum)
{
INPparseNode *arg1, *arg2, *newp;
INPparseNode *arg1 = NULL, *arg2, *newp;
/* printf("differentiating: "); printTree(p); printf(" wrt var %d\n", varnum);*/