# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # ox/ # ox/Makefile # ox/distinfo # ox/pkg-descr # ox/files # ox/files/patch-flex # echo c - ox/ mkdir -p ox/ > /dev/null 2>&1 echo x - ox/Makefile sed 's/^X//' >ox/Makefile << 'END-of-ox/Makefile' X# New ports collection Makefile for: ox X# Date created: 2005-11-29 X# Whom: arved X# X# $FreeBSD$ X XPORTNAME= ox XPORTVERSION= 1.04 XCATEGORIES= devel XMASTER_SITES= http://www.complang.tuwien.ac.at/ublu/tools/ox/ XDISTNAME= oxDistG1.04 XEXTRACT_SUFX= .sh.Z X XMAINTAINER= arved@FreeBSD.org XCOMMENT= A preprocessor for yacc/lex X XUNCOMPRESS?= /usr/bin/uncompress XWRKSRC= ${WRKDIR}/${DISTNAME}/source XALL_TARGET= ox XPLIST_FILES= bin/ox X Xdo-extract: X ${MKDIR} ${WRKSRC} X cp ${DISTDIR}/${DISTFILES} ${WRKDIR} X ${UNCOMPRESS} ${WRKDIR}/${DISTFILES} X cd ${WRKDIR}; ${SH} ${DISTFILES:S/.Z//} X Xdo-install: X ${INSTALL_PROGRAM} ${WRKSRC}/ox ${PREFIX}/bin X X.include END-of-ox/Makefile echo x - ox/distinfo sed 's/^X//' >ox/distinfo << 'END-of-ox/distinfo' XMD5 (oxDistG1.04.sh.Z) = c5817fa2033cdf16fd8b554fbf227461 XSHA256 (oxDistG1.04.sh.Z) = 4481dbc03d8c919044d21441176cf416ce62a7f9c535a535882e3e414996db02 XSIZE (oxDistG1.04.sh.Z) = 898773 END-of-ox/distinfo echo x - ox/pkg-descr sed 's/^X//' >ox/pkg-descr << 'END-of-ox/pkg-descr' XOx is a Yacc/Lex/C preprocessor, and is designed to bring Xattribute grammars to the mainstream of Unix-based language Xdevelopment. Ox inherits all of the familiar syntax and Xsemantics of Yacc, Lex, and C, so it is a good choice for Xlanguage designers, experimenters, and developers familiar with Xthose tools. It is relatively easy to convert programs between XOx code and "pure Yacc/Lex/C" code. Ox is carefully engineered Xfor reliability, portability, compatibility, simplicity, and Xefficiency. Ox can be used with Bison, Flex, and C++. X XAuthor: Kurt Bischoff END-of-ox/pkg-descr echo c - ox/files mkdir -p ox/files > /dev/null 2>&1 echo x - ox/files/patch-flex sed 's/^X//' >ox/files/patch-flex << 'END-of-ox/files/patch-flex' Xdiff -Naur oxDistG1.04.orig/source/agc1.l source/agc1.l X--- oxDistG1.04.orig/source/agc1.l 2004-04-30 15:26:24.000000000 +0200 X+++ agc1.l 2004-04-30 15:29:49.000000000 +0200 X@@ -1,4 +1,5 @@ X %start YD YDSI ADECL MH MB LVA ADSL UU CC TRDECL X+%option yylineno X X X %{ X@@ -69,6 +70,7 @@ X #include "outMgr.h" X #include "symTrans.h" X #include "ctc.h" X+#define YY_USER_ACTION ptext=yytext; X %} X X X@@ -247,7 +249,7 @@ X X void beginCC() {BEGIN CC;} X X-int yyScnState() {return (yybgin-yysvec-1);} X+int yyScnState() {return YY_START;} X X yywrap() X { Xdiff -Naur oxDistG1.04.orig/source/agc2.l source/agc2.l X--- oxDistG1.04.orig/source/agc2.l 2004-04-30 15:26:24.000000000 +0200 X+++ agc2.l 2004-04-30 15:29:50.000000000 +0200 X@@ -1,6 +1,7 @@ X %start YR YR1 AA LAAA LAAA1 X %start DL CL TT MUI TRAV1 TRVACT TRVCOND X-%start EOSFRET X+%start EOSFRET SKIP X+%option yylineno X X %{ X /* $Header: agc2.l,v 5.10 94/04/16 20:23:56 bischoff Exp $ */ X@@ -77,6 +78,7 @@ X int startCondTempT; X int nLparensT; X enum {oCond,dCond,action} travState; X+#define YY_USER_ACTION ptext=yytext; X %} X X X@@ -92,7 +94,10 @@ X X IDENT ([a-zA-Z][a-zA-Z0-9]*) X %% X-x {scanScanInit(); return(EOSF);} X+^{OPTWS}%%{OPTWS}$ BEGIN YR; X+. | X+\n ; X+<> {scanScanInit(); return(EOSF);} X [ \t\n\f] {flushLAbuffer(LA1,outG); charOut(*yytext,outG);} X \/\* {flushLAbuffer(LA1,outG); eatCommentAndEcho(outG,1);} X \/\/.*\n {flushLAbuffer(LA1,outG); lexemeOut(outG);} X@@ -343,13 +348,14 @@ X X X void scanInit2() X- {whichScanner = 2; X- yylineno = *plineno; X+ {whichScanner = 2; X+ yylineno=0; X plineno = &yylineno; X ptext = (char *)yytext; X pleng = &yyleng; X- BEGIN YR; X+ BEGIN SKIP; X yyin = yoxInG; X+ rewind(yyin); X } X X X@@ -357,7 +363,7 @@ X void beginAA() {BEGIN AA;} X void beginTT() {BEGIN TT;} X X-int yyScnState() {return (yybgin-yysvec-1);} X+int yyScnState() {return YY_START;} X X yywrap() X { X@@ -368,7 +374,7 @@ X } X unput('x'); X BEGIN EOSFRET; X- return 0; X+ return 1; X X err1: X rmTempFiles(); Xdiff -Naur oxDistG1.04.orig/source/agc3.l source/agc3.l X--- oxDistG1.04.orig/source/agc3.l 2004-04-30 15:26:24.000000000 +0200 X+++ agc3.l 2004-04-30 15:29:51.000000000 +0200 X@@ -1,4 +1,5 @@ X %start EOSFRET LD LRP LRRE LRRE1 LRA LRAAD LRAAR LRAAR1 LRAAD1 LUS MUI X+%option yylineno X X %{ X /* $Header: agc3.l,v 5.10 94/04/16 20:23:59 bischoff Exp $ */ X@@ -78,6 +79,7 @@ X static int nLparMac; X static FILE *tempForTrash; X int yyStartCondTemp; X+#define YY_USER_ACTION ptext=yytext; X %} X X X@@ -92,7 +94,7 @@ X X IDENT ([a-zA-Z][a-zA-Z0-9]*) X %% X-x {scanScanInit(); return EOSF;} X+<> {scanScanInit(); return EOSF;} X ^\%\%(.*) {BEGIN LRP; X if (!buildHeaderFile) X {fprintf(Lfile[currentLfile].outPtr,"\n%%{\n"); X@@ -338,7 +340,7 @@ X } X X X-int yyScnState() {return (yybgin-yysvec-1);} X+int yyScnState() {return YY_START;} X X X X@@ -356,9 +358,8 @@ X } X if (yyScnState() == LRAAR) X yerror("error: identifier expected after \"return\".\n"); X- unput('x'); X BEGIN EOSFRET; X- return 0; X+ return 1; X X err1: X rmTempFiles(); Xdiff -Naur oxDistG1.04.orig/source/agc4.l source/agc4.l X--- oxDistG1.04.orig/source/agc4.l 2004-04-30 15:26:24.000000000 +0200 X+++ agc4.l 2004-04-30 15:29:52.000000000 +0200 X@@ -1,5 +1,6 @@ X %start GEN ADECL AADECL ADS MAC TRDECL X %start LD LRP LRRE LRRE1 LRA LRAAD LUS X+%option yylineno X X %{ X /* $Header: agc4.l,v 5.10 94/04/16 20:24:02 bischoff Exp $ */ X@@ -68,6 +69,7 @@ X #include "opts.hh" X #include "opts.h" X #include "outMgr.h" X+#define YY_USER_ACTION ptext=yytext; X %} X X WS [ \t\f]+ X@@ -164,7 +166,7 @@ X inFileStr = yoxInFileStrG; X } X X-int yyScnState() {return (yybgin-yysvec-1);} X+int yyScnState() {return YY_START;} X X int yywrap() X { Xdiff -Naur oxDistG1.04.orig/source/agc5.l source/agc5.l X--- oxDistG1.04.orig/source/agc5.l 2004-04-30 15:26:24.000000000 +0200 X+++ agc5.l 2004-04-30 15:29:54.000000000 +0200 X@@ -1,4 +1,5 @@ X %start EOSFRET LRA LRAAD LRAAR LRAAR1 LRAAD1 LUS MUI X+%option yylineno X X %{ X /* $Header: agc5.l,v 5.10 94/04/16 20:24:04 bischoff Exp $ */ X@@ -78,6 +79,7 @@ X static int nLparMac; X static FILE *tempForTrash; X int yyStartCondTemp; X+#define YY_USER_ACTION ptext=yytext; X %} X X X@@ -92,7 +94,7 @@ X X IDENT ([a-zA-Z][a-zA-Z0-9]*) X %% X-x {scanScanInit(); return(EOSF);} X+<> {scanScanInit(); return(EOSF);} X \/\* eatCommentAndEcho(outL,1); X \/\/.*\n lexemeOut(outL); X \" eatStringAndEcho(outL); X@@ -281,7 +283,7 @@ X } X X X-int yyScnState() {return (yybgin-yysvec-1);} X+int yyScnState() {return YY_START;} X X X X@@ -291,7 +293,7 @@ X yerror("error: identifier expected after \"return\".\n"); X unput('x'); X BEGIN EOSFRET; X- return 0; X+ return 1; X X err1: X rmTempFiles(); Xdiff -Naur oxDistG1.04.orig/source/mac.c source/mac.c X--- oxDistG1.04.orig/source/mac.c 2004-04-30 15:26:25.000000000 +0200 X+++ mac.c 2004-04-30 15:29:55.000000000 +0200 X@@ -440,7 +440,8 @@ X {char c; X X c = *(macStackTop->nextChar)++; X- if (!makeReadyInputFromMacro()) switchInputStreamFromMacro(); X+ if (!makeReadyInputFromMacro()) switchInputStreamFromMacro(); X+ if(c=='\n')c='\t'; X return c; X } X Xdiff -Naur oxDistG1.04.orig/source/Makefile source/Makefile X--- oxDistG1.04.orig/source/Makefile 2004-04-30 15:26:24.000000000 +0200 X+++ Makefile 2004-04-30 15:34:54.000000000 +0200 X@@ -6,6 +6,7 @@ X # or software environment. X X CC=cc X+LEX=flex -l X X SHELL= /bin/sh X X@@ -17,25 +18,25 @@ X mac.o trav.o treeShow.o xtreeshw.o X X medyy : medyy.l X- lex medyy.l; $(CC) -o medyy lex.yy.c -ll X+ $(LEX) medyy.l; $(CC) -o medyy lex.yy.c -ll X X medi : medi.l X- lex medi.l; $(CC) -o medi lex.yy.c -ll X+ $(LEX) medi.l; $(CC) -o medi lex.yy.c -ll X X lexyy1.c : agc1.l medyy X- lex agc1.l; ./medyy lex.yy.c lexyy1.c 1 X+ $(LEX) agc1.l; ./medyy lex.yy.c lexyy1.c 1 X X lexyy2.c : agc2.l medyy medi X- lex agc2.l; ./medi lex.yy.c lex.yyM2.c ; ./medyy lex.yyM2.c lexyy2.c 2 X+ $(LEX) agc2.l; ./medi lex.yy.c lex.yyM2.c ; ./medyy lex.yyM2.c lexyy2.c 2 X X lexyy3.c : agc3.l medyy medi X- lex agc3.l; ./medi lex.yy.c lex.yyM3.c ; ./medyy lex.yyM3.c lexyy3.c 3 X+ $(LEX) agc3.l; ./medi lex.yy.c lex.yyM3.c ; ./medyy lex.yyM3.c lexyy3.c 3 X X lexyy4.c : agc4.l medyy medi X- lex agc4.l; ./medyy lex.yy.c lexyy4.c 4 X+ $(LEX) agc4.l; ./medyy lex.yy.c lexyy4.c 4 X X lexyy5.c : agc5.l medyy medi X- lex agc5.l; ./medi lex.yy.c lex.yyM5.c ; ./medyy lex.yyM5.c lexyy5.c 5 X+ $(LEX) agc5.l; ./medi lex.yy.c lex.yyM5.c ; ./medyy lex.yyM5.c lexyy5.c 5 X X lexyy1.o : lexyy1.c glob.h scan.h opts.h outMgr.h symTrans.h ctc.h X $(CC) -c lexyy1.c Xdiff -Naur oxDistG1.04.orig/source/medi.l source/medi.l X--- oxDistG1.04.orig/source/medi.l 2004-04-30 15:26:25.000000000 +0200 X+++ medi.l 2004-04-30 15:30:28.000000000 +0200 X@@ -121,10 +121,10 @@ X char *substIText[] = { X "extern int inFromMac;\n", X "extern char inputFromMacro();\n", X-"#define input() (inFromMac?((yysptr>yysbuf)?(*--yysptr):\\\n", X+"#define myinput() (inFromMac?((yysptr>yysbuf)?(*--yysptr):\\\n", X " inputFromMacro()\\\n", X " ):\\\n", X-" inputM()\\\n", X+" getc(yyin)\\\n", X " )\n", X }; X X@@ -144,7 +144,7 @@ X "#define unput(c) {if (inFromMac) \\\n", X " {yytchar= (c);*yysptr++=yytchar;} \\\n", X " else \\\n", X-" unputM(c) \\\n", X+" unputM(c); \\\n", X " }\n", X }; X X@@ -170,6 +170,13 @@ X if ((outFile = fopen(argv[2],"w")) == (FILE *)NULL) X fprintf(stderr,"error when trying to open output file for med\n"); X yyout = outFile; X+fprintf(outFile,"#include \nchar yytchar,yysbuf[BUFSIZ]={0},*yysptr=&yysbuf[0];\n"); X+fprintf(outFile,"#define YY_INPUT(buf,result,max_size) " X+" { " X+" int c = myinput(); " X+" result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); " X+" }\n"); X+substInputDef(outFile); X yylex(); X fclose(inFile); X fclose(outFile); Xdiff -Naur oxDistG1.04.orig/source/medyy.l source/medyy.l X--- oxDistG1.04.orig/source/medyy.l 2004-04-30 15:26:25.000000000 +0200 X+++ medyy.l 2004-04-30 15:29:57.000000000 +0200 X@@ -105,6 +105,7 @@ X yyout = outFile; X modString = argv[3]; X yylex(); X+fprintf(outFile,"int yy%sinput(){return input();}\n",modString); X fclose(inFile); X fclose(outFile); X erasf(argv[1]); Xdiff -Naur oxDistG1.04.orig/source/opts.c source/opts.c X--- oxDistG1.04.orig/source/opts.c 2004-04-30 15:26:25.000000000 +0200 X+++ opts.c 2004-04-30 15:29:58.000000000 +0200 X@@ -488,9 +488,9 @@ X fclose(yoxOutG); X for (i=0;i