Backgrounder:
The af (arithmetic filter) manual page advises that af command line numeric
parameters cannot contain ``E notation.'' (They mean Scientific notation,
e.g. 1.23e04). That is a severe limitation, because we have several
scripts that make their own af command line parameters using af. Guess
what, af gladly outputs E notation, but such a result can't be used as
a parameter. Here's how af might produce a number containing E notation.
$ af '1000000+100000'
1.1e+06
$
script done on Tue Jul 15 18:28:21 1986
Repeat by:
Try the following af command:
$ af '1e01+2e02'
af assumes that the funny name ``e01'' refers to the stdin, and then
complains that the file ``e02'' can't be opened.
Anyway, we had working scripts that broke when the numbers got too small
and so it seemed a fix was in order, even though this is a FEATURE
according to the manual page. The fix is very simple (although recompiling
af may not be). The only file that needs to be changed is `aeparse.c'
in the /wherever_gps_src_is_stored/graf/stat.d directory.
*** aeparse.c.orig Tue Jul 15 17:29:33 1986
--- aeparse.c Tue Jul 15 17:35:57 1986
***************
*** 1,5
static char SCCSID[]="@(#)aeparse.c 1.2";
/* <: t-5 d :> */
#include "s.h"
#include "stdio.h"
--- 1,6 -----
static char SCCSID[]="@(#)aeparse.c 1.2";
/* <: t-5 d :> */
+ /* kc 7/86 command line exponential notation allowed */
#include "s.h"
#include "stdio.h"
***************
*** 172,177
case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
break;
case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
break;
default: if(!silent) ERRPR1(? %c,*(*p)++); break;
}
--- 173,184 -----
case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
break;
case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
+ /* following four lines added by kc 7/86 to allow
+ exponents on the command line */
+ if( (**p == 'e') || (**p == 'E') ) /* exponent */
+ *buf++ = *(*p)++;
+ while( ISNUM(**p) )
+ *buf++ = *(*p)++;
break;
default: if(!silent) ERRPR1(? %c,*(*p)++); break;
}
Kaare Christian
cmcl2!rna!kc
*** aeparse.c.orig Tue Jul 15 17:29:33 1986
--- aeparse.c Tue Jul 15 21:55:58 1986
***************
*** 1,5
static char SCCSID[]="@(#)aeparse.c 1.2";
/* <: t-5 d :> */
#include "s.h"
#include "stdio.h"
--- 1,6 -----
static char SCCSID[]="@(#)aeparse.c 1.2";
/* <: t-5 d :> */
+ /* kc 7/86 command line exponential notation allowed */
#include "s.h"
#include "stdio.h"
***************
*** 172,177
case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
break;
case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
break;
default: if(!silent) ERRPR1(? %c,*(*p)++); break;
}
--- 173,186 -----
case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
break;
case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
+ /* following four lines added by kc 7/86 to allow
+ exponents on the command line */
+ if( (**p == 'e') || (**p == 'E') ) /* exponent */
+ *buf++ = *(*p)++;
+ if( **p == '-' ) /* sign */
+ *buf++ = *(*p)++;
+ while( ISNUM(**p) )
+ *buf++ = *(*p)++;
break;
default: if(!silent) ERRPR1(? %c,*(*p)++); break;
}
Once again, sorry for the inconvenience of two messages when one should
have been enough.
Kaare Christian
cmcl2!rna!kc