From 50db84abd37e97f7cbbfbed00f9ab3f3240ee0e3 Mon Sep 17 00:00:00 2001 From: Matthew Hunt Date: Sun, 26 Apr 1998 03:25:11 +0000 Subject: Import of Eval v113, a command-line based floating-point calculator. PR: 4979 Submitted by: Slaven Rezic --- math/eval/files/patch-ac | 166 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 math/eval/files/patch-ac (limited to 'math/eval/files/patch-ac') diff --git a/math/eval/files/patch-ac b/math/eval/files/patch-ac new file mode 100644 index 000000000000..50dd1635f5b0 --- /dev/null +++ b/math/eval/files/patch-ac @@ -0,0 +1,166 @@ +--- /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