Frontend options fiules. Missing in the previous commit
This commit is contained in:
parent
5ba0b8b86c
commit
eb14693b09
|
|
@ -0,0 +1,94 @@
|
|||
/**********
|
||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||
Author: 2010 Paolo Nenzi
|
||||
**********/
|
||||
|
||||
|
||||
#include "ngspice.h"
|
||||
#include "const.h"
|
||||
#include "ftedefs.h"
|
||||
#include "wordlist.h"
|
||||
#include "variable.h"
|
||||
#include "sperror.h"
|
||||
|
||||
|
||||
typedef struct sFTEparm {
|
||||
char *keyword;
|
||||
int id;
|
||||
char dataType;
|
||||
char *description;
|
||||
} FTEparm;
|
||||
|
||||
|
||||
static FTEparm FTEOPTtbl[] = {
|
||||
{ "decklineno", FTEOPT_NLDECK, CP_NUM, "Number of lines in the deck" },
|
||||
{ "netloadtime", FTEOPT_NLT, CP_REAL, "Netlist loading time" },
|
||||
{ "netparsetime", FTEOPT_NPT, CP_REAL, "Netlist parsing time" }
|
||||
};
|
||||
|
||||
int FTEOPTcount = sizeof(FTEOPTtbl)/sizeof(FTEparm);
|
||||
|
||||
static struct variable *getFTEstat(struct circ *, int);
|
||||
|
||||
|
||||
struct variable *
|
||||
ft_getstat(struct circ *ft_curckt, char *name)
|
||||
{
|
||||
int i;
|
||||
struct variable *v, *vars , *vv = NULL;
|
||||
|
||||
if (name) {
|
||||
for (i = 0; i < FTEOPTcount; i++)
|
||||
if (eq(name, FTEOPTtbl[i].keyword)) {
|
||||
vv = getFTEstat(ft_curckt, FTEOPTtbl[i].id);
|
||||
if (vv) {
|
||||
vv->va_type = FTEOPTtbl[i].dataType;
|
||||
vv->va_name = copy(FTEOPTtbl[i].description);
|
||||
vv->va_next = NULL;
|
||||
return(vv);
|
||||
} else
|
||||
return (NULL);
|
||||
}
|
||||
return (NULL);
|
||||
} else {
|
||||
for (i = 0, v = vars = NULL; i < FTEOPTcount; i++) {
|
||||
if (v) {
|
||||
v->va_next = getFTEstat(ft_curckt, FTEOPTtbl[i].id);
|
||||
v = v->va_next;
|
||||
} else {
|
||||
vars = v = getFTEstat(ft_curckt, FTEOPTtbl[i].id);
|
||||
}
|
||||
|
||||
v->va_type = FTEOPTtbl[i].dataType;
|
||||
v->va_name = copy(FTEOPTtbl[i].description);
|
||||
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function fill the value field of the variable */
|
||||
|
||||
static struct variable *
|
||||
getFTEstat(struct circ *ft_curckt, int id)
|
||||
{
|
||||
|
||||
struct variable *v = TMALLOC(struct variable, 1);
|
||||
|
||||
switch (id) {
|
||||
case FTEOPT_NLDECK:
|
||||
v->va_num = ft_curckt->FTEstats->FTESTATdeckNumLines;
|
||||
break;
|
||||
case FTEOPT_NLT:
|
||||
v->va_real = ft_curckt->FTEstats->FTESTATnetLoadTime;
|
||||
break;
|
||||
case FTEOPT_NPT:
|
||||
v->va_real = ft_curckt->FTEstats->FTESTATnetParseTime;
|
||||
break;
|
||||
default:
|
||||
tfree(v);
|
||||
return(NULL);
|
||||
}
|
||||
return(v);
|
||||
}
|
||||
Loading…
Reference in New Issue