Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
check_mdl.cpp
Go to the documentation of this file.
1 /*
2  * check_mdl.cpp - iterate an IC-CAP MDL file
3  *
4  * Copyright (C) 2006, 2007 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id$
22  *
23  */
24 
25 #if HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <cmath>
33 #include <assert.h>
34 #include <float.h>
35 #include <ctype.h>
36 
37 #include "logging.h"
38 #include "strlist.h"
39 #include "object.h"
40 #include "complex.h"
41 #include "vector.h"
42 #include "dataset.h"
43 #include "sweep.h"
44 #include "valuelist.h"
45 #include "constants.h"
46 #include "check_mdl.h"
47 #include "tokens_mdl.h"
48 
49 using namespace qucs;
50 
51 // Global variables.
52 dataset * mdl_result = NULL;
53 struct mdl_link_t * mdl_root = NULL;
54 struct mdl_sync_t * mdl_sync_root = NULL;
55 
56 // Creates an independent data vector.
57 static void mdl_create_depdataset (sweep * data, char * name) {
58  vector v (name);
59  for (int i = 0; i < data->getSize (); i++) v.add (data->get (i));
60  mdl_result->appendDependency (new vector (v));
61 }
62 
63 // Creates an independent data vector with a single element.
64 static void mdl_create_condataset (double val, char * name) {
65  vector v (name);
66  v.add (val);
67  mdl_result->appendDependency (new vector (v));
68 }
69 
70 // The functions creates dependent data vector(s).
71 static void mdl_create_vardataset (struct mdl_point_t * point,
72  struct mdl_datasize_t * dsize,
73  const char * name, const char * type,
74  strlist * deps) {
75  vector * v = new vector[dsize->x * dsize->y] ();
76  // adjust type
77  if (!strcmp (type, "MEAS"))
78  type = ".M";
79  else if (!strcmp (type, "SIMU"))
80  type = ".S";
81  else if (!strcmp (type, "COMMON"))
82  type = "";
83  // create vectors
84  for (struct mdl_point_t * p = point; p != NULL; p = p->next) {
85  int n = (p->y - 1) * 2 + p->x - 1;
86  v[n].add (nr_complex_t (p->r, p->i));
87  }
88  // go through indices
89  for (int x = 1; x < dsize->x + 1; x++) {
90  for (int y = 1; y < dsize->y + 1; y++) {
91  // create vector description
92  int n = (y - 1) * 2 + x - 1;
93  char * txt = (char *) malloc (strlen (name) + strlen (type) + 4 + 2 * 3);
94  if (dsize->x > 1 || dsize->y > 1)
95  sprintf (txt, "%s%s[%d,%d]", name, type, x, y);
96  else
97  sprintf (txt, "%s%s", name, type);
98  v[n].setName (txt);
99  free (txt);
100  // put vector into dataset
101  if (v[n].getSize () > 1) {
102  v[n].setDependencies (new strlist (*deps));
103  mdl_result->appendVariable (new vector (v[n]));
104  } else {
105  v[n].setDependencies (new strlist ());
106  mdl_result->appendDependency (new vector (v[n]));
107  }
108  }
109  }
110  delete[] v;
111 }
112 
113 // Look through hypertable elements for a name and return value.
114 static char * mdl_find_helement (struct mdl_element_t * root,
115  const char * name) {
116  for (; root != NULL; root = root->next) {
117  if (!strcmp (root->name, name)) return root->value;
118  }
119  return NULL;
120 }
121 
122 // Look through table elements for a name and return value.
123 static char * mdl_find_telement (struct mdl_element_t * root,
124  const char * name) {
125  for (; root != NULL; root = root->next) {
126  if (!strcmp (root->name, "Name") && !strcmp (root->value, name)) {
127  if (root->next && !strcmp (root->next->name, "Value")) {
128  return root->next->value;
129  }
130  }
131  }
132  return NULL;
133 }
134 
135 // Convert number suffix into a multiplication factor.
136 static double mdl_convert_factor (char * end) {
137  double f = 1.0;
138  if (end) {
139  switch (*end) {
140  case 'K': f = 1e+03; break;
141  case 'M': f = 1e+06; break;
142  case 'G': f = 1e+09; break;
143  case 'T': f = 1e+12; break;
144  case 'm': f = 1e-03; break;
145  case 'u': f = 1e-06; break;
146  case 'n': f = 1e-09; break;
147  case 'p': f = 1e-12; break;
148  case 'f': f = 1e-15; break;
149  case 'a': f = 1e-18; break;
150  }
151  }
152  return f;
153 }
154 
155 // Forward declaration.
156 static double mdl_telement_dvalue (struct mdl_link_t *, struct mdl_element_t *,
157  const char *);
158 
159 // The function resolves the given variable trying upscope resolving.
160 static int mdl_resolve_variable (struct mdl_link_t * link, char * name,
161  double &val) {
162  int done = 0;
163  val = 0.0;
164  struct mdl_lcontent_t * root;
165  // try finding variable in current link
166  for (root = link->content; !done && root != NULL; root = root->next) {
167  if (root->type == t_TABLE) {
168  struct mdl_element_t * eroot = root->table->data;
169  if (mdl_find_telement (eroot, name)) {
170  val = mdl_telement_dvalue (link, eroot, name);
171  done++;
172  }
173  }
174  }
175  // resolve variable in upper scope recursively
176  if (!done && link->parent) {
177  done = mdl_resolve_variable (link->parent, name, val);
178  }
179  return done;
180 }
181 
182 // Converts a string into a valid value. Uses variable substitutions.
183 static double mdl_variable_value (struct mdl_link_t * link, char * txt) {
184  double val = 0.0;
185  char * end = NULL;
186  if (txt != NULL) {
187  // remove whitespaces
188  char * t, * p = txt;
189  while (*p) {
190  if (isspace (*p)) {
191  t = p;
192  while (*t) { *t = *(t + 1); t++; }
193  p--;
194  }
195  p++;
196  }
197  // extract value if possible
198  val = strtod (txt, &end);
199  // not a value, a variable
200  if (end == txt) {
201  double f = 1.0;
202  if (*txt == '-') { f = -1.0; txt++; }
203  else if (*txt == '+') { f = +1.0; txt++; }
204  if (!mdl_resolve_variable (link, txt, val)) {
205  // special variables
206  if (!strcmp (txt, "PI")) {
207  val = M_PI;
208  }
209  // no resolvable (probably equation)
210  else {
212  "checker error, unable to resolve `%s' variable in '%s'\n",
213  txt, link->name);
214  val = 0.0;
215  }
216  }
217  val = f * val;
218  }
219  // normal value with probably a suffix
220  else {
221  val *= mdl_convert_factor (end);
222  }
223  }
224  return val;
225 }
226 
227 // Returns a double variable value stored in a hypertable.
228 static double mdl_helement_dvalue (struct mdl_link_t * link,
229  struct mdl_element_t * eroot,
230  const char * name) {
231  char * txt = mdl_find_helement (eroot, name);
232  return mdl_variable_value (link, txt);
233 }
234 
235 // Returns a double variable value stored in a table.
236 static double mdl_telement_dvalue (struct mdl_link_t * link,
237  struct mdl_element_t * eroot,
238  const char * name) {
239  char * txt = mdl_find_telement (eroot, name);
240  return mdl_variable_value (link, txt);
241 }
242 
243 // Returns a integer variable value stored in a hypertable.
244 static int mdl_helement_ivalue (struct mdl_link_t * link,
245  struct mdl_element_t * eroot,
246  const char * name) {
247  return (int) mdl_helement_dvalue (link, eroot, name);
248 }
249 
250 // Looks for dependent data vectors and creates them.
251 static void mdl_find_vardataset (struct mdl_dcontent_t * droot, char * name,
252  strlist * deps) {
253  struct mdl_dcontent_t * root;
254  // go through dataset content
255  for (root = droot; root != NULL; root = root->next) {
256  if (root->type == t_DATASET) {
257  // create possibly both - MEAS and SIMU - data vectors
258  struct mdl_dataset_t * dset = root->data;
259  if (dset->data1)
260  mdl_create_vardataset (dset->data1, dset->dsize, name, dset->type1,
261  deps);
262  if (dset->data2)
263  mdl_create_vardataset (dset->data2, dset->dsize, name, dset->type2,
264  deps);
265  }
266  }
267 }
268 
269 // Looks for independent data vectors and creates them.
270 valuelist<int> * mdl_find_depdataset (struct mdl_link_t * link,
271  struct mdl_dcontent_t * droot,
272  char * name) {
273  char * stype = NULL;
274  double val, start, stop, step;
275  int nof = 0, order = 0;
276  valuelist<int> * deps = new valuelist<int> ();
277  struct mdl_dcontent_t * root;
278 
279  // go through dataset content
280  for (root = droot; root != NULL; root = root->next) {
281  if (root->type == t_HYPTABLE) {
282  struct mdl_hyptable_t * hyptab = root->hyptable;
283  // found a sweep definition?
284  if (!strcmp (hyptab->name, "Edit Sweep Def")) {
285  if (!strcmp (stype, "LIN")) {
286  // linear sweep
287  order = mdl_helement_ivalue (link, hyptab->data, "Sweep Order");
288  start = mdl_helement_dvalue (link, hyptab->data, "Start");
289  stop = mdl_helement_dvalue (link, hyptab->data, "Stop");
290  nof = mdl_helement_ivalue (link, hyptab->data, "# of Points");
291  step = mdl_helement_dvalue (link, hyptab->data, "Step Size");
292  if (nof <= 0) nof = (int) fabs ((stop - start) / step) + 1;
293  deps->append (name, new int (order));
294  linsweep * sw = new linsweep ();
295  sw->create (start, stop, nof);
296  mdl_create_depdataset (sw, name);
297  delete sw;
298  }
299  else if (!strcmp (stype, "CON")) {
300  // constant sweep
301  val = mdl_helement_dvalue (link, hyptab->data, "Value");
302  mdl_create_condataset (val, name);
303  }
304  else if (!strcmp (stype, "LOG")) {
305  // logarithmic sweep
306  order = mdl_helement_ivalue (link, hyptab->data, "Sweep Order");
307  start = mdl_helement_dvalue (link, hyptab->data, "Start");
308  stop = mdl_helement_dvalue (link, hyptab->data, "Stop");
309  nof = mdl_helement_ivalue (link, hyptab->data, "Total Pts");
310  if (nof <= 0)
311  nof = mdl_helement_ivalue (link, hyptab->data, "# of Points");
312  if (start * stop == 0.0) {
313  if (start == 0.0) start = 1.0;
314  if (stop == 0.0) stop = 1.0;
315  }
316  deps->append (name, new int (order));
317  logsweep * sw = new logsweep ();
318  sw->create (start, stop, nof);
319  mdl_create_depdataset (sw, name);
320  delete sw;
321  }
322  else if (!strcmp (stype, "LIST")) {
323  // list sweep
324  order = mdl_helement_ivalue (link, hyptab->data, "Sweep Order");
325  nof = mdl_helement_ivalue (link, hyptab->data, "# of Values");
326  deps->append (name, new int (order));
327  }
328  else if (!strcmp (stype, "SYNC")) {
329  // sync sweep
330  struct mdl_sync_t * sync = (struct mdl_sync_t *)
331  calloc (sizeof (struct mdl_sync_t), 1);
332  sync->ratio = mdl_helement_dvalue (link, hyptab->data, "Ratio");
333  sync->offset = mdl_helement_dvalue (link, hyptab->data, "Offset");
334  sync->master = mdl_find_helement (hyptab->data, "Master Sweep");
335  sync->master = strdup (sync->master);
336  sync->name = strdup (name);
337  sync->next = mdl_sync_root;
338  mdl_sync_root = sync;
339  }
340  }
341  // found a sweep information?
342  else if (!strcmp (hyptab->name, "Edit Sweep Info")) {
343  stype = mdl_find_helement (hyptab->data, "Sweep Type");
344  }
345  // found a list table?
346  else if (!strcmp (hyptab->name, "List Table")) {
347  lstsweep * sw = new lstsweep ();
348  sw->create (nof);
349  char txt[16];
350  for (int i = 0; i < nof; i++) {
351  sprintf (txt, "Value %d", i + 1);
352  val = mdl_helement_dvalue (link, hyptab->data, txt);
353  sw->set (i, val);
354  }
355  mdl_create_depdataset (sw, name);
356  delete sw;
357  }
358  }
359  }
360  return deps;
361 }
362 
363 // Composes a link name.
364 static char * mdl_create_linkname (char * base, char * name) {
365  char * txt = (char *) malloc (strlen (base) + 2 + strlen (name));
366  sprintf (txt, "%s.%s", base, name);
367  return txt;
368 }
369 
370 // Collects dependency links.
371 static void mdl_find_deplink (struct mdl_link_t * link, char * name,
372  valuelist<int> * deps) {
373  struct mdl_lcontent_t * root;
374  valuelist<int> * d;
375  // go through link content
376  for (root = link->content; root != NULL; root = root->next) {
377  // independent data vector
378  if (root->type == t_DATA) {
379  d = mdl_find_depdataset (link, root->data->content, name);
380  if (d != NULL) {
381  deps->append (d);
382  delete d;
383  }
384  }
385  // link to independent data vector
386  else if (root->type == t_LINK && !strcmp (root->link->type, "SWEEP")) {
387  char * txt = mdl_create_linkname (name, root->link->name);
388  root->link->parent = link;
389  mdl_find_deplink (root->link, txt, deps);
390  free (txt);
391  }
392  }
393 }
394 
395 // Collects variable links.
396 static void mdl_find_varlink (struct mdl_link_t * link, char * name,
397  strlist * deps) {
398  struct mdl_lcontent_t * root;
399  // go through link content
400  for (root = link->content; root != NULL; root = root->next) {
401  // dependent data vector
402  if (root->type == t_DATA) {
403  mdl_find_vardataset (root->data->content, name, deps);
404  }
405  // link to dependent data vector
406  else if (root->type == t_LINK && (!strcmp (root->link->type, "OUT") ||
407  !strcmp (root->link->type, "XFORM"))) {
408  char * txt = mdl_create_linkname (name, root->link->name);
409  root->link->parent = link;
410  mdl_find_varlink (root->link, txt, deps);
411  free (txt);
412  }
413  }
414 }
415 
416 // Sorts a dependency list according to their sweep order.
417 static strlist * mdl_sort_deps (valuelist<int> * d) {
418  strlist * deps = new strlist ();
419  for (int i = 0; i < d->length (); i++) {
420  for (valuelistiterator<int> it (*d); *it; ++it) {
421  if (*(it.currentVal ()) == i + 1) {
422  deps->append (it.currentKey ());
423  }
424  }
425  }
426  return deps;
427 }
428 
429 // Iterates the MDL file recursively.
430 static void mdl_find_link (struct mdl_link_t * link, char * name) {
431  struct mdl_lcontent_t * root;
432 
433  // collect independent data
434  valuelist<int> * vdeps = new valuelist<int> ();
435  mdl_find_deplink (link, name, vdeps);
436  strlist * deps = mdl_sort_deps (vdeps);
437  delete vdeps;
438 
439  // collect dependent data
440  mdl_find_varlink (link, name, deps);
441  delete deps;
442 
443  // go through link content
444  for (root = link->content; root != NULL; root = root->next) {
445  if (root->type == t_LINK &&
446  strcmp (root->link->type, "OUT") &&
447  strcmp (root->link->type, "SWEEP") &&
448  strcmp (root->link->type, "XFORM")) {
449  char * txt = mdl_create_linkname (name, root->link->name);
450  root->link->parent = link;
451  mdl_find_link (root->link, txt);
452  free (txt);
453  }
454  }
455 }
456 
457 // Creates an synchronized independent data vector.
458 static void mdl_create_syndataset (vector * v, char * name) {
459  v->setName (name);
461 }
462 
463 // Goes through list of sync sweeps and creates them if possible.
464 void mdl_find_syncdatasets (struct mdl_sync_t * root) {
465  struct mdl_sync_t * sync;
466  for (sync = root; sync != NULL; sync = sync->next) {
467  // determine master sweep link
468  char * link = sync->name;
469  int i = strlen (link) - 1;
470  while (i > 0 && link[i] != '.') i--;
471  if (link[i] == '.') {
472  link[i] = '\0';
473  char * txt = (char *) malloc (i + 2 + strlen (sync->master));
474  sprintf (txt, "%s.%s", link, sync->master);
475  link[i] = '.';
476  free (sync->master);
477  sync->master = txt;
478  }
479  // create synchronize independent data vector
480  vector * v = mdl_result->findDependency (sync->master);
481  if (v != NULL) {
482  vector * s = new vector ((*v) * sync->ratio + sync->offset);
483  mdl_create_syndataset (s, sync->name);
484  }
485  }
486 }
487 
488 // Destroys an element structure.
489 static void mdl_free_element (struct mdl_element_t * e) {
490  if (e->name) free (e->name);
491  if (e->value) free (e->value);
492  if (e->attr) free (e->attr);
493  free (e);
494 }
495 
496 // Destroys a datasize structure.
497 static void mdl_free_datasize (struct mdl_datasize_t * d) {
498  if (d->type) free (d->type);
499  free (d);
500 }
501 
502 // Destroys a hypertable structure.
503 static void mdl_free_hyptable (struct mdl_hyptable_t * h) {
504  if (h->name) free (h->name);
505  struct mdl_element_t * e, * next;
506  for (e = h->data; e != NULL; e = next) {
507  next = e->next;
508  mdl_free_element (e);
509  }
510  free (h);
511 }
512 
513 // Destroys a table structure.
514 static void mdl_free_table (struct mdl_table_t * t) {
515  if (t->name) free (t->name);
516  struct mdl_element_t * e, * next;
517  for (e = t->data; e != NULL; e = next) {
518  next = e->next;
519  mdl_free_element (e);
520  }
521  free (t);
522 }
523 
524 // Destroys a dataset structure.
525 static void mdl_free_dataset (struct mdl_dataset_t * d) {
526  if (d->type1) free (d->type1);
527  struct mdl_point_t * p, * next;
528  for (p = d->data1; p != NULL; p = next) {
529  next = p->next;
530  free (p);
531  }
532  if (d->type2) free (d->type2);
533  for (p = d->data2; p != NULL; p = next) {
534  next = p->next;
535  free (p);
536  }
537  if (d->dsize) mdl_free_datasize (d->dsize);
538 }
539 
540 // Destroys a data content structure.
541 static void mdl_free_dcontent (struct mdl_dcontent_t * c) {
542  switch (c->type) {
543  case t_DATASET: mdl_free_dataset (c->data); break;
544  case t_HYPTABLE: mdl_free_hyptable (c->hyptable); break;
545  }
546 }
547 
548 // Destroys a data structure.
549 static void mdl_free_data (struct mdl_data_t * d) {
550  struct mdl_dcontent_t * c, * next;
551  for (c = d->content; c != NULL; c = next) {
552  next = c->next;
553  mdl_free_dcontent (c);
554  }
555 }
556 
557 // Forward declaration.
558 static void mdl_free_link (struct mdl_link_t *);
559 
560 // Destroys a link content structure.
561 static void mdl_free_lcontent (struct mdl_lcontent_t * c) {
562  switch (c->type) {
563  case t_LINK: mdl_free_link (c->link); break;
564  case t_DATA: mdl_free_data (c->data); break;
565  case t_TABLE: mdl_free_table (c->table); break;
566  }
567  free (c);
568 }
569 
570 // Destroys a link structure.
571 static void mdl_free_link (struct mdl_link_t * l) {
572  if (l->name) free (l->name);
573  if (l->type) free (l->type);
574  struct mdl_lcontent_t * c, * next;
575  for (c = l->content; c != NULL; c = next) {
576  next = c->next;
577  mdl_free_lcontent (c);
578  }
579 }
580 
581 // Destroys a sync structure.
582 static void mdl_free_sync (struct mdl_sync_t * s) {
583  struct mdl_sync_t * next;
584  for (; s != NULL; s = next) {
585  next = s->next;
586  if (s->name) free (s->name);
587  if (s->master) free (s->master);
588  free (s);
589  }
590 }
591 
592 // Computes the dependent vector length for the given dependency list.
593 static int mdl_get_depsize (strlist * deps) {
594  char * n;
595  vector * v;
596  int res = 1;
597  for (int i = 0; i < deps->length (); i++) {
598  if ((n = deps->get (i)) != NULL)
599  if ((v = mdl_result->findDependency (n)) != NULL)
600  res *= v->getSize ();
601  }
602  return res;
603 }
604 
605 // Checks the variable vector dependencies. Makes them independent if
606 // necessary.
607 static void mdl_check_xform_deplen (void) {
608  vector * v, * next;
609  for (v = mdl_result->getVariables (); v; v = next) {
610  next = (vector *) v->getNext ();
611  strlist * deps = v->getDependencies ();
612  if (deps->length () <= 0) {
613  vector * d = new vector (*v);
614  mdl_result->delVariable (v);
616  }
617  }
618 }
619 
620 // Checks the variable vector dependencies and reduces them if necessary.
621 static void mdl_check_xform_dep (void) {
622  vector * v, * d;
623  strlist * deps;
624  for (v = mdl_result->getVariables (); v; v = (vector *) v->getNext ()) {
625  deps = v->getDependencies ();
626  int s = mdl_get_depsize (deps);
627  // dependencies differ from actual vector length
628  if (v->getSize () != s) {
629  int found = 0;
630  for (int i = 0; i < deps->length (); i++) {
631  // find out a single dependency with the appropriate length
632  char * n = deps->get (i);
633  if (n != NULL) {
634  d = mdl_result->findDependency (n);
635  if (d != NULL && v->getSize () == d->getSize ()) {
636  strlist * dep = new strlist ();
637  dep->add (n);
638  v->setDependencies (dep);
639  found++;
640  break;
641  }
642  }
643  }
644  // if not found, then no dependency vector
645  if (!found) v->setDependencies (new strlist ());
646  }
647  }
648 }
649 
650 // Checks the XFORM's in the model file
651 static void mdl_check_xforms (void) {
654 }
655 
656 /* This function is the overall MDL data checker. It returns zero on
657  success, non-zero otherwise. */
658 int mdl_check (void) {
659  int errors = 0;
660  mdl_result = new dataset ();
661  struct mdl_link_t * root;
662  for (root = mdl_root; root; root = root->next) {
663  char * name = root->name;
664  mdl_find_link (root, name);
665  }
667  mdl_check_xforms ();
668  return errors ? -1 : 0;
669 }
670 
671 // Destroys data used by the MDL checker.
672 void mdl_destroy (void) {
673  if (mdl_result != NULL) {
674  // delete associated dataset
675  delete mdl_result;
676  mdl_result = NULL;
677  }
678  if (mdl_root != NULL) {
679  // release internal data structures
680  struct mdl_link_t * root, * next;
681  for (root = mdl_root; root; root = next) {
682  next = root->next;
683  mdl_free_link (root);
684  }
685  mdl_root = NULL;
686  }
687  if (mdl_sync_root != NULL) {
688  // release internal sync structures
690  mdl_sync_root = NULL;
691  }
692 }
693 
694 // Initializes the MDL checker.
695 void mdl_init (void) {
696  mdl_root = NULL;
697  mdl_result = NULL;
698  mdl_sync_root = NULL;
699 }
struct mdl_sync_t * next
Definition: check_mdl.h:133
double ratio
Definition: check_mdl.h:131
void addDependency(qucs::vector *)
Definition: dataset.cpp:95
start
Definition: parse_zvr.y:126
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
l
Definition: parse_vcd.y:213
static int mdl_resolve_variable(struct mdl_link_t *link, char *name, double &val)
Definition: check_mdl.cpp:160
qucs::vector * getVariables(void)
Definition: dataset.h:63
static double mdl_telement_dvalue(struct mdl_link_t *, struct mdl_element_t *, const char *)
Definition: check_mdl.cpp:236
name
Definition: parse_mdl.y:352
char * attr
Definition: check_mdl.h:75
nr_complex_t step(const nr_complex_t z)
Heaviside step function for complex number.
Definition: complex.cpp:691
t
Definition: parse_vcd.y:290
static void mdl_find_deplink(struct mdl_link_t *link, char *name, valuelist< int > *deps)
Definition: check_mdl.cpp:371
static void mdl_free_datasize(struct mdl_datasize_t *d)
Definition: check_mdl.cpp:497
Global physical constants header file.
void mdl_init(void)
Definition: check_mdl.cpp:695
struct mdl_element_t * next
Definition: check_mdl.h:76
struct mdl_dcontent_t * next
Definition: check_mdl.h:125
static double mdl_helement_dvalue(struct mdl_link_t *link, struct mdl_element_t *eroot, const char *name)
Definition: check_mdl.cpp:228
struct mdl_sync_t * mdl_sync_root
Definition: check_mdl.cpp:54
static strlist * mdl_sort_deps(valuelist< int > *d)
Definition: check_mdl.cpp:417
struct mdl_data_t * data
Definition: check_mdl.h:109
n
Definition: parse_citi.y:147
static void mdl_create_syndataset(vector *v, char *name)
Definition: check_mdl.cpp:458
struct mdl_dcontent_t * content
Definition: check_mdl.h:116
h
Definition: parse_vcd.y:214
struct mdl_link_t * link
Definition: check_mdl.h:108
void appendVariable(qucs::vector *)
Definition: dataset.cpp:186
struct mdl_element_t * data
Definition: check_mdl.h:81
i
Definition: parse_mdl.y:516
static double mdl_convert_factor(char *end)
Definition: check_mdl.cpp:136
struct mdl_point_t * data2
Definition: check_mdl.h:93
next
Definition: parse_spice.y:859
struct mdl_point_t * next
Definition: check_mdl.h:61
void mdl_find_syncdatasets(struct mdl_sync_t *root)
Definition: check_mdl.cpp:464
stop
Definition: parse_zvr.y:127
struct mdl_dataset_t * data
Definition: check_mdl.h:122
static void mdl_free_link(struct mdl_link_t *)
Definition: check_mdl.cpp:571
dataset * mdl_result
Definition: check_mdl.cpp:52
static int mdl_get_depsize(strlist *deps)
Definition: check_mdl.cpp:593
static void mdl_free_dcontent(struct mdl_dcontent_t *c)
Definition: check_mdl.cpp:541
static void mdl_create_depdataset(sweep *data, char *name)
Definition: check_mdl.cpp:57
free($1)
static void mdl_free_sync(struct mdl_sync_t *s)
Definition: check_mdl.cpp:582
struct mdl_point_t * data1
Definition: check_mdl.h:91
x
Definition: parse_mdl.y:498
struct mdl_hyptable_t * hyptable
Definition: check_mdl.h:123
void delVariable(qucs::vector *)
Definition: dataset.cpp:161
#define M_PI
Archimedes' constant ( )
Definition: consts.h:47
type
Definition: parse_vcd.y:164
static void mdl_free_table(struct mdl_table_t *t)
Definition: check_mdl.cpp:514
static void mdl_free_element(struct mdl_element_t *e)
Definition: check_mdl.cpp:489
static void mdl_check_xform_deplen(void)
Definition: check_mdl.cpp:607
v
Definition: parse_zvr.y:141
void appendDependency(qucs::vector *)
Definition: dataset.cpp:128
double offset
Definition: check_mdl.h:132
List int
Definition: parse_citi.y:183
DSContent dsize
Definition: parse_mdl.y:323
y
Definition: parse_mdl.y:499
static void mdl_find_link(struct mdl_link_t *link, char *name)
Definition: check_mdl.cpp:430
static double mdl_variable_value(struct mdl_link_t *link, char *txt)
Definition: check_mdl.cpp:183
static char * mdl_find_telement(struct mdl_element_t *root, const char *name)
Definition: check_mdl.cpp:123
static void mdl_free_lcontent(struct mdl_lcontent_t *c)
Definition: check_mdl.cpp:561
static void mdl_check_xforms(void)
Definition: check_mdl.cpp:651
char * type2
Definition: check_mdl.h:92
static void mdl_free_dataset(struct mdl_dataset_t *d)
Definition: check_mdl.cpp:525
static void mdl_free_hyptable(struct mdl_hyptable_t *h)
Definition: check_mdl.cpp:503
char * type
Definition: check_mdl.h:65
#define LOG_ERROR
Definition: logging.h:28
static void mdl_find_vardataset(struct mdl_dcontent_t *droot, char *name, strlist *deps)
Definition: check_mdl.cpp:251
struct mdl_table_t * table
Definition: check_mdl.h:110
static void mdl_create_condataset(double val, char *name)
Definition: check_mdl.cpp:64
qucs::vector * findDependency(const char *)
Definition: dataset.cpp:281
char * master
Definition: check_mdl.h:129
struct mdl_link_t * mdl_root
Definition: check_mdl.cpp:53
struct mdl_element_t * data
Definition: check_mdl.h:86
static char * mdl_find_helement(struct mdl_element_t *root, const char *name)
Definition: check_mdl.cpp:114
char * name
Definition: check_mdl.h:130
struct mdl_lcontent_t * next
Definition: check_mdl.h:112
valuelist< int > * mdl_find_depdataset(struct mdl_link_t *link, struct mdl_dcontent_t *droot, char *name)
Definition: check_mdl.cpp:270
int mdl_check(void)
Definition: check_mdl.cpp:658
static void mdl_free_data(struct mdl_data_t *d)
Definition: check_mdl.cpp:549
void logprint(int level, const char *format,...)
Definition: logging.c:37
void mdl_destroy(void)
Definition: check_mdl.cpp:672
char * name
Definition: check_mdl.h:80
char * value
Definition: check_mdl.h:74
char * type1
Definition: check_mdl.h:90
struct mdl_datasize_t * dsize
Definition: check_mdl.h:94
link
Definition: parse_mdl.y:223
static void mdl_create_vardataset(struct mdl_point_t *point, struct mdl_datasize_t *dsize, const char *name, const char *type, strlist *deps)
Definition: check_mdl.cpp:71
static void mdl_find_varlink(struct mdl_link_t *link, char *name, strlist *deps)
Definition: check_mdl.cpp:396
char * name
Definition: check_mdl.h:85
static void mdl_check_xform_dep(void)
Definition: check_mdl.cpp:621
static int mdl_helement_ivalue(struct mdl_link_t *link, struct mdl_element_t *eroot, const char *name)
Definition: check_mdl.cpp:244
char * name
Definition: check_mdl.h:73
data
Definition: parse_citi.y:117
static char * mdl_create_linkname(char *base, char *name)
Definition: check_mdl.cpp:364