diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-05-31 16:20:56 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-05-31 16:20:56 +0000 |
commit | 5ef36308196fb0fd80dffe99bd32d9e802ddcb2a (patch) | |
tree | a1617d8e8e1f2d5d55d7dae753f68cd034b052e9 | |
parent | 16ddf67b511f7668f9fd5a8e9c242291cdeb72cb (diff) | |
download | ATCD-5ef36308196fb0fd80dffe99bd32d9e802ddcb2a.tar.gz |
ChangeLogTag: Sat May 31 16:11:30 UTC 2008 William R. Otte <wotte@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 30 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_mcpp_preproc.cpp | 149 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/fe_extern.cpp | 21 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.ll | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/lex.yy.cpp | 1386 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/lex.yy.cpp.diff | 48 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/mcpp_tao_yyinput.h | 29 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe_mcpp.mpb | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/include/fe_extern.h | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/tao_idl.mpc | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/tao_idl_mcpp.mpb (renamed from TAO/TAO_IDL/preproc.mpb) | 1 |
11 files changed, 931 insertions, 749 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 7d7847d976a..d22d0308a5d 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,27 @@ +Sat May 31 16:11:30 UTC 2008 William R. Otte <wotte@dre.vanderbilt.edu> + + * TAO_IDL/driver/drv_mcpp_preproc.cpp: + * TAO_IDL/fe/fe_extern.cpp: + * TAO_IDL/fe/idl.ll: + * TAO_IDL/fe/lex.yy.cpp: + * TAO_IDL/fe/lex.yy.cpp.diff: + * TAO_IDL/fe/mcpp_tao_yyinput.h: + * TAO_IDL/include/fe_extern.h: + * TAO_IDL/tao_idl.mpc: + * TAO_IDL/tao_idl_mcpp.mpb: + * TAO_IDL/fe_mcpp.mpb: + + Changes to enable in-memory preprocessing AND lexing of IDL files + with the MCPP preprocessor. This eliminates the need to use multiple + temporary files for this process. This capability is triggered by enabling + the mcpp feature when generating project files, which causes the in-memory + preprocessing and lexing to replace the external preprocessor/temporary file + preprocessing and lexing which is still used by default. + + * TAO_IDL/preproc.mpb: + + Renamed to tao_idl_mcpp.mbp. + Sat May 31 01:10:02 UTC 2008 William R. Otte <wotte@dre.vanderbilt.edu> * TAO_IDL/contrib/mcpp/configed.H: @@ -5,11 +29,11 @@ Sat May 31 01:10:02 UTC 2008 William R. Otte <wotte@dre.vanderbilt.edu> * TAO_IDL/contrib/mcpp/system.cpp: Changes to make generated output more similar to that of GCC. - + * TAO_IDL/driver/drv_mcpp_preproc.cpp: - Fixed a bug which resulted in includes not being properly generated. - + Fixed a bug which resulted in includes not being properly generated. + Fri May 30 23:32:47 UTC 2008 J.T. Conklin <jtc@acorntoolworks.com> * orbsvcs/orbsvcs/Log/LogNotification.cpp: diff --git a/TAO/TAO_IDL/driver/drv_mcpp_preproc.cpp b/TAO/TAO_IDL/driver/drv_mcpp_preproc.cpp index b6d42ebaecb..c2940e1f384 100644 --- a/TAO/TAO_IDL/driver/drv_mcpp_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_mcpp_preproc.cpp @@ -936,56 +936,6 @@ DRV_check_file_for_includes (const char *filename) void DRV_pre_proc (const char *myfile) { - const char* tmpdir = idl_global->temp_dir (); - static const char temp_file_extension[] = ".cpp"; - - static char const tao_idlf_template[] = "tao-idlf_XXXXXX"; - - size_t const tlen = - ACE_OS::strlen (tmpdir) + sizeof (temp_file_extension); - - // Prevent a buffer overrun. - if (tlen + sizeof (tao_idlf_template) > sizeof (tmp_file)) - { - ACE_ERROR ((LM_ERROR, - "%s: temporary path/filename length is greater than " - "length allowed by platform\n", - idl_global->prog_name ())); - - - throw Bailout (); - } - - ACE_OS::strcpy (tmp_file, tmpdir); - -// Append temporary filename template to temporary directory. - ACE_OS::strcat (tmp_file, tao_idlf_template); - - ACE_HANDLE const tf_fd = ACE_OS::mkstemp (tmp_file); - - if (tf_fd == ACE_INVALID_HANDLE) - { - ACE_ERROR ((LM_ERROR, - "%s: Unable to create temporary file: %m\n", - idl_global->prog_name ())); - - - throw Bailout (); - } - - char tmp_cpp_file [MAXPATHLEN + 1] = { 0 }; - - // Append C++ source file extension. Temporary files will be renamed - // to these filenames. - ACE_OS::strcpy (tmp_cpp_file, tmp_file); - ACE_OS::strcat (tmp_cpp_file, temp_file_extension); - - char * const t_file = tmp_cpp_file; - - ACE_OS::close (tf_fd); - - // - DRV_check_file_for_includes (myfile); #if defined (ACE_OPENVMS) @@ -1009,55 +959,7 @@ DRV_pre_proc (const char *myfile) idl_global->set_real_filename (idl_global->utl_string_factory (myfile)); //t_ifile)); - DRV_cpp_expand_output_arg (t_file); DRV_cpp_putarg (myfile); - - // Rename temporary files so that they have extensions accepted - // by the preprocessor. Renaming is (supposed to be) an atomic - // operation so we shouldn't be susceptible to attack. -if (ACE_OS::rename (tmp_file, t_file) != 0) - { - ACE_ERROR ((LM_ERROR, - "%s: Unable to rename temporary file: %m\n", - idl_global->prog_name ())); - - - throw Bailout (); - } - - // Remove any existing output file. -(void) ACE_OS::unlink (t_file); - - ACE_HANDLE fd = ACE_INVALID_HANDLE; - - if (output_arg_format == 0) - { - // If the following open() fails, then we're either being hit with a - // symbolic link attack, or another process opened the file before - // us. -#if defined (ACE_OPENVMS) - //FUZZ: disable check_for_lack_ACE_OS - fd = ::open (t_file, O_WRONLY | O_CREAT | O_EXCL, - ACE_DEFAULT_FILE_PERMS, - "shr=get,put,upd", "ctx=rec", "fop=dfw"); - //FUZZ: enable check_for_lack_ACE_OS -#else - fd = ACE_OS::open (t_file, - O_WRONLY | O_CREAT | O_EXCL, - ACE_DEFAULT_FILE_PERMS); -#endif - - if (fd == ACE_INVALID_HANDLE) - { - ACE_ERROR ((LM_ERROR, - "%s: cannot open temp file \"%s\" for writing\n", - idl_global->prog_name (), - t_file)); - - - throw Bailout (); - } - } char * tmp_arglist [DRV_MAX_ARGCOUNT] = { 0 }; @@ -1066,13 +968,17 @@ if (ACE_OS::rename (tmp_file, t_file) != 0) tmp_arglist[i] = ACE::strnew (DRV_arglist[i]); } - if (mcpp_lib_main (DRV_argcount, tmp_arglist) != 0) - { - ACE_ERROR ((LM_ERROR, - "%s: mcpp preprocessor execution failed\n", - idl_global->prog_name ())); - throw Bailout (); - } + // tell mcpp to use memory buffers, instead of an output file. + mcpp_use_mem_buffers(1); + + if (mcpp_lib_main (DRV_argcount, tmp_arglist) != 0) + { + ACE_ERROR ((LM_ERROR, + "%s: mcpp preprocessor execution failed:\n%s", + idl_global->prog_name (), + mcpp_get_mem_buffer(ERR))); + throw Bailout (); + } for (size_t i = 0; i < DRV_argcount; ++i) delete tmp_arglist[i]; @@ -1084,36 +990,27 @@ if (ACE_OS::rename (tmp_file, t_file) != 0) DRV_argcount -= 2; - FILE * const yyin = ACE_OS::fopen (t_file, "r"); + char * yyin = mcpp_get_mem_buffer(OUT); + if (yyin == 0) { ACE_ERROR ((LM_ERROR, - "%s: Could not open cpp output file: %p\n", + "%s: Could not retrieve preprocessed buffer\n%s", idl_global->prog_name (), - t_file)); + mcpp_get_mem_buffer(ERR))); throw Bailout (); } FE_set_yyin (yyin); + /** @@TODO worry about this later. if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC) { - FILE *preproc = ACE_OS::fopen (t_file, "r"); char buffer[ACE_MAXLOGMSGLEN]; size_t bytes; - if (preproc == 0) - { - ACE_ERROR ((LM_ERROR, - "%s: Could not open cpp output file: %p\n", - idl_global->prog_name (), - t_file)); - - throw Bailout (); - } - // ACE_DEBUG sends to stderr - we want stdout for this dump // of the preprocessor output. So we modify the singleton that // was created in this process. Since IDL_CF_ONLY_PREPROC causes @@ -1137,15 +1034,7 @@ if (ACE_OS::rename (tmp_file, t_file) != 0) } ACE_OS::fclose (preproc); - } - - if (ACE_OS::unlink (t_file) == -1) - { - ACE_ERROR ((LM_ERROR, - "%s: Could not remove cpp output file: %p\n", - idl_global->prog_name (), - t_file)); - - throw Bailout (); - } + } + // need to free buffers? + */ } diff --git a/TAO/TAO_IDL/fe/fe_extern.cpp b/TAO/TAO_IDL/fe/fe_extern.cpp index e6f783b4431..3d31bdfc601 100644 --- a/TAO/TAO_IDL/fe/fe_extern.cpp +++ b/TAO/TAO_IDL/fe/fe_extern.cpp @@ -81,7 +81,13 @@ ACE_RCSID (fe, "$Id$") extern int tao_yyparse (void); + +#ifdef USE_MCPP_BUFFER_LEXING +char *tao_preproc_buffer = 0; +size_t tao_preproc_buffer_length = 0; +#else extern FILE *tao_yyin; +#endif /* USE_MCPP_BUFFER_LEXING */ int FE_yyparse (void) @@ -93,15 +99,30 @@ FE_yyparse (void) idl_global->root ()->call_add (); } +#ifdef USE_MCPP_BUFFER_LEXING + ACE_OS::free (tao_preproc_buffer); + tao_preproc_buffer_length = 0; +#else ACE_OS::fclose (tao_yyin); +#endif /* USE_MCPP_BUFFER_LEXING */ + return result; } +#ifdef USE_MCPP_BUFFER_LEXING +void +FE_set_yyin (char * f) +{ + tao_preproc_buffer = f; + tao_preproc_buffer_length = ACE_OS::strlen (f); +} +#else void FE_set_yyin (FILE * f) { tao_yyin = f; } +#endif /* USE_MCPP_BUFFER_LEXING */ // Constructor interfaces. diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index 3e751e33945..c5dfb5b0a48 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -101,6 +101,10 @@ static AST_Decl * idl_find_node (char *); #define ace_yytext yytext +#ifdef USE_MCPP_BUFFER_LEXING +#include "mcpp_yyinput.h" +#endif /*USE_MCPP_BUFFER_LEXING*/ + %} /* SO we don't choke on files that use \r\n */ diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index dc9c3a36ac8..ed77a623473 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -1,31 +1,88 @@ -/* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Id$ - */ +#line 3 "<stdout>" + +#define TAO_YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define TAO_YY_FLEX_MAJOR_VERSION 2 #define TAO_YY_FLEX_MINOR_VERSION 5 +#define TAO_YY_FLEX_SUBMINOR_VERSION 33 +#if TAO_YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_stdio.h" +/* First, we deal with platform-specific or compiler-specific issues. */ +/* begin standard C headers. */ +#include "ace/os_include/os_stdio.h" +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +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 */ -#ifdef __cplusplus +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif +#endif /* ! FLEXINT_H */ -/* Use prototypes in function declarations. */ -#define TAO_YY_USE_PROTOS +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define TAO_YY_USE_CONST @@ -34,32 +91,17 @@ #if __STDC__ -#define TAO_YY_USE_PROTOS #define TAO_YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#define TAO_YY_USE_CONST -#define TAO_YY_USE_PROTOS -#endif - #ifdef TAO_YY_USE_CONST #define tao_yyconst const #else #define tao_yyconst #endif - -#ifdef TAO_YY_USE_PROTOS -#define TAO_YY_PROTO(proto) proto -#else -#define TAO_YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define TAO_YY_NULL 0 @@ -74,71 +116,75 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN tao_yy_start = 1 + 2 * +#define BEGIN (tao_yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The TAO_YYSTATE alias is for lex * compatibility. */ -#define TAO_YY_START ((tao_yy_start - 1) / 2) +#define TAO_YY_START (((tao_yy_start) - 1) / 2) #define TAO_YYSTATE TAO_YY_START /* Action number for EOF rule of a given start state. */ #define TAO_YY_STATE_EOF(state) (TAO_YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define TAO_YY_NEW_FILE tao_yyrestart( tao_yyin ) +#define TAO_YY_NEW_FILE tao_yyrestart(tao_yyin ) #define TAO_YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef TAO_YY_BUF_SIZE #define TAO_YY_BUF_SIZE 16384 +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define TAO_YY_STATE_BUF_SIZE ((TAO_YY_BUF_SIZE + 2) * sizeof(tao_yy_state_type)) + +#ifndef TAO_YY_TYPEDEF_TAO_YY_BUFFER_STATE +#define TAO_YY_TYPEDEF_TAO_YY_BUFFER_STATE typedef struct tao_yy_buffer_state *TAO_YY_BUFFER_STATE; +#endif extern int tao_yyleng; + extern FILE *tao_yyin, *tao_yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * tao_yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the tao_yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ + #define TAO_YY_LESS_LINENO(n) +/* Return all but the first "n" matched characters back to the input stream. */ #define tao_yyless(n) \ do \ { \ /* Undo effects of setting up tao_yytext. */ \ - *tao_yy_cp = tao_yy_hold_char; \ + int tao_yyless_macro_arg = (n); \ + TAO_YY_LESS_LINENO(tao_yyless_macro_arg);\ + *tao_yy_cp = (tao_yy_hold_char); \ TAO_YY_RESTORE_TAO_YY_MORE_OFFSET \ - tao_yy_c_buf_p = tao_yy_cp = tao_yy_bp + n - TAO_YY_MORE_ADJ; \ + (tao_yy_c_buf_p) = tao_yy_cp = tao_yy_bp + tao_yyless_macro_arg - TAO_YY_MORE_ADJ; \ TAO_YY_DO_BEFORE_ACTION; /* set up tao_yytext again */ \ } \ while ( 0 ) -#define unput(c) tao_yyunput( c, tao_yytext_ptr ) +#define unput(c) tao_yyunput( c, (tao_yytext_ptr) ) /* 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). */ -typedef unsigned int tao_yy_size_t; +#ifndef TAO_YY_TYPEDEF_TAO_YY_SIZE_T +#define TAO_YY_TYPEDEF_TAO_YY_SIZE_T +typedef unsigned int tao_yy_size_t; +#endif +#ifndef TAO_YY_STRUCT_TAO_YY_BUFFER_STATE +#define TAO_YY_STRUCT_TAO_YY_BUFFER_STATE struct tao_yy_buffer_state { FILE *tao_yy_input_file; @@ -175,12 +221,16 @@ struct tao_yy_buffer_state */ int tao_yy_at_bol; + int tao_yy_bs_lineno; /**< The line count. */ + int tao_yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int tao_yy_fill_buffer; int tao_yy_buffer_status; + #define TAO_YY_BUFFER_NEW 0 #define TAO_YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -194,28 +244,38 @@ struct tao_yy_buffer_state * just pointing tao_yyin at a new input file. */ #define TAO_YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !TAO_YY_STRUCT_TAO_YY_BUFFER_STATE */ -static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0; +/* Stack of input buffers. */ +static size_t tao_yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t tao_yy_buffer_stack_max = 0; /**< capacity of stack. */ +static TAO_YY_BUFFER_STATE * tao_yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or 0. */ -#define TAO_YY_CURRENT_BUFFER tao_yy_current_buffer +#define TAO_YY_CURRENT_BUFFER ( (tao_yy_buffer_stack) \ + ? (tao_yy_buffer_stack)[(tao_yy_buffer_stack_top)] \ + : 0) +/* Same as previous macro, but useful when we know that the buffer stack is not + * 0 or when we need an lvalue. For internal use only. + */ +#define TAO_YY_CURRENT_BUFFER_LVALUE (tao_yy_buffer_stack)[(tao_yy_buffer_stack_top)] /* tao_yy_hold_char holds the character lost when tao_yytext is formed. */ static char tao_yy_hold_char; - static int tao_yy_n_chars; /* number of characters read into tao_yy_ch_buf */ - - int tao_yyleng; /* Points to current character in buffer. */ static char *tao_yy_c_buf_p = (char *) 0; -static int tao_yy_init = 1; /* whether we need to initialize */ +static int tao_yy_init = 0; /* whether we need to initialize */ static int tao_yy_start = 0; /* start state number */ /* Flag which is used to allow tao_yywrap()'s to do buffer switches @@ -223,69 +283,94 @@ static int tao_yy_start = 0; /* start state number */ */ static int tao_yy_did_buffer_switch_on_eof; -void tao_yyrestart TAO_YY_PROTO(( FILE *input_file )); +void tao_yyrestart (FILE *input_file ); +void tao_yy_switch_to_buffer (TAO_YY_BUFFER_STATE new_buffer ); +TAO_YY_BUFFER_STATE tao_yy_create_buffer (FILE *file,int size ); +void tao_yy_delete_buffer (TAO_YY_BUFFER_STATE b ); +void tao_yy_flush_buffer (TAO_YY_BUFFER_STATE b ); +void tao_yypush_buffer_state (TAO_YY_BUFFER_STATE new_buffer ); +void tao_yypop_buffer_state (void ); + +static void tao_yyensure_buffer_stack (void ); +static void tao_yy_load_buffer_state (void ); +static void tao_yy_init_buffer (TAO_YY_BUFFER_STATE b,FILE *file ); -void tao_yy_switch_to_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE new_buffer )); -void tao_yy_load_buffer_state TAO_YY_PROTO(( void )); -TAO_YY_BUFFER_STATE tao_yy_create_buffer TAO_YY_PROTO(( FILE *file, int size )); -void tao_yy_delete_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b )); -void tao_yy_init_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b, FILE *file )); -void tao_yy_flush_buffer TAO_YY_PROTO(( TAO_YY_BUFFER_STATE b )); -#define TAO_YY_FLUSH_BUFFER tao_yy_flush_buffer( tao_yy_current_buffer ) +#define TAO_YY_FLUSH_BUFFER tao_yy_flush_buffer(TAO_YY_CURRENT_BUFFER ) -TAO_YY_BUFFER_STATE tao_yy_scan_buffer TAO_YY_PROTO(( char *base, tao_yy_size_t size )); -TAO_YY_BUFFER_STATE tao_yy_scan_string TAO_YY_PROTO(( tao_yyconst char *tao_yy_str )); -TAO_YY_BUFFER_STATE tao_yy_scan_bytes TAO_YY_PROTO(( tao_yyconst char *bytes, int len )); +TAO_YY_BUFFER_STATE tao_yy_scan_buffer (char *base,tao_yy_size_t size ); +TAO_YY_BUFFER_STATE tao_yy_scan_string (tao_yyconst char *tao_yy_str ); +TAO_YY_BUFFER_STATE tao_yy_scan_bytes (tao_yyconst char *bytes,int len ); -static void *tao_yy_flex_alloc TAO_YY_PROTO(( tao_yy_size_t )); -static void *tao_yy_flex_realloc TAO_YY_PROTO(( void *, tao_yy_size_t )); -static void tao_yy_flex_free TAO_YY_PROTO(( void * )); +void *tao_yyalloc (tao_yy_size_t ); +void *tao_yyrealloc (void *,tao_yy_size_t ); +void tao_yyfree (void * ); #define tao_yy_new_buffer tao_yy_create_buffer #define tao_yy_set_interactive(is_interactive) \ { \ - if ( ! tao_yy_current_buffer ) \ - tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \ - tao_yy_current_buffer->tao_yy_is_interactive = is_interactive; \ + if ( ! TAO_YY_CURRENT_BUFFER ){ \ + tao_yyensure_buffer_stack (); \ + TAO_YY_CURRENT_BUFFER_LVALUE = \ + tao_yy_create_buffer(tao_yyin,TAO_YY_BUF_SIZE ); \ + } \ + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_is_interactive = is_interactive; \ } #define tao_yy_set_bol(at_bol) \ { \ - if ( ! tao_yy_current_buffer ) \ - tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \ - tao_yy_current_buffer->tao_yy_at_bol = at_bol; \ + if ( ! TAO_YY_CURRENT_BUFFER ){\ + tao_yyensure_buffer_stack (); \ + TAO_YY_CURRENT_BUFFER_LVALUE = \ + tao_yy_create_buffer(tao_yyin,TAO_YY_BUF_SIZE ); \ + } \ + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_at_bol = at_bol; \ } -#define TAO_YY_AT_BOL() (tao_yy_current_buffer->tao_yy_at_bol) +#define TAO_YY_AT_BOL() (TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_at_bol) + +/* Begin user sect3 */ typedef unsigned char TAO_YY_CHAR; + FILE *tao_yyin = (FILE *) 0, *tao_yyout = (FILE *) 0; + typedef int tao_yy_state_type; -extern char tao_yytext[]; +extern int tao_yylineno; -static tao_yy_state_type tao_yy_get_previous_state TAO_YY_PROTO(( void )); -static tao_yy_state_type tao_yy_try_NUL_trans TAO_YY_PROTO(( tao_yy_state_type current_state )); -static int tao_yy_get_next_buffer TAO_YY_PROTO(( void )); -static void tao_yy_fatal_error TAO_YY_PROTO(( tao_yyconst char msg[] )); +int tao_yylineno = 1; + +extern char tao_yytext[]; + +static tao_yy_state_type tao_yy_get_previous_state (void ); +static tao_yy_state_type tao_yy_try_NUL_trans (tao_yy_state_type current_state ); +static int tao_yy_get_next_buffer (void ); +static void tao_yy_fatal_error (tao_yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up tao_yytext. */ #define TAO_YY_DO_BEFORE_ACTION \ - tao_yytext_ptr = tao_yy_bp; \ - tao_yyleng = (int) (tao_yy_cp - tao_yy_bp); \ - tao_yy_hold_char = *tao_yy_cp; \ + (tao_yytext_ptr) = tao_yy_bp; \ + tao_yyleng = (size_t) (tao_yy_cp - tao_yy_bp); \ + (tao_yy_hold_char) = *tao_yy_cp; \ *tao_yy_cp = '\0'; \ if ( tao_yyleng >= TAO_YYLMAX ) \ TAO_YY_FATAL_ERROR( "token too large, exceeds TAO_YYLMAX" ); \ - tao_yy_flex_strncpy( tao_yytext, tao_yytext_ptr, tao_yyleng + 1 ); \ - tao_yy_c_buf_p = tao_yy_cp; + tao_yy_flex_strncpy( tao_yytext, (tao_yytext_ptr), tao_yyleng + 1 ); \ + (tao_yy_c_buf_p) = tao_yy_cp; #define TAO_YY_NUM_RULES 104 #define TAO_YY_END_OF_BUFFER 105 -static tao_yyconst short int tao_yy_accept[562] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct tao_yy_trans_info + { + flex_int32_t tao_yy_verify; + flex_int32_t tao_yy_nxt; + }; +static tao_yyconst flex_int16_t tao_yy_accept[562] = { 0, 101, 101, 105, 103, 101, 102, 102, 103, 103, 103, 103, 103, 76, 72, 103, 103, 103, 68, 68, 68, @@ -351,7 +436,7 @@ static tao_yyconst short int tao_yy_accept[562] = 0 } ; -static tao_yyconst int tao_yy_ec[256] = +static tao_yyconst flex_int32_t tao_yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -383,7 +468,7 @@ static tao_yyconst int tao_yy_ec[256] = 1, 1, 1, 1, 1 } ; -static tao_yyconst int tao_yy_meta[60] = +static tao_yyconst flex_int32_t tao_yy_meta[60] = { 0, 1, 1, 2, 1, 1, 3, 1, 4, 1, 1, 1, 1, 1, 5, 5, 6, 1, 1, 1, 1, @@ -393,7 +478,7 @@ static tao_yyconst int tao_yy_meta[60] = 7, 8, 7, 8, 9, 8, 7, 8, 7 } ; -static tao_yyconst short int tao_yy_base[590] = +static tao_yyconst flex_int16_t tao_yy_base[590] = { 0, 0, 58, 1129, 1130, 59, 1130, 1130, 56, 1094, 54, 57, 65, 68, 73, 1110, 1108, 1105, 0, 1102, 69, @@ -461,7 +546,7 @@ static tao_yyconst short int tao_yy_base[590] = 817, 823, 829, 838, 847, 856, 865, 874, 883 } ; -static tao_yyconst short int tao_yy_def[590] = +static tao_yyconst flex_int16_t tao_yy_def[590] = { 0, 561, 1, 561, 561, 561, 561, 561, 562, 563, 561, 561, 561, 561, 561, 561, 561, 561, 564, 564, 564, @@ -529,7 +614,7 @@ static tao_yyconst short int tao_yy_def[590] = 561, 561, 561, 561, 561, 561, 561, 561, 561 } ; -static tao_yyconst short int tao_yy_nxt[1190] = +static tao_yyconst flex_int16_t tao_yy_nxt[1190] = { 0, 4, 5, 6, 7, 5, 8, 4, 9, 4, 4, 10, 11, 12, 13, 14, 14, 15, 16, 4, 17, @@ -663,7 +748,7 @@ static tao_yyconst short int tao_yy_nxt[1190] = 561, 561, 561, 561, 561, 561, 561, 561, 561 } ; -static tao_yyconst short int tao_yy_chk[1190] = +static tao_yyconst flex_int16_t tao_yy_chk[1190] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -800,6 +885,9 @@ static tao_yyconst short int tao_yy_chk[1190] = static tao_yy_state_type tao_yy_last_accepting_state; static char *tao_yy_last_accepting_cpos; +extern int tao_yy_flex_debug; +int tao_yy_flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -813,7 +901,6 @@ static char *tao_yy_last_accepting_cpos; char tao_yytext[TAO_YYLMAX]; char *tao_yytext_ptr; -#define INITIAL 0 /* $Id$ COPYRIGHT @@ -916,8 +1003,27 @@ static AST_Decl * idl_find_node (char *); #define ace_tao_yytext tao_yytext +#ifdef USE_MCPP_BUFFER_LEXING +#include "mcpp_tao_yyinput.h" +#endif /*USE_MCPP_BUFFER_LEXING*/ + /* SO we don't choke on files that use \r\n */ -#define TAO_YY_NEVER_INTERACTIVE 1 + +#define INITIAL 0 + +#ifndef TAO_YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include "ace/os_include/os_ctype.h" +#endif + +#ifndef TAO_YY_EXTRA_TYPE +#define TAO_YY_EXTRA_TYPE void * +#endif + +static int tao_yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -925,64 +1031,30 @@ static AST_Decl * idl_find_node (char *); #ifndef TAO_YY_SKIP_TAO_YYWRAP #ifdef __cplusplus -extern "C" int tao_yywrap TAO_YY_PROTO(( void )); +extern "C" int tao_yywrap (void ); #else -extern int tao_yywrap TAO_YY_PROTO(( void )); +extern int tao_yywrap (void ); #endif #endif -#ifndef TAO_YY_NO_UNPUT -static void tao_yyunput TAO_YY_PROTO(( int c, char *buf_ptr )); -#endif + static void tao_yyunput (int c,char *buf_ptr ); #ifndef tao_yytext_ptr -static void tao_yy_flex_strncpy TAO_YY_PROTO(( char *, tao_yyconst char *, int )); +static void tao_yy_flex_strncpy (char *,tao_yyconst char *,int ); #endif #ifdef TAO_YY_NEED_STRLEN -static int tao_yy_flex_strlen TAO_YY_PROTO(( tao_yyconst char * )); +static int tao_yy_flex_strlen (tao_yyconst char * ); #endif #ifndef TAO_YY_NO_INPUT -#ifdef __cplusplus -static int tao_yyinput TAO_YY_PROTO(( void )); -#else -static int input TAO_YY_PROTO(( void )); -#endif -#endif - -#if TAO_YY_STACK_USED -static int tao_yy_start_stack_ptr = 0; -static int tao_yy_start_stack_depth = 0; -static int *tao_yy_start_stack = 0; -#ifndef TAO_YY_NO_PUSH_STATE -static void tao_yy_push_state TAO_YY_PROTO(( int new_state )); -#endif -#ifndef TAO_YY_NO_POP_STATE -static void tao_yy_pop_state TAO_YY_PROTO(( void )); -#endif -#ifndef TAO_YY_NO_TOP_STATE -static int tao_yy_top_state TAO_YY_PROTO(( void )); -#endif +#ifdef __cplusplus +static int tao_yyinput (void ); #else -#define TAO_YY_NO_PUSH_STATE 1 -#define TAO_YY_NO_POP_STATE 1 -#define TAO_YY_NO_TOP_STATE 1 +static int input (void ); #endif -#ifdef TAO_YY_MALLOC_DECL -TAO_YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -991,26 +1063,24 @@ TAO_YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - -//FUZZ: disable check_for_lack_ACE_OS #ifndef TAO_YY_ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define TAO_YY_ECHO (void) fwrite( tao_yytext, tao_yyleng, 1, tao_yyout ) #endif -//FUZZ: enable check_for_lack_ACE_OS /* Gets input and stuffs it into "buf". number of characters read, or TAO_YY_NULL, * is returned in "result". */ #ifndef TAO_YY_INPUT #define TAO_YY_INPUT(buf,result,max_size) \ - if ( tao_yy_current_buffer->tao_yy_is_interactive ) \ + if ( TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = ACE_OS::getc( tao_yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( tao_yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ @@ -1018,9 +1088,22 @@ TAO_YY_MALLOC_DECL TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = static_cast<int> (ACE_OS::fread( buf, 1, max_size, tao_yyin ))) == 0) \ - && ferror( tao_yyin ) ) \ - TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = static_cast<int> (fread(buf, 1, max_size, tao_yyin)))==0 && ferror(tao_yyin)) \ + { \ + if( errno != EINTR) \ + { \ + TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(tao_yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "tao_yyterminate();" - @@ -1041,12 +1124,18 @@ TAO_YY_MALLOC_DECL #define TAO_YY_FATAL_ERROR(msg) tao_yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef TAO_YY_DECL -#define TAO_YY_DECL int tao_yylex TAO_YY_PROTO(( void )) -#endif +#define TAO_YY_DECL_IS_OURS 1 + +extern int tao_yylex (void); + +#define TAO_YY_DECL int tao_yylex (void) +#endif /* !TAO_YY_DECL */ /* Code executed at the beginning of each rule, after tao_yytext and tao_yyleng * have been set up. @@ -1062,29 +1151,28 @@ TAO_YY_MALLOC_DECL #define TAO_YY_RULE_SETUP \ if ( tao_yyleng > 0 ) \ - tao_yy_current_buffer->tao_yy_at_bol = \ + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_at_bol = \ (tao_yytext[tao_yyleng - 1] == '\n'); \ TAO_YY_USER_ACTION +/** The main scanner function which does all the work. + */ TAO_YY_DECL - { +{ register tao_yy_state_type tao_yy_current_state; - register char *tao_yy_cp = 0, *tao_yy_bp = 0; + register char *tao_yy_cp, *tao_yy_bp; register int tao_yy_act; - - - - if ( tao_yy_init ) + if ( !(tao_yy_init) ) { - tao_yy_init = 0; + (tao_yy_init) = 1; #ifdef TAO_YY_USER_INIT TAO_YY_USER_INIT; #endif - if ( ! tao_yy_start ) - tao_yy_start = 1; /* first start state */ + if ( ! (tao_yy_start) ) + (tao_yy_start) = 1; /* first start state */ if ( ! tao_yyin ) tao_yyin = stdin; @@ -1092,26 +1180,28 @@ TAO_YY_DECL if ( ! tao_yyout ) tao_yyout = stdout; - if ( ! tao_yy_current_buffer ) - tao_yy_current_buffer = - tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); + if ( ! TAO_YY_CURRENT_BUFFER ) { + tao_yyensure_buffer_stack (); + TAO_YY_CURRENT_BUFFER_LVALUE = + tao_yy_create_buffer(tao_yyin,TAO_YY_BUF_SIZE ); + } - tao_yy_load_buffer_state(); + tao_yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - tao_yy_cp = tao_yy_c_buf_p; + tao_yy_cp = (tao_yy_c_buf_p); /* Support of tao_yytext. */ - *tao_yy_cp = tao_yy_hold_char; + *tao_yy_cp = (tao_yy_hold_char); /* tao_yy_bp points to the position in tao_yy_ch_buf of the start of * the current run. */ tao_yy_bp = tao_yy_cp; - tao_yy_current_state = tao_yy_start; + tao_yy_current_state = (tao_yy_start); tao_yy_current_state += TAO_YY_AT_BOL(); tao_yy_match: do @@ -1119,8 +1209,8 @@ tao_yy_match: register TAO_YY_CHAR tao_yy_c = tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)]; if ( tao_yy_accept[tao_yy_current_state] ) { - tao_yy_last_accepting_state = tao_yy_current_state; - tao_yy_last_accepting_cpos = tao_yy_cp; + (tao_yy_last_accepting_state) = tao_yy_current_state; + (tao_yy_last_accepting_cpos) = tao_yy_cp; } while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) { @@ -1131,30 +1221,24 @@ tao_yy_match: tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c]; ++tao_yy_cp; } - while ( tao_yy_base[tao_yy_current_state] != 1130 ); + while ( tao_yy_current_state != 561 ); + tao_yy_cp = (tao_yy_last_accepting_cpos); + tao_yy_current_state = (tao_yy_last_accepting_state); tao_yy_find_action: tao_yy_act = tao_yy_accept[tao_yy_current_state]; - if ( tao_yy_act == 0 ) - { /* have to back up */ - tao_yy_cp = tao_yy_last_accepting_cpos; - tao_yy_current_state = tao_yy_last_accepting_state; - tao_yy_act = tao_yy_accept[tao_yy_current_state]; - } TAO_YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( tao_yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of TAO_YY_DO_BEFORE_ACTION */ - *tao_yy_cp = tao_yy_hold_char; - tao_yy_cp = tao_yy_last_accepting_cpos; - tao_yy_current_state = tao_yy_last_accepting_state; + *tao_yy_cp = (tao_yy_hold_char); + tao_yy_cp = (tao_yy_last_accepting_cpos); + tao_yy_current_state = (tao_yy_last_accepting_state); goto tao_yy_find_action; case 1: @@ -1520,12 +1604,13 @@ TAO_YY_RULE_SETUP } TAO_YY_BREAK case 77: +/* rule 77 can match eol */ TAO_YY_RULE_SETUP { /* Skip the quotes */ char * const tmp = ace_tao_yytext; for(size_t i = ACE_OS::strlen (tmp); i-- != 0; ) { - if (ACE_OS::ace_isspace(tmp[i])) { + if (isspace(tmp[i])) { tmp[i] = '\0'; } else { @@ -1540,12 +1625,13 @@ TAO_YY_RULE_SETUP } TAO_YY_BREAK case 78: +/* rule 78 can match eol */ TAO_YY_RULE_SETUP { /* Skip the bookends */ char * const tmp = ACE_OS::strdup (ace_tao_yytext); for(size_t i = ACE_OS::strlen (tmp); i-- != 0; ) { - if (ACE_OS::ace_isspace(tmp[i])) { + if (isspace(tmp[i])) { tmp[i] = '\0'; } else { @@ -1604,7 +1690,9 @@ TAO_YY_RULE_SETUP } TAO_YY_BREAK case 85: +/* rule 85 can match eol */ case 86: +/* rule 86 can match eol */ TAO_YY_RULE_SETUP {/* remember pragma */ idl_global->set_lineno(idl_global->lineno() + 1); @@ -1612,55 +1700,68 @@ TAO_YY_RULE_SETUP } break; case 87: +/* rule 87 can match eol */ case 88: +/* rule 88 can match eol */ TAO_YY_RULE_SETUP {/* ignore file */ idl_global->set_lineno(idl_global->lineno() + 1); } break; case 89: +/* rule 89 can match eol */ case 90: +/* rule 90 can match eol */ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); } break; case 91: +/* rule 91 can match eol */ case 92: +/* rule 92 can match eol */ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); } break; case 93: +/* rule 93 can match eol */ case 94: +/* rule 94 can match eol */ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); } break; case 95: +/* rule 95 can match eol */ case 96: +/* rule 96 can match eol */ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); } - break; + break; case 97: +/* rule 97 can match eol */ case 98: +/* rule 98 can match eol */ TAO_YY_RULE_SETUP { /* ignore cpp ident */ idl_global->set_lineno(idl_global->lineno() + 1); } - break; + break; case 99: +/* rule 99 can match eol */ TAO_YY_RULE_SETUP { /* ignore comments */ idl_global->set_lineno(idl_global->lineno() + 1); } - break; + break; case 100: TAO_YY_RULE_SETUP { @@ -1678,17 +1779,18 @@ TAO_YY_RULE_SETUP } } } - break; + TAO_YY_BREAK case 101: TAO_YY_RULE_SETUP ; - break; + break; case 102: +/* rule 102 can match eol */ TAO_YY_RULE_SETUP { idl_global->set_lineno(idl_global->lineno() + 1); } - break; + break; case 103: TAO_YY_RULE_SETUP return ace_tao_yytext [0]; @@ -1703,26 +1805,26 @@ case TAO_YY_STATE_EOF(INITIAL): case TAO_YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int tao_yy_amount_of_matched_text = (int) (tao_yy_cp - tao_yytext_ptr) - 1; + int tao_yy_amount_of_matched_text = (int) (tao_yy_cp - (tao_yytext_ptr)) - 1; /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */ - *tao_yy_cp = tao_yy_hold_char; + *tao_yy_cp = (tao_yy_hold_char); TAO_YY_RESTORE_TAO_YY_MORE_OFFSET - if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_NEW ) + if ( TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buffer_status == TAO_YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed tao_yyin at a new source and called * tao_yylex(). If so, then we have to assure - * consistency between tao_yy_current_buffer and our + * consistency between TAO_YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars; - tao_yy_current_buffer->tao_yy_input_file = tao_yyin; - tao_yy_current_buffer->tao_yy_buffer_status = TAO_YY_BUFFER_NORMAL; + (tao_yy_n_chars) = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_input_file = tao_yyin; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buffer_status = TAO_YY_BUFFER_NORMAL; } /* Note that here we test for tao_yy_c_buf_p "<=" to the position @@ -1732,13 +1834,13 @@ case TAO_YY_STATE_EOF(INITIAL): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( tao_yy_c_buf_p <= &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] ) + if ( (tao_yy_c_buf_p) <= &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars)] ) { /* This was really a NUL. */ tao_yy_state_type tao_yy_next_state; - tao_yy_c_buf_p = tao_yytext_ptr + tao_yy_amount_of_matched_text; + (tao_yy_c_buf_p) = (tao_yytext_ptr) + tao_yy_amount_of_matched_text; - tao_yy_current_state = tao_yy_get_previous_state(); + tao_yy_current_state = tao_yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -1751,30 +1853,31 @@ case TAO_YY_STATE_EOF(INITIAL): tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state ); - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + tao_yy_bp = (tao_yytext_ptr) + TAO_YY_MORE_ADJ; if ( tao_yy_next_state ) { /* Consume the NUL. */ - tao_yy_cp = ++tao_yy_c_buf_p; + tao_yy_cp = ++(tao_yy_c_buf_p); tao_yy_current_state = tao_yy_next_state; goto tao_yy_match; } else { - tao_yy_cp = tao_yy_c_buf_p; + tao_yy_cp = (tao_yy_last_accepting_cpos); + tao_yy_current_state = (tao_yy_last_accepting_state); goto tao_yy_find_action; } } - else switch ( tao_yy_get_next_buffer() ) + else switch ( tao_yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - tao_yy_did_buffer_switch_on_eof = 0; + (tao_yy_did_buffer_switch_on_eof) = 0; - if ( tao_yywrap() ) + if ( tao_yywrap( ) ) { /* Note: because we've taken care in * tao_yy_get_next_buffer() to have set up @@ -1785,7 +1888,7 @@ case TAO_YY_STATE_EOF(INITIAL): * TAO_YY_NULL, it'll still work - another * TAO_YY_NULL will get returned. */ - tao_yy_c_buf_p = tao_yytext_ptr + TAO_YY_MORE_ADJ; + (tao_yy_c_buf_p) = (tao_yytext_ptr) + TAO_YY_MORE_ADJ; tao_yy_act = TAO_YY_STATE_EOF(TAO_YY_START); goto do_action; @@ -1793,30 +1896,30 @@ case TAO_YY_STATE_EOF(INITIAL): else { - if ( ! tao_yy_did_buffer_switch_on_eof ) + if ( ! (tao_yy_did_buffer_switch_on_eof) ) TAO_YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - tao_yy_c_buf_p = - tao_yytext_ptr + tao_yy_amount_of_matched_text; + (tao_yy_c_buf_p) = + (tao_yytext_ptr) + tao_yy_amount_of_matched_text; - tao_yy_current_state = tao_yy_get_previous_state(); + tao_yy_current_state = tao_yy_get_previous_state( ); - tao_yy_cp = tao_yy_c_buf_p; - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + tao_yy_cp = (tao_yy_c_buf_p); + tao_yy_bp = (tao_yytext_ptr) + TAO_YY_MORE_ADJ; goto tao_yy_match; case EOB_ACT_LAST_MATCH: - tao_yy_c_buf_p = - &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars]; + (tao_yy_c_buf_p) = + &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars)]; - tao_yy_current_state = tao_yy_get_previous_state(); + tao_yy_current_state = tao_yy_get_previous_state( ); - tao_yy_cp = tao_yy_c_buf_p; - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + tao_yy_cp = (tao_yy_c_buf_p); + tao_yy_bp = (tao_yytext_ptr) + TAO_YY_MORE_ADJ; goto tao_yy_find_action; } break; @@ -1827,8 +1930,7 @@ case TAO_YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of tao_yylex */ - +} /* end of tao_yylex */ /* tao_yy_get_next_buffer - try to read in a new buffer * @@ -1837,21 +1939,20 @@ case TAO_YY_STATE_EOF(INITIAL): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int tao_yy_get_next_buffer() - { - register char *dest = tao_yy_current_buffer->tao_yy_ch_buf; - register char *source = tao_yytext_ptr; +static int tao_yy_get_next_buffer (void) +{ + register char *dest = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf; + register char *source = (tao_yytext_ptr); register int number_to_move, i; int ret_val; - if ( tao_yy_c_buf_p > &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] ) + if ( (tao_yy_c_buf_p) > &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars) + 1] ) TAO_YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( tao_yy_current_buffer->tao_yy_fill_buffer == 0 ) + if ( TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( tao_yy_c_buf_p - tao_yytext_ptr - TAO_YY_MORE_ADJ == 1 ) + if ( (tao_yy_c_buf_p) - (tao_yytext_ptr) - TAO_YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1871,34 +1972,30 @@ static int tao_yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (tao_yy_c_buf_p - tao_yytext_ptr) - 1; + number_to_move = (int) ((tao_yy_c_buf_p) - (tao_yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_EOF_PENDING ) + if ( TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buffer_status == TAO_YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars = 0; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars = (tao_yy_n_chars) = 0; else { - int num_to_read = - tao_yy_current_buffer->tao_yy_buf_size - number_to_move - 1; + int num_to_read = + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef TAO_YY_USES_REJECT - TAO_YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - TAO_YY_BUFFER_STATE b = tao_yy_current_buffer; + TAO_YY_BUFFER_STATE b = TAO_YY_CURRENT_BUFFER; int tao_yy_c_buf_p_offset = - (int) (tao_yy_c_buf_p - b->tao_yy_ch_buf); + (int) ((tao_yy_c_buf_p) - b->tao_yy_ch_buf); if ( b->tao_yy_is_our_buffer ) { @@ -1911,8 +2008,7 @@ static int tao_yy_get_next_buffer() b->tao_yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - tao_yy_flex_realloc( (void *) b->tao_yy_ch_buf, - b->tao_yy_buf_size + 2 ); + tao_yyrealloc((void *) b->tao_yy_ch_buf,b->tao_yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1922,35 +2018,35 @@ static int tao_yy_get_next_buffer() TAO_YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - tao_yy_c_buf_p = &b->tao_yy_ch_buf[tao_yy_c_buf_p_offset]; + (tao_yy_c_buf_p) = &b->tao_yy_ch_buf[tao_yy_c_buf_p_offset]; - num_to_read = tao_yy_current_buffer->tao_yy_buf_size - + num_to_read = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > TAO_YY_READ_BUF_SIZE ) num_to_read = TAO_YY_READ_BUF_SIZE; /* Read in more data. */ - TAO_YY_INPUT( (&tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]), - tao_yy_n_chars, num_to_read ); + TAO_YY_INPUT( (&TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[number_to_move]), + (tao_yy_n_chars), num_to_read ); - tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars = (tao_yy_n_chars); } - if ( tao_yy_n_chars == 0 ) + if ( (tao_yy_n_chars) == 0 ) { if ( number_to_move == TAO_YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - tao_yyrestart( tao_yyin ); + tao_yyrestart(tao_yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - tao_yy_current_buffer->tao_yy_buffer_status = + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buffer_status = TAO_YY_BUFFER_EOF_PENDING; } } @@ -1958,33 +2054,32 @@ static int tao_yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - tao_yy_n_chars += number_to_move; - tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] = TAO_YY_END_OF_BUFFER_CHAR; - tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] = TAO_YY_END_OF_BUFFER_CHAR; + (tao_yy_n_chars) += number_to_move; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars)] = TAO_YY_END_OF_BUFFER_CHAR; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars) + 1] = TAO_YY_END_OF_BUFFER_CHAR; - tao_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0]; + (tao_yytext_ptr) = &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[0]; return ret_val; - } - +} /* tao_yy_get_previous_state - get the state just before the EOB char was reached */ -static tao_yy_state_type tao_yy_get_previous_state() - { + static tao_yy_state_type tao_yy_get_previous_state (void) +{ register tao_yy_state_type tao_yy_current_state; register char *tao_yy_cp; - tao_yy_current_state = tao_yy_start; + tao_yy_current_state = (tao_yy_start); tao_yy_current_state += TAO_YY_AT_BOL(); - for ( tao_yy_cp = tao_yytext_ptr + TAO_YY_MORE_ADJ; tao_yy_cp < tao_yy_c_buf_p; ++tao_yy_cp ) + for ( tao_yy_cp = (tao_yytext_ptr) + TAO_YY_MORE_ADJ; tao_yy_cp < (tao_yy_c_buf_p); ++tao_yy_cp ) { register TAO_YY_CHAR tao_yy_c = (*tao_yy_cp ? tao_yy_ec[TAO_YY_SC_TO_UI(*tao_yy_cp)] : 1); if ( tao_yy_accept[tao_yy_current_state] ) { - tao_yy_last_accepting_state = tao_yy_current_state; - tao_yy_last_accepting_cpos = tao_yy_cp; + (tao_yy_last_accepting_state) = tao_yy_current_state; + (tao_yy_last_accepting_cpos) = tao_yy_cp; } while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) { @@ -1996,30 +2091,23 @@ static tao_yy_state_type tao_yy_get_previous_state() } return tao_yy_current_state; - } - +} /* tao_yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = tao_yy_try_NUL_trans( current_state ); */ - -#ifdef TAO_YY_USE_PROTOS -static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_state_type tao_yy_current_state ) -#else -static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_current_state ) -tao_yy_state_type tao_yy_current_state; -#endif - { + static tao_yy_state_type tao_yy_try_NUL_trans (tao_yy_state_type tao_yy_current_state ) +{ register int tao_yy_is_jam; - register char *tao_yy_cp = tao_yy_c_buf_p; + register char *tao_yy_cp = (tao_yy_c_buf_p); register TAO_YY_CHAR tao_yy_c = 1; if ( tao_yy_accept[tao_yy_current_state] ) { - tao_yy_last_accepting_state = tao_yy_current_state; - tao_yy_last_accepting_cpos = tao_yy_cp; + (tao_yy_last_accepting_state) = tao_yy_current_state; + (tao_yy_last_accepting_cpos) = tao_yy_cp; } while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) { @@ -2031,81 +2119,73 @@ tao_yy_state_type tao_yy_current_state; tao_yy_is_jam = (tao_yy_current_state == 561); return tao_yy_is_jam ? 0 : tao_yy_current_state; - } +} + static void tao_yyunput (int c, register char * tao_yy_bp ) +{ + register char *tao_yy_cp; -#ifndef TAO_YY_NO_UNPUT -#ifdef TAO_YY_USE_PROTOS -static void tao_yyunput( int c, register char *tao_yy_bp ) -#else -static void tao_yyunput( c, tao_yy_bp ) -int c; -register char *tao_yy_bp; -#endif - { - register char *tao_yy_cp = tao_yy_c_buf_p; + tao_yy_cp = (tao_yy_c_buf_p); /* undo effects of setting up tao_yytext */ - *tao_yy_cp = tao_yy_hold_char; + *tao_yy_cp = (tao_yy_hold_char); - if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 ) + if ( tao_yy_cp < TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = tao_yy_n_chars + 2; - register char *dest = &tao_yy_current_buffer->tao_yy_ch_buf[ - tao_yy_current_buffer->tao_yy_buf_size + 2]; + register int number_to_move = (tao_yy_n_chars) + 2; + register char *dest = &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[ + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_size + 2]; register char *source = - &tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]; + &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[number_to_move]; - while ( source > tao_yy_current_buffer->tao_yy_ch_buf ) + while ( source > TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf ) *--dest = *--source; tao_yy_cp += (int) (dest - source); tao_yy_bp += (int) (dest - source); - tao_yy_current_buffer->tao_yy_n_chars = - tao_yy_n_chars = tao_yy_current_buffer->tao_yy_buf_size; + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars = + (tao_yy_n_chars) = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_size; - if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 ) + if ( tao_yy_cp < TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf + 2 ) TAO_YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--tao_yy_cp = (char) c; - - tao_yytext_ptr = tao_yy_bp; - tao_yy_hold_char = *tao_yy_cp; - tao_yy_c_buf_p = tao_yy_cp; - } -#endif /* ifndef TAO_YY_NO_UNPUT */ - + (tao_yytext_ptr) = tao_yy_bp; + (tao_yy_hold_char) = *tao_yy_cp; + (tao_yy_c_buf_p) = tao_yy_cp; +} #ifndef TAO_YY_NO_INPUT #ifdef __cplusplus -static int tao_yyinput() + static int tao_yyinput (void) #else -static int input() + static int input (void) #endif - { + +{ int c; - *tao_yy_c_buf_p = tao_yy_hold_char; + *(tao_yy_c_buf_p) = (tao_yy_hold_char); - if ( *tao_yy_c_buf_p == TAO_YY_END_OF_BUFFER_CHAR ) + if ( *(tao_yy_c_buf_p) == TAO_YY_END_OF_BUFFER_CHAR ) { /* tao_yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( tao_yy_c_buf_p < &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] ) + if ( (tao_yy_c_buf_p) < &TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_ch_buf[(tao_yy_n_chars)] ) /* This was really a NUL. */ - *tao_yy_c_buf_p = '\0'; + *(tao_yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = tao_yy_c_buf_p - tao_yytext_ptr; - ++tao_yy_c_buf_p; + int offset = (tao_yy_c_buf_p) - (tao_yytext_ptr); + ++(tao_yy_c_buf_p); - switch ( tao_yy_get_next_buffer() ) + switch ( tao_yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because tao_yy_g_n_b() @@ -2119,16 +2199,16 @@ static int input() */ /* Reset buffer status. */ - tao_yyrestart( tao_yyin ); + tao_yyrestart(tao_yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( tao_yywrap() ) - return EOF; + if ( tao_yywrap( ) ) + return 0; - if ( ! tao_yy_did_buffer_switch_on_eof ) + if ( ! (tao_yy_did_buffer_switch_on_eof) ) TAO_YY_NEW_FILE; #ifdef __cplusplus return tao_yyinput(); @@ -2138,91 +2218,94 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - tao_yy_c_buf_p = tao_yytext_ptr + offset; + (tao_yy_c_buf_p) = (tao_yytext_ptr) + offset; break; } } } - c = *(unsigned char *) tao_yy_c_buf_p; /* cast for 8-bit char's */ - *tao_yy_c_buf_p = '\0'; /* preserve tao_yytext */ - tao_yy_hold_char = *++tao_yy_c_buf_p; + c = *(unsigned char *) (tao_yy_c_buf_p); /* cast for 8-bit char's */ + *(tao_yy_c_buf_p) = '\0'; /* preserve tao_yytext */ + (tao_yy_hold_char) = *++(tao_yy_c_buf_p); - tao_yy_current_buffer->tao_yy_at_bol = (c == '\n'); + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_at_bol = (c == '\n'); return c; - } -#endif /* TAO_YY_NO_INPUT */ +} +#endif /* ifndef TAO_YY_NO_INPUT */ -#ifdef TAO_YY_USE_PROTOS -void tao_yyrestart( FILE *input_file ) -#else -void tao_yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! tao_yy_current_buffer ) - tao_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void tao_yyrestart (FILE * input_file ) +{ - tao_yy_init_buffer( tao_yy_current_buffer, input_file ); - tao_yy_load_buffer_state(); + if ( ! TAO_YY_CURRENT_BUFFER ){ + tao_yyensure_buffer_stack (); + TAO_YY_CURRENT_BUFFER_LVALUE = + tao_yy_create_buffer(tao_yyin,TAO_YY_BUF_SIZE ); } + tao_yy_init_buffer(TAO_YY_CURRENT_BUFFER,input_file ); + tao_yy_load_buffer_state( ); +} -#ifdef TAO_YY_USE_PROTOS -void tao_yy_switch_to_buffer( TAO_YY_BUFFER_STATE new_buffer ) -#else -void tao_yy_switch_to_buffer( new_buffer ) -TAO_YY_BUFFER_STATE new_buffer; -#endif - { - if ( tao_yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void tao_yy_switch_to_buffer (TAO_YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * tao_yypop_buffer_state(); + * tao_yypush_buffer_state(new_buffer); + */ + tao_yyensure_buffer_stack (); + if ( TAO_YY_CURRENT_BUFFER == new_buffer ) return; - if ( tao_yy_current_buffer ) + if ( TAO_YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *tao_yy_c_buf_p = tao_yy_hold_char; - tao_yy_current_buffer->tao_yy_buf_pos = tao_yy_c_buf_p; - tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; + *(tao_yy_c_buf_p) = (tao_yy_hold_char); + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_pos = (tao_yy_c_buf_p); + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars = (tao_yy_n_chars); } - tao_yy_current_buffer = new_buffer; - tao_yy_load_buffer_state(); + TAO_YY_CURRENT_BUFFER_LVALUE = new_buffer; + tao_yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (tao_yywrap()) processing, but the only time this flag * is looked at is after tao_yywrap() is called, so it's safe * to go ahead and always set it. */ - tao_yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef TAO_YY_USE_PROTOS -void tao_yy_load_buffer_state( void ) -#else -void tao_yy_load_buffer_state() -#endif - { - tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars; - tao_yytext_ptr = tao_yy_c_buf_p = tao_yy_current_buffer->tao_yy_buf_pos; - tao_yyin = tao_yy_current_buffer->tao_yy_input_file; - tao_yy_hold_char = *tao_yy_c_buf_p; - } + (tao_yy_did_buffer_switch_on_eof) = 1; +} +static void tao_yy_load_buffer_state (void) +{ + (tao_yy_n_chars) = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars; + (tao_yytext_ptr) = (tao_yy_c_buf_p) = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_pos; + tao_yyin = TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_input_file; + (tao_yy_hold_char) = *(tao_yy_c_buf_p); +} -#ifdef TAO_YY_USE_PROTOS -TAO_YY_BUFFER_STATE tao_yy_create_buffer( FILE *file, int size ) -#else -TAO_YY_BUFFER_STATE tao_yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c TAO_YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + TAO_YY_BUFFER_STATE tao_yy_create_buffer (FILE * file, int size ) +{ TAO_YY_BUFFER_STATE b; - b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) ); + b = (TAO_YY_BUFFER_STATE) tao_yyalloc(sizeof( struct tao_yy_buffer_state ) ); if ( ! b ) TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" ); @@ -2231,75 +2314,71 @@ int size; /* tao_yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->tao_yy_ch_buf = (char *) tao_yy_flex_alloc( b->tao_yy_buf_size + 2 ); + b->tao_yy_ch_buf = (char *) tao_yyalloc(b->tao_yy_buf_size + 2 ); if ( ! b->tao_yy_ch_buf ) TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" ); b->tao_yy_is_our_buffer = 1; - tao_yy_init_buffer( b, file ); + tao_yy_init_buffer(b,file ); return b; - } +} +/** Destroy the buffer. + * @param b a buffer created with tao_yy_create_buffer() + * + */ + void tao_yy_delete_buffer (TAO_YY_BUFFER_STATE b ) +{ -#ifdef TAO_YY_USE_PROTOS -void tao_yy_delete_buffer( TAO_YY_BUFFER_STATE b ) -#else -void tao_yy_delete_buffer( b ) -TAO_YY_BUFFER_STATE b; -#endif - { if ( ! b ) return; - if ( b == tao_yy_current_buffer ) - tao_yy_current_buffer = (TAO_YY_BUFFER_STATE) 0; + if ( b == TAO_YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + TAO_YY_CURRENT_BUFFER_LVALUE = (TAO_YY_BUFFER_STATE) 0; if ( b->tao_yy_is_our_buffer ) - tao_yy_flex_free( (void *) b->tao_yy_ch_buf ); - - tao_yy_flex_free( (void *) b ); - } - + tao_yyfree((void *) b->tao_yy_ch_buf ); + tao_yyfree((void *) b ); +} -#ifdef TAO_YY_USE_PROTOS -void tao_yy_init_buffer( TAO_YY_BUFFER_STATE b, FILE *file ) -#else -void tao_yy_init_buffer( b, file ) -TAO_YY_BUFFER_STATE b; -FILE *file; -#endif +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a tao_yyrestart() or at EOF. + */ + static void tao_yy_init_buffer (TAO_YY_BUFFER_STATE b, FILE * file ) +{ + int oerrno = errno; - { - tao_yy_flush_buffer( b ); + tao_yy_flush_buffer(b ); b->tao_yy_input_file = file; b->tao_yy_fill_buffer = 1; -#if TAO_YY_ALWAYS_INTERACTIVE - b->tao_yy_is_interactive = 1; -#else -#if TAO_YY_NEVER_INTERACTIVE - b->tao_yy_is_interactive = 0; -#else - b->tao_yy_is_interactive = file ? (ACE_OS::isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then tao_yy_init_buffer was _probably_ + * called from tao_yyrestart() or through tao_yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != TAO_YY_CURRENT_BUFFER){ + b->tao_yy_bs_lineno = 1; + b->tao_yy_bs_column = 0; + } + b->tao_yy_is_interactive = 0; -#ifdef TAO_YY_USE_PROTOS -void tao_yy_flush_buffer( TAO_YY_BUFFER_STATE b ) -#else -void tao_yy_flush_buffer( b ) -TAO_YY_BUFFER_STATE b; -#endif + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, TAO_YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c TAO_YY_CURRENT_BUFFER. + * + */ + void tao_yy_flush_buffer (TAO_YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->tao_yy_n_chars = 0; @@ -2316,20 +2395,112 @@ TAO_YY_BUFFER_STATE b; b->tao_yy_at_bol = 1; b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW; - if ( b == tao_yy_current_buffer ) - tao_yy_load_buffer_state(); + if ( b == TAO_YY_CURRENT_BUFFER ) + tao_yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void tao_yypush_buffer_state (TAO_YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == 0) + return; + + tao_yyensure_buffer_stack(); + + /* This block is copied from tao_yy_switch_to_buffer. */ + if ( TAO_YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(tao_yy_c_buf_p) = (tao_yy_hold_char); + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_buf_pos = (tao_yy_c_buf_p); + TAO_YY_CURRENT_BUFFER_LVALUE->tao_yy_n_chars = (tao_yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (TAO_YY_CURRENT_BUFFER) + (tao_yy_buffer_stack_top)++; + TAO_YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from tao_yy_switch_to_buffer. */ + tao_yy_load_buffer_state( ); + (tao_yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void tao_yypop_buffer_state (void) +{ + if (!TAO_YY_CURRENT_BUFFER) + return; + + tao_yy_delete_buffer(TAO_YY_CURRENT_BUFFER ); + TAO_YY_CURRENT_BUFFER_LVALUE = 0; + if ((tao_yy_buffer_stack_top) > 0) + --(tao_yy_buffer_stack_top); + + if (TAO_YY_CURRENT_BUFFER) { + tao_yy_load_buffer_state( ); + (tao_yy_did_buffer_switch_on_eof) = 1; } +} +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void tao_yyensure_buffer_stack (void) +{ + int num_to_alloc; -#ifndef TAO_YY_NO_SCAN_BUFFER -#ifdef TAO_YY_USE_PROTOS -TAO_YY_BUFFER_STATE tao_yy_scan_buffer( char *base, tao_yy_size_t size ) -#else -TAO_YY_BUFFER_STATE tao_yy_scan_buffer( base, size ) -char *base; -tao_yy_size_t size; -#endif - { + if (!(tao_yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (tao_yy_buffer_stack) = (struct tao_yy_buffer_state**)tao_yyalloc + (num_to_alloc * sizeof(struct tao_yy_buffer_state*) + ); + + memset((tao_yy_buffer_stack), 0, num_to_alloc * sizeof(struct tao_yy_buffer_state*)); + + (tao_yy_buffer_stack_max) = num_to_alloc; + (tao_yy_buffer_stack_top) = 0; + return; + } + + if ((tao_yy_buffer_stack_top) >= ((tao_yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (tao_yy_buffer_stack_max) + grow_size; + (tao_yy_buffer_stack) = (struct tao_yy_buffer_state**)tao_yyrealloc + ((tao_yy_buffer_stack), + num_to_alloc * sizeof(struct tao_yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((tao_yy_buffer_stack) + (tao_yy_buffer_stack_max), 0, grow_size * sizeof(struct tao_yy_buffer_state*)); + (tao_yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +TAO_YY_BUFFER_STATE tao_yy_scan_buffer (char * base, tao_yy_size_t size ) +{ TAO_YY_BUFFER_STATE b; if ( size < 2 || @@ -2338,7 +2509,7 @@ tao_yy_size_t size; /* They forgot to leave room for the EOB's. */ return 0; - b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) ); + b = (TAO_YY_BUFFER_STATE) tao_yyalloc(sizeof( struct tao_yy_buffer_state ) ); if ( ! b ) TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_buffer()" ); @@ -2352,56 +2523,51 @@ tao_yy_size_t size; b->tao_yy_fill_buffer = 0; b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW; - tao_yy_switch_to_buffer( b ); + tao_yy_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef TAO_YY_NO_SCAN_STRING -#ifdef TAO_YY_USE_PROTOS -TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yyconst char *tao_yy_str ) -#else -TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yy_str ) -tao_yyconst char *tao_yy_str; -#endif - { - int len; - for ( len = 0; tao_yy_str[len]; ++len ) - ; +} - return tao_yy_scan_bytes( tao_yy_str, len ); - } -#endif +/** Setup the input buffer state to scan a string. The next call to tao_yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * tao_yy_scan_bytes() instead. + */ +TAO_YY_BUFFER_STATE tao_yy_scan_string (tao_yyconst char * tao_yystr ) +{ + return tao_yy_scan_bytes(tao_yystr,strlen(tao_yystr) ); +} -#ifndef TAO_YY_NO_SCAN_BYTES -#ifdef TAO_YY_USE_PROTOS -TAO_YY_BUFFER_STATE tao_yy_scan_bytes( tao_yyconst char *bytes, int len ) -#else -TAO_YY_BUFFER_STATE tao_yy_scan_bytes( bytes, len ) -tao_yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to tao_yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +TAO_YY_BUFFER_STATE tao_yy_scan_bytes (tao_yyconst char * tao_yybytes, int _tao_yybytes_len ) +{ TAO_YY_BUFFER_STATE b; char *buf; tao_yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) tao_yy_flex_alloc( n ); + n = _tao_yybytes_len + 2; + buf = (char *) tao_yyalloc(n ); if ( ! buf ) TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _tao_yybytes_len; ++i ) + buf[i] = tao_yybytes[i]; - buf[len] = buf[len+1] = TAO_YY_END_OF_BUFFER_CHAR; + buf[_tao_yybytes_len] = buf[_tao_yybytes_len+1] = TAO_YY_END_OF_BUFFER_CHAR; - b = tao_yy_scan_buffer( buf, n ); + b = tao_yy_scan_buffer(buf,n ); if ( ! b ) TAO_YY_FATAL_ERROR( "bad buffer in tao_yy_scan_bytes()" ); @@ -2411,148 +2577,196 @@ int len; b->tao_yy_is_our_buffer = 1; return b; - } +} + +#ifndef TAO_YY_EXIT_FAILURE +#define TAO_YY_EXIT_FAILURE 2 #endif +static void tao_yy_fatal_error (tao_yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( TAO_YY_EXIT_FAILURE ); +} -#ifndef TAO_YY_NO_PUSH_STATE -#ifdef TAO_YY_USE_PROTOS -static void tao_yy_push_state( int new_state ) -#else -static void tao_yy_push_state( new_state ) -int new_state; -#endif - { - if ( tao_yy_start_stack_ptr >= tao_yy_start_stack_depth ) - { - tao_yy_size_t new_size; +/* Redefine tao_yyless() so it works in section 3 code. */ - tao_yy_start_stack_depth += TAO_YY_START_STACK_INCR; - new_size = tao_yy_start_stack_depth * sizeof( int ); +#undef tao_yyless +#define tao_yyless(n) \ + do \ + { \ + /* Undo effects of setting up tao_yytext. */ \ + int tao_yyless_macro_arg = (n); \ + TAO_YY_LESS_LINENO(tao_yyless_macro_arg);\ + tao_yytext[tao_yyleng] = (tao_yy_hold_char); \ + (tao_yy_c_buf_p) = tao_yytext + tao_yyless_macro_arg; \ + (tao_yy_hold_char) = *(tao_yy_c_buf_p); \ + *(tao_yy_c_buf_p) = '\0'; \ + tao_yyleng = tao_yyless_macro_arg; \ + } \ + while ( 0 ) - if ( ! tao_yy_start_stack ) - tao_yy_start_stack = (int *) tao_yy_flex_alloc( new_size ); +/* Accessor methods (get/set functions) to struct members. */ - else - tao_yy_start_stack = (int *) tao_yy_flex_realloc( - (void *) tao_yy_start_stack, new_size ); +/** Get the current line number. + * + */ +int tao_yyget_lineno (void) +{ - if ( ! tao_yy_start_stack ) - TAO_YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + return tao_yylineno; +} - tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START; +/** Get the input stream. + * + */ +FILE *tao_yyget_in (void) +{ + return tao_yyin; +} - BEGIN(new_state); - } -#endif +/** Get the output stream. + * + */ +FILE *tao_yyget_out (void) +{ + return tao_yyout; +} +/** Get the length of the current token. + * + */ +int tao_yyget_leng (void) +{ + return tao_yyleng; +} -#ifndef TAO_YY_NO_POP_STATE -static void tao_yy_pop_state() - { - if ( --tao_yy_start_stack_ptr < 0 ) - TAO_YY_FATAL_ERROR( "start-condition stack underflow" ); +/** Get the current token. + * + */ - BEGIN(tao_yy_start_stack[tao_yy_start_stack_ptr]); - } -#endif +char *tao_yyget_text (void) +{ + return tao_yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void tao_yyset_lineno (int line_number ) +{ + tao_yylineno = line_number; +} -#ifndef TAO_YY_NO_TOP_STATE -static int tao_yy_top_state() - { - return tao_yy_start_stack[tao_yy_start_stack_ptr - 1]; - } -#endif +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see tao_yy_switch_to_buffer + */ +void tao_yyset_in (FILE * in_str ) +{ + tao_yyin = in_str ; +} -#ifndef TAO_YY_EXIT_FAILURE -#define TAO_YY_EXIT_FAILURE 2 -#endif +void tao_yyset_out (FILE * out_str ) +{ + tao_yyout = out_str ; +} + +int tao_yyget_debug (void) +{ + return tao_yy_flex_debug; +} + +void tao_yyset_debug (int bdebug ) +{ + tao_yy_flex_debug = bdebug ; +} -#ifdef TAO_YY_USE_PROTOS -static void tao_yy_fatal_error( tao_yyconst char msg[] ) +static int tao_yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from tao_yylex_destroy(), so don't allocate here. + */ + + (tao_yy_buffer_stack) = 0; + (tao_yy_buffer_stack_top) = 0; + (tao_yy_buffer_stack_max) = 0; + (tao_yy_c_buf_p) = (char *) 0; + (tao_yy_init) = 0; + (tao_yy_start) = 0; + +/* Defined in main.c */ +#ifdef TAO_YY_STDINIT + tao_yyin = stdin; + tao_yyout = stdout; #else -static void tao_yy_fatal_error( msg ) -char msg[]; + tao_yyin = (FILE *) 0; + tao_yyout = (FILE *) 0; #endif - { - (void) ACE_OS::fprintf( stderr, "%s\n", msg ); - ACE_OS::exit( TAO_YY_EXIT_FAILURE ); - } + /* For future reference: Set errno on error, since we are called by + * tao_yylex_init() + */ + return 0; +} +/* tao_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int tao_yylex_destroy (void) +{ -/* Redefine tao_yyless() so it works in section 3 code. */ + /* Pop the buffer stack, destroying each element. */ + while(TAO_YY_CURRENT_BUFFER){ + tao_yy_delete_buffer(TAO_YY_CURRENT_BUFFER ); + TAO_YY_CURRENT_BUFFER_LVALUE = 0; + tao_yypop_buffer_state(); + } -#undef tao_yyless -#define tao_yyless(n) \ - do \ - { \ - /* Undo effects of setting up tao_yytext. */ \ - tao_yytext[tao_yyleng] = tao_yy_hold_char; \ - tao_yy_c_buf_p = tao_yytext + n; \ - tao_yy_hold_char = *tao_yy_c_buf_p; \ - *tao_yy_c_buf_p = '\0'; \ - tao_yyleng = n; \ - } \ - while ( 0 ) + /* Destroy the stack itself. */ + tao_yyfree((tao_yy_buffer_stack) ); + (tao_yy_buffer_stack) = 0; + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * tao_yylex() is called, initialization will occur. */ + tao_yy_init_globals( ); -/* Internal utility routines. */ + return 0; +} + +/* + * Internal utility routines. + */ #ifndef tao_yytext_ptr -#ifdef TAO_YY_USE_PROTOS -static void tao_yy_flex_strncpy( char *s1, tao_yyconst char *s2, int n ) -#else -static void tao_yy_flex_strncpy( s1, s2, n ) -char *s1; -tao_yyconst char *s2; -int n; -#endif - { +static void tao_yy_flex_strncpy (char* s1, tao_yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef TAO_YY_NEED_STRLEN -#ifdef TAO_YY_USE_PROTOS -static int tao_yy_flex_strlen( tao_yyconst char *s ) -#else -static int tao_yy_flex_strlen( s ) -tao_yyconst char *s; -#endif - { +static int tao_yy_flex_strlen (tao_yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif +void *tao_yyalloc (tao_yy_size_t size ) +{ + return (void *) malloc( size ); +} -#ifdef TAO_YY_USE_PROTOS -static void *tao_yy_flex_alloc( tao_yy_size_t size ) -#else -static void *tao_yy_flex_alloc( size ) -tao_yy_size_t size; -#endif - { - return (void *) ACE_OS::malloc( size ); - } - -#ifdef TAO_YY_USE_PROTOS -static void *tao_yy_flex_realloc( void *ptr, tao_yy_size_t size ) -#else -static void *tao_yy_flex_realloc( ptr, size ) -void *ptr; -tao_yy_size_t size; -#endif - { +void *tao_yyrealloc (void * ptr, tao_yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2560,26 +2774,15 @@ tao_yy_size_t size; * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) ACE_OS::realloc( (char *) ptr, size ); - } + return (void *) realloc( (char *) ptr, size ); +} -#ifdef TAO_YY_USE_PROTOS -static void tao_yy_flex_free( void *ptr ) -#else -static void tao_yy_flex_free( ptr ) -void *ptr; -#endif - { - ACE_OS::free( ptr ); - } +void tao_yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see tao_yyrealloc() for (char *) cast */ +} -#if TAO_YY_MAIN -int main() - { - tao_yylex(); - return 0; - } -#endif +#define TAO_YYTABLES_NAME "tao_yytables" /* subroutines */ @@ -2610,14 +2813,14 @@ idl_parse_line_and_file (char *buf) } // Find line number. - while (ACE_OS::ace_isspace (*r)) + while (isspace (*r)) { r++; } h = r; - for (; ACE_OS::ace_isdigit (*r); r++) + for (; isdigit (*r); r++) { continue; } @@ -2953,9 +3156,9 @@ idl_store_pragma (char *buf) // split up data type and key strings char *sample_type = tmp; - while (*tmp && !ACE_OS::ace_isspace (*tmp)) + while (*tmp && !isspace (*tmp)) tmp++; - while (ACE_OS::ace_isspace (*tmp)) + while (isspace (*tmp)) { *tmp = '\0'; tmp++; @@ -3191,7 +3394,7 @@ idl_escape_reader( int i; // hex value - for (i = 2; str[i] != '\0' && ACE_OS::ace_isxdigit (str[i]); ++i) + for (i = 2; str[i] != '\0' && isxdigit (str[i]); ++i) { continue; } @@ -3240,7 +3443,7 @@ idl_wchar_escape_reader (char *str) int i; // get the hex digits - for (i = 2; str[i] != '\0' && ACE_OS::ace_isxdigit (str[i]); i++) + for (i = 2; str[i] != '\0' && isxdigit (str[i]); i++) { continue; } @@ -3319,7 +3522,7 @@ idl_valid_version (char *s) for (i = 0; tmp[i] != '\0'; ++i) { - if (!ACE_OS::ace_isdigit (tmp[i])) + if (!isdigit (tmp[i])) { return 0; } @@ -3329,7 +3532,7 @@ idl_valid_version (char *s) for (i = 0; i < len; ++i) { - if (!ACE_OS::ace_isdigit (s[i])) + if (!isdigit (s[i])) { return 0; } @@ -3367,3 +3570,4 @@ idl_find_node (char *s) return d; } + diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp.diff b/TAO/TAO_IDL/fe/lex.yy.cpp.diff index cc361764657..7ac996987db 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp.diff +++ b/TAO/TAO_IDL/fe/lex.yy.cpp.diff @@ -1,93 +1,95 @@ ---- lex.yy.cpp.orig 2006-11-30 07:19:39.000000000 -0600 -+++ lex.yy.cpp 2006-11-30 07:18:28.000000000 -0600 -@@ -1602,42 +1602,42 @@ +--- lex.yy.cpp.orig 2008-05-31 10:22:13.000000000 -0500 ++++ lex.yy.cpp 2008-05-31 10:27:05.000000000 -0500 +@@ -1698,7 +1698,7 @@ idl_global->set_lineno(idl_global->lineno() + 1); idl_store_pragma(ace_tao_yytext); } - TAO_YY_BREAK + break; case 87: + /* rule 87 can match eol */ case 88: - TAO_YY_RULE_SETUP +@@ -1707,7 +1707,7 @@ {/* ignore file */ idl_global->set_lineno(idl_global->lineno() + 1); } - TAO_YY_BREAK + break; case 89: + /* rule 89 can match eol */ case 90: - TAO_YY_RULE_SETUP +@@ -1716,7 +1716,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 91: + /* rule 91 can match eol */ case 92: - TAO_YY_RULE_SETUP +@@ -1725,7 +1725,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 93: + /* rule 93 can match eol */ case 94: - TAO_YY_RULE_SETUP +@@ -1734,7 +1734,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 95: + /* rule 95 can match eol */ case 96: - TAO_YY_RULE_SETUP +@@ -1743,7 +1743,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK -+ break; ++ break; case 97: + /* rule 97 can match eol */ case 98: - TAO_YY_RULE_SETUP -@@ -1645,14 +1645,14 @@ +@@ -1753,7 +1753,7 @@ /* ignore cpp ident */ idl_global->set_lineno(idl_global->lineno() + 1); } - TAO_YY_BREAK -+ break; ++ break; case 99: + /* rule 99 can match eol */ TAO_YY_RULE_SETUP - { +@@ -1761,7 +1761,7 @@ /* ignore comments */ idl_global->set_lineno(idl_global->lineno() + 1); } - TAO_YY_BREAK -+ break; ++ break; case 100: TAO_YY_RULE_SETUP { -@@ -1669,17 +1669,17 @@ - } - } - } -- TAO_YY_BREAK -+ break; +@@ -1783,14 +1783,14 @@ case 101: TAO_YY_RULE_SETUP ; - TAO_YY_BREAK -+ break; ++ break; case 102: + /* rule 102 can match eol */ TAO_YY_RULE_SETUP { idl_global->set_lineno(idl_global->lineno() + 1); } - TAO_YY_BREAK -+ break; ++ break; case 103: TAO_YY_RULE_SETUP return ace_tao_yytext [0]; -@@ -1687,7 +1687,7 @@ +@@ -1798,7 +1798,7 @@ case 104: TAO_YY_RULE_SETUP TAO_YY_ECHO; diff --git a/TAO/TAO_IDL/fe/mcpp_tao_yyinput.h b/TAO/TAO_IDL/fe/mcpp_tao_yyinput.h new file mode 100644 index 00000000000..ade25f68a3e --- /dev/null +++ b/TAO/TAO_IDL/fe/mcpp_tao_yyinput.h @@ -0,0 +1,29 @@ +/** $Id$ + * @file mcpp_yyinput.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * + * Provides a YY_INPUT macro which enables lexing from an in-memory buffer + * instead of a file. + */ + +#ifndef MCPP_YYINPUT_H +#define MCPP_YYINPUT_H + +extern char *tao_preproc_buffer; +extern size_t tao_preproc_buffer_length; + +size_t tao_preproc_buffer_pos = 0; + +#define TAO_YY_INPUT(buf,result,max_size) \ + { \ + result = 0 ; \ + while ((tao_preproc_buffer_pos < tao_preproc_buffer_length) && \ + (result < max_size)) \ + { \ + buf[result] = tao_preproc_buffer[tao_preproc_buffer_pos]; \ + ++tao_preproc_buffer_pos; \ + ++result; \ + } \ + if (result == 0) result = TAO_YY_NULL;} \ + +#endif /* MCPP_YYINPUT_H */ diff --git a/TAO/TAO_IDL/fe_mcpp.mpb b/TAO/TAO_IDL/fe_mcpp.mpb new file mode 100644 index 00000000000..e41aec29fa0 --- /dev/null +++ b/TAO/TAO_IDL/fe_mcpp.mpb @@ -0,0 +1,3 @@ +feature(mcpp) { + macros += USE_MCPP_BUFFER_LEXING +} diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h index 79252d3e693..1f635ebcec5 100644 --- a/TAO/TAO_IDL/include/fe_extern.h +++ b/TAO/TAO_IDL/include/fe_extern.h @@ -82,7 +82,11 @@ TAO_IDL_FE_Export int FE_yyparse (void); TAO_IDL_FE_Export void +#ifdef USE_MCPP_BUFFER_LEXING +FE_set_yyin (char *); // Set yyin +#else FE_set_yyin (FILE *); // Set yyin +#endif /* USE_MCPP_BUFFER_LEXING */ // Interface to constructors for objects need by the driver diff --git a/TAO/TAO_IDL/tao_idl.mpc b/TAO/TAO_IDL/tao_idl.mpc index 0d7d5618a39..12f3522d0c2 100644 --- a/TAO/TAO_IDL/tao_idl.mpc +++ b/TAO/TAO_IDL/tao_idl.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(TAO_IDL_EXE) : aceexe, install, tao_output, crosscompile, mcpp, preproc { +project(TAO_IDL_EXE) : aceexe, install, tao_output, crosscompile, mcpp, tao_idl_mcpp { exename = tao_idl libs += TAO_IDL_BE TAO_IDL_FE install = $(ACE_ROOT)/bin @@ -75,7 +75,7 @@ project(TAO_IDL_BE) : acelib, conv_lib, tao_output, crosscompile, tao_vc8warning } -project(TAO_IDL_FE) : acelib, conv_lib, tao_output, crosscompile { +project(TAO_IDL_FE) : acelib, conv_lib, tao_output, crosscompile, fe_mcpp { sharedname = TAO_IDL_FE dynamicflags = TAO_IDL_FE_BUILD_DLL @@ -182,3 +182,4 @@ project(TAO_IDL_FE) : acelib, conv_lib, tao_output, crosscompile { "endif" } } + diff --git a/TAO/TAO_IDL/preproc.mpb b/TAO/TAO_IDL/tao_idl_mcpp.mpb index 84b7c246853..c3fc2b4c7b6 100644 --- a/TAO/TAO_IDL/preproc.mpb +++ b/TAO/TAO_IDL/tao_idl_mcpp.mpb @@ -1,5 +1,6 @@ // $Id$ feature(mcpp) { + macros += USE_MCPP_BUFFER_LEXING Source_Files { driver/drv_mcpp_preproc.cpp } |