Browse Source
Frontend options fiules. Missing in the previous commit
Frontend options fiules. Missing in the previous commit
1 changed files with 94 additions and 0 deletions
@ -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); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue