diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-04-17 03:15:58 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-04-17 03:15:58 +0000 |
commit | 3176b44a88bfe6058159d5a24d160f57e960615c (patch) | |
tree | cb3ed89fa04355aec4433687b9a6dc81528cbd31 /cpp | |
parent | file FactoryTableDef.cpp was initially added on branch slicing. (diff) | |
download | ice-3176b44a88bfe6058159d5a24d160f57e960615c.tar.bz2 ice-3176b44a88bfe6058159d5a24d160f57e960615c.tar.xz ice-3176b44a88bfe6058159d5a24d160f57e960615c.zip |
Macro reorg/cleanup
Diffstat (limited to 'cpp')
33 files changed, 270 insertions, 341 deletions
diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index 22fd709eb2a..56ab579c0b5 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -27,6 +27,18 @@ prefix = /opt/Ice-$(VERSION) #OPTIMIZE = yes # +# Define LP64 as yes if you want to build in 64 bit mode on a platform +# that supports both 32 and 64 bit. +# +#LP64 := yes + +# +# Define USER_READLINE as yes if you want to build parts of Ice using +# readline on platforms where readline is available. + +USE_READLINE := yes + +# # The values below can be overridden by defining them as environment # variables. For example, if you are using a bourne shell or # compatible, you can override the location of STLport like this: @@ -111,13 +123,10 @@ INSTALL_DATA = ${INSTALL} -m 644 UNAME := $(shell uname) # -# TODO: synchronize properly USE_READLINE here and HAS_READLINE -# in include/IceUtil/Config.h +# Platform specific definitions # +include $(top_srcdir)/config/Make.rules.$(UNAME) -ifeq ($(UNAME),Linux) -USE_READLINE := 1 -endif ifneq ($(STLPORT_HOME),) STLPORT_FLAGS = -I$(STLPORT_HOME)/include/stlport @@ -159,22 +168,18 @@ else XERCESC_LIBS = -lxerces-c endif -ifneq ($(USE_READLINE),) - ifneq ($(READLINE_HOME),) - - READLINE_FLAGS = -I$(READLINE_HOME)/include - READLINE_LIBS = -L$(READLINE_HOME)/lib -lreadline -lncurses - else - READLINE_FLAGS = - READLINE_LIBS = -lreadline -lncurses +ifeq ($(PLATFORM_HAS_READLINE),yes) + ifeq ($(USE_READLINE),yes) + ifneq ($(READLINE_HOME),) + READLINE_FLAGS = -DHAVE_READLINE -I$(READLINE_HOME)/include + READLINE_LIBS = -L$(READLINE_HOME)/lib -lreadline -lncurses + else + READLINE_FLAGS = -DHAVE_READLINE + READLINE_LIBS = -lreadline -lncurses + endif endif endif -# -# Platform specific definitions -# -include $(top_srcdir)/config/Make.rules.$(UNAME) - CPPFLAGS = -I$(includedir) $(STLPORT_FLAGS) ICECPPFLAGS = -I$(slicedir) diff --git a/cpp/config/Make.rules.Linux b/cpp/config/Make.rules.Linux index 50c8f6c737b..ce127a75e56 100644 --- a/cpp/config/Make.rules.Linux +++ b/cpp/config/Make.rules.Linux @@ -33,3 +33,5 @@ BASELIBS = -lIceUtil $(STLPORT_LIBS) -lpthread LIBS = -lIce -ldl -lbz2 $(BASELIBS) ICEUTIL_OS_LIBS = -lpthread + +PLATFORM_HAS_READLINE := yes diff --git a/cpp/config/Make.rules.SunOS b/cpp/config/Make.rules.SunOS index 2d3f7ecbf48..f9ed5db8f0b 100644 --- a/cpp/config/Make.rules.SunOS +++ b/cpp/config/Make.rules.SunOS @@ -19,6 +19,11 @@ CXX = CC CXXFLAGS = -KPIC -mt +w +p +ifeq ($(LP64),yes) + CXXFLAGS = -xarch=v9 $(CXXFLAGS) +endif + + TEMPLATE_REPOSITORY = SunWS_cache ifeq ($(OPTIMIZE),yes) diff --git a/cpp/demo/Freeze/library/Makefile b/cpp/demo/Freeze/library/Makefile index 05b7fcaaee0..d98c5a46e44 100644 --- a/cpp/demo/Freeze/library/Makefile +++ b/cpp/demo/Freeze/library/Makefile @@ -51,7 +51,7 @@ SLICE_SRCS = Library.ice include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I. $(DB_FLAGS) $(CPPFLAGS) +CPPFLAGS := -I. $(DB_FLAGS) $(READLINE_FLAGS) $(CPPFLAGS) SLICE2CPPFLAGS := --ice $(SLICE2CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) diff --git a/cpp/demo/Freeze/phonebook/Makefile b/cpp/demo/Freeze/phonebook/Makefile index 52726bec970..99f0ea3cb27 100644 --- a/cpp/demo/Freeze/phonebook/Makefile +++ b/cpp/demo/Freeze/phonebook/Makefile @@ -52,7 +52,7 @@ SLICE_SRCS = PhoneBook.ice include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I. $(DB_FLAGS) $(CPPFLAGS) +CPPFLAGS := -I. $(DB_FLAGS) $(READLINE_FLAGS) $(CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ diff --git a/cpp/demo/Ice/throughput/.depend b/cpp/demo/Ice/throughput/.depend index e7643a16950..d6e43781deb 100644 --- a/cpp/demo/Ice/throughput/.depend +++ b/cpp/demo/Ice/throughput/.depend @@ -1,4 +1,4 @@ -Throughput.o: Throughput.cpp Throughput.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/Const.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/Stream.h ../../../include/Ice/BuiltinSequences.h -Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h Throughput.h ../../../include/Ice/Const.h -Server.o: Server.cpp ThroughputI.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h Throughput.h ../../../include/Ice/Const.h +Throughput.o: Throughput.cpp Throughput.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/InstanceF.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/Stream.h ../../../include/Ice/BuiltinSequences.h +Client.o: Client.cpp ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h Throughput.h +Server.o: Server.cpp ThroughputI.h ../../../include/Ice/Ice.h ../../../include/Ice/Initialize.h ../../../include/Ice/CommunicatorF.h ../../../include/Ice/LocalObjectF.h ../../../include/Ice/Handle.h ../../../include/IceUtil/Handle.h ../../../include/IceUtil/Exception.h ../../../include/IceUtil/Config.h ../../../include/Ice/Config.h ../../../include/Ice/ProxyF.h ../../../include/Ice/ProxyHandle.h ../../../include/Ice/ObjectF.h ../../../include/Ice/Exception.h ../../../include/Ice/LocalObject.h ../../../include/IceUtil/Shared.h ../../../include/Ice/StreamF.h ../../../include/Ice/PropertiesF.h ../../../include/Ice/InstanceF.h ../../../include/Ice/BuiltinSequences.h ../../../include/Ice/Proxy.h ../../../include/IceUtil/Mutex.h ../../../include/IceUtil/Lock.h ../../../include/IceUtil/ThreadException.h ../../../include/Ice/ProxyFactoryF.h ../../../include/Ice/ConnectionF.h ../../../include/Ice/EndpointF.h ../../../include/Ice/ObjectAdapterF.h ../../../include/Ice/ReferenceF.h ../../../include/Ice/OutgoingAsyncF.h ../../../include/Ice/Current.h ../../../include/Ice/Identity.h ../../../include/Ice/Facet.h ../../../include/Ice/Object.h ../../../include/Ice/IncomingAsyncF.h ../../../include/Ice/Outgoing.h ../../../include/IceUtil/Monitor.h ../../../include/IceUtil/Cond.h ../../../include/IceUtil/Time.h ../../../include/Ice/BasicStream.h ../../../include/Ice/ObjectFactoryF.h ../../../include/Ice/Buffer.h ../../../include/Ice/Incoming.h ../../../include/Ice/ServantLocatorF.h ../../../include/Ice/ServantManagerF.h ../../../include/Ice/Direct.h ../../../include/Ice/LocalException.h ../../../include/Ice/Properties.h ../../../include/Ice/Logger.h ../../../include/Ice/LoggerUtil.h ../../../include/Ice/LoggerF.h ../../../include/Ice/Stats.h ../../../include/Ice/Communicator.h ../../../include/Ice/StatsF.h ../../../include/Ice/UserExceptionFactoryF.h ../../../include/Ice/RouterF.h ../../../include/Ice/LocatorF.h ../../../include/Ice/PluginF.h ../../../include/Ice/ObjectFactory.h ../../../include/Ice/UserExceptionFactory.h ../../../include/Ice/ObjectAdapter.h ../../../include/Ice/ServantLocator.h ../../../include/Ice/IdentityUtil.h ../../../include/Ice/OutgoingAsync.h ../../../include/Ice/IncomingAsync.h ../../../include/Ice/Application.h Throughput.h Throughput.cpp: Throughput.ice diff --git a/cpp/include/Freeze/Application.h b/cpp/include/Freeze/Application.h index f87d9fec60e..0db2ee5bfdd 100644 --- a/cpp/include/Freeze/Application.h +++ b/cpp/include/Freeze/Application.h @@ -15,16 +15,6 @@ #ifndef FREEZE_APPLICATION_H #define FREEZE_APPLICATION_H -#ifdef _WIN32 -# ifdef FREEZE_API_EXPORTS -# define FREEZE_API __declspec(dllexport) -# else -# define FREEZE_API __declspec(dllimport) -# endif -#else -# define FREEZE_API /**/ -#endif - #include <Ice/Application.h> #include <Freeze/Freeze.h> diff --git a/cpp/include/Freeze/Initialize.h b/cpp/include/Freeze/Initialize.h index 3b208a70238..8fefce833ce 100644 --- a/cpp/include/Freeze/Initialize.h +++ b/cpp/include/Freeze/Initialize.h @@ -18,16 +18,6 @@ #include <Ice/Ice.h> #include <Freeze/DBF.h> -#ifdef _WIN32 -# ifdef FREEZE_API_EXPORTS -# define FREEZE_API __declspec(dllexport) -# else -# define FREEZE_API __declspec(dllimport) -# endif -#else -# define FREEZE_API /**/ -#endif - namespace Freeze { diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index a1211c23f8f..804e4ede4a7 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -27,6 +27,13 @@ #include <vector> #include <map> +#if defined(_WIN32) +# include <process.h> +#else +# include <sys/types.h> +# include <unistd.h> +#endif + // // Define the Ice and IceInternal namespace, so that we can use the following // everywhere in our code: @@ -42,21 +49,22 @@ namespace IceInternal { } -#if defined(_WIN32) - +#ifndef ICE_API # ifdef ICE_API_EXPORTS -# define ICE_API __declspec(dllexport) -# else -# define ICE_API __declspec(dllimport) -# endif +# define ICE_API ICE_DECLSPEC_EXPORT +# else +# define ICE_API ICE_DECLSPEC_IMPORT +# endif +#endif +#ifndef ICE_PROTOCOL_API # ifdef ICE_PROTOCOL_API_EXPORTS -# define ICE_PROTOCOL_API __declspec(dllexport) +# define ICE_PROTOCOL_API ICE_DECLSPEC_EXPORT # else -# define ICE_PROTOCOL_API __declspec(dllimport) +# define ICE_PROTOCOL_API ICE_DECLSPEC_IMPORT # endif +#endif -# include <process.h> namespace Ice { @@ -64,50 +72,19 @@ namespace Ice typedef char Byte; typedef short Short; typedef int Int; -typedef __int64 Long; +typedef IceUtil::Int64 Long; typedef float Float; typedef double Double; } // TODO: Should not be inline, this is not performance critical. +#ifdef _WIN32 inline int getSystemErrno() { return GetLastError(); } inline int getSocketErrno() { return WSAGetLastError(); } - -#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) || defined (__sun) - -# include <sys/types.h> -# include <unistd.h> - -# define ICE_API /**/ -# define ICE_PROTOCOL_API /**/ - -namespace Ice -{ - -typedef char Byte; -typedef short Short; -typedef int Int; - -#ifdef __sparcv9 -typedef long Long #else -typedef long long Long; -#endif - -typedef float Float; -typedef double Double; - -} - -// TODO: Should not be inline, this is not performance critical. inline int getSystemErrno() { return errno; } inline int getSocketErrno() { return errno; } - -#else - -# error "Unsupported operating system or platform!" - #endif #endif diff --git a/cpp/include/Ice/Const.h b/cpp/include/Ice/Const.h deleted file mode 100644 index 044fd3a8741..00000000000 --- a/cpp/include/Ice/Const.h +++ /dev/null @@ -1,34 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003 -// ZeroC, Inc. -// Billerica, MA, USA -// -// All Rights Reserved. -// -// Ice is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License version 2 as published by -// the Free Software Foundation. -// -// ********************************************************************** - -#ifndef ICE_CONST_H -#define ICE_CONST_H - -// -// TODO: - switch to C++ compiler macros, since this syntax is compiler -// dependent -// - define an ICE_WIDTH macro (or ICE_32 and ICE_64?) to avoid doing -// the 32 vs 64 bit checks in multiple places. - -#if defined(_WIN32) -# define ICE_INT64_LITERAL(n) n##i64 -#elif defined(__linux__) && defined(i386) || (defined (__sun) && !defined(__sparcv9)) -# define ICE_INT64_LITERAL(n) n##LL -#elif defined (__sun) && defined(__sparcv9) -# define ICE_INT64_LITERAL(n) n##L -#else -# error "Unsupported operating system or platform!" -#endif - -#endif diff --git a/cpp/include/IceSSL/CertificateVerifierOpenSSL.h b/cpp/include/IceSSL/CertificateVerifierOpenSSL.h index f1eec1dadbf..722d1426f19 100644 --- a/cpp/include/IceSSL/CertificateVerifierOpenSSL.h +++ b/cpp/include/IceSSL/CertificateVerifierOpenSSL.h @@ -15,19 +15,10 @@ #ifndef ICE_SSL_CERTIFICATE_VERIFIER_OPENSSL_H #define ICE_SSL_CERTIFICATE_VERIFIER_OPENSSL_H +#include <IceSSL/Config.h> #include <IceSSL/CertificateVerifier.h> #include <openssl/ssl.h> -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif - namespace IceSSL { diff --git a/cpp/include/IceSSL/Config.h b/cpp/include/IceSSL/Config.h new file mode 100644 index 00000000000..2f65d4f0eee --- /dev/null +++ b/cpp/include/IceSSL/Config.h @@ -0,0 +1,29 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + + +#ifndef ICE_SSL_CONFIG_H +#define ICE_SSL_CONFIG_H + +#include <IceUtil/Config.h> + +#ifndef ICE_SSL_API +# ifdef ICE_SSL_API_EXPORTS +# define ICE_SSL_API ICE_DECLSPEC_EXPORT +# else +# define ICE_SSL_API ICE_DECLSPEC_IMPORT +# endif +#endif + +#endif diff --git a/cpp/include/IceSSL/RSACertificateGen.h b/cpp/include/IceSSL/RSACertificateGen.h index c65b767b5c7..b5e86fa422e 100644 --- a/cpp/include/IceSSL/RSACertificateGen.h +++ b/cpp/include/IceSSL/RSACertificateGen.h @@ -16,16 +16,7 @@ #define ICE_SSL_CERTIFICATE_GEN_H #include <IceSSL/RSAKeyPairF.h> - -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif +#include <IceSSL/Config.h> namespace IceSSL { diff --git a/cpp/include/IceSSL/RSAKeyPair.h b/cpp/include/IceSSL/RSAKeyPair.h index 8a18b25e81d..945d0493da7 100644 --- a/cpp/include/IceSSL/RSAKeyPair.h +++ b/cpp/include/IceSSL/RSAKeyPair.h @@ -23,18 +23,10 @@ #include <IceSSL/RSACertificateGenF.h> #include <IceSSL/RSAPrivateKeyF.h> #include <IceSSL/RSAPublicKeyF.h> +#include <IceSSL/Config.h> #include <openssl/ssl.h> -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif namespace IceSSL { diff --git a/cpp/include/IceSSL/RSAKeyPairF.h b/cpp/include/IceSSL/RSAKeyPairF.h index 422ab18ec0f..d750be15ae8 100644 --- a/cpp/include/IceSSL/RSAKeyPairF.h +++ b/cpp/include/IceSSL/RSAKeyPairF.h @@ -16,16 +16,7 @@ #define ICE_SSL_RSA_KEY_PAIR_F_H #include <Ice/Handle.h> - -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif +#include <IceSSL/Config.h> namespace IceSSL { diff --git a/cpp/include/IceSSL/RSAPrivateKey.h b/cpp/include/IceSSL/RSAPrivateKey.h index c87a7394f8a..dc355ce9525 100644 --- a/cpp/include/IceSSL/RSAPrivateKey.h +++ b/cpp/include/IceSSL/RSAPrivateKey.h @@ -19,19 +19,12 @@ #include <Ice/BuiltinSequences.h> +#include <IceSSL/Config.h> #include <IceSSL/RSAPrivateKeyF.h> #include <openssl/ssl.h> -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif + namespace IceSSL { diff --git a/cpp/include/IceSSL/RSAPublicKey.h b/cpp/include/IceSSL/RSAPublicKey.h index c5ec47ca46b..dcec37086fc 100644 --- a/cpp/include/IceSSL/RSAPublicKey.h +++ b/cpp/include/IceSSL/RSAPublicKey.h @@ -19,20 +19,11 @@ #include <Ice/BuiltinSequences.h> +#include <IceSSL/Config.h> #include <IceSSL/RSAPublicKeyF.h> #include <openssl/ssl.h> -#ifdef _WIN32 -# ifdef ICE_SSL_API_EXPORTS -# define ICE_SSL_API __declspec(dllexport) -# else -# define ICE_SSL_API __declspec(dllimport) -# endif -#else -# define ICE_SSL_API /**/ -#endif - namespace IceSSL { diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h index 37973c059c3..f5b1d62220e 100644 --- a/cpp/include/IceUtil/Cond.h +++ b/cpp/include/IceUtil/Cond.h @@ -100,6 +100,10 @@ public: template <typename Lock> inline void wait(const Lock& lock) const { + if (!lock.acquired()) + { + throw ThreadLockedException(__FILE__, __LINE__); + } waitImpl(lock._mutex); } @@ -113,6 +117,10 @@ public: template <typename Lock> inline bool timedWait(const Lock& lock, const Time& timeout) const { + if (!lock.acquired()) + { + throw ThreadLockedException(__FILE__, __LINE__); + } return timedWaitImpl(lock._mutex, timeout); } diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 0e2a07026da..b67de990c41 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -17,13 +17,49 @@ // -// Endianness: define ICE_UTIL_BIGENDIAN on big endian platforms, -// nothing on little endian platforms. +// Endianness +// Most CPUs support only one endianness, with the notable exceptions +// of Itanium (IA64) and MIPS. +// +#if defined(__i386) || defined(_M_IX86) +# define ICE_LITTLE_ENDIAN +#elif defined(__sparc) +# define ICE_BIG_ENDIAN +#else +# error "Unknown architecture" +#endif -#if defined(__sparc) -#define ICE_UTIL_BIGENDIAN +// +// 32 or 64 bit mode? +// +#if (defined(__sun) && defined(__sparcv9)) +# define ICE_64 +#else +# define ICE_32 #endif +// +// Compiler extensions to export and import symbols: see the documentation +// for Visual C++ and HP aC++. +// +// TODO: more macros to support IBM Visual Age _Export syntax as well. +// +#ifdef _MSC_VER +# define ICE_DECLSPEC_EXPORT __declspec(dllexport) +# define ICE_DECLSPEC_IMPORT __declspec(dllimport) +#else +# define ICE_DECLSPEC_EXPORT /**/ +# define ICE_DECLSPEC_IMPORT /**/ +#endif + +// +// Let's use these extensions with for IceUtil: +// +#ifdef ICE_UTIL_API_EXPORTS +# define ICE_UTIL_API ICE_DECLSPEC_EXPORT +#else +# define ICE_UTIL_API ICE_DECLSPEC_IMPORT +#endif // // For STLport. If we compile in debug mode, we want to use the debug @@ -47,12 +83,6 @@ # error "Only multi-threaded DLL libraries can be used with Ice!" # endif -# ifdef ICE_UTIL_API_EXPORTS -# define ICE_UTIL_API __declspec(dllexport) -# else -# define ICE_UTIL_API __declspec(dllimport) -# endif - # include <windows.h> // '...' : forcing value to bool 'true' or 'false' (performance warning) @@ -70,14 +100,9 @@ // ...: decorated name length exceeded, name was truncated # pragma warning( disable : 4503 ) -# define SIZEOF_WCHAR_T 2 - -#elif (defined(__linux) || defined(__FreeBSD__)) && defined(__i386) - -# define ICE_UTIL_API /**/ -# define HAVE_READLINE -# define SIZEOF_WCHAR_T 4 - +#elif defined(__sun) && defined(__sparc) +# include <inttypes.h> +#else // // The ISO C99 standard specifies that in C++ implementations the // macros for minimum/maximum integer values should only be defined if @@ -85,20 +110,8 @@ // # define __STDC_LIMIT_MACROS # include <stdint.h> - -#elif defined(__sun) && defined(__sparc) - -# define ICE_UTIL_API /**/ -# define SIZEOF_WCHAR_T 4 -# include <inttypes.h> - -#else - -# error "unsupported operating system or platform" - #endif - // // Some include files we need almost everywhere. // @@ -139,32 +152,37 @@ private: // // Some definitions for 64-bit integers. // -#if defined(_WIN32) - +#if defined(_MSC_VER) typedef __int64 Int64; const Int64 Int64Min = -9223372036854775808i64; const Int64 Int64Max = 9223372036854775807i64; -# define ICE_INT64(x) Int64(x##i64) +#elif defined(__SUNPRO_CC) +# if defined(ICE_64) +typedef long Int64; +const Int64 Int64Min = -0x7fffffffffffffffL-1L; +const Int64 Int64Max = 0x7fffffffffffffffL; +# else +typedef long long Int64; +const Int64 Int64Min = -0x7fffffffffffffffLL-1LL; +const Int64 Int64Max = 0x7fffffffffffffffLL; +# endif #else - -# if defined(INT64_MIN) && defined(INT64_MAX) - +// Assumes ISO C99 types +// typedef int64_t Int64; const Int64 Int64Min = INT64_MIN; const Int64 Int64Max = INT64_MAX; -# else - -typedef long long Int64; -const Int64 Int64Min = -0x7fffffffffffffffLL-1LL; -const Int64 Int64Max = 0x7fffffffffffffffLL; - -# endif - -#define ICE_INT64(x) Int64(x##LL) +#endif +#if defined(_MSC_VER) +# define ICE_INT64(n) n##i64 +#elif defined(ICE_64) +# define ICE_INT64(n) n##L +#else +# define ICE_INT64(n) n##LL #endif } diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index aae20dc017a..7666f999dbd 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -17,19 +17,10 @@ #include <IceUtil/Config.h> -// -// The inline assembler causes problems with shared libraries. -// -#if (defined(__ICC) && !defined(_WIN32)) || defined (__sun) -# define ICE_USE_MUTEX_SHARED -#endif - -#ifdef ICE_USE_MUTEX_SHARED -# include <IceUtil/Mutex.h> -#endif - -#if !defined(_WIN32) && !defined(ICE_USE_MUTEX_SHARED) +#if (defined(__linux) || defined(__FreeBSD__)) && defined(__i386) && !defined(__ICC) +# define ICE_HAS_ATOMIC_FUNCTIONS +// __ICC: The inline assembler causes problems with shared libraries. // // Linux only. Unfortunately, asm/atomic.h builds non-SMP safe code // with non-SMP kernels. This means that executables compiled with a @@ -116,6 +107,11 @@ inline int ice_atomic_exchange_add(int i, ice_atomic_t* v) return tmp + i; } +#elif defined(_WIN32) +// Nothing to include +#else +// Use a simple mutex +# include <IceUtil/Mutex.h> #endif // @@ -203,13 +199,13 @@ public: private: -#ifdef ICE_USE_MUTEX_SHARED - int _ref; - Mutex _mutex; -#elif defined(_WIN32) +#if defined(_WIN32) LONG _ref; -#else +#elif defined(ICE_HAS_ATOMIC_FUNCTIONS) ice_atomic_t _ref; +#else + int _ref; + Mutex _mutex; #endif bool _noDelete; }; @@ -219,7 +215,7 @@ private: // all of them should be inlined. // -#ifdef ICE_USE_MUTEX_SHARED +#if defined(_WIN32) inline Shared::Shared() : @@ -236,26 +232,17 @@ Shared::~Shared() inline void Shared::__incRef() { - _mutex.lock(); - assert(_ref >= 0); - ++_ref; - _mutex.unlock(); + assert(InterlockedExchangeAdd(&_ref, 0) >= 0); + InterlockedIncrement(&_ref); } inline void Shared::__decRef() { - _mutex.lock(); - bool doDelete = false; - assert(_ref > 0); - if(--_ref == 0) + assert(InterlockedExchangeAdd(&_ref, 0) > 0); + if(InterlockedDecrement(&_ref) == 0 && !_noDelete) { - doDelete = !_noDelete; _noDelete = true; - } - _mutex.unlock(); - if(doDelete) - { delete this; } } @@ -263,27 +250,22 @@ Shared::__decRef() inline int Shared::__getRef() const { - _mutex.lock(); - int ref = _ref; - _mutex.unlock(); - return ref; + return InterlockedExchangeAdd(const_cast<LONG*>(&_ref), 0); } inline void Shared::__setNoDelete(bool b) { - _mutex.lock(); _noDelete = b; - _mutex.unlock(); } -#elif defined(_WIN32) +#elif defined(ICE_HAS_ATOMIC_FUNCTIONS) inline Shared::Shared() : - _ref(0), _noDelete(false) { + ice_atomic_set(&_ref, 0); } inline @@ -294,15 +276,15 @@ Shared::~Shared() inline void Shared::__incRef() { - assert(InterlockedExchangeAdd(&_ref, 0) >= 0); - InterlockedIncrement(&_ref); + assert(ice_atomic_exchange_add(0, &_ref) >= 0); + ice_atomic_inc(&_ref); } inline void Shared::__decRef() { - assert(InterlockedExchangeAdd(&_ref, 0) > 0); - if(InterlockedDecrement(&_ref) == 0 && !_noDelete) + assert(ice_atomic_exchange_add(0, &_ref) > 0); + if(ice_atomic_dec_and_test(&_ref) && !_noDelete) { _noDelete = true; delete this; @@ -312,7 +294,7 @@ Shared::__decRef() inline int Shared::__getRef() const { - return InterlockedExchangeAdd(const_cast<LONG*>(&_ref), 0); + return ice_atomic_exchange_add(0, const_cast<ice_atomic_t*>(&_ref)); } inline void @@ -325,9 +307,9 @@ Shared::__setNoDelete(bool b) inline Shared::Shared() : + _ref(0), _noDelete(false) { - ice_atomic_set(&_ref, 0); } inline @@ -338,17 +320,26 @@ Shared::~Shared() inline void Shared::__incRef() { - assert(ice_atomic_exchange_add(0, &_ref) >= 0); - ice_atomic_inc(&_ref); + _mutex.lock(); + assert(_ref >= 0); + ++_ref; + _mutex.unlock(); } inline void Shared::__decRef() { - assert(ice_atomic_exchange_add(0, &_ref) > 0); - if(ice_atomic_dec_and_test(&_ref) && !_noDelete) + _mutex.lock(); + bool doDelete = false; + assert(_ref > 0); + if(--_ref == 0) { + doDelete = !_noDelete; _noDelete = true; + } + _mutex.unlock(); + if(doDelete) + { delete this; } } @@ -356,17 +347,21 @@ Shared::__decRef() inline int Shared::__getRef() const { - return ice_atomic_exchange_add(0, const_cast<ice_atomic_t*>(&_ref)); + _mutex.lock(); + int ref = _ref; + _mutex.unlock(); + return ref; } inline void Shared::__setNoDelete(bool b) { + _mutex.lock(); _noDelete = b; + _mutex.unlock(); } #endif } - #endif diff --git a/cpp/include/IceXML/StreamI.h b/cpp/include/IceXML/StreamI.h index 7a5a7d7b324..e5144993486 100644 --- a/cpp/include/IceXML/StreamI.h +++ b/cpp/include/IceXML/StreamI.h @@ -21,14 +21,12 @@ #include <map> -#ifdef _WIN32 +#ifndef ICE_XML_API # ifdef ICE_XML_API_EXPORTS -# define ICE_XML_API __declspec(dllexport) +# define ICE_XML_API ICE_DECLSPEC_EXPORT # else -# define ICE_XML_API __declspec(dllimport) +# define ICE_XML_API ICE_DECLSPEC_IMPORT # endif -#else -# define ICE_XML_API /**/ #endif namespace IceXML diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index 858a4efdbc3..ec7bee1a22d 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -25,14 +25,12 @@ #include <map> #include <set> -#ifdef _WIN32 +#ifndef SLICE_API # ifdef SLICE_API_EXPORTS -# define SLICE_API __declspec(dllexport) +# define SLICE_API ICE_DECLSPEC_EXPORT # else -# define SLICE_API __declspec(dllimport) +# define SLICE_API ICE_DECLSPEC_IMPORT # endif -#else -# define SLICE_API /**/ #endif namespace Slice diff --git a/cpp/include/Slice/Preprocessor.h b/cpp/include/Slice/Preprocessor.h index 7d26926189a..273c31f3d49 100644 --- a/cpp/include/Slice/Preprocessor.h +++ b/cpp/include/Slice/Preprocessor.h @@ -17,14 +17,12 @@ #include <IceUtil/Config.h> -#ifdef _WIN32 +#ifndef SLICE_API # ifdef SLICE_API_EXPORTS -# define SLICE_API __declspec(dllexport) +# define SLICE_API ICE_DECLSPEC_EXPORT # else -# define SLICE_API __declspec(dllimport) +# define SLICE_API ICE_DECLSPEC_IMPORT # endif -#else -# define SLICE_API /**/ #endif namespace Slice diff --git a/cpp/include/XMLTransform/XMLTransform.h b/cpp/include/XMLTransform/XMLTransform.h index 4042c1a0496..8c79b291aa2 100644 --- a/cpp/include/XMLTransform/XMLTransform.h +++ b/cpp/include/XMLTransform/XMLTransform.h @@ -23,14 +23,12 @@ #include <map> -#ifdef WIN32 +#ifndef XML_TRANSFORM_API # ifdef XML_TRANSFORM_API_EXPORTS -# define XML_TRANSFORM_API __declspec(dllexport) +# define XML_TRANSFORM_API ICE_DECLSPEC_EXPORT # else -# define XML_TRANSFORM_API __declspec(dllimport) +# define XML_TRANSFORM_API ICE_DECLSPEC_IMPORT # endif -#else -# define XML_TRANSFORM_API /**/ #endif namespace XMLTransform diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 8c3b7b72869..c9956a43bb1 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -137,7 +137,7 @@ IceInternal::BasicStream::endWriteEncaps() } Int sz = b.size() - start + sizeof(Int) + 2; // Size includes size and version const Byte* p = reinterpret_cast<const Byte*>(&sz); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), b.begin() + start - sizeof(Int) - 2); // - 2 for major and minor version byte #else ice_copy(p, p + sizeof(Int), b.begin() + start - sizeof(Int) - 2); // - 2 for major and minor version byte @@ -429,7 +429,7 @@ IceInternal::BasicStream::write(Short v) int pos = b.size(); inlineResize(this, pos + sizeof(Short)); const Byte* p = reinterpret_cast<const Byte*>(&v); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Short), b.begin() + pos); #else ice_copy(p, p + sizeof(Short), b.begin() + pos); @@ -446,7 +446,7 @@ IceInternal::BasicStream::write(const vector<Short>& v) int pos = b.size(); inlineResize(this, pos + sz * sizeof(Short)); const Byte* p = reinterpret_cast<const Byte*>(&v[0]); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(p, p + sizeof(Short), b.begin() + pos); @@ -468,7 +468,7 @@ IceInternal::BasicStream::read(Short& v) } Container::iterator begin = i; i += sizeof(Short); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(begin, i, reinterpret_cast<Byte*>(&v)); #else ice_copy(begin, i, reinterpret_cast<Byte*>(&v)); @@ -490,7 +490,7 @@ IceInternal::BasicStream::read(vector<Short>& v) v.resize(sz); if(sz > 0) { -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(begin, begin + sizeof(Short), reinterpret_cast<Byte*>(&v[j])); @@ -508,7 +508,7 @@ IceInternal::BasicStream::write(Int v) int pos = b.size(); inlineResize(this, pos + sizeof(Int)); const Byte* p = reinterpret_cast<const Byte*>(&v); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), b.begin() + pos); #else ice_copy(p, p + sizeof(Int), b.begin() + pos); @@ -525,7 +525,7 @@ IceInternal::BasicStream::write(const vector<Int>& v) int pos = b.size(); inlineResize(this, pos + sz * sizeof(Int)); const Byte* p = reinterpret_cast<const Byte*>(&v[0]); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(p, p + sizeof(Int), b.begin() + pos); @@ -547,7 +547,7 @@ IceInternal::BasicStream::read(Int& v) } Container::iterator begin = i; i += sizeof(Int); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(begin, i, reinterpret_cast<Byte*>(&v)); #else ice_copy(begin, i, reinterpret_cast<Byte*>(&v)); @@ -569,7 +569,7 @@ IceInternal::BasicStream::read(vector<Int>& v) v.resize(sz); if(sz > 0) { -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(begin, begin + sizeof(Int), reinterpret_cast<Byte*>(&v[j])); @@ -587,7 +587,7 @@ IceInternal::BasicStream::write(Long v) int pos = b.size(); inlineResize(this, pos + sizeof(Long)); const Byte* p = reinterpret_cast<const Byte*>(&v); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Long), b.begin() + pos); #else ice_copy(p, p + sizeof(Long), b.begin() + pos); @@ -604,7 +604,7 @@ IceInternal::BasicStream::write(const vector<Long>& v) int pos = b.size(); inlineResize(this, pos + sz * sizeof(Long)); const Byte* p = reinterpret_cast<const Byte*>(&v[0]); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(p, p + sizeof(Long), b.begin() + pos); @@ -626,7 +626,7 @@ IceInternal::BasicStream::read(Long& v) } Container::iterator begin = i; i += sizeof(Long); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(begin, i, reinterpret_cast<Byte*>(&v)); #else ice_copy(begin, i, reinterpret_cast<Byte*>(&v)); @@ -648,7 +648,7 @@ IceInternal::BasicStream::read(vector<Long>& v) v.resize(sz); if(sz > 0) { -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(begin, begin + sizeof(Long), reinterpret_cast<Byte*>(&v[j])); @@ -666,7 +666,7 @@ IceInternal::BasicStream::write(Float v) int pos = b.size(); inlineResize(this, pos + sizeof(Float)); const Byte* p = reinterpret_cast<const Byte*>(&v); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Float), b.begin() + pos); #else ice_copy(p, p + sizeof(Float), b.begin() + pos); @@ -683,7 +683,7 @@ IceInternal::BasicStream::write(const vector<Float>& v) int pos = b.size(); inlineResize(this, pos + sz * sizeof(Float)); const Byte* p = reinterpret_cast<const Byte*>(&v[0]); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(p, p + sizeof(Float), b.begin() + pos); @@ -705,7 +705,7 @@ IceInternal::BasicStream::read(Float& v) } Container::iterator begin = i; i += sizeof(Float); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(begin, i, reinterpret_cast<Byte*>(&v)); #else ice_copy(begin, i, reinterpret_cast<Byte*>(&v)); @@ -727,7 +727,7 @@ IceInternal::BasicStream::read(vector<Float>& v) v.resize(sz); if(sz > 0) { -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(begin, begin + sizeof(Float), reinterpret_cast<Byte*>(&v[j])); @@ -745,7 +745,7 @@ IceInternal::BasicStream::write(Double v) int pos = b.size(); inlineResize(this, pos + sizeof(Double)); const Byte* p = reinterpret_cast<const Byte*>(&v); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Double), b.begin() + pos); #else ice_copy(p, p + sizeof(Double), b.begin() + pos); @@ -762,7 +762,7 @@ IceInternal::BasicStream::write(const vector<Double>& v) int pos = b.size(); inlineResize(this, pos + sz * sizeof(Double)); const Byte* p = reinterpret_cast<const Byte*>(&v[0]); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(p, p + sizeof(Double), b.begin() + pos); @@ -784,7 +784,7 @@ IceInternal::BasicStream::read(Double& v) } Container::iterator begin = i; i += sizeof(Double); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(begin, i, reinterpret_cast<Byte*>(&v)); #else ice_copy(begin, i, reinterpret_cast<Byte*>(&v)); @@ -806,7 +806,7 @@ IceInternal::BasicStream::read(vector<Double>& v) v.resize(sz); if(sz > 0) { -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN for(int j = 0 ; j < sz ; ++j) { reverse_copy(begin, begin + sizeof(Double), reinterpret_cast<Byte*>(&v[j])); diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp index a4a0eb67ef8..e14ecf34294 100644 --- a/cpp/src/Ice/Connection.cpp +++ b/cpp/src/Ice/Connection.cpp @@ -391,7 +391,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway) } const Byte* p; p = reinterpret_cast<const Byte*>(&requestId); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize); #else copy(p, p + sizeof(Int), os->b.begin() + headerSize); @@ -437,7 +437,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway) const Byte* p; Int sz = os->b.size(); p = reinterpret_cast<const Byte*>(&sz); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + 10); #else copy(p, p + sizeof(Int), os->b.begin() + 10); @@ -501,7 +501,7 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out) const Byte* p; p = reinterpret_cast<const Byte*>(&requestId); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + headerSize); #else copy(p, p + sizeof(Int), os->b.begin() + headerSize); @@ -546,7 +546,7 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out) const Byte* p; Int sz = os->b.size(); p = reinterpret_cast<const Byte*>(&sz); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + 10); #else copy(p, p + sizeof(Int), os->b.begin() + 10); @@ -659,7 +659,7 @@ IceInternal::Connection::flushBatchRequest() const Byte* p; p = reinterpret_cast<const Byte*>(&_batchRequestNum); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); #else copy(p, p + sizeof(Int), _batchStream.b.begin() + headerSize); @@ -705,7 +705,7 @@ IceInternal::Connection::flushBatchRequest() Int sz = _batchStream.b.size(); p = reinterpret_cast<const Byte*>(&sz); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), _batchStream.b.begin() + 10); #else copy(p, p + sizeof(Int), _batchStream.b.begin() + 10); @@ -797,7 +797,7 @@ IceInternal::Connection::sendResponse(BasicStream* os, Byte compressFlag) Int sz = os->b.size(); p = reinterpret_cast<const Byte*>(&sz); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), os->b.begin() + 10); #else copy(p, p + sizeof(Int), os->b.begin() + 10); @@ -1698,7 +1698,7 @@ IceInternal::Connection::doCompress(BasicStream& uncompressed, BasicStream& comp Int compressedSize = compressed.b.size(); p = reinterpret_cast<const Byte*>(&compressedSize); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), uncompressed.b.begin() + 10); #else copy(p, p + sizeof(Int), uncompressed.b.begin() + 10); @@ -1710,7 +1710,7 @@ IceInternal::Connection::doCompress(BasicStream& uncompressed, BasicStream& comp Int uncompressedSize = uncompressed.b.size(); p = reinterpret_cast<const Byte*>(&uncompressedSize); -#ifdef ICE_UTIL_BIGENDIAN +#ifdef ICE_BIG_ENDIAN reverse_copy(p, p + sizeof(Int), compressed.b.begin() + headerSize); #else copy(p, p + sizeof(Int), compressed.b.begin() + headerSize); diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile index f7d4c33e9be..e089972fe57 100644 --- a/cpp/src/IcePack/Makefile +++ b/cpp/src/IcePack/Makefile @@ -96,7 +96,7 @@ SLICE2FREEZECMD = $(SLICE2FREEZE) --ice --include-dir IcePack $(ICECPPFLAGS) include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I.. $(CPPFLAGS) $(XERCESC_FLAGS) +CPPFLAGS := -I.. $(CPPFLAGS) $(READLINE_FLAGS) $(XERCESC_FLAGS) ICECPPFLAGS := -I.. $(ICECPPFLAGS) SLICE2CPPFLAGS := --ice --include-dir IcePack --dll-export ICE_PACK_API $(SLICE2CPPFLAGS) diff --git a/cpp/src/IceSSL/ConfigParser.h b/cpp/src/IceSSL/ConfigParser.h index 86ee95f3bcc..e92e5596494 100644 --- a/cpp/src/IceSSL/ConfigParser.h +++ b/cpp/src/IceSSL/ConfigParser.h @@ -12,8 +12,8 @@ // // ********************************************************************** -#ifndef ICE_SSL_CONFIG_H -#define ICE_SSL_CONFIG_H +#ifndef ICE_SSL_CONFIG_PARSER_H +#define ICE_SSL_CONFIG_PARSER_H #include <Ice/LoggerF.h> #include <IceSSL/CertificateDesc.h> diff --git a/cpp/src/IceStorm/Makefile b/cpp/src/IceStorm/Makefile index 8a182ca4ec0..08b5c93c10f 100644 --- a/cpp/src/IceStorm/Makefile +++ b/cpp/src/IceStorm/Makefile @@ -64,7 +64,7 @@ SLICE2FREEZECMD = $(SLICE2FREEZE) --ice --include-dir IceStorm $(ICECPPFLAGS) include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I.. $(XERCESC_FLAGS) $(CPPFLAGS) +CPPFLAGS := -I.. $(XERCESC_FLAGS) $(READLINE_FLAGS) $(CPPFLAGS) ICECPPFLAGS := -I.. $(ICECPPFLAGS) SLICE2CPPFLAGS := --ice --include-dir IceStorm $(SLICE2CPPFLAGS) diff --git a/cpp/src/IceUtil/Unicode.cpp b/cpp/src/IceUtil/Unicode.cpp index d02e394dc2a..4a7537a1308 100644 --- a/cpp/src/IceUtil/Unicode.cpp +++ b/cpp/src/IceUtil/Unicode.cpp @@ -15,6 +15,13 @@ #include <IceUtil/Unicode.h> #include <algorithm> +#if defined(_WIN32) +# define SIZEOF_WCHAR_T 2 +#elif (defined(__sun) && defined(__sparc)) || \ + ((defined(__linux) || defined(__FreeBSD__)) && defined (__i386)) +# define SIZEOF_WCHAR_T 4 +#endif + using namespace std; string diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 1baee9853e6..2b3834ac072 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -101,14 +101,12 @@ Slice::printDllExportStuff(Output& out, const string& dllExport) if(dllExport.size()) { out << sp; - out << "\n#ifdef _WIN32"; + out << "\n#ifndef " << dllExport; out << "\n# ifdef " << dllExport << "_EXPORTS"; - out << "\n# define " << dllExport << " __declspec(dllexport)"; + out << "\n# define " << dllExport << " ICE_DECLSPEC_EXPORT"; out << "\n# else"; - out << "\n# define " << dllExport << " __declspec(dllimport)"; + out << "\n# define " << dllExport << " ICE_DECLSPEC_IMPORT"; out << "\n# endif"; - out << "\n#else"; - out << "\n# define " << dllExport << " /**/"; out << "\n#endif"; } } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 665ec5e59f5..023ae1ead0d 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -211,11 +211,6 @@ Slice::Gen::generate(const UnitPtr& unit) H << "\n#include <Ice/LocalObject.h>"; } - if(unit->usesConsts()) - { - H << "\n#include <Ice/Const.h>"; - } - StringList includes = unit->includeFiles(); for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q) { @@ -1002,7 +997,7 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) } else if(bp && bp->kind() == Builtin::KindLong) { - H << "ICE_INT64_LITERAL(" << p->value() << ")"; + H << "ICE_INT64(" << p->value() << ")"; } else { diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index ba04554b6cb..bc9d3caeac5 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -24,9 +24,12 @@ using namespace std; using namespace Ice; using namespace Freeze; -// The following variable is extern instead of static due to -// a Sun C++ 5.4 template bug -extern Byte alphabetChars[] = "abcdefghijklmnopqrstuvwxyz"; +#ifdef __SUNPRO_CC +extern +#else +static +#endif +Byte alphabetChars[] = "abcdefghijklmnopqrstuvwxyz"; vector<Byte> alphabet; |