enable B source debugging in behavioral models, exit on error if variable strict_errorhandling is set
This commit is contained in:
parent
1cbc41cc32
commit
0a087a47c8
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue