diff options
author | eas <eas@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-21 18:23:14 +0000 |
---|---|---|
committer | eas <eas@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-02-21 18:23:14 +0000 |
commit | 06ed2ba411e4ee382855c0eff6dfba5553ce6fbe (patch) | |
tree | 61f2a50aab0d7841b0787f9a85c3b70d48dcb7ce | |
parent | 79980e3809adb6157a73ca2faa953fbd231d7cf9 (diff) | |
download | ATCD-06ed2ba411e4ee382855c0eff6dfba5553ce6fbe.tar.gz |
ChangeLogTag:Fri Feb 21 17:49:54 2003 Edward Scott <eas@prismtechnologies.com>
48 files changed, 3341 insertions, 1203 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 0e6bddacefa..f4b13c301e5 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,77 @@ +Fri Feb 21 17:49:54 2003 Edward Scott <eas@prismtechnologies.com> + + * tao/DynamicAny/DynUnion_i.h: + * tao/DynamicAny/DynUnion_i.cpp: + Fixes for bug 1455 for creating Dynamic Anys from Anys initialised + with _default(). + + * tao/DynamicAny/DynStruct_i.cpp (from_any): + * tao/DynamicAny/DynStruct_i.h (TAO_Local_RefCounted_Object): + * tao/DynamicAny/DynUnion_i.cpp (TAO_DynUnion_i): + Fixes for Dynamic Any with aliases typecodes. Fixes bug 1449. + + * tests/DynAny_Test/test_dynunion.cpp: + * tests/DynAny_Test/test_dynstruct.cpp: + * tests/DynAny_Test/da_tests.idl: + Test update for bugs 1449 and 1455. + + * TAO_IDL/util/utl_global.cpp: + * TAO_IDL/include/idl_global.h: + * TAO_IDL/fe/lex.yy.cpp: + * TAO_IDL/fe/idl.ll: + * TAO_IDL/tao_idl.cpp: + Correct IFR Service handling IDL with C++ keyword identifiers. + Fixes bug 1393. + + * TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client.dsp: + * TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client_Static.dsp: + * TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Regression.dsw: + * TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Regression.mpc: + * TAO/orbsvcs/tests/Bug_1393_Regression/client.cpp: + * TAO/orbsvcs/tests/Bug_1393_Regression/Makefile: + * TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.bor: + * TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.Bug_1393_Client: + * TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.Bug_1393_Client.bor: + * TAO/orbsvcs/tests/Bug_1393_Regression/README: + * TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl: + Regression test for 1393. + + * tao/PortableServer/POA.cpp (TAO_POA): + Recover from failure to contact IMR in create_POA with + persistent policy. Fixes bug 1395. + + * TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Client.dsp: + * TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Regression.dsw: + * TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Regression.mpc: + * TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Server.dsp: + * TAO/orbsvcs/tests/Bug_1395_Regression/client.cpp: + * TAO/orbsvcs/tests/Bug_1395_Regression/Makefile: + * TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Client: + * TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Server: + * TAO/orbsvcs/tests/Bug_1395_Regression/README: + * TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl: + * TAO/orbsvcs/tests/Bug_1395_Regression/server.cpp: + * TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.cpp: + * TAO/orbsvcs/tests/Bug_1395_Regression/Test.idl: + * TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.h: + Regression test for 1395. + + * orbsvcs/orbsvcs/Naming/Naming_Utils.cpp (parse_args): + Fixed usage message (Bug 1438). + + * TAO/orbsvcs/tests/Bug_1436_Regression/README: + * TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl: + * TAO/orbsvcs/tests/Bug_1436_Regression/test.idl: + Regression test for 1436. + + * orbsvcs/ImplRepo_Service/tao_imr_i.cpp: + Prevent registration of server with empty server name in the + ImplRepo service. Fixes bug 1437. + + * TAO/orbsvcs/tests/Bug_1437_Regression/README: + * TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl: + Regression test for 1437. + Fri Feb 21 06:54:45 2003 Ossama Othman <ossama@uci.edu> * TAO_IDL/be/be_visitor_operation/operation.cpp diff --git a/TAO/TAO_IDL/fe/Makefile.am b/TAO/TAO_IDL/fe/Makefile.am index 728634a90a1..52e6c108bd8 100644 --- a/TAO/TAO_IDL/fe/Makefile.am +++ b/TAO/TAO_IDL/fe/Makefile.am @@ -59,6 +59,7 @@ lex.yy.cpp.target: -e "s@#include <unistd\.h>@#include \"ace/OS.h\"@" \ -e "/#include </d" \ -e "s@ECHO@TAO_YY_ECHO@" \ + -e "/^#line /d" \ -e 's/\$$Hea''der.*\$$/$$I''d$$/' > lex.yy.cpp patch < lex.yy.cpp.diff echo timestamp > $@ diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index 3f822a22e57..8f651137772 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -202,9 +202,12 @@ oneway return IDL_ONEWAY; // regular expression is to handle EBCDIC, as well as ASCII. TAO_IDL_CPP_Keyword_Table cpp_key_tbl; - const TAO_IDL_CPP_Keyword_Entry *entry = - cpp_key_tbl.lookup (ace_yytext, - ACE_OS::strlen (ace_yytext)); + const TAO_IDL_CPP_Keyword_Entry *entry = 0; + if (!idl_global->preserve_cpp_keywords()) + { + entry = cpp_key_tbl.lookup (ace_yytext, + ACE_OS::strlen (ace_yytext)); + } if (entry) yylval.strval = ACE_OS::strdup (entry->mapping_); else diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index e80c71f0ca2..8bc30c0dee6 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -1,7 +1,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Id$ + * $Id: lex.yy.cpp,v 1.2 2003/02/10 16:17:07 sm Exp $ */ #define FLEX_SCANNER @@ -28,15 +28,15 @@ /* The "const" storage-class-modifier is valid. */ #define TAO_YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #ifdef __STDC__ #define TAO_YY_USE_PROTOS #define TAO_YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch @@ -105,10 +105,10 @@ extern FILE *tao_yyin, *tao_yyout; * 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(); + * 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 @@ -118,15 +118,15 @@ extern FILE *tao_yyin, *tao_yyout; /* 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; \ - 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_DO_BEFORE_ACTION; /* set up tao_yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up tao_yytext. */ \ + *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_DO_BEFORE_ACTION; /* set up tao_yytext again */ \ + } \ + while ( 0 ) #define unput(c) tao_yyunput( c, tao_yytext_ptr ) @@ -138,61 +138,61 @@ typedef unsigned int tao_yy_size_t; struct tao_yy_buffer_state - { - FILE *tao_yy_input_file; - - char *tao_yy_ch_buf; /* input buffer */ - char *tao_yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - tao_yy_size_t tao_yy_buf_size; - - /* Number of characters read into tao_yy_ch_buf, not including EOB - * characters. - */ - int tao_yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int tao_yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int tao_yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int tao_yy_at_bol; - - /* 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; + { + FILE *tao_yy_input_file; + + char *tao_yy_ch_buf; /* input buffer */ + char *tao_yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + tao_yy_size_t tao_yy_buf_size; + + /* Number of characters read into tao_yy_ch_buf, not including EOB + * characters. + */ + int tao_yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int tao_yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int tao_yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int tao_yy_at_bol; + + /* 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 - * then we mark the buffer as TAO_YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via tao_yyrestart()), so that the user can continue scanning by - * just pointing tao_yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as TAO_YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via tao_yyrestart()), so that the user can continue scanning by + * just pointing tao_yyin at a new input file. + */ #define TAO_YY_BUFFER_EOF_PENDING 2 - }; + }; static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0; @@ -206,15 +206,15 @@ static TAO_YY_BUFFER_STATE tao_yy_current_buffer = 0; /* 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 */ +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_start = 0; /* start state number */ +static int tao_yy_init = 1; /* 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 * instead of setting up a fresh tao_yyin. A bit of a hack ... @@ -242,18 +242,18 @@ static void tao_yy_flex_free TAO_YY_PROTO(( 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_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \ + tao_yy_current_buffer->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_yy_current_buffer = tao_yy_create_buffer( tao_yyin, TAO_YY_BUF_SIZE ); \ + tao_yy_current_buffer->tao_yy_at_bol = at_bol; \ + } #define TAO_YY_AT_BOL() (tao_yy_current_buffer->tao_yy_at_bol) @@ -272,14 +272,14 @@ static void tao_yy_fatal_error TAO_YY_PROTO(( tao_yyconst char msg[] )); * 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_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_yytext_ptr = tao_yy_bp; \ + tao_yyleng = (int) (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; #define TAO_YY_NUM_RULES 104 #define TAO_YY_END_OF_BUFFER 105 @@ -880,9 +880,9 @@ static ACE_CDR::WChar idl_wchar_escape_reader (char *); static char idl_escape_reader (char *); static double idl_atof (char *); static long idl_atoi (char *, long); -static unsigned long idl_atoui (char *, long); -static void idl_parse_line_and_file (char *); -static void idl_store_pragma (char *); +static unsigned long idl_atoui (char *, long); +static void idl_parse_line_and_file (char *); +static void idl_store_pragma (char *); static char * idl_get_pragma_string (char *); static idl_bool idl_valid_version (char *); static AST_Decl * idl_find_node (char *); @@ -990,21 +990,21 @@ TAO_YY_MALLOC_DECL */ #ifndef TAO_YY_INPUT #define TAO_YY_INPUT(buf,result,max_size) \ - if ( tao_yy_current_buffer->tao_yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( tao_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( tao_yyin ) ) \ - TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, tao_yyin )) == 0) \ - && ferror( tao_yyin ) ) \ - TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( tao_yy_current_buffer->tao_yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( tao_yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( tao_yyin ) ) \ + TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, tao_yyin )) == 0) \ + && ferror( tao_yyin ) ) \ + TAO_YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "tao_yyterminate();" - @@ -1045,373 +1045,373 @@ TAO_YY_MALLOC_DECL #endif #define TAO_YY_RULE_SETUP \ - if ( tao_yyleng > 0 ) \ - tao_yy_current_buffer->tao_yy_at_bol = \ - (tao_yytext[tao_yyleng - 1] == '\n'); \ - TAO_YY_USER_ACTION + if ( tao_yyleng > 0 ) \ + tao_yy_current_buffer->tao_yy_at_bol = \ + (tao_yytext[tao_yyleng - 1] == '\n'); \ + TAO_YY_USER_ACTION TAO_YY_DECL - { - register tao_yy_state_type tao_yy_current_state; - register char *tao_yy_cp = 0, *tao_yy_bp = 0; - register int tao_yy_act; + { + register tao_yy_state_type tao_yy_current_state; + register char *tao_yy_cp = 0, *tao_yy_bp = 0; + register int tao_yy_act; - if ( tao_yy_init ) - { - tao_yy_init = 0; + if ( tao_yy_init ) + { + tao_yy_init = 0; #ifdef TAO_YY_USER_INIT - 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; + if ( ! tao_yyin ) + tao_yyin = stdin; - if ( ! tao_yyout ) - tao_yyout = stdout; + 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_yy_current_buffer = + 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; + while ( 1 ) /* loops until end-of-file is reached */ + { + tao_yy_cp = tao_yy_c_buf_p; - /* Support of tao_yytext. */ - *tao_yy_cp = tao_yy_hold_char; + /* Support of tao_yytext. */ + *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_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_AT_BOL(); + tao_yy_current_state = tao_yy_start; + tao_yy_current_state += TAO_YY_AT_BOL(); tao_yy_match: - do - { - 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; - } - while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) - { - tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; - if ( tao_yy_current_state >= 549 ) - tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; - } - 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] != 1038 ); + do + { + 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; + } + while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) + { + tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; + if ( tao_yy_current_state >= 549 ) + tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; + } + 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] != 1038 ); 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_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; + TAO_YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +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; - goto tao_yy_find_action; + 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; + goto tao_yy_find_action; case 1: TAO_YY_RULE_SETUP return IDL_ANY; - TAO_YY_BREAK + TAO_YY_BREAK case 2: TAO_YY_RULE_SETUP return IDL_OBJECT; - TAO_YY_BREAK + TAO_YY_BREAK case 3: TAO_YY_RULE_SETUP return IDL_MODULE; - TAO_YY_BREAK + TAO_YY_BREAK case 4: TAO_YY_RULE_SETUP return IDL_RAISES; - TAO_YY_BREAK + TAO_YY_BREAK case 5: TAO_YY_RULE_SETUP return IDL_READONLY; - TAO_YY_BREAK + TAO_YY_BREAK case 6: TAO_YY_RULE_SETUP return IDL_ATTRIBUTE; - TAO_YY_BREAK + TAO_YY_BREAK case 7: TAO_YY_RULE_SETUP return IDL_EXCEPTION; - TAO_YY_BREAK + TAO_YY_BREAK case 8: TAO_YY_RULE_SETUP return IDL_CONTEXT; - TAO_YY_BREAK + TAO_YY_BREAK case 9: TAO_YY_RULE_SETUP return IDL_INTERFACE; - TAO_YY_BREAK + TAO_YY_BREAK case 10: TAO_YY_RULE_SETUP return IDL_CONST; - TAO_YY_BREAK + TAO_YY_BREAK case 11: TAO_YY_RULE_SETUP return IDL_TYPEDEF; - TAO_YY_BREAK + TAO_YY_BREAK case 12: TAO_YY_RULE_SETUP return IDL_STRUCT; - TAO_YY_BREAK + TAO_YY_BREAK case 13: TAO_YY_RULE_SETUP return IDL_ENUM; - TAO_YY_BREAK + TAO_YY_BREAK case 14: TAO_YY_RULE_SETUP return IDL_STRING; - TAO_YY_BREAK + TAO_YY_BREAK case 15: TAO_YY_RULE_SETUP return IDL_WSTRING; - TAO_YY_BREAK + TAO_YY_BREAK case 16: TAO_YY_RULE_SETUP return IDL_SEQUENCE; - TAO_YY_BREAK + TAO_YY_BREAK case 17: TAO_YY_RULE_SETUP return IDL_UNION; - TAO_YY_BREAK + TAO_YY_BREAK case 18: TAO_YY_RULE_SETUP return IDL_FIXED; - TAO_YY_BREAK + TAO_YY_BREAK case 19: TAO_YY_RULE_SETUP return IDL_SWITCH; - TAO_YY_BREAK + TAO_YY_BREAK case 20: TAO_YY_RULE_SETUP return IDL_CASE; - TAO_YY_BREAK + TAO_YY_BREAK case 21: TAO_YY_RULE_SETUP return IDL_DEFAULT; - TAO_YY_BREAK + TAO_YY_BREAK case 22: TAO_YY_RULE_SETUP return IDL_FLOAT; - TAO_YY_BREAK + TAO_YY_BREAK case 23: TAO_YY_RULE_SETUP return IDL_DOUBLE; - TAO_YY_BREAK + TAO_YY_BREAK case 24: TAO_YY_RULE_SETUP return IDL_LONG; - TAO_YY_BREAK + TAO_YY_BREAK case 25: TAO_YY_RULE_SETUP return IDL_SHORT; - TAO_YY_BREAK + TAO_YY_BREAK case 26: TAO_YY_RULE_SETUP return IDL_UNSIGNED; - TAO_YY_BREAK + TAO_YY_BREAK case 27: TAO_YY_RULE_SETUP return IDL_CHAR; - TAO_YY_BREAK + TAO_YY_BREAK case 28: TAO_YY_RULE_SETUP return IDL_WCHAR; - TAO_YY_BREAK + TAO_YY_BREAK case 29: TAO_YY_RULE_SETUP return IDL_BOOLEAN; - TAO_YY_BREAK + TAO_YY_BREAK case 30: TAO_YY_RULE_SETUP return IDL_OCTET; - TAO_YY_BREAK + TAO_YY_BREAK case 31: TAO_YY_RULE_SETUP return IDL_VOID; - TAO_YY_BREAK + TAO_YY_BREAK case 32: TAO_YY_RULE_SETUP return IDL_NATIVE; - TAO_YY_BREAK + TAO_YY_BREAK case 33: TAO_YY_RULE_SETUP return IDL_LOCAL; - TAO_YY_BREAK + TAO_YY_BREAK case 34: TAO_YY_RULE_SETUP return IDL_ABSTRACT; - TAO_YY_BREAK + TAO_YY_BREAK case 35: TAO_YY_RULE_SETUP return IDL_CUSTOM; - TAO_YY_BREAK + TAO_YY_BREAK case 36: TAO_YY_RULE_SETUP return IDL_FACTORY; - TAO_YY_BREAK + TAO_YY_BREAK case 37: TAO_YY_RULE_SETUP return IDL_PRIVATE; - TAO_YY_BREAK + TAO_YY_BREAK case 38: TAO_YY_RULE_SETUP return IDL_PUBLIC; - TAO_YY_BREAK + TAO_YY_BREAK case 39: TAO_YY_RULE_SETUP return IDL_SUPPORTS; - TAO_YY_BREAK + TAO_YY_BREAK case 40: TAO_YY_RULE_SETUP return IDL_TRUNCATABLE; - TAO_YY_BREAK + TAO_YY_BREAK case 41: TAO_YY_RULE_SETUP return IDL_VALUETYPE; - TAO_YY_BREAK + TAO_YY_BREAK case 42: TAO_YY_RULE_SETUP return IDL_COMPONENT; - TAO_YY_BREAK + TAO_YY_BREAK case 43: TAO_YY_RULE_SETUP return IDL_CONSUMES; - TAO_YY_BREAK + TAO_YY_BREAK case 44: TAO_YY_RULE_SETUP return IDL_EMITS; - TAO_YY_BREAK + TAO_YY_BREAK case 45: TAO_YY_RULE_SETUP return IDL_EVENTTYPE; - TAO_YY_BREAK + TAO_YY_BREAK case 46: TAO_YY_RULE_SETUP return IDL_FINDER; - TAO_YY_BREAK + TAO_YY_BREAK case 47: TAO_YY_RULE_SETUP return IDL_GETRAISES; - TAO_YY_BREAK + TAO_YY_BREAK case 48: TAO_YY_RULE_SETUP return IDL_HOME; - TAO_YY_BREAK + TAO_YY_BREAK case 49: TAO_YY_RULE_SETUP return IDL_IMPORT; - TAO_YY_BREAK + TAO_YY_BREAK case 50: TAO_YY_RULE_SETUP return IDL_MULTIPLE; - TAO_YY_BREAK + TAO_YY_BREAK case 51: TAO_YY_RULE_SETUP return IDL_PRIMARYKEY; - TAO_YY_BREAK + TAO_YY_BREAK case 52: TAO_YY_RULE_SETUP return IDL_PROVIDES; - TAO_YY_BREAK + TAO_YY_BREAK case 53: TAO_YY_RULE_SETUP return IDL_PUBLISHES; - TAO_YY_BREAK + TAO_YY_BREAK case 54: TAO_YY_RULE_SETUP return IDL_SETRAISES; - TAO_YY_BREAK + TAO_YY_BREAK case 55: TAO_YY_RULE_SETUP return IDL_TYPEID; - TAO_YY_BREAK + TAO_YY_BREAK case 56: TAO_YY_RULE_SETUP return IDL_TYPEPREFIX; - TAO_YY_BREAK + TAO_YY_BREAK case 57: TAO_YY_RULE_SETUP return IDL_USES; - TAO_YY_BREAK + TAO_YY_BREAK case 58: TAO_YY_RULE_SETUP return IDL_MANAGES; - TAO_YY_BREAK + TAO_YY_BREAK case 59: TAO_YY_RULE_SETUP return IDL_TRUETOK; - TAO_YY_BREAK + TAO_YY_BREAK case 60: TAO_YY_RULE_SETUP return IDL_FALSETOK; - TAO_YY_BREAK + TAO_YY_BREAK case 61: TAO_YY_RULE_SETUP return IDL_INOUT; - TAO_YY_BREAK + TAO_YY_BREAK case 62: TAO_YY_RULE_SETUP return IDL_IN; - TAO_YY_BREAK + TAO_YY_BREAK case 63: TAO_YY_RULE_SETUP return IDL_OUT; - TAO_YY_BREAK + TAO_YY_BREAK case 64: TAO_YY_RULE_SETUP return IDL_ONEWAY; - TAO_YY_BREAK + TAO_YY_BREAK case 65: TAO_YY_RULE_SETUP return IDL_LEFT_SHIFT; - TAO_YY_BREAK + TAO_YY_BREAK case 66: TAO_YY_RULE_SETUP return IDL_RIGHT_SHIFT; - TAO_YY_BREAK + TAO_YY_BREAK case 67: TAO_YY_RULE_SETUP { - tao_yylval.strval = (char *) "::"; - return IDL_SCOPE_DELIMITOR; - } - TAO_YY_BREAK + tao_yylval.strval = (char *) "::"; + return IDL_SCOPE_DELIMITOR; + } + TAO_YY_BREAK case 68: TAO_YY_RULE_SETUP { @@ -1421,9 +1421,12 @@ TAO_YY_RULE_SETUP // regular expression is to handle EBCDIC, as well as ASCII. TAO_IDL_CPP_Keyword_Table cpp_key_tbl; - const TAO_IDL_CPP_Keyword_Entry *entry = - cpp_key_tbl.lookup (ace_tao_yytext, + const TAO_IDL_CPP_Keyword_Entry *entry = 0; + if (!idl_global->preserve_cpp_keywords()) + { + entry = cpp_key_tbl.lookup (ace_tao_yytext, ACE_OS::strlen (ace_tao_yytext)); + } if (entry) tao_yylval.strval = ACE_OS::strdup (entry->mapping_); else @@ -1431,534 +1434,534 @@ TAO_YY_RULE_SETUP return IDENTIFIER; } - TAO_YY_BREAK + TAO_YY_BREAK case 69: TAO_YY_RULE_SETUP { tao_yylval.dval = idl_atof(ace_tao_yytext); return IDL_FLOATING_PT_LITERAL; } - TAO_YY_BREAK + TAO_YY_BREAK case 70: TAO_YY_RULE_SETUP { tao_yylval.dval = idl_atof(ace_tao_yytext); return IDL_FLOATING_PT_LITERAL; } - TAO_YY_BREAK + TAO_YY_BREAK case 71: TAO_YY_RULE_SETUP { - tao_yylval.ival = idl_atoi(ace_tao_yytext, 10); - return IDL_INTEGER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.ival = idl_atoi(ace_tao_yytext, 10); + return IDL_INTEGER_LITERAL; + } + TAO_YY_BREAK case 72: TAO_YY_RULE_SETUP { - tao_yylval.uival = idl_atoui(ace_tao_yytext, 10); - return IDL_UINTEGER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.uival = idl_atoui(ace_tao_yytext, 10); + return IDL_UINTEGER_LITERAL; + } + TAO_YY_BREAK case 73: TAO_YY_RULE_SETUP { - tao_yylval.ival = idl_atoi(ace_tao_yytext, 16); - return IDL_INTEGER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.ival = idl_atoi(ace_tao_yytext, 16); + return IDL_INTEGER_LITERAL; + } + TAO_YY_BREAK case 74: TAO_YY_RULE_SETUP { tao_yylval.uival = idl_atoui(ace_tao_yytext, 16); - return IDL_UINTEGER_LITERAL; - } - TAO_YY_BREAK + return IDL_UINTEGER_LITERAL; + } + TAO_YY_BREAK case 75: TAO_YY_RULE_SETUP { - tao_yylval.ival = idl_atoi(ace_tao_yytext, 8); - return IDL_INTEGER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.ival = idl_atoi(ace_tao_yytext, 8); + return IDL_INTEGER_LITERAL; + } + TAO_YY_BREAK case 76: TAO_YY_RULE_SETUP { - tao_yylval.uival = idl_atoui(ace_tao_yytext, 8); - return IDL_UINTEGER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.uival = idl_atoui(ace_tao_yytext, 8); + return IDL_UINTEGER_LITERAL; + } + TAO_YY_BREAK case 77: TAO_YY_RULE_SETUP { - /* Skip the quotes */ - char *tmp = ace_tao_yytext; + /* Skip the quotes */ + char *tmp = ace_tao_yytext; #if defined (__SUNPRO_CC) - tmp[strlen (tmp) - 2] = '\0'; + tmp[strlen (tmp) - 2] = '\0'; #else - tmp[strlen (tmp) - 1] = '\0'; + tmp[strlen (tmp) - 1] = '\0'; #endif - ACE_NEW_RETURN (tao_yylval.sval, + ACE_NEW_RETURN (tao_yylval.sval, UTL_String (tmp + 1), IDL_STRING_LITERAL); - return IDL_STRING_LITERAL; - } - TAO_YY_BREAK + return IDL_STRING_LITERAL; + } + TAO_YY_BREAK case 78: TAO_YY_RULE_SETUP { - /* Skip the bookends */ - char *tmp = ACE_OS::strdup (ace_tao_yytext); - tmp[strlen (tmp) - 1] = '\0'; - tao_yylval.wsval = idl_wstring_escape_reader(tmp + 2); - return IDL_WSTRING_LITERAL; - } - TAO_YY_BREAK + /* Skip the bookends */ + char *tmp = ACE_OS::strdup (ace_tao_yytext); + tmp[strlen (tmp) - 1] = '\0'; + tao_yylval.wsval = idl_wstring_escape_reader(tmp + 2); + return IDL_WSTRING_LITERAL; + } + TAO_YY_BREAK case 79: TAO_YY_RULE_SETUP { - tao_yylval.cval = ace_tao_yytext [1]; - return IDL_CHARACTER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.cval = ace_tao_yytext [1]; + return IDL_CHARACTER_LITERAL; + } + TAO_YY_BREAK case 80: TAO_YY_RULE_SETUP { - // octal character constant - tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); - return IDL_CHARACTER_LITERAL; - } - TAO_YY_BREAK + // octal character constant + tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); + return IDL_CHARACTER_LITERAL; + } + TAO_YY_BREAK case 81: TAO_YY_RULE_SETUP { - // hexadecimal character constant - tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); - return IDL_CHARACTER_LITERAL; - } - TAO_YY_BREAK + // hexadecimal character constant + tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); + return IDL_CHARACTER_LITERAL; + } + TAO_YY_BREAK case 82: TAO_YY_RULE_SETUP { - tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); - return IDL_CHARACTER_LITERAL; - } - TAO_YY_BREAK + tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); + return IDL_CHARACTER_LITERAL; + } + TAO_YY_BREAK case 83: TAO_YY_RULE_SETUP { - // wide character constant - tao_yylval.wcval = ace_tao_yytext [2]; - return IDL_WCHAR_LITERAL; - } - TAO_YY_BREAK + // wide character constant + tao_yylval.wcval = ace_tao_yytext [2]; + return IDL_WCHAR_LITERAL; + } + TAO_YY_BREAK case 84: TAO_YY_RULE_SETUP { - // hexadecimal wide character constant - tao_yylval.wcval = idl_wchar_escape_reader(ace_tao_yytext + 2); - return IDL_WCHAR_LITERAL; - } - TAO_YY_BREAK + // hexadecimal wide character constant + tao_yylval.wcval = idl_wchar_escape_reader(ace_tao_yytext + 2); + return IDL_WCHAR_LITERAL; + } + TAO_YY_BREAK case 85: case 86: TAO_YY_RULE_SETUP {/* remember pragma */ - idl_global->set_lineno(idl_global->lineno() + 1); - idl_store_pragma(ace_tao_yytext); - } + idl_global->set_lineno(idl_global->lineno() + 1); + idl_store_pragma(ace_tao_yytext); + } break; case 87: case 88: TAO_YY_RULE_SETUP {/* ignore file */ - idl_global->set_lineno(idl_global->lineno() + 1); - } - break; + idl_global->set_lineno(idl_global->lineno() + 1); + } + break; case 89: case 90: TAO_YY_RULE_SETUP { - idl_parse_line_and_file(ace_tao_yytext); - } - break; + idl_parse_line_and_file(ace_tao_yytext); + } + break; case 91: case 92: TAO_YY_RULE_SETUP { - idl_parse_line_and_file(ace_tao_yytext); - } - break; + idl_parse_line_and_file(ace_tao_yytext); + } + break; case 93: case 94: TAO_YY_RULE_SETUP { - idl_parse_line_and_file(ace_tao_yytext); - } - break; + idl_parse_line_and_file(ace_tao_yytext); + } + break; case 95: case 96: TAO_YY_RULE_SETUP { - idl_parse_line_and_file(ace_tao_yytext); - } - break; + idl_parse_line_and_file(ace_tao_yytext); + } + break; case 97: case 98: TAO_YY_RULE_SETUP { - /* ignore cpp ident */ - idl_global->set_lineno(idl_global->lineno() + 1); - } - break; + /* ignore cpp ident */ + idl_global->set_lineno(idl_global->lineno() + 1); + } + break; case 99: TAO_YY_RULE_SETUP { - /* ignore comments */ - idl_global->set_lineno(idl_global->lineno() + 1); - } + /* ignore comments */ + idl_global->set_lineno(idl_global->lineno() + 1); + } break; case 100: TAO_YY_RULE_SETUP { - for(;;) { - char c = tao_yyinput(); - if (c == '*') { - char next = tao_yyinput(); - if (next == '/') - break; - else - tao_yyunput(c, NULL); - if (c == '\n') - idl_global->set_lineno(idl_global->lineno() + 1); - } - } - } - break; + for(;;) { + char c = tao_yyinput(); + if (c == '*') { + char next = tao_yyinput(); + if (next == '/') + break; + else + tao_yyunput(c, NULL); + if (c == '\n') + idl_global->set_lineno(idl_global->lineno() + 1); + } + } + } + break; case 101: TAO_YY_RULE_SETUP ; - break; + break; case 102: TAO_YY_RULE_SETUP { - idl_global->set_lineno(idl_global->lineno() + 1); - } - break; + idl_global->set_lineno(idl_global->lineno() + 1); + } + break; case 103: TAO_YY_RULE_SETUP return ace_tao_yytext [0]; - break; + break; case 104: TAO_YY_RULE_SETUP TAO_YY_ECHO; - break; + break; case TAO_YY_STATE_EOF(INITIAL): - tao_yyterminate(); - - 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; - - /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */ - *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 ) - { - /* 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 - * 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; - } - - /* Note that here we test for tao_yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since tao_yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * 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] ) - { /* 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_current_state = tao_yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * tao_yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state ); - - 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_current_state = tao_yy_next_state; - goto tao_yy_match; - } - - else - { - tao_yy_cp = tao_yy_c_buf_p; - goto tao_yy_find_action; - } - } - - else switch ( tao_yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - tao_yy_did_buffer_switch_on_eof = 0; - - if ( tao_yywrap() ) - { - /* Note: because we've taken care in - * tao_yy_get_next_buffer() to have set up - * tao_yytext, we can now set up - * tao_yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * 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_act = TAO_YY_STATE_EOF(TAO_YY_START); - goto do_action; - } - - else - { - 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_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; - 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_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; - goto tao_yy_find_action; - } - break; - } - - default: - TAO_YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of tao_yylex */ + tao_yyterminate(); + + 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; + + /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */ + *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 ) + { + /* 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 + * 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; + } + + /* Note that here we test for tao_yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since tao_yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * 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] ) + { /* 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_current_state = tao_yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * tao_yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state ); + + 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_current_state = tao_yy_next_state; + goto tao_yy_match; + } + + else + { + tao_yy_cp = tao_yy_c_buf_p; + goto tao_yy_find_action; + } + } + + else switch ( tao_yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + tao_yy_did_buffer_switch_on_eof = 0; + + if ( tao_yywrap() ) + { + /* Note: because we've taken care in + * tao_yy_get_next_buffer() to have set up + * tao_yytext, we can now set up + * tao_yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * 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_act = TAO_YY_STATE_EOF(TAO_YY_START); + goto do_action; + } + + else + { + 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_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; + 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_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; + goto tao_yy_find_action; + } + break; + } + + default: + TAO_YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of tao_yylex */ /* tao_yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * 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; - 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] ) - TAO_YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( tao_yy_current_buffer->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 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* 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; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( tao_yy_current_buffer->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; - - else - { - int num_to_read = - tao_yy_current_buffer->tao_yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + { + register char *dest = tao_yy_current_buffer->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] ) + TAO_YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( tao_yy_current_buffer->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 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* 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; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( tao_yy_current_buffer->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; + + else + { + int num_to_read = + tao_yy_current_buffer->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( + 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; + /* just a shorter name for the 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_offset = + (int) (tao_yy_c_buf_p - b->tao_yy_ch_buf); - if ( b->tao_yy_is_our_buffer ) - { - int new_size = b->tao_yy_buf_size * 2; + if ( b->tao_yy_is_our_buffer ) + { + int new_size = b->tao_yy_buf_size * 2; - if ( new_size <= 0 ) - b->tao_yy_buf_size += b->tao_yy_buf_size / 8; - else - b->tao_yy_buf_size *= 2; + if ( new_size <= 0 ) + b->tao_yy_buf_size += b->tao_yy_buf_size / 8; + else + b->tao_yy_buf_size *= 2; - 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 ); - } - else - /* Can't grow it, we don't own it. */ - b->tao_yy_ch_buf = 0; + 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 ); + } + else + /* Can't grow it, we don't own it. */ + b->tao_yy_ch_buf = 0; - if ( ! b->tao_yy_ch_buf ) - TAO_YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + if ( ! b->tao_yy_ch_buf ) + 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 - - number_to_move - 1; + num_to_read = tao_yy_current_buffer->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; + 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 ); + /* 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_current_buffer->tao_yy_n_chars = tao_yy_n_chars; - } - - 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_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - tao_yy_current_buffer->tao_yy_buffer_status = - TAO_YY_BUFFER_EOF_PENDING; - } - } + 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 ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + tao_yy_current_buffer->tao_yy_buffer_status = + TAO_YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + 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->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_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0]; + tao_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0]; - return ret_val; - } + 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() - { - 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_AT_BOL(); - - 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; - } - while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) - { - tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; - if ( tao_yy_current_state >= 549 ) - tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; - } - tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c]; - } - - return tao_yy_current_state; - } + { + 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_AT_BOL(); + + 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; + } + while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) + { + tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; + if ( tao_yy_current_state >= 549 ) + tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; + } + tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c]; + } + + 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 ); + * next_state = tao_yy_try_NUL_trans( current_state ); */ #ifdef TAO_YY_USE_PROTOS @@ -1967,27 +1970,27 @@ static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_state_type tao_yy_current_ static tao_yy_state_type tao_yy_try_NUL_trans( tao_yy_current_state ) tao_yy_state_type tao_yy_current_state; #endif - { - register int tao_yy_is_jam; - 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; - } - while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) - { - tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; - if ( tao_yy_current_state >= 549 ) - tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; - } - tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c]; - tao_yy_is_jam = (tao_yy_current_state == 548); - - return tao_yy_is_jam ? 0 : tao_yy_current_state; - } + { + register int tao_yy_is_jam; + 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; + } + while ( tao_yy_chk[tao_yy_base[tao_yy_current_state] + tao_yy_c] != tao_yy_current_state ) + { + tao_yy_current_state = (int) tao_yy_def[tao_yy_current_state]; + if ( tao_yy_current_state >= 549 ) + tao_yy_c = tao_yy_meta[(unsigned int) tao_yy_c]; + } + tao_yy_current_state = tao_yy_nxt[tao_yy_base[tao_yy_current_state] + (unsigned int) tao_yy_c]; + tao_yy_is_jam = (tao_yy_current_state == 548); + + return tao_yy_is_jam ? 0 : tao_yy_current_state; + } #ifndef TAO_YY_NO_UNPUT @@ -1998,41 +2001,41 @@ 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; - - /* undo effects of setting up tao_yytext */ - *tao_yy_cp = tao_yy_hold_char; - - if ( tao_yy_cp < tao_yy_current_buffer->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 char *source = - &tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]; - - while ( source > tao_yy_current_buffer->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; - - if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 ) - TAO_YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + { + register char *tao_yy_cp = tao_yy_c_buf_p; + + /* undo effects of setting up tao_yytext */ + *tao_yy_cp = tao_yy_hold_char; + + if ( tao_yy_cp < tao_yy_current_buffer->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 char *source = + &tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]; + + while ( source > tao_yy_current_buffer->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; + + if ( tao_yy_cp < tao_yy_current_buffer->tao_yy_ch_buf + 2 ) + TAO_YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--tao_yy_cp = (char) c; + *--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; + } +#endif /* ifndef TAO_YY_NO_UNPUT */ #ifdef __cplusplus @@ -2040,73 +2043,73 @@ static int tao_yyinput() #else static int input() #endif - { - int c; - - *tao_yy_c_buf_p = tao_yy_hold_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] ) - /* This was really a NUL. */ - *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; - - switch ( tao_yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because tao_yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - tao_yyrestart( tao_yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( tao_yywrap() ) - return EOF; - - if ( ! tao_yy_did_buffer_switch_on_eof ) - TAO_YY_NEW_FILE; + { + int c; + + *tao_yy_c_buf_p = tao_yy_hold_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] ) + /* This was really a NUL. */ + *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; + + switch ( tao_yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because tao_yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + tao_yyrestart( tao_yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( tao_yywrap() ) + return EOF; + + if ( ! tao_yy_did_buffer_switch_on_eof ) + TAO_YY_NEW_FILE; #ifdef __cplusplus - return tao_yyinput(); + return tao_yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - tao_yy_c_buf_p = tao_yytext_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + 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->tao_yy_at_bol = (c == '\n'); - return c; - } + return c; + } #ifdef TAO_YY_USE_PROTOS @@ -2115,13 +2118,13 @@ void tao_yyrestart( FILE *input_file ) 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 ); + { + if ( ! tao_yy_current_buffer ) + tao_yy_current_buffer = 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(); - } + tao_yy_init_buffer( tao_yy_current_buffer, input_file ); + tao_yy_load_buffer_state(); + } #ifdef TAO_YY_USE_PROTOS @@ -2130,28 +2133,28 @@ void tao_yy_switch_to_buffer( TAO_YY_BUFFER_STATE new_buffer ) void tao_yy_switch_to_buffer( new_buffer ) TAO_YY_BUFFER_STATE new_buffer; #endif - { - if ( tao_yy_current_buffer == new_buffer ) - return; - - 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; - } + { + if ( tao_yy_current_buffer == new_buffer ) + return; + + 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_current_buffer = new_buffer; - tao_yy_load_buffer_state(); + tao_yy_current_buffer = 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; - } + /* 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 @@ -2159,12 +2162,12 @@ 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_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; + } #ifdef TAO_YY_USE_PROTOS @@ -2174,28 +2177,28 @@ TAO_YY_BUFFER_STATE tao_yy_create_buffer( file, size ) FILE *file; int size; #endif - { - TAO_YY_BUFFER_STATE b; + { + TAO_YY_BUFFER_STATE b; - b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) ); - if ( ! b ) - TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" ); + b = (TAO_YY_BUFFER_STATE) tao_yy_flex_alloc( sizeof( struct tao_yy_buffer_state ) ); + if ( ! b ) + TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" ); - b->tao_yy_buf_size = size; + b->tao_yy_buf_size = 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 ); - if ( ! b->tao_yy_ch_buf ) - TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_create_buffer()" ); + /* 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 ); + 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; + b->tao_yy_is_our_buffer = 1; - tao_yy_init_buffer( b, file ); + tao_yy_init_buffer( b, file ); - return b; - } + return b; + } #ifdef TAO_YY_USE_PROTOS @@ -2204,18 +2207,18 @@ void tao_yy_delete_buffer( TAO_YY_BUFFER_STATE b ) void tao_yy_delete_buffer( b ) TAO_YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - if ( b == tao_yy_current_buffer ) - tao_yy_current_buffer = (TAO_YY_BUFFER_STATE) 0; + if ( b == tao_yy_current_buffer ) + tao_yy_current_buffer = (TAO_YY_BUFFER_STATE) 0; - if ( b->tao_yy_is_our_buffer ) - tao_yy_flex_free( (void *) b->tao_yy_ch_buf ); + if ( b->tao_yy_is_our_buffer ) + tao_yy_flex_free( (void *) b->tao_yy_ch_buf ); - tao_yy_flex_free( (void *) b ); - } + tao_yy_flex_free( (void *) b ); + } #ifndef TAO_YY_ALWAYS_INTERACTIVE @@ -2233,22 +2236,22 @@ FILE *file; #endif - { - tao_yy_flush_buffer( b ); + { + tao_yy_flush_buffer( b ); - b->tao_yy_input_file = file; - b->tao_yy_fill_buffer = 1; + b->tao_yy_input_file = file; + b->tao_yy_fill_buffer = 1; #ifdef TAO_YY_ALWAYS_INTERACTIVE - b->tao_yy_is_interactive = 1; + b->tao_yy_is_interactive = 1; #else #ifdef TAO_YY_NEVER_INTERACTIVE - b->tao_yy_is_interactive = 0; + b->tao_yy_is_interactive = 0; #else - b->tao_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->tao_yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif - } + } #ifdef TAO_YY_USE_PROTOS @@ -2258,27 +2261,27 @@ void tao_yy_flush_buffer( b ) TAO_YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - b->tao_yy_n_chars = 0; + b->tao_yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->tao_yy_ch_buf[0] = TAO_YY_END_OF_BUFFER_CHAR; - b->tao_yy_ch_buf[1] = TAO_YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->tao_yy_ch_buf[0] = TAO_YY_END_OF_BUFFER_CHAR; + b->tao_yy_ch_buf[1] = TAO_YY_END_OF_BUFFER_CHAR; - b->tao_yy_buf_pos = &b->tao_yy_ch_buf[0]; + b->tao_yy_buf_pos = &b->tao_yy_ch_buf[0]; - b->tao_yy_at_bol = 1; - b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW; + 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(); + } #ifndef TAO_YY_NO_SCAN_BUFFER @@ -2289,33 +2292,33 @@ TAO_YY_BUFFER_STATE tao_yy_scan_buffer( base, size ) char *base; tao_yy_size_t size; #endif - { - TAO_YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != TAO_YY_END_OF_BUFFER_CHAR || - base[size-1] != TAO_YY_END_OF_BUFFER_CHAR ) - /* 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 ) ); - if ( ! b ) - TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_buffer()" ); - - b->tao_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->tao_yy_buf_pos = b->tao_yy_ch_buf = base; - b->tao_yy_is_our_buffer = 0; - b->tao_yy_input_file = 0; - b->tao_yy_n_chars = b->tao_yy_buf_size; - b->tao_yy_is_interactive = 0; - b->tao_yy_at_bol = 1; - b->tao_yy_fill_buffer = 0; - b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW; - - tao_yy_switch_to_buffer( b ); - - return b; - } + { + TAO_YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != TAO_YY_END_OF_BUFFER_CHAR || + base[size-1] != TAO_YY_END_OF_BUFFER_CHAR ) + /* 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 ) ); + if ( ! b ) + TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_buffer()" ); + + b->tao_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->tao_yy_buf_pos = b->tao_yy_ch_buf = base; + b->tao_yy_is_our_buffer = 0; + b->tao_yy_input_file = 0; + b->tao_yy_n_chars = b->tao_yy_buf_size; + b->tao_yy_is_interactive = 0; + b->tao_yy_at_bol = 1; + b->tao_yy_fill_buffer = 0; + b->tao_yy_buffer_status = TAO_YY_BUFFER_NEW; + + tao_yy_switch_to_buffer( b ); + + return b; + } #endif @@ -2326,13 +2329,13 @@ TAO_YY_BUFFER_STATE tao_yy_scan_string( tao_yyconst char *tao_yy_str ) 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 ) - ; + { + int len; + for ( len = 0; tao_yy_str[len]; ++len ) + ; - return tao_yy_scan_bytes( tao_yy_str, len ); - } + return tao_yy_scan_bytes( tao_yy_str, len ); + } #endif @@ -2344,34 +2347,34 @@ TAO_YY_BUFFER_STATE tao_yy_scan_bytes( bytes, len ) tao_yyconst char *bytes; int len; #endif - { - TAO_YY_BUFFER_STATE b; - char *buf; - tao_yy_size_t n; - int i; + { + 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 ); - if ( ! buf ) - TAO_YY_FATAL_ERROR( "out of dynamic memory in tao_yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) tao_yy_flex_alloc( 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 < len; ++i ) + buf[i] = bytes[i]; - buf[len] = buf[len+1] = TAO_YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = TAO_YY_END_OF_BUFFER_CHAR; - b = tao_yy_scan_buffer( buf, n ); - if ( ! b ) - TAO_YY_FATAL_ERROR( "bad buffer in tao_yy_scan_bytes()" ); + b = tao_yy_scan_buffer( buf, n ); + if ( ! b ) + TAO_YY_FATAL_ERROR( "bad buffer in tao_yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->tao_yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->tao_yy_is_our_buffer = 1; - return b; - } + return b; + } #endif @@ -2382,49 +2385,49 @@ static void tao_yy_push_state( int new_state ) 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; + { + if ( tao_yy_start_stack_ptr >= tao_yy_start_stack_depth ) + { + tao_yy_size_t new_size; - tao_yy_start_stack_depth += TAO_YY_START_STACK_INCR; - new_size = tao_yy_start_stack_depth * sizeof( int ); + tao_yy_start_stack_depth += TAO_YY_START_STACK_INCR; + new_size = tao_yy_start_stack_depth * sizeof( int ); - if ( ! tao_yy_start_stack ) - tao_yy_start_stack = (int *) tao_yy_flex_alloc( new_size ); + if ( ! tao_yy_start_stack ) + tao_yy_start_stack = (int *) tao_yy_flex_alloc( new_size ); - else - tao_yy_start_stack = (int *) tao_yy_flex_realloc( - (void *) tao_yy_start_stack, new_size ); + else + tao_yy_start_stack = (int *) tao_yy_flex_realloc( + (void *) tao_yy_start_stack, new_size ); - if ( ! tao_yy_start_stack ) - TAO_YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + if ( ! tao_yy_start_stack ) + TAO_YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } - tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START; + tao_yy_start_stack[tao_yy_start_stack_ptr++] = TAO_YY_START; - BEGIN(new_state); - } + BEGIN(new_state); + } #endif #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" ); + { + if ( --tao_yy_start_stack_ptr < 0 ) + TAO_YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(tao_yy_start_stack[tao_yy_start_stack_ptr]); - } + BEGIN(tao_yy_start_stack[tao_yy_start_stack_ptr]); + } #endif #ifndef TAO_YY_NO_TOP_STATE static int tao_yy_top_state() - { - return tao_yy_start_stack[tao_yy_start_stack_ptr - 1]; - } + { + return tao_yy_start_stack[tao_yy_start_stack_ptr - 1]; + } #endif #ifndef TAO_YY_EXIT_FAILURE @@ -2437,10 +2440,10 @@ static void tao_yy_fatal_error( tao_yyconst char msg[] ) static void tao_yy_fatal_error( msg ) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( TAO_YY_EXIT_FAILURE ); - } + { + (void) fprintf( stderr, "%s\n", msg ); + exit( TAO_YY_EXIT_FAILURE ); + } @@ -2448,16 +2451,16 @@ char msg[]; #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 ) + 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 ) /* Internal utility routines. */ @@ -2471,11 +2474,11 @@ char *s1; tao_yyconst char *s2; int n; #endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } #endif #ifdef TAO_YY_NEED_STRLEN @@ -2485,13 +2488,13 @@ static int tao_yy_flex_strlen( tao_yyconst char *s ) static int tao_yy_flex_strlen( s ) tao_yyconst char *s; #endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; + { + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; - } + return n; + } #endif @@ -2501,9 +2504,9 @@ static void *tao_yy_flex_alloc( tao_yy_size_t size ) static void *tao_yy_flex_alloc( size ) tao_yy_size_t size; #endif - { - return (void *) malloc( size ); - } + { + return (void *) malloc( size ); + } #ifdef TAO_YY_USE_PROTOS static void *tao_yy_flex_realloc( void *ptr, tao_yy_size_t size ) @@ -2512,16 +2515,16 @@ static void *tao_yy_flex_realloc( ptr, size ) void *ptr; tao_yy_size_t size; #endif - { - /* 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 - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, 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 + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } #ifdef TAO_YY_USE_PROTOS static void tao_yy_flex_free( void *ptr ) @@ -2529,19 +2532,19 @@ static void tao_yy_flex_free( void *ptr ) static void tao_yy_flex_free( ptr ) void *ptr; #endif - { - free( ptr ); - } + { + free( ptr ); + } #ifdef TAO_YY_MAIN int main() - { - tao_yylex(); - return 0; - } + { + tao_yylex(); + return 0; + } #endif - /* subroutines */ + /* subroutines */ // Parse a #line statement generated by the C preprocessor static void @@ -2621,10 +2624,10 @@ idl_parse_line_and_file (char *buf) { if (h[j] == '\\' && h[j + 1] == '\\') { - j++; + j++; } - h[i] = h[j]; + h[i] = h[j]; } h[i] = '\0'; @@ -2838,25 +2841,25 @@ idl_store_pragma (char *buf) static long idl_atoi(char *s, long b) { - long r = 0; - s++; - - if (b == 8 && *s == '0') - s++; - else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) - s += 2; - - for (; *s; s++) - if (*s <= '9' && *s >= '0') - r = (r * b) + (*s - '0'); - else if (b > 10 && *s <= 'f' && *s >= 'a') - r = (r * b) + (*s - 'a' + 10); - else if (b > 10 && *s <= 'F' && *s >= 'A') - r = (r * b) + (*s - 'A' + 10); - else - break; - - return -r; + long r = 0; + s++; + + if (b == 8 && *s == '0') + s++; + else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) + s += 2; + + for (; *s; s++) + if (*s <= '9' && *s >= '0') + r = (r * b) + (*s - '0'); + else if (b > 10 && *s <= 'f' && *s >= 'a') + r = (r * b) + (*s - 'a' + 10); + else if (b > 10 && *s <= 'F' && *s >= 'A') + r = (r * b) + (*s - 'A' + 10); + else + break; + + return -r; } /* @@ -2865,24 +2868,24 @@ idl_atoi(char *s, long b) static unsigned long idl_atoui(char *s, long b) { - long r = 0; - - if (b == 8 && *s == '0') - s++; - else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) - s += 2; - - for (; *s; s++) - if (*s <= '9' && *s >= '0') - r = (r * b) + (*s - '0'); - else if (b > 10 && *s <= 'f' && *s >= 'a') - r = (r * b) + (*s - 'a' + 10); - else if (b > 10 && *s <= 'F' && *s >= 'A') - r = (r * b) + (*s - 'A' + 10); - else - break; - - return r; + long r = 0; + + if (b == 8 && *s == '0') + s++; + else if (b == 16 && *s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) + s += 2; + + for (; *s; s++) + if (*s <= '9' && *s >= '0') + r = (r * b) + (*s - '0'); + else if (b > 10 && *s <= 'f' && *s >= 'a') + r = (r * b) + (*s - 'a' + 10); + else if (b > 10 && *s <= 'F' && *s >= 'A') + r = (r * b) + (*s - 'A' + 10); + else + break; + + return r; } /* @@ -2891,56 +2894,56 @@ idl_atoui(char *s, long b) static double idl_atof(char *s) { - char *h = s; - double d = 0.0; - double f = 0.0; - double e, k; - long neg = 0, negexp = 0; - - ACE_UNUSED_ARG (f); - ACE_UNUSED_ARG (h); - - if (*s == '-') { - neg = 1; - s++; - } - while (*s >= '0' && *s <= '9') { - d = (d * 10) + *s - '0'; - s++; - } - if (*s == '.') { - s++; - e = 10; - while (*s >= '0' && *s <= '9') { - d += (*s - '0') / (e * 1.0); - e *= 10; - s++; - } - } - if (*s == 'e' || *s == 'E') { - s++; - if (*s == '-') { - negexp = 1; - s++; - } else if (*s == '+') - s++; - e = 0; - while (*s >= '0' && *s <= '9') { - e = (e * 10) + *s - '0'; - s++; - } - if (e > 0) { - for (k = 1; e > 0; k *= 10, e--); - if (negexp) - d /= k; - else - d *= k; - } - } - - if (neg) d *= -1.0; - - return d; + char *h = s; + double d = 0.0; + double f = 0.0; + double e, k; + long neg = 0, negexp = 0; + + ACE_UNUSED_ARG (f); + ACE_UNUSED_ARG (h); + + if (*s == '-') { + neg = 1; + s++; + } + while (*s >= '0' && *s <= '9') { + d = (d * 10) + *s - '0'; + s++; + } + if (*s == '.') { + s++; + e = 10; + while (*s >= '0' && *s <= '9') { + d += (*s - '0') / (e * 1.0); + e *= 10; + s++; + } + } + if (*s == 'e' || *s == 'E') { + s++; + if (*s == '-') { + negexp = 1; + s++; + } else if (*s == '+') + s++; + e = 0; + while (*s >= '0' && *s <= '9') { + e = (e * 10) + *s - '0'; + s++; + } + if (e > 0) { + for (k = 1; e > 0; k *= 10, e--); + if (negexp) + d /= k; + else + d *= k; + } + } + + if (neg) d *= -1.0; + + return d; } /* @@ -2952,62 +2955,62 @@ idl_escape_reader( ) { if (str[0] != '\\') { - return str[0]; + return str[0]; } switch (str[1]) { case 'n': - return '\n'; + return '\n'; case 't': - return '\t'; + return '\t'; case 'v': - return '\v'; + return '\v'; case 'b': - return '\b'; + return '\b'; case 'r': - return '\r'; + return '\r'; case 'f': - return '\f'; + return '\f'; case 'a': - return '\a'; + return '\a'; case '\\': - return '\\'; + return '\\'; case '\?': - return '?'; + return '?'; case '\'': - return '\''; + return '\''; case '"': - return '"'; + return '"'; case 'x': - { - int i; - // hex value - for (i = 2; str[i] != '\0' && isxdigit(str[i]); i++) { - continue; - } - char save = str[i]; - str[i] = '\0'; - char out = (char)idl_atoui(&str[2], 16); - str[i] = save; - return out; - } - ACE_NOTREACHED (break;) + { + int i; + // hex value + for (i = 2; str[i] != '\0' && isxdigit(str[i]); i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoui(&str[2], 16); + str[i] = save; + return out; + } + ACE_NOTREACHED (break;) default: - // check for octal value - if (str[1] >= '0' && str[1] <= '7') { - int i; - for (i = 1; str[i] >= '0' && str[i] <= '7'; i++) { - continue; - } - char save = str[i]; - str[i] = '\0'; - char out = (char)idl_atoui(&str[1], 8); - str[i] = save; - return out; - } else { - return str[1] - 'a'; - } - ACE_NOTREACHED (break;) + // check for octal value + if (str[1] >= '0' && str[1] <= '7') { + int i; + for (i = 1; str[i] >= '0' && str[i] <= '7'; i++) { + continue; + } + char save = str[i]; + str[i] = '\0'; + char out = (char)idl_atoui(&str[1], 8); + str[i] = save; + return out; + } else { + return str[1] - 'a'; + } + ACE_NOTREACHED (break;) } } /* diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index ba6415556f3..52f6663ca45 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -1,3 +1,4 @@ + // $Id$ /* @@ -453,6 +454,17 @@ public: // strips off any command line -I prefix that may have been // prepended. + virtual idl_bool preserve_cpp_keywords (void); + // Whether we should not mung idl element names that are + // C++ keywords e.g. delete, operator etc. with _cxx_ prefix. + // Should be true when being used by the IFR Service + + virtual void preserve_cpp_keywords (idl_bool); + // Set whether we should not mung idl element names that are C++ + // keywords e.g. delete, operator etc. with _cxx_ prefix. + // Is set by the IFR Service. + + private: // Data UTL_ScopeStack pd_scopes; // Store scopes stack @@ -525,6 +537,9 @@ private: idl_bool repeat_include_; // Has this IDL file been included before? + + idl_bool preserve_cpp_keywords_; + // Do we allow C++ keywords as identifiers in the idl to stay as they are ? }; diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp index aed60c547db..68c4e011a38 100644 --- a/TAO/TAO_IDL/tao_idl.cpp +++ b/TAO/TAO_IDL/tao_idl.cpp @@ -192,6 +192,7 @@ DRV_init (void) idl_global->set_include_file_names (0); idl_global->set_n_include_file_names (0); idl_global->set_parse_state (IDL_GlobalData::PS_NoState); + idl_global->preserve_cpp_keywords(I_FALSE); // Put an empty prefix on the stack for the global scope. idl_global->pragma_prefixes ().push (ACE::strnew ("")); diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 61fd50ae561..8cc8d2ea5ce 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -117,7 +117,8 @@ IDL_GlobalData::IDL_GlobalData (void) obv_support_ (I_TRUE), case_diff_error_ (I_TRUE), nest_orb_ (I_FALSE), - idl_flags_ ("") + idl_flags_ (""), + preserve_cpp_keywords_ (I_TRUE) { // Path for the perfect hash generator(gperf) program. // Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined. @@ -1163,3 +1164,25 @@ IDL_GlobalData::stripped_preproc_include (const char *name) } } +/** + Whether we should not mung idl element names that are + C++ keywords e.g. delete, operator etc. with _cxx_ prefix. + Should be true when being used by the IFR Service + */ +idl_bool +IDL_GlobalData::preserve_cpp_keywords (void) +{ + return preserve_cpp_keywords_; +} + +/** + Set whether we should not mung idl element names that are C++ + keywords e.g. delete, operator etc. with _cxx_ prefix. + Is unset by the tao_idl compiler. + */ +void +IDL_GlobalData::preserve_cpp_keywords (idl_bool val) +{ + preserve_cpp_keywords_ = val; +} + diff --git a/TAO/orbsvcs/ImplRepo_Service/tao_imr_i.cpp b/TAO/orbsvcs/ImplRepo_Service/tao_imr_i.cpp index e5c237f1074..07481239519 100644 --- a/TAO/orbsvcs/ImplRepo_Service/tao_imr_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/tao_imr_i.cpp @@ -364,6 +364,13 @@ TAO_IMR_Op_Add::parse (int argc, ACE_TCHAR **argv) ACE_Get_Opt get_opts (argc, argv, "hc:w:a:e:l:"); this->server_name_ = argv[0]; + if (ACE_OS_String::strlen(this->server_name_.c_str()) < 1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Server name <%s> must be at least one character long!\n", + this->server_name_.c_str()),-1); + } + int c; while ((c = get_opts ()) != -1) diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp index 5324d8c3aef..66045c253a8 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp @@ -196,10 +196,11 @@ TAO_Naming_Server::parse_args (int argc, default: ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("usage: %s ") - ACE_LIB_TEXT ("-NScontextname <contextname> ") + ACE_LIB_TEXT ("-d ") ACE_LIB_TEXT ("-o <ior_output_file> ") ACE_LIB_TEXT ("-p <pid_file_name> ") ACE_LIB_TEXT ("-f <persistence_file_name> ") + ACE_LIB_TEXT ("-s <context_size> ") ACE_LIB_TEXT ("-b <base_address> ") ACE_LIB_TEXT ("-m <1=enable multicast, 0=disable multicast(default) ") ACE_LIB_TEXT ("-u <storable_persistence_directory (not used with -f)> ") diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client.dsp b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client.dsp new file mode 100644 index 00000000000..60d9b94fcef --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client.dsp @@ -0,0 +1,77 @@ +# Microsoft Developer Studio Project File - Name="Bug 1393 Client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug 1393 Client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1393_Client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1393_Client.mak" CFG="Bug 1393 Client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug 1393 Client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug 1393 Client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug 1393 Client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_IFR_Client.lib TAO.lib ACE.lib /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /nologo /version:1.2.8 /subsystem:console /machine:I386 /out:"client.exe"
+
+!ELSEIF "$(CFG)" == "Bug 1393 Client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_IFR_Clientd.lib TAOd.lib ACEd.lib /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /nologo /version:1.2.8 /subsystem:console /debug /machine:I386 /out:"client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug 1393 Client EXE - Win32 Release"
+# Name "Bug 1393 Client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client_Static.dsp b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client_Static.dsp new file mode 100644 index 00000000000..fd3661ac4dd --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Client_Static.dsp @@ -0,0 +1,77 @@ +# Microsoft Developer Studio Project File - Name="Bug 1393 Client Static EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug 1393 Client Static EXE - Win32 Static Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1393_Client_Static.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1393_Client_Static.mak" CFG="Bug 1393 Client Static EXE - Win32 Static Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug 1393 Client Static EXE - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug 1393 Client Static EXE - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug 1393 Client Static EXE - Win32 Static Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /D TAO_AS_STATIC_LIBS=1 /D ACE_AS_STATIC_LIBS=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_IFR_Clients.lib TAOs.lib ACEs.lib /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /nologo /version:1.2.8 /subsystem:console /machine:I386 /out:"client.exe"
+
+!ELSEIF "$(CFG)" == "Bug 1393 Client Static EXE - Win32 Static Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "..\..\.." /I "..\..\..\tao" /I "..\..\..\.." /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /D TAO_AS_STATIC_LIBS=1 /D ACE_AS_STATIC_LIBS=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "..\..\.." /i "..\..\..\tao" /i "..\..\..\.."
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_IFR_Clientsd.lib TAOsd.lib ACEsd.lib /libpath:"..\..\..\tao\IFR_Client" /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /nologo /version:1.2.8 /subsystem:console /debug /machine:I386 /out:"client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug 1393 Client Static EXE - Win32 Static Release"
+# Name "Bug 1393 Client Static EXE - Win32 Static Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Regression.dsw b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Regression.dsw new file mode 100644 index 00000000000..3e5b7718b6b --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Bug_1393_Regression.dsw @@ -0,0 +1,65 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Bug 1393 Client EXE"=Bug_1393_Client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name IFR_Client DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "Bug 1393 Client Static EXE"=Bug_1393_Client_Static.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name IFR_Client LIB
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao LIB
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE Static EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace LIB
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile new file mode 100644 index 00000000000..0a3b38d1722 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile @@ -0,0 +1,15 @@ +#---------------------------------------------------------------------------- +# GNU Workspace +#---------------------------------------------------------------------------- + +# $Id$ + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +TARGETS_NESTED := $(TARGETS_NESTED:.nested=) + +$(TARGETS_NESTED): +ifneq (Windows,$(findstring Windows,$(OS))) + @$(MAKE) -f Makefile.Bug_1393_Client -C . $(@); +else + -@cmd /c "$(MAKE) -f Makefile.Bug_1393_Client -C . $(@)" +endif diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.Bug_1393_Client.bor b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.Bug_1393_Client.bor new file mode 100644 index 00000000000..5e9cae01085 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.Bug_1393_Client.bor @@ -0,0 +1,39 @@ +# Makefile for building the client exe with Borland C++ Builder + +NAME = client + +OBJFILES = \ + $(OBJDIR)\client.obj + +EXTERNAL_LIBS = + +LFLAGS = \ + -L..\..\..\tao\IFR_Client\$(CONFIG_SUBDIR) -L..\..\..\tao\IFR_Client \ + -L..\..\..\tao\$(CONFIG_SUBDIR) -L..\..\..\tao \ + -L..\..\..\..\ace\$(CONFIG_SUBDIR) -L..\..\..\..\ace \ + -L$(CORE_BINDIR) + +LIBFILES = \ + TAO_IFR_Client$(LIB_DECORATOR).lib \ + TAO$(LIB_DECORATOR).lib \ + ACE$(LIB_DECORATOR).lib \ + $(EXTERNAL_LIBS) + +!ifdef STATIC +LIB_FLAGS = -DTAO_AS_STATIC_LIBS=1 -DACE_AS_STATIC_LIBS=1 +DLL_FLAGS = +!else +LIB_FLAGS = +DLL_FLAGS = +!endif + +CFLAGS = \ + -I..\..\.. \ + -I..\..\..\tao \ + -I..\..\..\.. \ + $(LIB_FLAGS) \ + $(DLL_FLAGS) + +CPPDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.bor b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.bor new file mode 100644 index 00000000000..e7328793734 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/Makefile.bor @@ -0,0 +1,20 @@ +#---------------------------------------------------------------------------- +# Borland Workspace +#---------------------------------------------------------------------------- + +!include <$(ACE_ROOT)\include\makeinclude\make_flags.bor> + +all: + $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f Makefile.Bug_1393_Client.bor all + +clean: + $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f Makefile.Bug_1393_Client.bor clean + +realclean: + $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f Makefile.Bug_1393_Client.bor realclean + +install: + $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f Makefile.Bug_1393_Client.bor install + +regenerate: + perl E:\worcvs\tao13\bin\mwc.pl -type bor diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/README b/TAO/orbsvcs/tests/Bug_1393_Regression/README new file mode 100644 index 00000000000..1f95f0d4850 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/README @@ -0,0 +1,3 @@ +This is the regression test for the fix to Bug #1393. + +sm@prismtechnologies.com diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/client.cpp b/TAO/orbsvcs/tests/Bug_1393_Regression/client.cpp new file mode 100644 index 00000000000..c3893239cb3 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/client.cpp @@ -0,0 +1,62 @@ +// $Id$ + +#include "tao/corba.h" +#include "tao/IFR_Client/IFR_BasicC.h" + +int main(int argc, char** argv) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb_ = CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var object = + orb_->resolve_initial_references ("InterfaceRepository" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Repository_var repo_ = CORBA::Repository::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + + CORBA::ContainedSeq_var interfaces = + repo_->contents ( CORBA::dk_Interface, // Any type of contained object. + 1 // Exclude parents of interfaces. + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::ULong length = interfaces->length (); + + if (length != 1) + { + ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Incorrect number of elements in IFR - length is %d\n", length)); + return -1; + } + + CORBA::ULong first_one = 0; + + CORBA::InterfaceDef_var the_interface = + CORBA::InterfaceDef::_narrow (interfaces[first_one].in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::String_var name = the_interface->name(); + + if (ACE_OS::strcmp (name.in(), "int")) + { + ACE_DEBUG ((LM_DEBUG, "CLIENT (%P): Interface name has been munged - it is now %s\n", + name.in())); + return -1; + } + + + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception ..."); + return -1; + } + ACE_ENDTRY; + return 0; +} diff --git a/TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl new file mode 100755 index 00000000000..bf135b3dcb9 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl @@ -0,0 +1,117 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- +# $Id$ + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +$status = 0; + +# The location of the IFR_Service binary +$ifr_service_bin = "../../IFR_Service"; + +# The location of the tao_ifr utility binary +if ($^O eq "MSWin32") +{ + $tao_ifr_bin = "../../../../bin"; +} +else +{ + $tao_ifr_bin = $ifr_service_bin; +} + +# The location of the tao_idl utility binary +$tao_idl_bin = "../../../../TAO/TAO_IDL"; + +# The idl file to be used for the test +$test_idl = PerlACE::LocalFile("test.idl"); + +# Create an idl file contaning an interface with a C++ reserved word name +open(HANDLE, ">$test_idl"); +print HANDLE <<_EOF_ +interface int +{ +}; +_EOF_ +; +close(HANDLE); + +$TAO_IDL = new PerlACE::Process("$tao_idl_bin/tao_idl"); +$TAO_IDL->Arguments("$test_idl"); +$result = $TAO_IDL->SpawnWaitKill (30); + +# Search one of the stub files for the munged for of the interface name +if ($result == 0) +{ + $result = 1; + open (HANDLE, "<testC.h"); + while (<HANDLE>) + { + if (/^class\s+_cxx_int/) + { + $result = 0; + last; + } + } + close(HANDLE); +} + +# Check result of idl compiler test +if ($result != 0) +{ + print STDERR "ERROR: Bug #1393 Idl compiler test failed\n"; + $status = 1; +} + +# Delete files created during IDL compilation +unlink <test*.h>; +unlink <test*.cpp>; +unlink <test*.i>; + +# The file name for the IFR service IOR +$ifr_service_ior_file = PerlACE::LocalFile("ifr.ior"); +unlink $ifr_service_ior_file; + +# Start the IFR service +$IFR_SERVICE = new PerlACE::Process("$ifr_service_bin/IFR_Service"); +$IFR_SERVICE->Arguments("-o $ifr_service_ior_file"); +$IFR_SERVICE->Spawn(); + +if (PerlACE::waitforfile_timed ($ifr_service_ior_file, 10) == -1) +{ + print STDERR "ERROR: cannot find $ifr_service_ior_file\n"; + $IFR_SERVICE->Kill (); + $status = 1; +} + +# Use the iao_ifr utility to add our test IDL +$TAO_IFR = new PerlACE::Process("$tao_ifr_bin/tao_ifr"); +$TAO_IFR->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_service_ior_file $test_idl"); +$result = $TAO_IFR->SpawnWaitKill (30); + +if ($result != 0) +{ + print STDERR "ERROR: Failed to add IDL to interface repository\n"; + $status = 1; +} + +# Invoke the client code that retrieves the interface and checks it's not munged +$CLIENT = new PerlACE::Process("client"); +$CLIENT->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_service_ior_file"); +$result = $CLIENT->SpawnWaitKill (30); + +if ($result != 0) +{ + print STDERR "ERROR: Interface definition incorrect in IFR\n"; + $status = 1; +} + +# Tidy up +$IFR_SERVICE->TerminateWaitKill (10); +unlink $test_idl; +unlink $ifr_service_ior_file; + +exit $status; diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Client.dsp b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Client.dsp new file mode 100644 index 00000000000..6ea962aec52 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Client.dsp @@ -0,0 +1,180 @@ +# Microsoft Developer Studio Project File - Name="Bug 1395 Client EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug 1395 Client EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1395_Client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1395_Client.mak" CFG="Bug 1395 Client EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug 1395 Client EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug 1395 Client EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug 1395 Client EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "$(TAO_ROOT)" /I "$(TAO_ROOT)\tao" /I "$(ACE_ROOT)" /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "$(TAO_ROOT)" /i "$(TAO_ROOT)\tao" /i "$(ACE_ROOT)"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO.lib ACE.lib /libpath:"$(TAO_ROOT)\tao" /libpath:"$(ACE_ROOT)\ace" /nologo /version:1.2.8 /subsystem:console /machine:I386 /out:"client.exe"
+
+!ELSEIF "$(CFG)" == "Bug 1395 Client EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "$(TAO_ROOT)" /I "$(TAO_ROOT)\tao" /I "$(ACE_ROOT)" /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "$(TAO_ROOT)" /i "$(TAO_ROOT)\tao" /i "$(ACE_ROOT)"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAOd.lib ACEd.lib /libpath:"$(TAO_ROOT)\tao" /libpath:"$(ACE_ROOT)\ace" /nologo /version:1.2.8 /subsystem:console /debug /machine:I386 /out:"client.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug 1395 Client EXE - Win32 Release"
+# Name "Bug 1395 Client EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\TestC.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\TestC.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\Test.idl
+
+!IF "$(CFG)" == "Bug 1395 Client EXE - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\Test.idl
+InputName=Test
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ $(ACE_ROOT)\bin\tao_idl -o $(OutDir) -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Bug 1395 Client EXE - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\Test.idl
+InputName=Test
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ $(ACE_ROOT)\bin\tao_idl -o $(OutDir) -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Regression.dsw b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Regression.dsw new file mode 100644 index 00000000000..b19744e82d5 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Regression.dsw @@ -0,0 +1,107 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Bug 1395 Server EXE"=Bug_1395_Server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name PortableServer DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "Bug 1395 Server Static EXE"=Bug_1395_Server_Static.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name PortableServer LIB
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name tao LIB
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE Static EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace LIB
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "Bug 1395 Client EXE"=Bug_1395_Client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name tao DLL
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace DLL
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "Bug 1395 Client Static EXE"=Bug_1395_Client_Static.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name tao LIB
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name TAO_IDL_EXE Static EXE
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name ace LIB
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Server.dsp b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Server.dsp new file mode 100644 index 00000000000..e444bd30c18 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Bug_1395_Server.dsp @@ -0,0 +1,200 @@ +# Microsoft Developer Studio Project File - Name="Bug 1395 Server EXE" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug 1395 Server EXE - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE run the tool that generated this project file and specify the
+!MESSAGE nmake output type. You can then use the following command:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1395_Server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Bug_1395_Server.mak" CFG="Bug 1395 Server EXE - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug 1395 Server EXE - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug 1395 Server EXE - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug 1395 Server EXE - Win32 Release"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /GX /O2 /MD /GR /I "$(TAO_ROOT)" /I "$(TAO_ROOT)\tao" /I "$(ACE_ROOT)" /D NDEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d NDEBUG=1 /i "$(TAO_ROOT)" /i "$(TAO_ROOT)\tao" /i "$(ACE_ROOT)"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_PortableServer.lib TAO.lib ACE.lib /libpath:"$(TAO_ROOT)\tao\PortableServer" /libpath:"$(TAO_ROOT)\tao" /libpath:"$(ACE_ROOT)\ace" /nologo /version:1.2.8 /subsystem:console /machine:I386 /out:"server.exe"
+
+!ELSEIF "$(CFG)" == "Bug 1395 Server EXE - Win32 Debug"
+
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /MDd /GR /Gy /I "$(TAO_ROOT)" /I "$(TAO_ROOT)\tao" /I "$(ACE_ROOT)" /D _DEBUG=1 /D WIN32=1 /D _CONSOLE=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD RSC /l 0x409 /d _DEBUG=1 /i "$(TAO_ROOT)" /i "$(TAO_ROOT)\tao" /i "$(ACE_ROOT)"
+BSC32=bscmake.exe
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD LINK32 advapi32.lib user32.lib /INCREMENTAL:NO TAO_PortableServerd.lib TAOd.lib ACEd.lib /libpath:"$(TAO_ROOT)\tao\PortableServer" /libpath:"$(TAO_ROOT)\tao" /libpath:"$(ACE_ROOT)\ace" /nologo /version:1.2.8 /subsystem:console /debug /machine:I386 /out:"server.exe"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug 1395 Server EXE - Win32 Release"
+# Name "Bug 1395 Server EXE - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;cxx;c"
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test_i.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hh"
+# Begin Source File
+
+SOURCE=.\Test_i.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i;inl"
+# Begin Source File
+
+SOURCE=.\TestC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\TestS.i
+# End Source File
+# End Group
+# Begin Group "Documentation"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\README
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\Test.idl
+
+!IF "$(CFG)" == "Bug 1395 Server EXE - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\Test.idl
+InputName=Test
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ $(ACE_ROOT)\bin\tao_idl -o $(OutDir) -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Bug 1395 Server EXE - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+# Begin Custom Build - Invoking TAO_IDL Compiler on $(InputPath)
+InputPath=.\Test.idl
+InputName=Test
+InputDir=.
+OutDir=.
+
+BuildCmds= \
+ $(ACE_ROOT)\bin\tao_idl -o $(OutDir) -Ge 1 -Sc $(InputPath)
+
+"$(OutDir)\$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile new file mode 100644 index 00000000000..6abffaea28d --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile @@ -0,0 +1,21 @@ +#---------------------------------------------------------------------------- +# GNU Workspace +#---------------------------------------------------------------------------- + +# $Id$ + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +TARGETS_NESTED := $(TARGETS_NESTED:.nested=) +MFILES = \ + Makefile.Bug_1395_Server \ + Makefile.Bug_1395_Client + +$(TARGETS_NESTED): +ifneq (Windows,$(findstring Windows,$(OS))) + @for file in $(MFILES); do \ + $(MAKE) -f `basename $$file` -C `dirname $$file` $(@); \ + done +else + -@cmd /c "$(MAKE) -f Makefile.Bug_1395_Server -C . $(@)" + -@cmd /c "$(MAKE) -f Makefile.Bug_1395_Client -C . $(@)" +endif diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Client b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Client new file mode 100644 index 00000000000..b6bc2f49e0e --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Client @@ -0,0 +1,71 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.Bug_1395_Client +DEPENDENCY_FILE = .depend.Makefile.Bug_1395_Client +BIN_UNCHECKED = client + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +IDL_FILES = Test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + + + +FILES = \ + TestC \ + client + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) +ACELIB = -lACE + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao -I$(ACE_ROOT) +ifeq ($(static_libs),1) +ifneq ($(LIB),) +CPPFLAGS += -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS +endif +endif + + +LDFLAGS += -L$(TAO_ROOT)/tao -L$(ACE_ROOT)/ace +TAO_IDLFLAGS += -Ge 1 -Sc + +LDLIBS = -lTAO + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +ADDITIONAL_IDL_TARGETS = + +# IDL File Directory: . + +idl_stubs: $(ADDITIONAL_IDL_TARGETS) + +all: idl_stubs + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Server b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Server new file mode 100644 index 00000000000..04468641d1f --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Makefile.Bug_1395_Server @@ -0,0 +1,73 @@ +#---------------------------------------------------------------------------- +# GNU Makefile +#---------------------------------------------------------------------------- +MAKEFILE = Makefile.Bug_1395_Server +DEPENDENCY_FILE = .depend.Makefile.Bug_1395_Server +BIN_UNCHECKED = server + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +IDL_FILES = Test +IDL_SRC = $(foreach ext, C.cpp S.cpp, $(foreach file, $(IDL_FILES), $(file)$(ext))) + + + +FILES = \ + TestC \ + TestS \ + Test_i \ + server + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +BIN = $(BIN_UNCHECKED) + +OBJS = $(addsuffix .o, $(notdir $(FILES))) +SRC = $(addsuffix .cpp, $(FILES)) +ACELIB = -lACE + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao -I$(ACE_ROOT) +ifeq ($(static_libs),1) +ifneq ($(LIB),) +CPPFLAGS += -DTAO_AS_STATIC_LIBS -DACE_AS_STATIC_LIBS +endif +endif + + +LDFLAGS += -L$(TAO_ROOT)/tao/PortableServer -L$(TAO_ROOT)/tao -L$(ACE_ROOT)/ace +TAO_IDLFLAGS += -Ge 1 -Sc + +LDLIBS = -lTAO_PortableServer -lTAO + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +ADDITIONAL_IDL_TARGETS = + +# IDL File Directory: . + +idl_stubs: $(ADDITIONAL_IDL_TARGETS) + +all: idl_stubs + +.PRECIOUS: $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + +$(BIN): $(addprefix $(VDIR), $(OBJS)) + $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $^ $(VLDLIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) + diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/README b/TAO/orbsvcs/tests/Bug_1395_Regression/README new file mode 100644 index 00000000000..d1f531018e3 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/README @@ -0,0 +1,3 @@ +This test contains regression tests for fixes to bugs #1394 and #1395. + +See the bugzilla records for these bugs for details.
\ No newline at end of file diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Test.idl b/TAO/orbsvcs/tests/Bug_1395_Regression/Test.idl new file mode 100644 index 00000000000..fff2e17959a --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Test.idl @@ -0,0 +1,7 @@ +// $Id$ + +interface Test +{ + long try_and_create_POA (); + void shutdown(); +}; diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.cpp b/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.cpp new file mode 100644 index 00000000000..f0632bf38d2 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.cpp @@ -0,0 +1,46 @@ +// $Id$ + +#include "Test_i.h" + +Test_i::Test_i(CORBA::ORB_ptr orb) : + orb_(CORBA::ORB::_duplicate(orb)), + policies_(1) +{ + CORBA::Object_var obj = orb_->resolve_initial_references("RootPOA"); + root_poa_ = PortableServer::POA::_narrow(obj.in()); + policies_.length(1); + policies_[0] = root_poa_->create_lifespan_policy(PortableServer::PERSISTENT); + poa_mgr_ = root_poa_->the_POAManager(); +} + +Test_i::~Test_i() +{ + policies_[0]->destroy(); +} + +int +Test_i::try_and_create_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_TRY + { + PortableServer::POA_var persistent_poa = + root_poa_->create_POA( "MyPoa", poa_mgr_.in(), policies_); + ACE_TRY_CHECK; + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "try_and_create_POA Exception ..."); + return 1; + } + ACE_ENDTRY; +} + +void +Test_i::shutdown(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.h b/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.h new file mode 100644 index 00000000000..a5d3bf02f6c --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/Test_i.h @@ -0,0 +1,35 @@ +// -*- C++ -*- +// $Id$ + +#if !defined BUG_1395_REGRESSION_TEST_I_H + #define BUG_1395_REGRESSION_TEST_I_H + +#include "tao/corba.h" +#include "tao/PortableServer/PortableServer.h" + +#include "TestS.h" + +class Test_i: public POA_Test +{ +public: + /// Constructor + Test_i (CORBA::ORB_ptr orb); + + /// Destructor + ~Test_i (void); + + /// Try and create a persistant POA + int try_and_create_POA (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((CORBA::SystemException)); + +protected: + CORBA::ORB_var orb_; + PortableServer::POA_var root_poa_; + PortableServer::POAManager_var poa_mgr_; + CORBA::PolicyList policies_; +}; + +#endif /* ! BUG_1395_REGRESSION_TEST_I_H */ diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/client.cpp b/TAO/orbsvcs/tests/Bug_1395_Regression/client.cpp new file mode 100644 index 00000000000..69909f4e3d5 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/client.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include "TestC.h" +#include "ace/Get_Opt.h" + +const char *ior = "file://test.ior"; +int shutdown_server = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "k:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.opt_arg (); + break; + case 's': + shutdown_server = 1; + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k <ior> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + int result = 0; + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + CORBA::Object_var tmp = + orb->string_to_object(ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + Test_var server = + Test::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (server.in ())) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "Nil Test::Server reference <%s>\n", + ior), + 1); + } + + if (shutdown_server) + { + server->shutdown(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + result = server->try_and_create_POA(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + result =1; + } + ACE_ENDTRY; + + return result; +} diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl new file mode 100755 index 00000000000..26d9a6aed1c --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/run_test.pl @@ -0,0 +1,187 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- +# $Id$ + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +# The location of the implementation repository binaries +$imr_bin_path = "../../ImplRepo_Service"; + +# The location of the tao_imr IMR utility +if ($^O eq "MSWin32") +{ + $tao_imr_bin_path = "../../../../bin"; +} +else +{ + $tao_imr_bin_path = $imr_bin_path; +} + +# IOR file names +$imr_ior_file = PerlACE::LocalFile("impl.ior"); +$activator_ior_file = PerlACE::LocalFile("activator.ior"); +$server_ior_file = PerlACE::LocalFile("server.ior"); + +# The players in our little drama. +$LOCATOR = new PerlACE::Process("$imr_bin_path/ImplRepo_Service"); +$ACTIVATOR = new PerlACE::Process("$imr_bin_path/ImR_Activator"); +$SERVER = new PerlACE::Process(PerlACE::LocalFile("server")); +$CLIENT = new PerlACE::Process(PerlACE::LocalFile("client")); +$TAO_IMR = new PerlACE::Process("$tao_imr_bin_path/tao_imr"); + +# Run the IMR locator on a fixed port +$port = PerlACE::uniqueid () + 10001; # This can't be 10000 for Chorus 4.0 + +sub test_body +{ + unlink $imr_ior_file; + unlink $activator_ior_file; + unlink $server_ior_file; + + # Start the IMR locator to generate an IOR file for the server to use... + $LOCATOR->Arguments("-o $imr_ior_file -ORBEndpoint iiop://:$port"); + $LOCATOR->Spawn (); + + if (PerlACE::waitforfile_timed ($imr_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $imr_ior_file\n"; + $LOCATOR->Kill (); + return 1; + } + + # ...then shut it down so that the server will not be able to contact it + $LOCATOR->TerminateWaitKill (5); + + if ($imr_locator != 0) + { + print STDERR "ERROR: IMR returned $imr_locator\n"; + $status = 1; + } + + # Start our server + $SERVER->Arguments("-o $server_ior_file -ORBInitRef ImplRepoService=file://$imr_ior_file -ORBUseIMR 1"); + $SERVER->Spawn (); + + if (PerlACE::waitforfile_timed ($server_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $server_ior_file\n"; + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + $SERVER->Kill (); + return 1; + } + + # Use the client to ask the server to try and create a persitent POA + # We expect this to 'fail' as the IMR is dead + $CLIENT->Arguments("-k file://$server_ior_file"); + $result = $CLIENT->SpawnWaitKill (30); + + if ($result == 0) + { + print STDERR "ERROR: First create POA attempt succeeded when it shouldn't have done\n"; + $SERVER->Kill (); + return 1; + } + + # Now we restart the IMR locator + unlink $imr_ior_file; + $LOCATOR->Arguments("-o $imr_ior_file -ORBEndpoint iiop://:$port"); + $LOCATOR->Spawn (); + + if (PerlACE::waitforfile_timed ($imr_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $imr_ior_file\n"; + $LOCATOR->Kill (); + return 1; + } + + # Work out the IMR activator command line. + # Use the '-a' switch if this is a regression for bug #1394, else not + if ($use_tao_imr_util != 0) + { + $activator_arguments = "-o $activator_ior_file -ORBInitRef ImplRepoService=file://$imr_ior_file"; + } + else + { + $activator_arguments = "-o $activator_ior_file -a -ORBInitRef ImplRepoService=file://$imr_ior_file"; + } + + # Start up the activator + $ACTIVATOR->Arguments ($activator_arguments); + $ACTIVATOR->Spawn (); + + if (PerlACE::waitforfile_timed ($activator_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $activator_ior_file\n"; + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + return 1; + } + + # If this is just a regression for bug #1395 we need to register the POA + # If it is a regression for enhancement bug #1394, we don't need to. + if ($use_tao_imr_util != 0) + { + # Add the persistent POA name to the IMR + $TAO_IMR->Arguments("add MyPoa -ORBInitRef ImplRepoService=file://$imr_ior_file"); + $result = $TAO_IMR->SpawnWaitKill (30); + + if ($result != 0) + { + print STDERR "ERROR: tao_imr returned $result\n"; + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + return 1; + } + } + + # Use the client to tell the server to attempt to create the POA again + $CLIENT->Arguments("-k file://$server_ior_file"); + $result = $CLIENT->SpawnWaitKill (30); + + if ($result != 0) + { + print STDERR "ERROR: Second create POA attempt failed when it should have succeeded\n"; + $SERVER->Kill (); + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + return 1; + } + + # Tidy up + $SERVER->TerminateWaitKill (5); + $ACTIVATOR->TerminateWaitKill (5); + $LOCATOR->TerminateWaitKill (5); + return 0; +} + +# Run regression for bug #1395 +$use_tao_imr_util = 1; +$test_result = test_body(); +if ($test_result != 0) +{ + print STDERR "ERROR: Regression test for Bug #1395 failed\n"; + unlink $imr_ior_file; + unlink $activator_ior_file; + unlink $server_ior_file; + exit $test_result; +} + +# Bug 1394 is an enhancement so will not be submitted until after TAO1.3.1 +# Uncomment the following to activate regression after submission and .. +# Run regression for bug #1394 +#$use_tao_imr_util = 0; +#$test_result = test_body(); +#if ($test_result != 0) +#{ +# print STDERR "ERROR: Regression test for Bug #1394 failed\n"; +#} + +unlink $imr_ior_file; +unlink $activator_ior_file; +unlink $server_ior_file; +exit $test_result; diff --git a/TAO/orbsvcs/tests/Bug_1395_Regression/server.cpp b/TAO/orbsvcs/tests/Bug_1395_Regression/server.cpp new file mode 100644 index 00000000000..9ba773b9a3d --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1395_Regression/server.cpp @@ -0,0 +1,119 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "Test_i.h" + +const char *ior_output_file = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "o:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'o': + ior_output_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "SERVER (%P): usage: %s " + "-o <iorfile>" + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +main (int argc, char *argv[]) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var poa_object = + orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + "SERVER (%P): Unable to initialize the POA.\n"), + 1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (parse_args (argc, argv) != 0) + return 1; + + Test_i server_impl (orb.in ()); + + root_poa->activate_object (&server_impl + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + + CORBA::Object_var server = server_impl._this(); + ACE_TRY_CHECK; + + CORBA::String_var ior = + orb->object_to_string (server.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // If the ior_output_file exists, output the ior to it + if (ior_output_file != 0) + { + FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); + if (output_file == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "SERVER (%P): Cannot open output file " + "for writing IOR: %s", + ior_output_file), + 1); + ACE_OS::fprintf (output_file, "%s", ior.in ()); + ACE_OS::fclose (output_file); + + ACE_DEBUG ((LM_DEBUG, + "SERVER (%P): Activated as file://%s\n", + ior_output_file)); + } + else + { + ACE_DEBUG ((LM_DEBUG, + "SERVER (%P): Activated as <%s>\n", + ior.in ())); + } + + poa_manager->activate(); + + orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + root_poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "SERVER (%P): Caught exception:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/orbsvcs/tests/Bug_1436_Regression/README b/TAO/orbsvcs/tests/Bug_1436_Regression/README new file mode 100644 index 00000000000..c0dbdd71810 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1436_Regression/README @@ -0,0 +1,5 @@ +This test contains regression tests for fixes to bugs #1436 + +See the bugzilla records for these bugs for details. + +gv@prismtechnologies.com diff --git a/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl new file mode 100755 index 00000000000..946d75e1d5b --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl @@ -0,0 +1,89 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- +# $Id$ + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +# The location of the implementation repository binaries +$ifr_bin_path = "../../IFR_Service"; + +# The location of the tao_ifr IFR utility +if ($^O eq "MSWin32") +{ + $tao_ifr_bin_path = "../../../../bin"; +} +else +{ + $tao_ifr_bin_path = $ifr_bin_path; +} + +# IOR file names +$ifr_ior_file = PerlACE::LocalFile("ifr.ior"); + +# IDL File +$idl_file = PerlACE::LocalFile("test.idl"); + +#Log file +$result_file = PerlACE::LocalFile("test_result.log"); + +$IFRSERVICE = new PerlACE::Process("$ifr_bin_path/IFR_Service"); +$TAO_IFR = new PerlACE::Process("$tao_ifr_bin_path/tao_ifr"); + +sub test_body +{ + unlink $ifr_ior_file; + + # Start the IFR Service to generate an IOR file for the tao_ifr to use... + $IFRSERVICE->Arguments("-o $ifr_ior_file "); + $IFRSERVICE->Spawn (); + + if (PerlACE::waitforfile_timed ($ifr_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $ifr_ior_file\n"; + $IFRSERVICE->Kill (); + return 1; + } + + $TAO_IFR->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_ior_file -Cw $idl_file &> $result_file"); + $TAO_IFR->Spawn (); + + if (PerlACE::waitforfile_timed ($result_file, 10) == -1) + { + print STDERR "ERROR: cannot find $result_file\n"; + $IFRSERVICE->Kill (); + $TAO_IFR->Kill (); + return 1; + } + + $match = 0; + open (FILE, $result_file) or return -1; + while (<FILE>) { + $match = /Warning - identifier spellings differ only in case:/; + last if $match; + } + close FILE; + # Tidy up + $IFRSERVICE->TerminateWaitKill (5); + $TAO_IFR->TerminateWaitKill (5); + return $match ? 0 : -1; +} + +# Run regression for bug #1436 +$test_result = test_body(); + +if ($test_result != 0) +{ + print STDERR "ERROR: Regression test for Bug #1436 failed\n"; +} +else +{ + print "Regression test for Bug #1436 passed.\n"; +} + +unlink $ifr_ior_file; +unlink $result_file; +exit $test_result; diff --git a/TAO/orbsvcs/tests/Bug_1436_Regression/test.idl b/TAO/orbsvcs/tests/Bug_1436_Regression/test.idl new file mode 100644 index 00000000000..28796f76c3c --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1436_Regression/test.idl @@ -0,0 +1,7 @@ +// $Id$ + +interface test +{ + void testme (); + void TESTME (); +}; diff --git a/TAO/orbsvcs/tests/Bug_1437_Regression/README b/TAO/orbsvcs/tests/Bug_1437_Regression/README new file mode 100644 index 00000000000..69f8256d38c --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1437_Regression/README @@ -0,0 +1,5 @@ +This is the regression test for Bug #1437 + +Please see Bug Tracker for details on this test. + +gv@prismtechnologies.com diff --git a/TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl new file mode 100755 index 00000000000..59ccd2b87a4 --- /dev/null +++ b/TAO/orbsvcs/tests/Bug_1437_Regression/run_test.pl @@ -0,0 +1,112 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- +# $Id$ + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +# The location of the implementation repository binaries +$imr_bin_path = "../../ImplRepo_Service"; + +# The location of the tao_imr IMR utility +if ($^O eq "MSWin32") +{ + $tao_imr_bin_path = "../../../../bin"; +} +else +{ + $tao_imr_bin_path = $imr_bin_path; +} + +# IOR file names +$imr_ior_file = PerlACE::LocalFile("impl.ior"); +$activator_ior_file = PerlACE::LocalFile("activator.ior"); + +# Log file +$log_file = PerlACE::LocalFile("test_result.log"); + +# The players in our little drama. +$LOCATOR = new PerlACE::Process("$imr_bin_path/ImplRepo_Service"); +$ACTIVATOR = new PerlACE::Process("$imr_bin_path/ImR_Activator"); +$TAO_IMR = new PerlACE::Process("$tao_imr_bin_path/tao_imr"); + +# Run the IMR locator on a fixed port +$port = PerlACE::uniqueid () + 10001; # This can't be 10000 for Chorus 4.0 + +sub test_body +{ + unlink $imr_ior_file; + unlink $activator_ior_file; + unlink $log_file; + + # Start the IMR locator to generate an IOR file for the server to use... + $LOCATOR->Arguments("-o $imr_ior_file -ORBEndpoint iiop://:$port"); + $LOCATOR->Spawn (); + + if (PerlACE::waitforfile_timed ($imr_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $imr_ior_file\n"; + $LOCATOR->Kill (); + return 1; + } + + # Set the activator arguments + $activator_arguments = "-o $activator_ior_file -ORBInitRef ImplRepoService=file://$imr_ior_file"; + + # Start up the activator + $ACTIVATOR->Arguments ($activator_arguments); + $ACTIVATOR->Spawn (); + + if (PerlACE::waitforfile_timed ($activator_ior_file, 10) == -1) + { + print STDERR "ERROR: cannot find $activator_ior_file\n"; + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + return 1; + } + + # Add the persistent POA name to the IMR + $TAO_IMR->Arguments("-ORBInitRef ImplRepoService=file://$imr_ior_file &> $log_file add \"\""); + $result = $TAO_IMR->SpawnWaitKill (30); + + if (PerlACE::waitforfile_timed ($log_file, 10) == -1) + { + print STDERR "ERROR: cannot find $log_file\n"; + $ACTIVATOR->Kill (); + $LOCATOR->Kill (); + return 1; + } + + $match = 0; + open (FILE, $log_file) or return -1; + while (<FILE>) { + $match = /must be at least one character long/; + last if $match; + } + close FILE; + + # Tidy up + $ACTIVATOR->TerminateWaitKill (5); + $LOCATOR->TerminateWaitKill (5); + return $match ? 0 : -1; +} + +# Run regression for bug #1437 +$test_result = test_body(); + +if ($test_result != 0) +{ + print STDERR "ERROR: Regression test for Bug #1437 failed\n"; +} +else +{ + print "Regression test for Bug #1437 passed.\n"; +} +unlink $log_file; +unlink $imr_ior_file; +unlink $activator_ior_file; + +exit $test_result; diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/client.cpp index d946e668daa..11ad11738f0 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/client.cpp @@ -22,8 +22,13 @@ main (int argc, char *argv[]) } else { - client.run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + int status = client.run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (status == -1) + { + return 1; + } } } ACE_CATCHANY @@ -36,4 +41,3 @@ main (int argc, char *argv[]) return 0; } - diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp index 728b64f2a41..b31ad5d8603 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.cpp @@ -52,12 +52,15 @@ IFR_DII_Client::run (ACE_ENV_SINGLE_ARG_DECL) { if (this->lookup_by_name_) { - this->lookup_interface_def (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + if (this->lookup_interface_def (ACE_ENV_SINGLE_ARG_PARAMETER) == -1) + { + return -1; + } + ACE_CHECK_RETURN (-1); } else { - this->find_interface_def (ACE_ENV_SINGLE_ARG_PARAMETER); + this->find_interface_def (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); } @@ -106,7 +109,7 @@ IFR_DII_Client::find_interface_def (ACE_ENV_SINGLE_ARG_DECL) this->target_->_get_interface (ACE_ENV_SINGLE_ARG_PARAMETER); } -void +int IFR_DII_Client::lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL) { CORBA::Object_var obj = @@ -134,6 +137,12 @@ IFR_DII_Client::lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL) CORBA::ULong n_interfaces = 0; CORBA::String_var name; + // No point continuing; theres nothing to look at. + if (length == 0) + { + return -1; + } + // The length is 1 in this case, but in general, it could // be any length. for (CORBA::ULong i = 0; i < length; ++i) @@ -168,7 +177,7 @@ IFR_DII_Client::lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL) // The length is 1 in this case, but in general, it could // be any length. - for (CORBA::ULong j = 0; j < n_interfaces; ++j) + for (CORBA::ULong j = 0; j < n_interfaces ; ++j) { name = interfaces[j]->name (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; @@ -181,6 +190,7 @@ IFR_DII_Client::lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; } } + return 0; } void @@ -331,5 +341,3 @@ IFR_DII_Client::invoke_and_display (ACE_ENV_SINGLE_ARG_DECL) } } } - - diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h index a1282935808..5bbff228eaf 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/ifr_dii_client.h @@ -34,7 +34,7 @@ private: void find_interface_def (ACE_ENV_SINGLE_ARG_DECL); // Query the object reference to get its InterfaceDef in the IFR. - void lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL); + int lookup_interface_def (ACE_ENV_SINGLE_ARG_DECL); // Look up the InterfaceDef by name in the IFR. void get_operation_def (ACE_ENV_SINGLE_ARG_DECL); @@ -80,4 +80,3 @@ private: }; #endif /* IFR_DII_CLIENT_H */ - diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl index e3a6d22a41f..ae55db13823 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl @@ -38,6 +38,7 @@ $IFR = new PerlACE::Process ("../../../IFR_Service/IFR_Service"); $SV = new PerlACE::Process ("server"); $CL = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile" . " $lookup_by_name"); +$CL2 = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile -n"); unlink $ifr_iorfile; unlink $svr_iorfile; @@ -46,7 +47,7 @@ $IFR->Spawn (); if (PerlACE::waitforfile_timed ($ifr_iorfile, 15) == -1) { print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); + $IFR->Kill (); exit 1; } @@ -55,7 +56,7 @@ $SV->Spawn (); if (PerlACE::waitforfile_timed ($svr_iorfile, 15) == -1) { print STDERR "ERROR: cannot find file <$svr_iorfile>\n"; $IFR->Kill (); - $SV->Kill (); + $SV->Kill (); exit 1; } @@ -75,13 +76,6 @@ if ($client != 0) { $status = 1; } -$server = $SV->TerminateWaitKill (5); - -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; -} - $TAO_IFR->Arguments ("-r $test_idl"); $tresult = $TAO_IFR->SpawnWaitKill (30); @@ -91,6 +85,20 @@ if ($tresult != 0) { $status = 1; } +# Do another lookup to check it really has been removed. +$client = $CL2->SpawnWaitKill (60); + +if ($client == 0) { + print STDERR "ERROR: second client run returned $client\n"; + $status = 1; +} + +$server = $SV->TerminateWaitKill (5); + +if ($server != 0) { + print STDERR "ERROR: server returned $server\n"; + $status = 1; +} $server = $IFR->TerminateWaitKill (5); if ($server != 0) { @@ -102,4 +110,3 @@ unlink $ifr_iorfile; unlink $svr_iorfile; exit $status; - diff --git a/TAO/tao/DynamicAny/DynStruct_i.cpp b/TAO/tao/DynamicAny/DynStruct_i.cpp index 4d01be3991b..bca822faeeb 100644 --- a/TAO/tao/DynamicAny/DynStruct_i.cpp +++ b/TAO/tao/DynamicAny/DynStruct_i.cpp @@ -54,8 +54,25 @@ TAO_DynStruct_i::init (const CORBA::Any& any this->type_ = tc; - // Member_count works with aliased type codes. - CORBA::ULong numfields = this->type_->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); + this->set_from_any (any + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + + +// This code is common to from_any() and the init() overload that takes +// an Any argument. +void +TAO_DynStruct_i::set_from_any (const CORBA::Any & any + ACE_ENV_ARG_DECL) +{ + // member_type() does not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (any.type () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CORBA::ULong numfields = unaliased_tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; // Resize the array. @@ -70,7 +87,7 @@ TAO_DynStruct_i::init (const CORBA::Any& any any._tao_byte_order ()); // If we have an exception type, unmarshal the repository ID. - CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in () + CORBA::TCKind kind = TAO_DynAnyFactory::unalias (any.type () ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -80,12 +97,6 @@ TAO_DynStruct_i::init (const CORBA::Any& any cdr >> str.out (); } - // member_type() does not work with aliased type codes. - CORBA::TypeCode_var unaliased_tc = - TAO_DynAnyFactory::strip_alias (this->type_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - for (CORBA::ULong i = 0; i < numfields; i++) { CORBA::TypeCode_var field_tc = @@ -134,10 +145,15 @@ TAO_DynStruct_i::init (CORBA::TypeCode_ptr tc CORBA::TypeCode_var mtype; + // member_type() does not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in () + ACE_ENV_ARG_PARAMETER); + for (CORBA::ULong i = 0; i < numfields; i++) { - mtype = tc->member_type (i - ACE_ENV_ARG_PARAMETER); + mtype = unaliased_tc->member_type (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK; // Recursively initialize each member. @@ -214,10 +230,14 @@ TAO_DynStruct_i::current_member_name (ACE_ENV_SINGLE_ARG_DECL) 0); } - // Member_name works with aliased type codes. + // member_name() does not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; const char *name = - this->type_->member_name (this->current_position_ - ACE_ENV_ARG_PARAMETER); + unaliased_tc->member_name (this->current_position_ + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); return CORBA::string_dup (name); @@ -251,9 +271,14 @@ TAO_DynStruct_i::current_member_kind (ACE_ENV_SINGLE_ARG_DECL) CORBA::tk_null); } - CORBA::TypeCode_var tc = - this->type_.in ()->member_type (this->current_position_ + // member_type() does not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + CORBA::TypeCode_var tc = + unaliased_tc->member_type (this->current_position_ + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::tk_null); CORBA::TCKind retval = TAO_DynAnyFactory::unalias (tc.in () @@ -387,11 +412,17 @@ TAO_DynStruct_i::get_members_as_dyn_any (ACE_ENV_SINGLE_ARG_DECL) DynamicAny::NameDynAnyPairSeq_var safe_retval = members; + // member_name() does not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + // Assign name and value to each pearl on the string. for (CORBA::ULong i = 0; i < this->component_count_; ++i) { safe_retval[i].id = - CORBA::string_dup (this->type_.in ()->member_name (i)); + CORBA::string_dup (unaliased_tc->member_name (i)); // A deep copy is made only by copy() (CORBA 2.4.2 section 9.2.3.6). // Set the flag so the caller can't destroy. @@ -486,7 +517,6 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any { ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); } - CORBA::TypeCode_var tc = any.type (); CORBA::Boolean equivalent = this->type_->equivalent (tc.in () ACE_ENV_ARG_PARAMETER); @@ -494,56 +524,11 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any if (equivalent) { - // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); - TAO_InputCDR cdr (mb, - any._tao_byte_order ()); - - // If we have an exception type, unmarshal the repository ID. - CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (kind == CORBA::tk_except) - { - CORBA::String_var str; - cdr >> str.out (); - } - - CORBA::TypeCode_var field_tc; - - for (CORBA::ULong i = 0; i < this->component_count_; ++i) - { - field_tc = this->type_.in ()->member_type (i - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // This Any constructor is a TAO extension. - CORBA::Any field_any (field_tc.in (), - 0, - cdr.byte_order (), - cdr.start ()); - - this->da_members_[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->da_members_[i] = - TAO_DynAnyFactory::make_dyn_any (field_any - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Move to the next field in the CDR stream. - (void) TAO_Marshal_Object::perform_skip (field_tc.in (), - &cdr - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - this->current_position_ = this->component_count_ ? 0 : -1; + this->set_from_any (any ACE_ENV_ARG_PARAMETER); } else { - ACE_THROW (DynamicAny::DynAny::InvalidValue ()); + ACE_THROW (DynamicAny::DynAny::TypeMismatch ()); } } diff --git a/TAO/tao/DynamicAny/DynStruct_i.h b/TAO/tao/DynamicAny/DynStruct_i.h index 84a509df9fb..6ec359b8cb1 100644 --- a/TAO/tao/DynamicAny/DynStruct_i.h +++ b/TAO/tao/DynamicAny/DynStruct_i.h @@ -168,6 +168,11 @@ private: void check_typecode (CORBA::TypeCode_ptr tc ACE_ENV_ARG_DECL); + // Code common to the constructor from an Any arg and the member + // function from_any(). + void set_from_any (const CORBA::Any &any + ACE_ENV_SINGLE_ARG_DECL); + // Called by both versions of init(). void init_common (void); diff --git a/TAO/tao/DynamicAny/DynUnion_i.cpp b/TAO/tao/DynamicAny/DynUnion_i.cpp index 61374ebafd9..720d5c37e0b 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.cpp +++ b/TAO/tao/DynamicAny/DynUnion_i.cpp @@ -48,11 +48,18 @@ TAO_DynUnion_i::init (const CORBA::Any& any this->init_common (); - // Set the from_factory arg to TRUE, so any problems will throw - // InconsistentTypeCode. - this->set_from_any (any, - 1 - ACE_ENV_ARG_PARAMETER); + // Map TypeMismatch to InconsistentTypeCode.2 + ACE_TRY + { + this->set_from_any (any + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + ACE_CATCH(DynamicAny::DynAny::TypeMismatch, ex) + { + ACE_TRY_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ()); + } + ACE_ENDTRY; ACE_CHECK; } @@ -74,7 +81,11 @@ TAO_DynUnion_i::init (CORBA::TypeCode_ptr tc this->init_common (); - CORBA::Any_var first_label = tc->member_label (this->current_position_ + // member_type()/member_label() do not work with aliased type codes. + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in () + ACE_ENV_ARG_PARAMETER); + CORBA::Any_var first_label = unaliased_tc->member_label (this->current_position_ ACE_ENV_ARG_PARAMETER); ACE_CHECK; @@ -84,8 +95,8 @@ TAO_DynUnion_i::init (CORBA::TypeCode_ptr tc ACE_ENV_ARG_PARAMETER); ACE_CHECK; - CORBA::TypeCode_var first_type = tc->member_type (this->current_position_ - ACE_ENV_ARG_PARAMETER); + CORBA::TypeCode_var first_type = unaliased_tc->member_type (this->current_position_ + ACE_ENV_ARG_PARAMETER); ACE_CHECK; // Recursively initialize the member to its default value. @@ -135,8 +146,7 @@ TAO_DynUnion_i::_tao_QueryInterface (ptr_arith_t type) // This code is common to from_any() and the init() overload that takes // an Any argument. void -TAO_DynUnion_i::set_from_any (const CORBA::Any & any, - CORBA::Boolean from_factory +TAO_DynUnion_i::set_from_any (const CORBA::Any & any ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, @@ -243,14 +253,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any, if (default_index == -1) { - if (from_factory) - { - ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ()); - } - else - { - ACE_THROW (DynamicAny::DynAny::TypeMismatch ()); - } + set_to_no_active_member (ACE_ENV_SINGLE_ARG_PARAMETER); } else { @@ -704,10 +707,7 @@ TAO_DynUnion_i::from_any (const CORBA::Any& any // May be changed in set_from_any(). this->component_count_ = 2; - // Set the from_factory arg to FALSE, so any problems will throw - // TypeMismatch. - this->set_from_any (any, - 0 + this->set_from_any (any ACE_ENV_ARG_PARAMETER); ACE_CHECK; } @@ -1017,4 +1017,3 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, return 0; } } - diff --git a/TAO/tao/DynamicAny/DynUnion_i.h b/TAO/tao/DynamicAny/DynUnion_i.h index c5038b1bf9a..76d79ccd726 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.h +++ b/TAO/tao/DynamicAny/DynUnion_i.h @@ -180,9 +180,8 @@ public: private: // Code common to the constructor from an Any arg and the member // function from_any(). - void set_from_any (const CORBA::Any &any, - CORBA::Boolean from_factory - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + void set_from_any (const CORBA::Any &any + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC (( CORBA::SystemException, DynamicAny::DynAny::TypeMismatch, diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp index d64877ec69d..151fe38f16e 100644 --- a/TAO/tao/PortableServer/POA.cpp +++ b/TAO/tao/PortableServer/POA.cpp @@ -318,8 +318,20 @@ TAO_POA::TAO_POA (const TAO_POA::String &name, { int temp = this->use_imr_; this->use_imr_ = 0; - this->imr_notify_startup (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_TRY + { + this->imr_notify_startup (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + ACE_CATCHANY + { + this->poa_manager_.remove_poa (this); + this->object_adapter ().unbind_poa (this, + this->folded_name_, + this->system_name_); + ACE_RE_THROW; + } + ACE_ENDTRY; this->use_imr_ = temp; } diff --git a/TAO/tests/DynAny_Test/da_tests.idl b/TAO/tests/DynAny_Test/da_tests.idl index 4b797e77f4d..7bf0456b638 100644 --- a/TAO/tests/DynAny_Test/da_tests.idl +++ b/TAO/tests/DynAny_Test/da_tests.idl @@ -6,13 +6,13 @@ module DynAnyTests { - struct enclosed_struct + struct enclosed_struct { float f; short s; }; - struct test_struct + struct test_struct { char c; long l; @@ -24,7 +24,7 @@ module DynAnyTests const unsigned long DIM = 2; typedef long test_array [DIM]; - enum test_enum + enum test_enum { TE_ZEROTH, TE_FIRST, @@ -41,4 +41,12 @@ module DynAnyTests case TE_THIRD: string str; case TE_ZEROTH: octet o; }; + + typedef test_struct test_struct_alias; + typedef test_union test_union_alias; + + union test_implicit_def switch (boolean) { + case TRUE : + test_enum tenum; + } ; }; diff --git a/TAO/tests/DynAny_Test/test_dynstruct.cpp b/TAO/tests/DynAny_Test/test_dynstruct.cpp index 1e8658bdb77..2795352f146 100644 --- a/TAO/tests/DynAny_Test/test_dynstruct.cpp +++ b/TAO/tests/DynAny_Test/test_dynstruct.cpp @@ -200,6 +200,63 @@ Test_DynStruct::run_test (void) } ACE_DEBUG ((LM_DEBUG, + "testing: constructor(TypeCode alias)/from_any/to_any\n")); + + + const DynAnyTests::test_struct* ts_out2 = 0; + CORBA_Any_var out_any2 ; + DynamicAny::DynStruct_var ftc2; + + ACE_TRY + { + DynamicAny::DynAny_var ftc2_base = dynany_factory->create_dyn_any_from_type_code (DynAnyTests::_tc_test_struct_alias + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ftc2 = DynamicAny::DynStruct::_narrow (ftc2_base.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (ftc2.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "DynStruct::_narrow() returned nil\n"), + -1); + } + + ts.c = data.m_char1; + ts.l = data.m_long1; + ts.es.f = data.m_float1; + ts.es.s = data.m_short1; + CORBA_Any in_any3; + in_any3 <<= ts; + ftc2->from_any (in_any3 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + out_any2 = ftc2->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + if ((out_any2.in () >>= ts_out2) != 1) // problem + { + ts_out2 = 0; + } + } + ACE_CATCH (CORBA::TypeCode::BadKind, ex) + { + } + ACE_ENDTRY; + + if (ts_out2 != 0 && ts_out2->es.s == data.m_short1) + { + ACE_DEBUG ((LM_DEBUG, + "++ OK ++\n")); + } + else + { + ++this->error_count_; + } + + + ACE_DEBUG ((LM_DEBUG, "testing: current_member_name/current_member_kind\n")); ftc1->seek (2 @@ -229,6 +286,34 @@ Test_DynStruct::run_test (void) } ACE_DEBUG ((LM_DEBUG, + "testing: current_member_name/current_member_kind with alias\n")); + ftc2->seek (2 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + DynamicAny::FieldName_var fn2 = + ftc2->current_member_name (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (ACE_OS::strcmp (fn2.in (), "es")) + { + ++this->error_count_; + } + + CORBA::TCKind tk2 = ftc2->current_member_kind (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (tk2 != CORBA::tk_struct) + { + ++this->error_count_; + } + + if (this->error_count_ == 0) + { + ACE_DEBUG ((LM_DEBUG, + "++ OK ++\n")); + } + + ACE_DEBUG ((LM_DEBUG, "testing: get_members/set_members\n")); DynamicAny::NameValuePairSeq_var nvps = fa1->get_members (ACE_ENV_SINGLE_ARG_PARAMETER); diff --git a/TAO/tests/DynAny_Test/test_dynunion.cpp b/TAO/tests/DynAny_Test/test_dynunion.cpp index 64427858f68..1afe066d346 100644 --- a/TAO/tests/DynAny_Test/test_dynunion.cpp +++ b/TAO/tests/DynAny_Test/test_dynunion.cpp @@ -146,6 +146,58 @@ Test_DynUnion::run_test (void) } ACE_DEBUG ((LM_DEBUG, + "testing: constructor(TypeCode alias)/from_any/to_any\n")); + + CORBA_Any_var out_any2 = fa1->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::TypeCode_var s_out3; + + ACE_TRY + { + DynamicAny::DynAny_var ftc2_base = dynany_factory->create_dyn_any_from_type_code + (DynAnyTests::_tc_test_union_alias ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + DynamicAny::DynUnion_var ftc2 = + DynamicAny::DynUnion::_narrow (ftc2_base.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (ftc2.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "DynUnion::_narrow() returned nil\n"), + -1); + } + + ftc2->from_any (out_any2.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + ftc2->seek (1 + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + s_out3 = ftc2->get_typecode (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + ACE_CATCH (CORBA::TypeCode::BadKind, ex) + { + // Failed to create + } + ACE_ENDTRY; + + if ( ! CORBA::is_nil (s_out3.in ()) && + s_out3.in ()->equal (data.m_typecode1)) + { + ACE_DEBUG ((LM_DEBUG, + "++ OK ++\n")); + } + else + { + ++this->error_count_; + } + + ACE_DEBUG ((LM_DEBUG, "testing:discriminator/discriminator_kind\n")); DynamicAny::DynAny_var dp2 = ftc1->get_discriminator (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -225,6 +277,22 @@ Test_DynUnion::run_test (void) ACE_TRY_CHECK; ftc1->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "testing: create_dyn_any with _default()\n")); + DynAnyTests::test_implicit_def test_implicit_def_union; + CORBA::Any any_union; + + test_implicit_def_union._default(); + ACE_TRY_CHECK; + any_union <<= test_implicit_def_union; + ACE_TRY_CHECK; + + DynamicAny::DynAny_var da_union = + dynany_factory->create_dyn_any(any_union); + ACE_TRY_CHECK; + + // if we get here the create_dyn_any worked. } ACE_CATCHANY { |