aboutsummaryrefslogtreecommitdiff
path: root/math/eval/files
diff options
context:
space:
mode:
authorMatthew Hunt <mph@FreeBSD.org>1998-04-26 03:25:11 +0000
committerMatthew Hunt <mph@FreeBSD.org>1998-04-26 03:25:11 +0000
commit50db84abd37e97f7cbbfbed00f9ab3f3240ee0e3 (patch)
tree90e6070b2a800afe8f93647724540a734eb5abef /math/eval/files
parentff7d128d26c683ee565350ed7350f36d4e8d0b27 (diff)
downloadports-50db84abd37e97f7cbbfbed00f9ab3f3240ee0e3.tar.gz
ports-50db84abd37e97f7cbbfbed00f9ab3f3240ee0e3.zip
Import of Eval v113, a command-line based floating-point calculator.
PR: 4979 Submitted by: Slaven Rezic <eserte@cs.tu-berlin.de>
Notes
Notes: svn path=/head/; revision=10680
Diffstat (limited to 'math/eval/files')
-rw-r--r--math/eval/files/patch-aa27
-rw-r--r--math/eval/files/patch-ab33
-rw-r--r--math/eval/files/patch-ac166
-rw-r--r--math/eval/files/patch-ad28
4 files changed, 254 insertions, 0 deletions
diff --git a/math/eval/files/patch-aa b/math/eval/files/patch-aa
new file mode 100644
index 000000000000..465076c00b62
--- /dev/null
+++ b/math/eval/files/patch-aa
@@ -0,0 +1,27 @@
+--- /tmp/Eval/source/Makefile.unx Tue Apr 13 21:04:14 1993
++++ Makefile Sat Nov 8 11:50:35 1997
+@@ -11,13 +11,14 @@
+ # in order to get the string space high enough. I haven't had any
+ # trouble with any of the other source modules.
+ #
+-CCFLAGS=-c
++CCFLAGS=-c -fwritable-strings $(CFLAGS)
+ #
+ # On some systems, you can use LIBC=-lc_s to make the program smaller by
+ # linking to a shared library.
+ #
+ LIBC=-lc
+ LIBM=-lm
++LIBREADLINE=-lreadline -ltermcap
+ EXE=
+ OBJ=.o
+ HEADER=eval.h
+@@ -30,7 +31,7 @@
+ $(OBJFILES): $(HEADER)
+
+ Eval$(EXE): $(OBJFILES)
+- $(CC) -o Eval $(OBJFILES) $(LIBM) $(LIBC)
++ $(CC) -o Eval $(OBJFILES) $(LIBM) $(LIBC) $(LIBREADLINE)
+ chmod 755 Eval
+
+ eval: Eval$(EXE)
diff --git a/math/eval/files/patch-ab b/math/eval/files/patch-ab
new file mode 100644
index 000000000000..84b35dd51993
--- /dev/null
+++ b/math/eval/files/patch-ab
@@ -0,0 +1,33 @@
+--- /tmp/Eval/source/eval.h Tue Apr 13 21:04:44 1993
++++ eval.h Wed Mar 16 04:26:57 1994
+@@ -55,6 +55,8 @@
+ #define MAXINPUT 160
+ #define NUMFUNCS 30
+ #define MAXFLEN 6
++#define MAXALEN 3
++#define MAXDLEN 80
+ #define SCRWIDTH 80
+ #define MAXARGS 10
+ #define EOS '\0'
+@@ -115,6 +117,12 @@
+ char type;
+ int code;
+ } TOKEN, *TOKENPTR;
++typedef struct {
++ int id;
++ char name[MAXFLEN+1];
++ char argspec[MAXALEN+1];
++ char desc[MAXDLEN+1];
++ } FUNC, *FUNCPTR;
+
+ /* Function definitions */
+
+@@ -131,6 +139,8 @@
+ char *func_name (int);
+ int func_nargs (int);
+ int print_funclist (FILE *s,char *input,int d);
++
++extern FUNC flist[];
+
+ /* ----- PARSE.C functions -------------------------------------------- */
+
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 <readline/readline.h>
++#include <readline/history.h>
++#include <signal.h>
+
+ 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<MAXC) {
++ if (strncmp (clist[i].name, text, strlen(text)) == 0)
++ return strdup(clist[i++].name);
++ else
++ i++;
++ }
+
+-static int nextline(char *s,FILE *stream)
+-
++ while (j<NUMFUNCS) {
++ if (strncmp (flist[j].name, text, strlen(text)) == 0)
++ return strdup(flist[j++].name);
++ else
++ j++;
++ }
++
++ return NULL;
++}
++
++int initialize_readline ()
++{
++ /* Allow conditional parsing of the ~/.inputrc file. */
++ rl_readline_name = "Eval";
++
++ rl_completion_entry_function = (Function *)complete_consts;
++}
++
++/* A static variable for holding the line. */
++static char *line_read = (char *)NULL;
++
++/* Read a string, and return a pointer to it. Returns NULL on EOF. */
++char *
++do_gets ()
++{
++ /* If the buffer has already been allocated, return the memory
++ to the free pool. */
++ if (line_read != (char *)NULL)
+ {
+- while (1)
+-
+- {
+- if (stream==stdin)
+- printf("%s",PROMPT);
+- if (fgets(s,MAXINPUT,stream)==NULL)
+- return(0);
+- fixup(s);
+- if (s[0]!=';')
+- break;
+- }
+- return(1);
++ free (line_read);
++ line_read = (char *)NULL;
+ }
+
++ /* Get a line from the user. */
++ line_read = readline (PROMPT);
++
++ /* If the line has any text in it, save it on the history. */
++ if (line_read && *line_read)
++ add_history (line_read);
++
++ return (line_read);
++}
++
++
++static int nextline(char *s,FILE *stream)
++
++{
++ while (1)
++
++ {
++ if (stream==stdin) {
++ if (do_gets() == NULL)
++ return 0;
++ else
++ strncpy(s, line_read, MAXINPUT);
++ }
++ else
++ if (fgets(s,MAXINPUT,stream)==NULL)
++ return(0);
++ fixup(s);
++ if (s[0]!=';')
++ break;
++ }
++ return(1);
++}
++
+
+ static void close_temp(int showout)
+
diff --git a/math/eval/files/patch-ad b/math/eval/files/patch-ad
new file mode 100644
index 000000000000..f8946bc9062e
--- /dev/null
+++ b/math/eval/files/patch-ad
@@ -0,0 +1,28 @@
+--- /tmp/Eval/source/funcs.c Tue Apr 13 21:04:40 1993
++++ funcs.c Wed Mar 16 04:31:35 1994
+@@ -52,16 +52,6 @@
+
+ #include "eval.h"
+
+-#define MAXALEN 3
+-#define MAXDLEN 80
+-
+-typedef struct {
+- int id;
+- char name[MAXFLEN+1];
+- char argspec[MAXALEN+1];
+- char desc[MAXDLEN+1];
+- } FUNC, *FUNCPTR;
+-
+ #define ABSVAL 1
+ #define ACOS 2
+ #define ACOSH 3
+@@ -93,7 +83,7 @@
+ #define TAN 29
+ #define TANH 30
+
+-static FUNC flist[NUMFUNCS] =
++FUNC flist[NUMFUNCS] =
+ {
+ {ABSVAL,"abs", "x", "absolute value" },
+ {ACOS, "acos", "x", "arccosine, return value in radians" },