diff options
Diffstat (limited to 'cpp')
136 files changed, 3184 insertions, 2589 deletions
diff --git a/cpp/allDemos.py b/cpp/allDemos.py index b07ff86af3e..9e157cbcd55 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -15,7 +15,7 @@ for toplevel in [".", "..", "../..", "../../..", "../../../.."]: if os.path.exists(os.path.join(toplevel, "demoscript")): break else: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(os.path.join(toplevel)) from demoscript import Util diff --git a/cpp/allTests.py b/cpp/allTests.py index 79e2904ab1b..316bc188080 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -10,16 +10,16 @@ import os, sys, re, getopt -for toplevel in [".", "..", "../..", "../../..", "../../../.."]: - toplevel = os.path.abspath(toplevel) - 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!" +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(toplevel)) -from scripts import * +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil # # List of all basic tests. diff --git a/cpp/config/convertssl.py b/cpp/config/convertssl.py index 21675eda874..54cebe82d32 100755 --- a/cpp/config/convertssl.py +++ b/cpp/config/convertssl.py @@ -26,10 +26,10 @@ import sys, xml.dom, xml.dom.minidom # Show usage information. # def usage(): - print "Usage: " + sys.argv[0] + " xmlfile" - print - print "Options:" - print "-h Show this message." + print("Usage: " + sys.argv[0] + " xmlfile") + print("") + print("Options:") + print("-h Show this message.") def isCygwin(): # The substring on sys.platform is required because some cygwin @@ -56,20 +56,20 @@ def printConfig(node, name, comment=""): result = result + "#\n# NOTE: You may need to define IceSSL.DefaultDir\n" general = findChild(node, "general") if general: - if general.attributes.has_key("version"): + if "version" in general.attributes: version = general.attributes["version"].nodeValue if version == "SSLv3": result = result + prefix + "Protocols=SSLv3\n" elif version == "TLSv1": result = result + prefix + "Protocols=TLSv1\n" elif version != "SSLv23": - print "unknown value `" + version + "' for version attribute" + print("unknown value `" + version + "' for version attribute") sys.exit(1) - if general.attributes.has_key("cipherlist"): + if "cipherlist" in general.attributes: result = result + prefix + "Ciphers=" + general.attributes["cipherlist"].nodeValue + "\n" - if general.attributes.has_key("verifymode"): + if "verifymode" in general.attributes: verifymode = general.attributes["verifymode"].nodeValue if verifymode == "none": result = result + prefix + "VerifyPeer=0\n" @@ -80,21 +80,21 @@ def printConfig(node, name, comment=""): elif verifymode.find("client_once") != -1: result = result + prefix + "VerifyPeer=2\n" else: - print "unknown value `" + verifymode + "' for verifymode attribute" + print("unknown value `" + verifymode + "' for verifymode attribute") sys.exit(1) - if general.attributes.has_key("verifydepth"): + if "verifydepth" in general.attributes: result = result + prefix + "VerifyDepthMax=" + general.attributes["verifydepth"].nodeValue + "\n" - if general.attributes.has_key("randombytes"): + if "randombytes" in general.attributes: result = result + "# NOTE: You may need to use IceSSL.EntropyDaemon\n" result = result + prefix + "Random=" + general.attributes["randombytes"].nodeValue + "\n" ca = findChild(node, "certauthority") if ca: - if ca.attributes.has_key("file"): + if "file" in ca.attributes: result = result + prefix + "CertAuthFile=" + ca.attributes["file"].nodeValue + "\n" - if ca.attributes.has_key("path"): + if "path" in ca.attributes: result = result + prefix + "CertAuthDir=" + ca.attributes["path"].nodeValue + "\n" basecerts = findChild(node, "basecerts") @@ -104,33 +104,33 @@ def printConfig(node, name, comment=""): rsacert = findChild(basecerts, "rsacert") if rsacert: pub = findChild(rsacert, "public") - if pub.attributes.has_key("encoding"): + if "encoding" in pub.attributes: if pub.attributes["encoding"].nodeValue != "PEM": result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" - if pub.attributes.has_key("filename"): + if "filename" in pub.attributes: certFile = pub.attributes["filename"].nodeValue priv = findChild(rsacert, "private") - if priv.attributes.has_key("encoding"): + if "encoding" in priv.attributes: if priv.attributes["encoding"].nodeValue != "PEM": result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" - if priv.attributes.has_key("filename"): + if "filename" in priv.attributes: keyFile = priv.attributes["filename"].nodeValue dsacert = findChild(basecerts, "dsacert") if dsacert: pub = findChild(dsacert, "public") - if pub.attributes.has_key("encoding"): + if "encoding" in pub.attributes: if pub.attributes["encoding"].nodeValue != "PEM": result = result + "# NOTE: Only PEM encoding is supported for certificates!\n" - if pub.attributes.has_key("filename"): + if "filename" in pub.attributes: if len(certFile) > 0: certFile = certFile + sep + pub.attributes["filename"].nodeValue else: certFile = pub.attributes["filename"].nodeValue priv = findChild(rsacert, "private") - if priv.attributes.has_key("encoding"): + if "encoding" in priv.attributes: if priv.attributes["encoding"].nodeValue != "PEM": result = result + "# NOTE: Only PEM encoding is supported for private keys!\n" - if priv.attributes.has_key("filename"): + if "filename" in priv.attributes: if len(keyFile) > 0: keyFile = keyFile + sep + priv.attributes["filename"].nodeValue else: @@ -143,7 +143,7 @@ def printConfig(node, name, comment=""): for child in basecerts.childNodes: if child.localName == "dhparams": keysize = child.attributes["keysize"].nodeValue - if child.attributes.has_key("encoding"): + if "encoding" in child.attributes: if child.attributes["encoding"].nodeValue != "PEM": result = result + "# NOTE: Only PEM encoding is supported for DH parameters!\n" filename = child.attributes["filename"].nodeValue @@ -160,8 +160,8 @@ for x in sys.argv[1:]: usage() sys.exit(0) elif x.startswith("-"): - print sys.argv[0] + ": unknown option `" + x + "'" - print + print(sys.argv[0] + ": unknown option `" + x + "'") + print("") usage() sys.exit(1) else: @@ -180,16 +180,16 @@ f.close() config = findChild(doc, "SSLConfig") if not config: - print sys.argv[0] + ": unable to find element SSLConfig" + print(sys.argv[0] + ": unable to find element SSLConfig") sys.exit(1) client = findChild(config, "client") server = findChild(config, "server") output = None if client and server: - print printConfig(client, "Client") - print printConfig(server, "Server", "#") + print(printConfig(client, "Client")) + print(printConfig(server, "Server", "#")) elif client: - print printConfig(client, "Client") + print(printConfig(client, "Client")) elif server: - print printConfig(server, "Server") + print(printConfig(server, "Server")) diff --git a/cpp/demo/Freeze/backup/expect.py b/cpp/demo/Freeze/backup/expect.py index 652713735ec..4ed9445da18 100755 --- a/cpp/demo/Freeze/backup/expect.py +++ b/cpp/demo/Freeze/backup/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, shutil, signal, time path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,12 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * -import shutil -import signal, time +from demoscript import Util def cleandb(): shutil.rmtree("db.save", True) @@ -30,23 +28,23 @@ def cleandb(): for filename in [ os.path.join("db", f) for f in os.listdir("db") if f.startswith("__db") ]: os.remove(filename) -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() cleandb() for d in os.listdir('.'): if d.startswith('hotbackup'): shutil.rmtree(d) -print "ok" +print("ok") client = Util.spawn('./client') -print "populating map...", +sys.stdout.write("populating map... ") sys.stdout.flush() client.expect('Updating map', timeout=60) time.sleep(3) # Let the client do some work for a bit. -print "ok" +print("ok") -print "performing full backup...", +sys.stdout.write("performing full backup... ") sys.stdout.flush() if Util.isWin32(): backup = Util.spawn('./backup.bat full') @@ -54,14 +52,14 @@ else: backup = Util.spawn('./backup full') backup.expect('hot backup started', timeout=30) backup.waitTestSuccess(timeout=30) -print "ok" +print("ok") -print "sleeping 5s...", +sys.stdout.write("sleeping 5s... ") sys.stdout.flush() time.sleep(5) -print "ok" +print("ok") -print "performing incremental backup...", +sys.stdout.write("performing incremental backup... ") sys.stdout.flush() if Util.isWin32(): backup = Util.spawn('./backup.bat incremental') @@ -69,25 +67,25 @@ else: backup = Util.spawn('./backup incremental') backup.expect('hot backup started', timeout=30) backup.waitTestSuccess(timeout=30) -print "ok" +print("ok") -print "sleeping 30s...", +sys.stdout.write("sleeping 30s... ") sys.stdout.flush() time.sleep(30) -print "ok" +print("ok") assert os.path.isdir('hotbackup') -print "killing client with SIGTERM...", +sys.stdout.write("killing client with SIGTERM... ") sys.stdout.flush() client.kill(signal.SIGTERM) client.waitTestSuccess(-signal.SIGTERM) -print "ok" +print("ok") -print "Client output: ", -print "%s " % (client.before) +sys.stdout.write("Client output: ") +print("%s" % (client.before)) -print "restarting client...", +sys.stdout.write("restarting client... ") sys.stdout.flush() cleandb() # Annoying. shutil.copytree cannot be used since db already exists @@ -107,17 +105,17 @@ sys.stdout.flush() client = Util.spawn('./client') client.expect('(.*)Updating map', timeout=60) assert client.match.group(1).find('Creating new map') == -1 -print "ok" +print("ok") -print "sleeping 5s...", +sys.stdout.write("sleeping 5s... ") sys.stdout.flush() time.sleep(5) -print "ok" +print("ok") -print "killing client with SIGTERM...", +sys.stdout.write("killing client with SIGTERM... ") client.kill(signal.SIGTERM) client.waitTestSuccess(-signal.SIGTERM) -print "ok" +print("ok") -print "Restarted client output:", -print "%s " % (client.before) +sys.stdout.write("Restarted client output: ") +print("%s" % (client.before)) diff --git a/cpp/demo/Freeze/bench/expect.py b/cpp/demo/Freeze/bench/expect.py index b9747ec0818..ec03365ba29 100755 --- a/cpp/demo/Freeze/bench/expect.py +++ b/cpp/demo/Freeze/bench/expect.py @@ -16,16 +16,16 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Freeze import bench -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") client = Util.spawn('./client') bench.run(client) diff --git a/cpp/demo/Freeze/casino/expect.py b/cpp/demo/Freeze/casino/expect.py index 0db8ec59bfa..2592229b213 100755 --- a/cpp/demo/Freeze/casino/expect.py +++ b/cpp/demo/Freeze/casino/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Freeze import casino casino.run('./client', './server') diff --git a/cpp/demo/Freeze/customEvictor/expect.py b/cpp/demo/Freeze/customEvictor/expect.py index 45ecac4f2e7..b0685606d0a 100755 --- a/cpp/demo/Freeze/customEvictor/expect.py +++ b/cpp/demo/Freeze/customEvictor/expect.py @@ -16,38 +16,38 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util if Util.isDarwin(): - print "This demo is not supported under MacOS." + print("This demo is not supported under MacOS.") sys.exit(0) -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") -print "testing IceUtil::Cache evictor" +print("testing IceUtil::Cache evictor") server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect(".* ready", timeout=120) client = Util.spawn('./client') client.waitTestSuccess(timeout=8 * 60) -print client.before +print(client.before) server.kill(signal.SIGINT) server.waitTestSuccess(timeout=60) -print "testing simple evictor" +print("testing simple evictor") server = Util.spawn('./server simple --Ice.PrintAdapterReady') server.expect(".* ready") client = Util.spawn('./client') client.waitTestSuccess(timeout=8*60) -print client.before +print(client.before) server.kill(signal.SIGINT) server.waitTestSuccess(timeout=60) diff --git a/cpp/demo/Freeze/library/Grammar.cpp b/cpp/demo/Freeze/library/Grammar.cpp index fcc1cb7e8ee..de514f337bd 100644 --- a/cpp/demo/Freeze/library/Grammar.cpp +++ b/cpp/demo/Freeze/library/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,51 +54,20 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - +/* Push parsers. */ +#define YYPUSH 0 +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_ADD_BOOK = 260, - TOK_FIND_ISBN = 261, - TOK_FIND_AUTHORS = 262, - TOK_NEXT_FOUND_BOOK = 263, - TOK_PRINT_CURRENT = 264, - TOK_RENT_BOOK = 265, - TOK_RETURN_BOOK = 266, - TOK_REMOVE_CURRENT = 267, - TOK_SET_EVICTOR_SIZE = 268, - TOK_SHUTDOWN = 269, - TOK_STRING = 270 - }; -#endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_ADD_BOOK 260 -#define TOK_FIND_ISBN 261 -#define TOK_FIND_AUTHORS 262 -#define TOK_NEXT_FOUND_BOOK 263 -#define TOK_PRINT_CURRENT 264 -#define TOK_RENT_BOOK 265 -#define TOK_RETURN_BOOK 266 -#define TOK_REMOVE_CURRENT 267 -#define TOK_SET_EVICTOR_SIZE 268 -#define TOK_SHUTDOWN 269 -#define TOK_STRING 270 - +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "Grammar.y" @@ -132,6 +100,9 @@ yyerror(const char* s) +/* Line 189 of yacc.c */ +#line 105 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -150,20 +121,44 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_ADD_BOOK = 260, + TOK_FIND_ISBN = 261, + TOK_FIND_AUTHORS = 262, + TOK_NEXT_FOUND_BOOK = 263, + TOK_PRINT_CURRENT = 264, + TOK_RENT_BOOK = 265, + TOK_RETURN_BOOK = 266, + TOK_REMOVE_CURRENT = 267, + TOK_SET_EVICTOR_SIZE = 268, + TOK_SHUTDOWN = 269, + TOK_STRING = 270 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 167 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 162 "Grammar.tab.c" #ifdef short # undef short @@ -238,14 +233,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -326,9 +321,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -362,12 +357,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -751,17 +746,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -795,11 +793,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1079,10 +1077,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1101,10 +1097,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1128,74 +1123,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1225,7 +1221,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1233,7 +1228,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1256,9 +1250,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1269,7 +1262,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1279,6 +1271,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1287,16 +1282,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1328,20 +1323,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1381,30 +1372,40 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 54 "Grammar.y" { ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 57 "Grammar.y" { ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 65 "Grammar.y" { ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 68 "Grammar.y" { ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 76 "Grammar.y" { parser->usage(); @@ -1412,6 +1413,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 80 "Grammar.y" { return 0; @@ -1419,6 +1422,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 84 "Grammar.y" { parser->addBook((yyvsp[(2) - (3)])); @@ -1426,6 +1431,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 88 "Grammar.y" { parser->findIsbn((yyvsp[(2) - (3)])); @@ -1433,6 +1440,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 92 "Grammar.y" { parser->findAuthors((yyvsp[(2) - (3)])); @@ -1440,6 +1449,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 96 "Grammar.y" { parser->nextFoundBook(); @@ -1447,6 +1458,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 100 "Grammar.y" { parser->printCurrent(); @@ -1454,6 +1467,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 104 "Grammar.y" { parser->rentCurrent((yyvsp[(2) - (3)])); @@ -1461,6 +1476,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 108 "Grammar.y" { parser->returnCurrent(); @@ -1468,6 +1485,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 112 "Grammar.y" { parser->removeCurrent(); @@ -1475,6 +1494,8 @@ yyreduce: break; case 16: + +/* Line 1455 of yacc.c */ #line 116 "Grammar.y" { parser->setEvictorSize((yyvsp[(2) - (3)])); @@ -1482,6 +1503,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 120 "Grammar.y" { parser->shutdown(); @@ -1489,6 +1512,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 124 "Grammar.y" { yyerrok; @@ -1496,12 +1521,16 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 128 "Grammar.y" { ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 136 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); @@ -1510,6 +1539,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 141 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); @@ -1517,8 +1548,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1522 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 1554 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1529,7 +1561,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1594,7 +1625,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1611,7 +1642,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1668,9 +1699,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -1695,7 +1723,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1706,7 +1734,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1732,6 +1760,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 146 "Grammar.y" diff --git a/cpp/demo/Freeze/library/Grammar.h b/cpp/demo/Freeze/library/Grammar.h index f956ecdbf3a..06c71695747 100644 --- a/cpp/demo/Freeze/library/Grammar.h +++ b/cpp/demo/Freeze/library/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -54,30 +54,16 @@ TOK_STRING = 270 }; #endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_ADD_BOOK 260 -#define TOK_FIND_ISBN 261 -#define TOK_FIND_AUTHORS 262 -#define TOK_NEXT_FOUND_BOOK 263 -#define TOK_PRINT_CURRENT 264 -#define TOK_RENT_BOOK 265 -#define TOK_RETURN_BOOK 266 -#define TOK_REMOVE_CURRENT 267 -#define TOK_SET_EVICTOR_SIZE 268 -#define TOK_SHUTDOWN 269 -#define TOK_STRING 270 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/cpp/demo/Freeze/library/Scanner.cpp b/cpp/demo/Freeze/library/Scanner.cpp index cb08ec61fba..ffb9f557140 100755..100644 --- a/cpp/demo/Freeze/library/Scanner.cpp +++ b/cpp/demo/Freeze/library/Scanner.cpp @@ -1,71 +1,113 @@ -#include "IceUtil/Config.h" -/* A lexical scanner generated by flex */ +#include <IceUtil/Config.h> -/* 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 35 +#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 <string.h> #include <errno.h> +#include <stdlib.h> -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif +/* end standard C headers. */ +/* flex integer type definitions */ -#ifdef __cplusplus +#ifndef FLEXINT_H +#define FLEXINT_H -#include <stdlib.h> -#ifndef _WIN32 -#include <unistd.h> +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __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 -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +#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 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__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 @@ -80,71 +122,70 @@ * 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 ) - -/* 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; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -181,12 +222,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 @@ -200,28 +245,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 @@ -229,69 +284,95 @@ 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 20 #define YY_END_OF_BUFFER 21 -static yyconst short int yy_accept[77] = +/* 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[77] = { 0, 15, 15, 21, 19, 15, 16, 17, 18, 19, 16, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, @@ -303,7 +384,7 @@ static yyconst short int yy_accept[77] = 0, 7, 9, 0, 14, 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, @@ -335,14 +416,14 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[31] = +static yyconst flex_int32_t yy_meta[31] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst short int yy_base[77] = +static yyconst flex_int16_t yy_base[77] = { 0, 0, 0, 93, 94, 29, 94, 94, 94, 26, 94, 32, 23, 66, 62, 76, 65, 74, 61, 72, 24, @@ -354,7 +435,7 @@ static yyconst short int yy_base[77] = 22, 94, 94, 24, 94, 94 } ; -static yyconst short int yy_def[77] = +static yyconst flex_int16_t yy_def[77] = { 0, 76, 1, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, @@ -366,7 +447,7 @@ static yyconst short int yy_def[77] = 76, 76, 76, 76, 76, 0 } ; -static yyconst short int yy_nxt[125] = +static yyconst flex_int16_t yy_nxt[125] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12, 4, 13, 4, 14, 15, 16, 4, 4, 17, 4, @@ -384,7 +465,7 @@ static yyconst short int yy_nxt[125] = 76, 76, 76, 76 } ; -static yyconst short int yy_chk[125] = +static yyconst flex_int16_t yy_chk[125] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -405,6 +486,9 @@ static yyconst short int yy_chk[125] = 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. */ @@ -414,7 +498,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" // ********************************************************************** @@ -441,8 +524,52 @@ using namespace std; #define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize) -#define YY_ALWAYS_INTERACTIVE 1 -#line 445 "lex.yy.c" +#line 527 "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 ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -450,65 +577,30 @@ using namespace std; #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 )); -#else -static int input YY_PROTO(( void )); -#endif -#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 +#ifdef __cplusplus +static int yyinput (void ); #else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 +static int input (void ); #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. */ @@ -517,12 +609,11 @@ 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(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -530,9 +621,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 = '*'; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -555,7 +647,9 @@ YY_MALLOC_DECL errno=0; \ clearerr(yyin); \ } \ - } + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -576,12 +670,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. @@ -598,27 +698,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, *yy_bp; register int yy_act; - + #line 35 "Scanner.l" -#line 610 "lex.yy.c" +#line 712 "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; @@ -626,34 +728,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 ) { @@ -670,24 +774,22 @@ 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: @@ -816,6 +918,7 @@ YY_RULE_SETUP } YY_BREAK case 15: +/* rule 15 can match eol */ YY_RULE_SETUP #line 120 "Scanner.l" { @@ -830,6 +933,7 @@ YY_RULE_SETUP } YY_BREAK case 16: +/* rule 16 can match eol */ YY_RULE_SETUP #line 131 "Scanner.l" { @@ -973,33 +1077,33 @@ YY_RULE_SETUP #line 258 "Scanner.l" ECHO; YY_BREAK -#line 976 "lex.yy.c" +#line 1080 "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 @@ -1009,13 +1113,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 @@ -1028,30 +1132,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(0) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -1062,7 +1166,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; @@ -1070,30 +1174,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; @@ -1104,8 +1208,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 * @@ -1114,21 +1217,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. @@ -1148,34 +1250,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 ) { @@ -1188,8 +1286,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. */ @@ -1199,35 +1296,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), (size_t) 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; } } @@ -1235,32 +1332,39 @@ 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; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + (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; - return ret_val; - } + (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 ) { @@ -1272,30 +1376,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 ) { @@ -1307,80 +1404,73 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 76); 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; +} - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - +#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() @@ -1394,16 +1484,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( yywrap(0) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1413,90 +1503,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; - } - - -#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()" ); @@ -1505,84 +1597,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 ); + yyfree((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } - - -#ifndef _WIN32 -#include <unistd.h> -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif - -#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 + yyfree((void *) b ); +} +/* 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; @@ -1599,29 +1678,125 @@ 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*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + 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; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#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; + /* 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*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* 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()" ); @@ -1635,56 +1810,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 yystr 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()" ); @@ -1694,148 +1864,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 @@ -1844,24 +2062,16 @@ 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" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif #line 258 "Scanner.l" + + diff --git a/cpp/demo/Freeze/library/expect.py b/cpp/demo/Freeze/library/expect.py index 3ace50b52cd..52b8dd0398e 100755 --- a/cpp/demo/Freeze/library/expect.py +++ b/cpp/demo/Freeze/library/expect.py @@ -16,16 +16,16 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Freeze import library -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('.* ready') @@ -34,12 +34,12 @@ client.expect('>') library.run(client, server) -print "running with collocated server" +print("running with collocated server") -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('>>> ') diff --git a/cpp/demo/Freeze/phonebook/Grammar.cpp b/cpp/demo/Freeze/phonebook/Grammar.cpp index 9d138d03042..5309aa41c35 100644 --- a/cpp/demo/Freeze/phonebook/Grammar.cpp +++ b/cpp/demo/Freeze/phonebook/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,51 +54,20 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - +/* Push parsers. */ +#define YYPUSH 0 +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_ADD_CONTACTS = 260, - TOK_FIND_CONTACTS = 261, - TOK_NEXT_FOUND_CONTACT = 262, - TOK_PRINT_CURRENT = 263, - TOK_SET_CURRENT_NAME = 264, - TOK_SET_CURRENT_ADDRESS = 265, - TOK_SET_CURRENT_PHONE = 266, - TOK_REMOVE_CURRENT = 267, - TOK_SET_EVICTOR_SIZE = 268, - TOK_SHUTDOWN = 269, - TOK_STRING = 270 - }; -#endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_ADD_CONTACTS 260 -#define TOK_FIND_CONTACTS 261 -#define TOK_NEXT_FOUND_CONTACT 262 -#define TOK_PRINT_CURRENT 263 -#define TOK_SET_CURRENT_NAME 264 -#define TOK_SET_CURRENT_ADDRESS 265 -#define TOK_SET_CURRENT_PHONE 266 -#define TOK_REMOVE_CURRENT 267 -#define TOK_SET_EVICTOR_SIZE 268 -#define TOK_SHUTDOWN 269 -#define TOK_STRING 270 - +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "Grammar.y" @@ -133,6 +101,9 @@ yyerror(const char* s) +/* Line 189 of yacc.c */ +#line 106 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -151,20 +122,44 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_ADD_CONTACTS = 260, + TOK_FIND_CONTACTS = 261, + TOK_NEXT_FOUND_CONTACT = 262, + TOK_PRINT_CURRENT = 263, + TOK_SET_CURRENT_NAME = 264, + TOK_SET_CURRENT_ADDRESS = 265, + TOK_SET_CURRENT_PHONE = 266, + TOK_REMOVE_CURRENT = 267, + TOK_SET_EVICTOR_SIZE = 268, + TOK_SHUTDOWN = 269, + TOK_STRING = 270 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 168 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 163 "Grammar.tab.c" #ifdef short # undef short @@ -239,14 +234,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -327,9 +322,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -363,12 +358,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -755,17 +750,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -799,11 +797,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1083,10 +1081,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1105,10 +1101,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1132,74 +1127,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Number of syntax errors so far. */ + int yynerrs; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1229,7 +1225,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1237,7 +1232,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1260,9 +1254,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1273,7 +1266,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1283,6 +1275,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1291,16 +1286,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1332,20 +1327,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1385,30 +1376,40 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 55 "Grammar.y" { ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 58 "Grammar.y" { ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 66 "Grammar.y" { ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 69 "Grammar.y" { ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 77 "Grammar.y" { parser->usage(); @@ -1416,6 +1417,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 81 "Grammar.y" { return 0; @@ -1423,6 +1426,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 85 "Grammar.y" { parser->addContacts((yyvsp[(2) - (3)])); @@ -1430,6 +1435,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 89 "Grammar.y" { parser->findContacts((yyvsp[(2) - (3)])); @@ -1437,6 +1444,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 93 "Grammar.y" { parser->nextFoundContact(); @@ -1444,6 +1453,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 97 "Grammar.y" { parser->printCurrent(); @@ -1451,6 +1462,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 101 "Grammar.y" { parser->setCurrentName((yyvsp[(2) - (3)])); @@ -1458,6 +1471,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 105 "Grammar.y" { parser->setCurrentAddress((yyvsp[(2) - (3)])); @@ -1465,6 +1480,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 109 "Grammar.y" { parser->setCurrentPhone((yyvsp[(2) - (3)])); @@ -1472,6 +1489,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 113 "Grammar.y" { parser->removeCurrent(); @@ -1479,6 +1498,8 @@ yyreduce: break; case 16: + +/* Line 1455 of yacc.c */ #line 117 "Grammar.y" { parser->setEvictorSize((yyvsp[(2) - (3)])); @@ -1486,6 +1507,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 121 "Grammar.y" { parser->shutdown(); @@ -1493,6 +1516,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 125 "Grammar.y" { yyerrok; @@ -1500,12 +1525,16 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 129 "Grammar.y" { ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 137 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); @@ -1514,6 +1543,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 142 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); @@ -1521,8 +1552,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1526 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 1558 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1533,7 +1565,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1598,7 +1629,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1615,7 +1646,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1672,9 +1703,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -1699,7 +1727,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1710,7 +1738,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1736,6 +1764,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 147 "Grammar.y" diff --git a/cpp/demo/Freeze/phonebook/Grammar.h b/cpp/demo/Freeze/phonebook/Grammar.h index 759d1869ca2..fb5de6918c2 100644 --- a/cpp/demo/Freeze/phonebook/Grammar.h +++ b/cpp/demo/Freeze/phonebook/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -54,30 +54,16 @@ TOK_STRING = 270 }; #endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_ADD_CONTACTS 260 -#define TOK_FIND_CONTACTS 261 -#define TOK_NEXT_FOUND_CONTACT 262 -#define TOK_PRINT_CURRENT 263 -#define TOK_SET_CURRENT_NAME 264 -#define TOK_SET_CURRENT_ADDRESS 265 -#define TOK_SET_CURRENT_PHONE 266 -#define TOK_REMOVE_CURRENT 267 -#define TOK_SET_EVICTOR_SIZE 268 -#define TOK_SHUTDOWN 269 -#define TOK_STRING 270 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/cpp/demo/Freeze/phonebook/expect.py b/cpp/demo/Freeze/phonebook/expect.py index fb8c23abd5b..bcd9808d949 100755 --- a/cpp/demo/Freeze/phonebook/expect.py +++ b/cpp/demo/Freeze/phonebook/expect.py @@ -16,16 +16,16 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Freeze import phonebook -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./server --Ice.PrintAdapterReady --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('.* ready') @@ -34,12 +34,12 @@ client.expect('>>> ') phonebook.run(client, server) -print "running with collocated server" +print("running with collocated server") -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./collocated --Freeze.Trace.Evictor=0 --Freeze.Trace.DbEnv=0') server.expect('>>> ') diff --git a/cpp/demo/Freeze/transform/expect.py b/cpp/demo/Freeze/transform/expect.py index 697b60d3578..c536511e279 100755 --- a/cpp/demo/Freeze/transform/expect.py +++ b/cpp/demo/Freeze/transform/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Freeze import transform transform.run('./create', './recreate', './read', './readnew') diff --git a/cpp/demo/Glacier2/callback/expect.py b/cpp/demo/Glacier2/callback/expect.py index b5e9633eeb9..f7430af0d59 100755 --- a/cpp/demo/Glacier2/callback/expect.py +++ b/cpp/demo/Glacier2/callback/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Glacier2 import callback server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Glacier2/chat/expect.py b/cpp/demo/Glacier2/chat/expect.py index 890960bb98b..a59a5c888c0 100755 --- a/cpp/demo/Glacier2/chat/expect.py +++ b/cpp/demo/Glacier2/chat/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') @@ -28,16 +28,16 @@ glacier2 = Util.spawn(Util.getGlacier2Router() + ' --Ice.Config=config.glacier2 glacier2.expect('Glacier2.Client ready') glacier2.expect('Glacier2.Server ready') -print "starting client 1...", +sys.stdout.write("starting client 1... ") sys.stdout.flush() client1 = Util.spawn('./client') client1.expect('user id:') client1.sendline("foo") client1.expect('password:') client1.sendline("foo") -print "ok" +print("ok") -print "starting client 2...", +sys.stdout.write("starting client 2... ") sys.stdout.flush() client2 = Util.spawn('./client') client2.expect('user id:') @@ -46,9 +46,9 @@ client2.expect('password:') client2.sendline("bar") client1.expect("bar has entered the chat room") -print "ok" +print("ok") -print "testing chat...", +sys.stdout.write("testing chat... ") sys.stdout.flush() client1.sendline("hi") client1.expect("foo says: hi") @@ -64,7 +64,7 @@ client2.expect("foo has left the chat room") client2.sendline("/quit") client2.waitTestSuccess() -print "ok" +print("ok") server.kill(signal.SIGINT) server.waitTestSuccess() diff --git a/cpp/demo/Ice/async/expect.py b/cpp/demo/Ice/async/expect.py index 4c20aa34150..4150f135175 100755 --- a/cpp/demo/Ice/async/expect.py +++ b/cpp/demo/Ice/async/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import async server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/bidir/expect.py b/cpp/demo/Ice/bidir/expect.py index fe86f7b95cc..381688e8106 100755 --- a/cpp/demo/Ice/bidir/expect.py +++ b/cpp/demo/Ice/bidir/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import bidir server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/callback/expect.py b/cpp/demo/Ice/callback/expect.py index b9e9683ea58..8ab9968f507 100755 --- a/cpp/demo/Ice/callback/expect.py +++ b/cpp/demo/Ice/callback/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import callback server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/converter/expect.py b/cpp/demo/Ice/converter/expect.py index 590cded83ac..21800dc2266 100755 --- a/cpp/demo/Ice/converter/expect.py +++ b/cpp/demo/Ice/converter/expect.py @@ -16,28 +16,28 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') client = Util.spawn('./client') client.expect('.*==>') -print "testing with conversion... ", +sys.stdout.write("testing with conversion... ") sys.stdout.flush() client.sendline('u') server.expect('Received \\(UTF-8\\): "Bonne journ\\\\351e"') client.expect('Received: "Bonne journ\\\\303\\\\251e"') -print "ok" +print("ok") -print "testing without conversion... ", +sys.stdout.write("testing without conversion... ") client.sendline('t') server.expect('Received \\(UTF-8\\): "Bonne journ\\\\303\\\\251e"') client.expect('Received: "Bonne journ\\\\351e"') -print "ok" +print("ok") client.sendline('s') server.waitTestSuccess() diff --git a/cpp/demo/Ice/hello/expect.py b/cpp/demo/Ice/hello/expect.py index 5796f363955..82b66514830 100755 --- a/cpp/demo/Ice/hello/expect.py +++ b/cpp/demo/Ice/hello/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import hello server = Util.spawn('./server --Ice.PrintAdapterReady --Ice.Warn.Connections=0') diff --git a/cpp/demo/Ice/interleaved/expect.py b/cpp/demo/Ice/interleaved/expect.py index fdf40f00260..9ec158b5dd8 100755 --- a/cpp/demo/Ice/interleaved/expect.py +++ b/cpp/demo/Ice/interleaved/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import interleaved server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/invoke/expect.py b/cpp/demo/Ice/invoke/expect.py index 78c6e0013f5..1176eadfa87 100755 --- a/cpp/demo/Ice/invoke/expect.py +++ b/cpp/demo/Ice/invoke/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import invoke server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/latency/expect.py b/cpp/demo/Ice/latency/expect.py index 2a04f308d43..bbde1cb2477 100755 --- a/cpp/demo/Ice/latency/expect.py +++ b/cpp/demo/Ice/latency/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,22 +16,21 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -print "testing ping... ", +sys.stdout.write("testing ping... ") sys.stdout.flush() client = Util.spawn('./client') client.waitTestSuccess(timeout=100) -print "ok" +print("ok") -import signal server.kill(signal.SIGINT) server.waitTestSuccess() -print client.before +print(client.before) diff --git a/cpp/demo/Ice/minimal/expect.py b/cpp/demo/Ice/minimal/expect.py index fe15c20274d..18f5823a845 100755 --- a/cpp/demo/Ice/minimal/expect.py +++ b/cpp/demo/Ice/minimal/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,21 +16,20 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -print "testing...", +sys.stdout.write("testing... ") sys.stdout.flush() client = Util.spawn('./client') client.waitTestSuccess() server.expect('Hello World!') -print "ok" +print("ok") -import signal server.kill(signal.SIGINT) -#server.waitTestSuccess() +server.waitTestFail() diff --git a/cpp/demo/Ice/multicast/expect.py b/cpp/demo/Ice/multicast/expect.py index b3b618ca5a6..57d45167330 100755 --- a/cpp/demo/Ice/multicast/expect.py +++ b/cpp/demo/Ice/multicast/expect.py @@ -16,10 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) +sys.path.append(os.path.join(path[0], "scripts")) -from demoscript import * +from demoscript import Util from demoscript.Ice import multicast multicast.run("./client", "./server") diff --git a/cpp/demo/Ice/nested/expect.py b/cpp/demo/Ice/nested/expect.py index 58814de5a0e..908827e6d1a 100755 --- a/cpp/demo/Ice/nested/expect.py +++ b/cpp/demo/Ice/nested/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import nested server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/nrvo/expect.py b/cpp/demo/Ice/nrvo/expect.py index 81acd6aa7a7..0023b1579b5 100644 --- a/cpp/demo/Ice/nrvo/expect.py +++ b/cpp/demo/Ice/nrvo/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import nrvo server = Util.spawn('./server --Ice.PrintAdapterReady') @@ -28,3 +28,5 @@ client = Util.spawn('./client') client.expect('.*==>') nrvo.run(client, server) + +server.waitTestSuccess() diff --git a/cpp/demo/Ice/plugin/expect.py b/cpp/demo/Ice/plugin/expect.py index d6d6b3d59a1..f89da1ddbec 100755 --- a/cpp/demo/Ice/plugin/expect.py +++ b/cpp/demo/Ice/plugin/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import plugin Util.addLdPath(os.getcwd()) diff --git a/cpp/demo/Ice/session/expect.py b/cpp/demo/Ice/session/expect.py index 0fe2e9f6117..f0a60cdfea7 100755 --- a/cpp/demo/Ice/session/expect.py +++ b/cpp/demo/Ice/session/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import session server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/throughput/expect.py b/cpp/demo/Ice/throughput/expect.py index b4728f315c6..49843efbc59 100755 --- a/cpp/demo/Ice/throughput/expect.py +++ b/cpp/demo/Ice/throughput/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import throughput server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/Ice/value/expect.py b/cpp/demo/Ice/value/expect.py index 82beb9d502e..f3a3b6bea9e 100755 --- a/cpp/demo/Ice/value/expect.py +++ b/cpp/demo/Ice/value/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.Ice import value server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/IceBox/hello/expect.py b/cpp/demo/IceBox/hello/expect.py index c3d2368fc78..e80bce92ad2 100755 --- a/cpp/demo/IceBox/hello/expect.py +++ b/cpp/demo/IceBox/hello/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceBox import hello # Override the service command line diff --git a/cpp/demo/IceGrid/allocate/expect.py b/cpp/demo/IceGrid/allocate/expect.py index faf14b93cdb..e861174bcf2 100755 --- a/cpp/demo/IceGrid/allocate/expect.py +++ b/cpp/demo/IceGrid/allocate/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceGrid import allocate allocate.run('./client') diff --git a/cpp/demo/IceGrid/icebox/expect.py b/cpp/demo/IceGrid/icebox/expect.py index 71bc07e36fe..d0977bd9980 100755 --- a/cpp/demo/IceGrid/icebox/expect.py +++ b/cpp/demo/IceGrid/icebox/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceGrid import icebox desc = 'application.xml' diff --git a/cpp/demo/IceGrid/replication/expect.py b/cpp/demo/IceGrid/replication/expect.py index 904462a88e7..ac41fcea230 100755 --- a/cpp/demo/IceGrid/replication/expect.py +++ b/cpp/demo/IceGrid/replication/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,27 +16,26 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * -import signal +from demoscript import Util -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db/master") Util.cleanDbDir("db/node1") Util.cleanDbDir("db/node2") Util.cleanDbDir("db/replica1") Util.cleanDbDir("db/replica2") -print "ok" +print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' -print "starting icegridnodes...", +sys.stdout.write("starting icegridnodes... ") sys.stdout.flush() master = Util.spawn(Util.getIceGridRegistry() + ' --Ice.Config=config.master --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut=') master.expect('IceGrid.Registry.Internal ready\nIceGrid.Registry.Server ready\nIceGrid.Registry.Client ready') @@ -48,15 +47,15 @@ node1 = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.node1 --Ice.Pri node1.expect('IceGrid.Node ready') node2 = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.node2 --Ice.PrintAdapterReady --Ice.StdErr= --Ice.StdOut= %s' % (args)) node2.expect('IceGrid.Node ready') -print "ok" +print("ok") -print "deploying application...", +sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.client') admin.expect('>>>') admin.sendline("application add \'application.xml\'") admin.expect('>>>') -print "ok" +print("ok") def runtest(): client = Util.spawn('./client') @@ -71,12 +70,12 @@ def runtest(): client.waitTestSuccess(timeout=1) -print "testing client...", +sys.stdout.write("testing client... ") sys.stdout.flush() runtest() -print "ok" +print("ok") -print "testing replication...", +sys.stdout.write("testing replication... ") sys.stdout.flush() admin.sendline('registry shutdown Replica1') admin.expect('>>>') @@ -86,9 +85,9 @@ admin.sendline('registry shutdown Replica2') admin.expect('>>>') replica2.waitTestSuccess() runtest() -print "ok" +print("ok") -print "completing shutdown...", +sys.stdout.write("completing shutdown... ") sys.stdout.flush() admin.sendline('node shutdown node1') admin.expect('>>>') @@ -104,4 +103,4 @@ master.waitTestSuccess() admin.sendline('exit') admin.waitTestSuccess(timeout=120) -print "ok" +print("ok") diff --git a/cpp/demo/IceGrid/secure/.gitignore b/cpp/demo/IceGrid/secure/.gitignore index 58441e933c7..ebb4189ea80 100644 --- a/cpp/demo/IceGrid/secure/.gitignore +++ b/cpp/demo/IceGrid/secure/.gitignore @@ -7,4 +7,6 @@ Hello.cpp Hello.h db/registry/* db/node/* +db/master/* +db/slave/* certs/* diff --git a/cpp/demo/IceGrid/secure/expect.py b/cpp/demo/IceGrid/secure/expect.py index 77feee84f70..0dcf1101caa 100755 --- a/cpp/demo/IceGrid/secure/expect.py +++ b/cpp/demo/IceGrid/secure/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,26 +16,25 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * -import signal +from demoscript import Util -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db/master") Util.cleanDbDir("db/slave") Util.cleanDbDir("db/node") Util.cleanDbDir("certs") -print "ok" +print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' -print "creating certificates...", +sys.stdout.write("creating certificates... ") sys.stdout.flush() makecerts = Util.spawn("python -u makecerts.py") makecerts.expect("Do you want to keep this as the CA subject name?") @@ -63,9 +62,9 @@ makecerts.sendline("y") makecerts.expect("1 out of 1 certificate requests certified, commit?") makecerts.sendline("y") makecerts.waitTestSuccess() -print "ok" +print("ok") -print "starting icegrid...", +sys.stdout.write("starting icegrid... ") sys.stdout.flush() masterProps = " --Ice.PrintAdapterReady" master = Util.spawn(Util.getIceGridRegistry() + ' --Ice.Config=config.master' + masterProps) @@ -81,18 +80,18 @@ slave.expect('IceGrid.Registry.Client ready') node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.node --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Node ready') -print "ok" +print("ok") -print "starting glacier2...", +sys.stdout.write("starting glacier2... ") sys.stdout.flush() glacier2Props = " --Ice.PrintAdapterReady --Glacier2.SessionTimeout=5" glacier2 = Util.spawn(Util.getGlacier2Router() + ' --Ice.Config=config.glacier2' + glacier2Props) glacier2.expect('Glacier2.Client ready') glacier2.expect('Glacier2.Server ready') -print "ok" +print("ok") -print "deploying application...", +sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.admin') admin.expect('>>>') @@ -100,7 +99,7 @@ admin.sendline("application add application.xml") admin.expect('>>>') admin.sendline('exit') admin.waitTestSuccess(timeout=120) -print "ok" +print("ok") def runtest(): client = Util.spawn('./client') @@ -115,12 +114,12 @@ def runtest(): client.waitTestSuccess(timeout=1) -print "testing client...", +sys.stdout.write("testing client... ") sys.stdout.flush() runtest() -print "ok" +print("ok") -print "completing shutdown...", +sys.stdout.write("completing shutdown... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.admin') @@ -144,4 +143,4 @@ admin.waitTestSuccess(timeout=120) glacier2.kill(signal.SIGINT) glacier2.waitTestSuccess() -print "ok" +print("ok") diff --git a/cpp/demo/IceGrid/secure/makecerts.py b/cpp/demo/IceGrid/secure/makecerts.py index 6d49467d33e..0b44a1f9ba9 100755 --- a/cpp/demo/IceGrid/secure/makecerts.py +++ b/cpp/demo/IceGrid/secure/makecerts.py @@ -18,18 +18,18 @@ def runIceca(args): def createCertificate(filename, cn): - print "======= Creating " + filename + " certificate =======" + print("======= Creating " + filename + " certificate =======") 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) - print - print + print("") + print("") cwd = os.getcwd() if not os.path.exists("certs") or os.path.basename(cwd) != "secure": - print "You must run this script from the secure demo directory" + print("You must run this script from the secure demo directory") sys.exit(1) os.environ["ICE_CA_HOME"] = os.path.abspath("certs") @@ -39,10 +39,10 @@ os.chdir("certs") # # First, create the certificate authority. # -print "======= Creating Certificate Authority =======" +print("======= Creating Certificate Authority =======") runIceca("init --overwrite --no-password") -print -print +print("") +print("") createCertificate("master", "Master") createCertificate("slave", "Slave") @@ -50,7 +50,7 @@ createCertificate("node", "Node") createCertificate("glacier2", "Glacier2") createCertificate("server", "Server") -print "======= Creating Java Key Store =======" +print("======= Creating Java Key Store =======") try: os.remove("certs.jks") diff --git a/cpp/demo/IceGrid/sessionActivation/expect.py b/cpp/demo/IceGrid/sessionActivation/expect.py index 7dbd6b89405..bf787cb0c50 100755 --- a/cpp/demo/IceGrid/sessionActivation/expect.py +++ b/cpp/demo/IceGrid/sessionActivation/expect.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceGrid import sessionActivation sessionActivation.run('./client') - diff --git a/cpp/demo/IceGrid/simple/expect.py b/cpp/demo/IceGrid/simple/expect.py index 426054077f5..d2bd07efe14 100755 --- a/cpp/demo/IceGrid/simple/expect.py +++ b/cpp/demo/IceGrid/simple/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceGrid import simple simple.run('./client') diff --git a/cpp/demo/IceStorm/clock/expect.py b/cpp/demo/IceStorm/clock/expect.py index bd3c080afba..fdf71c1c8bd 100755 --- a/cpp/demo/IceStorm/clock/expect.py +++ b/cpp/demo/IceStorm/clock/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.IceStorm import clock clock.run('./subscriber', './publisher') diff --git a/cpp/demo/IceStorm/counter/expect.py b/cpp/demo/IceStorm/counter/expect.py index b47e550b8f7..e441c84025f 100755 --- a/cpp/demo/IceStorm/counter/expect.py +++ b/cpp/demo/IceStorm/counter/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,16 +16,15 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * -import signal +from demoscript import Util -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") if Util.defaultHost: args = ' --IceBox.Service.IceStorm="IceStormService,34:createIceStorm --Ice.Config=config.service %s"' \ @@ -36,7 +35,7 @@ else: icestorm = Util.spawn('%s --Ice.Config=config.icebox --Ice.PrintAdapterReady %s' % (Util.getIceBox(), args)) icestorm.expect('.* ready') -print "testing single client...", +sys.stdout.write("testing single client... ") sys.stdout.flush() server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') @@ -44,27 +43,27 @@ client1 = Util.spawn('./client') client1.expect('init: 0') client1.sendline('i') client1.expect('int: 1 total: 1') -print "ok" +print("ok") -print "testing second client...", +sys.stdout.write("testing second client... ") sys.stdout.flush() client2 = Util.spawn('./client') client2.expect('init: 1') client2.sendline('i') client1.expect('int: 1 total: 2') client2.expect('int: 1 total: 2') -print "ok" +print("ok") -print "testing third client...", +sys.stdout.write("testing third client... ") client3 = Util.spawn('./client') client3.expect('init: 2') client3.sendline('d') client1.expect('int: -1 total: 1') client2.expect('int: -1 total: 1') client3.expect('int: -1 total: 1') -print "ok" +print("ok") -print "testing removing client...", +sys.stdout.write("testing removing client... ") client3.sendline('x') client3.waitTestSuccess() @@ -75,7 +74,7 @@ client1.sendline('x') client1.waitTestSuccess() client2.sendline('x') client2.waitTestSuccess() -print "ok" +print("ok") server.kill(signal.SIGINT) server.waitTestSuccess() diff --git a/cpp/demo/IceStorm/replicated/expect.py b/cpp/demo/IceStorm/replicated/expect.py index 43ba9ad873e..6815b9a5401 100755 --- a/cpp/demo/IceStorm/replicated/expect.py +++ b/cpp/demo/IceStorm/replicated/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util import time, signal desc = 'application.xml' @@ -37,32 +37,32 @@ if Util.isNoServices() or Util.isDebugBuild(): fi.close() fo.close() -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db/node") Util.cleanDbDir("db/registry") -print "ok" +print("ok") if Util.defaultHost: args = ' --IceGrid.Node.PropertiesOverride="Ice.Default.Host=127.0.0.1"' else: args = '' -print "starting icegridnode...", +sys.stdout.write("starting icegridnode... ") sys.stdout.flush() node = Util.spawn(Util.getIceGridNode() + ' --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) node.expect('IceGrid.Registry.Server ready\nIceGrid.Registry.Client ready\nIceGrid.Node ready') -print "ok" +print("ok") -print "deploying application...", +sys.stdout.write("deploying application... ") sys.stdout.flush() admin = Util.spawn(Util.getIceGridAdmin() + ' --Ice.Config=config.grid') admin.expect('>>>') admin.sendline("application add \'%s\'" %(desc)) admin.expect('>>>') -print "ok" +print("ok") -print "testing pub/sub...", +sys.stdout.write("testing pub/sub... ") sys.stdout.flush() sub = Util.spawn('./subscriber --Ice.PrintAdapterReady') @@ -80,7 +80,7 @@ pub = Util.spawn('./publisher') time.sleep(3) sub.expect('[0-9][0-9]/[0-9][0-9].*\n[0-9][0-9]/[0-9][0-9]') -print "ok" +print("ok") sub.kill(signal.SIGINT) sub.waitTestSuccess() diff --git a/cpp/demo/IceStorm/replicated2/expect.py b/cpp/demo/IceStorm/replicated2/expect.py index 82ec81f2f56..3572447bf48 100755 --- a/cpp/demo/IceStorm/replicated2/expect.py +++ b/cpp/demo/IceStorm/replicated2/expect.py @@ -16,18 +16,18 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util import time, signal -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db1"); Util.cleanDbDir("db2") Util.cleanDbDir("db3") -print "ok" +print("ok") if Util.defaultHost: a1 = ' --IceBox.Service.IceStorm="IceStormService,34:createIceStorm --Ice.Config=config.s1 %s"' \ @@ -41,7 +41,7 @@ else: a2 = '' a3 = '' -print "starting replicas...", +sys.stdout.write("starting replicas... ") sys.stdout.flush() ib1 = Util.spawn('%s --Ice.Config=config.ib1 --Ice.PrintAdapterReady %s' % (Util.getIceBox(), a1)) ib1.expect('.* ready') @@ -49,13 +49,13 @@ ib2 = Util.spawn('%s --Ice.Config=config.ib2 --Ice.PrintAdapterReady %s' % (Util ib2.expect('.* ready') ib3 = Util.spawn('%s --Ice.Config=config.ib3 --Ice.PrintAdapterReady %s' % (Util.getIceBox(), a3)) ib3.expect('.* ready') -print "ok" +print("ok") ib3.expect('Election: node 2: reporting for duty in group 2:[-0-9A-Fa-f]+ as coordinator' , timeout=20) ib2.expect('Election: node 1: reporting for duty in group 2:[-0-9A-Fa-f]+ with coordinator 2', timeout=20) ib1.expect('Election: node 0: reporting for duty in group 2:[-0-9A-Fa-f]+ with coordinator 2', timeout=20) -print "testing pub/sub...", +sys.stdout.write("testing pub/sub... ") sys.stdout.flush() sub = Util.spawn('./subscriber --Ice.PrintAdapterReady') @@ -69,9 +69,9 @@ pub = Util.spawn('./publisher') time.sleep(3) sub.expect('[0-9][0-9]/[0-9][0-9].*\n[0-9][0-9]/[0-9][0-9]') -print "ok" +print("ok") -print "shutting down...", +sys.stdout.write("shutting down... ") sys.stdout.flush() sub.kill(signal.SIGINT) sub.waitTestSuccess() @@ -88,4 +88,8 @@ admin = Util.spawn(Util.getIceBoxAdmin() + ' --Ice.Config=config.ib2 shutdown') admin.waitTestSuccess() admin = Util.spawn(Util.getIceBoxAdmin() + ' --Ice.Config=config.ib3 shutdown') admin.waitTestSuccess() -print "ok" + +ib1.waitTestSuccess() +ib2.waitTestSuccess() +ib3.waitTestSuccess() +print("ok") diff --git a/cpp/demo/IceUtil/workqueue/expect.py b/cpp/demo/IceUtil/workqueue/expect.py index a5d7d080eed..558b105a8ed 100755 --- a/cpp/demo/IceUtil/workqueue/expect.py +++ b/cpp/demo/IceUtil/workqueue/expect.py @@ -16,15 +16,15 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util server = Util.spawn('./workqueue') server.expect('Pushing work items') -print "testing...", +sys.stdout.write("testing... ") sys.stdout.flush() server.expect('work item: item1') server.expect('work item: item2') @@ -32,4 +32,4 @@ server.expect('work item: item3') server.expect('work item: item4') server.expect('work item: item5') server.waitTestSuccess(timeout=10) -print "ok" +print("ok") diff --git a/cpp/demo/book/evictor_filesystem/Grammar.cpp b/cpp/demo/book/evictor_filesystem/Grammar.cpp index 2104fad405b..e6a9689518e 100644 --- a/cpp/demo/book/evictor_filesystem/Grammar.cpp +++ b/cpp/demo/book/evictor_filesystem/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,49 +54,20 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - - +/* Push parsers. */ +#define YYPUSH 0 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_STRING = 260, - TOK_LIST = 261, - TOK_LIST_RECURSIVE = 262, - TOK_CREATE_FILE = 263, - TOK_CREATE_DIR = 264, - TOK_PWD = 265, - TOK_CD = 266, - TOK_CAT = 267, - TOK_WRITE = 268, - TOK_RM = 269 - }; -#endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_STRING 260 -#define TOK_LIST 261 -#define TOK_LIST_RECURSIVE 262 -#define TOK_CREATE_FILE 263 -#define TOK_CREATE_DIR 264 -#define TOK_PWD 265 -#define TOK_CD 266 -#define TOK_CAT 267 -#define TOK_WRITE 268 -#define TOK_RM 269 +/* Pull parsers. */ +#define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "Grammar.y" @@ -130,6 +100,9 @@ yyerror(const char* s) +/* Line 189 of yacc.c */ +#line 105 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -148,20 +121,43 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 165 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 161 "Grammar.tab.c" #ifdef short # undef short @@ -236,14 +232,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -324,9 +320,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -360,12 +356,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -740,17 +736,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -784,11 +783,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1068,10 +1067,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1090,10 +1087,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1117,74 +1113,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + /* Number of syntax errors so far. */ + int yynerrs; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1214,7 +1211,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1222,7 +1218,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1245,9 +1240,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1258,7 +1252,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1268,6 +1261,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1276,16 +1272,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1317,20 +1313,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1370,30 +1362,40 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 53 "Grammar.y" { ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 56 "Grammar.y" { ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 64 "Grammar.y" { ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 67 "Grammar.y" { ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 75 "Grammar.y" { parser->usage(); @@ -1401,6 +1403,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 79 "Grammar.y" { return 0; @@ -1408,6 +1412,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 83 "Grammar.y" { parser->list(false); @@ -1415,6 +1421,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 87 "Grammar.y" { parser->list(true); @@ -1422,6 +1430,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 91 "Grammar.y" { parser->createFile((yyvsp[(2) - (2)])); @@ -1429,6 +1439,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 95 "Grammar.y" { parser->createDir((yyvsp[(2) - (2)])); @@ -1436,6 +1448,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 99 "Grammar.y" { parser->pwd(); @@ -1443,6 +1457,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 103 "Grammar.y" { parser->cd("/"); @@ -1450,6 +1466,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 107 "Grammar.y" { parser->cd((yyvsp[(2) - (2)]).front()); @@ -1457,6 +1475,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 111 "Grammar.y" { parser->cat((yyvsp[(2) - (2)]).front()); @@ -1464,6 +1484,8 @@ yyreduce: break; case 16: + +/* Line 1455 of yacc.c */ #line 115 "Grammar.y" { parser->write((yyvsp[(2) - (2)])); @@ -1471,6 +1493,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 119 "Grammar.y" { parser->destroy((yyvsp[(2) - (2)])); @@ -1478,6 +1502,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 123 "Grammar.y" { parser->usage(); @@ -1486,12 +1512,16 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 128 "Grammar.y" { ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 136 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); @@ -1500,6 +1530,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 141 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); @@ -1507,8 +1539,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1512 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 1545 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1519,7 +1552,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1584,7 +1616,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1601,7 +1633,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1658,9 +1690,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -1685,7 +1714,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1696,7 +1725,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1722,6 +1751,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 146 "Grammar.y" diff --git a/cpp/demo/book/evictor_filesystem/Grammar.h b/cpp/demo/book/evictor_filesystem/Grammar.h index b5b8e41ade4..ca5a99150f6 100644 --- a/cpp/demo/book/evictor_filesystem/Grammar.h +++ b/cpp/demo/book/evictor_filesystem/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -53,29 +53,16 @@ TOK_RM = 269 }; #endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_STRING 260 -#define TOK_LIST 261 -#define TOK_LIST_RECURSIVE 262 -#define TOK_CREATE_FILE 263 -#define TOK_CREATE_DIR 264 -#define TOK_PWD 265 -#define TOK_CD 266 -#define TOK_CAT 267 -#define TOK_WRITE 268 -#define TOK_RM 269 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/cpp/demo/book/evictor_filesystem/expect.py b/cpp/demo/book/evictor_filesystem/expect.py index 19d2ab5e4b7..1b01a6bbbe5 100755 --- a/cpp/demo/book/evictor_filesystem/expect.py +++ b/cpp/demo/book/evictor_filesystem/expect.py @@ -16,16 +16,16 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.book import evictor_filesystem -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') diff --git a/cpp/demo/book/lifecycle/Grammar.cpp b/cpp/demo/book/lifecycle/Grammar.cpp index 2104fad405b..e6a9689518e 100644 --- a/cpp/demo/book/lifecycle/Grammar.cpp +++ b/cpp/demo/book/lifecycle/Grammar.cpp @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,49 +54,20 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - - +/* Push parsers. */ +#define YYPUSH 0 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_HELP = 258, - TOK_EXIT = 259, - TOK_STRING = 260, - TOK_LIST = 261, - TOK_LIST_RECURSIVE = 262, - TOK_CREATE_FILE = 263, - TOK_CREATE_DIR = 264, - TOK_PWD = 265, - TOK_CD = 266, - TOK_CAT = 267, - TOK_WRITE = 268, - TOK_RM = 269 - }; -#endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_STRING 260 -#define TOK_LIST 261 -#define TOK_LIST_RECURSIVE 262 -#define TOK_CREATE_FILE 263 -#define TOK_CREATE_DIR 264 -#define TOK_PWD 265 -#define TOK_CD 266 -#define TOK_CAT 267 -#define TOK_WRITE 268 -#define TOK_RM 269 +/* Pull parsers. */ +#define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "Grammar.y" @@ -130,6 +100,9 @@ yyerror(const char* s) +/* Line 189 of yacc.c */ +#line 105 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -148,20 +121,43 @@ yyerror(const char* s) # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_HELP = 258, + TOK_EXIT = 259, + TOK_STRING = 260, + TOK_LIST = 261, + TOK_LIST_RECURSIVE = 262, + TOK_CREATE_FILE = 263, + TOK_CREATE_DIR = 264, + TOK_PWD = 265, + TOK_CD = 266, + TOK_CAT = 267, + TOK_WRITE = 268, + TOK_RM = 269 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 165 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 161 "Grammar.tab.c" #ifdef short # undef short @@ -236,14 +232,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -324,9 +320,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -360,12 +356,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -740,17 +736,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -784,11 +783,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1068,10 +1067,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1090,10 +1087,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1117,74 +1113,75 @@ yyparse () #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + /* Number of syntax errors so far. */ + int yynerrs; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1214,7 +1211,6 @@ int yynerrs; YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1222,7 +1218,6 @@ int yynerrs; yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1245,9 +1240,8 @@ int yynerrs; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1258,7 +1252,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1268,6 +1261,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1276,16 +1272,16 @@ int yynerrs; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1317,20 +1313,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1370,30 +1362,40 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 53 "Grammar.y" { ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 56 "Grammar.y" { ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 64 "Grammar.y" { ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 67 "Grammar.y" { ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 75 "Grammar.y" { parser->usage(); @@ -1401,6 +1403,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 79 "Grammar.y" { return 0; @@ -1408,6 +1412,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 83 "Grammar.y" { parser->list(false); @@ -1415,6 +1421,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 87 "Grammar.y" { parser->list(true); @@ -1422,6 +1430,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 91 "Grammar.y" { parser->createFile((yyvsp[(2) - (2)])); @@ -1429,6 +1439,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 95 "Grammar.y" { parser->createDir((yyvsp[(2) - (2)])); @@ -1436,6 +1448,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 99 "Grammar.y" { parser->pwd(); @@ -1443,6 +1457,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 103 "Grammar.y" { parser->cd("/"); @@ -1450,6 +1466,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 107 "Grammar.y" { parser->cd((yyvsp[(2) - (2)]).front()); @@ -1457,6 +1475,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 111 "Grammar.y" { parser->cat((yyvsp[(2) - (2)]).front()); @@ -1464,6 +1484,8 @@ yyreduce: break; case 16: + +/* Line 1455 of yacc.c */ #line 115 "Grammar.y" { parser->write((yyvsp[(2) - (2)])); @@ -1471,6 +1493,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 119 "Grammar.y" { parser->destroy((yyvsp[(2) - (2)])); @@ -1478,6 +1502,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 123 "Grammar.y" { parser->usage(); @@ -1486,12 +1512,16 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 128 "Grammar.y" { ;} break; case 20: + +/* Line 1455 of yacc.c */ #line 136 "Grammar.y" { (yyval) = (yyvsp[(2) - (2)]); @@ -1500,6 +1530,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 141 "Grammar.y" { (yyval) = (yyvsp[(1) - (1)]); @@ -1507,8 +1539,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1512 "Grammar.tab.c" + +/* Line 1455 of yacc.c */ +#line 1545 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1519,7 +1552,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1584,7 +1616,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1601,7 +1633,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1658,9 +1690,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -1685,7 +1714,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1696,7 +1725,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1722,6 +1751,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 146 "Grammar.y" diff --git a/cpp/demo/book/lifecycle/Grammar.h b/cpp/demo/book/lifecycle/Grammar.h index b5b8e41ade4..ca5a99150f6 100644 --- a/cpp/demo/book/lifecycle/Grammar.h +++ b/cpp/demo/book/lifecycle/Grammar.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -53,29 +53,16 @@ TOK_RM = 269 }; #endif -/* Tokens. */ -#define TOK_HELP 258 -#define TOK_EXIT 259 -#define TOK_STRING 260 -#define TOK_LIST 261 -#define TOK_LIST_RECURSIVE 262 -#define TOK_CREATE_FILE 263 -#define TOK_CREATE_DIR 264 -#define TOK_PWD 265 -#define TOK_CD 266 -#define TOK_CAT 267 -#define TOK_WRITE 268 -#define TOK_RM 269 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif + diff --git a/cpp/demo/book/lifecycle/expect.py b/cpp/demo/book/lifecycle/expect.py index 5993eeb23b6..fc5bdb408f3 100755 --- a/cpp/demo/book/lifecycle/expect.py +++ b/cpp/demo/book/lifecycle/expect.py @@ -16,10 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.book import lifecycle server = Util.spawn('./server --Ice.PrintAdapterReady') diff --git a/cpp/demo/book/map_filesystem/expect.py b/cpp/demo/book/map_filesystem/expect.py index 9d1609ad4ce..59cdb7ce2d2 100755 --- a/cpp/demo/book/map_filesystem/expect.py +++ b/cpp/demo/book/map_filesystem/expect.py @@ -16,16 +16,16 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * +from demoscript import Util from demoscript.book import map_filesystem -print "cleaning databases...", +sys.stdout.write("cleaning databases... ") sys.stdout.flush() Util.cleanDbDir("db") -print "ok" +print("ok") server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') diff --git a/cpp/demo/book/printer/expect.py b/cpp/demo/book/printer/expect.py index 54cef43522f..12670c9d14f 100755 --- a/cpp/demo/book/printer/expect.py +++ b/cpp/demo/book/printer/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,20 +16,19 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * -import signal +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -print "testing...", +sys.stdout.write("testing... ") sys.stdout.flush() client = Util.spawn('./client') client.waitTestSuccess() server.expect('Hello World!') server.kill(signal.SIGTERM) server.waitTestSuccess(-signal.SIGTERM) -print "ok" +print("ok") diff --git a/cpp/demo/book/simple_filesystem/expect.py b/cpp/demo/book/simple_filesystem/expect.py index 07f8c64905d..a2a9e91955d 100755 --- a/cpp/demo/book/simple_filesystem/expect.py +++ b/cpp/demo/book/simple_filesystem/expect.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import sys, os +import sys, os, signal path = [ ".", "..", "../..", "../../..", "../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -16,21 +16,19 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] if len(path) == 0: - raise "can't find toplevel directory!" + raise RuntimeError("can't find toplevel directory!") sys.path.append(path[0]) -from demoscript import * - -import signal +from demoscript import Util server = Util.spawn('./server --Ice.PrintAdapterReady') server.expect('.* ready') -print "testing...", +sys.stdout.write("testing... ") sys.stdout.flush() client = Util.spawn('./client') client.expect('Contents of root directory:\n.*Down to a sunless sea.') client.waitTestSuccess() server.kill(signal.SIGINT) server.waitTestSuccess() -print "ok" +print("ok") diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 7b62ef2970a..899b859a423 100755 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -240,7 +240,7 @@ getDictLookup(const ContainedPtr& cont, const string& suffix = string()) scope = package + "." + scope; } - return "_M_" + scope + "__dict__.has_key('" + suffix + Slice::Python::fixIdent(cont->name()) + "')"; + return "'" + suffix + Slice::Python::fixIdent(cont->name()) + "' not in _M_" + scope + "__dict__"; } // @@ -383,7 +383,7 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p) string scoped = p->scoped(); if(_classHistory.count(scoped) == 0) { - _out << sp << nl << "if not " << getDictLookup(p) << ':'; + _out << sp << nl << "if " << getDictLookup(p) << ':'; _out.inc(); string type = getAbsolute(p, "_t_"); _out << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')"; @@ -415,7 +415,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // // Define the class. // - _out << sp << nl << "if not " << getDictLookup(p) << ':'; + _out << sp << nl << "if " << getDictLookup(p) << ':'; _out.inc(); _out << nl << "_M_" << abs << " = Ice.createTempClass()"; _out << nl << "class " << name << '('; @@ -472,7 +472,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) { if(isAbstract) { - _out << nl << "if __builtin__.type(self) == _M_" << abs << ':'; + _out << nl << "if Ice.getType(self) == _M_" << abs << ':'; _out.inc(); _out << nl << "raise RuntimeError('" << abs << " is an abstract class')"; _out.dec(); @@ -1001,7 +1001,7 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p) string abs = getAbsolute(p); string name = fixIdent(p->name()); - _out << sp << nl << "if not " << getDictLookup(p) << ':'; + _out << sp << nl << "if " << getDictLookup(p) << ':'; _out.inc(); _out << nl << "_M_" << abs << " = Ice.createTempClass()"; _out << nl << "class " << name << '('; @@ -1164,7 +1164,7 @@ Slice::Python::CodeVisitor::visitStructStart(const StructPtr& p) } } - _out << sp << nl << "if not " << getDictLookup(p) << ':'; + _out << sp << nl << "if " << getDictLookup(p) << ':'; _out.inc(); _out << nl << "_M_" << abs << " = Ice.createTempClass()"; _out << nl << "class " << name << "(object):"; @@ -1342,7 +1342,7 @@ Slice::Python::CodeVisitor::visitSequence(const SequencePtr& p) // Emit the type information. // string scoped = p->scoped(); - _out << sp << nl << "if not " << getDictLookup(p, "_t_") << ':'; + _out << sp << nl << "if " << getDictLookup(p, "_t_") << ':'; _out.inc(); if(isCustom) { @@ -1369,7 +1369,7 @@ Slice::Python::CodeVisitor::visitDictionary(const DictionaryPtr& p) // Emit the type information. // string scoped = p->scoped(); - _out << sp << nl << "if not " << getDictLookup(p, "_t_") << ':'; + _out << sp << nl << "if " << getDictLookup(p, "_t_") << ':'; _out.inc(); _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineDictionary('" << scoped << "', "; writeMetaData(p->getMetaData()); @@ -1391,7 +1391,7 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p) EnumeratorList::iterator q; int i; - _out << sp << nl << "if not " << getDictLookup(p) << ':'; + _out << sp << nl << "if " << getDictLookup(p) << ':'; _out.inc(); _out << nl << "_M_" << abs << " = Ice.createTempClass()"; _out << nl << "class " << name << "(object):"; @@ -1716,7 +1716,7 @@ Slice::Python::CodeVisitor::writeHash(const string& name, const TypePtr& p, int& return; } - _out << nl << "_h = 5 * _h + __builtin__.hash(" << name << ")"; + _out << nl << "_h = 5 * _h + Ice.getHash(" << name << ")"; } void @@ -2208,7 +2208,7 @@ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector Slice::Python::MetaDataVisitor visitor; un->visit(&visitor, false); - out << nl << "import Ice, IcePy, __builtin__"; + out << nl << "import Ice, IcePy"; if(!all) { diff --git a/cpp/test/Freeze/complex/Grammar.cpp b/cpp/test/Freeze/complex/Grammar.cpp index ba6b0d6bee4..b77c4a3fe56 100644 --- a/cpp/test/Freeze/complex/Grammar.cpp +++ b/cpp/test/Freeze/complex/Grammar.cpp @@ -1,30 +1,39 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* A Bison parser, made by GNU Bison 2.4.1. */ - This program is free software; you can redistribute it and/or modify +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -36,32 +45,29 @@ /* Identify Bison output. */ #define YYBISON 1 +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 - +/* Push parsers. */ +#define YYPUSH 0 +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_NUMBER = 258 - }; -#endif -#define TOK_NUMBER 258 - +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "Grammar.y" @@ -96,6 +102,9 @@ yyerror(const char* s) +/* Line 189 of yacc.c */ +#line 107 "Grammar.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 @@ -109,70 +118,202 @@ yyerror(const char* s) # define YYERROR_VERBOSE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_NUMBER = 258 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 214 of yacc.c. */ -#line 126 "Grammar.tab.c" +/* Line 264 of yacc.c */ +#line 152 "Grammar.tab.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif -# ifndef YYFREE -# define YYFREE free +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif -# ifndef YYMALLOC -# define YYMALLOC malloc +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid # endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# endif -# else -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif +# else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -180,24 +321,24 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ - register YYSIZE_T yyi; \ + YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -206,48 +347,42 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 6 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 11 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 8 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 3 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 6 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 12 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 258 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -280,28 +415,28 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned char yyprhs[] = +static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 11, 15 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { 9, 0, -1, 10, -1, 3, -1, 10, 4, 10, -1, 5, 10, 6, -1, 10, 7, 10, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned char yyrline[] = +static const yytype_uint8 yyrline[] = { 0, 42, 42, 49, 53, 57, 61 }; #endif -#if YYDEBUG || YYERROR_VERBOSE -/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_NUMBER", "'+'", "'('", "')'", "'*'", @@ -312,20 +447,20 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 43, 40, 41, 42 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 8, 9, 10, 10, 10, 10 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 3, 3, 3 }; @@ -333,14 +468,14 @@ static const unsigned char yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { 0, 3, 0, 0, 2, 0, 1, 0, 0, 5, 4, 6 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { -1, 3, 4 }; @@ -348,14 +483,14 @@ static const yysigned_char yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -4 -static const yysigned_char yypact[] = +static const yytype_int8 yypact[] = { 6, -4, 6, 2, 3, -3, -4, 6, 6, -4, 3, 3 }; /* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = +static const yytype_int8 yypgoto[] = { -4, -4, -2 }; @@ -365,13 +500,13 @@ static const yysigned_char yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 -static const unsigned char yytable[] = +static const yytype_uint8 yytable[] = { 5, 7, 6, 9, 8, 10, 11, 7, 0, 1, 8, 2 }; -static const yysigned_char yycheck[] = +static const yytype_int8 yycheck[] = { 2, 4, 0, 6, 7, 7, 8, 4, -1, 3, 7, 5 @@ -379,28 +514,12 @@ static const yysigned_char yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { 0, 3, 5, 9, 10, 10, 0, 4, 7, 6, 10, 10 }; -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) @@ -426,30 +545,63 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up");\ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) + #define YYTERROR 1 #define YYERRCODE 256 -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). */ +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - ((Current).first_line = (Rhs)[1].first_line, \ - (Current).first_column = (Rhs)[1].first_column, \ - (Current).last_line = (Rhs)[N].last_line, \ - (Current).last_column = (Rhs)[N].last_column) +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) #endif + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM @@ -470,43 +622,100 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YYDSYMPRINT(Args) \ -do { \ - if (yydebug) \ - yysymprint Args; \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) -# define YYDSYMPRINTF(Title, Token, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Token, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short *bottom, short *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - short *bottom; - short *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -514,45 +723,52 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; - unsigned int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) -# define YYDSYMPRINT(Args) -# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ @@ -567,13 +783,9 @@ int yydebug; if the built-in stack extension method is used). Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ -#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 -# undef YYMAXDEPTH -#endif - #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif @@ -583,45 +795,47 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - register const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { - register char *yyd = yydest; - register const char *yys = yysrc; + char *yyd = yydest; + const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; @@ -631,84 +845,204 @@ yystpcpy (yydest, yysrc) # endif # endif -#endif /* !YYERROR_VERBOSE */ +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } - + if (! yyres) + return yystrlen (yystr); -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ + return yystpcpy (yyres, yystr) - yyres; +} +# endif -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) - { - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); -# ifdef YYPRINT - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - } + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - switch (yytype) { - default: - break; + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yydestruct (int yytype, YYSTYPE *yyvaluep) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yytype, yyvaluep) +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: - break; + break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -719,20 +1053,23 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else @@ -742,68 +1079,75 @@ yyparse () #endif #endif { - /* The lookahead symbol. */ +/* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; + /* Number of syntax errors so far. */ + int yynerrs; - register int yystate; - register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; - register short *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - register YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK (yyvsp--, yyssp--) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -814,8 +1158,7 @@ int yynerrs; `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -828,21 +1171,19 @@ int yynerrs; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", + yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -850,24 +1191,23 @@ int yynerrs; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE - goto yyoverflowlab; + goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyoverflowlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { - short *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -878,7 +1218,6 @@ int yynerrs; yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -888,6 +1227,9 @@ int yynerrs; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -895,12 +1237,10 @@ int yynerrs; `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -922,7 +1262,7 @@ yybackup: else { yytoken = YYTRANSLATE (yychar); - YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to @@ -939,25 +1279,20 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -993,55 +1328,64 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 43 "Grammar.y" { - parser->setResult(yyval); + parser->setResult((yyval)); ;} break; case 3: + +/* Line 1455 of yacc.c */ #line 50 "Grammar.y" { - yyval = yyvsp[0]; + (yyval) = (yyvsp[(1) - (1)]); ;} break; case 4: + +/* Line 1455 of yacc.c */ #line 54 "Grammar.y" { - yyval = new Complex::AddNodeI(yyvsp[-2], yyvsp[0]); + (yyval) = new Complex::AddNodeI((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; case 5: + +/* Line 1455 of yacc.c */ #line 58 "Grammar.y" { - yyval = yyvsp[-1]; + (yyval) = (yyvsp[(2) - (3)]); ;} break; case 6: + +/* Line 1455 of yacc.c */ #line 62 "Grammar.y" { - yyval = new Complex::MultiplyNodeI(yyvsp[-2], yyvsp[0]); + (yyval) = new Complex::MultiplyNodeI((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); ;} break; - } - -/* Line 1000 of yacc.c. */ -#line 1035 "Grammar.tab.c" - - yyvsp -= yylen; - yyssp -= yylen; +/* Line 1455 of yacc.c */ +#line 1379 "Grammar.tab.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1065,66 +1409,41 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - YYSIZE_T yysize = 0; - int yytype = YYTRANSLATE (yychar); - const char* yyprefix; - char *yymsg; - int yyx; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 0; - - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else { - yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); - yycount += 1; - if (yycount == 5) - { - yysize = 0; - break; - } + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } - yysize += (sizeof ("syntax error, unexpected ") - + yystrlen (yytname[yytype])); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) - { - char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); - yyp = yystpcpy (yyp, yytname[yytype]); - - if (yycount < 5) - { - yyprefix = ", expecting "; - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - yyp = yystpcpy (yyp, yyprefix); - yyp = yystpcpy (yyp, yytname[yyx]); - yyprefix = " or "; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - yyerror ("syntax error; also virtual memory exhausted"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror ("syntax error"); + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif } @@ -1135,25 +1454,16 @@ yyerrlab: error, discard it. */ if (yychar <= YYEOF) - { - /* If at end of input, pop the error token, - then the rest of the stack, then return failure. */ + { + /* Return failure if at end of input. */ if (yychar == YYEOF) - for (;;) - { - YYPOPSTACK; - if (yyssp == yyss) - YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[*yyssp], yyvsp); - } - } + YYABORT; + } else { - YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); - yydestruct (yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; - } } @@ -1167,15 +1477,17 @@ yyerrlab: `---------------------------------------------------*/ yyerrorlab: -#ifdef __GNUC__ - /* Pacify GCC when the user code never invokes YYERROR and the label - yyerrorlab therefore never appears in user code. */ - if (0) + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) goto yyerrorlab; -#endif - yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -1204,21 +1516,20 @@ yyerrlab1: if (yyssp == yyss) YYABORT; - YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); - yydestruct (yystos[yystate], yyvsp); - YYPOPSTACK; + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - - YYDPRINTF ((stderr, "Shifting error token, ")); - *++yyvsp = yylval; + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; goto yynewstate; @@ -1237,25 +1548,45 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow -/*----------------------------------------------. -| yyoverflowlab -- parser overflow comes here. | -`----------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } + +/* Line 1675 of yacc.c */ #line 67 "Grammar.y" diff --git a/cpp/test/Freeze/complex/Grammar.h b/cpp/test/Freeze/complex/Grammar.h index ff8b73a45bb..b7f7c2131d8 100644 --- a/cpp/test/Freeze/complex/Grammar.h +++ b/cpp/test/Freeze/complex/Grammar.h @@ -1,27 +1,37 @@ -/* A Bison parser, made by GNU Bison 1.875c. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* A Bison parser, made by GNU Bison 2.4.1. */ - This program is free software; you can redistribute it and/or modify +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -32,19 +42,16 @@ TOK_NUMBER = 258 }; #endif -#define TOK_NUMBER 258 - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - diff --git a/cpp/test/Freeze/complex/run.py b/cpp/test/Freeze/complex/run.py index deae63146e1..86316dce547 100755 --- a/cpp/test/Freeze/complex/run.py +++ b/cpp/test/Freeze/complex/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil testdir = os.path.dirname(os.path.abspath(__file__)) @@ -33,15 +33,17 @@ client = os.path.join(os.getcwd(), "client") if TestUtil.appverifier: TestUtil.setAppVerifierSettings([client]) -print "starting populate...", +sys.stdout.write("starting populate... ") +sys.stdout.flush() populateProc = TestUtil.startClient(client, ' --dbdir "%s" populate' % os.getcwd(), startReader = False) -print "ok" +print("ok") populateProc.startReader() populateProc.waitTestSuccess() -print "starting verification client...", +sys.stdout.write("starting verification client... ") +sys.stdout.flush() clientProc = TestUtil.startClient(client, ' --dbdir "%s" validate' % os.getcwd(), startReader = False) -print "ok" +print("ok") clientProc.startReader() clientProc.waitTestSuccess() diff --git a/cpp/test/Freeze/dbmap/run.py b/cpp/test/Freeze/dbmap/run.py index f1809a84d4d..89ea23b3d22 100755 --- a/cpp/test/Freeze/dbmap/run.py +++ b/cpp/test/Freeze/dbmap/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) diff --git a/cpp/test/Freeze/evictor/run.py b/cpp/test/Freeze/evictor/run.py index abac1bca7f4..b4b226b2727 100755 --- a/cpp/test/Freeze/evictor/run.py +++ b/cpp/test/Freeze/evictor/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) @@ -26,4 +26,3 @@ TestUtil.cleanDbDir(dbdir) 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/Freeze/fileLock/run.py b/cpp/test/Freeze/fileLock/run.py index 423aa1e2987..621efd35f3d 100755 --- a/cpp/test/Freeze/fileLock/run.py +++ b/cpp/test/Freeze/fileLock/run.py @@ -16,11 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "testing Freeze file lock...", +sys.stdout.write("testing Freeze file lock... ") sys.stdout.flush() client = os.path.join(os.getcwd(), "client") @@ -46,4 +46,4 @@ clientExe.sendline('go') clientExe.expect('File lock released.') clientExe.waitTestSuccess() -print "ok" +print("ok") diff --git a/cpp/test/FreezeScript/dbmap/run.py b/cpp/test/FreezeScript/dbmap/run.py index 4cee776f276..da971d3385c 100755 --- a/cpp/test/FreezeScript/dbmap/run.py +++ b/cpp/test/FreezeScript/dbmap/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * - + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil transformdb = '%s' % os.path.join(TestUtil.getCppBinDir(), "transformdb") @@ -52,10 +51,10 @@ for file in os.listdir(os.path.join(os.getcwd(), "fail")): regex2 = re.compile(r"^.*transf(ormdb|~1)(\.exe)?", re.IGNORECASE) -print "testing error detection...", +sys.stdout.write("testing error detection... ") sys.stdout.flush() if TestUtil.debug: - print + sys.stdout.write("\n") files.sort() for oldfile in files: @@ -71,7 +70,7 @@ for oldfile in files: os.path.join(os.getcwd(), "fail", newfile) + '" -o tmp.xml --key string --value ' + value if TestUtil.debug: - print command + print(command) p = TestUtil.runCommand(command) (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) @@ -79,36 +78,40 @@ for oldfile in files: lines1 = stderr.readlines() lines2 = open(os.path.join(os.getcwd(), "fail", oldfile.replace("_old.ice", ".err")), "r").readlines() if len(lines1) != len(lines2): - print "failed! (1)" + print("failed! (1)") sys.exit(1) i = 0 while i < len(lines1): - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() + if sys.version_info[0] == 2: + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + else: + line1 = regex2.sub("", lines1[i].decode("utf-8")).strip() + line2 = regex2.sub("", lines2[i]).strip() if line1 != line2: - print "failed! (2)" - print "line1 = " + line1 - print "line2 = " + line2 + print("failed! (2)") + print("line1 = " + line1) + print("line2 = " + line2) # sys.exit(1) i = i + 1 -print "ok" +print("ok") -print "creating test database...", +sys.stdout.write("creating test database... ") sys.stdout.flush() makedb = '"%s" "%s"'% (os.path.join(os.getcwd(), "makedb"), os.getcwd()) proc = TestUtil.spawn(makedb) proc.waitTestSuccess() -print "ok" +print("ok") testold = os.path.join(os.getcwd(), "TestOld.ice") testnew = os.path.join(os.getcwd(), "TestNew.ice") initxml = os.path.join(os.getcwd(), "init.xml") checkxml = os.path.join(os.getcwd(), "check.xml") -print "initializing test database...", +sys.stdout.write("initializing test database... ") sys.stdout.flush() command = '"' + transformdb + '" --old "' + testold + '" --new "' + testold + '" -f "' + initxml + '" "' + dbdir + \ @@ -116,9 +119,9 @@ command = '"' + transformdb + '" --old "' + testold + '" --new "' + testold + '" TestUtil.spawn(command).waitTestSuccess() -print "ok" +print("ok") -print "executing default transformations...", +sys.stdout.write("executing default transformations... ") sys.stdout.flush() command = '"' + transformdb + '" --old "' + testold + '" --new "' + testnew + '" --key int --value ::Test::S "' + init_dbdir + \ @@ -126,9 +129,9 @@ command = '"' + transformdb + '" --old "' + testold + '" --new "' + testnew + '" TestUtil.spawn(command).waitTestSuccess() -print "ok" +print("ok") -print "validating database...", +sys.stdout.write("validating database... ") sys.stdout.flush() command = '"' + transformdb + '" --old "' + testnew + '" --new "' + testnew + '" -f "' + checkxml + '" "' + check_dbdir + \ @@ -136,7 +139,7 @@ command = '"' + transformdb + '" --old "' + testnew + '" --new "' + testnew + '" TestUtil.spawn(command).waitTestSuccess() -print "ok" +print("ok") if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd([transformdb]) diff --git a/cpp/test/FreezeScript/evictor/run.py b/cpp/test/FreezeScript/evictor/run.py index 5f4391559dd..a197c80fec4 100755 --- a/cpp/test/FreezeScript/evictor/run.py +++ b/cpp/test/FreezeScript/evictor/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel os.getcwd()!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel os.getcwd()!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil transformdb = os.path.join(TestUtil.getCppBinDir(), "transformdb") @@ -38,36 +38,36 @@ if os.path.exists(tmp_dbdir): shutil.rmtree(tmp_dbdir) os.mkdir(tmp_dbdir) -print "creating test database...", +sys.stdout.write("creating test database... ") sys.stdout.flush() makedb = '"%s" "%s"' % (os.path.join(os.getcwd(), "makedb"), os.getcwd()) proc = TestUtil.spawn(makedb) proc.waitTestSuccess() -print "ok" +print("ok") testold = os.path.join(os.getcwd(), "TestOld.ice") testnew = os.path.join(os.getcwd(), "TestNew.ice") transformxml = os.path.join(os.getcwd(), "transform.xml") checkxml = os.path.join(os.getcwd(), "check.xml") -print "executing evictor transformations...", +sys.stdout.write("executing evictor transformations... ") sys.stdout.flush() command = '"' + transformdb + '" -e -p --old "' + testold + '" --new "' + testnew + '" -f "' + transformxml + '" "' + dbdir + \ '" evictor.db "' + check_dbdir + '" ' proc = TestUtil.spawn(command) proc.waitTestSuccess() -print "ok" +print("ok") -print "validating database...", +sys.stdout.write("validating database... ") sys.stdout.flush() command = '"' + transformdb + '" -e --old "' + testnew + '" --new "' + testnew + '" -f "' + checkxml + '" "' + check_dbdir + \ '" evictor.db "' + tmp_dbdir + '"' proc = TestUtil.spawn(command) proc.waitTestSuccess() -print "ok" +print("ok") if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd([transformdb]) diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py index 624dc1f7e5c..8b510507d5f 100755 --- a/cpp/test/Glacier2/attack/run.py +++ b/cpp/test/Glacier2/attack/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil testdir = os.getcwd() router = TestUtil.getGlacier2Router() @@ -32,9 +32,10 @@ args = ' --Glacier2.RoutingTable.MaxSize=10' + \ ' --Ice.Admin.InstanceName=Glacier2' + \ ' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"' -print "starting router...", +sys.stdout.write("starting router... ") +sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) -print "ok" +print("ok") TestUtil.clientServerTest() diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py index 44e72842f45..69cc0cf4aac 100755 --- a/cpp/test/Glacier2/dynamicFiltering/run.py +++ b/cpp/test/Glacier2/dynamicFiltering/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil server = os.path.join(os.getcwd(), "server") client = os.path.join(os.getcwd(), "client") @@ -30,9 +30,10 @@ if TestUtil.appverifier: TestUtil.setAppVerifierSettings(targets) -print "starting server...", +sys.stdout.write("starting server... ") +sys.stdout.flush() serverProc = TestUtil.startServer(server, count=3) -print "ok" +print("ok") args = r' --Glacier2.Client.Endpoints="default -p 12347"' + \ r' --Ice.Admin.Endpoints="tcp -p 12348"' + \ @@ -42,15 +43,15 @@ args = r' --Glacier2.Client.Endpoints="default -p 12347"' + \ r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \ r' --Ice.Default.Locator="locator:default -p 12012"' -print "starting router...", +sys.stdout.write("starting router... ") +sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) -print "ok" +print("ok") - - -print "starting client...", +sys.stdout.write("starting client... ") +sys.stdout.flush() proc = TestUtil.startClient(client, startReader = False) -print "ok" +print("ok") proc.startReader() proc.waitTestSuccess() diff --git a/cpp/test/Glacier2/override/run.py b/cpp/test/Glacier2/override/run.py index c531f9dec1b..cd2173e01b4 100755 --- a/cpp/test/Glacier2/override/run.py +++ b/cpp/test/Glacier2/override/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil router = TestUtil.getGlacier2Router() @@ -46,9 +46,10 @@ def startRouter(): ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' + \ ' --Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime=50' - print "starting router in buffered mode...", + sys.stdout.write("starting router in buffered mode... ") + sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) - print "ok" + print("ok") return starterProc name = os.path.join("Glacier2", "override") @@ -59,4 +60,3 @@ starterProc.waitTestSuccess() if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd([router]) - diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py index b8194611f80..05234c93d7c 100755 --- a/cpp/test/Glacier2/router/run.py +++ b/cpp/test/Glacier2/router/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil router = TestUtil.getGlacier2Router() @@ -40,14 +40,16 @@ def startRouter(buffered): if buffered: args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' - print "starting router in buffered mode...", + sys.stdout.write("starting router in buffered mode... ") + sys.stdout.flush() else: args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0' - print "starting router in unbuffered mode...", + sys.stdout.write("starting router in unbuffered mode... ") + sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count=2) - print "ok" + print("ok") return starterProc name = os.path.join("Glacier2", "router") @@ -76,4 +78,3 @@ starterProc.waitTestSuccess() if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd([router]) - diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py index 500ac7668bb..f4564493786 100755 --- a/cpp/test/Glacier2/sessionControl/run.py +++ b/cpp/test/Glacier2/sessionControl/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil server = os.path.join(os.getcwd(), "server") router = TestUtil.getGlacier2Router() @@ -29,9 +29,10 @@ if TestUtil.appverifier: targets = [server, client, router] TestUtil.setAppVerifierSettings(targets) -print "starting server...", +sys.stdout.write("starting server... ") +sys.stdout.flush() serverProc = TestUtil.startServer(server) -print "ok" +print("ok") args = ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Ice.Admin.Endpoints="tcp -p 12348"' + \ @@ -40,20 +41,20 @@ args = ' --Glacier2.Client.Endpoints="default -p 12347"' + \ ' --Glacier2.SessionManager="SessionManager:tcp -p 12010"' \ ' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' -print "starting router...", +sys.stdout.write("starting router... ") +sys.stdout.flush() starterProc = TestUtil.startServer(router, args, count = 2) -print "ok" - - +print("ok") # # The test may sporadically fail without this slight pause. # time.sleep(1) -print "starting client...", +sys.stdout.write("starting client... ") +sys.stdout.flush() clientProc = TestUtil.startClient(client, startReader = False) -print "ok" +print("ok") clientProc.startReader() clientProc.waitTestSuccess() @@ -62,4 +63,3 @@ starterProc.waitTestSuccess() if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd(targets) - diff --git a/cpp/test/Glacier2/sessionHelper/run.py b/cpp/test/Glacier2/sessionHelper/run.py index 1705881b750..7284609bbda 100755 --- a/cpp/test/Glacier2/sessionHelper/run.py +++ b/cpp/test/Glacier2/sessionHelper/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil router = os.path.join(TestUtil.getCppBinDir(), "glacier2router") @@ -31,15 +31,13 @@ args = ' --Ice.Warn.Dispatch=0' + \ ' --Ice.Admin.InstanceName=Glacier2' + \ ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' -print "starting router...", +sys.stdout.write("starting router... ") +sys.stdout.flush() routerConfig = TestUtil.DriverConfig("server") routerConfig.lang = "cpp" starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig) -print "ok" - - +print("ok") TestUtil.clientServerTest(additionalClientOptions=" --shutdown") starterProc.waitTestSuccess() - diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py index 72dd1ada03a..903540c602e 100755 --- a/cpp/test/Glacier2/ssl/run.py +++ b/cpp/test/Glacier2/ssl/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil server = os.path.join(os.getcwd(), "server") client = os.path.join(os.getcwd(), "client") @@ -29,9 +29,10 @@ if TestUtil.appverifier: targets = [server, client, router] TestUtil.setAppVerifierSettings(targets) -print "starting server...", +sys.stdout.write("starting server... ") +sys.stdout.flush() serverProc = TestUtil.startServer(server) -print "ok" +print("ok") args = ' --Ice.Warn.Dispatch=0' + \ ' --Glacier2.AddSSLContext=1' + \ @@ -47,16 +48,18 @@ args = ' --Ice.Warn.Dispatch=0' + \ routerCfg = TestUtil.DriverConfig("server") routerCfg.protocol = "ssl" -print "starting router...", +sys.stdout.write("starting router... ") +sys.stdout.flush() starterProc = TestUtil.startServer(router, args, routerCfg, count = 2) -print "ok" +print("ok") clientCfg = TestUtil.DriverConfig("client") clientCfg.protocol = "ssl" -print "starting client...", +sys.stdout.write("starting client... ") +sys.stdout.flush() clientProc = TestUtil.startClient(client, "", clientCfg, startReader = False) -print "ok" +print("ok") clientProc.startReader() clientProc.waitTestSuccess() diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index ca0c7147623..e3807da41fc 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil hostname = socket.gethostname() fqdn = socket.getfqdn() @@ -224,13 +224,13 @@ if not limitedTests: ]) if len(testcases) == 0: - print "WARNING: You are running this test with SSL disabled and the network " - print " configuration for this host does not permit the other tests " - print " to run correctly." + print("WARNING: You are running this test with SSL disabled and the network ") + print(" configuration for this host does not permit the other tests ") + print(" to run correctly.") sys.exit(0) elif len(testcases) < 6: - print "WARNING: The network configuration for this host does not permit all " - print " tests to run correctly, some tests have been disabled." + print("WARNING: The network configuration for this host does not permit all ") + print(" tests to run correctly, some tests have been disabled.") def pingProgress(): sys.stdout.write('.') @@ -244,7 +244,7 @@ for testcase in testcases: # use command line arguments to pass the test cases in, but a # configuration file is easier. # - attackcfg = file(os.path.join(os.getcwd(), 'attack.cfg'), 'w') + attackcfg = open(os.path.join(os.getcwd(), 'attack.cfg'), 'w') accepts=0 rejects=0 sys.stdout.write(description) @@ -285,7 +285,7 @@ for testcase in testcases: ' --Ice.Admin.InstanceName=Glacier2' + \ ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"' - routerConfig = file(os.path.join(os.getcwd(), "router.cfg"), "w") + routerConfig = open(os.path.join(os.getcwd(), "router.cfg"), "w") routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % hostname) routerConfig.write("Glacier2.Client.Trace.Reject=0\n") @@ -327,7 +327,7 @@ for testcase in testcases: pingProgress() if TestUtil.protocol != "ssl": - serverConfig = file(os.path.join(os.getcwd(), "server.cfg"), "w") + serverConfig = open(os.path.join(os.getcwd(), "server.cfg"), "w") serverOptions = ' --Ice.Config="' + os.path.join(os.getcwd(), "server.cfg") + '" ' serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n") serverConfig.close() diff --git a/cpp/test/Ice/adapterDeactivation/run.py b/cpp/test/Ice/adapterDeactivation/run.py index 099ce110107..db68ff30b9a 100755 --- a/cpp/test/Ice/adapterDeactivation/run.py +++ b/cpp/test/Ice/adapterDeactivation/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/ami/run.py b/cpp/test/Ice/ami/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/ami/run.py +++ b/cpp/test/Ice/ami/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/background/run.py b/cpp/test/Ice/background/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/background/run.py +++ b/cpp/test/Ice/background/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/binding/run.py b/cpp/test/Ice/binding/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/binding/run.py +++ b/cpp/test/Ice/binding/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/checksum/run.py b/cpp/test/Ice/checksum/run.py index f6f62b28c1f..564355252bc 100755 --- a/cpp/test/Ice/checksum/run.py +++ b/cpp/test/Ice/checksum/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil server = os.path.join(os.getcwd(), "server", "server") TestUtil.clientServerTest(server = server) - diff --git a/cpp/test/Ice/custom/run.py b/cpp/test/Ice/custom/run.py index 43526feb98b..f1fb492a715 100755 --- a/cpp/test/Ice/custom/run.py +++ b/cpp/test/Ice/custom/run.py @@ -16,14 +16,13 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") -print "tests with collocated server." +print("tests with collocated server.") TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/defaultServant/run.py b/cpp/test/Ice/defaultServant/run.py index de6f75c19e5..21a39b058b8 100755 --- a/cpp/test/Ice/defaultServant/run.py +++ b/cpp/test/Ice/defaultServant/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Ice/defaultValue/run.py b/cpp/test/Ice/defaultValue/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/Ice/defaultValue/run.py +++ b/cpp/test/Ice/defaultValue/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Ice/dispatcher/run.py b/cpp/test/Ice/dispatcher/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/dispatcher/run.py +++ b/cpp/test/Ice/dispatcher/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py index 43526feb98b..f1fb492a715 100755 --- a/cpp/test/Ice/exceptions/run.py +++ b/cpp/test/Ice/exceptions/run.py @@ -16,14 +16,13 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") -print "tests with collocated server." +print("tests with collocated server.") TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/facets/run.py b/cpp/test/Ice/facets/run.py index 099ce110107..db68ff30b9a 100755 --- a/cpp/test/Ice/facets/run.py +++ b/cpp/test/Ice/facets/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py index d1473a0250a..2dce603e0a8 100755 --- a/cpp/test/Ice/faultTolerance/run.py +++ b/cpp/test/Ice/faultTolerance/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil server = os.path.join(os.getcwd(), "server") client = os.path.join(os.getcwd(), "client") @@ -28,20 +28,21 @@ base = 12340 serverProc = [] for i in range(0, num): - print "starting server #%d..." % (i + 1), + sys.stdout.write("starting server #%d... " % (i + 1)) + sys.stdout.flush() serverProc.append(TestUtil.startServer(server, "%d" % (base + i))) - print "ok" + print("ok") ports = "" for i in range(0, num): ports = "%s %d" % (ports, base + i) -print "starting client...", +sys.stdout.write("starting client... ") +sys.stdout.flush() clientProc = TestUtil.startClient(client, ports, startReader = False) -print "ok" +print("ok") clientProc.startReader() clientProc.waitTestSuccess() for p in serverProc: p.waitTestSuccess() - diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index 51dea83141e..dcf09c04d79 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") @@ -27,4 +27,3 @@ seedfile = os.path.join(os.getcwd(), "seed") TestUtil.simpleTest(client, '"%s"' % seedfile) os.remove(seedfile) - diff --git a/cpp/test/Ice/hold/run.py b/cpp/test/Ice/hold/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/hold/run.py +++ b/cpp/test/Ice/hold/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/info/run.py b/cpp/test/Ice/info/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/info/run.py +++ b/cpp/test/Ice/info/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py index 099ce110107..db68ff30b9a 100755 --- a/cpp/test/Ice/inheritance/run.py +++ b/cpp/test/Ice/inheritance/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/interceptor/run.py b/cpp/test/Ice/interceptor/run.py index 1be74428998..384e0ed4805 100755 --- a/cpp/test/Ice/interceptor/run.py +++ b/cpp/test/Ice/interceptor/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client, " --Ice.Warn.Dispatch=0") - diff --git a/cpp/test/Ice/invoke/run.py b/cpp/test/Ice/invoke/run.py index 719a5ffbd39..361d84543dc 100755 --- a/cpp/test/Ice/invoke/run.py +++ b/cpp/test/Ice/invoke/run.py @@ -16,16 +16,15 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with Blobject server." +print("tests with Blobject server.") TestUtil.clientServerTest() -print "tests with BlobjectArray server." +print("tests with BlobjectArray server.") TestUtil.clientServerTest(additionalServerOptions = "--array") -print "tests with BlobjectAsync server." +print("tests with BlobjectAsync server.") TestUtil.clientServerTest(additionalServerOptions = "--async") -print "tests with BlobjectAsyncArray server." +print("tests with BlobjectAsyncArray server.") TestUtil.clientServerTest(additionalServerOptions = "--array --async") - diff --git a/cpp/test/Ice/location/run.py b/cpp/test/Ice/location/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/location/run.py +++ b/cpp/test/Ice/location/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/objects/run.py b/cpp/test/Ice/objects/run.py index 099ce110107..db68ff30b9a 100755 --- a/cpp/test/Ice/objects/run.py +++ b/cpp/test/Ice/objects/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py index 17b74635d79..698206c03ca 100755 --- a/cpp/test/Ice/operations/run.py +++ b/cpp/test/Ice/operations/run.py @@ -16,14 +16,13 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0") -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0", server = "serveramd") -print "tests with collocated server." +print("tests with collocated server.") TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/properties/run.py b/cpp/test/Ice/properties/run.py index 18f78f00db1..e0193967f47 100755 --- a/cpp/test/Ice/properties/run.py +++ b/cpp/test/Ice/properties/run.py @@ -17,25 +17,34 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") # # Write config # -configPath = u"./config/ä¸å›½_client.config" - -TestUtil.createConfig(configPath, - ["# Automatically generated by Ice test driver.", - "Ice.Trace.Protocol=1", - "Ice.Trace.Network=1", - "Ice.ProgramName=PropertiesClient", - "Config.Path=./config/ä¸å›½_client.config"]) +if sys.version_info[0] == 2: + configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config".decode("utf-8") + TestUtil.createConfig(configPath, + ["# Automatically generated by Ice test driver.", + "Ice.Trace.Protocol=1", + "Ice.Trace.Network=1", + "Ice.ProgramName=PropertiesClient", + "Config.Path=./config/ä¸å›½_client.config"]) +else: + configPath = "./config/\u4e2d\u56fd_client.config" + TestUtil.createConfig(configPath, + ["# Automatically generated by Ice test driver.", + "Ice.Trace.Protocol=1", + "Ice.Trace.Network=1", + "Ice.ProgramName=PropertiesClient", + "Config.Path=" + configPath], + "utf-8") TestUtil.simpleTest(client) if os.path.exists(configPath): - os.remove(configPath)
\ No newline at end of file + os.remove(configPath) diff --git a/cpp/test/Ice/proxy/run.py b/cpp/test/Ice/proxy/run.py index 43526feb98b..f1fb492a715 100755 --- a/cpp/test/Ice/proxy/run.py +++ b/cpp/test/Ice/proxy/run.py @@ -16,14 +16,13 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") -print "tests with collocated server." +print("tests with collocated server.") TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/retry/run.py b/cpp/test/Ice/retry/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/retry/run.py +++ b/cpp/test/Ice/retry/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/servantLocator/run.py b/cpp/test/Ice/servantLocator/run.py index 43526feb98b..f1fb492a715 100755 --- a/cpp/test/Ice/servantLocator/run.py +++ b/cpp/test/Ice/servantLocator/run.py @@ -16,14 +16,13 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") -print "tests with collocated server." +print("tests with collocated server.") TestUtil.collocatedTest() - diff --git a/cpp/test/Ice/slicing/exceptions/run.py b/cpp/test/Ice/slicing/exceptions/run.py index 7056fe381ec..0dc8f723956 100755 --- a/cpp/test/Ice/slicing/exceptions/run.py +++ b/cpp/test/Ice/slicing/exceptions/run.py @@ -16,12 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") - diff --git a/cpp/test/Ice/slicing/objects/run.py b/cpp/test/Ice/slicing/objects/run.py index a3051e1fc42..c5200040d14 100755 --- a/cpp/test/Ice/slicing/objects/run.py +++ b/cpp/test/Ice/slicing/objects/run.py @@ -16,12 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests with regular server." +print("tests with regular server.") TestUtil.clientServerTest() -print "tests with AMD server." +print("tests with AMD server.") TestUtil.clientServerTest(server = "serveramd") - diff --git a/cpp/test/Ice/stream/run.py b/cpp/test/Ice/stream/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/Ice/stream/run.py +++ b/cpp/test/Ice/stream/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Ice/stringConverter/run.py b/cpp/test/Ice/stringConverter/run.py index c864d65fafb..247405f3610 100755 --- a/cpp/test/Ice/stringConverter/run.py +++ b/cpp/test/Ice/stringConverter/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Ice/threadPoolPriority/run.py b/cpp/test/Ice/threadPoolPriority/run.py index 26f66ec7fac..cdf273409f3 100755 --- a/cpp/test/Ice/threadPoolPriority/run.py +++ b/cpp/test/Ice/threadPoolPriority/run.py @@ -16,12 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "tests default server thread pool." +print("tests default server thread pool.") TestUtil.clientServerTest() -print "tests custom server thread pool." +print("tests custom server thread pool.") TestUtil.clientServerTest(server = "servercustom") - diff --git a/cpp/test/Ice/timeout/run.py b/cpp/test/Ice/timeout/run.py index 32ea526c3b4..2265a40ca12 100755 --- a/cpp/test/Ice/timeout/run.py +++ b/cpp/test/Ice/timeout/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() - diff --git a/cpp/test/Ice/udp/run.py b/cpp/test/Ice/udp/run.py index edb57a0f46c..012688ce120 100755 --- a/cpp/test/Ice/udp/run.py +++ b/cpp/test/Ice/udp/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil # # COMPILERFIX: The server fails to start on Solaris when IPv6 is @@ -26,7 +26,7 @@ from scripts import * # linked-local configured link. # if TestUtil.isSolaris() and TestUtil.ipv6: - print "test not supported on Solaris with IPv6" + print("test not supported on Solaris with IPv6") sys.exit(0) server = os.path.join(os.getcwd(), "server") @@ -36,16 +36,17 @@ num = 5 serverProc = [] for i in range(0, num): - print "starting server #%d..." % (i + 1), + sys.stdout.write("starting server #%d... " % (i + 1)) + sys.stdout.flush() serverProc.append(TestUtil.startServer(server, "%d" % i , adapter="McastTestAdapter")) - print "ok" + print("ok") -print "starting client...", +sys.stdout.write("starting client... ") +sys.stdout.flush() clientProc = TestUtil.startClient(client, "%d" % num, startReader = False) -print "ok" +print("ok") clientProc.startReader() clientProc.waitTestSuccess() for p in serverProc: p.waitTestSuccess() - diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py index 1c9c186b581..1b006c54318 100755 --- a/cpp/test/IceBox/configuration/run.py +++ b/cpp/test/IceBox/configuration/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil icebox = TestUtil.getIceBox() @@ -27,4 +27,3 @@ 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) - diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py index 9baa8b2f02e..c3bcd3f1405 100755 --- a/cpp/test/IceGrid/activation/run.py +++ b/cpp/test/IceGrid/activation/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin IceGridAdmin.iceGridTest("application.xml", "", "properties-override='%s'" % IceGridAdmin.iceGridNodePropertiesOverride()) - diff --git a/cpp/test/IceGrid/admin/run.py b/cpp/test/IceGrid/admin/run.py index 67d30e16921..835aa346838 100755 --- a/cpp/test/IceGrid/admin/run.py +++ b/cpp/test/IceGrid/admin/run.py @@ -16,14 +16,14 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(path[0]) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin if not TestUtil.isWin32() and os.getuid() == 0: - print - print "*** can't run test as root ***" - print + sys.stdout.write("\n") + sys.stdout.write("*** can't run test as root ***\n") + sys.stdout.write("\n") sys.exit(0) testdir = os.getcwd(); @@ -37,7 +37,7 @@ if TestUtil.appverifier: registryProcs = IceGridAdmin.startIceGridRegistry(testdir) nodeProc = IceGridAdmin.startIceGridNode(testdir) -print "starting glacier2...", +sys.stdout.write("starting glacier2... ") sys.stdout.flush() args = ' --Glacier2.SessionTimeout=5' + \ @@ -50,9 +50,9 @@ args = ' --Glacier2.SessionTimeout=5' + \ ' --Ice.Default.Locator="IceGrid/Locator:default -p 12010"' + \ ' --IceSSL.VerifyPeer=1' routerProc = TestUtil.startServer(router, args, count=2) -print "ok" +print("ok") -print "testing login with username/password...", +sys.stdout.write("testing login with username/password... ") sys.stdout.flush() # Direct registry connection with username/password @@ -77,11 +77,11 @@ admin.sendline("server list") admin.expect('>>> ') admin.sendline('exit') admin.waitTestSuccess(timeout=120) -print "ok" +print("ok") if TestUtil.protocol == "ssl": - print "testing login with ssl...", + sys.stdout.write("testing login with ssl... ") sys.stdout.flush() # Direct registry connection with SSL @@ -103,9 +103,9 @@ if TestUtil.protocol == "ssl": admin.sendline('exit') admin.waitTestSuccess(timeout=120) - print "ok" + print("ok") -print "testing commands...", +sys.stdout.write("testing commands... ") sys.stdout.flush() icegridadmin = TestUtil.getIceGridAdmin() args = ' --Ice.Default.Locator="IceGrid/Locator:default -p 12010"' + \ @@ -195,9 +195,9 @@ admin.expect('node is up') admin.expect('>>> ') admin.sendline('exit') admin.waitTestSuccess(timeout=120) -print "ok" +print("ok") -# print "testing icegridadmin...", +# sys.stdout.write("testing icegridadmin... ") # sys.stdout.flush() # admin = Util.spawn('icegridadmin --Ice.Config=config.admin --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"') @@ -224,7 +224,7 @@ print "ok" # admin.sendline('exit') # admin.waitTestSuccess(timeout=120) -# print "ok" +# print("ok") # print "completing shutdown...", # sys.stdout.flush() @@ -243,11 +243,11 @@ print "ok" # admin.sendline('exit') # admin.waitTestSuccess(timeout=120) -print "stopping glacier2...", +sys.stdout.write("stopping glacier2... ") sys.stdout.flush() routerProc.kill(signal.SIGINT) routerProc.waitTestSuccess() -print "ok" +print("ok") IceGridAdmin.iceGridAdmin("node shutdown localnode") IceGridAdmin.shutdownIceGridRegistry(registryProcs) @@ -255,4 +255,3 @@ nodeProc.waitTestSuccess() if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd(targets) - diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py index f44b04e16f5..9cddd6c3179 100755 --- a/cpp/test/IceGrid/allocation/run.py +++ b/cpp/test/IceGrid/allocation/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin IceGridAdmin.iceGridTest("application.xml") - diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py index 20ca3c73a22..6f66f393364 100755 --- a/cpp/test/IceGrid/deployer/run.py +++ b/cpp/test/IceGrid/deployer/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin os.environ["MY_FOO"] = "12" @@ -27,4 +27,3 @@ IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % os.getcwd(), "ice # Tests with targets IceGridAdmin.iceGridTest("application.xml", '-t --TestDir="%s"' % os.getcwd(), "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 8c9f3bcab43..bf345146953 100755 --- a/cpp/test/IceGrid/distribution/run.py +++ b/cpp/test/IceGrid/distribution/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin def icepatch2Calc(datadir, dirname): icePatch2Calc = "" @@ -43,7 +43,8 @@ files = [ ] -print "creating IcePatch2 data directory...", +sys.stdout.write("creating IcePatch2 data directory... ") +sys.stdout.flush() if not os.path.exists(datadir): os.mkdir(datadir) else: @@ -59,7 +60,7 @@ for [file, content] in files: icepatch2Calc(datadir, "original") icepatch2Calc(datadir, "updated") -print "ok" +print("ok") IceGridAdmin.iceGridTest("application.xml") diff --git a/cpp/test/IceGrid/fileLock/run.py b/cpp/test/IceGrid/fileLock/run.py index 8068eb87cff..41f6b82ee41 100755 --- a/cpp/test/IceGrid/fileLock/run.py +++ b/cpp/test/IceGrid/fileLock/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin testdir = os.getcwd(); @@ -52,11 +52,10 @@ def runIceGridRegistry(): registryProcs = IceGridAdmin.startIceGridRegistry(testdir) -print "testing IceGrid file lock...", +sys.stdout.write("testing IceGrid file lock... ") iceGrid = runIceGridRegistry() iceGrid.expect(".*IceUtil::FileLockedException.*") iceGrid.wait() -print "ok" +print("ok") IceGridAdmin.shutdownIceGridRegistry(registryProcs) - diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py index 4bd32ee230f..a3079355940 100755 --- a/cpp/test/IceGrid/replicaGroup/run.py +++ b/cpp/test/IceGrid/replicaGroup/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin IceGridAdmin.iceGridTest("application.xml", "--Ice.RetryIntervals=\"0 50 100 250\"", "icebox.exe='%s'" % TestUtil.getIceBox()) - diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py index c1ff43bf060..cc61946c6b2 100755 --- a/cpp/test/IceGrid/replication/run.py +++ b/cpp/test/IceGrid/replication/run.py @@ -16,14 +16,14 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin TestUtil.addLdPath(os.getcwd()) if TestUtil.sqlType != None and TestUtil.sqlType != "QSQLITE": - print "*** This test only supports Freeze or SQLite databases" + print("*** This test only supports Freeze or SQLite databases") sys.exit(0) variables = "properties-override='%s'" % IceGridAdmin.iceGridNodePropertiesOverride() diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py index 2f9e95a01d4..4e20e9f655f 100755 --- a/cpp/test/IceGrid/session/run.py +++ b/cpp/test/IceGrid/session/run.py @@ -16,14 +16,14 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin if not TestUtil.isWin32() and os.getuid() == 0: - print - print "*** can't run test as root ***" - print + sys.stdout.write("\n") + sys.stdout.write("*** can't run test as root ***\n") + sys.stdout.write("\n") sys.exit(0) name = os.path.join("IceGrid", "session") @@ -34,9 +34,9 @@ if not os.path.exists(node1Dir): else: IceGridAdmin.cleanDbDir(node1Dir) -print "starting admin permissions verifier...", +sys.stdout.write("starting admin permissions verifier... ") verifierProc = TestUtil.startServer(os.path.join(os.getcwd(), "verifier"), config=TestUtil.DriverConfig("server")) -print "ok" +print("ok") IceGridAdmin.registryOptions += \ r' --IceGrid.Registry.DynamicRegistration' + \ @@ -51,4 +51,3 @@ IceGridAdmin.iceGridTest("application.xml", 'properties-override=\'%s\'' % IceGridAdmin.iceGridNodePropertiesOverride()) verifierProc.waitTestSuccess() - diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py index 568bbe5fa53..c0e31578fda 100755 --- a/cpp/test/IceGrid/simple/run.py +++ b/cpp/test/IceGrid/simple/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin # # Test client/server without on demand activation. @@ -29,4 +29,3 @@ IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --Test # Test client/server with on demand activation. # IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy") - diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py index 8435dad3012..093afe59055 100755 --- a/cpp/test/IceGrid/update/run.py +++ b/cpp/test/IceGrid/update/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin name = os.path.join("IceGrid", "update") @@ -39,4 +39,3 @@ nodeOverrideOptions = '--IceBinDir="%s" --TestDir="%s" ' % (TestUtil.getCppBinDi IceGridAdmin.iceGridNodePropertiesOverride() IceGridAdmin.iceGridTest("", nodeOverrideOptions) - diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index 5235efd9276..8942615d408 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -16,9 +16,8 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.getcwd()) - diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index 62b48b15fa6..bf0d91e32b5 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -17,9 +17,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") @@ -53,33 +53,34 @@ def runtest(type, **args): icestorm.start() - print "setting up topics...", + sys.stdout.write("setting up topics... ") sys.stdout.flush() icestorm.admin("create fed1 fed2 fed3; link fed1 fed2 10; link fed2 fed3 5") - print "ok" + print("ok") # # Test oneway subscribers. # - print "testing oneway subscribers...", + sys.stdout.write("testing oneway subscribers... ") sys.stdout.flush() doTest(icestorm, 0) - print "ok" + print("ok") # # Test batch oneway subscribers. # - print "testing batch subscribers...", + sys.stdout.write("testing batch subscribers... ") sys.stdout.flush() doTest(icestorm, 1) - print "ok" + print("ok") # # Destroy the topics. # - print "destroying topics...", + sys.stdout.write("destroying topics... ") + sys.stdout.flush() icestorm.admin("destroy fed1 fed2 fed3") - print "ok" + print("ok") # # Shutdown icestorm. diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index d9d89192a5a..0981cd3a81b 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil, Expect iceStormAdmin = "" if TestUtil.isBCC2010(): @@ -81,26 +81,26 @@ def runtest(type, **args): adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % ( icestorm1.proxy(), icestorm2.proxy()) - print "setting up the topics...", + sys.stdout.write("setting up the topics... ") sys.stdout.flush() admin(adminIceStormReference, "create TestIceStorm1/fed1 TestIceStorm2/fed1; link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "ok" + print("ok") # # Test oneway subscribers. # - print "testing federation with oneway subscribers...", + sys.stdout.write("testing federation with oneway subscribers... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 0) - print "ok" + print("ok") # # Test batch oneway subscribers. # - print "testing federation with batch subscribers...", + sys.stdout.write("testing federation with batch subscribers... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 1) - print "ok" + print("ok") # # Test #2: @@ -108,7 +108,7 @@ def runtest(type, **args): # Stop and restart the service and repeat the test. This ensures that # the database is correct. # - print "restarting services to ensure that the database content is preserved...", + sys.stdout.write("restarting services to ensure that the database content is preserved... ") sys.stdout.flush() # @@ -119,23 +119,23 @@ def runtest(type, **args): icestorm1.start(echo=False) icestorm2.start(echo=False) - print "ok" + print("ok") # # Test oneway subscribers. # - print "retesting federation with oneway subscribers... ", + sys.stdout.write("retesting federation with oneway subscribers... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 0) - print "ok" + print("ok") # # Test batch oneway subscribers. # - print "retesting federation with batch subscribers... ", + sys.stdout.write("retesting federation with batch subscribers... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 1) - print "ok" + print("ok") # # Shutdown icestorm. @@ -151,31 +151,31 @@ def runtest(type, **args): # Ensure they are received by the linked server. # if type != "replicated": - print "restarting only one IceStorm server...", + sys.stdout.write("restarting only one IceStorm server... ") sys.stdout.flush() proc = icestorm1.start(echo=False) #proc.expect("topic.fed1.*subscriber offline") #proc.expect("connection refused") - print "ok" + print("ok") # # Test oneway subscribers. # - print "testing that the federation link reports an error...", + sys.stdout.write("testing that the federation link reports an error... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 0, icestorm1.reference()) - # Give some time for the output to be sent. - time.sleep(2) + # Give some time for the output to be sent. + time.sleep(2) proc.expect("topic.fed1.*subscriber offline") - print "ok" + print("ok") - print "starting downstream icestorm server...", + sys.stdout.write("starting downstream icestorm server... ") sys.stdout.flush() icestorm2.start(echo=False) - print "ok" + print("ok") # # Need to sleep for at least the discard interval. @@ -185,10 +185,10 @@ def runtest(type, **args): # # Test oneway subscribers. # - print "testing link is reestablished...", + sys.stdout.write("testing link is reestablished... ") sys.stdout.flush() doTest(icestorm1, icestorm2, 0) - print "ok" + print("ok") try: proc.expect("topic.fed1.*subscriber offline") @@ -205,26 +205,27 @@ def runtest(type, **args): # Trash the TestIceStorm2 database. Then restart the servers and # verify that the link is removed. # - print "destroying the downstream IceStorm service database...", + sys.stdout.write("destroying the downstream IceStorm service database... ") sys.stdout.flush() icestorm2.clean() - print "ok" + print("ok") - print "restarting IceStorm servers...", + sys.stdout.write("restarting IceStorm servers... ") sys.stdout.flush() icestorm1.start(echo = False) icestorm2.start(echo = False) - print "ok" + print("ok") - print "checking link still exists...", + sys.stdout.write("checking link still exists... ") + sys.stdout.flush() line = admin(adminIceStormReference, "links TestIceStorm1") if not re.compile("fed1 with cost 0").search(line): - print line + print(line) sys.exit(1) - print "ok" + print("ok") - print "publishing some events...", + sys.stdout.write("publishing some events... ") sys.stdout.flush() # The publisher must be run twice because all the events can be # sent out in one batch to the linked subscriber which means that @@ -232,13 +233,13 @@ def runtest(type, **args): # sent. Furthermore, with a replicated IceStorm both sets of # events must be set to the same replica. runPublisher(icestorm1, opt = " --count 2") - print "ok" + print("ok") # Give the unsubscription time to propagate. time.sleep(1) # Verify that the link has disappeared. - print "verifying that the link has been destroyed...", + sys.stdout.write("verifying that the link has been destroyed... ") sys.stdout.flush() line = admin(adminIceStormReference, "links TestIceStorm1") nRetry = 5 @@ -247,25 +248,26 @@ def runtest(type, **args): time.sleep(1) # Give more time for unsubscription to propagate. nRetry -= 1 if len(line) > 0: - print line + print(line) sys.exit(1) - print "ok" + print("ok") # # Destroy the remaining topic. # - print "destroying topics...", + sys.stdout.write("destroying topics... ") + sys.stdout.flush() admin(adminIceStormReference, "destroy TestIceStorm1/fed1") - print "ok" + print("ok") # # Shutdown icestorm. # - print "shutting down icestorm services...", + sys.stdout.write("shutting down icestorm services... ") sys.stdout.flush() icestorm1.stop() icestorm2.stop() - print "ok" + print("ok") runtest("persistent") runtest("replicated", replicatedPublisher = False) diff --git a/cpp/test/IceStorm/rep1/run.py b/cpp/test/IceStorm/rep1/run.py index b1f62dc216f..358090cdf82 100755 --- a/cpp/test/IceStorm/rep1/run.py +++ b/cpp/test/IceStorm/rep1/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") @@ -77,23 +77,23 @@ icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", repli ' --IceStorm.Election.ResponseTimeout=2') icestorm.start() -print "testing topic creation across replicas...", +sys.stdout.write("testing topic creation across replicas... ") sys.stdout.flush() icestorm.admin("create single") for replica in range(0, 3): icestorm.adminForReplica(replica, "create single", "error: topic `single' exists") -print "ok" +print("ok") -print "testing topic destruction across replicas...", +sys.stdout.write("testing topic destruction across replicas... ") sys.stdout.flush() icestorm.admin("destroy single") for replica in range(0, 3): icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'") -print "ok" +print("ok") -print "testing topic creation without replica...", +sys.stdout.write("testing topic creation without replica... ") sys.stdout.flush() icestorm.stopReplica(0) @@ -107,11 +107,11 @@ icestorm.adminForReplica(0, "create single", "ConnectionRefused") icestorm.startReplica(0, echo=False) icestorm.adminForReplica(0, "create single", "error: topic `single' exists") -print "ok" +print("ok") icestorm.admin("destroy single") -print "testing topic creation without master...", +sys.stdout.write("testing topic creation without master... ") sys.stdout.flush() icestorm.stopReplica(2) @@ -125,11 +125,11 @@ icestorm.adminForReplica(2, "create single", "ConnectionRefused") icestorm.startReplica(2, echo=False) icestorm.adminForReplica(2, "create single", "error: topic `single' exists") -print "ok" +print("ok") # All replicas are running -print "testing topic destruction without replica...", +sys.stdout.write("testing topic destruction without replica... ") sys.stdout.flush() icestorm.stopReplica(0) @@ -143,9 +143,9 @@ icestorm.adminForReplica(0, "destroy single", "ConnectionRefused") icestorm.startReplica(0, echo=False) icestorm.adminForReplica(0, "destroy single", "error: couldn't find topic `single'") -print "ok" +print("ok") -print "testing topic destruction without master...", +sys.stdout.write("testing topic destruction without master... ") sys.stdout.flush() icestorm.admin("create single") @@ -161,29 +161,29 @@ icestorm.adminForReplica(2, "destroy single", "ConnectionRefused") icestorm.startReplica(2, echo=False) icestorm.adminForReplica(2, "destroy single", "error: couldn't find topic `single'") -print "ok" +print("ok") # Now test subscription/unsubscription on all replicas. icestorm.admin("create single") -print "testing subscription across replicas...", +sys.stdout.write("testing subscription across replicas... ") sys.stdout.flush() runsub2() for replica in range(0, 3): runsub2(replica, "IceStorm::AlreadySubscribed") -print "ok" +print("ok") -print "testing unsubscription across replicas...", +sys.stdout.write("testing unsubscription across replicas... ") sys.stdout.flush() rununsub2() for replica in range(0, 3): rununsub2(replica) -print "ok" +print("ok") -print "testing subscription without master...", +sys.stdout.write("testing subscription without master... ") sys.stdout.flush() icestorm.stopReplica(2) @@ -197,9 +197,9 @@ runsub2(2, "ConnectionRefused") icestorm.startReplica(2, echo=False) runsub2(2, "IceStorm::AlreadySubscribed") -print "ok" +print("ok") -print "testing unsubscription without master...", +sys.stdout.write("testing unsubscription without master... ") sys.stdout.flush() icestorm.stopReplica(2) @@ -213,9 +213,9 @@ rununsub2(2, "ConnectionRefused") icestorm.startReplica(2, echo=False) rununsub2(2) -print "ok" +print("ok") -print "testing subscription without replica...", +sys.stdout.write("testing subscription without replica... ") sys.stdout.flush() icestorm.stopReplica(0) @@ -229,9 +229,9 @@ runsub2(0, "ConnectionRefused") icestorm.startReplica(0, echo=False) runsub2(0, "IceStorm::AlreadySubscribed") -print "ok" +print("ok") -print "testing unsubscription without replica...", +sys.stdout.write("testing unsubscription without replica... ") sys.stdout.flush() icestorm.stopReplica(0) @@ -245,48 +245,48 @@ rununsub2(0, "ConnectionRefused") icestorm.startReplica(0, echo=False) rununsub2(0) -print "ok" +print("ok") # All replicas are running -print "running twoway subscription test...", +sys.stdout.write("running twoway subscription test... ") sys.stdout.flush() runtest("twoway", icestorm.reference()) -print "ok" +print("ok") -print "running ordered subscription test...", +sys.stdout.write("running ordered subscription test... ") sys.stdout.flush() runtest("ordered", icestorm.reference()) -print "ok" +print("ok") icestorm.stopReplica(2) -print "running twoway, ordered subscription test without master...", +sys.stdout.write("running twoway, ordered subscription test without master... ") sys.stdout.flush() runtest("twoway", icestorm.reference()) runtest("ordered", icestorm.reference()) -print "ok" +print("ok") icestorm.startReplica(2, echo = False) icestorm.stopReplica(0) -print "running twoway, ordered subscription test without replica...", +sys.stdout.write("running twoway, ordered subscription test without replica... ") sys.stdout.flush() runtest("twoway", icestorm.reference()) runtest("ordered", icestorm.reference()) -print "ok" +print("ok") icestorm.startReplica(0, echo = False) -print "running cycle publishing test...", +sys.stdout.write("running cycle publishing test... ") sys.stdout.flush() runtest("twoway", icestorm.reference(), pubopt=" --cycle") -print "ok" +print("ok") -print "stopping replicas...", +sys.stdout.write("stopping replicas... ") sys.stdout.flush() icestorm.stop() -print "ok" +print("ok") if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/repgrid/run.py b/cpp/test/IceStorm/repgrid/run.py index 834e9ff9783..1fb8a64dc8c 100755 --- a/cpp/test/IceStorm/repgrid/run.py +++ b/cpp/test/IceStorm/repgrid/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil, IceGridAdmin targets = [] if TestUtil.appverifier: diff --git a/cpp/test/IceStorm/repstress/run.py b/cpp/test/IceStorm/repstress/run.py index 67096c750c6..08aa574ea6b 100755 --- a/cpp/test/IceStorm/repstress/run.py +++ b/cpp/test/IceStorm/repstress/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") @@ -40,86 +40,86 @@ icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", repli ' --IceStorm.Election.ResponseTimeout=2') icestorm.start() -print "creating topic...", +sys.stdout.write("creating topic... ") sys.stdout.flush() icestorm.admin("create single") -print "ok" +print("ok") -print "running subscriber...", +sys.stdout.write("running subscriber... ") sys.stdout.flush() subscriberProc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False) subscriberProc.expect("([^\n]+)\n") subControl = subscriberProc.match.group(1) -print "ok" +print("ok") -print "running publisher...", +sys.stdout.write("running publisher... ") sys.stdout.flush() publisherProc = TestUtil.startServer(publisher, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False) publisherProc.expect("([^\n]+)\n") pubControl = publisherProc.match.group(1) -print "ok" +print("ok") time.sleep(2) for i in range(0, 3): # 0, 1 - print "stopping replica 2 (0, 1 running)...", + sys.stdout.write("stopping replica 2 (0, 1 running)... ") sys.stdout.flush() icestorm.stopReplica(2) - print "ok" + print("ok") time.sleep(2) # 1, 2 - print "starting 2, stopping 0 (1, 2 running)...", + sys.stdout.write("starting 2, stopping 0 (1, 2 running)... ") sys.stdout.flush() icestorm.startReplica(2, echo=False) icestorm.stopReplica(0) - print "ok" + print("ok") # This waits for the replication to startup #icestorm.admin("list") time.sleep(2) # 0, 2 - print "starting 0, stopping 1 (0, 2 running)...", + sys.stdout.write("starting 0, stopping 1 (0, 2 running)... ") sys.stdout.flush() icestorm.startReplica(0, echo=False) icestorm.stopReplica(1) - print "ok" + print("ok") # This waits for the replication to startup #icestorm.admin("list") time.sleep(2) - print "starting 1 (all running)...", + sys.stdout.write("starting 1 (all running)... ") sys.stdout.flush() icestorm.startReplica(1, echo=False) - print "ok" + print("ok") # This waits for the replication to startup #icestorm.admin("list") time.sleep(2) -print "stopping publisher...", +sys.stdout.write("stopping publisher... ") sys.stdout.flush() runcontrol(pubControl) publisherProc.expect("([^\n]+)\n") publisherCount = publisherProc.match.group(1) publisherProc.waitTestSuccess() -print "ok" +print("ok") -print "stopping replicas...", +sys.stdout.write("stopping replicas... ") sys.stdout.flush() icestorm.stop() -print "ok" +print("ok") -print "stopping subscriber...", +sys.stdout.write("stopping subscriber... ") sys.stdout.flush() runcontrol(subControl) subscriberProc.expect("([^\n]+)\n") subscriberCount = subscriberProc.match.group(1) subscriberProc.waitTestSuccess() -print "ok" +print("ok") -print "publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount) +print("publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount)) if TestUtil.appverifier: TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd()) diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index 27935f821e8..bfba477917e 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -17,9 +17,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil publisher = os.path.join(os.getcwd(), "publisher") subscriber = os.path.join(os.getcwd(), "subscriber") @@ -35,24 +35,24 @@ def dotest(type): icestorm.start() - print "creating topic...", + sys.stdout.write("creating topic... ") sys.stdout.flush() icestorm.admin("create single") - print "ok" + print("ok") - print "starting subscriber...", + sys.stdout.write("starting subscriber... ") sys.stdout.flush() subscriberProc = TestUtil.startServer(subscriber, icestorm.reference(), count = 5) - print "ok" + print("ok") # # Start the publisher. This should publish 10 events which eventually # causes subscriber to terminate. # - print "starting publisher...", + sys.stdout.write("starting publisher... ") sys.stdout.flush() publisherProc = TestUtil.startClient(publisher, icestorm.reference(), startReader = False) - print "ok" + print("ok") publisherProc.startReader() subscriberProc.waitTestSuccess() @@ -61,10 +61,10 @@ def dotest(type): # # Destroy the topic. # - print "destroy topic...", + sys.stdout.write("destroy topic... ") sys.stdout.flush() icestorm.admin("destroy single") - print "ok" + print("ok") # # Shutdown icestorm. diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py index 21a799e0667..87d6ab2541e 100755 --- a/cpp/test/IceStorm/stress/run.py +++ b/cpp/test/IceStorm/stress/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceStormUtil iceStormAdmin = "" if TestUtil.isBCC2010(): @@ -57,84 +57,85 @@ def runAdmin(cmd, desc = None): global iceStormAdmin global iceStormAdminReference if desc: - print desc, + sys.stdout.write(desc + " ") sys.stdout.flush() proc = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "%s"' % cmd, startReader = True) proc.waitTestSuccess() if desc: - print "ok" + print("ok") def runtest(type): # Clear the idle timeout otherwise the IceBox ThreadPool will timeout. server1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db", instanceName = "TestIceStorm1", - port = 12000) + port = 12000) server2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db2", instanceName = "TestIceStorm2", - port = 12500) + port = 12500) global adminIceStormReference adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % ( server1.proxy(), server2.proxy()) - print "starting icestorm services...", + sys.stdout.write("starting icestorm services... ") sys.stdout.flush() server1.start(echo=False) server2.start(echo=False) - print "ok" + print("ok") runAdmin("create TestIceStorm1/fed1 TestIceStorm2/fed1", "setting up the topics...") - print "Sending 5000 ordered events... ", + sys.stdout.write("Sending 5000 ordered events... ") sys.stdout.flush() doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server1.reference(), '--events 5000') - print "ok" + print("ok") runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 5000 ordered events across a link... ", + sys.stdout.write("Sending 5000 ordered events across a link... ") sys.stdout.flush() doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server2.reference(), '--events 5000') - print "ok" + print("ok") runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events... ", + sys.stdout.write("Sending 20000 unordered events... ") sys.stdout.flush() doTest(server1, server2, '--events 20000 ' + server1.reference(), '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events across a link... ", + sys.stdout.write("Sending 20000 unordered events across a link... ") sys.stdout.flush() doTest(server1, server2, '--events 20000 ' + server2.reference(), '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered batch events... ", + sys.stdout.write("Sending 20000 unordered batch events... ") sys.stdout.flush() doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server1.reference(), '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered batch events across a link... ", + sys.stdout.write("Sending 20000 unordered batch events across a link... ") sys.stdout.flush() doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server2.reference(), '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events with slow subscriber... ", + sys.stdout.write("Sending 20000 unordered events with slow subscriber... ") + sys.stdout.flush() doTest(server1, server2, ['--events 2 --slow ' + server1.reference(), '--events 20000 ' + server1.reference()], '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events with slow subscriber & link... ", + sys.stdout.write("Sending 20000 unordered events with slow subscriber & link... ") + sys.stdout.flush() doTest(server1, server2, ['--events 2 --slow' + server1.reference(), '--events 20000' + server1.reference(), '--events 2 --slow' + server2.reference(), '--events 20000' + server2.reference()], '--events 20000 --oneway') - print "ok" - + print("ok") - print "shutting down icestorm services...", + sys.stdout.write("shutting down icestorm services... ") sys.stdout.flush() server1.stop() server2.stop() - print "ok" + print("ok") - print "starting icestorm services...", + sys.stdout.write("starting icestorm services... ") sys.stdout.flush() # # The erratic tests emit lots of connection warnings so they are @@ -143,21 +144,21 @@ def runtest(type): # server1.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0') server2.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0') - print "ok" + print("ok") runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events with erratic subscriber... ", + sys.stdout.write("Sending 20000 unordered events with erratic subscriber... ") sys.stdout.flush() doTest(server1, server2, [ '--erratic 5 --qos "reliability,ordered" --events 20000' + server1.reference(), '--erratic 5 --events 20000' + server1.reference(), '--events 20000' + server1.reference()], '--events 20000 --oneway') - print "ok" + print("ok") runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1") - print "Sending 20000 unordered events with erratic subscriber across a link... ", + sys.stdout.write("Sending 20000 unordered events with erratic subscriber across a link... ") sys.stdout.flush() doTest(server1, server2, [ '--events 20000' + server1.reference(), @@ -167,16 +168,16 @@ def runtest(type): '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server2.reference(), '--erratic 5 --events 20000 ' + server2.reference()], '--events 20000 --oneway ') - print "ok" + print("ok") # # Shutdown icestorm. # - print "shutting down icestorm services...", + sys.stdout.write("shutting down icestorm services... ") sys.stdout.flush() server1.stop() server2.stop() - print "ok" + print("ok") runtest("persistent") runtest("replicated") diff --git a/cpp/test/IceUtil/condvar/run.py b/cpp/test/IceUtil/condvar/run.py index e82f73fb946..b04ffcce420 100755 --- a/cpp/test/IceUtil/condvar/run.py +++ b/cpp/test/IceUtil/condvar/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil workqueue = os.path.join(os.getcwd(), "workqueue") diff --git a/cpp/test/IceUtil/fileLock/run.py b/cpp/test/IceUtil/fileLock/run.py index 48760b12db2..5ed68cb4b38 100755 --- a/cpp/test/IceUtil/fileLock/run.py +++ b/cpp/test/IceUtil/fileLock/run.py @@ -16,11 +16,11 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil -print "testing process file lock...", +sys.stdout.write("testing process file lock... ") sys.stdout.flush() client = os.path.join(os.getcwd(), "client") @@ -53,4 +53,4 @@ clientExe.expect('File lock acquired.\.*') clientExe.sendline('go') clientExe.expect('File lock released.') clientExe.waitTestSuccess() -print "ok" +print("ok") diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py index 1e01f6b11bf..4d6633269cd 100755 --- a/cpp/test/IceUtil/inputUtil/run.py +++ b/cpp/test/IceUtil/inputUtil/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client, os.getcwd()) - diff --git a/cpp/test/IceUtil/priority/run.py b/cpp/test/IceUtil/priority/run.py index 3fe7d3cc948..5240b248794 100755 --- a/cpp/test/IceUtil/priority/run.py +++ b/cpp/test/IceUtil/priority/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client, os.getcwd()) - diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py index 3fe7d3cc948..5240b248794 100755 --- a/cpp/test/IceUtil/thread/run.py +++ b/cpp/test/IceUtil/thread/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client, os.getcwd()) - diff --git a/cpp/test/IceUtil/timer/run.py b/cpp/test/IceUtil/timer/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/IceUtil/timer/run.py +++ b/cpp/test/IceUtil/timer/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py index 0a82dd170b3..6a8bc9790bc 100755 --- a/cpp/test/IceUtil/unicode/run.py +++ b/cpp/test/IceUtil/unicode/run.py @@ -16,11 +16,10 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client, '"%s"' % os.getcwd()) - diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/IceUtil/uuid/run.py +++ b/cpp/test/IceUtil/uuid/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index 0baf3c1f4b0..7a9041ed4df 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -16,9 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel os.getcwd()!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel os.getcwd()!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil slice2cpp = '"%s"' % os.path.join(TestUtil.getCppBinDir(), "slice2cpp") @@ -32,7 +32,8 @@ files.sort() for file in files: - print file + "...", + sys.stdout.write(file + "... ") + sys.stdout.flush() if file.find("Underscore") != -1: command = slice2cpp + ' --underscore -I. "%s"' % os.path.join(os.getcwd(), file) @@ -45,19 +46,23 @@ for file in files: 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 + ")") i = 0 while i < len(lines1): - line1 = regex2.sub("", lines1[i]).strip() - line2 = regex2.sub("", lines2[i]).strip() + if sys.version_info[0] == 2: + line1 = regex2.sub("", lines1[i]).strip() + line2 = regex2.sub("", lines2[i]).strip() + else: + line1 = regex2.sub("", lines1[i].decode("utf-8")).strip() + line2 = regex2.sub("", lines2[i]).strip() if line1 != line2: - print "failed! " + print("failed!") sys.exit(1) i = i + 1 else: - print "ok" + print("ok") sys.exit(0) diff --git a/cpp/test/Slice/keyword/run.py b/cpp/test/Slice/keyword/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/Slice/keyword/run.py +++ b/cpp/test/Slice/keyword/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - diff --git a/cpp/test/Slice/structure/run.py b/cpp/test/Slice/structure/run.py index 3c4472ca289..86e9aba519e 100755 --- a/cpp/test/Slice/structure/run.py +++ b/cpp/test/Slice/structure/run.py @@ -16,10 +16,9 @@ if len(head) > 0: path = [os.path.join(head, p) for p in path] path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: - raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * + raise RuntimeError("can't find toplevel directory!") +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil client = os.path.join(os.getcwd(), "client") TestUtil.simpleTest(client) - |