diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-02-14 16:22:39 +0800 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-02-14 16:22:39 +0800 |
commit | 294ec25fda6e3785c54970d274b860b1ca837955 (patch) | |
tree | 26e5d1987ffdfde7bbacb87fdfb7b96bbef998e9 /cpp | |
parent | Merge branch 'bug2435' (diff) | |
download | ice-294ec25fda6e3785c54970d274b860b1ca837955.tar.bz2 ice-294ec25fda6e3785c54970d274b860b1ca837955.tar.xz ice-294ec25fda6e3785c54970d274b860b1ca837955.zip |
merged bug2615
Diffstat (limited to 'cpp')
130 files changed, 1421 insertions, 1764 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 132e0cec35d..dd4a3796260 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,14 @@ Changes since version 3.2.X (binary incompatible) ------------------------------------------------- +- The use of sequences (and structs containing sequences) as valid + dictionary keys has been deprecated and will be removed in a future + release. + +- It is now possible to specify properties in a config file with + space, '#' or '=' in either the key or value string. It is necessary + to escape '#' and '=' as '\#' and '\='. + - The following APIs were deprecated in Ice 3.1 and have been removed: @@ -30,7 +38,7 @@ Changes since version 3.2.X (binary incompatible) - It is now possible for IceBox services to recursively start/stop other IceBox services from within service start/stop method. The Ice.Admin.ThreadPool.Size property much be set to a high enough - value to have enough threads to handle all the number of recursive + value to have enough threads to handle the number of recursive calls to startService/stopService. - Added a new object adapter property, <adapter>.ProxyOptions, which diff --git a/cpp/INSTALL.HP-UX b/cpp/INSTALL.HP-UX index 8a24a3769ea..1f575bc9437 100644 --- a/cpp/INSTALL.HP-UX +++ b/cpp/INSTALL.HP-UX @@ -31,82 +31,28 @@ Third-party libraries Ice has dependencies on a number of third-party libraries: -- Berkeley DB 4.5.20 with C++ support enabled, and built with a C++ - compiler compatible with the one you are using. +- Berkeley DB 4.6.21 +- expat 1.95.7 or 2.0.0 +- OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) +- bzip2 1.0.x +- mcpp 2.6.4 with patch - You can download the Berkeley DB source distribution from +We recommend downloading the Ice third-party source archive from - http://www.oracle.com/technology/software/products/berkeley-db/index.html + http://www.zeroc.com/download.html - We recommend that you configure and build Berkeley DB with: +This archive contains the source distributions for each of the +third-party dependencies, as well as required source patches and +configuration instructions. - $ export CXXOPTS="-AA -mt" - $ export CCOPTS="-mt" - $ ../dist/configure --enable-cxx - (plus --prefix=<dir> and/or --enable-java if you like) - $ gmake +For more information about these dependencies, please refer to +the links below: - If you intend to use Ice for Java with Berkeley DB, you must also - include the option --enable-java. - - For 64-bit builds, use: - - $ export CXXOPTS="-AA +DD64 -mt" - $ export CCOPTS="+DD64 -mt" - $ ../dist/configure --enable-cxx - (plus --prefix=<dir> and/or --enable-java if you like) - $ gmake - -- OpenSSL 0.9.8, which can be downloaded from - - http://www.openssl.org - - We do not recommend using the binary distribution available from - the "Software Porting And Archive Centre for HP-UX" as it depends on - the GCC runtime. - - A recommended configuration is: - - ./Configure hpux-parisc2-cc shared - (and --prefix=<dir> if you like) - - For 64-bit builds, a recommended configuration is: - - ./Configure hpux64-parisc2-cc shared - (and --prefix=<dir> if you like) - -- expat 2.0, which can be downloaded from - - http://sourceforge.net/projects/expat - - For 32-bit builds, you can also use the binary distribution from the - "Software Porting And Archive Centre for HP-UX" located at - http://hpux.cs.utah.edu. - -- bzip2 1.0, which can be downloaded from the "Software Porting And - Archive Centre for HP-UX", http://hpux.cs.utah.edu. For 32-bit - builds, you can also use the binary distribution from the "Software - Porting And Archive Centre for HP-UX". - -- mcpp 2.6.4, which can be downloaded from - - http://mcpp.sourceforge.net/download.html - - After downloading and unpacking the source distribution it is - necessary to first apply a source patch available on the Ice - download page before building. From the mcpp 2.6.4 base directory - run - - patch -p0 < mcpp-2.6.4.patch - - Ice requires the library version of mcpp, so configure mcpp similar - to the following - - ./configure CC=cc CXX=aCC CFLAGS=+Z --enable-mcpplib --disable-shared - (and --prefix=<dir> if you like) - - For 64 bit builds, after installation it is necessary to move libraries - from $(prefix)/lib to $(prefix)/lib/pa20_64. +Berkeley DB http://www.oracle.com/database/berkeley-db/index.html +expat http://expat.sourceforge.net +OpenSSL http://www.openssl.org +bzip2 http://sources.redhat.com/bzip2 +mcpp http://mcpp.sourceforge.net GNU Make 3.80 diff --git a/cpp/INSTALL.LINUX b/cpp/INSTALL.LINUX index 49dc26af07a..f87cd31439c 100644 --- a/cpp/INSTALL.LINUX +++ b/cpp/INSTALL.LINUX @@ -29,55 +29,46 @@ the following compilers are officially supported: - GCC 4.1.x on SLES 10 +Required packages +----------------- + +On RHEL 4, Ice requires the nptl-devel package, which contains the +function pthread_condattr_setclock. + + Third-party libraries --------------------- Ice has dependencies on a number of third-party libraries: -- Berkeley DB 4.5.20 configured with --enable-cxx. - - If you intend to use Ice for Java with Berkeley DB, you must also - include the option --enable-java. - +- Berkeley DB 4.6.21 - expat 1.95.7 or 2.0.0 - - OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) - - bzip2 1.0.x +- mcpp 2.6.4 with patch -Berkeley DB, expat, OpenSSL, and bzip2 are usually included with your -Linux distribution, or you can download them from the following -locations: - -Berkeley DB http://www.oracle.com/database/berkeley-db/index.html -expat http://sourceforge.net/projects/expat/ -OpenSSL http://www.openssl.org -bzip2 http://sources.redhat.com/bzip2 - -RPMs for Berkeley DB 4.5.20 on RHEL 4.4, RHEL 5 and SLES 10 are -available from: - -http://www.zeroc.com/download.html - -- mcpp 2.6.4, which can be downloaded from +Some of these packages may have been included in your Linux +distribution. For those packages that are not installed or have an +older version than what is listed above, we recommend downloading the +Ice third-party source archive from - http://mcpp.sourceforge.net/download.html + http://www.zeroc.com/download.html - After downloading and unpacking the source distribution it is - necessary to first apply a source patch available on the Ice - download page before building. From the mcpp 2.6.4 base directory - run +This archive contains the source distributions for each of the +third-party dependencies, as well as required source patches and +configuration instructions. - patch -p0 < mcpp-2.6.4.patch +ZeroC also supplies RPMs at the link above for Berkeley DB on RHEL +4.x, RHEL 5.x and SLES 10.x. - Ice requires the library version of mcpp, so configure mcpp similar - to the following +For more information about these dependencies, please refer to +the links below: - ./configure CFLAGS=-fPIC --enable-mcpplib --disable-shared - (and --prefix=<dir> if you like) - - For 64 bit machines, after installation it is necessary to rename the - library installation directory from $(prefix)/lib to $(prefix>/lib64. +Berkeley DB http://www.oracle.com/database/berkeley-db/index.html +expat http://expat.sourceforge.net +OpenSSL http://www.openssl.org +bzip2 http://sources.redhat.com/bzip2 +mcpp http://mcpp.sourceforge.net Python diff --git a/cpp/INSTALL.MACOSX b/cpp/INSTALL.MACOSX index fd0601a77f1..8e56d3322bb 100644 --- a/cpp/INSTALL.MACOSX +++ b/cpp/INSTALL.MACOSX @@ -22,35 +22,32 @@ Third-party libraries Ice has dependencies on a number of third-party libraries: -- Berkeley DB 4.5.20 configured with --enable-cxx. +- Berkeley DB 4.6.21 +- expat 1.95.7 or 2.0.0 +- OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) +- bzip2 1.0.x +- mcpp 2.6.4 with patch - If you intend to use Ice for Java with Berkeley DB, you must also - include the option --enable-java. +Some of these packages are included with your system. For those +packages that are not installed or have an older version than what +is listed above, we recommend downloading the Ice third-party source +archive from - You can download the Berkeley DB source distribution from + http://www.zeroc.com/download.html - http://www.oracle.com/technology/software/products/berkeley-db/index.html +This archive contains the source distributions for each of the +third-party dependencies, as well as required source patches and +configuration instructions. -- expat 2.0. You can download expat from +For more information about these dependencies, please refer to +the links below: - http://sourceforge.net/projects/expat/ +Berkeley DB http://www.oracle.com/database/berkeley-db/index.html +expat http://expat.sourceforge.net +OpenSSL http://www.openssl.org +bzip2 http://sources.redhat.com/bzip2 +mcpp http://mcpp.sourceforge.net -- mcpp 2.6.4, which can be downloaded from - - http://mcpp.sourceforge.net/download.html - - After downloading and unpacking the source distribution it is - necessary to first apply a source patch available on the Ice - download page before building. From the mcpp 2.6.4 base directory - run - - patch -p0 < mcpp-2.6.4.patch - - Ice requires the library version of mcpp, so configure mcpp similar - to the following - - ./configure --enable-mcpplib --disable-shared - (and --prefix=<dir> if you like) ====================================================================== Compilation and Testing diff --git a/cpp/INSTALL.SOLARIS b/cpp/INSTALL.SOLARIS index 40543d9c0a6..a560fb3a8f1 100644 --- a/cpp/INSTALL.SOLARIS +++ b/cpp/INSTALL.SOLARIS @@ -35,55 +35,28 @@ Third-party libraries Ice has dependencies on a number of third-party libraries: -- Berkeley DB 4.5.20 configured with --enable-cxx, and built with a - C++ compiler compatible with the one you are using. - - If you intend to use Ice for Java with Berkeley DB, you must also - include the option --enable-java. +- Berkeley DB 4.6.21 +- expat 1.95.7 or 2.0.0 +- OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) +- bzip2 1.0.x +- mcpp 2.6.4 with patch -- expat 1.95.7 or later +We recommend downloading the Ice third-party source archive from -- OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) + http://www.zeroc.com/download.html -- bzip2 1.0 +This archive contains the source distributions for each of the +third-party dependencies, as well as required source patches and +configuration instructions. -You can download these packages at the following locations: +For more information about these dependencies, please refer to +the links below: Berkeley DB http://www.oracle.com/database/berkeley-db/index.html -expat http://sourceforge.net/projects/expat/ +expat http://expat.sourceforge.net OpenSSL http://www.openssl.org bzip2 http://sources.redhat.com/bzip2 - -bzip2, expat and openssl are distributed with the Solaris 10 operating -system. - -The "bundled" expat and openssl are installed in /usr/sfw. If you want -to use the bundled openssl with Ice, we recommend that you also -install the "Solaris 10 Encryption Kit" available from: - -http://www.sun.com/download/index.jsp?cat=Security&tab=3&subcat=Cryptography%20%26%20Encryption - -This kit is required to run the IceSSL tests successfully. - -- mcpp 2.6.4, which can be downloaded from - - http://mcpp.sourceforge.net/download.html - - After downloading and unpacking the source distribution it is - necessary to first apply a source patch available on the Ice - download page before building. From the mcpp 2.6.4 base directory - run - - patch -p0 < mcpp-2.6.4.patch - - Ice requires the library version of mcpp, so configure mcpp similar - to the following - - ./configure CC=cc CXX=CC CFLAGS=-KPIC --enable-mcpplib --disable-shared - (and --prefix=<dir> if you like) - - For 64 bit builds, after installation it is necessary to move libraries - from $(prefix)/lib to $(prefix)/lib/sparcv9. +mcpp http://mcpp.sourceforge.net GNU Make 3.80 diff --git a/cpp/INSTALL.WINDOWS b/cpp/INSTALL.WINDOWS index 44d3f0cea76..3b9f9c6b5ba 100644 --- a/cpp/INSTALL.WINDOWS +++ b/cpp/INSTALL.WINDOWS @@ -1,4 +1,20 @@ ====================================================================== +Introduction +====================================================================== + +This file describes the Ice source distribution, including information +about compiler requirements, third-party dependencies, and +instructions for building and testing the distribution. + +If you prefer, you can download a Windows installer that contains +pre-compiled debug and release libraries, executables, and everything +else necessary to build Ice applications on Windows. Installers for +each supported compiler are available at the link below: + + http://www.zeroc.com/download.html + + +====================================================================== Requirements ====================================================================== @@ -12,7 +28,8 @@ Ice has been extensively tested on: - Windows 2003 Server x86 and x64 - Windows Vista x86 -Ice may work on Windows 2000; however we did not test on this platform. +Ice does not work on Windows 2000; however porting Ice to Windows 2000 +should be fairly simple if you do not require UDP multicast or IPv6. There are several Ice binary distributions available for Windows, each built with a different C++ compiler. These distributions can be @@ -30,6 +47,8 @@ C++ compiler The following C++ compilers are supported: +- Microsoft Visual C++ 2008 + - Microsoft Visual C++ 2005 (both Professional and Express editions) Visual C++ 2005 Express is available for download from: @@ -40,14 +59,12 @@ The following C++ compilers are supported: (February 2003) and STLport 4.6.2 (or later) The Standard Template Library included with Visual C++ 6.0 is not - supported. STLPort is included in the Ice third-party package + supported. STLport is included in the Ice third-party package for Visual C++ 6.0. In order to build the MFC demos, you need to install the MFC "Shared Libraries for Unicode". -- Borland C++Builder 2006 Update 2 - Visual C++ 2005 Express Setup ----------------------------- @@ -82,7 +99,7 @@ Visual C++ 6.0 Setup -------------------- Users of Visual C++ 6.0 need to install the February 2003 Microsoft -Platform SDK to compile Ice: +Platform SDK in order to compile Ice: http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm @@ -118,92 +135,46 @@ Third-party libraries Ice has dependencies on a number of third-party libraries: - STLport 4.6.2 or later (only for Visual C++ 6.0) -- Berkeley DB 4.5.20 +- Berkeley DB 4.6.21 - expat 2.0 - OpenSSL 0.9.7 or later (OpenSSL 0.9.8 or later recommended) - bzip2 1.0 -- mcpp 2.6.4 +- mcpp 2.6.4 with patch -If you have downloaded an Ice binary installer, you already have all -of the required third-party libraries and do not need to download any -additional packages, nor do you need to compile the Ice source -code. +You do not need to build these packages yourself, as ZeroC supplies a +Windows installer for each supported compiler that contains release +and debug libraries for all of the third-party dependencies. -If you want to compile an Ice source distribution, you can download an -installer containing binaries for all of the required third-party -libraries from the ZeroC web site: +If you intend to build the third-party dependencies from source, we +recommend downloading the Ice third-party source archive from http://www.zeroc.com/download.html -Finally, if you prefer to download and install the third-party -dependencies yourself, you can find them at the following locations: - -STLport http://www.stlport.org/download.html -Berkeley DB http://www.oracle.com/database/berkeley-db/index.html -expat http://sourceforge.net/projects/expat/ -OpenSSL http://www.openssl.org -bzip2 http://sources.redhat.com/bzip2 -mcpp http://mcpp.sourceforge.net/download.html - -For STLport installation instructions, please refer to - - http://www.stlport.org/doc/install.html - -Note: For a regular build of bzip2, both the debug and the release -library are named "libbz2.lib". In order to have both a debug and a -release version on your system, please rename the debug library to -"libbz2d.lib". This is also what the Ice project files expect if you -build a debug version of Ice. - -Since Ice requires the library version of mcpp you cannot use the -mcpp Windows installer but must build it yourself. Once you downloaded -and unpacked the mcpp source package use the following steps to build -mcpp: - -1. From the mcpp base direcory apply the mcpp source patch available - on the Ice download page: - - patch -p0 < mcpp-2.6.4.patch +This archive contains the source distributions for each of the +third-party dependencies, as well as required source patches and +configuration instructions. - You can download the patch utility from the following location if - you do not already have it available. +For more information about these dependencies, please refer to +the links below: - http://gnuwin32.sourceforge.net/packages/patch.htm +STLport http://www.stlport.org +Berkeley DB http://www.oracle.com/database/berkeley-db/index.html +expat http://expat.sourceforge.net +OpenSSL http://www.openssl.org +bzip2 http://sources.redhat.com/bzip2 +mcpp http://mcpp.sourceforge.net -2. CD to the mcpp src directory: - cd src - -3. Apply the appropriate patch for noconfig.H from the noconfig - directory. For example for VS2005 you would run: - - patch -p0 < ../noconfig/vc2005.def - -4. Build the mcpp library: - - nmake MCPP_LIB=1 /f ../nonconfig/visualc.mak mcpplib - - Or for the debug version of the library: - - nmake MCPP_LIB=1 DEBUG=1 /f ../nonconfig/visualc.mak mcpplib - -If you compile the third-party libraries from source code, we -recommend that you use the same Visual C++ version to build all of -the third-party libraries. - -Users of Visual C++ 6.0 must configure Visual Studio to use STLPort -before building Berkeley DB: - -- In the Visual C++ 6.0 IDE, choose Tools->Options->Directories - -- Select "Include files" - -- Add the include directory for STLport first in the list. (Note that - you must add the "include\stlport" directory, not just "include".) +Monotonic clock +--------------- -- Select "Library files" +Ice uses the QueryPerformanceCounter Windows API function to measure +time with a monotonic clock. If you are experiencing timing or +performance issues, there are two knowledgebase articles that may be +relevant for your system: -- Add the lib directory for STLport. + http://support.microsoft.com/?id=896256 + http://support.microsoft.com/?id=895980 Python @@ -216,15 +187,6 @@ You can download a Python distribution for Windows from http://www.python.org/download -Important note for Windows 98, Windows 98 SE and Windows ME users: - -The Windows 9x shell is too limited to run the Ice test suite. For -these versions of Windows, you need Cygwin and the python interpreter -that comes with Cygwin in order to run the test suite. Cygwin can be -downloaded from: - - http://www.cygwin.com - ====================================================================== Compilation and Testing diff --git a/cpp/Makefile b/cpp/Makefile index ebbf69df8d3..1839141d02f 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -13,15 +13,10 @@ include $(top_srcdir)/config/Make.rules SUBDIRS = config src include test demo doc -INSTALL_SUBDIRS = $(install_bindir) $(install_libdir) $(install_includedir) $(install_slicedir) $(install_docdir) +INSTALL_SUBDIRS = $(install_bindir) $(install_libdir) $(install_includedir) $(install_docdir) -install:: - @if test ! -d $(prefix) ; \ - then \ - echo "Creating $(prefix)..." ; \ - $(call mkdir,$(prefix)) ; \ - fi -ifneq ($(embedded_runpath_prefix),) +install:: install-common +ifeq ("$(create_runpath_symlink)",yes) @if test -h $(embedded_runpath_prefix) ; \ then \ if `\rm -f $(embedded_runpath_prefix) 2>/dev/null`; \ @@ -40,13 +35,6 @@ endif fi ; \ done - cd ../slice ; \ - for subdir in * ; \ - do \ - echo "Copying slice/$$subdir to $(install_slicedir)..." ; \ - cp -fpr $$subdir $(install_slicedir) ; \ - done ; - $(EVERYTHING):: @for subdir in $(SUBDIRS); \ do \ @@ -54,22 +42,5 @@ $(EVERYTHING):: ( cd $$subdir && $(MAKE) $@ ) || exit 1; \ done -doc:: - @( cd doc && $(MAKE) ) || exit 1 - -install:: - @if test -d doc ; \ - then \ - ( cd doc && $(MAKE) install ) || exit 1 ; \ - fi - $(call installdata,ICE_LICENSE,$(prefix)) - $(call installdata,LICENSE,$(prefix)) - -clean:: - @if test -d doc ; \ - then \ - ( cd doc && $(MAKE) clean ) || exit 1 ; \ - fi - test:: @python $(top_srcdir)/allTests.py diff --git a/cpp/Makefile.mak b/cpp/Makefile.mak index bc98b309cfc..343fe201c37 100644 --- a/cpp/Makefile.mak +++ b/cpp/Makefile.mak @@ -13,15 +13,9 @@ top_srcdir = . SUBDIRS = config src include test demo doc -INSTALL_SUBDIRS = $(install_bindir) $(install_libdir) $(install_includedir) $(install_slicedir) $(install_docdir) - -install:: createdir - -createdir:: - @if not exist $(prefix) \ - @echo "Creating $(prefix)..." && \ - mkdir $(prefix) +INSTALL_SUBDIRS = $(install_bindir) $(install_libdir) $(install_includedir) $(install_docdir) +install:: install-common @for %i in ( $(INSTALL_SUBDIRS) ) do \ @if not exist %i \ @echo "Creating %i..." && \ @@ -31,13 +25,6 @@ $(EVERYTHING):: @for %i in ( $(SUBDIRS) ) do \ @echo "making $@ in %i" && \ cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1 -install:: - @echo "Copying slice files..." && \ - cmd /c "xcopy /s /y ..\slice $(install_slicedir)" || exit 1 - -install:: - copy ICE_LICENSE $(prefix) - copy LICENSE $(prefix) test:: @python $(top_srcdir)/allTests.py diff --git a/cpp/allDemos.py b/cpp/allDemos.py index 98936c9d3cc..4298a3dd730 100755 --- a/cpp/allDemos.py +++ b/cpp/allDemos.py @@ -8,51 +8,17 @@ # # ********************************************************************** -import os, sys, getopt, re +import os, sys -def isCygwin(): - # The substring on sys.platform is required because some cygwin - # versions return variations like "cygwin_nt-4.01". - return sys.platform[:6] == "cygwin" - -if sys.platform == "win32": - print "allDemos.py only supports cygwin python under Windows (use /usr/bin/python allDemos.py)" - sys.exit(1) - -def runDemos(args, demos, num = 0): - - rootPath = "demo" - if not os.path.exists(rootPath): - rootPath = "." - - if len(demos) > 0 and not os.path.exists(os.path.join(rootPath, os.path.normpath(demos[0]))): - print "Unable to locate first demo. Check directory structure and location of scripts" - sys.exit(1) - - # - # Run each of the demos. - # - for i in demos: - - i = os.path.normpath(i) - dir = os.path.join(rootPath, i) - - print - if(num > 0): - print "[" + str(num) + "]", - print "*** running demo in " + dir, - print - - if isCygwin(): - status = os.system("cd %s ; %s %s" % (dir, "/usr/bin/python expect.py", args)) - else: - status = os.system("cd %s ; %s %s" % (dir, "./expect.py", args)) +for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.abspath(toplevel) + if os.path.exists(os.path.join(toplevel, "config", "DemoUtil.py")): + break +else: + raise "can't find toplevel directory!" - if status: - if(num > 0): - print "[" + str(num) + "]", - print "test in " + dir + " failed with exit status", status, - sys.exit(status) +sys.path.append(os.path.join(toplevel, "config")) +import DemoUtil # # List of all basic demos. @@ -80,6 +46,7 @@ demos = [ "IceGrid/allocate", "IceGrid/sessionActivation", "IceGrid/replication", + "IceGrid/icebox", "Glacier2/chat", "Glacier2/callback", "Freeze/bench", @@ -88,6 +55,7 @@ demos = [ "Freeze/library", "Freeze/backup", "Freeze/transform", + "Freeze/casino", "book/freeze_filesystem", "book/simple_filesystem", "book/printer", @@ -97,71 +65,7 @@ demos = [ # # These demos are currently disabled on cygwin # -if isCygwin() == 0: +if DemoUtil.isCygwin() == 0: demos += [ ] -def usage(): - print "usage: %s " % (sys.argv[0]) - print " --start=<regex> Start running the demos at the given demo." - print " --start-after=<regex> Start running the demos after the given demo." - print " --loop Run the demos in a loop." - print " --filter=<regex> Run all the demos that match the given regex." - print " --rfilter=<regex> Run all the demos that do not match the given regex." - print " --fast Run an abbreviated version of the demos." - print " --debug Display debugging information on each demos." - print " --trace Run the demos with tracing enabled." - print " --host=host Set --Ice.Default.Host=<host>." - print " --mode=debug|release Run the demos with debug or release mode builds (win32 only)." - sys.exit(2) - -try: - opts, args = getopt.getopt(sys.argv[1:], "lr:R:", [ - "filter=", "rfilter=", "start-after=", "start=", "loop", "fast", "trace", "debug", "host=", "mode="]) -except getopt.GetoptError: - usage() - -# Extra args cause a usage error. -if args: - usage() - -def index(l, re): - """Find the index of the first item in the list that matches the given re""" - for i in range(0, len(l)): - if re.search(l[i]): - return i - return -1 - -loop = False -arg = "" -for o, a in opts: - if o in ("-l", "--loop"): - loop = True - elif o in ("-r", "-R", "--filter", '--rfilter'): - regexp = re.compile(a) - if o in ("--rfilter", "-R"): - demos = [ x for x in demos if not regexp.search(x) ] - else: - demos = [ x for x in demos if regexp.search(x) ] - elif o in ("--host", "--fast", "--trace", "--debug", "--mode"): - if o == "--mode": - if a not in ( "debug", "release"): - usage() - arg += " " + o - if len(a) > 0: - arg += " " + a - elif o in ('--start', "--start-after"): - start = index(demos, re.compile(a)) - if start == -1: - print "demo %s not found. no demos to run" % (a) - sys.exit(2) - if o == "--start-after": - start += 1 - demos = demos[start:] - -if loop: - num = 1 - while 1: - runDemos(arg, demos, num) - num += 1 -else: - runDemos(arg, demos) +DemoUtil.run(demos) diff --git a/cpp/allTests.py b/cpp/allTests.py index fb8a2723ce7..c8afb08143d 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -20,7 +20,6 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil - # # List of all basic tests. # diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index 4536a4e97d4..ed6f03c25ac 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -95,12 +95,6 @@ USE_READLINE ?= no #MCPP_HOME ?= /opt/mcpp # -# Define if your OpenSSL requires Kerberos, and if Kerberos is not -# installed in a standard location -# -KERBEROS_HOME ?= /usr/kerberos - -# # If readline is not installed in a standard location where the # compiler can find it, AND you want to use readline, set # READLINE_HOME to the readline installation directory. @@ -133,8 +127,6 @@ else endif install_includedir = $(prefix)/include -install_slicedir = $(prefix)/slice -install_schemadir = $(prefix)/schema install_docdir = $(prefix)/doc ifdef ice_src_dist bindir = $(top_srcdir)/bin @@ -162,7 +154,8 @@ else endif ifneq ($(embedded_runpath_prefix),) - runpath_libdir := $(embedded_runpath_prefix)/$(libsubdir) + runpath_libdir := $(embedded_runpath_prefix)/$(libsubdir) + create_runpath_symlink ?= yes endif ifneq ($(STLPORT_HOME),) @@ -190,9 +183,9 @@ ifneq ($(DB_HOME),) DB_LIBS = -L$(DB_HOME)/$(libsubdir) -ldb_cxx DB_RPATH_LINK = $(call rpathlink,$(DB_HOME)/$(libsubdir)) else - ifeq ($(shell if [ -d /usr/include/db45 -a -d /usr/$(libsubdir)/db45 ] ; then echo yes; fi), yes) - DB_FLAGS = -I/usr/include/db45 - DB_LIBS = -L/usr/$(libsubdir)/db45 -ldb_cxx + ifeq ($(shell if [ -d /usr/include/db46 -a -d /usr/$(libsubdir)/db46 ] ; then echo yes; fi), yes) + DB_FLAGS = -I/usr/include/db46 + DB_LIBS = -L/usr/$(libsubdir)/db46 -ldb_cxx else DB_LIBS = -ldb_cxx endif diff --git a/cpp/config/Make.rules.mak b/cpp/config/Make.rules.mak index 1e9bcfdf591..8c147dd040e 100755 --- a/cpp/config/Make.rules.mak +++ b/cpp/config/Make.rules.mak @@ -88,7 +88,7 @@ MT = mt.exe ice_language = cpp !if !exist ($(top_srcdir)\..\cpp) # Don't check for slice2cpp in ICE_HOME if building the source distribution -slice_translator = slice2cpp +slice_translator = slice2cpp.exe !endif !if exist ($(top_srcdir)\..\config\Make.common.rules) @@ -109,8 +109,6 @@ includedir = $(ice_dir)\include install_bindir = $(prefix)\bin install_includedir = $(prefix)\include -install_slicedir = $(prefix)\slice -install_schemadir = $(prefix)\schema install_docdir = $(prefix)\doc install_libdir = $(prefix)\lib libsubdir = lib diff --git a/cpp/config/Make.rules.msvc b/cpp/config/Make.rules.msvc index 4a497880b90..31576db14f4 100755 --- a/cpp/config/Make.rules.msvc +++ b/cpp/config/Make.rules.msvc @@ -33,7 +33,7 @@ LDFLAGS = /LIBPATH:"$(THIRDPARTY_HOME)\lib" !endif !if "$(CPP_COMPILER)" == "VC60" -CPPFLAGS = -I"$(THIRDPARTY_HOME)\include\stlport" -D_STLP_NEW_PLATFORM_SDK $(CPPFLAGS) +CPPFLAGS = -I"$(THIRDPARTY_HOME)\include\stlport" $(CPPFLAGS) !endif !endif diff --git a/cpp/demo/Freeze/casino/.gitignore b/cpp/demo/Freeze/casino/.gitignore index cad7a8f63f0..4a22629a03a 100644 --- a/cpp/demo/Freeze/casino/.gitignore +++ b/cpp/demo/Freeze/casino/.gitignore @@ -8,7 +8,7 @@ CasinoStore.cpp Casino.h CasinoStore.h db/__catalog -db/__catalogIndexLIst +db/__catalogIndexList db/bet db/bank db/player diff --git a/cpp/demo/Freeze/casino/expect.py b/cpp/demo/Freeze/casino/expect.py new file mode 100755 index 00000000000..a374606fc26 --- /dev/null +++ b/cpp/demo/Freeze/casino/expect.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +demoscript.Util.defaultLanguage = "C++" +import demoscript.Freeze.casino + +demoscript.Freeze.casino.run('./client', './server') diff --git a/cpp/demo/Ice/MFC/client/stdafx.h b/cpp/demo/Ice/MFC/client/stdafx.h index 5d207793d98..09a7123ec78 100644 --- a/cpp/demo/Ice/MFC/client/stdafx.h +++ b/cpp/demo/Ice/MFC/client/stdafx.h @@ -7,55 +7,55 @@ // // ********************************************************************** -
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
-
-#pragma once
-
-//
-// For VC6 and STLport
-//
-#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
-# define _STLP_DEBUG
-#endif
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
-#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
-#endif
-
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
-#endif
-#endif
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-#include <Ice/Ice.h>
+ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +// +// For VC6 and STLport +// +#if !defined(NDEBUG) && !defined(_STLP_DEBUG) +# define _STLP_DEBUG +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#if 0 +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#endif +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions + +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include <Ice/Ice.h> diff --git a/cpp/demo/Ice/MFC/server/stdafx.h b/cpp/demo/Ice/MFC/server/stdafx.h index 5d207793d98..09a7123ec78 100644 --- a/cpp/demo/Ice/MFC/server/stdafx.h +++ b/cpp/demo/Ice/MFC/server/stdafx.h @@ -7,55 +7,55 @@ // // ********************************************************************** -
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
-
-#pragma once
-
-//
-// For VC6 and STLport
-//
-#if !defined(NDEBUG) && !defined(_STLP_DEBUG)
-# define _STLP_DEBUG
-#endif
-
-#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-// Modify the following defines if you have to target a platform prior to the ones specified below.
-// Refer to MSDN for the latest info on corresponding values for different platforms.
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
-#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
-#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
-#endif
-
-#if 0
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
-#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
-#endif
-
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
-#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
-#endif
-#endif
-
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
-
-#include <afxwin.h> // MFC core and standard components
-#include <afxext.h> // MFC extensions
-
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
-#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
-#endif // _AFX_NO_AFXCMN_SUPPORT
-
-#include <Ice/Ice.h>
+ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +// +// For VC6 and STLport +// +#if !defined(NDEBUG) && !defined(_STLP_DEBUG) +# define _STLP_DEBUG +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. +#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. +#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#endif + +#if 0 +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. +#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. +#endif +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include <afxwin.h> // MFC core and standard components +#include <afxext.h> // MFC extensions + +#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include <afxcmn.h> // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include <Ice/Ice.h> diff --git a/cpp/demo/Ice/converter/expect.py b/cpp/demo/Ice/converter/expect.py index 287d5d0d4fd..03b603661e4 100755 --- a/cpp/demo/Ice/converter/expect.py +++ b/cpp/demo/Ice/converter/expect.py @@ -33,7 +33,7 @@ client.expect('.*==>') print "testing with conversion... ", sys.stdout.flush() client.sendline('u') -server.expect('Received \\(UTF-8\\): "Bonne journ(351)e"') +server.expect('Received \\(UTF-8\\): "Bonne journ\\\\351e"') client.expect('Received: "Bonne journ\\\\303\\\\251e"') print "ok" diff --git a/cpp/demo/IceGrid/icebox/expect.py b/cpp/demo/IceGrid/icebox/expect.py new file mode 100755 index 00000000000..b5d15e89099 --- /dev/null +++ b/cpp/demo/IceGrid/icebox/expect.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +try: + import demoscript +except ImportError: + for toplevel in [".", "..", "../..", "../../..", "../../../.."]: + toplevel = os.path.normpath(toplevel) + if os.path.exists(os.path.join(toplevel, "demoscript")): + break + else: + raise "can't find toplevel directory!" + sys.path.append(os.path.join(toplevel)) + import demoscript + +import demoscript.Util +demoscript.Util.defaultLanguage = "C++" +import demoscript.IceGrid.icebox + +demoscript.IceGrid.icebox.run('./client') diff --git a/cpp/demo/IcePatch2/MFC/stdafx.h b/cpp/demo/IcePatch2/MFC/stdafx.h index 4d8823b0936..aaef3805f37 100755 --- a/cpp/demo/IcePatch2/MFC/stdafx.h +++ b/cpp/demo/IcePatch2/MFC/stdafx.h @@ -27,11 +27,11 @@ // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. -#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. -#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. +#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #if 0 diff --git a/cpp/demo/IceStorm/replicated/expect.py b/cpp/demo/IceStorm/replicated/expect.py index d7661c01431..e3618b8e72b 100755 --- a/cpp/demo/IceStorm/replicated/expect.py +++ b/cpp/demo/IceStorm/replicated/expect.py @@ -52,7 +52,7 @@ else: print "starting icegridnode...", sys.stdout.flush() node = demoscript.Util.spawn('icegridnode --Ice.Config=config.grid --Ice.PrintAdapterReady %s' % (args)) -node.expect('IceGrid.Registry.Internal ready\r{1,2}\nIceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.Client ready\r{1,2}\nIceGrid.Node ready') +node.expect('IceGrid.Registry.Server ready\r{1,2}\nIceGrid.Registry.AdminCallbackRouter ready\r{1,2}\nIceGrid.Registry.Client ready\r{1,2}\nIceGrid.Node ready') print "ok" print "deploying application...", diff --git a/cpp/demo/book/freeze_filesystem/freezefsS.dsp b/cpp/demo/book/freeze_filesystem/freezefsS.dsp index b5b7a2c9494..a15ea1d0b46 100755 --- a/cpp/demo/book/freeze_filesystem/freezefsS.dsp +++ b/cpp/demo/book/freeze_filesystem/freezefsS.dsp @@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 Freeze Ice.lib IceUtil.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /out:"server.exe" /libpath:"../../../lib" /FIXED:no
+# ADD LINK32 Freeze.lib Ice.lib IceUtil.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /out:"server.exe" /libpath:"../../../lib" /FIXED:no
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "freezefsS - Win32 Debug"
diff --git a/cpp/doc/Makefile b/cpp/doc/Makefile index 11c03b57af7..6d2eb1b5b50 100644 --- a/cpp/doc/Makefile +++ b/cpp/doc/Makefile @@ -38,27 +38,24 @@ reference/index.html: $(SLICEFILES) clean:: -rm -rf reference/* -install:: - @if test -f reference/index.html ; \ +install:: reference/index.html + @if test ! -d $(install_docdir)/reference ; \ then \ - if test ! -d $(install_docdir)/reference ; \ - then \ - echo "Creating $(install_docdir)/reference..." ; \ - $(call mkdir,$(install_docdir)/reference) ; \ - fi ; \ - echo "Installing HTML..." ; \ - $(call installdata,reference/*.*,$(install_docdir)/reference) ; \ - for i in reference/*; \ - do if test -d $$i ; \ - then \ - if test ! -d $(install_docdir)/$$i ; \ - then \ - echo "Creating $(install_docdir)/$$i..." ; \ - $(call mkdir,$(install_docdir)/$$i) ; \ - fi ; \ - echo "Installing files in $$i..." ; \ - $(call installdata,$$i/*.*,$(install_docdir)/$$i) ; \ - fi; \ - done ; \ - fi + echo "Creating $(install_docdir)/reference..." ; \ + $(call mkdir,$(install_docdir)/reference) ; \ + fi ; \ + echo "Installing HTML..." ; \ + $(call installdata,reference/*.*,$(install_docdir)/reference) ; \ + for i in reference/*; \ + do if test -d $$i ; \ + then \ + if test ! -d $(install_docdir)/$$i ; \ + then \ + echo "Creating $(install_docdir)/$$i..." ; \ + $(call mkdir,$(install_docdir)/$$i) ; \ + fi ; \ + echo "Installing files in $$i..." ; \ + $(call installdata,$$i/*.*,$(install_docdir)/$$i) ; \ + fi; \ + done ; \ diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 62a06dd5b0d..41bbcd39a57 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -97,15 +97,15 @@ #if defined(_WIN32) -// -// Comment out the following block if you want to run on Windows 9x -// or Windows NT 3.51. -// # ifndef _WIN32_WINNT // - // Necessary for TryEnterCriticalSection. + // Necessary for TryEnterCriticalSection (see IceUtil/Mutex.h). // -# define _WIN32_WINNT 0x0400 +# if defined(_MSC_VER) && _MSC_VER < 1500 +# define _WIN32_WINNT 0x0400 +# endif +# elif _WIN32_WINNT < 0x0400 +# error "TryEnterCricalSection requires _WIN32_WINNT >= 0x0400" # endif # if !defined(ICE_STATIC_LIBS) && defined(_MSC_VER) && (!defined(_DLL) || !defined(_MT)) @@ -130,6 +130,13 @@ // ...: decorated name length exceeded, name was truncated # pragma warning( disable : 4503 ) # endif + + // + // For STLport. Define _STLP_NEW_PLATFORM_SDK if a PSDK newer than the PSDK included with VC6. + // +# if !defined(_STLP_NEW_PLATFORM_SDK) && WINVER > 0x0400 +# define _STLP_NEW_PLATFORM_SDK 1 +# endif #endif // diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h index 0ed13b36672..1d7f3fb018b 100644 --- a/cpp/include/IceUtil/Mutex.h +++ b/cpp/include/IceUtil/Mutex.h @@ -97,12 +97,7 @@ private: friend class Cond; #ifdef _WIN32 -# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400 mutable CRITICAL_SECTION _mutex; -# else - mutable HANDLE _mutex; - mutable int _recursionCount; -# endif #else mutable pthread_mutex_t _mutex; #endif @@ -114,8 +109,6 @@ private: #ifdef _WIN32 -# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0400 - inline Mutex::Mutex() { @@ -169,93 +162,6 @@ Mutex::lock(LockState&) const EnterCriticalSection(&_mutex); } -# else - -inline -Mutex::Mutex() : - _recursionCount(0) -{ - _mutex = CreateMutex(0, false, 0); - if(_mutex == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -inline -Mutex::~Mutex() -{ - BOOL rc = CloseHandle(_mutex); - if(rc == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -inline void -Mutex::lock() const -{ - DWORD rc = WaitForSingleObject(_mutex, INFINITE); - if(rc != WAIT_OBJECT_0) - { - if(rc == WAIT_FAILED) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, 0); - } - } - _recursionCount++; -} - -inline bool -Mutex::tryLock() const -{ - DWORD rc = WaitForSingleObject(_mutex, 0); - if(rc != WAIT_OBJECT_0) - { - return false; - } - else if(_recursionCount == 1) - { - _recursionCount++; - unlock(); - throw ThreadLockedException(__FILE__, __LINE__); - } - else - { - _recursionCount++; - return true; - } -} - -inline void -Mutex::unlock() const -{ - _recursionCount--; - BOOL rc = ReleaseMutex(_mutex); - if(rc == 0) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } -} - -inline void -Mutex::unlock(LockState& state) const -{ - unlock(); -} - -inline void -Mutex::lock(LockState&) const -{ - lock(); -} - -# endif - #else inline diff --git a/cpp/include/IceUtil/StringUtil.h b/cpp/include/IceUtil/StringUtil.h index b7859ec6946..351739cc311 100644 --- a/cpp/include/IceUtil/StringUtil.h +++ b/cpp/include/IceUtil/StringUtil.h @@ -35,6 +35,11 @@ ICE_UTIL_API bool unescapeString(const std::string&, std::string::size_type, std ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&); // +// Trim white space +// +ICE_UTIL_API std::string trim(const std::string&); + +// // If a single or double quotation mark is found at the start // position, then the position of the matching closing quote is // returned. If no quotation mark is found at the start position, then diff --git a/cpp/include/Slice/DotNetNames.h b/cpp/include/Slice/DotNetNames.h index df552e0d35c..31fab7dc985 100755 --- a/cpp/include/Slice/DotNetNames.h +++ b/cpp/include/Slice/DotNetNames.h @@ -20,7 +20,7 @@ namespace DotNet enum BaseType { - Object=1, ICloneable=2, Exception=4, ApplicationException=8, END=16 + Object=1, ICloneable=2, Exception=4, END=8 }; extern const char * manglePrefix; diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index 97a6c4482a0..13bf21c233f 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -773,7 +773,7 @@ public: virtual void visit(ParserVisitor*, bool); virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - static bool legalKeyType(const TypePtr&); + static bool legalKeyType(const TypePtr&, bool&); protected: diff --git a/cpp/makedist.py b/cpp/makedist.py deleted file mode 100755 index 8051c63d8e4..00000000000 --- a/cpp/makedist.py +++ /dev/null @@ -1,439 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -import os, sys, shutil, fnmatch, re, glob - -# -# Program usage. -# -def usage(): - print "Usage: " + sys.argv[0] + " [options]" - print - print "Options:" - print "-h Show this message." - print "-v Be verbose." - -# -# Find files matching a pattern. -# -def find(path, patt): - result = [ ] - files = os.listdir(path) - for x in files: - fullpath = os.path.join(path, x); - if os.path.isdir(fullpath) and not os.path.islink(fullpath): - result.extend(find(fullpath, patt)) - elif fnmatch.fnmatch(x, patt): - result.append(fullpath) - return result - -# -# Comment out rules in a Makefile. -# -def fixMakefile(file, target): - origfile = file + ".orig" - os.rename(file, origfile) - oldMakefile = open(origfile, "r") - newMakefile = open(file, "w") - origLines = oldMakefile.readlines() - - doComment = 0 - doCheck = 0 - newLines = [] - for x in origLines: - # - # If the rule contains the target string, then - # comment out this rule. - # - if not x.startswith("\t") and x.find(target) != -1 and x.find(target + ".o") == -1: - doComment = 1 - # - # If the line starts with "clean::", then check - # the following lines and comment out any that - # contain the target string. - # - elif x.startswith("clean::"): - doCheck = 1 - # - # Stop when we encounter an empty line. - # - elif len(x.strip()) == 0: - doComment = 0 - doCheck = 0 - - if doComment or (doCheck and x.find(target) != -1): - x = "#" + x - newLines.append(x) - - newMakefile.writelines(newLines) - newMakefile.close() - oldMakefile.close() - os.remove(origfile) - -# -# Remove lines containing a keyword from a file. -# -def editFile(file, target): - origfile = file + ".orig" - os.rename(file, origfile) - oldFile = open(origfile, "r") - newFile = open(file, "w") - origLines = oldFile.readlines() - - newLines = [] - for x in origLines: - if x.find(target) == -1: - newLines.append(x) - - newFile.writelines(newLines) - newFile.close() - oldFile.close() - os.remove(origfile) - -# -# Comment out rules in VC project. -# -def fixProject(file, target): - origfile = file + ".orig" - os.rename(file, origfile) - oldProject = open(origfile, "r") - newProject = open(file, "w") - origLines = oldProject.readlines() - - # - # Find a Source File declaration containing SOURCE=<target> - # and comment out the entire declaration. - # - expr = re.compile("SOURCE=.*" + target.replace(".", "\\.") + ".*") - inSource = 0 - doComment = 0 - newLines = [] - source = [] - for x in origLines: - if x.startswith("# Begin Source File"): - inSource = 1 - - if inSource: - if not doComment and expr.match(x) != None: - doComment = 1 - source.append(x) - else: - newLines.append(x) - - if x.startswith("# End Source File"): - inSource = 0 - for s in source: - if doComment: - newLines.append('#xxx#' + s) - else: - newLines.append(s) - doComment = 0 - source = [] - - newProject.writelines(newLines) - newProject.close() - oldProject.close() - os.remove(origfile) - -# -# Comment out implicit parser/scanner rules in config/Make.rules. -# -def fixMakeRules(file): - origfile = file + ".orig" - os.rename(file, origfile) - oldFile = open(origfile, "r") - newFile = open(file, "w") - origLines = oldFile.readlines() - - doComment = 0 - newLines = [] - for x in origLines: - if x.find("%.y") != -1 or x.find("%.l") != -1: - doComment = 1 - # - # Stop when we encounter an empty line. - # - elif len(x.strip()) == 0: - doComment = 0 - - if doComment: - x = "#" + x - newLines.append(x) - - newFile.writelines(newLines) - newFile.close() - oldFile.close() - os.remove(origfile) - -# -# Fix version in README, INSTALL files -# -def fixVersion(files, version, mmversion): - - for file in files: - origfile = file + ".orig" - os.rename(file, origfile) - oldFile = open(origfile, "r") - newFile = open(file, "w") - line = oldFile.read(); - line = re.sub("@ver@", version, line) - line = re.sub("@mmver@", mmversion, line) - newFile.write(line) - newFile.close() - oldFile.close() - os.remove(origfile) - -# -# Check arguments -# -verbose = 0 -for x in sys.argv[1:]: - if x == "-h": - usage() - sys.exit(0) - elif x == "-v": - verbose = 1 - elif x.startswith("-"): - print sys.argv[0] + ": unknown option `" + x + "'" - print - usage() - sys.exit(1) - -if os.path.exists("../.git"): - print "ERROR: Unable to run in repository! Exiting..." - sys.exit(1) - -# -# Remove any existing "dist" directory and create a new one. -# -distdir = "dist" -if os.path.exists(distdir): - shutil.rmtree(distdir) -os.mkdir(distdir) - -if verbose: - quiet = "v" -else: - quiet = "" - -# -# Get Ice version. -# -config = open(os.path.join("include", "IceUtil", "Config.h"), "r") -version = re.search("ICE_STRING_VERSION \"([0-9\.b]*)\"", config.read()).group(1) -mmversion = re.search("([0-9]+\.[0-9b]+)[\.0-9]*", version).group(1) - -print "Creating Ice-rpmbuild..." -rpmbuildver = os.path.join("dist", "Ice-rpmbuild-" + version) -fixVersion(find(os.path.join("install", "rpm"), "icegridregistry.*"), version, mmversion) -fixVersion(find(os.path.join("install", "rpm"), "icegridnode.*"), version, mmversion) -fixVersion(find(os.path.join("install", "rpm"), "glacier2router.*"), version, mmversion) -fixVersion(find(os.path.join("install", "rpm"), "README.RPM"), version, mmversion) -fixVersion(find(os.path.join("install", "unix"), "THIRD_PARTY_LICENSE.Linux"), version, mmversion) -fixVersion(find(os.path.join("install", "unix"), "README.Linux-RPM"), version, mmversion) -fixVersion(find(os.path.join("install", "unix"), "SOURCES.Linux"), version, mmversion) - -if os.system("tar c" + quiet + "f " + rpmbuildver + ".tar " + - "-C .. `[ -e RELEASE_NOTES.txt ] && echo ""RELEASE_NOTES.txt""` " + - "-C cpp/install -C rpm {icegridregistry,icegridnode,glacier2router}.{conf,suse,redhat} README.RPM " + - "-C ../unix THIRD_PARTY_LICENSE.Linux README.Linux-RPM SOURCES.Linux " + - "-C ../thirdparty/php ice.ini"): - print >> sys.stderr, "ERROR: Archiving failed" - sys.exit(1) - -if os.system("gzip -9 " + rpmbuildver + ".tar"): - print >> sys.stderr, "ERROR: Archiving failed" - sys.exit(1) - - -# -# Create archives. -# -print "Creating distribution..." -icever = "Ice-" + version - -print "Creating exclusion file..." -filesToRemove = [ \ - "makedist.py", \ - "makebindist.py", \ - "iceemakedist.py", \ - "RPMTools.py", \ - "fixCopyright.py", \ - "fixVersion.py", \ - "icee.dsw", \ - "icee.dsp", \ - "allDemos.py", \ - os.path.join("config", "makegitignore.py"), \ - os.path.join("src", "icecpp", "icecppe.dsp"), \ - os.path.join("src", "IceUtil", "iceutile.dsp"), \ - os.path.join("src", "Slice", "slicee.dsp"), \ - "dist", \ - "install", \ - os.path.join("src", "slice2cppe"), \ - os.path.join("src", "slice2javae"), \ - os.path.join("exclusions") - ] - -filesToRemove.extend(find(".", ".gitignore")) -filesToRemove.extend(find(".", "expect.py")) - -exclusionFile = open("exclusions", "w") -for x in filesToRemove: - exclusionFile.write("%s\n" % x) -exclusionFile.close() -os.mkdir(os.path.join("dist", icever)) -if os.system("tar c" + quiet + " -X exclusions . | ( cd " + os.path.join("dist", icever) + " && tar xf - )"): - print >> sys.stderr, "ERROR: demo script archive caused errors" - sys.exit(1) -os.remove("exclusions") -os.chdir("dist") - -if os.system("chmod -R u+rw,go+r-w %s " % icever): - print >> sys.stderr, "ERROR: unable to set directory permissions" - sys.exit(1) - -# -# Printing warnings here instead of exiting because these probably -# are not errors per-se but may reflect an unnecessary operation. -# -if os.system("find %s \\( -name \"*.h\" -or -name \"*.cpp\" -or -name \"*.ice\" \\) -exec chmod a-x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" -if os.system("find %s \\( -name \"README*\" -or -name \"INSTALL*\" \\) -exec chmod a-x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" -if os.system("find %s \\( -name \"*.xml\" -or -name \"*.mc\" \\) -exec chmod a-x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" -if os.system("find %s \\( -name \"Makefile\" -or -name \"*.dsp\" \\) -exec chmod a-x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" -if os.system("find %s -type d -exec chmod a+x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" -if os.system("find %s -perm +111 -exec chmod a+x {} \\;" % icever): - print >> sys.stderr, "WARNING: find returned non-zero result" - -print "Fixing version in various files..." -fixVersion(find(icever, "README*"), version, mmversion) -fixVersion(find(icever, "INSTALL*"), version, mmversion) -fixVersion(find(os.path.join(icever, "config"), "glacier2router.cfg"), version, mmversion) -fixVersion(find(os.path.join(icever, "config"), "icegridregistry.cfg"), version, mmversion) - -# -# Generate bison files. -# -print "Generating bison files..." -cwd = os.getcwd() -grammars = find(icever, "*.y") -for x in grammars: - # - # Change to the directory containing the file. - # - (dir,file) = os.path.split(x) - os.chdir(dir) - (base,ext) = os.path.splitext(file) - # - # Run gmake to create the output files. - # - if verbose: - quiet = "" - else: - quiet = "-s" - result = 0 - if file == "cexp.y": - result = os.system("gmake " + quiet + " cexp.c") - else: - result = os.system("gmake " + quiet + " " + base + ".cpp") - if result: - print - # - # Edit the Makefile to comment out the grammar rules. - # - fixMakefile("Makefile", base) - fixMakefile("Makefile.mak", base) - - # - # Edit the project file(s) to comment out the grammar rules. - # - for p in glob.glob("*.dsp"): - fixProject(p, file) - os.chdir(cwd) - -# -# Generate flex files. -# -print "Generating flex files..." -scanners = find(icever, "*.l") -for x in scanners: - # - # Change to the directory containing the file. - # - (dir,file) = os.path.split(x) - os.chdir(dir) - (base,ext) = os.path.splitext(file) - # - # Run gmake to create the output files. - # - if verbose: - quiet = "" - else: - quiet = "-s" - if os.system("gmake " + quiet + " " + base + ".cpp"): - print>>sys.stderr, "Generating flex files failed." - sys.exit(1) - # - # Edit the Makefile to comment out the flex rules. - # - fixMakefile("Makefile", base) - fixMakefile("Makefile.mak", base) - - # - # Edit the project file(s) to comment out the flex rules. - # - for p in glob.glob("*.dsp"): - fixProject(p, file) - os.chdir(cwd) - -if verbose: - quiet = "v" -else: - quiet = "" - -# -# Comment out the implicit parser and scanner rules in -# config/Make.rules. -# -print "Fixing makefiles..." -fixMakeRules(os.path.join(icever, "config", "Make.rules")) - -if os.system("tar c" + quiet + "f %s.tar %s" % (icever, icever)): - print>>sys.stderr, "ERROR: tar command failed" - sys.exit(1) - -if os.system("gzip -9 " + icever + ".tar"): - print>>sys.stderr, "ERROR: gzip command failed" - sys.exit(1) - -if verbose: - quiet = "" -else: - quiet = "q" - -if os.system("zip -9r" + quiet + " " + icever + ".zip " + icever): - print>>sys.stderr, "ERROR: zip command failed" - sys.exit(1) - -# -# Copy CHANGES -# -shutil.copyfile(os.path.join(icever, "CHANGES"), "Ice-" + version + "-CHANGES") - -# -# Done. -# -print "Cleaning up..." -shutil.rmtree(icever) -print "Done." diff --git a/cpp/src/FreezeScript/DumpDB.cpp b/cpp/src/FreezeScript/DumpDB.cpp index b47c45bf51d..676e3d0fd36 100644 --- a/cpp/src/FreezeScript/DumpDB.cpp +++ b/cpp/src/FreezeScript/DumpDB.cpp @@ -79,7 +79,11 @@ private: static void usage(const char* n) { - cerr << "Usage: " << n << " [options] [dbenv [db]]\n"; + cerr << "Usage:\n"; + cerr << "\n"; + cerr << n << " [options] dbenv db\n"; + cerr << n << " -c dbenv [db]\n"; + cerr << "\n"; cerr << "Options:\n" "-h, --help Show this message.\n" diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index c9b7a061e7c..94d22e2f11b 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -100,14 +100,9 @@ ConnectRequestHandler::connect() _reference->getConnection(this); Lock sync(*this); - if(_exception.get()) + if(initialized()) { - _exception->ice_throw(); - return 0; // Keep the compiler happy. - } - else if(_connection) - { - assert(_initialized); + assert(_connection); return new ConnectionRequestHandler(_reference, _connection, _compress); } else diff --git a/cpp/src/Ice/Makefile.mak b/cpp/src/Ice/Makefile.mak index 70d067a22b3..f5745c251d4 100644 --- a/cpp/src/Ice/Makefile.mak +++ b/cpp/src/Ice/Makefile.mak @@ -117,7 +117,7 @@ SDIR = $(slicedir)\Ice CPPFLAGS = -I.. $(CPPFLAGS) -DICE_API_EXPORTS -DFD_SETSIZE=1024 -DWIN32_LEAN_AND_MEAN SLICE2CPPFLAGS = --ice --include-dir Ice --dll-export ICE_API $(SLICE2CPPFLAGS) -LINKWITH = $(BASELIBS) $(BZIP2_LIBS) $(ICE_OS_LIBS) ws2_32.lib +LINKWITH = $(BASELIBS) $(BZIP2_LIBS) $(ICE_OS_LIBS) ws2_32.lib Iphlpapi.lib !if "$(CPP_COMPILER)" == "BCC2006" RES_FILE = ,, EventLoggerMsg.res diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 749b5683e27..36adc5b70fe 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -11,10 +11,18 @@ // The following is required on HP-UX in order to bring in // the definition for the ip_mreq structure. // -#ifdef __hpux -#undef _XOPEN_SOURCE_EXTENDED -#define _XOPEN_SOURCE -#include <netinet/in.h> +#if defined(__hpux) +# undef _XOPEN_SOURCE_EXTENDED +# define _XOPEN_SOURCE +# include <netinet/in.h> +#endif + +// +// The following is required for the Vista PSDK to bring in +// the definitions of the IN6_IS_ADDR_* macros. +// +#if defined(_WIN32) && !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0501 #endif #include <IceUtil/StringUtil.h> @@ -26,15 +34,15 @@ #if defined(_WIN32) # include <winsock2.h> # include <ws2tcpip.h> -#elif defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) +# include <iphlpapi.h> +#else # include <ifaddrs.h> # include <net/if.h> -#else # include <sys/ioctl.h> -# include <net/if.h> -# ifdef __sun -# include <sys/sockio.h> -# endif +#endif + +#ifdef __sun +# include <sys/sockio.h> #endif using namespace std; @@ -68,7 +76,7 @@ getLocalAddresses(ProtocolSupport protocol) vector<unsigned char> buffer; buffer.resize(1024); unsigned long len = 0; - DWORD rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, + DWORD rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, &buffer[0], static_cast<DWORD>(buffer.size()), &len, 0, 0); if(rs == SOCKET_ERROR) @@ -80,7 +88,7 @@ getLocalAddresses(ProtocolSupport protocol) if(getSocketErrno() == WSAEFAULT) { buffer.resize(len); - rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, + rs = WSAIoctl(fd, SIO_ADDRESS_LIST_QUERY, 0, 0, &buffer[0], static_cast<DWORD>(buffer.size()), &len, 0, 0); } @@ -94,7 +102,7 @@ getLocalAddresses(ProtocolSupport protocol) } } - // + // // Add the local interface addresses. // SOCKET_ADDRESS_LIST* addrs = reinterpret_cast<SOCKET_ADDRESS_LIST*>(&buffer[0]); @@ -161,7 +169,7 @@ getLocalAddresses(ProtocolSupport protocol) } } } - + curr = curr->ifa_next; } @@ -195,7 +203,7 @@ getLocalAddresses(ProtocolSupport protocol) int bufsize = numaddrs * static_cast<int>(sizeof(struct ifreq)); ifc.ifc_len = bufsize; ifc.ifc_buf = (char*)malloc(bufsize); - + int rs = ioctl(fd, cmd, &ifc); if(rs == SOCKET_ERROR) { @@ -216,7 +224,7 @@ getLocalAddresses(ProtocolSupport protocol) { old_ifc_len = ifc.ifc_len; } - + numaddrs += 10; free(ifc.ifc_buf); } @@ -262,11 +270,11 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot // We now use getaddrinfo() on Windows. // // #ifdef _WIN32 - + // // // // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice. // // - + // // // // gethostbyname() is thread safe on Windows, with a separate hostent per thread // // @@ -277,7 +285,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot // entry = gethostbyname(host.c_str()); // } // while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0); - + // if(entry == 0) // { // DNSException ex(__FILE__, __LINE__); @@ -293,7 +301,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot memset(&addr, 0, sizeof(struct sockaddr_storage)); struct addrinfo* info = 0; int retry = 5; - + struct addrinfo hints = { 0 }; if(server) @@ -301,7 +309,7 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot // // If host is empty, getaddrinfo will return the wildcard // address instead of the loopack address. - // + // hints.ai_flags |= AI_PASSIVE; } @@ -327,11 +335,11 @@ getAddressImpl(const string& host, int port, struct sockaddr_storage& addr, Prot } else { - rs = getaddrinfo(host.c_str(), 0, &hints, &info); + rs = getaddrinfo(host.c_str(), 0, &hints, &info); } } while(info == 0 && rs == EAI_AGAIN && --retry >= 0); - + if(rs != 0) { DNSException ex(__FILE__, __LINE__); @@ -389,6 +397,86 @@ isWildcard(const string& host, ProtocolSupport protocol) return false; } +int +getInterfaceIndex(const string& name) +{ + int index = 0; +#ifdef _WIN32 + IP_ADAPTER_ADDRESSES addrs; + ULONG buflen = 0; + if(::GetAdaptersAddresses(AF_INET6, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW) + { + PIP_ADAPTER_ADDRESSES paddrs; + char* buf = new char[buflen]; + paddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buf); + if(::GetAdaptersAddresses(AF_INET6, 0, 0, paddrs, &buflen) == NO_ERROR) + { + while(paddrs) + { + if(IceUtil::wstringToString(paddrs->FriendlyName) == name) + { + index = paddrs->Ipv6IfIndex; + break; + } + paddrs = paddrs->Next; + } + } + delete[] buf; + } +#else + index = if_nametoindex(name.c_str()); +#endif + + return index; +} + +struct in_addr +getInterfaceAddress(const string& name) +{ + struct in_addr addr; + addr.s_addr = INADDR_ANY; +#ifdef _WIN32 + IP_ADAPTER_ADDRESSES addrs; + ULONG buflen = 0; + if(::GetAdaptersAddresses(AF_INET, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW) + { + PIP_ADAPTER_ADDRESSES paddrs; + char* buf = new char[buflen]; + paddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buf); + if(::GetAdaptersAddresses(AF_INET, 0, 0, paddrs, &buflen) == NO_ERROR) + { + while(paddrs) + { + if(IceUtil::wstringToString(paddrs->FriendlyName) == name) + { + struct sockaddr_in addrin; + memcpy(&addrin, paddrs->FirstUnicastAddress->Address.lpSockaddr, + paddrs->FirstUnicastAddress->Address.iSockaddrLength); + addr = addrin.sin_addr; + break; + } + paddrs = paddrs->Next; + } + } + delete[] buf; + } +#else + ifreq if_address; + strcpy(if_address.ifr_name, name.c_str()); + + SOCKET fd = createSocket(false, AF_INET); + int rc = ioctl(fd, SIOCGIFADDR, &if_address); + closeSocketNoThrow(fd); + + if(rc != SOCKET_ERROR) + { + addr = reinterpret_cast<struct sockaddr_in*>(&if_address.ifr_addr)->sin_addr; + } +#endif + + return addr; +} + } int @@ -609,7 +697,7 @@ IceInternal::closeSocketNoThrow(SOCKET fd) errno = error; #endif } - + void IceInternal::shutdownSocketWrite(SOCKET fd) { @@ -645,7 +733,7 @@ IceInternal::shutdownSocketWrite(SOCKET fd) throw ex; } } - + void IceInternal::shutdownSocketReadWrite(SOCKET fd) { @@ -682,7 +770,7 @@ IceInternal::shutdownSocketReadWrite(SOCKET fd) throw ex; } } - + void IceInternal::setBlock(SOCKET fd, bool block) { @@ -746,7 +834,7 @@ IceInternal::setTcpNoDelay(SOCKET fd) throw ex; } } - + void IceInternal::setKeepAlive(SOCKET fd) { @@ -825,9 +913,16 @@ IceInternal::setMcastGroup(SOCKET fd, const struct sockaddr_storage& group, cons mreq.imr_interface.s_addr = INADDR_ANY; if(interface.size() > 0) { - struct sockaddr_storage addr; - getAddressForServer(interface, 0, addr, EnableIPv4); - mreq.imr_interface = reinterpret_cast<const struct sockaddr_in*>(&addr)->sin_addr; + // + // First see if it is the interface name. If not check if IP Address. + // + mreq.imr_interface = getInterfaceAddress(interface); + if(mreq.imr_interface.s_addr == INADDR_ANY) + { + struct sockaddr_storage addr; + getAddressForServer(interface, 0, addr, EnableIPv4); + mreq.imr_interface = reinterpret_cast<const struct sockaddr_in*>(&addr)->sin_addr; + } } rc = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, int(sizeof(mreq))); } @@ -835,13 +930,24 @@ IceInternal::setMcastGroup(SOCKET fd, const struct sockaddr_storage& group, cons { struct ipv6_mreq mreq; mreq.ipv6mr_multiaddr = reinterpret_cast<const struct sockaddr_in6*>(&group)->sin6_addr; - istringstream p(interface); - if(!(p >> mreq.ipv6mr_interface) || !p.eof()) + mreq.ipv6mr_interface = 0; + if(interface.size() != 0) { - closeSocketNoThrow(fd); - SocketException ex(__FILE__, __LINE__); - ex.error = 0; - throw ex; + // + // First check if it is the interface name. If not check if index. + // + mreq.ipv6mr_interface = getInterfaceIndex(interface); + if(mreq.ipv6mr_interface == 0) + { + istringstream p(interface); + if(!(p >> mreq.ipv6mr_interface) || !p.eof()) + { + closeSocketNoThrow(fd); + SocketException ex(__FILE__, __LINE__); + ex.error = 0; + throw ex; + } + } } rc = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*)&mreq, int(sizeof(mreq))); } @@ -860,14 +966,34 @@ IceInternal::setMcastInterface(SOCKET fd, const string& interface, bool IPv4) int rc; if(IPv4) { - struct sockaddr_storage addr; - getAddress(interface, 0, addr, EnableIPv4); - struct in_addr iface = reinterpret_cast<const struct sockaddr_in*>(&addr)->sin_addr; + // + // First see if it is the interface name. If not check if IP Address. + // + struct in_addr iface = getInterfaceAddress(interface); + if(iface.s_addr == INADDR_ANY) + { + struct sockaddr_storage addr; + getAddressForServer(interface, 0, addr, EnableIPv4); + iface = reinterpret_cast<const struct sockaddr_in*>(&addr)->sin_addr; + } rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)&iface, int(sizeof(iface))); } else { - int interfaceNum = atoi(interface.c_str()); + // + // First check if it is the interface name. If not check if index. + // + int interfaceNum = getInterfaceIndex(interface); + if(interfaceNum == 0) + { + istringstream p(interface); + if(!(p >> interfaceNum) || !p.eof()) + { + closeSocketNoThrow(fd); + SocketException ex(__FILE__, __LINE__); + ex.error = 0; + } + } rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, (char*)&interfaceNum, int(sizeof(int))); } if(rc == SOCKET_ERROR) @@ -958,7 +1084,7 @@ repeatListen: { goto repeatListen; } - + closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); @@ -991,7 +1117,7 @@ repeatConnect: { goto repeatConnect; } - + if(connectInProgress()) { if(timeout == 0) @@ -1010,7 +1136,7 @@ repeatConnect: } return true; } - + closeSocketNoThrow(fd); if(connectionRefused()) { @@ -1097,7 +1223,7 @@ IceInternal::doFinishConnect(SOCKET fd, int timeout) { goto repeatSelect; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -1121,7 +1247,7 @@ IceInternal::doFinishConnect(SOCKET fd, int timeout) ex.error = getSocketErrno(); throw ex; } - + if(val > 0) { #ifdef _WIN32 @@ -1209,27 +1335,27 @@ repeatAccept: pollFd[0].events = POLLIN; rs = ::poll(pollFd, 1, timeout); #endif - + if(rs == SOCKET_ERROR) { if(interrupted()) { goto repeatSelect; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } - + if(rs == 0) { throw TimeoutException(__FILE__, __LINE__); } - + goto repeatAccept; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -1262,7 +1388,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol // // // // Windows XP has getaddrinfo(), but we don't want to require XP to run Ice. // // - + // // // // gethostbyname() is thread safe on Windows, with a separate hostent per thread // // @@ -1274,7 +1400,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol // entry = gethostbyname(host.c_str()); // } // while(entry == 0 && h_errno == TRY_AGAIN && --retry >= 0); - + // if(entry == 0) // { // DNSException ex(__FILE__, __LINE__); @@ -1289,7 +1415,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol // memcpy(&addr.sin_addr, *p, entry->h_length); // result.push_back(addr); // p++; -// } +// } // #else @@ -1318,7 +1444,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol { hints.ai_flags = AI_NUMERICHOST; } - + int rs = 0; do { @@ -1435,7 +1561,7 @@ IceInternal::compareAddress(const struct sockaddr_storage& addr1, const struct s { return 1; } - + int res = memcmp(&addr1in->sin6_addr, &addr2in->sin6_addr, sizeof(struct in6_addr)); if(res < 0) { @@ -1457,7 +1583,7 @@ IceInternal::createPipe(SOCKET fds[2]) SOCKET fd = createSocket(false, AF_INET); setBlock(fd, true); - + struct sockaddr_storage addr; memset(&addr, 0, sizeof(addr)); @@ -1465,7 +1591,7 @@ IceInternal::createPipe(SOCKET fds[2]) addrin->sin_family = AF_INET; addrin->sin_port = htons(0); addrin->sin_addr.s_addr = htonl(INADDR_LOOPBACK); - + doBind(fd, addr); doListen(fd, 1); @@ -1694,10 +1820,10 @@ IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport proto for(vector<struct sockaddr_storage>::const_iterator p = addrs.begin(); p != addrs.end(); ++p) { // - // NOTE: We don't publish link-local IPv6 addresses as these addresses can only + // NOTE: We don't publish link-local IPv6 addresses as these addresses can only // be accessed in general with a scope-id. // - if(p->ss_family != AF_INET6 || + if(p->ss_family != AF_INET6 || !IN6_IS_ADDR_LINKLOCAL(&reinterpret_cast<const struct sockaddr_in6*>(&(*p))->sin6_addr)) { hosts.push_back(inetAddrToString(*p)); diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index 4a850896e5b..ec7bae151d0 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -161,56 +161,39 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) PropertiesPtr properties = _communicator->getProperties(); PropertyDict plugins = properties->getPropertiesForPrefix(prefix); - string loadOrder = properties->getProperty("Ice.PluginLoadOrder"); - string::size_type beg = 0; - if(!loadOrder.empty()) + StringSeq loadOrder = properties->getPropertyAsList("Ice.PluginLoadOrder"); + for(StringSeq::const_iterator p = loadOrder.begin(); p != loadOrder.end(); ++p) { - const string delim = ", \t\n"; - beg = loadOrder.find_first_not_of(delim, beg); - while(beg != string::npos) - { - string name; - string::size_type end = loadOrder.find_first_of(delim, beg); - if(end == string::npos) - { - name = loadOrder.substr(beg); - beg = end; - } - else - { - name = loadOrder.substr(beg, end - beg); - beg = loadOrder.find_first_not_of(delim, end); - } + string name = *p; - map<string, PluginPtr>::iterator p = _plugins.find(name); - if(p != _plugins.end()) - { - PluginInitializationException ex(__FILE__, __LINE__); - ex.reason = "plugin `" + name + "' already loaded"; - throw ex; - } + map<string, PluginPtr>::iterator p = _plugins.find(name); + if(p != _plugins.end()) + { + PluginInitializationException ex(__FILE__, __LINE__); + ex.reason = "plugin `" + name + "' already loaded"; + throw ex; + } - PropertyDict::iterator q = plugins.find("Ice.Plugin." + name + ".cpp"); - if(q == plugins.end()) - { - q = plugins.find("Ice.Plugin." + name); - } - else - { - plugins.erase("Ice.Plugin." + name); - } + PropertyDict::iterator q = plugins.find("Ice.Plugin." + name + ".cpp"); + if(q == plugins.end()) + { + q = plugins.find("Ice.Plugin." + name); + } + else + { + plugins.erase("Ice.Plugin." + name); + } - if(q != plugins.end()) - { - loadPlugin(name, q->second, cmdArgs); - plugins.erase(q); - } - else - { - PluginInitializationException ex(__FILE__, __LINE__); - ex.reason = "plugin `" + name + "' not defined"; - throw ex; - } + if(q != plugins.end()) + { + loadPlugin(name, q->second, cmdArgs); + plugins.erase(q); + } + else + { + PluginInitializationException ex(__FILE__, __LINE__); + ex.reason = "plugin `" + name + "' not defined"; + throw ex; } } diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 94a8f0cf276..bf8840badbe 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -101,7 +101,7 @@ Ice::PropertiesI::getPropertyAsListWithDefault(const string& key, const StringSe p->second.used = true; StringSeq result; - if(!IceUtilInternal::splitString(p->second.value, " \t\n", result)) + if(!IceUtilInternal::splitString(p->second.value, ", \t\n", result)) { Warning out(getProcessLogger()); out << "mismatched quotes in property " << key << "'s value, returning default value"; @@ -406,49 +406,56 @@ Ice::PropertiesI::PropertiesI(StringSeq& args, const PropertiesPtr& defaults, co void Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& converter) { - const string delim = " \t\r\n"; string s = line; - string::size_type idx = s.find('#'); - if(idx != string::npos) - { - s.erase(idx); - } - - idx = s.find_last_not_of(delim); - if(idx != string::npos && idx + 1 < s.length()) - { - s.erase(idx + 1); - } - - string::size_type beg = s.find_first_not_of(delim); - if(beg == string::npos) + // + // Remove comments and unescape #'s + // + string::size_type idx = 0; + while((idx = s.find("#", idx)) != string::npos) { - return; + if(idx != 0 && s[idx - 1] == '\\') + { + s.erase(idx - 1, 1); + ++idx; + } + else + { + s.erase(idx); + break; + } } - - string::size_type end = s.find_first_of(delim + "=", beg); - if(end == string::npos) + + // + // Split key/value and unescape ='s + // + string::size_type split = string::npos; + idx = 0; + while((idx = s.find("=", idx)) != string::npos) { - return; + if(idx != 0 && s[idx - 1] == '\\') + { + s.erase(idx - 1, 1); + } + else if(split == string::npos) + { + split = idx; + } + ++idx; } - - string key = s.substr(beg, end - beg); - - end = s.find('=', end); - if(end == string::npos) + + if(split == 0 || split == string::npos) { + s = IceUtilInternal::trim(s); + if(s.length() != 0) + { + getProcessLogger()->warning("invalid config file entry: \"" + line + "\""); + } return; } - ++end; - string value; - beg = s.find_first_not_of(delim, end); - if(beg != string::npos) - { - end = s.length(); - value = s.substr(beg, end - beg); - } + string key = IceUtilInternal::trim(s.substr(0, split)); + string value = IceUtilInternal::trim(s.substr(split + 1, s.length() - split - 1)); if(converter) { @@ -479,29 +486,14 @@ Ice::PropertiesI::loadConfig() if(s && *s != '\0') { value = s; + setProperty("Ice.Config", value); } } - if(!value.empty()) + StringSeq files = getPropertyAsList("Ice.Config"); + for(StringSeq::const_iterator p = files.begin(); p != files.end(); ++p) { - const string delim = " \t\r\n"; - string::size_type beg = value.find_first_not_of(delim); - while(beg != string::npos) - { - string::size_type end = value.find(",", beg); - string file; - if(end == string::npos) - { - file = value.substr(beg); - beg = end; - } - else - { - file = value.substr(beg, end - beg); - beg = value.find_first_not_of("," + delim, end); - } - load(file); - } + load(*p); } PropertyValue pv(value, true); diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index f55a159bb6c..bd378d74896 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -223,53 +223,33 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) : _instance(instance) { - string str = _instance->initializationData().properties->getPropertyWithDefault("Ice.RetryIntervals", "0"); - - string::size_type beg; - string::size_type end = 0; - - while(true) + StringSeq retryValues = _instance->initializationData().properties->getPropertyAsList("Ice.RetryIntervals"); + if(retryValues.size() == 0) { - const string delim = " \t"; - - beg = str.find_first_not_of(delim, end); - if(beg == string::npos) + _retryIntervals.push_back(0); + } + else + { + for(StringSeq::const_iterator p = retryValues.begin(); p != retryValues.end(); ++p) { - if(_retryIntervals.empty()) + istringstream value(*p); + + int v; + if(!(value >> v) || !value.eof()) { - _retryIntervals.push_back(0); + v = 0; } - break; - } - - end = str.find_first_of(delim, beg); - if(end == string::npos) - { - end = str.length(); - } - - if(beg == end) - { - break; - } - - istringstream value(str.substr(beg, end - beg)); - int v; - if(!(value >> v) || !value.eof()) - { - v = 0; - } + // + // If -1 is the first value, no retry and wait intervals. + // + if(v == -1 && _retryIntervals.empty()) + { + break; + } - // - // If -1 is the first value, no retry and wait intervals. - // - if(v == -1 && _retryIntervals.empty()) - { - break; + _retryIntervals.push_back(v > 0 ? v : 0); } - - _retryIntervals.push_back(v > 0 ? v : 0); } } diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index c59122ccdad..c4b60bce3e8 100755 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -477,7 +477,7 @@ IceInternal::Reference::hashInit() const h = 5 * h + *p; } - _hashValue = 5 * _hashValue + static_cast<Int>(_secure); + h = 5 * h + static_cast<Int>(_secure); _hashValue = h; _hashInitialized = true; diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index e6664fe9d8e..e535a6c23af 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -82,10 +82,27 @@ IceInternal::UdpEndpointI::UdpEndpointI(const InstancePtr& instance, const strin if(argumentBeg != string::npos && str[argumentBeg] != '-') { beg = argumentBeg; - end = str.find_first_of(delim, beg); - if(end == string::npos) + if(str[beg] == '\"') { - end = str.length(); + end = str.find_first_of('\"', beg + 1); + if(end == string::npos) + { + EndpointParseException ex(__FILE__, __LINE__); + ex.str = "udp " + str; + throw ex; + } + else + { + ++end; + } + } + else + { + end = str.find_first_of(delim, beg); + if(end == string::npos) + { + end = str.length(); + } } argument = str.substr(beg, end - beg); if(argument[0] == '\"' && argument[argument.size() - 1] == '\"') diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 4d2b904c185..146aebc0af3 100644 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -7,6 +7,14 @@ // // ********************************************************************** +// +// The following is required for the Vista PSDK to bring in +// the definitions of the IN6_IS_ADDR_* macros. +// +#if defined(_WIN32) && !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0501 +#endif + #include <Ice/UdpTransceiver.h> #include <Ice/Instance.h> #include <Ice/TraceLevels.h> @@ -131,7 +139,7 @@ repeat: ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), static_cast<int>(buf.b.size()), 0); #else ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&buf.b[0]), buf.b.size(), 0); -#endif +#endif if(ret == SOCKET_ERROR) { @@ -153,7 +161,7 @@ repeat: assert(_fd != INVALID_SOCKET); #ifdef _WIN32 FD_SET(_fd, &_wFdSet); - + if(timeout >= 0) { struct timeval tv; @@ -170,14 +178,14 @@ repeat: pollFd[0].fd = _fd; pollFd[0].events = POLLOUT; rs = ::poll(pollFd, 1, timeout); -#endif +#endif if(rs == SOCKET_ERROR) { if(interrupted()) { goto repeatSelect; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -187,10 +195,10 @@ repeat: { throw new Ice::TimeoutException(__FILE__, __LINE__); } - + goto repeat; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -201,7 +209,7 @@ repeat: Trace out(_logger, _traceLevels->networkCat); out << "sent " << ret << " bytes via udp\n" << toString(); } - + if(_stats) { _stats->bytesSent(type(), static_cast<Int>(ret)); @@ -289,7 +297,7 @@ repeat: { goto repeat; } - + if(wouldBlock()) { if(timeout == 0) @@ -298,7 +306,7 @@ repeat: } repeatSelect: - + assert(_fd != INVALID_SOCKET); #ifdef _WIN32 FD_SET(_fd, &_rFdSet); @@ -316,12 +324,12 @@ repeat: { goto repeatSelect; } - + SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; } - + if(rs == 0) { throw TimeoutException(__FILE__, __LINE__); @@ -346,7 +354,7 @@ repeat: ex.error = getSocketErrno(); throw ex; } - + if(_traceLevels->network >= 3) { Trace out(_logger, _traceLevels->networkCat); @@ -454,7 +462,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s setMcastTtl(_fd, mcastTtl, _addr.ss_family == AF_INET); } } - + if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); @@ -473,7 +481,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s #endif } -IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port, +IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const string& host, int port, const string& mcastInterface, bool connect) : _traceLevels(instance->traceLevels()), _logger(instance->initializationData().logger), @@ -545,7 +553,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s #endif doBind(_fd, _addr); } - + if(_traceLevels->network >= 1) { Trace out(_logger, _traceLevels->networkCat); @@ -567,7 +575,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s IceInternal::UdpTransceiver::~UdpTransceiver() { assert(_fd == INVALID_SOCKET); -} +} // // Set UDP receive and send buffer sizes. diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index fecb1285761..759a9c58072 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -357,30 +357,6 @@ IceBox::ServiceManagerI::start() } // - // Parse the IceBox.LoadOrder property. - // - string order = properties->getProperty("IceBox.LoadOrder"); - StringSeq loadOrder; - if(!order.empty()) - { - string::size_type beg = order.find_first_not_of(",\t "); - while(beg != string::npos) - { - string::size_type end = order.find_first_of(",\t ", beg); - if(end == string::npos) - { - loadOrder.push_back(order.substr(beg)); - beg = end; - } - else - { - loadOrder.push_back(order.substr(beg, end - beg)); - beg = order.find_first_not_of(",\t ", end); - } - } - } - - // // Load and start the services defined in the property set // with the prefix "IceBox.Service.". These properties should // have the following format: @@ -393,6 +369,7 @@ IceBox::ServiceManagerI::start() const string prefix = "IceBox.Service."; PropertyDict services = properties->getPropertiesForPrefix(prefix); PropertyDict::iterator p; + StringSeq loadOrder = properties->getPropertyAsList("IceBox.LoadOrder"); for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q) { p = services.find(prefix + *q); diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 397cdc31c55..230847c56f9 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -359,9 +359,9 @@ Activator::activate(const string& name, if(_traceLevels->activator > 0) { Trace out(_traceLevels->logger, _traceLevels->activatorCat); - out << "cannot convert `" << path << "' into an absolute path"; + out << "couldn't find `" << path << "' executable."; } - throw string("The server executable path `" + path + "' can't be converted into an absolute path."); + throw string("Couldn't find `" + path + "' executable."); } path = absbuf; } diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 3bbc3d03c19..3a20680cdd3 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -11,6 +11,7 @@ #include <IceUtil/Options.h> #include <IceUtil/CtrlCHandler.h> #include <IceUtil/Thread.h> +#include <IceUtil/StringUtil.h> #include <Ice/Ice.h> #include <Ice/SliceChecksums.h> #include <IceGrid/Parser.h> @@ -99,7 +100,6 @@ public: Ice::CommunicatorPtr communicator() const { return _communicator; } const char* appName() const { return _appName; } - string trim(const string&); string getPassword(const string&); private: @@ -380,7 +380,7 @@ Client::run(int argc, char* argv[]) { cout << "user id: " << flush; getline(cin, id); - id = trim(id); + id = IceUtilInternal::trim(id); } if(password.empty()) @@ -486,7 +486,7 @@ Client::run(int argc, char* argv[]) { cout << "user id: " << flush; getline(cin, id); - id = trim(id); + id = IceUtilInternal::trim(id); } if(password.empty()) @@ -615,18 +615,6 @@ Client::run(int argc, char* argv[]) } string -Client::trim(const string& s) -{ - static const string delims = "\t\r\n "; - string::size_type last = s.find_last_not_of(delims); - if(last != string::npos) - { - return s.substr(s.find_first_not_of(delims), last+1); - } - return s; -} - -string Client::getPassword(const string& prompt) { cout << prompt << flush; @@ -648,5 +636,5 @@ Client::getPassword(const string& prompt) } #endif cout << endl; - return trim(password); + return IceUtilInternal::trim(password); } diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 575c4120c89..9f997d2b577 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -9,6 +9,7 @@ #include <IceUtil/UUID.h> #include <IceUtil/Timer.h> +#include <IceUtil/StringUtil.h> #include <Ice/Ice.h> #include <Ice/Locator.h> #include <Ice/Service.h> @@ -83,7 +84,6 @@ protected: private: void usage(const std::string&); - string trim(const string&); ActivatorPtr _activator; IceUtil::TimerPtr _timer; @@ -583,14 +583,14 @@ NodeService::start(int argc, char* argv[]) { cout << "user id: " << flush; getline(cin, id); - id = trim(id); + id = IceUtilInternal::trim(id); } if(password.empty()) { cout << "password: " << flush; getline(cin, password); - password = trim(password); + password = IceUtilInternal::trim(password); } session = registry->createAdminSession(id, password); @@ -812,18 +812,6 @@ NodeService::usage(const string& appName) print("Usage: " + appName + " [options]\n" + options); } -string -NodeService::trim(const string& s) -{ - static const string delims = "\t\r\n "; - string::size_type last = s.find_last_not_of(delims); - if(last != string::npos) - { - return s.substr(s.find_first_not_of(delims), last+1); - } - return s; -} - int main(int argc, char* argv[]) { diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 1d3629245c9..899511f95a9 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -228,65 +228,45 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter, // // Parse the properties override property. // - string overrides = props->getProperty("IceGrid.Node.PropertiesOverride"); - Ice::StringSeq propsAsArgs; - if(!overrides.empty()) + Ice::StringSeq overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride"); + for(Ice::StringSeq::const_iterator p = overrides.begin(); p != overrides.end(); ++p) { - string::size_type end = 0; - while(end != string::npos) - { - const string delim = " \t\r\n"; - - string::size_type beg = overrides.find_first_not_of(delim, end); - if(beg == string::npos) - { - break; - } - - end = overrides.find_first_of(delim, beg); - string arg; - if(end == string::npos) - { - arg = overrides.substr(beg); - } - else - { - arg = overrides.substr(beg, end - beg); - } + string arg = *p; - if(arg.find("--") == 0) - { - arg = arg.substr(2); - } + const string delim = " \t\r\n"; - // - // Extract the key/value - // - string::size_type argEnd = arg.find_first_of(delim + "="); - if(argEnd == string::npos) - { - continue; - } - - string key = arg.substr(0, argEnd); - - argEnd = arg.find('=', argEnd); - if(argEnd == string::npos) - { - return; - } - ++argEnd; - - string value; - string::size_type argBeg = arg.find_first_not_of(delim, argEnd); - if(argBeg != string::npos) - { - argEnd = arg.length(); - value = arg.substr(argBeg, argEnd - argBeg); - } + if(arg.find("--") == 0) + { + arg = arg.substr(2); + } - _propertiesOverride.push_back(createProperty(key, value)); + // + // Extract the key/value + // + string::size_type argEnd = arg.find_first_of(delim + "="); + if(argEnd == string::npos) + { + continue; + } + + string key = arg.substr(0, argEnd); + + argEnd = arg.find('=', argEnd); + if(argEnd == string::npos) + { + return; } + ++argEnd; + + string value; + string::size_type argBeg = arg.find_first_not_of(delim, argEnd); + if(argBeg != string::npos) + { + argEnd = arg.length(); + value = arg.substr(argBeg, argEnd - argBeg); + } + + _propertiesOverride.push_back(createProperty(key, value)); } } diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index c36bfd4eeb2..9ab3f547738 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -2017,8 +2017,8 @@ Parser::getInput(char* buf, int& result, int maxSize) } else { -#if defined(_MSC_VER) && !defined(_STLP_MSVC) - // COMPILERBUG: Stupid Visual C++ defines min and max as macros +#if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(_STLP_MSVC) + // COMPILERBUG: Visual C++ defines min and max as macros result = _MIN(maxSize, static_cast<int>(_commands.length())); #else result = min(maxSize, static_cast<int>(_commands.length())); diff --git a/cpp/src/IceSSL/Instance.cpp b/cpp/src/IceSSL/Instance.cpp index 50ae4a9f516..b0109240528 100644 --- a/cpp/src/IceSSL/Instance.cpp +++ b/cpp/src/IceSSL/Instance.cpp @@ -146,7 +146,7 @@ IceSSL::Instance::initialize() // Select protocols. // { - string protocols = properties->getProperty(propPrefix + "Protocols"); + StringSeq protocols = properties->getPropertyAsList(propPrefix + "Protocols"); if(!protocols.empty()) { parseProtocols(protocols); @@ -841,30 +841,12 @@ IceSSL::Instance::traceConnection(SSL* ssl, bool incoming) } void -IceSSL::Instance::parseProtocols(const string& val) +IceSSL::Instance::parseProtocols(const StringSeq& protocols) { - const string delim = ", "; bool sslv3 = false, tlsv1 = false; - string::size_type pos = 0; - while(pos != string::npos) + for(Ice::StringSeq::const_iterator p = protocols.begin(); p != protocols.end(); ++p) { - pos = val.find_first_not_of(delim, pos); - if(pos == string::npos) - { - break; - } - - string prot; - string::size_type end = val.find_first_of(delim, pos); - if(end == string::npos) - { - prot = val.substr(pos); - } - else - { - prot = val.substr(pos, end - pos); - } - pos = end; + string prot = *p; if(prot == "ssl3" || prot == "sslv3") { diff --git a/cpp/src/IceSSL/Instance.h b/cpp/src/IceSSL/Instance.h index 39a81808013..4cf354760f2 100644 --- a/cpp/src/IceSSL/Instance.h +++ b/cpp/src/IceSSL/Instance.h @@ -18,6 +18,7 @@ #include <Ice/ProtocolPluginFacadeF.h> #include <IceSSL/Plugin.h> #include <IceSSL/TrustManagerF.h> +#include <Ice/BuiltinSequences.h> namespace IceSSL { @@ -62,7 +63,7 @@ public: private: - void parseProtocols(const std::string&); + void parseProtocols(const Ice::StringSeq&); Ice::LoggerPtr _logger; IceInternal::ProtocolPluginFacadePtr _facade; diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp index facd21440cf..58c8d6c0976 100644 --- a/cpp/src/IceStorm/Parser.cpp +++ b/cpp/src/IceStorm/Parser.cpp @@ -305,8 +305,8 @@ Parser::getInput(char* buf, int& result, int maxSize) } else { -#if defined(_MSC_VER) && !defined(_STLP_MSVC) - // COMPILERBUG: Stupid Visual C++ defines min and max as macros +#if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(_STLP_MSVC) + // COMPILERBUG: Visual C++ defines min and max as macros result = _MIN(maxSize, static_cast<int>(_commands.length())); #else result = min(maxSize, static_cast<int>(_commands.length())); diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index 62bd9e1f44d..e087e5586dc 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -364,6 +364,23 @@ IceUtilInternal::splitString(const string& str, const string& delim, vector<stri return true; } +// +// Trim white space (" \t\r\n") +// +string +IceUtilInternal::trim(const string& s) +{ + static const string delim = " \t\r\n"; + string::size_type beg = s.find_first_not_of(delim); + if(beg == string::npos) + { + return ""; + } + else + { + return s.substr(beg, s.find_last_not_of(delim) - beg + 1); + } +} // // If a single or double quotation mark is found at the start position, diff --git a/cpp/src/Slice/DotNetNames.cpp b/cpp/src/Slice/DotNetNames.cpp index 0d672548d7a..689949a0234 100755 --- a/cpp/src/Slice/DotNetNames.cpp +++ b/cpp/src/Slice/DotNetNames.cpp @@ -65,25 +65,12 @@ static const Node ExceptionNode = ExceptionNames, &ExceptionParents[0] }; -static const char* ApplicationExceptionNames[] = - { - 0 - }; -static const Node* ApplicationExceptionParents[] = - { - &ExceptionNode, 0 - }; -static const Node ApplicationExceptionNode = - { - ApplicationExceptionNames, &ApplicationExceptionParents[0] - }; - // // Must be kept in same order as definition of BaseType in header file! // static const Node* nodes[] = { - &ObjectNode, &ICloneableNode, &ExceptionNode, &ApplicationExceptionNode + &ObjectNode, &ICloneableNode, &ExceptionNode }; static bool diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 98c6582635d..2557a048c1b 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -922,10 +922,18 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c checkForGlobalDef(name, "dictionary"); // Don't return here -- we create the dictionary anyway. } - if(nt == Real && !Dictionary::legalKeyType(keyType)) + if(nt == Real) { - _unit->error("dictionary `" + name + "' uses an illegal key type"); - return 0; + bool containsSequence = false; + if(!Dictionary::legalKeyType(keyType, containsSequence)) + { + _unit->error("dictionary `" + name + "' uses an illegal key type"); + return 0; + } + if(containsSequence) + { + _unit->warning("use of sequences in dictionary keys has been deprecated"); + } } if(!local) @@ -3894,8 +3902,11 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies) // integral types, string, and sequences and structs containing only // other legal key types. // +// Note: Allowing sequences in dictionary keys has been deprecated as +// of Ice 3.3.0. +// bool -Slice::Dictionary::legalKeyType(const TypePtr& type) +Slice::Dictionary::legalKeyType(const TypePtr& type, bool& containsSequence) { BuiltinPtr bp = BuiltinPtr::dynamicCast(type); if(bp) @@ -3932,9 +3943,13 @@ Slice::Dictionary::legalKeyType(const TypePtr& type) } SequencePtr seqp = SequencePtr::dynamicCast(type); - if(seqp && legalKeyType(seqp->type())) + if(seqp) { - return true; + containsSequence = true; + if(legalKeyType(seqp->type(), containsSequence)) + { + return true; + } } StructPtr strp = StructPtr::dynamicCast(type); @@ -3943,7 +3958,7 @@ Slice::Dictionary::legalKeyType(const TypePtr& type) DataMemberList dml = strp->dataMembers(); for(DataMemberList::const_iterator mem = dml.begin(); mem != dml.end(); ++mem) { - if(!legalKeyType((*mem)->type())) + if(!legalKeyType((*mem)->type(), containsSequence)) { return false; } diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 7b3acd99500..869dc5ca760 100755 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -284,14 +284,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin while((end = unprocessed.find(".ice", pos)) != string::npos) { end += 4; - string file = unprocessed.substr(pos, end - pos); - - // - // Strip white space from the file name. - // - size_t b = file.find_first_not_of(" \t"); - size_t e = file.find_last_not_of(" \t"); - file = file.substr(b, e - b + 1); + string file = IceUtilInternal::trim(unprocessed.substr(pos, end - pos)); // // Normalize paths if not relative path. diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 75ed5d400b8..517fabbbdf5 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -526,6 +526,15 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out.inc(); _out << nl << "return '" << scoped << "'"; _out.dec(); + + // + // ice_staticId + // + _out << sp << nl << "def ice_staticId():"; + _out.inc(); + _out << nl << "return '" << scoped << "'"; + _out.dec(); + _out << nl << "ice_staticId = staticmethod(ice_staticId)"; } if(!ops.empty()) diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index 3322899a24e..2f861a8e283 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -407,6 +407,12 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "class " << name; _out.inc(); _out << nl << "include " << name << "_mixin"; + _out << nl; + _out << nl << "def " << name << ".ice_staticId()"; + _out.inc(); + _out << nl << "'" << scoped << "'"; + _out.dec(); + _out << nl << "end"; _out.dec(); _out << nl << "end"; } @@ -422,6 +428,12 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } _out.inc(); _out << nl << "include " << name << "_mixin"; + _out << nl; + _out << nl << "def " << name << ".ice_staticId()"; + _out.inc(); + _out << nl << "'" << scoped << "'"; + _out.dec(); + _out << nl << "end"; // // initialize diff --git a/cpp/src/iceserviceinstall/Install.cpp b/cpp/src/iceserviceinstall/Install.cpp index d9f0a476bde..124961b9e83 100755 --- a/cpp/src/iceserviceinstall/Install.cpp +++ b/cpp/src/iceserviceinstall/Install.cpp @@ -186,17 +186,17 @@ Install::usage() const "Valid properties:\n" "ImagePath Full path to <service>.exe. The default value is\n" " <directory of " << appName() << ">\\<service>.exe\n" - "DisplayName Display name for the service\n" - "Description Description for the service\n" - "AutoStart When non 0, the service is started automatically when\n" - " the computer starts up. The default value is 1\n" + "DisplayName Display name of the service.\n" + "Description Description of the service.\n" + "AutoStart If non-zero, the service is started automatically when\n" + " the computer starts up. The default value is 1.\n" "ObjectName Account used to run the service. Defaults to\n" - " NT Authority\\LocalService\n" - "Password Password for ObjectName\n" - "DependOnRegistry When non 0, the service depends on the IceGrid registry\n" + " NT Authority\\LocalService.\n" + "Password Password for ObjectName.\n" + "DependOnRegistry If non-zero, the service depends on the IceGrid registry\n" " service (the IceGrid registry service name is computed\n" " using Ice.Default.Locator in <config-file>).\n" "EventLog The name of the EventLog used by this service;\n" - " the default is Application\n" + " the default is Application.\n" ; } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 921ecd031f0..42a39edd084 100755 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -4881,6 +4881,25 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + set<string> includes; + ClassList classes = p->classes(); + for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q) + { + ClassList bases = (*q)->bases(); + for(ClassList::const_iterator r = bases.begin(); r != bases.end(); ++r) + { + if((*r)->isAbstract()) + { + includes.insert((*r)->name()); + } + } + } + + for(set<string>::const_iterator it = includes.begin(); it != includes.end(); ++it) + { + H << nl << "#include <" << *it << "I.h>"; + } + string name = fixKwd(p->name()); H << sp << nl << "namespace " << name << nl << '{'; @@ -4911,13 +4930,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) string scope = fixKwd(p->scope()); string cls = scope.substr(2) + name + "I"; string classScopedAMD = scope + "AMD_" + name; - ClassList bases = p->bases(); - ClassDefPtr base; - if(!bases.empty() && !bases.front()->isInterface()) - { - base = bases.front(); - } H << sp; H << nl << "class " << name << "I : "; diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index 920da32a79d..9ecaf80640a 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -2626,6 +2626,25 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + set<string> includes; + ClassList classes = p->classes(); + for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q) + { + ClassList bases = (*q)->bases(); + for(ClassList::const_iterator r = bases.begin(); r != bases.end(); ++r) + { + if((*r)->isAbstract()) + { + includes.insert((*r)->name()); + } + } + } + + for(set<string>::const_iterator it = includes.begin(); it != includes.end(); ++it) + { + H << nl << "#include <" << *it << "I.h>"; + } + string name = fixKwd(p->name()); H << sp << nl << "namespace " << name << nl << '{'; diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 8d38d699204..aa41bd24aa2 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1855,7 +1855,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string name = fixId((*q)->name(), DotNet::ApplicationException, false); + string name = fixId((*q)->name(), DotNet::Exception, false); _out << nl << "this." << name << " = " << fixId((*q)->name()) << ';'; } _out << eb; @@ -1902,22 +1902,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp << nl << "public override int GetHashCode()"; _out << sb; - _out << nl << "int h__ = 0;"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + if(p->base()) { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if((object)" << memberName << " != null)"; - _out << sb; - } - _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; - if(!isValue) - { - _out << eb; - } + _out << nl << "int h__ = base.GetHashCode();"; } + else + { + _out << nl << "int h__ = 0;"; + } + writeMemberHashCode(dataMembers, DotNet::Exception); _out << nl << "return h__;"; _out << eb; @@ -1935,31 +1928,18 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; _out << nl << "return false;"; _out << eb; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + if(p->base()) { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if(" << memberName << " == null)"; - _out << sb; - _out << nl << "if(((" << name << ")other__)." << memberName << " != null)"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - _out << nl << "else"; - _out << sb; - } - _out << nl << "if(!" << memberName << ".Equals(((" << name << ")other__)." << memberName << "))"; + _out << nl << "if(!base.Equals(other__))"; _out << sb; _out << nl << "return false;"; _out << eb; - if(!isValue) - { - _out << eb; - } } + if(!dataMembers.empty()) + { + _out << nl << name << " o__ = (" << name << ")other__;"; + } + writeMemberEquals(dataMembers, DotNet::Exception); _out << nl << "return true;"; _out << eb; @@ -1993,7 +1973,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << nl << "os__.startWriteSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, DotNet::Exception), true, false, false); } _out << nl << "os__.endWriteSlice();"; @@ -2045,7 +2025,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << nl << "case " << memberCount << ":"; _out.inc(); } - string memberName = fixId((*q)->name(), DotNet::ApplicationException); + string memberName = fixId((*q)->name(), DotNet::Exception); string memberType = typeToString((*q)->type()); _out << nl << "_instance." << memberName << " = (" << memberType << ")v;"; ContainedPtr contained = ContainedPtr::dynamicCast((*q)->type()); @@ -2098,7 +2078,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) patchParams << ", " << classMemberCount++; } } - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::Exception), false, false, false, patchParams.str()); } _out << nl << "is__.endReadSlice();"; @@ -2116,7 +2096,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << nl << "outS__.startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::Exception), true, true, false); } _out << nl << "outS__.endSlice();"; @@ -2146,7 +2126,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) patchParams << ", " << classMemberCount++; } } - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::Exception), false, true, false, patchParams.str()); } _out << nl << "inS__.endSlice();"; @@ -2301,21 +2281,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp << nl << "public override int GetHashCode()"; _out << sb; _out << nl << "int h__ = 0;"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if(" << memberName << " != null)"; - _out << sb; - } - _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; - if(!isValue) - { - _out << eb; - } - } + writeMemberHashCode(dataMembers, isClass ? DotNet::ICloneable : 0); _out << nl << "return h__;"; _out << eb; @@ -2347,34 +2313,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { _out << nl << name << " o__ = (" << name << ")other__;"; } - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - if(!isValueType((*q)->type())) - { - _out << nl << "if(" << memberName << " == null)"; - _out << sb; - _out << nl << "if(o__." << memberName << " != null)"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - _out << nl << "else"; - _out << sb; - _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - } - else - { - _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - } - } + writeMemberEquals(dataMembers, isClass ? DotNet::ICloneable : 0); _out << nl << "return true;"; _out << eb; @@ -2731,7 +2670,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) } else if(ExceptionPtr::dynamicCast(cont)) { - baseTypes = DotNet::ApplicationException; + baseTypes = DotNet::Exception; } else if(ClassDefPtr::dynamicCast(cont)) { @@ -2796,6 +2735,168 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) _out << eb; } +void +Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers, int baseTypes) +{ + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + string memberName = fixId((*q)->name(), baseTypes); + TypePtr memberType = (*q)->type(); + bool isValue = isValueType(memberType); + if(!isValue) + { + _out << nl << "if(" << memberName << " != null)"; + _out << sb; + } + SequencePtr seq = SequencePtr::dynamicCast(memberType); + if(seq) + { + string genericType; + bool isGeneric = seq->findMetaData("clr:generic:", genericType); + bool isArray = !isGeneric && !seq->hasMetaData("clr:collection"); + if(isArray) + { + // + // GetHashCode() for native arrays does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtilInternal.Arrays.GetHashCode(" << memberName << ");"; + } + else if(isGeneric) + { + // + // GetHashCode() for generic types does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtilInternal.Collections.SequenceGetHashCode(" << memberName << ");"; + } + else + { + // + // GetHashCode() for CollectionBase has value semantics. + // + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + } + else + { + DictionaryPtr dict = DictionaryPtr::dynamicCast(memberType); + if(dict) + { + if(dict->hasMetaData("clr:collection")) + { + // + // GetHashCode() for DictionaryBase has value semantics. + // + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + else + { + // + // GetHashCode() for generic types does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtilInternal.Collections.DictionaryGetHashCode(" << memberName + << ");"; + } + } + else + { + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + } + if(!isValue) + { + _out << eb; + } + } +} + +void +Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, int baseTypes) +{ + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + string memberName = fixId((*q)->name(), baseTypes); + TypePtr memberType = (*q)->type(); + if(!isValueType(memberType)) + { + _out << nl << "if(" << memberName << " == null)"; + _out << sb; + _out << nl << "if(o__." << memberName << " != null)"; + _out << sb; + _out << nl << "return false;"; + _out << eb; + _out << eb; + _out << nl << "else"; + _out << sb; + SequencePtr seq = SequencePtr::dynamicCast(memberType); + if(seq) + { + string genericType; + bool isGeneric = seq->findMetaData("clr:generic:", genericType); + bool isArray = !isGeneric && !seq->hasMetaData("clr:collection"); + if(isArray) + { + // + // Equals() for native arrays does not have value semantics. + // + _out << nl << "if(!IceUtilInternal.Arrays.Equals(" << memberName << ", o__." << memberName << "))"; + } + else if(isGeneric) + { + // + // Equals() for generic types does not have value semantics. + // + _out << nl << "if(!IceUtilInternal.Collections.SequenceEquals(" << memberName << ", o__." + << memberName << "))"; + } + else + { + // + // Equals() for CollectionBase has value semantics. + // + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + } + else + { + DictionaryPtr dict = DictionaryPtr::dynamicCast(memberType); + if(dict) + { + if(dict->hasMetaData("clr:collection")) + { + // + // Equals() for DictionaryBase has value semantics. + // + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + else + { + // + // Equals() for generic types does not have value semantics. + // + _out << nl << "if(!IceUtilInternal.Collections.DictionaryEquals(" << memberName << ", o__." + << memberName << "))"; + } + } + else + { + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + } + _out << sb; + _out << nl << "return false;"; + _out << eb; + _out << eb; + } + else + { + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + _out << sb; + _out << nl << "return false;"; + _out << eb; + } + } +} + Slice::Gen::ProxyVisitor::ProxyVisitor(IceUtilInternal::Output& out) : CsVisitor(out) { diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h index 4962bb438d7..c33257945ae 100644 --- a/cpp/src/slice2cs/Gen.h +++ b/cpp/src/slice2cs/Gen.h @@ -112,6 +112,9 @@ private: private: + void writeMemberHashCode(const DataMemberList&, int); + void writeMemberEquals(const DataMemberList&, int); + bool _stream; }; diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index 5136997cc4f..4bf091353ab 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -1003,11 +1003,16 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c return false; } - if(!Dictionary::legalKeyType(valueType)) + bool containsSequence = false; + if(!Dictionary::legalKeyType(valueType, containsSequence)) { cerr << n << ": `" << dict.value << "' is not a valid index type" << endl; return false; } + if(containsSequence) + { + cerr << n << ": warning: use of sequences in dictionary keys has been deprecated" << endl; + } if(index.caseSensitive == false) @@ -1071,11 +1076,17 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c TypePtr dataMemberType = dataMember->type(); - if(!Dictionary::legalKeyType(dataMemberType)) + bool containsSequence = false; + if(!Dictionary::legalKeyType(dataMemberType, containsSequence)) { cerr << n << ": `" << index.member << "' cannot be used as an index" << endl; return false; } + if(containsSequence) + { + cerr << n << ": warning: use of sequences in dictionary keys has been deprecated" << endl; + } + if(index.caseSensitive == false) { diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index 4494fe94e0e..f8c51ab112b 100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -254,11 +254,16 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) return false; } - if(!Dictionary::legalKeyType(valueType)) + bool containsSequence = false; + if(!Dictionary::legalKeyType(valueType, containsSequence)) { cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl; return false; } + if(containsSequence) + { + cerr << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl; + } if(index.caseSensitive == false) { @@ -320,11 +325,16 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) TypePtr dataMemberType = dataMember->type(); - if(!Dictionary::legalKeyType(dataMemberType)) + bool containsSequence = false; + if(!Dictionary::legalKeyType(dataMemberType, containsSequence)) { cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl; return false; } + if(containsSequence) + { + cerr << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl; + } if(index.caseSensitive == false) { diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 86150620aad..504cd6f6e31 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2830,100 +2830,105 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) if(java2) { out << nl << "public final class " << name; + out << sb; + + out << nl << "private static " << name << "[] __values = new " << name << "[" << sz << "];"; + out << nl << "private int __value;"; + + out << sp; + int n; + for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n) + { + string member = fixKwd((*en)->name()); + out << nl << "public static final int _" << member << " = " << n << ';'; + out << nl << "public static final " << name << ' ' << fixKwd(member) + << " = new " << name << "(_" << member << ");"; + } + + out << sp << nl << "public static " << name << nl << "convert(int val)"; + out << sb; + out << nl << "assert val >= 0 && val < " << sz << ';'; + out << nl << "return __values[val];"; + out << eb; + + out << sp << nl << "public static " << name << nl << "convert(String val)"; + out << sb; + out << nl << "for(int __i = 0; __i < __values.length; ++__i)"; + out << sb; + out << nl << "if(__values[__i].toString().equals(val))"; + out << sb; + out << nl << "return __values[__i];"; + out << eb; + out << eb; + out << nl << "assert false;"; + out << nl << "return null;"; + out << eb; + + out << sp << nl << "public int" << nl << "value()"; + out << sb; + out << nl << "return __value;"; + out << eb; + + out << sp << nl << "public String" << nl << "toString()"; + out << sb; + out << nl << "return __T[__value];"; + out << eb; + + out << sp << nl << "private" << nl << name << "(int val)"; + out << sb; + out << nl << "__value = val;"; + out << nl << "__values[val] = this;"; + out << eb; } else { out << nl << "public enum " << name; - } - out << sb; + out << sb; - if(!java2) - { - int n; - for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n) + for(en = enumerators.begin(); en != enumerators.end(); ++en) { if(en != enumerators.begin()) { out << ','; } - out << nl << fixKwd((*en)->name()) << '(' << n << ')'; + out << nl << fixKwd((*en)->name()); } out << ';'; - out << sp; - } - out << nl << "private static " << name << "[] __values = new " << name << "[" << sz << "];"; - if(!java2) - { - out << nl << "static"; - out << sb; - int n; - for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n) - { - out << nl << "__values[" << n << "] = " << fixKwd((*en)->name()) << ';'; - } - out << eb; - } - out << nl << "private int __value;"; - - // - // For backward compatibility, we keep the integer member in the Java5 mapping. - // - { + // + // For backward compatibility, we keep the integer member in the Java5 mapping. + // out << sp; int n; for(en = enumerators.begin(), n = 0; en != enumerators.end(); ++en, ++n) { string member = fixKwd((*en)->name()); out << nl << "public static final int _" << member << " = " << n << ';'; - if(java2) - { - out << nl << "public static final " << name << ' ' << fixKwd(member) - << " = new " << name << "(_" << member << ");"; - } } - } - - out << sp << nl << "public static " << name << nl << "convert(int val)"; - out << sb; - out << nl << "assert val >= 0 && val < " << sz << ';'; - out << nl << "return __values[val];"; - out << eb; - - out << sp << nl << "public static " << name << nl << "convert(String val)"; - out << sb; - out << nl << "for(int __i = 0; __i < __values.length; ++__i)"; - out << sb; - out << nl << "if(__values[__i].toString().equals(val))"; - out << sb; - out << nl << "return __values[__i];"; - out << eb; - out << eb; - out << nl << "assert false;"; - out << nl << "return null;"; - out << eb; - out << sp << nl << "public int" << nl << "value()"; - out << sb; - out << nl << "return __value;"; - out << eb; + out << sp << nl << "public static " << name << nl << "convert(int val)"; + out << sb; + out << nl << "assert val >= 0 && val < " << sz << ';'; + out << nl << "return values()[val];"; + out << eb; - if(java2) - { - out << sp << nl << "public String" << nl << "toString()"; + out << sp << nl << "public static " << name << nl << "convert(String val)"; out << sb; - out << nl << "return __T[__value];"; + out << nl << "try"; + out << sb; + out << nl << "return valueOf(val);"; + out << eb; + out << nl << "catch(java.lang.IllegalArgumentException ex)"; + out << sb; + out << nl << "return null;"; + out << eb; out << eb; - } - out << sp << nl << "private" << nl << name << "(int val)"; - out << sb; - out << nl << "__value = val;"; - if(java2) - { - out << nl << "__values[val] = this;"; + out << sp << nl << "public int" << nl << "value()"; + out << sb; + out << nl << "return ordinal();"; + out << eb; } - out << eb; if(!p->isLocal()) { @@ -2931,15 +2936,15 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) out << sb; if(sz <= 0x7f) { - out << nl << "__os.writeByte((byte)__value);"; + out << nl << "__os.writeByte((byte)value());"; } else if(sz <= 0x7fff) { - out << nl << "__os.writeShort((short)__value);"; + out << nl << "__os.writeShort((short)value());"; } else { - out << nl << "__os.writeInt(__value);"; + out << nl << "__os.writeInt(value());"; } out << eb; @@ -2966,15 +2971,15 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) out << sb; if(sz <= 0x7f) { - out << nl << "__outS.writeByte((byte)__value);"; + out << nl << "__outS.writeByte((byte)value());"; } else if(sz <= 0x7fff) { - out << nl << "__outS.writeShort((short)__value);"; + out << nl << "__outS.writeShort((short)value());"; } else { - out << nl << "__outS.writeInt(__value);"; + out << nl << "__outS.writeInt(value());"; } out << eb; diff --git a/cpp/src/slice2sl/Gen.cpp b/cpp/src/slice2sl/Gen.cpp index 7e0d94b651f..516034513dc 100755 --- a/cpp/src/slice2sl/Gen.cpp +++ b/cpp/src/slice2sl/Gen.cpp @@ -1293,7 +1293,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string name = fixId((*q)->name(), DotNet::ApplicationException, false); + string name = fixId((*q)->name(), DotNet::Exception, false); _out << nl << "this." << name << " = " << fixId((*q)->name()) << ';'; } _out << eb; @@ -1335,22 +1335,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp << nl << "public override int GetHashCode()"; _out << sb; - _out << nl << "int h__ = 0;"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + if(p->base()) { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if((object)" << memberName << " != null)"; - _out << sb; - } - _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; - if(!isValue) - { - _out << eb; - } + _out << nl << "int h__ = base.GetHashCode();"; } + else + { + _out << nl << "int h__ = 0;"; + } + writeMemberHashCode(dataMembers, DotNet::Exception); _out << nl << "return h__;"; _out << eb; @@ -1368,31 +1361,18 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; _out << nl << "return false;"; _out << eb; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + if(p->base()) { - string memberName = fixId((*q)->name(), DotNet::ApplicationException); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if(" << memberName << " == null)"; - _out << sb; - _out << nl << "if(((" << name << ")other__)." << memberName << " != null)"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - _out << nl << "else"; - _out << sb; - } - _out << nl << "if(!" << memberName << ".Equals(((" << name << ")other__)." << memberName << "))"; + _out << nl << "if(!base.Equals(other__))"; _out << sb; _out << nl << "return false;"; _out << eb; - if(!isValue) - { - _out << eb; - } } + if(!dataMembers.empty()) + { + _out << nl << name << " o__ = (" << name << ")other__;"; + } + writeMemberEquals(dataMembers, DotNet::Exception); _out << nl << "return true;"; _out << eb; @@ -1425,7 +1405,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << nl << "os__.startWriteSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId(*q, DotNet::Exception), true, false, false); } _out << nl << "os__.endWriteSlice();"; @@ -1477,7 +1457,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << nl << "case " << memberCount << ":"; _out.inc(); } - string memberName = fixId((*q)->name(), DotNet::ApplicationException); + string memberName = fixId((*q)->name(), DotNet::Exception); string memberType = typeToString((*q)->type()); _out << nl << "_instance." << memberName << " = (" << memberType << ")v;"; ContainedPtr contained = ContainedPtr::dynamicCast((*q)->type()); @@ -1530,7 +1510,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) patchParams << ", " << classMemberCount++; } } - writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::ApplicationException), + writeMarshalUnmarshalCode(_out, (*q)->type(), fixId((*q)->name(), DotNet::Exception), false, false, false, patchParams.str()); } _out << nl << "is__.endReadSlice();"; @@ -1645,21 +1625,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp << nl << "public override int GetHashCode()"; _out << sb; _out << nl << "int h__ = 0;"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - bool isValue = isValueType((*q)->type()); - if(!isValue) - { - _out << nl << "if(" << memberName << " != null)"; - _out << sb; - } - _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; - if(!isValue) - { - _out << eb; - } - } + writeMemberHashCode(dataMembers, isClass ? DotNet::ICloneable : 0); _out << nl << "return h__;"; _out << eb; @@ -1691,34 +1657,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { _out << nl << name << " o__ = (" << name << ")other__;"; } - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - if(!isValueType((*q)->type())) - { - _out << nl << "if(" << memberName << " == null)"; - _out << sb; - _out << nl << "if(o__." << memberName << " != null)"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - _out << nl << "else"; - _out << sb; - _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - _out << eb; - } - else - { - _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; - _out << sb; - _out << nl << "return false;"; - _out << eb; - } - } + writeMemberEquals(dataMembers, isClass ? DotNet::ICloneable : 0); _out << nl << "return true;"; _out << eb; @@ -2023,7 +1962,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) } else if(ExceptionPtr::dynamicCast(cont)) { - baseTypes = DotNet::ApplicationException; + baseTypes = DotNet::Exception; } else if(ClassDefPtr::dynamicCast(cont)) { @@ -2088,6 +2027,168 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) _out << eb; } +void +Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers, int baseTypes) +{ + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + string memberName = fixId((*q)->name(), baseTypes); + TypePtr memberType = (*q)->type(); + bool isValue = isValueType(memberType); + if(!isValue) + { + _out << nl << "if(" << memberName << " != null)"; + _out << sb; + } + SequencePtr seq = SequencePtr::dynamicCast(memberType); + if(seq) + { + string genericType; + bool isGeneric = seq->findMetaData("clr:generic:", genericType); + bool isArray = !isGeneric && !seq->hasMetaData("clr:collection"); + if(isArray) + { + // + // GetHashCode() for native arrays does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtil.Arrays.GetHashCode(" << memberName << ");"; + } + else if(isGeneric) + { + // + // GetHashCode() for generic types does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtil.Collections.SequenceGetHashCode(" << memberName << ");"; + } + else + { + // + // GetHashCode() for CollectionBase has value semantics. + // + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + } + else + { + DictionaryPtr dict = DictionaryPtr::dynamicCast(memberType); + if(dict) + { + if(dict->hasMetaData("clr:collection")) + { + // + // GetHashCode() for DictionaryBase has value semantics. + // + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + else + { + // + // GetHashCode() for generic types does not have value semantics. + // + _out << nl << "h__ = 5 * h__ + IceUtil.Collections.DictionaryGetHashCode(" << memberName + << ");"; + } + } + else + { + _out << nl << "h__ = 5 * h__ + " << memberName << ".GetHashCode();"; + } + } + if(!isValue) + { + _out << eb; + } + } +} + +void +Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, int baseTypes) +{ + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + string memberName = fixId((*q)->name(), baseTypes); + TypePtr memberType = (*q)->type(); + if(!isValueType(memberType)) + { + _out << nl << "if(" << memberName << " == null)"; + _out << sb; + _out << nl << "if(o__." << memberName << " != null)"; + _out << sb; + _out << nl << "return false;"; + _out << eb; + _out << eb; + _out << nl << "else"; + _out << sb; + SequencePtr seq = SequencePtr::dynamicCast(memberType); + if(seq) + { + string genericType; + bool isGeneric = seq->findMetaData("clr:generic:", genericType); + bool isArray = !isGeneric && !seq->hasMetaData("clr:collection"); + if(isArray) + { + // + // Equals() for native arrays does not have value semantics. + // + _out << nl << "if(!IceUtil.Arrays.Equals(" << memberName << ", o__." << memberName << "))"; + } + else if(isGeneric) + { + // + // Equals() for generic types does not have value semantics. + // + _out << nl << "if(!IceUtil.Collections.SequenceEquals(" << memberName << ", o__." + << memberName << "))"; + } + else + { + // + // Equals() for CollectionBase has value semantics. + // + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + } + else + { + DictionaryPtr dict = DictionaryPtr::dynamicCast(memberType); + if(dict) + { + if(dict->hasMetaData("clr:collection")) + { + // + // Equals() for DictionaryBase has value semantics. + // + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + else + { + // + // Equals() for generic types does not have value semantics. + // + _out << nl << "if(!IceUtil.Collections.DictionaryEquals(" << memberName << ", o__." + << memberName << "))"; + } + } + else + { + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + } + } + _out << sb; + _out << nl << "return false;"; + _out << eb; + _out << eb; + } + else + { + _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))"; + _out << sb; + _out << nl << "return false;"; + _out << eb; + } + } +} + Slice::Gen::ProxyVisitor::ProxyVisitor(IceUtilInternal::Output& out) : CsVisitor(out) { diff --git a/cpp/src/slice2sl/Gen.h b/cpp/src/slice2sl/Gen.h index c72a9e4b31d..c4d3292d072 100644 --- a/cpp/src/slice2sl/Gen.h +++ b/cpp/src/slice2sl/Gen.h @@ -99,6 +99,11 @@ private: virtual void visitEnum(const EnumPtr&); virtual void visitConst(const ConstPtr&); virtual void visitDataMember(const DataMemberPtr&); + + private: + + void writeMemberHashCode(const DataMemberList&, int); + void writeMemberEquals(const DataMemberList&, int); }; class ProxyVisitor : public CsVisitor diff --git a/cpp/test/Freeze/complex/Parser.cpp b/cpp/test/Freeze/complex/Parser.cpp index 8d1754cb503..93ed7e778eb 100644 --- a/cpp/test/Freeze/complex/Parser.cpp +++ b/cpp/test/Freeze/complex/Parser.cpp @@ -69,8 +69,8 @@ Parser::getInput(char* buf, int& result, int maxSize) { if(!_buf.empty()) { -#if defined(_MSC_VER) && !defined(_STLP_MSVC) - // COMPILERBUG: Stupid Visual C++ defines min and max as macros +#if defined(_MSC_VER) && _MSC_VER < 1500 && !defined(_STLP_MSVC) + // COMPILERBUG: Visual C++ defines min and max as macros result = _MIN(maxSize, static_cast<int>(_buf.length())); #else result = min(maxSize, static_cast<int>(_buf.length())); diff --git a/cpp/test/Freeze/complex/run.py b/cpp/test/Freeze/complex/run.py index 8fa474a2a7a..19395e6cc75 100755 --- a/cpp/test/Freeze/complex/run.py +++ b/cpp/test/Freeze/complex/run.py @@ -18,7 +18,8 @@ else: raise "can't find toplevel directory!" sys.path.append(os.path.join(toplevel, "config")) -import TestUtil +import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Freeze/dbmap/run.py b/cpp/test/Freeze/dbmap/run.py index 87f2961e254..294171da26c 100755 --- a/cpp/test/Freeze/dbmap/run.py +++ b/cpp/test/Freeze/dbmap/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Freeze/evictor/run.py b/cpp/test/Freeze/evictor/run.py index f47ebccee03..9f1f6bf50f4 100755 --- a/cpp/test/Freeze/evictor/run.py +++ b/cpp/test/Freeze/evictor/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Freeze", "evictor") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Freeze/oldevictor/run.py b/cpp/test/Freeze/oldevictor/run.py index 1b26f8ccc1e..64ef39f758a 100755 --- a/cpp/test/Freeze/oldevictor/run.py +++ b/cpp/test/Freeze/oldevictor/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Freeze", "oldevictor") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/FreezeScript/dbmap/run.py b/cpp/test/FreezeScript/dbmap/run.py index daa7da82709..bba63dcc45e 100755 --- a/cpp/test/FreezeScript/dbmap/run.py +++ b/cpp/test/FreezeScript/dbmap/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() directory = os.path.dirname(os.path.abspath(__file__)) transformdb = os.path.join(toplevel, "cpp", "bin", "transformdb") diff --git a/cpp/test/FreezeScript/evictor/run.py b/cpp/test/FreezeScript/evictor/run.py index 5d4fe72d273..eac5e2a36e9 100755 --- a/cpp/test/FreezeScript/evictor/run.py +++ b/cpp/test/FreezeScript/evictor/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() directory = os.path.dirname(os.path.abspath(__file__)) transformdb = os.path.join(toplevel, "cpp", "bin", "transformdb") diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py index 93aedcc71bc..2f8f5650054 100755 --- a/cpp/test/Glacier2/attack/run.py +++ b/cpp/test/Glacier2/attack/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() router = os.path.join(TestUtil.getBinDir(__file__), "glacier2router") diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py index 3121484d7f5..0ab8401a702 100755 --- a/cpp/test/Glacier2/dynamicFiltering/run.py +++ b/cpp/test/Glacier2/dynamicFiltering/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py index 3069d0b6cbf..bcddfc5a9c8 100755 --- a/cpp/test/Glacier2/router/run.py +++ b/cpp/test/Glacier2/router/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() router = os.path.join(TestUtil.getBinDir(__file__), "glacier2router") diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py index c8aaf3670bd..048eba6a562 100755 --- a/cpp/test/Glacier2/sessionControl/run.py +++ b/cpp/test/Glacier2/sessionControl/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Glacier2", "sessionControl") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py index 2333b7445b0..f0febbd9ec3 100755 --- a/cpp/test/Glacier2/ssl/run.py +++ b/cpp/test/Glacier2/ssl/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Glacier2", "ssl") diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py index c91c2906c45..36f4772a1bf 100755 --- a/cpp/test/Glacier2/staticFiltering/run.py +++ b/cpp/test/Glacier2/staticFiltering/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() hostname = socket.gethostname() fqdn = socket.getfqdn() diff --git a/cpp/test/Ice/adapterDeactivation/run.py b/cpp/test/Ice/adapterDeactivation/run.py index 6a844bd1e05..789ff1b7f41 100755 --- a/cpp/test/Ice/adapterDeactivation/run.py +++ b/cpp/test/Ice/adapterDeactivation/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "adapterDeactivation") diff --git a/cpp/test/Ice/background/run.py b/cpp/test/Ice/background/run.py index 1f1d365cadc..ffa6acdbc2b 100755 --- a/cpp/test/Ice/background/run.py +++ b/cpp/test/Ice/background/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "background") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Ice/binding/run.py b/cpp/test/Ice/binding/run.py index 4740b351018..02f04424efa 100755 --- a/cpp/test/Ice/binding/run.py +++ b/cpp/test/Ice/binding/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "binding") diff --git a/cpp/test/Ice/checksum/run.py b/cpp/test/Ice/checksum/run.py index 1cca9d69d43..97845fd0f6d 100755 --- a/cpp/test/Ice/checksum/run.py +++ b/cpp/test/Ice/checksum/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "checksum") diff --git a/cpp/test/Ice/custom/run.py b/cpp/test/Ice/custom/run.py index ecc72eecef7..e3615b0dd26 100755 --- a/cpp/test/Ice/custom/run.py +++ b/cpp/test/Ice/custom/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "custom") diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py index ce9ce8c6580..1fe8ff8f01d 100755 --- a/cpp/test/Ice/exceptions/run.py +++ b/cpp/test/Ice/exceptions/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "exceptions") diff --git a/cpp/test/Ice/facets/run.py b/cpp/test/Ice/facets/run.py index 6819bee9a27..b3afa6aeb5f 100755 --- a/cpp/test/Ice/facets/run.py +++ b/cpp/test/Ice/facets/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "facets") diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py index 4609ee06f1b..0e091b083ec 100755 --- a/cpp/test/Ice/faultTolerance/run.py +++ b/cpp/test/Ice/faultTolerance/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "faultTolerance") diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py index e67d0c7ae99..011684a5e3b 100755 --- a/cpp/test/Ice/gc/run.py +++ b/cpp/test/Ice/gc/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "gc") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Ice/hold/run.py b/cpp/test/Ice/hold/run.py index 6fe4eba0621..e67fb9482ac 100755 --- a/cpp/test/Ice/hold/run.py +++ b/cpp/test/Ice/hold/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "hold") diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py index 4891102c8f9..7ecff0e5ae5 100755 --- a/cpp/test/Ice/inheritance/run.py +++ b/cpp/test/Ice/inheritance/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "inheritance") diff --git a/cpp/test/Ice/interceptor/run.py b/cpp/test/Ice/interceptor/run.py index 6014850b376..579120a0d0c 100755 --- a/cpp/test/Ice/interceptor/run.py +++ b/cpp/test/Ice/interceptor/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Ice/location/run.py b/cpp/test/Ice/location/run.py index be23e30ec16..177ebe2fb41 100755 --- a/cpp/test/Ice/location/run.py +++ b/cpp/test/Ice/location/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "location") diff --git a/cpp/test/Ice/objects/run.py b/cpp/test/Ice/objects/run.py index 6540f10fb9f..81b178ba4f4 100755 --- a/cpp/test/Ice/objects/run.py +++ b/cpp/test/Ice/objects/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "objects") diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 83730ef681d..2af41942c14 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -13,7 +13,7 @@ #include <limits> // -// Stupid Visual C++ defines min and max as macros :-( +// Visual C++ defines min and max as macros // #ifdef min # undef min diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index cb7189d35df..33435ba5d59 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -13,7 +13,7 @@ #include <limits> // -// Stupid Visual C++ defines min and max as macros :-( +// Visual C++ defines min and max as macros // #ifdef min # undef min diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py index 79e05add351..04d358c2981 100755 --- a/cpp/test/Ice/operations/run.py +++ b/cpp/test/Ice/operations/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "operations") diff --git a/cpp/test/Ice/proxy/run.py b/cpp/test/Ice/proxy/run.py index 2fb4c95a37d..f991276d917 100755 --- a/cpp/test/Ice/proxy/run.py +++ b/cpp/test/Ice/proxy/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "proxy") diff --git a/cpp/test/Ice/retry/run.py b/cpp/test/Ice/retry/run.py index 1872e2f2a0e..f0bc8d57120 100755 --- a/cpp/test/Ice/retry/run.py +++ b/cpp/test/Ice/retry/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "retry") diff --git a/cpp/test/Ice/servantLocator/run.py b/cpp/test/Ice/servantLocator/run.py index 0998bc7e6fd..527b3b391e9 100755 --- a/cpp/test/Ice/servantLocator/run.py +++ b/cpp/test/Ice/servantLocator/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "servantLocator") diff --git a/cpp/test/Ice/slicing/exceptions/run.py b/cpp/test/Ice/slicing/exceptions/run.py index 2bf539d286b..e5effa1c47e 100755 --- a/cpp/test/Ice/slicing/exceptions/run.py +++ b/cpp/test/Ice/slicing/exceptions/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "slicing", "exceptions") diff --git a/cpp/test/Ice/slicing/objects/run.py b/cpp/test/Ice/slicing/objects/run.py index 376ba0dacaf..11ef0384e8f 100755 --- a/cpp/test/Ice/slicing/objects/run.py +++ b/cpp/test/Ice/slicing/objects/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "slicing", "objects") diff --git a/cpp/test/Ice/stream/run.py b/cpp/test/Ice/stream/run.py index 94144947408..a8d95e0d012 100755 --- a/cpp/test/Ice/stream/run.py +++ b/cpp/test/Ice/stream/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() client = os.path.join(os.path.dirname(os.path.abspath(__file__)), "client") diff --git a/cpp/test/Ice/stringConverter/run.py b/cpp/test/Ice/stringConverter/run.py index 1bb518aa9fc..1e05abd1220 100755 --- a/cpp/test/Ice/stringConverter/run.py +++ b/cpp/test/Ice/stringConverter/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/Ice/threads/run.py b/cpp/test/Ice/threads/run.py index b86ec511481..bbd15920d76 100755 --- a/cpp/test/Ice/threads/run.py +++ b/cpp/test/Ice/threads/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "threads") diff --git a/cpp/test/Ice/timeout/run.py b/cpp/test/Ice/timeout/run.py index dde06549964..f04e73b903a 100755 --- a/cpp/test/Ice/timeout/run.py +++ b/cpp/test/Ice/timeout/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Ice", "timeout") diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py index 5cccb599ce0..2b8faa2881a 100755 --- a/cpp/test/IceBox/configuration/run.py +++ b/cpp/test/IceBox/configuration/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceBox", "configuration") diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py index 49518d05260..5f665f74b93 100755 --- a/cpp/test/IceGrid/activation/run.py +++ b/cpp/test/IceGrid/activation/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "activation") diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py index c236cc70599..36e87f4808f 100755 --- a/cpp/test/IceGrid/allocation/run.py +++ b/cpp/test/IceGrid/allocation/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "allocation") diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py index c153fc069fd..62d8f8d6523 100755 --- a/cpp/test/IceGrid/deployer/run.py +++ b/cpp/test/IceGrid/deployer/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "deployer") diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py index 43863bb90ed..0fd825d771a 100755 --- a/cpp/test/IceGrid/distribution/run.py +++ b/cpp/test/IceGrid/distribution/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin def icepatch2Calc(datadir, dirname): diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py index 8de2443fb14..d5fa8c36514 100755 --- a/cpp/test/IceGrid/replicaGroup/run.py +++ b/cpp/test/IceGrid/replicaGroup/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "replicaGroup") diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py index 3c93ef42806..33ccce57501 100755 --- a/cpp/test/IceGrid/replication/run.py +++ b/cpp/test/IceGrid/replication/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "replication") diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py index d9b34547674..2641badd573 100755 --- a/cpp/test/IceGrid/session/run.py +++ b/cpp/test/IceGrid/session/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin if not TestUtil.isWin32() and os.getuid() == 0: diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py index d90c5932723..b42a2ce003a 100755 --- a/cpp/test/IceGrid/simple/run.py +++ b/cpp/test/IceGrid/simple/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "simple") diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py index c8cec14318d..07133c53ad6 100755 --- a/cpp/test/IceGrid/update/run.py +++ b/cpp/test/IceGrid/update/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() import IceGridAdmin name = os.path.join("IceGrid", "update") diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index bc1c833c146..9831ce15e62 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("IceSSL", "configuration") diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py index 598f4abbb67..3f36ce46a4c 100755 --- a/cpp/test/IceStorm/federation/run.py +++ b/cpp/test/IceStorm/federation/run.py @@ -20,6 +20,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("IceStorm", "federation") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py index 4c4a187ee50..411533e1ff0 100755 --- a/cpp/test/IceStorm/federation2/run.py +++ b/cpp/test/IceStorm/federation2/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("IceStorm", "federation2") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py index ce1f7758ea8..01f378c25cf 100755 --- a/cpp/test/IceStorm/single/run.py +++ b/cpp/test/IceStorm/single/run.py @@ -20,6 +20,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("IceStorm", "single") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py index 89235907598..dacf98b7a2b 100755 --- a/cpp/test/IceStorm/stress/run.py +++ b/cpp/test/IceStorm/stress/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("IceStorm", "stress") testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceUtil/condvar/run.py b/cpp/test/IceUtil/condvar/run.py index 3060d194831..ad44a80d148 100755 --- a/cpp/test/IceUtil/condvar/run.py +++ b/cpp/test/IceUtil/condvar/run.py @@ -19,12 +19,15 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) workqueue = os.path.join(testdir, "workqueue") print "starting workqueue...", +if TestUtil.debug: + print "(" + workqueue + ")", workqueuePipe = os.popen(workqueue + " 2>&1") print "ok" diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py index 1f0816bd4af..2fb0e96c3e5 100755 --- a/cpp/test/IceUtil/inputUtil/run.py +++ b/cpp/test/IceUtil/inputUtil/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py index 394aa162dfc..6d4273abdea 100755 --- a/cpp/test/IceUtil/thread/run.py +++ b/cpp/test/IceUtil/thread/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) @@ -26,7 +27,10 @@ client = os.path.join(testdir, "client") clientOptions = ' ' + testdir print "starting client...", -clientPipe = os.popen(client + clientOptions + " 2>&1") +command = client + clientOptions +if TestUtil.debug: + print "(" + command + ")", +clientPipe = os.popen(command + " 2>&1") print "ok" TestUtil.printOutputFromPipe(clientPipe) diff --git a/cpp/test/IceUtil/timer/run.py b/cpp/test/IceUtil/timer/run.py index 1bb518aa9fc..1e05abd1220 100755 --- a/cpp/test/IceUtil/timer/run.py +++ b/cpp/test/IceUtil/timer/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py index e5f00245ce9..e004f5eb142 100755 --- a/cpp/test/IceUtil/unicode/run.py +++ b/cpp/test/IceUtil/unicode/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py index 1bb518aa9fc..0c8912bde72 100755 --- a/cpp/test/IceUtil/uuid/run.py +++ b/cpp/test/IceUtil/uuid/run.py @@ -19,12 +19,15 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() testdir = os.path.dirname(os.path.abspath(__file__)) client = os.path.join(testdir, "client") print "starting client...", +if TestUtil.debug: + print "(" + client + ")", clientPipe = os.popen(client + " 2>&1") print "ok" diff --git a/cpp/test/Slice/errorDetection/IllegalDictionary.err b/cpp/test/Slice/errorDetection/IllegalDictionary.err index 33863b470f8..3ab576761e6 100644 --- a/cpp/test/Slice/errorDetection/IllegalDictionary.err +++ b/cpp/test/Slice/errorDetection/IllegalDictionary.err @@ -3,6 +3,9 @@ IllegalDictionary.ice:23: dictionary `b2' uses an illegal key type IllegalDictionary.ice:24: dictionary `b3' uses an illegal key type IllegalDictionary.ice:25: dictionary `b4' uses an illegal key type IllegalDictionary.ice:26: dictionary `b5' uses an illegal key type +IllegalDictionary.ice:29: warning: use of sequences in dictionary keys has been deprecated IllegalDictionary.ice:32: dictionary `b6' uses an illegal key type +IllegalDictionary.ice:35: warning: use of sequences in dictionary keys has been deprecated IllegalDictionary.ice:49: dictionary `b8' uses an illegal key type +IllegalDictionary.ice:55: warning: use of sequences in dictionary keys has been deprecated IllegalDictionary.ice:57: dictionary `b9' uses an illegal key type diff --git a/cpp/test/Slice/errorDetection/IllegalDictionary.ice b/cpp/test/Slice/errorDetection/IllegalDictionary.ice index c0aef8c6c8d..136c177e4de 100644 --- a/cpp/test/Slice/errorDetection/IllegalDictionary.ice +++ b/cpp/test/Slice/errorDetection/IllegalDictionary.ice @@ -26,13 +26,13 @@ dictionary<Object*, long> b4; // Bad dictionary<LocalObject, long> b5; // Bad sequence<byte> s1; -dictionary<s1, long> d7; // OK +dictionary<s1, long> d7; // Deprecated sequence<float> s2; dictionary<s2, long> b6; // Bad sequence<s1> s3; -dictionary<s3, long> b7; // OK +dictionary<s3, long> b7; // Deprecated struct st1 { @@ -52,7 +52,7 @@ enum e { e1, e2 }; dictionary<e, long> d9; // OK sequence<e> s4; -dictionary<s4, long> d10; // OK +dictionary<s4, long> d10; // Deprecated dictionary<d9, long> b9; // Bad diff --git a/cpp/test/Slice/errorDetection/IllegalLocal.err b/cpp/test/Slice/errorDetection/IllegalLocal.err index a311da61d9c..fa56f466c01 100644 --- a/cpp/test/Slice/errorDetection/IllegalLocal.err +++ b/cpp/test/Slice/errorDetection/IllegalLocal.err @@ -11,8 +11,10 @@ IllegalLocal.ice:43: non-local class`c3' cannot contain local member `ls' IllegalLocal.ice:48: non-local struct`s1' cannot contain local member `ls'
IllegalLocal.ice:53: non-local exception`e3' cannot contain local member `ls'
IllegalLocal.ice:56: non-local sequence `los' cannot have local element type
+IllegalLocal.ice:59: warning: use of sequences in dictionary keys has been deprecated
IllegalLocal.ice:59: non-local dictionary `d1' cannot have local key type
IllegalLocal.ice:60: non-local dictionary `d2' cannot have local value type
+IllegalLocal.ice:61: warning: use of sequences in dictionary keys has been deprecated
IllegalLocal.ice:61: non-local dictionary `d3' cannot have local key type
IllegalLocal.ice:61: non-local dictionary `d3' cannot have local value type
IllegalLocal.ice:66: non-local struct`s2' cannot contain local member `m'
diff --git a/cpp/test/Slice/errorDetection/WrongProxyType.err b/cpp/test/Slice/errorDetection/WrongProxyType.err index 8665b846f14..ab7e04633ad 100644 --- a/cpp/test/Slice/errorDetection/WrongProxyType.err +++ b/cpp/test/Slice/errorDetection/WrongProxyType.err @@ -1,3 +1,4 @@ +WrongProxyType.ice:16: warning: use of sequences in dictionary keys has been deprecated WrongProxyType.ice:20: `Seq' must be class or interface WrongProxyType.ice:21: `Seq' must be class or interface WrongProxyType.ice:22: `Seq' must be class or interface diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py index 6fedf753866..81554dfc998 100755 --- a/cpp/test/Slice/errorDetection/run.py +++ b/cpp/test/Slice/errorDetection/run.py @@ -22,6 +22,7 @@ else: # sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() directory = os.path.dirname(os.path.abspath(__file__)) slice2cpp = os.path.join(TestUtil.getBinDir(__file__), "slice2cpp") diff --git a/cpp/test/Slice/keyword/run.py b/cpp/test/Slice/keyword/run.py index cad915b57ec..4863f077175 100755 --- a/cpp/test/Slice/keyword/run.py +++ b/cpp/test/Slice/keyword/run.py @@ -19,6 +19,7 @@ else: sys.path.append(os.path.join(toplevel, "config")) import TestUtil +TestUtil.processCmdLine() name = os.path.join("Slice", "keyword") testdir = os.path.dirname(os.path.abspath(__file__)) |