diff options
author | Matthew Hunt <mph@FreeBSD.org> | 1998-04-26 03:25:11 +0000 |
---|---|---|
committer | Matthew Hunt <mph@FreeBSD.org> | 1998-04-26 03:25:11 +0000 |
commit | 50db84abd37e97f7cbbfbed00f9ab3f3240ee0e3 (patch) | |
tree | 90e6070b2a800afe8f93647724540a734eb5abef /math | |
parent | portlint. (diff) |
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')
-rw-r--r-- | math/eval/Makefile | 31 | ||||
-rw-r--r-- | math/eval/distinfo | 1 | ||||
-rw-r--r-- | math/eval/files/patch-aa | 27 | ||||
-rw-r--r-- | math/eval/files/patch-ab | 33 | ||||
-rw-r--r-- | math/eval/files/patch-ac | 166 | ||||
-rw-r--r-- | math/eval/files/patch-ad | 28 | ||||
-rw-r--r-- | math/eval/pkg-comment | 1 | ||||
-rw-r--r-- | math/eval/pkg-descr | 8 | ||||
-rw-r--r-- | math/eval/pkg-plist | 1 |
9 files changed, 296 insertions, 0 deletions
diff --git a/math/eval/Makefile b/math/eval/Makefile new file mode 100644 index 000000000000..9837567373fb --- /dev/null +++ b/math/eval/Makefile @@ -0,0 +1,31 @@ +# New ports collection makefile for: eval +# Version required: 113 +# Date created: 24 Sep 1997 +# Whom: eserte +# +# $Id$ +# + +DISTNAME= Eval113 +PKGNAME= eval-113 +CATEGORIES= math +MASTER_SITES= ftp://ftp.doc.ic.ac.uk/Mirrors/wuarchive.wustl.edu/pub/aminet/util/cli/ \ + ftp://ftp.uni-paderborn.de/ftp/aminet/pub/util/cli/ \ + ftp://ftp.demon.net/pub/mirrors/aminet/util/cli/ +EXTRACT_SUFX= .lha + +MAINTAINER= eserte@cs.tu-berlin.de + +BUILD_DEPENDS= lha:${PORTSDIR}/archivers/lha + +EXTRACT_CMD= lha + +WRKSRC= ${WRKDIR}/Eval/source + +post-extract: + -ln -s Makefile.unx ${WRKSRC}/Makefile + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/Eval ${PREFIX}/bin + +.include <bsd.port.mk> diff --git a/math/eval/distinfo b/math/eval/distinfo new file mode 100644 index 000000000000..3e0c574d8ce8 --- /dev/null +++ b/math/eval/distinfo @@ -0,0 +1 @@ +MD5 (Eval113.lha) = 271123630e3efaf8298b4600a6b01f9d 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" }, diff --git a/math/eval/pkg-comment b/math/eval/pkg-comment new file mode 100644 index 000000000000..b8aae21c7012 --- /dev/null +++ b/math/eval/pkg-comment @@ -0,0 +1 @@ +A full featured floating point expression evaluator. diff --git a/math/eval/pkg-descr b/math/eval/pkg-descr new file mode 100644 index 000000000000..96122f208930 --- /dev/null +++ b/math/eval/pkg-descr @@ -0,0 +1,8 @@ +Eval is a full featured floating point expression evaluator that +can assign variables, has many built-in functions and constants, allows +input and output in any number base, and uses a C-like syntax for +expression evaluation. Full ANSI C source is included and easily +portable to other platforms. +Author: Will Menninger + +This version comes with readline support. diff --git a/math/eval/pkg-plist b/math/eval/pkg-plist new file mode 100644 index 000000000000..517f274e8ba3 --- /dev/null +++ b/math/eval/pkg-plist @@ -0,0 +1 @@ +bin/Eval |