Browse Source

enable B source debugging in behavioral models, exit on error if variable strict_errorhandling is set

h_vogt 14 years ago
parent
commit
0a087a47c8
  1. 2
      src/include/ngspice/inpptree.h
  2. 28
      src/spicelib/parser/ifeval.c
  3. 3
      src/spicelib/parser/inpptree.c

2
src/include/ngspice/inpptree.h

@ -55,6 +55,8 @@ typedef struct INPparseNode {
int usecnt;
} INPparseNode;
/* A debugging function */
void INPptPrint(char *str, IFparseTree * ptree);
/* FIXME, less public
* and replace with static inline functions for better type check

28
src/spicelib/parser/ifeval.c

@ -38,12 +38,32 @@ IFeval(IFparseTree * tree, double gmin, double *result, double *vals,
printf("\tvar%d = %lg\n", i, vals[i]);
#endif
if ((err = PTeval(myTree->tree, gmin, result, vals)) != OK)
return (err);
if ((err = PTeval(myTree->tree, gmin, result, vals)) != OK) {
if (ft_ngdebug) {
INPptPrint("calling PTeval, tree = ", tree);
printf("values:");
for (i = 0; i < myTree->p.numVars; i++)
printf("\tvar%d = %lg\n", i, vals[i]);
}
if (ft_stricterror)
controlled_exit(EXIT_BAD);
else
return (err);
}
for (i = 0; i < myTree->p.numVars; i++)
if ((err = PTeval(myTree->derivs[i], gmin, &derivs[i], vals)) !=
OK) return (err);
if ((err = PTeval(myTree->derivs[i], gmin, &derivs[i], vals)) != OK) {
if (ft_ngdebug) {
INPptPrint("calling PTeval, tree = ", tree);
printf("results: function = %lg\n", *result);
for (i = 0; i < myTree->p.numVars; i++)
printf("\td / d var%d = %lg\n", i, derivs[i]);
}
if (ft_stricterror)
controlled_exit(EXIT_BAD);
else
return (err);
}
#ifdef TRACE
printf("results: function = %lg\n", *result);

3
src/spicelib/parser/inpptree.c

@ -1383,8 +1383,6 @@ void free_tree(INPparseNode *pt)
}
#ifdef TRACE
/* Debugging stuff. */
void printTree(INPparseNode *);
@ -1497,4 +1495,3 @@ void printTree(INPparseNode * pt)
return;
}
#endif
Loading…
Cancel
Save