diff --git a/.cvsignore b/.cvsignore index e69de29..8e809b2 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +flex-2.5.4a.tar.gz diff --git a/README.fedora b/README.fedora new file mode 100644 index 0000000..24b1c8e --- /dev/null +++ b/README.fedora @@ -0,0 +1,22 @@ +compat-flex for Fedora +---------------------- + +The package compat-flex is provided as a safe default for cases, where +new flex (2.5.33 at the time of this writing) fails to work for some +reason. It is possible to have this package installed alongside flex, +and pick whichever of them you need at the moment. + +You need to do the following to compile your project with compat-flex: + + + Process the .l file with either flex-2.5.4a, or flex-2.5.4a++, + depending on whether you want C or C++ scanner. + + + Use -I/usr/include/flex-2.5.4a compilation flag when you use + header file. + + + Use -L/usr/lib/flex-2.5.4a (or -L/usr/lib64/flex-2.5.4a on 64bits) + linker flag when linking against -lfl. + +If the build system supports this, all you need to do is provide the +right values of FLEX, CFLAGS or CPPFLAGS, and LDFLAGS environment +variables. diff --git a/compat-flex.spec b/compat-flex.spec new file mode 100644 index 0000000..425e9da --- /dev/null +++ b/compat-flex.spec @@ -0,0 +1,96 @@ +Summary: Legacy version of flex, a tool for creating scanners +Name: compat-flex +Version: 2.5.4a +Release: 1%{?dist} +License: BSD +Group: Development/Tools +URL: http://www.gnu.org/software/flex/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source: ftp://ftp.gnu.org/non-gnu/flex/flex-2.5.4a.tar.gz +Source2: README.fedora +Patch0: flex-2.5.4a-skel.patch +Patch1: flex-2.5.4-glibc22.patch +Patch2: flex-2.5.4a-gcc3.patch +Patch3: flex-2.5.4a-gcc31.patch +Patch4: flex-2.5.4a2.patch +Patch5: flex-pic.patch +Patch6: flex-2.5.4a2-std.patch +Patch7: flex-2.5.4a2-warn.patch +Patch8: flex-2.5.4a2-shapwarn.patch +Patch9: flex-2.5.4a2-iniscan.patch +Patch10: flex-2.5.4a-Makefile.in.patch +BuildRequires: autoconf byacc texinfo info + +%description + +This is legacy version of flex, a program that generates scanners. +Scanners are programs which can recognize lexical patterns in text. +Flex takes pairs of regular expressions and C code as input and +generates a C source file as output. The output file is compiled and +linked with a library to produce an executable. The executable +searches through its input for occurrences of the regular expressions. +When a match is found, it executes the corresponding C code. Flex was +designed to work with both Yacc and Bison, and is used by many +programs as part of their build process. + +You should install flex if you are going to use your system for +application development. + +%prep +%setup -q -n flex-2.5.4 +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +cp %{SOURCE2} . + +%build +autoconf +%configure +sed -i '/^START-INFO-DIR-ENTRY/,/^END-INFO-DIR-ENTRY/s/[Ff]lex/&-%{version}/g' ./MISC/texinfo/flex.texi +make FLEX=flex-%{version} +makeinfo MISC/texinfo/flex.texi -o MISC/texinfo/flex-%{version}.info + +%install +rm -rf $RPM_BUILD_ROOT +%{makeinstall} FLEX=flex-%{version} libdir=$RPM_BUILD_ROOT/%{_libdir}/flex-%{version} mandir=$RPM_BUILD_ROOT/%{_mandir}/man1 +./mkinstalldirs $RPM_BUILD_ROOT/%{_infodir} $RPM_BUILD_ROOT/%{_includedir}/flex-%{version} +install -m 644 MISC/texinfo/flex-%{version}.info $RPM_BUILD_ROOT/%{_infodir}/flex-%{version}.info +mv ${RPM_BUILD_ROOT}/%{_includedir}/FlexLexer.h ${RPM_BUILD_ROOT}/%{_includedir}/flex-%{version}/FlexLexer.h +ln -s flex-%{version}.1 ${RPM_BUILD_ROOT}/%{_mandir}/man1/flex-%{version}++.1 + +%check +echo ============TESTING=============== +make FLEX=flex-%{version} bigcheck +echo ============END TESTING=========== + +%post +/sbin/install-info %{_infodir}/flex-%{version}.info --dir-file=%{_infodir}/dir ||: + +%preun +if [ $1 = 0 ]; then + /sbin/install-info --delete %{_infodir}/flex-%{version}.info %{_infodir}/dir ||: +fi + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%files +%defattr(-,root,root) +%doc COPYING NEWS README README.fedora +%{_bindir}/* +%{_mandir}/man1/* +%{_libdir}/flex-%{version} +%{_includedir}/flex-%{version} +%{_infodir}/flex-%{version}.info* + +%changelog +* Wed Jan 18 2006 Petr Machata - 2.5.4a-1 +- Initial build. diff --git a/flex-2.5.4-glibc22.patch b/flex-2.5.4-glibc22.patch new file mode 100644 index 0000000..299aa70 --- /dev/null +++ b/flex-2.5.4-glibc22.patch @@ -0,0 +1,108 @@ +--- flex-2.5.4/initscan.c.broken Sat Sep 30 16:50:31 2000 ++++ flex-2.5.4/initscan.c Sat Sep 30 16:51:34 2000 +@@ -10,7 +10,7 @@ + #define YY_FLEX_MINOR_VERSION 5 + + #include +- ++#include + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus +@@ -23,7 +23,6 @@ + #ifdef __cplusplus + + #include +-#include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS +@@ -3310,12 +3309,6 @@ + yy_flex_free( (void *) b ); + } + +- +-#ifndef YY_ALWAYS_INTERACTIVE +-#ifndef YY_NEVER_INTERACTIVE +-extern int isatty YY_PROTO(( int )); +-#endif +-#endif + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +--- flex-2.5.4/flex.skl.broken Sat Sep 30 16:51:05 2000 ++++ flex-2.5.4/flex.skl Sat Sep 30 16:52:24 2000 +@@ -10,6 +10,7 @@ + + %- + #include ++#include + %* + + +@@ -27,7 +28,6 @@ + %+ + class istream; + %* +-#include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS +@@ -1177,11 +1177,6 @@ + + + %- +-#ifndef YY_ALWAYS_INTERACTIVE +-#ifndef YY_NEVER_INTERACTIVE +-extern int isatty YY_PROTO(( int )); +-#endif +-#endif + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +@@ -1192,7 +1187,6 @@ + #endif + + %+ +-extern "C" int isatty YY_PROTO(( int )); + void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) + %* + +--- flex-2.5.4/skel.c.broken Sat Sep 30 16:52:34 2000 ++++ flex-2.5.4/skel.c Sat Sep 30 16:53:15 2000 +@@ -15,6 +15,7 @@ + "", + "%-", + "#include ", ++ "#include ", + "%*", + "", + "", +@@ -32,7 +33,6 @@ + "%+", + "class istream;", + "%*", +- "#include ", + "", + "/* Use prototypes in function declarations. */", + "#define YY_USE_PROTOS", +@@ -1182,11 +1182,6 @@ + "", + "", + "%-", +- "#ifndef YY_ALWAYS_INTERACTIVE", +- "#ifndef YY_NEVER_INTERACTIVE", +- "extern int isatty YY_PROTO(( int ));", +- "#endif", +- "#endif", + "", + "#ifdef YY_USE_PROTOS", + "void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )", +@@ -1197,7 +1192,6 @@ + "#endif", + "", + "%+", +- "extern \"C\" int isatty YY_PROTO(( int ));", + "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )", + "%*", + "", diff --git a/flex-2.5.4a-Makefile.in.patch b/flex-2.5.4a-Makefile.in.patch new file mode 100644 index 0000000..20f8e25 --- /dev/null +++ b/flex-2.5.4a-Makefile.in.patch @@ -0,0 +1,28 @@ +--- flex-2.5.4/Makefile.in 2006-03-09 19:28:41.000000000 +0100 ++++ flex-2.5.4/Makefile.in_new 2006-03-09 19:29:48.000000000 +0100 +@@ -114,6 +114,7 @@ scan.c: scan.l + $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l >scan.c + @sed s,\"$(srcdir)/scan.l\",\"scan.l\", scan.tmp + @mv scan.tmp scan.c ++ -rm $(FLEX) + + scan.o: scan.c parse.h flexdef.h config.h + yylex.o: yylex.c parse.h flexdef.h config.h +@@ -146,7 +147,7 @@ alloca.c: $(srcdir)/MISC/alloca.c + cp $(srcdir)/MISC/alloca.c . + + test: check +-check: $(FLEX) ++check: scan.c $(FLEX) + $(FLEX_EXEC) $(FLEX_FLAGS) $(COMPRESSION) $(srcdir)/scan.l \ + | sed s,\"$(srcdir)/scan.l\",\"scan.l\", \ + | diff scan.c - +@@ -160,7 +161,7 @@ bigcheck: + rm -f scan.c ; $(MAKE) COMPRESSION="-Cfea" check + rm -f scan.c ; $(MAKE) COMPRESSION="-CFer" check + rm -f scan.c ; $(MAKE) COMPRESSION="-l" PERF_REPORT="" check +- rm -f scan.c ; $(MAKE) ++ rm -f scan.c ; $(MAKE) check + @echo "All checks successful" + + $(FLEXLIB): $(LIBOBJS) diff --git a/flex-2.5.4a-gcc3.patch b/flex-2.5.4a-gcc3.patch new file mode 100644 index 0000000..a73dc41 --- /dev/null +++ b/flex-2.5.4a-gcc3.patch @@ -0,0 +1,11 @@ +--- flex-2.5.4/skel.c.orig Tue Nov 6 17:29:12 2001 ++++ flex-2.5.4/skel.c Tue Nov 6 17:28:49 2001 +@@ -31,7 +31,7 @@ + "", + "#include ", + "%+", +- "class istream;", ++ "#include ", + "%*", + "", + "/* Use prototypes in function declarations. */", diff --git a/flex-2.5.4a-gcc31.patch b/flex-2.5.4a-gcc31.patch new file mode 100644 index 0000000..a8c0181 --- /dev/null +++ b/flex-2.5.4a-gcc31.patch @@ -0,0 +1,94 @@ +--- flex-2.5.4/skel.c.gcc31 Wed Feb 20 12:15:18 2002 ++++ flex-2.5.4/skel.c Wed Feb 20 12:15:18 2002 +@@ -31,7 +31,8 @@ + "", + "#include ", + "%+", +- "#include ", ++ "#include ", ++ "using namespace std;", + "%*", + "", + "/* Use prototypes in function declarations. */", +--- flex-2.5.4/FlexLexer.h.gcc31 Sun Jul 27 04:41:38 1997 ++++ flex-2.5.4/FlexLexer.h Fri Mar 1 20:38:04 2002 +@@ -44,7 +44,7 @@ + #ifndef __FLEX_LEXER_H + // Never included before - need to define base class. + #define __FLEX_LEXER_H +-#include ++#include + + extern "C++" { + +@@ -61,14 +61,14 @@ + virtual void + yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; + virtual struct yy_buffer_state* +- yy_create_buffer( istream* s, int size ) = 0; ++ yy_create_buffer( std::istream* s, int size ) = 0; + virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; +- virtual void yyrestart( istream* s ) = 0; ++ virtual void yyrestart( std::istream* s ) = 0; + + virtual int yylex() = 0; + + // Call yylex with new input/output sources. +- int yylex( istream* new_in, ostream* new_out = 0 ) ++ int yylex( std::istream* new_in, std::ostream* new_out = 0 ) + { + switch_streams( new_in, new_out ); + return yylex(); +@@ -76,8 +76,8 @@ + + // Switch to new input/output streams. A nil stream pointer + // indicates "keep the current one". +- virtual void switch_streams( istream* new_in = 0, +- ostream* new_out = 0 ) = 0; ++ virtual void switch_streams( std::istream* new_in = 0, ++ std::ostream* new_out = 0 ) = 0; + + int lineno() const { return yylineno; } + +@@ -104,17 +104,17 @@ + public: + // arg_yyin and arg_yyout default to the cin and cout, but we + // only make that assignment when initializing in yylex(). +- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); ++ yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 ); + + virtual ~yyFlexLexer(); + + void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); +- struct yy_buffer_state* yy_create_buffer( istream* s, int size ); ++ struct yy_buffer_state* yy_create_buffer( std::istream* s, int size ); + void yy_delete_buffer( struct yy_buffer_state* b ); +- void yyrestart( istream* s ); ++ void yyrestart( std::istream* s ); + + virtual int yylex(); +- virtual void switch_streams( istream* new_in, ostream* new_out ); ++ virtual void switch_streams( std::istream* new_in, std::ostream* new_out ); + + protected: + virtual int LexerInput( char* buf, int max_size ); +@@ -125,7 +125,7 @@ + int yyinput(); + + void yy_load_buffer_state(); +- void yy_init_buffer( struct yy_buffer_state* b, istream* s ); ++ void yy_init_buffer( struct yy_buffer_state* b, std::istream* s ); + void yy_flush_buffer( struct yy_buffer_state* b ); + + int yy_start_stack_ptr; +@@ -140,8 +140,8 @@ + yy_state_type yy_try_NUL_trans( yy_state_type current_state ); + int yy_get_next_buffer(); + +- istream* yyin; // input source for default LexerInput +- ostream* yyout; // output sink for default LexerOutput ++ std::istream* yyin; // input source for default LexerInput ++ std::ostream* yyout; // output sink for default LexerOutput + + struct yy_buffer_state* yy_current_buffer; + diff --git a/flex-2.5.4a-skel.patch b/flex-2.5.4a-skel.patch new file mode 100644 index 0000000..5f8222a --- /dev/null +++ b/flex-2.5.4a-skel.patch @@ -0,0 +1,11 @@ +--- flex-2.5.4/skel.c.skel Wed Aug 25 14:02:51 1999 ++++ flex-2.5.4/skel.c Wed Aug 25 14:03:16 1999 +@@ -454,7 +454,7 @@ + "YY_DECL", + " {", + " register yy_state_type yy_current_state;", +- " register char *yy_cp, *yy_bp;", ++ " register char *yy_cp = NULL, *yy_bp = NULL;", + " register int yy_act;", + "", + "%% user's declarations go here", diff --git a/flex-2.5.4a2-iniscan.patch b/flex-2.5.4a2-iniscan.patch new file mode 100644 index 0000000..32db4ae --- /dev/null +++ b/flex-2.5.4a2-iniscan.patch @@ -0,0 +1,97 @@ +diff -burp flex-2.5.4/initscan.c flex-2.5.4-iniscan/initscan.c +--- flex-2.5.4/initscan.c 2006-01-13 16:16:52.000000000 +0100 ++++ flex-2.5.4-iniscan/initscan.c 2006-02-02 18:15:26.000000000 +0100 +@@ -1,5 +1,5 @@ + #line 2 "scan.c" +-/* A lexical scanner generated by flex */ ++/* A lexical scanner generated by flex*/ + + /* Scanner skeleton version: + * $Header: /home/fedora/jkeating/pkgs/rpms/compat-flex/devel/flex-2.5.4a2-iniscan.patch,v 1.1 2007/03/21 18:11:00 pmachata Exp $ +@@ -12,6 +12,7 @@ + #include + #include + ++ + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus + #ifndef __cplusplus +@@ -134,6 +135,15 @@ extern FILE *yyin, *yyout; + + #define unput(c) yyunput( c, yytext_ptr ) + ++/* Some routines like yy_flex_realloc() are emitted as static but are ++ not called by all lexers. This generates warnings in some compilers, ++ notably GCC. Arrange to suppress these. */ ++#ifdef __GNUC__ ++#define YY_MAY_BE_UNUSED __attribute__((unused)) ++#else ++#define YY_MAY_BE_UNUSED ++#endif ++ + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). +@@ -240,7 +250,7 @@ YY_BUFFER_STATE yy_scan_string YY_PROTO( + YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + + static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); ++static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; + static void yy_flex_free YY_PROTO(( void * )); + + #define yy_new_buffer yy_create_buffer +@@ -1328,7 +1338,7 @@ char *yytext; + #define OPTION 17 + #define LINEDIR 18 + +-#line 1333 "scan.c" ++#line 1342 "scan.c" + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -1479,7 +1489,7 @@ YY_MALLOC_DECL + YY_DECL + { + register yy_state_type yy_current_state; +- register char *yy_cp, *yy_bp; ++ register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + + #line 94 "scan.l" +@@ -1493,7 +1503,7 @@ YY_DECL + Char nmdef[MAXLINE], myesc(); + + +-#line 1498 "scan.c" ++#line 1507 "scan.c" + + if ( yy_init ) + { +@@ -2731,7 +2741,7 @@ YY_RULE_SETUP + #line 650 "scan.l" + YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +-#line 2736 "scan.c" ++#line 2745 "scan.c" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(SECT2): + case YY_STATE_EOF(CODEBLOCK): +@@ -3200,8 +3210,7 @@ static int input() + + return c; + } +-#endif /* ifndef YY_NO_INPUT */ +- ++#endif /* YY_NO_INPUT */ + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) +@@ -3312,6 +3321,7 @@ YY_BUFFER_STATE b; + } + + ++ + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) + #else diff --git a/flex-2.5.4a2-shapwarn.patch b/flex-2.5.4a2-shapwarn.patch new file mode 100644 index 0000000..36d7cc7 --- /dev/null +++ b/flex-2.5.4a2-shapwarn.patch @@ -0,0 +1,92 @@ +diff -Burp flex-2.5.4/gen.c flex-2.5.4shap/gen.c +--- flex-2.5.4/gen.c 1997-07-26 22:32:18.000000000 -0400 ++++ flex-2.5.4shap/gen.c 2006-01-15 11:49:20.000000000 -0500 +@@ -1437,7 +1437,7 @@ void make_tables() + indent_puts( "if ( yy_act == 0 )" ); + indent_up(); + indent_puts( C_plus_plus ? +- "cerr << \"--scanner backing up\\n\";" : ++ "std::cerr << \"--scanner backing up\\n\";" : + "fprintf( stderr, \"--scanner backing up\\n\" );" ); + indent_down(); + +@@ -1448,7 +1448,7 @@ void make_tables() + if ( C_plus_plus ) + { + indent_puts( +- "cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); ++ "std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); + indent_puts( + " \"(\\\"\" << yytext << \"\\\")\\n\";" ); + } +@@ -1470,7 +1470,7 @@ void make_tables() + if ( C_plus_plus ) + { + indent_puts( +-"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); ++"std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); + } + else + { +@@ -1486,7 +1486,7 @@ void make_tables() + indent_up(); + + indent_puts( C_plus_plus ? +- "cerr << \"--(end of buffer or a NUL)\\n\";" : ++ "std::cerr << \"--(end of buffer or a NUL)\\n\";" : + "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); + + indent_down(); +@@ -1498,7 +1498,7 @@ void make_tables() + if ( C_plus_plus ) + { + indent_puts( +- "cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); ++ "std::cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); + } + else + { +diff -Burp flex-2.5.4/skel.c flex-2.5.4shap/skel.c +--- flex-2.5.4/skel.c 2006-01-14 22:53:17.000000000 -0500 ++++ flex-2.5.4shap/skel.c 2006-01-15 11:56:59.000000000 -0500 +@@ -146,6 +146,15 @@ const char *skel[] = { + "", + "#define unput(c) yyunput( c, yytext_ptr )", + "", ++ "/* Some routines like yy_flex_realloc() are emitted as static but are", ++ " not called by all lexers. This generates warnings in some compilers,", ++ " notably GCC. Arrange to suppress these. */", ++ "#ifdef __GNUC__", ++ "#define YY_MAY_BE_UNUSED __attribute__((unused))", ++ "#else", ++ "#define YY_MAY_BE_UNUSED", ++ "#endif", ++ "", + "/* The following is because we cannot portably get our hands on size_t", + " * (without autoconf's help, which isn't available because we want", + " * flex-generated scanners to compile on their own).", +@@ -260,7 +269,7 @@ const char *skel[] = { + "%*", + "", + "static void *yy_flex_alloc YY_PROTO(( yy_size_t ));", +- "static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));", ++ "static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED;", + "static void yy_flex_free YY_PROTO(( void * ));", + "", + "#define yy_new_buffer yy_create_buffer", +@@ -1541,15 +1550,5 @@ const char *skel[] = { + " return 0;", + " }", + "#endif", +- "", +- "/* Some people want warning-free code, and under certain #define", +- " conditions, gcc will warn for unusedness of some functions. This", +- " function is provided merely to silent these warnings. It's not", +- " static itself, so it will clutter exports, but it has at least", +- " urandom name so that clashes won't occur.*/", +- "void _yy_dummy_uses_of_static_functions_b2f4_517d_02ff_b30c_3e5a_47d7_aaa3_3b5d_()", +- "{", +- " yy_flex_realloc ((void*)0, 0);", +- "}", + 0 + }; diff --git a/flex-2.5.4a2-std.patch b/flex-2.5.4a2-std.patch new file mode 100644 index 0000000..853ba63 --- /dev/null +++ b/flex-2.5.4a2-std.patch @@ -0,0 +1,256 @@ +diff -Burp flex-2.5.4/flex.skl flex-2.5.4-new/flex.skl +--- flex-2.5.4/flex.skl 2006-01-13 16:16:52.000000000 +0100 ++++ flex-2.5.4-new/flex.skl 2006-01-13 16:57:50.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* A lexical scanner generated by flex */ ++/* A lexical scanner generated by flex*/ + + /* Scanner skeleton version: + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ +@@ -26,7 +26,7 @@ + + #include + %+ +-class istream; ++#include + %* + + /* Use prototypes in function declarations. */ +@@ -153,7 +153,7 @@ struct yy_buffer_state + %- + FILE *yy_input_file; + %+ +- istream* yy_input_file; ++ std::istream* yy_input_file; + %* + + char *yy_ch_buf; /* input buffer */ +@@ -276,7 +276,7 @@ static void yy_flex_free YY_PROTO(( void + + #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + +-%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here ++%% yytext/yyin/yyout/yy_state_type/yylineno etc. def\'s & init go here + + %- Standard (non-C++) definition + static yy_state_type yy_get_previous_state YY_PROTO(( void )); +@@ -296,7 +296,7 @@ static void yy_fatal_error YY_PROTO(( yy + %% code to copy yytext_ptr to yytext[] goes here, if %array + yy_c_buf_p = yy_cp; + +-%% data tables for the DFA and the user's section 1 definitions go here ++%% data tables for the DFA and the user\'s section 1 definitions go here + + /* Macros after this point can all be overridden by user definitions in + * section 1. +@@ -449,10 +449,10 @@ YY_MALLOC_DECL + YY_DECL + { + register yy_state_type yy_current_state; +- register char *yy_cp, *yy_bp; ++ register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + +-%% user's declarations go here ++%% user\'s declarations go here + + if ( yy_init ) + { +@@ -469,14 +469,14 @@ YY_DECL + %- + yyin = stdin; + %+ +- yyin = &cin; ++ yyin = &std::cin; + %* + + if ( ! yyout ) + %- + yyout = stdout; + %+ +- yyout = &cout; ++ yyout = &std::cout; + %* + + if ( ! yy_current_buffer ) +@@ -646,7 +646,7 @@ do_action: /* This label is used only to + } /* end of yylex */ + + %+ +-yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) ++yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) + { + yyin = arg_yyin; + yyout = arg_yyout; +@@ -681,7 +681,7 @@ yyFlexLexer::~yyFlexLexer() + yy_delete_buffer( yy_current_buffer ); + } + +-void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) ++void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) + { + if ( new_in ) + { +@@ -1058,7 +1058,7 @@ void yyrestart( input_file ) + FILE *input_file; + #endif + %+ +-void yyFlexLexer::yyrestart( istream* input_file ) ++void yyFlexLexer::yyrestart( std::istream* input_file ) + %* + { + if ( ! yy_current_buffer ) +@@ -1129,7 +1129,7 @@ FILE *file; + int size; + #endif + %+ +-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) ++YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) + %* + { + YY_BUFFER_STATE b; +@@ -1190,7 +1190,7 @@ FILE *file; + #endif + + %+ +-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) ++void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) + %* + + { +@@ -1434,7 +1434,7 @@ char msg[]; + + void yyFlexLexer::LexerError( yyconst char msg[] ) + { +- cerr << msg << '\n'; ++ std::cerr << msg << '\n'; + exit( YY_EXIT_FAILURE ); + } + %* +diff -Burp flex-2.5.4/skel.c flex-2.5.4-new/skel.c +--- flex-2.5.4/skel.c 2006-01-13 16:16:52.000000000 +0100 ++++ flex-2.5.4-new/skel.c 2006-01-13 16:58:53.000000000 +0100 +@@ -3,7 +3,7 @@ + #include "flexdef.h" + + const char *skel[] = { +- "/* A lexical scanner generated by flex */", ++ "/* A lexical scanner generated by flex*/", + "", + "/* Scanner skeleton version:", + " * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $", +@@ -32,7 +32,6 @@ const char *skel[] = { + "#include ", + "%+", + "#include ", +- "using namespace std;", + "%*", + "", + "/* Use prototypes in function declarations. */", +@@ -159,7 +158,7 @@ const char *skel[] = { + "%-", + " FILE *yy_input_file;", + "%+", +- " istream* yy_input_file;", ++ " std::istream* yy_input_file;", + "%*", + "", + " char *yy_ch_buf; /* input buffer */", +@@ -282,7 +281,7 @@ const char *skel[] = { + "", + "#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)", + "", +- "%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here", ++ "%% yytext/yyin/yyout/yy_state_type/yylineno etc. def\\'s & init go here", + "", + "%- Standard (non-C++) definition", + "static yy_state_type yy_get_previous_state YY_PROTO(( void ));", +@@ -302,7 +301,7 @@ const char *skel[] = { + "%% code to copy yytext_ptr to yytext[] goes here, if %array", + " yy_c_buf_p = yy_cp;", + "", +- "%% data tables for the DFA and the user's section 1 definitions go here", ++ "%% data tables for the DFA and the user\\'s section 1 definitions go here", + "", + "/* Macros after this point can all be overridden by user definitions in", + " * section 1.", +@@ -458,7 +457,7 @@ const char *skel[] = { + " register char *yy_cp = NULL, *yy_bp = NULL;", + " register int yy_act;", + "", +- "%% user's declarations go here", ++ "%% user\\'s declarations go here", + "", + " if ( yy_init )", + " {", +@@ -475,14 +474,14 @@ const char *skel[] = { + "%-", + " yyin = stdin;", + "%+", +- " yyin = &cin;", ++ " yyin = &std::cin;", + "%*", + "", + " if ( ! yyout )", + "%-", + " yyout = stdout;", + "%+", +- " yyout = &cout;", ++ " yyout = &std::cout;", + "%*", + "", + " if ( ! yy_current_buffer )", +@@ -652,7 +651,7 @@ const char *skel[] = { + " } /* end of yylex */", + "", + "%+", +- "yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )", ++ "yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )", + " {", + " yyin = arg_yyin;", + " yyout = arg_yyout;", +@@ -687,7 +686,7 @@ const char *skel[] = { + " yy_delete_buffer( yy_current_buffer );", + " }", + "", +- "void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )", ++ "void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )", + " {", + " if ( new_in )", + " {", +@@ -1064,7 +1063,7 @@ const char *skel[] = { + "FILE *input_file;", + "#endif", + "%+", +- "void yyFlexLexer::yyrestart( istream* input_file )", ++ "void yyFlexLexer::yyrestart( std::istream* input_file )", + "%*", + " {", + " if ( ! yy_current_buffer )", +@@ -1135,7 +1134,7 @@ const char *skel[] = { + "int size;", + "#endif", + "%+", +- "YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )", ++ "YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )", + "%*", + " {", + " YY_BUFFER_STATE b;", +@@ -1196,7 +1195,7 @@ const char *skel[] = { + "#endif", + "", + "%+", +- "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )", ++ "void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )", + "%*", + "", + " {", +@@ -1440,7 +1439,7 @@ const char *skel[] = { + "", + "void yyFlexLexer::LexerError( yyconst char msg[] )", + " {", +- " cerr << msg << '\\n';", ++ " std::cerr << msg << '\\n';", + " exit( YY_EXIT_FAILURE );", + " }", + "%*", diff --git a/flex-2.5.4a2-warn.patch b/flex-2.5.4a2-warn.patch new file mode 100644 index 0000000..6fc5354 --- /dev/null +++ b/flex-2.5.4a2-warn.patch @@ -0,0 +1,36 @@ +diff -Burp flex-2.5.4/flex.skl flex-2.5.4-new/flex.skl +--- flex-2.5.4/flex.skl 2006-01-13 17:00:08.000000000 +0100 ++++ flex-2.5.4-new/flex.skl 2006-01-13 17:02:17.000000000 +0100 +@@ -1536,3 +1536,13 @@ int main() + return 0; + } + #endif ++ ++/* Some people want warning-free code, and under certain #define ++ conditions, gcc will warn for unusedness of some functions. This ++ function is provided merely to silent these warnings. It's not ++ static itself, so it will clutter exports, but it has at least ++ urandom name so that clashes won't occur.*/ ++void _yy_dummy_uses_of_static_functions_b2f4_517d_02ff_b30c_3e5a_47d7_aaa3_3b5d_() ++{ ++ yy_flex_realloc ((void*)0, 0); ++} +diff -Burp flex-2.5.4/skel.c flex-2.5.4-new/skel.c +--- flex-2.5.4/skel.c 2006-01-13 17:00:08.000000000 +0100 ++++ flex-2.5.4-new/skel.c 2006-01-13 17:02:28.000000000 +0100 +@@ -1541,5 +1541,15 @@ const char *skel[] = { + " return 0;", + " }", + "#endif", ++ "", ++ "/* Some people want warning-free code, and under certain #define", ++ " conditions, gcc will warn for unusedness of some functions. This", ++ " function is provided merely to silent these warnings. It's not", ++ " static itself, so it will clutter exports, but it has at least", ++ " urandom name so that clashes won't occur.*/", ++ "void _yy_dummy_uses_of_static_functions_b2f4_517d_02ff_b30c_3e5a_47d7_aaa3_3b5d_()", ++ "{", ++ " yy_flex_realloc ((void*)0, 0);", ++ "}", + 0 + }; diff --git a/flex-2.5.4a2.patch b/flex-2.5.4a2.patch new file mode 100644 index 0000000..07492d6 --- /dev/null +++ b/flex-2.5.4a2.patch @@ -0,0 +1,103 @@ +diff -r -c4 flex-2.5.4/flex.skl flex-2.5.4P/flex.skl +*** flex-2.5.4/flex.skl Wed Sep 11 01:58:54 1996 +--- flex-2.5.4P/flex.skl Thu Oct 24 19:25:30 2002 +*************** +*** 969,976 **** +--- 969,977 ---- + %* + + + %- ++ #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput() + #else + static int input() +*************** +*** 1044,1052 **** + %% update BOL and yylineno + + return c; + } +! + + %- + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) +--- 1045,1055 ---- + %% update BOL and yylineno + + return c; + } +! %- +! #endif /* YY_NO_INPUT */ +! %* + + %- + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) +diff -r -c4 flex-2.5.4/initscan.c flex-2.5.4P/initscan.c +*** flex-2.5.4/initscan.c Sun Jul 27 04:32:18 1997 +--- flex-2.5.4P/initscan.c Tue Oct 15 11:51:22 2002 +*************** +*** 3127,3134 **** +--- 3127,3135 ---- + } + #endif /* ifndef YY_NO_UNPUT */ + + ++ #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput() + #else + static int input() +*************** +*** 3199,3206 **** +--- 3200,3208 ---- + yy_current_buffer->yy_at_bol = (c == '\n'); + + return c; + } ++ #endif /* ifndef YY_NO_INPUT */ + + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) +diff -r -c4 flex-2.5.4/skel.c flex-2.5.4P/skel.c +*** flex-2.5.4/skel.c Wed Sep 11 02:00:38 1996 +--- flex-2.5.4P/skel.c Thu Oct 24 19:25:32 2002 +*************** +*** 974,981 **** +--- 974,982 ---- + "%*", + "", + "", + "%-", ++ "#ifndef YY_NO_INPUT", + "#ifdef __cplusplus", + "static int yyinput()", + "#else", + "static int input()", +*************** +*** 1049,1057 **** + "%% update BOL and yylineno", + "", + " return c;", + " }", +! "", + "", + "%-", + "#ifdef YY_USE_PROTOS", + "void yyrestart( FILE *input_file )", +--- 1050,1060 ---- + "%% update BOL and yylineno", + "", + " return c;", + " }", +! "%-", +! "#endif /* YY_NO_INPUT */", +! "%*", + "", + "%-", + "#ifdef YY_USE_PROTOS", + "void yyrestart( FILE *input_file )", diff --git a/flex-pic.patch b/flex-pic.patch new file mode 100644 index 0000000..56f0726 --- /dev/null +++ b/flex-pic.patch @@ -0,0 +1,14 @@ +--- flex-2.5.4/Makefile.in 2005-12-16 19:32:59.000000000 -0800 ++++ flex-2.5.4/Makefile.in.pic 2005-12-16 19:31:18.000000000 -0800 +@@ -118,6 +118,11 @@ + scan.o: scan.c parse.h flexdef.h config.h + yylex.o: yylex.c parse.h flexdef.h config.h + ++libmain.o: libmain.c ++ $(CC) -c $(CPPFLAGS) -fPIC $(CFLAGS) $< ++libyywrap.o: libyywrap.c ++ $(CC) -c $(CPPFLAGS) -fPIC $(CFLAGS) $< ++ + skel.c: flex.skl mkskel.sh + $(SHELL) $(srcdir)/mkskel.sh $(srcdir)/flex.skl >skel.c + diff --git a/sources b/sources index e69de29..4b0281d 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +bd8753d0b22e1f4ec87a553a73021adf flex-2.5.4a.tar.gz