diff -Nrup re2c-0.9.1/Makefile re2c-0.9.1-gentoo/Makefile --- re2c-0.9.1/Makefile 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/Makefile 2004-04-13 04:15:51.490805058 +0000 @@ -3,13 +3,13 @@ #Initial revision # -BIN = /usr/local/bin -MAN = /usr/local/man +BIN = /usr/bin +MAN = /usr/share/man -%.o : %.cc ; $(CC) -o $@ $(CFLAGS) -c $< +%.o : %.cc ; $(CXX) -o $@ $(CXXFLAGS) -c $< +%.o : %.c ; $(CC) -o $@ $(CFLAGS) -c $< %.cc : %.y ; $(YACC) $(YFLAGS) $<; mv $(YTAB).c $@ %.cc : %.l ; $(LEX) $(LFLAGS) $<; mv $(LEXYY).c $@ - %.cc: %.re re2c -s $< >$@ @@ -30,7 +30,8 @@ clean: parser.cc: parser.y yacc -d parser.y - mv -f y.tab.c parser.cc + grep -v '^char \* getenv' y.tab.c >y.tab.c.new + mv -f y.tab.c.new parser.cc re2c: $(OBJS) $(CC) -o $@ $(OBJS) $(LDFLAGS) -lstdc++ diff -Nrup re2c-0.9.1/actions.cc re2c-0.9.1-gentoo/actions.cc --- re2c-0.9.1/actions.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/actions.cc 2004-04-13 03:38:45.795861228 +0000 @@ -1,7 +1,7 @@ #include #include -#include -#include +#include +#include #include "globals.h" #include "parser.h" diff -Nrup re2c-0.9.1/bootstrap/parser.cc re2c-0.9.1-gentoo/bootstrap/parser.cc --- re2c-0.9.1/bootstrap/parser.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/bootstrap/parser.cc 2004-04-13 03:53:38.914194583 +0000 @@ -10,8 +10,9 @@ static char yysccsid[] = "@(#)yaccpar 1. #define YYPREFIX "yy" #line 2 "parser.y" +#include #include -#include +#include #include #include #include "globals.h" @@ -242,7 +243,6 @@ yyparse() register int yym, yyn, yystate; #if YYDEBUG register char *yys; - extern char *getenv(); if (yys = getenv("YYDEBUG")) { diff -Nrup re2c-0.9.1/bootstrap/scanner.cc re2c-0.9.1-gentoo/bootstrap/scanner.cc --- re2c-0.9.1/bootstrap/scanner.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/bootstrap/scanner.cc 2004-04-13 03:42:41.180051638 +0000 @@ -2,7 +2,7 @@ #line 1 "scanner.re" #include #include -#include +#include #include #include "scanner.h" #include "parser.h" diff -Nrup re2c-0.9.1/code.cc re2c-0.9.1-gentoo/code.cc --- re2c-0.9.1/code.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/code.cc 2004-04-13 03:38:53.875597712 +0000 @@ -1,9 +1,10 @@ #include #include #include -#include -#include "substr.h" +#include + #include "globals.h" +#include "substr.h" #include "dfa.h" // there must be at least one span in list; all spans must cover diff -Nrup re2c-0.9.1/dfa.cc re2c-0.9.1-gentoo/dfa.cc --- re2c-0.9.1/dfa.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/dfa.cc 2004-04-13 03:35:46.100962078 +0000 @@ -1,6 +1,7 @@ #include #include #include + #include "globals.h" #include "substr.h" #include "dfa.h" diff -Nrup re2c-0.9.1/dfa.h re2c-0.9.1-gentoo/dfa.h --- re2c-0.9.1/dfa.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/dfa.h 2004-04-13 03:39:21.297309480 +0000 @@ -1,7 +1,7 @@ #ifndef _dfa_h #define _dfa_h -#include +#include #include "re.h" extern void prtCh(ostream&, uchar); diff -Nrup re2c-0.9.1/examples/rexx/rexx.l re2c-0.9.1-gentoo/examples/rexx/rexx.l --- re2c-0.9.1/examples/rexx/rexx.l 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/examples/rexx/rexx.l 2004-04-13 03:46:20.398770018 +0000 @@ -1,3 +1,4 @@ +#include "globals.h" #include "scanio.h" #include "scanner.h" diff -Nrup re2c-0.9.1/globals.h re2c-0.9.1-gentoo/globals.h --- re2c-0.9.1/globals.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/globals.h 2004-04-13 03:57:53.226425008 +0000 @@ -12,4 +12,15 @@ extern uchar ebc2asc[256]; extern uchar *xlat, *talx; +/* Need to use a few pieces from the `std' namespace */ +using namespace std; + +#ifdef __cplusplus +# define BEGIN_C_DECLS() extern "C" { +# define END_C_DECLS() } +#else +# define BEGIN_C_DECLS() +# define END_C_DECLS() +#endif /* ! __cplusplus */ + #endif diff -Nrup re2c-0.9.1/ins.h re2c-0.9.1-gentoo/ins.h --- re2c-0.9.1/ins.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/ins.h 2004-04-13 03:39:27.514337256 +0000 @@ -1,7 +1,7 @@ #ifndef _ins_h #define _ins_h -#include +#include #include "basics.h" const uint nChars = 256; diff -Nrup re2c-0.9.1/main.cc re2c-0.9.1-gentoo/main.cc --- re2c-0.9.1/main.cc 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/main.cc 2004-04-13 03:39:10.277032841 +0000 @@ -1,7 +1,7 @@ -#include #include #include #include +#include #include "globals.h" #include "parser.h" diff -Nrup re2c-0.9.1/parser.y re2c-0.9.1-gentoo/parser.y --- re2c-0.9.1/parser.y 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/parser.y 2004-04-13 04:12:28.852493819 +0000 @@ -1,15 +1,23 @@ %{ +#include #include -#include +#include #include #include + #include "globals.h" #include "parser.h" +#include "scanner.h" + +BEGIN_C_DECLS() + int yyparse(); int yylex(); void yyerror(char*); +END_C_DECLS() + static uint accept; static RegExp *spec; static Scanner *in; diff -Nrup re2c-0.9.1/re.h re2c-0.9.1-gentoo/re.h --- re2c-0.9.1/re.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/re.h 2004-04-13 03:39:33.966328288 +0000 @@ -1,7 +1,7 @@ #ifndef _re_h #define _re_h -#include +#include #include "token.h" #include "ins.h" diff -Nrup re2c-0.9.1/scanner.h re2c-0.9.1-gentoo/scanner.h --- re2c-0.9.1/scanner.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/scanner.h 2004-04-13 03:32:35.648745166 +0000 @@ -6,10 +6,10 @@ class Scanner { private: int in; - uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; + char *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof; uint tchar, tline, cline; private: - uchar *fill(uchar*); + char *fill(char*); public: Scanner(int); int echo(ostream&); diff -Nrup re2c-0.9.1/scanner.re re2c-0.9.1-gentoo/scanner.re --- re2c-0.9.1/scanner.re 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/scanner.re 2004-04-13 03:55:45.524395166 +0000 @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include "scanner.h" #include "parser.h" @@ -10,7 +10,7 @@ extern YYSTYPE yylval; #define BSIZE 8192 -#define YYCTYPE uchar +#define YYCTYPE char #define YYCURSOR cursor #define YYLIMIT lim #define YYMARKER ptr @@ -25,7 +25,7 @@ Scanner::Scanner(int i) : in(i), ; } -uchar *Scanner::fill(uchar *cursor){ +char *Scanner::fill(char *cursor){ if(!eof){ uint cnt = tok - bot; if(cnt){ @@ -37,7 +37,7 @@ uchar *Scanner::fill(uchar *cursor){ lim -= cnt; } if((top - lim) < BSIZE){ - uchar *buf = new uchar[(lim - bot) + BSIZE]; + char *buf = new char[(lim - bot) + BSIZE]; memcpy(buf, tok, lim - tok); tok = buf; ptr = &buf[ptr - bot]; @@ -68,7 +68,7 @@ digit = [0-9]; */ int Scanner::echo(ostream &out){ - uchar *cursor = cur; + char *cursor = cur; tok = cursor; echo: /*!re2c @@ -85,7 +85,7 @@ echo: int Scanner::scan(){ - uchar *cursor = cur; + char *cursor = cur; uint depth; scan: diff -Nrup re2c-0.9.1/substr.h re2c-0.9.1-gentoo/substr.h --- re2c-0.9.1/substr.h 1999-08-27 03:46:32.000000000 +0000 +++ re2c-0.9.1-gentoo/substr.h 2004-04-13 04:11:24.262594445 +0000 @@ -1,7 +1,8 @@ #ifndef _substr_h #define _substr_h -#include +#include +#include "globals.h" #include "basics.h" class SubStr {