Hi all I attempted to take into account the differences in flex between linux and OSX with this patch. But it seems that OSX uses flex version 2.5.4 and for OSX these constants are not defined any suggestions welcome. Index: maketokenizer =================================================================== --- maketokenizer (revision 14746) +++ maketokenizer (working copy) @@ -43,6 +43,32 @@ END +#Not sure what the earliest version with the defines is +$flex_version=`flex --version`; +if( $flex_version = ~/2\.5/ ) { +print<<END +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ +END +} + + while (<>) { last if /YY_NUM_RULES/; }
On Jun 6, 2006, at 8:44 PM, Mike Emmel wrote:
Hi all I attempted to take into account the differences in flex between linux and OSX with this patch. But it seems that OSX uses flex version 2.5.4 and for OSX these constants are not defined any suggestions welcome.
Maybe this isn't about the version of flex, but rather some other difference between Linux and OS X. Anyone know what's up here? -- Darin
On Jun 6, 2006, at 8:44 PM, Mike Emmel wrote:
+#Not sure what the earliest version with the defines is +$flex_version=`flex --version`; +if( $flex_version = ~/2\.5/ ) { +print<<END +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ +END +}
This really looks to me like a problem on the Linux side. Why would you need to add all this code just to get the flex-generated code to compile? Are the other projects that use flex on Linux doing this? -- Darin
On 6/7/06, Darin Adler <darin@apple.com> wrote:
On Jun 6, 2006, at 8:44 PM, Mike Emmel wrote:
+#Not sure what the earliest version with the defines is +$flex_version=`flex --version`; +if( $flex_version = ~/2\.5/ ) { +print<<END +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ +END +}
This really looks to me like a problem on the Linux side. Why would you need to add all this code just to get the flex-generated code to compile? Are the other projects that use flex on Linux doing this?
-- Darin
The problem is the perl script actually only takes part of the flex output if you used the flex generated file as is it would not matter. I recall its doing this for unicode support. Mike
On 6/7/06, Darin Adler <darin@apple.com> wrote:
On Jun 7, 2006, at 11:20 AM, Mike Emmel wrote:
The problem is the perl script actually only takes part of the flex output if you used the flex generated file as is it would not matter. I recall its doing this for unicode support.
I see. Good explanation.
I'm thinking the right fix is to watch the input file and detect these defines then add them if there there.
-- Darin
participants (2)
-
Darin Adler
-
Mike Emmel