diff --git a/ChangeLog b/ChangeLog index e36fe305d..517a1bfcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-03-14 Holger Vogt + * inpcom.c: test for .end improved (comments are now allowed in .end line) + * xpressn.c: adding fcn sgn() to numparam function lib + 2010-03-07 Dietmar Warning * analysis/ninteg.c: limiting exp() in noise integration to prevent overflow and NAN (ID: 2950943). diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 49ea2cb4f..832b1b50f 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1324,9 +1324,12 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name) *(s-1) = '\0'; } - if (ciprefix(".end", buffer) && strlen(buffer) == 4 ) { - found_end = TRUE; - *buffer = '*'; +/* find the true .end command out of .endc, .ends, .endl, .end (comments may follow) */ + if (ciprefix(".end", buffer)) { + if ((*(buffer+4) == '\0') || ( isspace(*(buffer+4)))) { + found_end = TRUE; + *buffer = '*'; + } } /* removed because code changes .global to *global before it will be diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 8dc123514..e5e6fbf44 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -61,7 +61,7 @@ initkeys (void) "and or not div mod if else end while macro funct defined" " include for to downto is var"); scopy_up (&fmathS, - "sqr sqrt sin cos exp ln arctan abs pow pwr max min int log sinh cosh tanh ternary_fcn v agauss"); + "sqr sqrt sin cos exp ln arctan abs pow pwr max min int log sinh cosh tanh ternary_fcn v agauss sgn"); } static double @@ -121,6 +121,11 @@ mathfunction (int f, double z, double x) case 17: y=sinh(x)/cosh(x); break; + case 21: + if (x>0) y=1.; + else if (x == 0) y=0.; + else y = -1.; + break; default: y = x; break;