From f0c5297c3a54f31af6ffb006eedbfac6f25118b7 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Tue, 14 Oct 2003 00:38:33 +0000 Subject: Update lemon to the latest version in the SQLite repo. Please let me know if there are any grammar problems with this newer version. Assume maintainership. Approved by: maintainer --- devel/lemon/Makefile | 9 +- devel/lemon/distinfo | 4 +- devel/lemon/files/patch-aa | 212 --------------------------------------------- 3 files changed, 5 insertions(+), 220 deletions(-) delete mode 100644 devel/lemon/files/patch-aa diff --git a/devel/lemon/Makefile b/devel/lemon/Makefile index 893e6bde4614..032e1b908d23 100644 --- a/devel/lemon/Makefile +++ b/devel/lemon/Makefile @@ -6,17 +6,14 @@ # PORTNAME= lemon -PORTVERSION= 1.0 -PORTREVISION= 1 +PORTVERSION= 1.16 CATEGORIES= devel -MASTER_SITES= http://www.hwaci.com/sw/lemon/ +MASTER_SITES= http://people.FreeBSD.org/~seanc/ports/${PORTNAME}/ DISTFILES= lemon.c lempar.c -MAINTAINER= mi@aldan.algebra.com +MAINTAINER= seanc@FreeBSD.org COMMENT= An LALR(1) parser generator. Similar in function to yacc and bison -NO_WRKSUBDIR= YES - do-extract: ${MKDIR} ${WRKSRC} ${CP} -p ${DISTDIR}/lemon.c ${WRKSRC} diff --git a/devel/lemon/distinfo b/devel/lemon/distinfo index abee70b45ac7..5978fa470baf 100644 --- a/devel/lemon/distinfo +++ b/devel/lemon/distinfo @@ -1,2 +1,2 @@ -MD5 (lemon.c) = 926bc7eb6e5ee8f02e919cc0fe2febd6 -MD5 (lempar.c) = 19c9e510be0b6bde25f945aecc79a97b +MD5 (lemon.c) = 039871544440ff6a290d43b12b8f14c6 +MD5 (lempar.c) = 00255228878a4f3ba109ccdc863506bc diff --git a/devel/lemon/files/patch-aa b/devel/lemon/files/patch-aa deleted file mode 100644 index aa7da97bbca2..000000000000 --- a/devel/lemon/files/patch-aa +++ /dev/null @@ -1,212 +0,0 @@ ---- lemon.c Tue Dec 5 20:52:24 2000 -+++ lemon.c Mon Jul 14 18:43:15 2003 -@@ -27,13 +27,14 @@ - */ - #include --#include -+#include - #include - #include -+#include -+#include -+#include - - extern void qsort(); - extern double strtod(); - extern long strtol(); --extern void free(); --extern int access(); - extern int atoi(); - -@@ -54,5 +55,4 @@ - - char *msort(); --extern void *malloc(); - - /******** From the file "action.h" *************************************/ -@@ -90,5 +90,5 @@ - - /********* From the file "error.h" ***************************************/ --void ErrorMsg( /* char *, int, char *, ... */ ); -+static void ErrorMsg(const char *, int, const char *, ... ); - - /****** From the file "option.h" ******************************************/ -@@ -1109,10 +1109,7 @@ - #define LINEWIDTH 79 /* Max width of any output line */ - #define PREFIXLIMIT 30 /* Max width of the prefix on each line */ --void ErrorMsg(va_alist) --va_dcl -+static void -+ErrorMsg(const char *filename, int lineno, const char *format, ...) - { -- char *filename; -- int lineno; -- char *format; - char errmsg[ERRMSGSIZE]; - char prefix[PREFIXLIMIT+10]; -@@ -1123,8 +1120,5 @@ - int end, restart, base; - -- va_start(ap); -- filename = va_arg(ap,char*); -- lineno = va_arg(ap,int); -- format = va_arg(ap,char*); -+ va_start(ap, format); - /* Prepare a prefix to be prepended to every output line */ - if( lineno>0 ){ -@@ -1168,4 +1162,26 @@ - } - -+static char *lempar_locations[] = { -+ NULL, "lempar.c", LEMPAR -+}; -+ -+void setlempar(lempar) -+char *lempar; -+{ -+ if (access(lempar, R_OK)) { -+ perror(lempar); -+ exit(1); -+ } -+ lempar_locations[0] = lempar; -+} -+ -+static char *output_file = NULL; -+ -+void setoutput(base) -+char *base; -+{ -+ if (output_file = malloc(strlen(base) + 1)) -+ sprintf(output_file, "%s.", base); -+} - - /* The main program. Parse the command line and do it... */ -@@ -1185,7 +1201,12 @@ - {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, - {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, -- {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"}, -+ {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file."}, -+ {OPT_FSTR, "o", (char*)setoutput, "Set the dirname/basename for the " -+ "output file(s)."}, - {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."}, - {OPT_FLAG, "s", (char*)&statistics, "Print parser stats to standard output."}, -+ {OPT_FSTR, "t", (char*)setlempar, "An alternative template -- instead of" -+ " ``./lempar.c''\n\t\tor the system wide ``" -+ LEMPAR"''."}, - {OPT_FLAG, "x", (char*)&version, "Print the version number."}, - {OPT_FLAG,0,0,0} -@@ -2305,4 +2326,5 @@ - } - } -+ - /*********************** From the file "report.c" **************************/ - /* -@@ -2318,13 +2340,14 @@ - char *suffix; - { -- char *name; -- char *cp; -+ char *name = NULL; -+ char *cp, *fname; - -- name = malloc( strlen(lemp->filename) + strlen(suffix) + 5 ); -+ fname = output_file ? output_file : lemp->filename; -+ name = malloc( strlen(fname) + strlen(suffix)); - if( name==0 ){ - fprintf(stderr,"Can't allocate space for a filename.\n"); - exit(1); - } -- strcpy(name,lemp->filename); -+ strcpy(name, fname); - cp = strrchr(name,'.'); - if( cp ) *cp = 0; -@@ -2524,47 +2547,14 @@ - } - --/* Search for the file "name" which is in the same directory as --** the exacutable */ --PRIVATE char *pathsearch(argv0,name,modemask) --char *argv0; --char *name; --int modemask; -+PRIVATE const char *pathsearch() - { -- char *pathlist; -- char *path,*cp; -- char c; -- extern int access(); -+ int i; -+ const char *path = NULL; - --#ifdef __WIN32__ -- cp = strrchr(argv0,'\\'); --#else -- cp = strrchr(argv0,'/'); --#endif -- if( cp ){ -- c = *cp; -- *cp = 0; -- path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); -- if( path ) sprintf(path,"%s/%s",argv0,name); -- *cp = c; -- }else{ -- extern char *getenv(); -- pathlist = getenv("PATH"); -- if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; -- path = (char *)malloc( strlen(pathlist)+strlen(name)+2 ); -- if( path!=0 ){ -- while( *pathlist ){ -- cp = strchr(pathlist,':'); -- if( cp==0 ) cp = &pathlist[strlen(pathlist)]; -- c = *cp; -- *cp = 0; -- sprintf(path,"%s/%s",pathlist,name); -- *cp = c; -- if( c==0 ) pathlist = ""; -- else pathlist = &cp[1]; -- if( access(path,modemask)==0 ) break; -- } -- } -- } -- return path; -+ for (i = 0; i < sizeof(lempar_locations)/sizeof(char *); i++) -+ if (lempar_locations[i] && access(lempar_locations[i], R_OK) == 0) -+ return lempar_locations[i]; -+ -+ return(NULL); - } - -@@ -2630,8 +2620,7 @@ - struct lemon *lemp; - { -- static char templatename[] = "lempar.c"; -- char buf[1000]; -+ char buf[MAXPATHLEN]; - FILE *in; -- char *tpltname; -+ const char *tpltname; - char *cp; - -@@ -2642,12 +2631,11 @@ - sprintf(buf,"%s.lt",lemp->filename); - } -- if( access(buf,004)==0 ){ -+ if( access(buf, R_OK)==0 ){ - tpltname = buf; - }else{ -- tpltname = pathsearch(lemp->argv0,templatename,0); -+ tpltname = pathsearch(); - } - if( tpltname==0 ){ -- fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", -- templatename); -+ fprintf(stderr,"Can't find the parser driver template file.\n"); - lemp->errorcnt++; - return 0; -@@ -2655,5 +2643,5 @@ - in = fopen(tpltname,"r"); - if( in==0 ){ -- fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); -+ fprintf(stderr,"Can't open the template file \"%s\".\n", tpltname); - lemp->errorcnt++; - return 0; -- cgit v1.2.3