diff options
author | Jose <jose@zeroc.com> | 2009-11-26 23:24:04 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-11-26 23:24:04 +0100 |
commit | cd2034a7bd10e15544479e40afc239b085070f46 (patch) | |
tree | bc5580709b76b15e55482316c2ed5f0df1375a84 | |
parent | 4385 - new StreamApi & UserExecption (diff) | |
download | ice-cd2034a7bd10e15544479e40afc239b085070f46.tar.bz2 ice-cd2034a7bd10e15544479e40afc239b085070f46.tar.xz ice-cd2034a7bd10e15544479e40afc239b085070f46.zip |
4279 - alllTest.py fails to run if source path contains white spaces.
61 files changed, 1187 insertions, 904 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index 58eeeef6a86..86242aab578 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -15,6 +15,7 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: if os.path.exists(os.path.join(toplevel, "scripts", "TestUtil.py")): break else: + print "can't find toplevel directory!" raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel)) diff --git a/cpp/demo/IceGrid/secure/expect.py b/cpp/demo/IceGrid/secure/expect.py index e2da0b55107..2d5c1aaa520 100755 --- a/cpp/demo/IceGrid/secure/expect.py +++ b/cpp/demo/IceGrid/secure/expect.py @@ -42,8 +42,7 @@ elif os.path.isdir(os.path.join(path[0], "cpp")): command = 'python -u makecerts.py' if icecaPath != "": - command += " --iceca=" + os.path.join(icecaPath, "bin", "iceca") - + command += ' --iceca="%s"' % os.path.join(icecaPath, "bin", "iceca") print command print "creating certificates...", diff --git a/cpp/demo/IceGrid/secure/makecerts.py b/cpp/demo/IceGrid/secure/makecerts.py index 428934e38f1..d7d969a8f94 100755 --- a/cpp/demo/IceGrid/secure/makecerts.py +++ b/cpp/demo/IceGrid/secure/makecerts.py @@ -14,14 +14,15 @@ iceca = "iceca" def runIceca(args): os.environ['PYTHONUNBUFFERED'] = '1' - if os.system(iceca + " " + args): + command = 'python "%s" %s' % (iceca, args) + if os.system(command): sys.exit(1) def createCertificate(filename, cn): print "======= Creating " + filename + " certificate =======" - runIceca("request --no-password --overwrite %s \"%s\"" % (filename, cn)) + runIceca('request --no-password --overwrite "%s" "%s"' % (filename, cn)) runIceca("sign --in %s_req.pem --out %s_cert.pem" % (filename, filename)) os.remove("%s_req.pem" % filename) diff --git a/cpp/src/IceGrid/Scanner.cpp b/cpp/src/IceGrid/Scanner.cpp index f5379d68444..9fd31abc7c2 100644 --- a/cpp/src/IceGrid/Scanner.cpp +++ b/cpp/src/IceGrid/Scanner.cpp @@ -1,32 +1,93 @@ #include <IceUtil/Config.h> -/* A lexical scanner generated by flex */ -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#line 3 "lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 33 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ +/* begin standard C headers. */ #include <stdio.h> -#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ -#ifdef __cplusplus +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif -#include <stdlib.h> +#endif /* ! FLEXINT_H */ -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST @@ -35,34 +96,17 @@ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -77,71 +121,75 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int yyleng; + extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ -typedef unsigned int yy_size_t; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef unsigned int yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -178,12 +226,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -197,28 +249,38 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ -static YY_BUFFER_STATE yy_current_buffer = 0; +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches @@ -226,75 +288,101 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* Begin user sect3 */ -#define yywrap() 1 +#define yywrap(n) 1 #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 8 #define YY_END_OF_BUFFER 9 -static yyconst short int yy_accept[19] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[19] = { 0, 3, 3, 9, 7, 3, 4, 5, 6, 7, 4, 7, 3, 0, 2, 1, 0, 3, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -326,24 +414,24 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[10] = +static yyconst flex_int32_t yy_meta[10] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst short int yy_base[19] = +static yyconst flex_int16_t yy_base[19] = { 0, 0, 0, 11, 22, 8, 22, 22, 22, 12, 22, 18, 0, 0, 22, 22, 0, 22, 22 } ; -static yyconst short int yy_def[19] = +static yyconst flex_int16_t yy_def[19] = { 0, 18, 1, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, 11, 18, 18, 11, 18, 0 } ; -static yyconst short int yy_nxt[32] = +static yyconst flex_int16_t yy_nxt[32] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, 18, 18, 18, 18, 18, 18, 13, 14, 15, 16, @@ -351,7 +439,7 @@ static yyconst short int yy_nxt[32] = 18 } ; -static yyconst short int yy_chk[32] = +static yyconst flex_int16_t yy_chk[32] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 3, 0, 0, 0, 0, 0, 5, 9, 9, 11, @@ -362,6 +450,9 @@ static yyconst short int yy_chk[32] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int yy_flex_debug; +int yy_flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -371,7 +462,6 @@ static char *yy_last_accepting_cpos; #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "Scanner.l" -#define INITIAL 0 #line 2 "Scanner.l" // ********************************************************************** @@ -408,12 +498,29 @@ typedef std::map<std::string, int> StringTokenMap; static StringTokenMap keywordMap; void initScanner(); +std::string parseDoubleQuotedString(); +std::string parseSingleQuotedString(); } #define YY_USER_INIT initScanner(); -#define YY_ALWAYS_INTERACTIVE 1 -#line 416 "lex.yy.c" +#line 507 "lex.yy.c" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -421,65 +528,30 @@ void initScanner(); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int yywrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -488,7 +560,6 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -501,9 +572,10 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -513,9 +585,22 @@ YY_MALLOC_DECL YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -536,12 +621,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -558,27 +649,29 @@ YY_MALLOC_DECL #define YY_RULE_SETUP \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; - -#line 50 "Scanner.l" + +#line 52 "Scanner.l" -#line 570 "lex.yy.c" +#line 663 "lex.yy.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -586,34 +679,36 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); /* Support of yytext. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -630,29 +725,27 @@ yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP -#line 52 "Scanner.l" +#line 54 "Scanner.l" { // C++-style comment int c; @@ -665,7 +758,7 @@ YY_RULE_SETUP YY_BREAK case 2: YY_RULE_SETUP -#line 62 "Scanner.l" +#line 64 "Scanner.l" { // C-style comment while(true) @@ -692,8 +785,9 @@ YY_RULE_SETUP } YY_BREAK case 3: +/* rule 3 can match eol */ YY_RULE_SETUP -#line 87 "Scanner.l" +#line 89 "Scanner.l" { size_t len = strlen(yytext); for(size_t i = 0; i < len; ++i) @@ -706,84 +800,19 @@ YY_RULE_SETUP } YY_BREAK case 4: +/* rule 4 can match eol */ YY_RULE_SETUP -#line 98 "Scanner.l" +#line 100 "Scanner.l" { return ';'; } YY_BREAK case 5: YY_RULE_SETUP -#line 102 "Scanner.l" +#line 104 "Scanner.l" { // "..."-type strings - string s; - while(true) - { - char c = static_cast<char>(yyinput()); - if(c == '"') - { - break; - } - else if(c == EOF) - { - parser->warning("EOF in string"); - break; - } - else if(c == '\\') - { - char next = static_cast<char>(yyinput()); - switch(next) - { - case '\\': - case '"': - { - s += next; - break; - } - - case 'n': - { - s += '\n'; - break; - } - - case 'r': - { - s += '\r'; - break; - } - - case 't': - { - s += '\t'; - break; - } - - case 'v': - { - s += '\v'; - break; - } - - case 'f': - { - s += '\f'; - break; - } - - default: - { - s += c; - unput(next); - } - } - } - else - { - s += c; - } - } + string s = parseDoubleQuotedString(); yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; @@ -791,7 +820,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 176 "Scanner.l" +#line 112 "Scanner.l" { // '...'-type strings string s; @@ -819,25 +848,34 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 201 "Scanner.l" +#line 137 "Scanner.l" { // Simple strings string s; s += yytext[0]; while(true) { - char c = static_cast<char>(yyinput()); - if(c == EOF) - { - break; - } - else if(isspace(static_cast<unsigned char>(c)) || c == ';') - { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(c == '"') + { + s += parseDoubleQuotedString(); + continue; + } + else if(c == '\'') + { + s += parseSingleQuotedString(); + continue; + } + else if(isspace(static_cast<unsigned char>(c)) || c == ';') + { unput(c); - break; - } - - s += c; + break; + } + s += c; } yylvalp->clear(); @@ -849,36 +887,36 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 228 "Scanner.l" +#line 173 "Scanner.l" ECHO; YY_BREAK -#line 855 "lex.yy.c" +#line 893 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * consistency between 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. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -888,13 +926,13 @@ case YY_STATE_EOF(INITIAL): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -907,30 +945,30 @@ case YY_STATE_EOF(INITIAL): yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -941,7 +979,7 @@ case YY_STATE_EOF(INITIAL): * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -949,30 +987,30 @@ case YY_STATE_EOF(INITIAL): else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -983,8 +1021,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -993,21 +1030,20 @@ case YY_STATE_EOF(INITIAL): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -1027,34 +1063,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -1067,8 +1099,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -1078,35 +1109,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1114,32 +1145,31 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; - } - +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1151,30 +1181,23 @@ static yy_state_type yy_get_previous_state() } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1186,81 +1209,73 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 18); return yy_is_jam ? 0 : yy_current_state; - } - +} -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* 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 ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1274,16 +1289,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) - return EOF; + if ( yywrap( ) ) + return 0; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1293,90 +1308,92 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); return c; - } -#endif /* YY_NO_INPUT */ - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +} +#endif /* ifndef YY_NO_INPUT */ - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); } + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1385,75 +1402,71 @@ int size; /* 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->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; - } - +} -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - + yyfree((void *) b->yy_ch_buf ); + yyfree((void *) b ); +} -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + b->yy_is_interactive = 1; -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + errno = oerrno; +} - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1470,29 +1483,121 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } +} +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1506,56 +1611,51 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1565,148 +1665,196 @@ int len; b->yy_is_our_buffer = 1; return b; - } +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 #endif +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; +/* Redefine yyless() so it works in section 3 code. */ - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); +/* Accessor methods (get/set functions) to struct members. */ - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} - yy_start_stack[yy_start_stack_ptr++] = YY_START; +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} - BEGIN(new_state); - } -#endif +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} +/** Get the current token. + * + */ -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); +char *yyget_text (void) +{ + return yytext; +} - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; #else -static void yy_fatal_error( msg ) -char msg[]; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } -/* Redefine yyless() so it works in section 3 code. */ + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + return 0; +} -/* Internal utility routines. */ +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *yyalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *yyrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1715,26 +1863,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 173 "Scanner.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 228 "Scanner.l" namespace IceGrid { @@ -1787,4 +1926,102 @@ initScanner() keywordMap["disable"] = ICE_GRID_DISABLE; } +std::string +parseDoubleQuotedString() +{ + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + return s; +} + +std::string +parseSingleQuotedString() +{ + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + return s; +} + } + diff --git a/cpp/src/IceGrid/Scanner.l b/cpp/src/IceGrid/Scanner.l index 92470c2c88b..ac04a5ea3c8 100644 --- a/cpp/src/IceGrid/Scanner.l +++ b/cpp/src/IceGrid/Scanner.l @@ -34,6 +34,8 @@ typedef std::map<std::string, int> StringTokenMap; static StringTokenMap keywordMap; void initScanner(); +std::string parseDoubleQuotedString(); +std::string parseSingleQuotedString(); } #define YY_USER_INIT initScanner(); @@ -101,73 +103,7 @@ keyword [[:alpha:]]* \" { // "..."-type strings - string s; - while(true) - { - char c = static_cast<char>(yyinput()); - if(c == '"') - { - break; - } - else if(c == EOF) - { - parser->warning("EOF in string"); - break; - } - else if(c == '\\') - { - char next = static_cast<char>(yyinput()); - switch(next) - { - case '\\': - case '"': - { - s += next; - break; - } - - case 'n': - { - s += '\n'; - break; - } - - case 'r': - { - s += '\r'; - break; - } - - case 't': - { - s += '\t'; - break; - } - - case 'v': - { - s += '\v'; - break; - } - - case 'f': - { - s += '\f'; - break; - } - - default: - { - s += c; - unput(next); - } - } - } - else - { - s += c; - } - } + string s = parseDoubleQuotedString(); yylvalp->clear(); yylvalp->push_back(s); return ICE_GRID_STRING; @@ -204,18 +140,27 @@ keyword [[:alpha:]]* s += yytext[0]; while(true) { - char c = static_cast<char>(yyinput()); - if(c == EOF) - { - break; - } - else if(isspace(static_cast<unsigned char>(c)) || c == ';') - { + char c = static_cast<char>(yyinput()); + if(c == EOF) + { + break; + } + else if(c == '"') + { + s += parseDoubleQuotedString(); + continue; + } + else if(c == '\'') + { + s += parseSingleQuotedString(); + continue; + } + else if(isspace(static_cast<unsigned char>(c)) || c == ';') + { unput(c); - break; - } - - s += c; + break; + } + s += c; } yylvalp->clear(); @@ -277,4 +222,101 @@ initScanner() keywordMap["disable"] = ICE_GRID_DISABLE; } +std::string +parseDoubleQuotedString() +{ + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '"') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else if(c == '\\') + { + char next = static_cast<char>(yyinput()); + switch(next) + { + case '\\': + case '"': + { + s += next; + break; + } + + case 'n': + { + s += '\n'; + break; + } + + case 'r': + { + s += '\r'; + break; + } + + case 't': + { + s += '\t'; + break; + } + + case 'v': + { + s += '\v'; + break; + } + + case 'f': + { + s += '\f'; + break; + } + + default: + { + s += c; + unput(next); + } + } + } + else + { + s += c; + } + } + return s; +} + +std::string +parseSingleQuotedString() +{ + string s; + while(true) + { + char c = static_cast<char>(yyinput()); + if(c == '\'') + { + break; + } + else if(c == EOF) + { + parser->warning("EOF in string"); + break; + } + else + { + s += c; + } + } + return s; +} + } diff --git a/cpp/src/ca/iceca b/cpp/src/ca/iceca index 2202f385c50..aab8e3121cd 100755 --- a/cpp/src/ca/iceca +++ b/cpp/src/ca/iceca @@ -170,12 +170,11 @@ if sys.argv[script] == "import": if len(keyPass) > 0: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + " -name " + \ - alias + " -passin file:" + keypassfile1 + " -passout file:" + keypassfile2 + " -certfile " + \ - os.path.join(home, "ca_cert.pem") + alias + " -passin file:" + keypassfile1 + " -passout file:" + keypassfile2 + ' -certfile "' + \ + os.path.join(home, "ca_cert.pem") + '"' else: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + " -name " + \ - alias + " -passout file:" + keypassfile1 + " -certfile " + os.path.join(home, "ca_cert.pem") - + alias + " -passout file:" + keypassfile1 + ' -certfile "' + os.path.join(home, "ca_cert.pem") + '"' print "converting to pkcs12 format... ", sys.stdout.flush() if verbose: print cmd @@ -250,7 +249,6 @@ if sys.argv[script] == "import": else: cmd = opensslCmd + " pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + \ " -passout pass:" - print "converting to pkcs12 format...", sys.stdout.flush() if verbose: print cmd @@ -280,7 +278,7 @@ if sys.argv[script] == "init": usage() print "This script will initialize your organization's Certificate Authority (CA)." - print "The CA database will be created in " + caroot + print 'The CA database will be created in "%s"' % caroot nopassphrase = False for o, a in opts: @@ -518,9 +516,8 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\ print "ok" - cmd = opensslCmd + " req -config " + cacnfname + " -x509 -days 1825 -newkey rsa:2048 -out " + \ - os.path.join(cadb, "ca_cert.pem") + " -outform PEM" - + cmd = opensslCmd + ' req -config "' + cacnfname + '" -x509 -days 1825 -newkey rsa:2048 -out "' + \ + os.path.join(cadb, "ca_cert.pem") + '" -outform PEM' if nopassphrase: cmd += " -nodes" @@ -604,7 +601,7 @@ if sys.argv[script] == "request": os.write(temp, "emailAddress=" + email + "\n") os.close(temp) - cmd = opensslCmd + " req -config " + tempname + ' -new -keyout "' + keyfile + '" -out "' + reqfile + '"' + cmd = opensslCmd + ' req -config "' + tempname + '" -new -keyout "' + keyfile + '" -out "' + reqfile + '"' if nopassphrase: cmd += " -nodes" @@ -621,7 +618,7 @@ if sys.argv[script] == "request": print print "The certificate request must be signed by the CA. Send the certificate" print "request file to the CA at the following email address:" - cmd = opensslCmd + " x509 -in " + os.path.join(home, "ca_cert.pem") + " -email -noout" + cmd = opensslCmd + ' x509 -in "' + os.path.join(home, "ca_cert.pem") + '" -email -noout' if verbose: print cmd os.system(cmd) @@ -676,7 +673,7 @@ if sys.argv[script] == "sign": os.write(temp, "\n[certificate_extensions]\nsubjectAltName=" + subjectAltName + "\n") os.close(temp) - cmd = opensslCmd + " ca -config " + tempname + " -in " + infile + " -out " + outfile + cmd = opensslCmd + ' ca -config "' + tempname + '" -in "' + infile + '" -out "' + outfile + '"' if verbose: print cmd status = os.system(cmd) if not keep: os.remove(tempname) diff --git a/cpp/test/Freeze/complex/run.py b/cpp/test/Freeze/complex/run.py index 0d9204e7fe7..1ce79738e05 100755 --- a/cpp/test/Freeze/complex/run.py +++ b/cpp/test/Freeze/complex/run.py @@ -34,13 +34,13 @@ if TestUtil.appverifier: TestUtil.setAppVerifierSettings([client]) print "starting populate...", -populateProc = TestUtil.startClient(client, " --dbdir %s populate" % os.getcwd(), startReader = False) +populateProc = TestUtil.startClient(client, ' --dbdir "%s" populate' % os.getcwd(), startReader = False) print "ok" populateProc.startReader() populateProc.waitTestSuccess() print "starting verification client...", -clientProc = TestUtil.startClient(client, " --dbdir %s validate" % os.getcwd(), startReader = False) +clientProc = TestUtil.startClient(client, ' --dbdir "%s" validate' % os.getcwd(), startReader = False) print "ok" clientProc.startReader() clientProc.waitTestSuccess() diff --git a/cpp/test/Freeze/dbmap/run.py b/cpp/test/Freeze/dbmap/run.py index c1ae645641a..89fb4e6c073 100755 --- a/cpp/test/Freeze/dbmap/run.py +++ b/cpp/test/Freeze/dbmap/run.py @@ -28,7 +28,7 @@ client = os.path.join(os.getcwd(), "client") if TestUtil.appverifier: TestUtil.setAppVerifierSettings([client]) -clientProc = TestUtil.startClient(client, " --Freeze.Warn.Rollback=0 %s" % os.getcwd()) +clientProc = TestUtil.startClient(client, ' --Freeze.Warn.Rollback=0 "%s"' % os.getcwd()) clientProc.waitTestSuccess() if TestUtil.appverifier: diff --git a/cpp/test/Freeze/evictor/run.py b/cpp/test/Freeze/evictor/run.py index b895339b126..9a3a60ee1c6 100755 --- a/cpp/test/Freeze/evictor/run.py +++ b/cpp/test/Freeze/evictor/run.py @@ -23,7 +23,7 @@ from scripts import * dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -testOptions = " --Freeze.DbEnv.db.DbHome=%s --Ice.Config=%s" % (dbdir, os.path.join(os.getcwd(), "config")) +testOptions = ' --Freeze.DbEnv.db.DbHome="%s" --Ice.Config="%s"' % (dbdir, os.path.join(os.getcwd(), "config")) TestUtil.clientServerTest(additionalServerOptions= testOptions, additionalClientOptions= testOptions) diff --git a/cpp/test/FreezeScript/dbmap/run.py b/cpp/test/FreezeScript/dbmap/run.py index 305be843ca8..7fdabe7a6f7 100755 --- a/cpp/test/FreezeScript/dbmap/run.py +++ b/cpp/test/FreezeScript/dbmap/run.py @@ -21,7 +21,7 @@ sys.path.append(os.path.join(path[0])) from scripts import * -transformdb = os.path.join(TestUtil.getCppBinDir(), "transformdb") +transformdb = '%s' % os.path.join(TestUtil.getCppBinDir(), "transformdb") if TestUtil.appverifier: TestUtil.setAppVerifierSettings([transformdb]) @@ -67,13 +67,15 @@ for oldfile in files: else: value = "int" - command = transformdb + " --old " + os.path.join(os.getcwd(), "fail", oldfile) + " --new " + \ - os.path.join(os.getcwd(), "fail", newfile) + " -o tmp.xml --key string --value " + value + command = '"' + transformdb + '" --old "' + os.path.join(os.getcwd(), "fail", oldfile) + '" --new "' + \ + os.path.join(os.getcwd(), "fail", newfile) + '" -o tmp.xml --key string --value ' + value if TestUtil.debug: print command - stdin, stdout, stderr = os.popen3(command) + p = TestUtil.runCommand(command) + (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) + lines1 = stderr.readlines() lines2 = open(os.path.join(os.getcwd(), "fail", oldfile.replace("_old.ice", ".err")), "r").readlines() if len(lines1) != len(lines2): @@ -96,7 +98,7 @@ print "ok" print "creating test database...", sys.stdout.flush() -makedb = os.path.join(os.getcwd(), "makedb") + " " + os.getcwd() +makedb = '"%s" "%s"'% (os.path.join(os.getcwd(), "makedb"), os.getcwd()) proc = TestUtil.spawn(makedb) proc.waitTestSuccess() print "ok" @@ -109,36 +111,30 @@ checkxml = os.path.join(os.getcwd(), "check.xml") print "initializing test database...", sys.stdout.flush() -command = transformdb + " --old " + testold + " --new " + testold + " -f " + initxml + " " + dbdir + \ - " default.db " + init_dbdir -if TestUtil.debug: - print "(" + command + ")", -if os.system(command) != 0: - sys.exit(1) +command = '"' + transformdb + '" --old "' + testold + '" --new "' + testold + '" -f "' + initxml + '" "' + dbdir + \ + '" default.db "' + init_dbdir + '" ' + +TestUtil.spawn(command).waitTestSuccess() print "ok" print "executing default transformations...", sys.stdout.flush() -command = transformdb + " --old " + testold + " --new " + testnew + " --key int --value ::Test::S " + init_dbdir + \ - " default.db " + check_dbdir -if TestUtil.debug: - print "(" + command + ")", -stdin, stdout, stderr = os.popen3(command) -stderr.readlines() +command = '"' + transformdb + '" --old "' + testold + '" --new "' + testnew + '" --key int --value ::Test::S "' + init_dbdir + \ + '" default.db "' + check_dbdir + '" ' + +TestUtil.spawn(command).waitTestSuccess() print "ok" print "validating database...", sys.stdout.flush() -command = transformdb + " --old " + testnew + " --new " + testnew + " -f " + checkxml + " " + check_dbdir + \ - " default.db " + tmp_dbdir -if TestUtil.debug: - print "(" + command + ")", -if os.system(command) != 0: - sys.exit(1) +command = '"' + transformdb + '" --old "' + testnew + '" --new "' + testnew + '" -f "' + checkxml + '" "' + check_dbdir + \ + '" default.db "' + tmp_dbdir + '" ' + +TestUtil.spawn(command).waitTestSuccess() print "ok" diff --git a/cpp/test/FreezeScript/evictor/run.py b/cpp/test/FreezeScript/evictor/run.py index a4fa6c49e2a..fea87955568 100755 --- a/cpp/test/FreezeScript/evictor/run.py +++ b/cpp/test/FreezeScript/evictor/run.py @@ -41,7 +41,7 @@ os.mkdir(tmp_dbdir) print "creating test database...", sys.stdout.flush() -makedb = os.path.join(os.getcwd(), "makedb") + " " + os.getcwd() +makedb = '"%s" "%s"' % (os.path.join(os.getcwd(), "makedb"), os.getcwd()) proc = TestUtil.spawn(makedb) proc.waitTestSuccess() print "ok" @@ -54,8 +54,8 @@ checkxml = os.path.join(os.getcwd(), "check.xml") print "executing evictor transformations...", sys.stdout.flush() -command = transformdb + " -e -p --old " + testold + " --new " + testnew + " -f " + transformxml + " " + dbdir + \ - " evictor.db " + check_dbdir +command = '"' + transformdb + '" -e -p --old "' + testold + '" --new "' + testnew + '" -f "' + transformxml + '" "' + dbdir + \ + '" evictor.db "' + check_dbdir + '" ' proc = TestUtil.spawn(command) proc.waitTestSuccess() print "ok" @@ -63,8 +63,8 @@ print "ok" print "validating database...", sys.stdout.flush() -command = transformdb + " -e --old " + testnew + " --new " + testnew + " -f " + checkxml + " " + check_dbdir + \ - " evictor.db " + tmp_dbdir +command = '"' + transformdb + '" -e --old "' + testnew + '" --new "' + testnew + '" -f "' + checkxml + '" "' + check_dbdir + \ + '" evictor.db "' + tmp_dbdir + '"' proc = TestUtil.spawn(command) proc.waitTestSuccess() print "ok" diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index f1d7a6df140..58dcdf5466d 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -279,7 +279,7 @@ for testcase in testcases: # these tests. # - routerArgs = " --Ice.Config=" + os.path.join(os.getcwd(), "router.cfg") + \ + routerArgs = ' --Ice.Config="' + os.path.join(os.getcwd(), "router.cfg") + '"' + \ ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \ ' --Ice.Admin.InstanceName=Glacier2' + \ @@ -328,7 +328,7 @@ for testcase in testcases: if TestUtil.protocol != "ssl": serverConfig = file(os.path.join(os.getcwd(), "server.cfg"), "w") - serverOptions = ' --Ice.Config=' + os.path.join(os.getcwd(), "server.cfg") + " " + serverOptions = ' --Ice.Config="' + os.path.join(os.getcwd(), "server.cfg") + '" ' serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n") serverConfig.close() else: @@ -352,7 +352,7 @@ for testcase in testcases: if clientDriver.host == "127.0.0.1": clientDriver.host = None clientDriver.host = commonClientOptions - clientArgs = " --Ice.Config=" + os.path.join(os.getcwd(), 'attack.cfg') + " " + clientArgs = ' --Ice.Config="%s"' % os.path.join(os.getcwd(), 'attack.cfg') clientProc = TestUtil.startClient(clientCmd, clientArgs, clientDriver) clientProc.waitTestSuccess() serverProc.waitTestSuccess() diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index 48cf7fc8ad5..18b307ca60b 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -24,7 +24,7 @@ client = os.path.join(os.getcwd(), "client") seedfile = os.path.join(os.getcwd(), "seed") -TestUtil.simpleTest(client, seedfile) +TestUtil.simpleTest(client, '"%s"' % seedfile) os.remove(seedfile) diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py index 9b8395cb7ae..8e9f60684e8 100755 --- a/cpp/test/IceBox/configuration/run.py +++ b/cpp/test/IceBox/configuration/run.py @@ -25,6 +25,6 @@ icebox = TestUtil.getIceBox() config = os.path.join(os.getcwd(), "config.icebox") config2 = os.path.join(os.getcwd(), "config.icebox2") -TestUtil.clientServerTest(additionalServerOptions= "--Ice.Config=%s" % config, server = icebox) -TestUtil.clientServerTest(additionalServerOptions= "--Ice.Config=%s" % config2, server = icebox) +TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config, server = icebox) +TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config2, server = icebox) diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py index 3595970fa14..24d33fbad44 100755 --- a/cpp/test/IceGrid/deployer/run.py +++ b/cpp/test/IceGrid/deployer/run.py @@ -20,9 +20,9 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % os.getcwd(), '"icebox.exe=%s"' % TestUtil.getIceBox()) +IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % os.getcwd(), "icebox.exe='%s'" % TestUtil.getIceBox()) # Tests with targets IceGridAdmin.iceGridTest("application.xml", '-t --TestDir="%s"' % os.getcwd(), - "icebox.exe=%s moreservers moreservices moreproperties" % TestUtil.getIceBox()) + "icebox.exe='%s' moreservers moreservices moreproperties" % TestUtil.getIceBox()) diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py index d15618d4891..43172dcf748 100755 --- a/cpp/test/IceGrid/distribution/run.py +++ b/cpp/test/IceGrid/distribution/run.py @@ -26,7 +26,7 @@ def icepatch2Calc(datadir, dirname): icePatch2Calc = os.path.join(TestUtil.getServiceDir(), "icepatch2calc") else: icePatch2Calc = os.path.join(TestUtil.getCppBinDir(), "icepatch2calc") - commandProc = TestUtil.spawn(icePatch2Calc + " " + os.path.join(datadir, dirname)) + commandProc = TestUtil.spawn('"%s" "%s"' % (icePatch2Calc, os.path.join(datadir, dirname))) commandProc.waitTestSuccess() datadir = os.path.join(os.getcwd(), "data") diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py index 3ef3f4a3169..a0db78792b9 100755 --- a/cpp/test/IceGrid/replicaGroup/run.py +++ b/cpp/test/IceGrid/replicaGroup/run.py @@ -20,6 +20,6 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -IceGridAdmin.iceGridTest("application.xml", "--Ice.RetryIntervals=\"0 50 100 250\"", - "icebox.exe=%s" % TestUtil.getIceBox()) +IceGridAdmin.iceGridTest("application.xml", "--Ice.RetryIntervals='0 50 100 250'", + "icebox.exe='%s'" % TestUtil.getIceBox()) diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index 4c9cbc476a8..8d3aedef4ad 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -20,5 +20,5 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.clientServerTest(additionalClientOptions = os.getcwd()) +TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.getcwd()) diff --git a/cpp/test/IceStorm/repgrid/run.py b/cpp/test/IceStorm/repgrid/run.py index 77bce6d70f2..61fae4c95bc 100755 --- a/cpp/test/IceStorm/repgrid/run.py +++ b/cpp/test/IceStorm/repgrid/run.py @@ -31,7 +31,7 @@ if TestUtil.appverifier: for filename in [os.path.join("db", f) for f in os.listdir("db") if f.endswith(".db")]: os.remove(filename) -variables = '"icebox.exe=%s"' % TestUtil.getIceBox() +variables = "icebox.exe='%s'" % TestUtil.getIceBox() if TestUtil.sqlType != None: variables += " db-plugin=IceStormSqlDB:createSqlDB" diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py index 123c56353f2..d38aadbdd14 100755 --- a/cpp/test/IceUtil/unicode/run.py +++ b/cpp/test/IceUtil/unicode/run.py @@ -22,5 +22,5 @@ from scripts import * client = os.path.join(os.getcwd(), "client") -TestUtil.simpleTest(client, os.getcwd()) +TestUtil.simpleTest(client, '"%s"' % os.getcwd()) diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index e27fbfc76af..e6adbb3afa0 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import os, sys, re +import os, sys, re, subprocess path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -20,7 +20,7 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -slice2cpp = os.path.join(TestUtil.getCppBinDir(), "slice2cpp") +slice2cpp = '"%s"' % os.path.join(TestUtil.getCppBinDir(), "slice2cpp") regex1 = re.compile("\.ice$", re.IGNORECASE) files = [] @@ -33,13 +33,15 @@ files.sort() for file in files: print file + "...", + command = slice2cpp + ' -I. "%s"' % os.path.join(os.getcwd(), file) - command = slice2cpp + " -I. " + os.path.join(os.getcwd(), file); - stdin, stdout, stderr = os.popen3(command) + p = TestUtil.runCommand(command) + (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) + lines1 = stderr.readlines() lines2 = open(os.path.join(os.getcwd(), regex1.sub(".err", file)), "r").readlines() if len(lines1) != len(lines2): - print "failed!" + print "failed! " sys.exit(1) regex2 = re.compile("^.*(?=" + file + ")") @@ -48,7 +50,7 @@ for file in files: line1 = regex2.sub("", lines1[i]).strip() line2 = regex2.sub("", lines2[i]).strip() if line1 != line2: - print "failed!" + print "failed! " sys.exit(1) i = i + 1 else: diff --git a/cs/demo/IceBox/hello/expect.py b/cs/demo/IceBox/hello/expect.py index f1e8b663c64..f8367d1f670 100755 --- a/cs/demo/IceBox/hello/expect.py +++ b/cs/demo/IceBox/hello/expect.py @@ -27,7 +27,7 @@ if Util.defaultHost: else: args = '' -server = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox("cs"), args)) +server = Util.spawn("'%s' --Ice.Config=config.icebox --Ice.PrintAdapterReady %s" % (Util.getIceBox("cs"), args)) server.expect('.* ready') client = Util.spawn('client.exe') client.expect('.*==>') diff --git a/cs/test/IceBox/configuration/run.py b/cs/test/IceBox/configuration/run.py index ea4c34a04f9..b92ebde6fd1 100755 --- a/cs/test/IceBox/configuration/run.py +++ b/cs/test/IceBox/configuration/run.py @@ -22,8 +22,8 @@ from scripts import * icebox = TestUtil.getIceBox() -TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox"), +TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), server=icebox) -TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox2"), +TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), server=icebox) diff --git a/cs/test/IceSSL/configuration/run.py b/cs/test/IceSSL/configuration/run.py index 6d1b2f72ab7..6211f77d4c6 100755 --- a/cs/test/IceSSL/configuration/run.py +++ b/cs/test/IceSSL/configuration/run.py @@ -24,5 +24,5 @@ from scripts import * # The drive letter needs to be removed on Windows or loading the SSL # plug-in will not work. # -TestUtil.clientServerTest(additionalClientOptions=os.path.splitdrive(os.getcwd())[1]) +TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.path.splitdrive(os.getcwd())[1]) diff --git a/demoscript/Util.py b/demoscript/Util.py index 93dc9008845..7df0f7ec3f0 100644 --- a/demoscript/Util.py +++ b/demoscript/Util.py @@ -301,7 +301,7 @@ def runDemos(start, args, demos, num = 0, script = False, root = False): print " exit 1" print "fi" else: - status = os.system("python " + os.path.join(dir, "expect.py " + args)) + status = os.system('python "' + os.path.join(dir, "expect.py") + '" ' + args) if status: if(num > 0): diff --git a/java/test/Freeze/complex/run.py b/java/test/Freeze/complex/run.py index 5e0da40b743..92f59783fba 100755 --- a/java/test/Freeze/complex/run.py +++ b/java/test/Freeze/complex/run.py @@ -27,7 +27,7 @@ dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) print "starting populate...", -populateProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir %s populate" % os.getcwd(), +populateProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir '%s' populate" % os.getcwd(), startReader=False) print "ok" populateProc.startReader() @@ -35,7 +35,7 @@ populateProc.startReader() populateProc.waitTestSuccess() print "starting verification client...", -clientProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir %s validate" % os.getcwd(), startReader=False) +clientProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir '%s' validate" % os.getcwd(), startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/Freeze/dbmap/run.py b/java/test/Freeze/dbmap/run.py index 26e7650b684..76698abf205 100755 --- a/java/test/Freeze/dbmap/run.py +++ b/java/test/Freeze/dbmap/run.py @@ -24,7 +24,7 @@ dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) print "starting client...", -clientProc = TestUtil.startClient("test.Freeze.dbmap.Client", os.getcwd(), startReader=False) +clientProc = TestUtil.startClient("test.Freeze.dbmap.Client", "'" + os.getcwd() + "'", startReader=False) print "ok" clientProc.startReader() clientProc.waitTestSuccess() diff --git a/java/test/Freeze/evictor/run.py b/java/test/Freeze/evictor/run.py index 6534defd719..b739f85a150 100755 --- a/java/test/Freeze/evictor/run.py +++ b/java/test/Freeze/evictor/run.py @@ -23,7 +23,7 @@ from scripts import * dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) -testOptions = " --Freeze.Warn.Deadlocks=0 --Freeze.DbEnv.db.DbHome=%s/db --Ice.Config=%s/config " % (os.getcwd(), os.getcwd()) +testOptions = " --Freeze.Warn.Deadlocks=0 --Freeze.DbEnv.db.DbHome='%s/db' --Ice.Config='%s/config' " % (os.getcwd(), os.getcwd()) TestUtil.clientServerTest(testOptions, testOptions) diff --git a/java/test/IceBox/configuration/run.py b/java/test/IceBox/configuration/run.py index fb0b1fb0d7d..30f129410ed 100755 --- a/java/test/IceBox/configuration/run.py +++ b/java/test/IceBox/configuration/run.py @@ -20,8 +20,8 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox"), +TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox"), server=TestUtil.getIceBox()) -TestUtil.clientServerTest(additionalServerOptions="--Ice.Config=%s" % os.path.join(os.getcwd(), "config.icebox2"), +TestUtil.clientServerTest(additionalServerOptions='--Ice.Config="%s"' % os.path.join(os.getcwd(), "config.icebox2"), server=TestUtil.getIceBox()) diff --git a/java/test/IceSSL/configuration/run.py b/java/test/IceSSL/configuration/run.py index 138300e7c3c..93cddb4a0c7 100755 --- a/java/test/IceSSL/configuration/run.py +++ b/java/test/IceSSL/configuration/run.py @@ -20,7 +20,7 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -testdir = os.getcwd() +testdir = "'%s'" % os.getcwd() TestUtil.clientServerTest(additionalClientOptions=testdir) diff --git a/java/test/Slice/generation/run.py b/java/test/Slice/generation/run.py index 478486e6129..d2c39230f94 100755 --- a/java/test/Slice/generation/run.py +++ b/java/test/Slice/generation/run.py @@ -26,9 +26,9 @@ slice2java = os.path.join(TestUtil.getCppBinDir(), "slice2java") if not os.path.exists("classes"): os.mkdir("classes") -command = slice2java + " --list-generated --output-dir classes File1.ice File2.ice" -stdin, stdout, stderr = os.popen3(command) -lines1 = stdout.readlines() +command = '"' + slice2java + '" --list-generated --output-dir classes File1.ice File2.ice's +p = TestUtil.runCommand(command) +lines1 = p.stdout.readlines() lines2 = open(os.path.join(os.getcwd(), "list-generated.out"), "r").readlines() if len(lines1) != len(lines2): print "failed!" diff --git a/py/demo/Ice/bidir/Client.py b/py/demo/Ice/bidir/Client.py index 52a96649001..8435ef457f1 100755 --- a/py/demo/Ice/bidir/Client.py +++ b/py/demo/Ice/bidir/Client.py @@ -15,7 +15,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Callback.ice') +Ice.loadSlice("'-I" + slice_dir + "' Callback.ice") import Demo class CallbackReceiverI(Demo.CallbackReceiver): diff --git a/py/demo/Ice/bidir/Server.py b/py/demo/Ice/bidir/Server.py index 85611dcad91..bd8699a2932 100755 --- a/py/demo/Ice/bidir/Server.py +++ b/py/demo/Ice/bidir/Server.py @@ -15,7 +15,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Callback.ice') +Ice.loadSlice("'-I" + slice_dir + "' Callback.ice") import Demo class CallbackSenderI(Demo.CallbackSender, threading.Thread): diff --git a/py/test/Ice/checksum/Client.py b/py/test/Ice/checksum/Client.py index 42fbb2d4d5a..4d44ef14e05 100755 --- a/py/test/Ice/checksum/Client.py +++ b/py/test/Ice/checksum/Client.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' --checksum Test.ice CTypes.ice') +Ice.loadSlice("'-I" + slice_dir + "' --checksum Test.ice CTypes.ice") import Test, AllTests def run(args, communicator): diff --git a/py/test/Ice/checksum/Server.py b/py/test/Ice/checksum/Server.py index 00668d748d0..9f8a52f6656 100755 --- a/py/test/Ice/checksum/Server.py +++ b/py/test/Ice/checksum/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' --checksum Test.ice STypes.ice') +Ice.loadSlice("'-I" + slice_dir + "' --checksum Test.ice STypes.ice") import Test class ChecksumI(Test.Checksum): diff --git a/py/test/Ice/info/Client.py b/py/test/Ice/info/Client.py index cfae04b7c0a..1bb53da6acd 100755 --- a/py/test/Ice/info/Client.py +++ b/py/test/Ice/info/Client.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import AllTests def test(b): diff --git a/py/test/Ice/info/Server.py b/py/test/Ice/info/Server.py index bf0b99078f2..1d87b668bf7 100755 --- a/py/test/Ice/info/Server.py +++ b/py/test/Ice/info/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test, TestI def run(args, communicator): diff --git a/py/test/Ice/location/Client.py b/py/test/Ice/location/Client.py index ecbd624624c..776fa56654f 100755 --- a/py/test/Ice/location/Client.py +++ b/py/test/Ice/location/Client.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test, AllTests def test(b): diff --git a/py/test/Ice/location/Server.py b/py/test/Ice/location/Server.py index 82623694ac6..ebde12bd61c 100755 --- a/py/test/Ice/location/Server.py +++ b/py/test/Ice/location/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test class ServerLocatorRegistry(Test.TestLocatorRegistry): diff --git a/py/test/Ice/operations/Client.py b/py/test/Ice/operations/Client.py index 9eb16c8a65a..33922982aae 100755 --- a/py/test/Ice/operations/Client.py +++ b/py/test/Ice/operations/Client.py @@ -17,7 +17,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import AllTests def test(b): diff --git a/py/test/Ice/operations/Collocated.py b/py/test/Ice/operations/Collocated.py index 43a359493c2..2b4986a8856 100755 --- a/py/test/Ice/operations/Collocated.py +++ b/py/test/Ice/operations/Collocated.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice('"-I' + slice_dir + '" Test.ice') import Test, TestI, AllTests def run(args, communicator): diff --git a/py/test/Ice/operations/Server.py b/py/test/Ice/operations/Server.py index 59e13d97cea..678acc63487 100755 --- a/py/test/Ice/operations/Server.py +++ b/py/test/Ice/operations/Server.py @@ -15,7 +15,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice('"-I' + slice_dir + '" Test.ice') import Test, TestI def run(args, communicator): diff --git a/py/test/Ice/operations/ServerAMD.py b/py/test/Ice/operations/ServerAMD.py index 096d3f81fb5..6dd36510cdc 100755 --- a/py/test/Ice/operations/ServerAMD.py +++ b/py/test/Ice/operations/ServerAMD.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' TestAMD.ice') +Ice.loadSlice("'-I" + slice_dir + "' TestAMD.ice") import Test class Thread_opVoid(threading.Thread): diff --git a/py/test/Ice/proxy/Client.py b/py/test/Ice/proxy/Client.py index 916e444decd..bec1ea1f760 100755 --- a/py/test/Ice/proxy/Client.py +++ b/py/test/Ice/proxy/Client.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import AllTests def test(b): diff --git a/py/test/Ice/proxy/Collocated.py b/py/test/Ice/proxy/Collocated.py index 43a359493c2..436756d948b 100755 --- a/py/test/Ice/proxy/Collocated.py +++ b/py/test/Ice/proxy/Collocated.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test, TestI, AllTests def run(args, communicator): diff --git a/py/test/Ice/proxy/Server.py b/py/test/Ice/proxy/Server.py index 9af7dec4acd..31890009d35 100755 --- a/py/test/Ice/proxy/Server.py +++ b/py/test/Ice/proxy/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test, TestI def run(args, communicator): diff --git a/py/test/Ice/proxy/ServerAMD.py b/py/test/Ice/proxy/ServerAMD.py index 93839fe50f3..4d0631edc43 100755 --- a/py/test/Ice/proxy/ServerAMD.py +++ b/py/test/Ice/proxy/ServerAMD.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' TestAMD.ice') +Ice.loadSlice("'-I" + slice_dir + "' TestAMD.ice") import Test class MyDerivedClassI(Test.MyDerivedClass): diff --git a/py/test/Ice/retry/Client.py b/py/test/Ice/retry/Client.py index 082a48c4ce3..3880a4beef8 100755 --- a/py/test/Ice/retry/Client.py +++ b/py/test/Ice/retry/Client.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import AllTests def test(b): diff --git a/py/test/Ice/retry/Server.py b/py/test/Ice/retry/Server.py index 66b325a1013..8315554b1e6 100755 --- a/py/test/Ice/retry/Server.py +++ b/py/test/Ice/retry/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test, TestI def run(args, communicator): diff --git a/py/test/Ice/timeout/Client.py b/py/test/Ice/timeout/Client.py index 667b8bc0c8d..64c12f851d1 100755 --- a/py/test/Ice/timeout/Client.py +++ b/py/test/Ice/timeout/Client.py @@ -15,7 +15,7 @@ slice_dir = Ice.getSliceDir() if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import AllTests def test(b): diff --git a/py/test/Ice/timeout/Server.py b/py/test/Ice/timeout/Server.py index 791f7af6e89..6a8fb4b0d16 100755 --- a/py/test/Ice/timeout/Server.py +++ b/py/test/Ice/timeout/Server.py @@ -16,7 +16,7 @@ if not slice_dir: print sys.argv[0] + ': Slice directory not found.' sys.exit(1) -Ice.loadSlice('-I' + slice_dir + ' Test.ice') +Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test class ActivateAdapterThread(threading.Thread): diff --git a/rb/test/Ice/checksum/Client.rb b/rb/test/Ice/checksum/Client.rb index 710c385d019..c42ea795487 100755 --- a/rb/test/Ice/checksum/Client.rb +++ b/rb/test/Ice/checksum/Client.rb @@ -16,7 +16,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' --checksum Test.ice CTypes.ice') +Ice::loadSlice("'-I" + slice_dir + "' --checksum Test.ice CTypes.ice") require 'AllTests' def run(args, communicator) diff --git a/rb/test/Ice/info/Client.rb b/rb/test/Ice/info/Client.rb index b3ec9a874a6..25501defee9 100755 --- a/rb/test/Ice/info/Client.rb +++ b/rb/test/Ice/info/Client.rb @@ -15,7 +15,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def test(b) diff --git a/rb/test/Ice/location/Client.rb b/rb/test/Ice/location/Client.rb index 9ec666cd80b..d278ac6e4e1 100755 --- a/rb/test/Ice/location/Client.rb +++ b/rb/test/Ice/location/Client.rb @@ -16,7 +16,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def run(args, communicator) diff --git a/rb/test/Ice/operations/Client.rb b/rb/test/Ice/operations/Client.rb index 4b8a11e99e4..1f1bc0d9259 100755 --- a/rb/test/Ice/operations/Client.rb +++ b/rb/test/Ice/operations/Client.rb @@ -12,7 +12,7 @@ require 'pathname' require 'Ice' slice_dir = Ice.getSliceDir -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def test(b) diff --git a/rb/test/Ice/proxy/Client.rb b/rb/test/Ice/proxy/Client.rb index 215249a552f..fc1e3f2f218 100755 --- a/rb/test/Ice/proxy/Client.rb +++ b/rb/test/Ice/proxy/Client.rb @@ -15,7 +15,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def test(b) diff --git a/rb/test/Ice/retry/Client.rb b/rb/test/Ice/retry/Client.rb index f8eb439f71b..8cf0a0c6f9e 100755 --- a/rb/test/Ice/retry/Client.rb +++ b/rb/test/Ice/retry/Client.rb @@ -15,7 +15,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def run(args, communicator) diff --git a/rb/test/Ice/timeout/Client.rb b/rb/test/Ice/timeout/Client.rb index a03d910ff60..bdcdff35208 100755 --- a/rb/test/Ice/timeout/Client.rb +++ b/rb/test/Ice/timeout/Client.rb @@ -15,7 +15,7 @@ if slice_dir.empty? fail "Slice directory not found" end -Ice::loadSlice('-I' + slice_dir + ' Test.ice') +Ice::loadSlice("'-I" + slice_dir + "' Test.ice") require 'AllTests' def test(b) diff --git a/scripts/IceGridAdmin.py b/scripts/IceGridAdmin.py index 436851cb702..49919ceb965 100644 --- a/scripts/IceGridAdmin.py +++ b/scripts/IceGridAdmin.py @@ -54,8 +54,8 @@ registryOptions = r' --Ice.Warn.Connections=0' + \ r' --Ice.ThreadPool.Client.SizeWarn=0' + \ r' --IceGrid.Registry.Client.ThreadPool.SizeWarn=0' + \ r' --Ice.ServerIdleTime=0' + \ - r' --IceGrid.Registry.DefaultTemplates=' + \ - os.path.abspath(os.path.join(TestUtil.toplevel, "cpp", "config", "templates.xml")) + r' --IceGrid.Registry.DefaultTemplates="' + \ + os.path.abspath(os.path.join(TestUtil.toplevel, "cpp", "config", "templates.xml") + '"') def getDefaultLocatorProperty(): @@ -99,7 +99,7 @@ def startIceGridRegistry(testdir, dynamicRegistration = False): cmd = command + ' ' + TestUtil.getQtSqlOptions('IceGrid') + \ r' --Ice.ProgramName=' + name + \ r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(iceGridPort + i) + '" ' + \ - r' --IceGrid.Registry.Data=' + dataDir + r' --IceGrid.Registry.Data="' + dataDir + '" ' if i > 0: cmd += r' --IceGrid.Registry.ReplicaName=' + name + ' ' + getDefaultLocatorProperty() @@ -156,7 +156,7 @@ def startIceGridNode(testdir): print "starting icegrid node...", command = r' --nowarn ' + nodeOptions + getDefaultLocatorProperty() + \ - r' --IceGrid.Node.Data=' + dataDir + \ + r' --IceGrid.Node.Data="' + dataDir + '"' \ r' --IceGrid.Node.Name=localnode' + \ r' --IceGrid.Node.PropertiesOverride=' + overrideOptions @@ -170,17 +170,14 @@ def startIceGridNode(testdir): def iceGridAdmin(cmd, ignoreFailure = False): - iceGridAdmin = "" - if TestUtil.isBCC2010() or TestUtil.isVC6(): - iceGridAdmin = os.path.join(TestUtil.getServiceDir(), "icegridadmin") - else: - iceGridAdmin = os.path.join(TestUtil.getCppBinDir(), "icegridadmin") + iceGridAdmin = TestUtil.getIceGridAdmin() user = r"admin1" if cmd == "registry shutdown": user = r"shutdown" command = getDefaultLocatorProperty() + r" --IceGridAdmin.Username=" + user + " --IceGridAdmin.Password=test1 " + \ r' -e "' + cmd + '"' + if TestUtil.appverifier: TestUtil.setAppVerifierSettings([TestUtil.getIceGridAdmin()]) @@ -232,8 +229,8 @@ def iceGridTest(application, additionalOptions = "", applicationOptions = ""): if application != "": print "adding application...", - iceGridAdmin('application add -n ' + os.path.join(testdir, application) + ' ' + \ - '"test.dir=' + testdir + '" "ice.bindir=' + TestUtil.getCppBinDir() + '" ' + applicationOptions) + iceGridAdmin("application add -n '" + os.path.join(testdir, application) + "' " + \ + "test.dir='" + testdir + "' ice.bindir='" + TestUtil.getCppBinDir() + "' " + applicationOptions) print "ok" print "starting client...", diff --git a/scripts/IceStormUtil.py b/scripts/IceStormUtil.py index 11909ac935c..5fda340292f 100644 --- a/scripts/IceStormUtil.py +++ b/scripts/IceStormUtil.py @@ -129,7 +129,7 @@ class Replicated(IceStormUtil): sqlOptions = TestUtil.getQtSqlOptions('IceStorm', dbHome) if len(sqlOptions) == 0: - self.iceStormDBEnv.append(" --Freeze.DbEnv.IceStorm.DbHome=%s" % dbHome) + self.iceStormDBEnv.append(' --Freeze.DbEnv.IceStorm.DbHome="%s"' % dbHome) else: self.iceStormDBEnv.append(" %s" % sqlOptions) self.procs.append(None) @@ -229,7 +229,7 @@ class NonReplicated(IceStormUtil): sqlOptions = TestUtil.getQtSqlOptions('IceStorm', self.dbHome) if len(sqlOptions) == 0: - self.iceStormDBEnv = " --Freeze.DbEnv.IceStorm.DbHome=" + self.dbHome + self.iceStormDBEnv = ' --Freeze.DbEnv.IceStorm.DbHome="%s"' % self.dbHome else: self.iceStormDBEnv = " " + sqlOptions diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py index 64db8492108..e896eadefa7 100755 --- a/scripts/TestUtil.py +++ b/scripts/TestUtil.py @@ -138,7 +138,12 @@ def sanitize(cp): np = np + os.pathsep np = np + p return np - + +def quoteArgument(arg): + if arg == None: + return None + return '"%s"' % arg + def dumpenv(env, lang): if env == None: env = os.environ @@ -603,41 +608,28 @@ def getIceBox(): return iceBox def getIceBoxAdmin(): - if isBCC2010(): - return os.path.join(getServiceDir(), "iceboxadmin") - else: - return os.path.join(getCppBinDir(), "iceboxadmin") + return getIceExe("iceboxadmin") def getIceGridAdmin(): - if isBCC2010(): - return os.path.join(getServiceDir(), "icegridadmin") - else: - return os.path.join(getCppBinDir(), "icegridadmin") + return getIceExe("icegridadmin") def getIceStormAdmin(): - if isBCC2010(): - return os.path.join(getServiceDir(), "icestormadmin") - else: - return os.path.join(getCppBinDir(), "icestormadmin") + return getIceExe("icestormadmin") def getIceGridNode(): - if isBCC2010(): - return os.path.join(getServiceDir(), "icegridnode") - else: - return os.path.join(getCppBinDir(), "icegridnode") + return getIceExe("icegridnode") def getIceGridRegistry(): - if isBCC2010(): - return os.path.join(getServiceDir(), "icegridregistry") - else: - return os.path.join(getCppBinDir(), "icegridregistry") + return getIceExe("icegridregistry") def getGlacier2Router(): - if isBCC2010(): - return os.path.join(getServiceDir(), "glacier2router") - else: - return os.path.join(getCppBinDir(), "glacier2router") + return getIceExe("glacier2router") +def getIceExe(name): + if isBCC2010() or isVC6(): + return os.path.join(getServiceDir(), name) + else: + return os.path.join(getCppBinDir(), name) class InvalidSelectorString(Exception): def __init__(self, value): @@ -782,7 +774,7 @@ def getCommandLine(exe, config): # if config.protocol == "ssl": sslenv = {} - sslenv["certsdir"] = os.path.abspath(os.path.join(toplevel, "certs")) + sslenv["certsdir"] = quoteArgument(os.path.abspath(os.path.join(toplevel, "certs"))) components.append(sslConfigTree[config.lang]["plugin"] % sslenv) components.append(sslConfigTree[config.lang][config.type] % sslenv) @@ -822,9 +814,9 @@ def getCommandLine(exe, config): output = StringIO.StringIO() if config.mono and config.lang == "cs": - print >>output, "mono", "--debug %s.exe" % exe, + print >>output, "mono", "--debug '%s.exe'" % exe, elif config.lang == "rb" and config.type == "client": - print >>output, "ruby", exe, + print >>output, "ruby '" + exe + "'", elif config.lang == "java" or config.lang == "javae": print >>output, "%s -ea" % javaCmd, if isSolaris() and config.x64: @@ -833,16 +825,19 @@ def getCommandLine(exe, config): print >>output, "-Djava.net.preferIPv4Stack=true", print >>output, exe, elif config.lang == "py": - print >>output, sys.executable, exe, + print >>output, sys.executable, '"%s"' % exe, elif config.lang == "php" and config.type == "client": - print >>output, phpCmd, "-c tmp.ini -f", exe, " -- ", + print >>output, phpCmd, "-c tmp.ini -f'"+ exe +"' -- ", elif config.lang == "cpp" and config.valgrind: # --child-silent-after-fork=yes is required for the IceGrid/activator test where the node # forks a process with execv failing (invalid exe name). print >>output, "valgrind -q --child-silent-after-fork=yes --leak-check=full ", - print >>output, "--suppressions=" + os.path.join(toplevel, "config", "valgrind.sup"), exe, + print >>output, '--suppressions="' + os.path.join(toplevel, "config", "valgrind.sup") + '" "' + exe + '"', else: - print >>output, exe, + if exe.find(" ") != -1: + print >>output, '"' + exe + '"', + else: + print >>output, exe, for c in components: print >>output, c, @@ -966,13 +961,13 @@ def spawn(cmd, env=None, cwd=None, startReader=True, lang=None): return Expect.Expect(cmd, startReader=startReader, env=env, logfile=tracefile, cwd=cwd) def spawnClient(cmd, env=None, cwd=None, echo=True, startReader=True, lang=None): - client = spawn(cmd, env, cwd, startReader=startReader, lang=lang) + client = spawn(cmd, env, quoteArgument(cwd), startReader=startReader, lang=lang) if echo: client.trace() return client def spawnServer(cmd, env=None, cwd=None, count=1, adapter=None, echo=True, lang=None): - server = spawn(cmd, env, cwd, lang=lang) + server = spawn(cmd, env, quoteArgument(cwd), lang=lang) if adapter: server.expect("%s ready\n" % adapter) else: @@ -983,6 +978,21 @@ def spawnServer(cmd, env=None, cwd=None, count=1, adapter=None, echo=True, lang= server.trace([re.compile("[^\n]+ ready")]) return server +import subprocess +def runCommand(command): + # + # popen3 has problems dealing with white spaces in command line. + # + if isWin32(): + CREATE_NEW_PROCESS_GROUP = 512 + p = subprocess.Popen(command, shell=False, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, creationflags = 512) + else: + p = subprocess.Popen(command, shell=True, bufsize=1024, stdin=subprocess.PIPE, stdout=subprocess.PIPE, \ + stderr=subprocess.PIPE, close_fds=True) + + return p; + def matchAppVerifierSuccess(): return re.escape("\nApplication Verifier ") + ".*\n" + \ re.escape("Copyright (c) Microsoft Corporation. All rights reserved.") + \ @@ -1175,6 +1185,7 @@ def startServer(exe, args = "", config=None, env=None, adapter = None, count = 1 return spawnServer(cmd, env = env, adapter = adapter, count = count, echo = echo,lang=config.lang) def startColloc(exe, args, config=None, env=None): + exe = quoteArgument(exe) if config == None: config = DriverConfig("colloc") if env == None: @@ -1183,6 +1194,7 @@ def startColloc(exe, args, config=None, env=None): return spawnClient(cmd, env = env, lang=config.lang) def simpleTest(exe, options = ""): + exe = quoteArgument(exe) if appverifier: setAppVerifierSettings([exe]) print "starting client...", @@ -1535,7 +1547,6 @@ def runTests(start, expanded, num = 0, script = False): else: print "*** test started:", time.strftime("%x %X") sys.stdout.flush() - os.chdir(dir) global keepGoing @@ -1546,7 +1557,7 @@ def runTests(start, expanded, num = 0, script = False): print " exit 1" print "fi" else: - status = os.system(sys.executable + " " + os.path.join(dir, "run.py " + args)) + status = os.system(sys.executable + " " + quoteArgument(os.path.join(dir, "run.py")) + " " + args) if status: if(num > 0): |