--- /tmp/Eval/source/eval.c Tue Apr 13 21:04:42 1993 +++ eval.c Wed Sep 24 12:25:27 1997 @@ -44,6 +44,9 @@ */ #include "eval.h" +#include +#include +#include static char tempname[80]; static char wdir[100]; @@ -122,6 +125,7 @@ static BOOLEAN process_line(FILE *stream,int showinp,int showout,VARPTR vlist, VARPTR clist,char *pinput); static void init_varlist(VARPTR vlist); +static void init_sig(void); static void var_copy(VARPTR dest,VARPTR source); static int print_help(FILE *stream,int extended,int page,char *s); static int more(char *text,char *input,int pause); @@ -143,6 +147,8 @@ init_varlist(vlist); + initialize_readline(); + init_sig(); wdir[0]=EOS; rpath[0]=EOS; setobase(10); @@ -462,6 +468,7 @@ if (input[m0]!='?') { evaluate(&input[m0],showout,vlist,clist); + init_sig(); break; } if (!strcmp(&input[m0],"?")) @@ -565,6 +572,24 @@ vlist[i].name[0]=EOS; } +static void ignore_fpe(void) +{ + printf("Floating point exception... ignore result!\n"); + signal(SIGFPE, SIG_IGN); +} + +/* +** init_sig() +** +** initialize signal handler for floating point exceptions +** +*/ + +static void init_sig(void) +{ + signal(SIGFPE, ignore_fpe); +} + /* ** var_copy(VARPTR dest,VARPTR source) ** @@ -839,24 +864,89 @@ s[j+1]=EOS; } +char * +complete_consts (char *text, int state) +{ + static int i = 0, j = 0; + + if (state == 0) { + i = 0; + j = 0; + } + + while (i