37 #if defined(_WIN32) & not defined(__MINGW32__)
38 #define strcasecmp stricmp
176 #include "qucsdefs.h"
179 #define foreach_value(values,val) \
180 for ((val) = (values); (val) != NULL; (val) = (val)->next) \
181 if (!((val)->hint & HINT_DONE))
187 for (root = NULL; values != NULL; values =
next) {
199 for (root = NULL; pairs != NULL; pairs =
next) {
211 for (root = NULL; nodes != NULL; nodes =
next) {
222 if (p1 == NULL)
return p2;
224 for (pair = p1; pair->
next != NULL; pair = pair->
next) ;
232 if (v1 == NULL)
return v2;
234 for (val = v1; val->
next != NULL; val = val->
next) ;
242 if (n1 == NULL)
return n2;
244 for (node = n1; node->
next != NULL; node = node->
next) ;
253 for (def = spice_definition_available; def->
type != NULL; def++)
254 if (!strcasecmp (n, def->
type))
return def;
261 if (!strcmp (node,
"0")) {
265 n->
node = (
char *) malloc (5 + strlen (node));
266 strcpy (n->
node,
"_net");
267 strcat (n->
node, node);
269 for (
unsigned int i = 0;
i < strlen (n->
node);
i++) {
270 if (!isalpha (n->
node[
i]) && !isdigit (n->
node[
i])) {
271 switch (n->
node[
i]) {
272 case '+': n->
node[
i] =
'P';
break;
273 case '-': n->
node[
i] =
'N';
break;
274 default : n->
node[
i] =
'_';
break;
296 if (nodes == 0)
return NULL;
300 struct node_t * root = NULL;
309 if (++i >= nodes && nodes !=
PROP_NODES)
break;
325 const char *
scale = NULL;
329 value++; scale =
"T";
break;
331 value++; scale =
"G";
break;
333 value++; scale = (
char *) ((*value ==
'M') ?
"M" :
"m");
334 if ((value[0] ==
'i' || value[0] ==
'I') &&
335 (value[1] ==
'l' || value[1] ==
'L')) {
336 value += 2; *factor = 2.54e-5; scale = NULL;
338 if ((value[0] ==
'e' || value[0] ==
'E') &&
339 (value[1] ==
'g' || value[1] ==
'G')) {
340 value += 2; scale =
"M";
344 value++; scale =
"k";
break;
346 value++; scale =
"u";
break;
348 value++; scale =
"n";
break;
350 value++; scale =
"p";
break;
352 value++; scale =
"f";
break;
366 val->
value = strtod (ident, &end);
370 val->
scale = str ? strdup (str) : NULL;
371 if (*end) val->
unit = strdup (end);
380 struct pair_t * p, * root = NULL;
390 p->
key = strdup (prop->
key);
398 else if ((def->
type[0] ==
'F' || def->
type[0] ==
'H') &&
399 strcasecmp (val->
ident,
"POLY") &&
427 if (def->action && !strcasecmp (def->type,
"MODEL") &&
428 !strcasecmp (def->instance, type)) {
454 {
"NPN",
"BJT",
"npn" },
455 {
"PNP",
"BJT",
"pnp" },
456 {
"NJF",
"JFET",
"nfet" },
457 {
"PJF",
"JFET",
"pfet" },
458 {
"NMOS",
"MOSFET",
"nfet" },
459 {
"PMOS",
"MOSFET",
"pfet" },
460 {
"D",
"Diode", NULL },
461 {
"SW",
"Relais", NULL },
462 {
"VSWITCH",
"Relais", NULL },
463 {
"RES",
"R", NULL },
473 struct pair_t * root = NULL;
495 for (pair = def->
pairs; pair != NULL; pair = pair->
next) {
496 if (!strcmp (pair->
key, prop))
506 for (pair = def->
pairs; pair != NULL; pair = pair->
next) {
507 if (!strcasecmp (pair->
key, prop))
517 for (; pair != NULL; pair = pair->
next) {
518 if (!strcasecmp (pair->
key, prop))
531 if (!strcasecmp (prop, val->
ident))
return val;
548 prop->
key = strdup (key);
558 double val = value->
value, factor = 1.0;
559 if (value->
scale != NULL) {
560 switch (*(value->
scale)) {
561 case 'T': factor = 1e12;
break;
562 case 'G': factor = 1e9;
break;
563 case 'M': factor = 1e6;
break;
564 case 'k': factor = 1e3;
break;
565 case 'm': factor = 1e-3;
break;
566 case 'u': factor = 1e-6;
break;
567 case 'n': factor = 1e-9;
break;
568 case 'p': factor = 1e-12;
break;
569 case 'f': factor = 1e-15;
break;
586 for (; value != NULL; value =
next) {
609 for (prev = root; prev != NULL && prev->
next != pair; prev = prev->
next) ;
637 if (!strcasecmp (tran->
type, start->
ident)) {
656 if (version >= 1.11) {
657 if (version >= 1.2e9)
658 def->
type = strdup (
"hicumL0V1p2g");
659 else if (version >= 1.3)
660 def->
type = strdup (
"hicumL0V1p3");
661 else if (version >= 1.2)
662 def->
type = strdup (
"hicumL0V1p2");
664 def->
type = strdup (
"hic0_full");
672 else if (level == 2 && version == 2.1) {
673 def->
type = strdup (
"hicumL2V2p1");
676 else if (level == 2 && version >= 2.21 && version <= 2.22) {
677 def->
type = strdup (
"hic2_full");
680 else if (level == 2 && version == 2.23) {
681 def->
type = strdup (
"hicumL2V2p23");
684 else if (level == 2 && version >= 2.24) {
685 def->
type = strdup (
"hicumL2V2p24");
710 if (inst == NULL)
return;
722 else if (!strcasecmp (def->
type,
"C")) {
726 fprintf (stderr,
"spice error, no such .MODEL `%s' found as specified in "
737 for (entry = qucs_definition_available; entry->
type != NULL; entry++)
738 if (!strcmp (entry->
type, def->
type))
return entry;
771 if (!strcasecmp (tran->
type, def->
type)) {
847 { NULL, 0, { -1 }, { -1 } }
861 for (; node != NULL; node =
n) {
871 for (; pair != NULL; pair =
n) {
881 for (i = 1, node = def->
nodes; node != NULL; node = node->
next, i++)
882 if (i == pos)
return node;
893 if (!strcmp (nodes->
type, def->
type))
break;
894 if (nodes->
type == NULL || pass != nodes->
pass)
return;
911 sprintf (txt,
"%s%d",
"_node",
n);
912 node->
node = strdup (txt);
919 struct node_t * root = NULL;
920 for (
int n = entry->
nodes - 1;
n >= 0;
n--) {
954 for (
struct pair_t * pair = def->
pairs; pair != NULL; pair = pair->
next) {
960 if (!strcasecmp (unit->
key, value->
unit)) {
979 if (entry == NULL)
return;
986 pair->
key = strdup (prop->
key);
1003 if (entry == NULL)
return;
1010 pair->
key = strdup (prop->
key);
1031 { NULL,
"CCS",
"Cjs" },
1032 { NULL,
"VA",
"Vaf" },
1033 { NULL,
"VB",
"Var" },
1034 { NULL,
"IK",
"Ikf" },
1035 { NULL,
"PE",
"Vje" },
1036 { NULL,
"ME",
"Mje" },
1037 { NULL,
"PC",
"Vjc" },
1038 { NULL,
"MC",
"Mjc" },
1039 { NULL,
"PS",
"Vjs" },
1040 { NULL,
"MS",
"Mjs" },
1042 { NULL,
"VTO",
"Vt0" },
1043 { NULL,
"U0",
"Uo" },
1045 { NULL,
"CJO",
"Cj0" },
1049 { NULL,
"Z0",
"Z" },
1050 {
"R",
"TC",
"Tc1" },
1052 { NULL, NULL, NULL }
1060 for (; prop->
key != NULL; prop++) {
1062 if (!strcasecmp (prop->
key, pair->
key)) {
1077 for (pair = def->
pairs; pair != NULL; pair = pair->
next) {
1108 const char *
value,
int replace) {
1119 p->
key = strdup (prop);
1128 n->
node = strdup (node);
1134 for (
unsigned int i = 0;
i < strlen (str);
i++) {
1135 if (str[
i] >=
'a' && str[
i] <=
'z') str[
i] = toupper (str[
i]);
1187 for (def = root; def != NULL; def =
next) {
1201 definition_root = subcircuit_root = device_root = NULL;
1218 for (prev = root; prev != NULL && prev->
next != def; prev = prev->
next) ;
1232 static int intern = 0;
1233 static char txt[32];
1234 sprintf (txt,
"_cnet%d", intern++);
1248 node->
node = strdup (inode);
1268 res->
type = strdup (type);
1305 prop->
key = strdup (key);
1328 if (field->
field[i] == NULL)
break;
1349 char * txt = (
char *) malloc (strlen (str) + 1);
1351 for (val = def->
values; val != NULL; val = val->
next) {
1353 sprintf (str,
"%s ", val->
ident);
1363 sprintf (str,
"%s%s%s%s",
1372 txt = (
char *) realloc (txt, strlen (txt) + strlen (str) + 1);
1378 #define VAL_IS_NUMBER(val) \
1380 (val)->hint & (HINT_NUMBER | HINT_NODE) && \
1381 !((val)->hint & HINT_DONE))
1383 #define VAL_IS_DONE(val) \
1384 ((val) == NULL || (val)->hint & HINT_DONE)
1407 struct definition_t * ac = NULL, * dc = def, * pulse = NULL, * expo = NULL;
1409 char * ui = (
char *) ((type ==
'U') ?
"U" :
"I");
1421 dc->type = strdup (type ==
'U' ?
"Vdc" :
"Idc");
1439 { { ui,
"f",
"Phase",
"Theta", NULL } };
1452 char * Mag = NULL, * Phase = NULL;
1456 Mag = strdup (prop->
ident);
1460 Phase = strdup (prop->
ident);
1489 pulse->type = type ==
'U' ? strdup (
"Vrect") : strdup (
"Irect");
1490 double add, off = 0;
1501 { { ui,
"Td",
"Tr",
"Tf",
"TH",
"TL", NULL } };
1523 { { type ==
'U' ?
"U2" :
"I2",
"T1",
"Tr",
"Tf",
"T2", NULL } };
1542 { { type ==
'U' ?
"U1" :
"I1", type ==
'U' ?
"U2" :
"I2",
"T1",
"Tr",
1543 "T2",
"Tf", NULL } };
1581 static int intern = 1;
1582 static char txt[32];
1583 sprintf (txt,
"SW%d", intern++);
1594 if (!strcasecmp (*type,
"dec")) {
1597 *type = strdup (
"log");
1599 else if (!strcasecmp (*type,
"lin")) {
1602 *type = strdup (
"lin");
1604 else if (!strcasecmp (*type,
"oct")) {
1607 *type = strdup (
"log");
1617 { {
"Param",
"Start",
"Stop",
"Points", NULL } };
1620 para->
type = strdup (
"SW");
1639 int res = 0;
struct value_t * val;
1651 if (!strcasecmp (def->type, type) && !strcasecmp (def->instance, inst))
1663 if (!strcasecmp (def->type, type))
1674 if (!strcmp (def->type, type))
1684 for (val = def->
values; val != NULL; val = next) {
1716 for (dev = device_root; dev; dev = dev->
next) {
1717 if (!strcmp (dev->
instance, instance))
1728 if (strcasecmp (def->
type,
"MODEL"))
1741 device_root = Model;
1755 const char *
type,
char * inst) {
1757 if (def != coupled && !strcmp (def->type, type) && !def->
action) {
1761 char * linst2 = def->values->next->ident;
1762 if (!strcasecmp (linst1, inst) || !strcasecmp (linst2, inst))
1773 char * inst1,
char * inst2) {
1775 if (!strcmp (def->type, type) && !def->action) {
1779 char * linst2 = def->values->next->ident;
1780 if ((!strcasecmp (linst1, inst1) && !strcasecmp (linst2, inst2)) ||
1781 (!strcasecmp (linst1, inst2) && !strcasecmp (linst2, inst1)))
1796 if (target == NULL) {
1797 fprintf (stderr,
"spice error, no such inductor `%s' found as "
1798 "referenced by %s `%s'\n", inst, def->
type, def->
instance);
1818 char * inst = (
char *) malloc (strlen (k1->
instance) +
1834 nr_double_t l1, l2, l3, k,
t;
1835 char *
n1, *
n2, * n3, * n4;
1839 n1 = n2 = n3 = n4 = NULL;
1840 l1 = l2 = l3 = k = t = 0;
1849 if (!target1 || !target2)
return root;
1856 char * k12, * k13, * k23;
1861 if (k2 != NULL && k3 != NULL) {
1862 char * linst3, * linst4;
1863 if (!strcasecmp (k2->values->ident, linst1))
1864 linst3 = k2->values->next->ident;
1866 linst3 = k2->values->ident;
1867 if (!strcasecmp (k3->values->ident, linst2))
1868 linst4 = k3->values->next->ident;
1870 linst4 = k3->values->ident;
1874 if (strcasecmp (linst3, linst4)) {
1875 fprintf (stderr,
"spice error, cannot translate coupled inductors "
1876 "`%s' and `%s'\n", linst3, linst4);
1879 else if (k2 != k3) {
1882 if (target3 != NULL) {
1935 n1 = strdup (nn->
node);
1941 n2 = strdup (nn->
node);
1979 const char *
type,
char * inst) {
1981 if (!strcmp (def->type, type) && !def->action) {
1984 if (!coupled->
get (def->instance)) {
1986 char * linst2 = def->values->next->ident;
1987 if (!strcasecmp (linst1, inst) || !strcasecmp (linst2, inst))
2002 const char *
type,
char * inst) {
2015 if (!L_hash->
get (linst)) {
2017 L_hash->
put (linst, l);
2025 if (!L_hash->
get (linst)) {
2027 L_hash->
put (linst, l);
2040 char * linst1, * linst2;
2049 L_hash.
put (linst1, l);
2052 L_hash.
put (linst2, l);
2060 int i, o,
s = L_hash.
count ();
2061 nr_double_t * kval =
new nr_double_t[s *
s];
2073 nr_double_t kvalue = 0;
2081 kval[s * o +
i] = kvalue;
2082 kval[s * i + o] = kvalue;
2086 kval[s * o +
i] = 1;
2100 pair->
key = strdup (
"L");
2113 pair->
key = strdup (
"k");
2115 for (i = 0; i < s *
s; i++) {
2135 char *
n = (
char *) malloc (strlen (def->
instance) + 4 + 3);
2136 sprintf (n,
"%s.%c%d", def->
instance, type, p);
2150 sprintf (I_,
"I%d", p);
2151 sprintf (Q_,
"Q%d", p);
2162 sprintf (ieq,
"Eqn%sI%d", def->
instance, p);
2163 sprintf (qeq,
"Eqn%sQ%d", def->
instance, p);
2190 if (seq[k - 1] != 0)
break;
2202 for (i = 0; i < k - 1; i++)
2203 if (seq[i] != 0)
break;
2205 seq[0] = seq[nd - 1] + 1;
2211 while (seq[k - 1] < 1) {
2232 val->
scale = str ? strdup (str) : NULL;
2233 if (*end) val->
unit = strdup (end);
2245 int * pn = (
int *) calloc (nd,
sizeof (
int));
2246 static char expr[1024];
2261 sprintf (value,
"%+g", k);
2262 strcat (expr, value);
2265 for (
int i = 0;
i < nd;
i++) {
2266 int n = integrate ?
i + 1 :
i + 2;
2267 int e = integrate ? pn[
i] + 2 : pn[
i];
2273 sprintf (value,
"*V%d", n);
2276 sprintf (value,
"*V%d*V%d", n, n);
2279 sprintf (value,
"*V%d^%d", n, e);
2282 strcat (expr, value);
2285 if (integrate && e > 1) {
2286 sprintf (value,
"/%d", e);
2287 strcat (expr, value);
2306 if (strcasecmp (def->
type,
"E") && strcasecmp (def->
type,
"G") &&
2307 strcasecmp (def->
type,
"F") && strcasecmp (def->
type,
"H"))
2311 if (!strcasecmp (def->
type,
"E"))
2313 else if (!strcasecmp (def->
type,
"G"))
2315 else if (!strcasecmp (def->
type,
"H"))
2317 else if (!strcasecmp (def->
type,
"F"))
2323 def->
type = strdup (
"EDD");
2334 for (
int i = nd * 2 - 1;
i >= 0;
i--) {
2335 int p = (
i + 1) / 2 + 1;
2346 for (
int i = nd;
i > 0;
i--) {
2348 char * vn, * np, * nn;
2357 vn = (
char *) malloc (strlen (ibuf->
instance) + 3);
2358 sprintf (vn,
"%sV%d", ibuf->
instance, p);
2366 node->
node = strdup (nn);
2378 fprintf (stderr,
"spice error, no such voltage source `%s' found as "
2379 "referenced by the %s `%s' instance\n", def->
type,
2403 struct node_t * pnode, * nnode;
2406 if ((type & 1) == 0)
2408 else if ((type & 1) == 1)
2421 pnode->
node = strdup (intp);
2423 nnode->
node = strdup (
"gnd");
2441 if (!strcasecmp (def->
type,
"C"))
2443 else if (!strcasecmp (def->
type,
"L"))
2449 def->
type = strdup (
"EDD");
2469 char * expr2 = expr1;
2471 expr2 = (
char *) malloc (strlen (expr1) + 256);
2472 sprintf (expr2,
"%+g*V1%s", lc, expr1);
2485 struct node_t * pnode, * nnode;
2500 pnode->
node = strdup (intp);
2502 nnode->
node = strdup (
"gnd");
2519 if (def->action && !strcmp (def->type,
"SW")) {
2537 fprintf (stderr,
"spice error, no such source `%s' found as "
2538 "referenced by the .DC analysis\n", val);
2544 if (!def->action && (!strcmp (def->type,
"CCCS") ||
2545 !strcmp (def->type,
"CCVS"))) {
2557 fprintf (stderr,
"spice error, no such voltage source `%s' found "
2558 "as referenced by the %s `%s' instance\n", def->type,
2559 def->instance, key);
2565 if (!def->action && (!strcmp (def->type,
"F") ||
2566 !strcmp (def->type,
"H"))) {
2570 if (!def->action && !strcmp (def->type,
"Relais")) {
2573 if (pon != NULL && pof != NULL) {
2578 nr_double_t vh = (von - vof) / 2;
2579 nr_double_t vt = (von + vof) / 2;
2585 if (!def->action && (!strcmp (def->type,
"Vpulse") ||
2586 !strcmp (def->type,
"Ipulse") ||
2587 !strcmp (def->type,
"Vrect") ||
2588 !strcmp (def->type,
"Irect"))) {
2592 if (tr == NULL || tf == NULL) {
2597 nr_double_t tstep = (stop -
start) / (points - 1);
2598 nr_double_t
add = 0;
2607 if (!strcmp (&def->type[1],
"pulse")) {
2615 if (!def->action && (!strcmp (def->type,
"Vac") ||
2616 !strcmp (def->type,
"Iac"))) {
2627 if (!def->action && !strcmp (def->type,
"R")) {
2640 nr_double_t
l = 0, w = 0,
r = 0,
d = 0,
n = 0;
2661 if (
d == 0)
d = 1e-6;
2663 if (l != 0 && w != 0 &&
r != 0) {
2664 r =
r * (l -
n) / (w -
n);
2678 if (!def->action && !strcmp (def->type,
"C")) {
2686 nr_double_t
l = 0, w = 0,
c = 0,
d = 0,
n = 0,
s = 0;
2711 if (
d == 0)
d = 1e-6;
2713 if (l != 0 && w != 0 &&
c != 0) {
2714 c =
c * (l -
n) * (w -
n) + 2 *
s * (l + w - 2 *
n);
2719 if (!def->action && !strcmp (def->type,
"TLIN4P")) {
2723 nr_double_t len = 1e-3;
2730 else if (pf != NULL && pl != NULL) {
2739 else if (pf != NULL) {
2743 len =
C0 / f * 0.25;
2747 fprintf (stderr,
"spice error, either TD or F required in "
2748 "lossless `%s' line \n", def->instance);
2753 if (!def->action && !strcmp (def->type,
"Tr")) {
2760 if (def->action && strstr (def->type,
"OPT")) {
2782 if ((def->action && !strcmp (def->type,
"PRINT")) ||
2783 !strcmp (def->type,
"PLOT")) {
2787 if (def->define == NULL) {
2802 if (!strcasecmp (def->
type,
"TRAN")) {
2804 def->
type = strdup (
"TR");
2831 else if (!strcasecmp (def->
type,
"AC")) {
2838 type = strdup (val->
ident);
2862 else if (!strcasecmp (def->
type,
"DC")) {
2878 else if (!strcasecmp (def->
type,
"SUBCKT")) {
2880 def->
type = strdup (
"Def");
2884 else if (!strcasecmp (def->
type,
"OP")) {
2886 def->
type = strdup (
"DC");
2897 sub->
type = strdup (
"Sub");
2909 static int intern = 1;
2910 static char txt[32];
2911 sprintf (txt,
"NS%d", intern++);
2923 def->
type = strdup (
"NodeSet");
2949 strcpy (def->type, def->define->type);
2954 if (!strcasecmp (def->type,
"Q") || !strcasecmp (def->type,
"M") ||
2955 !strcasecmp (def->type,
"J") || !strcasecmp (def->type,
"D") ||
2956 !strcasecmp (def->type,
"S") || !strcasecmp (def->type,
"R") ||
2957 !strcasecmp (def->type,
"C")) {
2961 if (!strcasecmp (def->type,
"E") || !strcasecmp (def->type,
"G")) {
2965 if (!strcasecmp (def->type,
"C") || !strcasecmp (def->type,
"L")) {
2969 if (!strcasecmp (def->type,
"V")) {
2973 if (!strcasecmp (def->type,
"I")) {
2977 if (!strcasecmp (def->type,
"X")) {
2984 if (!strcasecmp (def->type,
"NODESET") ||
2985 !strcasecmp (def->type,
"IC")) {
2996 if (!strcasecmp (def->type,
"MODEL")) {
3031 static void spice_lister (
struct definition_t * root) {
3034 fprintf (stderr,
"%s:%s", def->type, def->instance);
3035 for (val = def->values; val != NULL; val = val->
next) {
3037 fprintf (stderr,
" %s[%d]", val->
ident, val->
hint);
3039 fprintf (stderr,
" %g[%d]", val->
value, val->
hint);
3041 fprintf (stderr,
"\n");
3048 if (val == NULL)
return;
3049 for (; val->
next != NULL; val = val->
next) ;
3055 if (val == NULL)
return;
3056 for (; val->
next != NULL; val = val->
next) ;
3063 spice_lister (root);
static char * spice_create_eqnstr(struct definition_t *def, int p, char type)
static struct definition_t * spice_post_translator(struct definition_t *root)
static void spice_adjust_device(struct definition_t *def, struct definition_t *trandef)
struct node_t * netlist_append_nodes(struct node_t *n1, struct node_t *n2)
struct node_translation_t node_translations[]
type_t * currentVal(void)
static char * spice_create_poly(struct value_t *prop, int nd, int integrate)
static int spice_evaluate_points(char **type, double start, double stop, double points)
type_t * put(char *, type_t *)
static struct pair_t * spice_generate_Model_pairs(struct value_t *values)
struct pair_t * netlist_append_pairs(struct pair_t *p1, struct pair_t *p2)
struct pair_t * spice_del_property(struct pair_t *root, struct pair_t *pair)
static struct property_t req_spice_C[]
static struct definition_t * spice_search_coupled(struct definition_t *root, qucs::hash< struct definition_t > *K_hash, qucs::hash< struct definition_t > *L_hash, const char *type, char *inst)
static char * spice_toupper(char *str)
static struct definition_t * spice_find_coupled(struct definition_t *root, struct definition_t *coupled, const char *type, char *inst)
static char * spice_coupled_instance(struct definition_t *k1, struct definition_t *k2, struct definition_t *k3)
static const char * spice_evaluate_scale(char *value, char **endptr, double *factor)
static struct property_t req_spice_R[]
Global physical constants header file.
#define K
Absolute 0 in centigrade.
static struct node_t * spice_get_node(struct definition_t *def, int pos)
static struct property_t req_spice_G[]
static struct property_t req_spice_IC[]
static void spice_translate_units(struct definition_t *def)
#define create_definition()
static void netlist_free_pairs(struct pair_t *pair)
struct property_translation_t property_translations[]
struct definition_t * device_root
static void spice_free_values(struct definition_t *def)
struct definition_t * spice_checker_intern(struct definition_t *root)
struct node_t * spice_nodes
static struct property_t req_spice_I[]
static void spice_append_node(struct definition_t *def, char *node)
static void spice_adjust_optional_properties(struct definition_t *def)
static struct define_t * spice_find_definition(const char *n)
static struct definition_t * spice_translate_source(struct definition_t *root, struct definition_t *def, char type)
static struct definition_t * spice_create_para(struct definition_t *base)
struct definition_t * sub
static struct property_t req_spice_V[]
int qucs_find_node(struct node_t *root, char *node)
nr_complex_t sqrt(const nr_complex_t z)
Compute principal value of square root.
static struct definition_t * spice_find_device(struct definition_t *root, char *type)
void netlist_free_pair(struct pair_t *pair)
static struct property_t req_spice_E[]
static int spice_count_values(struct value_t *values)
static void spice_translate_device(struct definition_t *root, struct definition_t *def)
static char * spice_create_intern_node(void)
struct property_t * required
struct definition_t * definition_root
struct property_t::@6 defaultval
static struct definition_t * spice_create_definition(struct definition_t *base, const char *type)
void spice_adjust_properties(struct definition_t *def)
static struct pair_t * spice_find_property(struct definition_t *def, const char *prop)
static struct node_t * spice_get_nodes(struct definition_t *def)
static struct definition_t * spice_translate_coupled_x(struct definition_t *root, struct definition_t *def)
static void spice_translate_subcircuit(struct definition_t *sub)
#define foreach_value(values, val)
nr_complex_t log10(const nr_complex_t z)
Compute principal value of decimal logarithm of z.
static struct value_t * spice_create_value(const char *ident)
struct spice_device_t spice_devices[]
void spice_add_last_hint(struct value_t *val, int hint)
struct definition_t * spice_del_definition(struct definition_t *root, struct definition_t *def)
nr_complex_t integrate(vector v, const nr_complex_t)
static struct definition_t * spice_translate_action(struct definition_t *root, struct definition_t *def)
struct define_t spice_definition_available[]
static struct definition_t * spice_translator(struct definition_t *root)
#define PROP_IS_PROP(prop)
static struct define_t * spice_get_qucs_definition(struct definition_t *def)
static struct property_t req_spice_NODESET[]
static struct value_t * spice_find_device_instance(struct definition_t *def)
static double spice_get_property_value(struct definition_t *def, const char *key)
static void spice_collect_external_nodes(struct definition_t *def)
static struct definition_t * spice_translate_nodeset(struct definition_t *root, struct definition_t *def)
static void spice_append_pair(struct definition_t *def, const char *prop, const char *value, int replace)
#define PROP_IS_VAL(prop)
static struct property_t req_spice_L[]
static int spice_count_nodes(struct definition_t *def)
static struct definition_t * spice_translate_poly_lc(struct definition_t *root, struct definition_t *def)
static struct definition_t * spice_translate_coupled(struct definition_t *root, struct definition_t *def)
static struct node_t * spice_translate_node(char *node)
static struct definition_t * spice_find_coupled_inductor(struct definition_t *root, struct definition_t *def, const char *type, char *inst)
static void spice_adjust_default_properties(struct definition_t *def)
static char * spice_create_intern_nodeset(void)
static struct definition_t * spice_add_edd_equation(struct definition_t *root, struct definition_t *def, int p, struct definition_t **i, struct definition_t **q)
static struct definition_t * spice_add_definition(struct definition_t *root, struct definition_t *def)
static struct definition_t * spice_add_Model(struct definition_t *def)
const char * trans_type_prop
static void spice_adjust_vsource_nodes(struct definition_t *up, struct definition_t *dn)
void spice_set_last_hint(struct value_t *val, int hint)
#define VAL_IS_NUMBER(val)
static void netlist_free_value(struct value_t *value)
static int spice_count_real_values(struct value_t *values)
static void spice_adjust_instance(struct definition_t *def)
static struct property_t req_spice_T[]
static struct pair_t * spice_get_pairs(struct definition_t *def)
struct property_t * optional
static struct value_t * spice_get_value_coupled(struct definition_t *def)
static void netlist_free_values(struct value_t *value)
static char * spice_untranslated_text(struct definition_t *def)
static struct property_t spice_noprops[]
static struct property_t req_spice_H[]
struct unit_translation_t unit_translations[]
#define C0
speed of light in vacuum ( )
static void netlist_free_nodes(struct node_t *node)
static void spice_set_property_value(struct definition_t *def, const char *key, double val)
static void spice_adjust_isource_nodes(struct definition_t *left, struct definition_t *right)
static void spice2g6_nxtpwr(int *seq, int nd)
struct pair_t * netlist_reverse_pairs(struct pair_t *pairs)
static void spice_value_done(struct value_t *val)
struct value_t * netlist_reverse_values(struct value_t *values)
struct node_t * netlist_reverse_nodes(struct node_t *nodes)
static struct property_t req_spice_F[]
static struct pair_t * spice_find_property_nocase(struct definition_t *def, const char *prop)
static char * spice_create_intern_para(void)
static void spice_extract_properties(struct definition_t *def, struct value_t *values, struct property_field_t *field)
struct value_t * netlist_append_values(struct value_t *v1, struct value_t *v2)
struct spice_device_table_t spice_device_table[]
static struct definition_t * spice_find_Model(char *instance)
static double spice_get_value(struct value_t *val)
static void spice_translate_nodes(struct definition_t *def, int pass)
struct definition_t * next
static void netlist_free_definition(struct definition_t *def)
static struct property_t opt_spice_R[]
static void netlist_destroy_intern(struct definition_t *)
static void spice_set_property_string(struct definition_t *def, const char *key, const char *val)
struct definition_t * subcircuit_root
static struct definition_t * spice_translate_poly(struct definition_t *root, struct definition_t *def)
static int spice_translate_type(struct definition_t *def)
static void spice_fixup_definition(struct definition_t *def)
static double spice_evaluate_value(struct value_t *value)
#define PROP_NO_SUBSTRATE
Expr HINT_NAME HINT_MSTART
static void spice_add_property(struct definition_t *root, const char *type, const char *key, char *value)
void spice_adjust_alias_properties(struct definition_t *def, struct pair_t *pair)