From d7677e935d836ce91e64af89e78d0c0345a49b7d Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 18 Jul 2007 16:47:05 -0400 Subject: Added new WindowsStringConverter --- cpp/test/Ice/Makefile.mak | 2 -- cpp/test/Ice/stringConverter/Client.cpp | 27 +++++++++++++++++++++++---- cpp/test/Ice/stringConverter/Makefile.mak | 8 ++++++-- 3 files changed, 29 insertions(+), 8 deletions(-) (limited to 'cpp/test') diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak index 77888312c28..dfe04be6621 100644 --- a/cpp/test/Ice/Makefile.mak +++ b/cpp/test/Ice/Makefile.mak @@ -32,9 +32,7 @@ SUBDIRS = proxy \ servantLocator \ threads \ interceptor \ -!if "$(ICONV_HOME)" != "" stringConverter -!endif $(EVERYTHING):: @for %i in ( $(SUBDIRS) ) do \ diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index 795535d6ece..8186e64151e 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -10,7 +10,14 @@ #include #include #include + +#if defined(ICONV_ON_WINDOWS) +// +// On Windows, Ice/IcongStringConverter.h is not included by Ice/Ice.h +// #include +#endif + #include #include @@ -49,26 +56,34 @@ public: }; static bool useLocale = false; +static bool useIconv = true; int main(int argc, char* argv[]) { Client app; +#ifndef _WIN32 // // Switch to French locale // (we just used the codeset for as default internal code for // initData.stringConverter below) // - -#ifndef _WIN32 + useLocale = (setlocale(LC_ALL, "fr_FR.ISO8859-15") != 0 || setlocale(LC_ALL, "fr_FR.iso885915@euro") != 0); #endif Ice::InitializationData initData; -#if defined(__hpux) +#if defined(_WIN32) && !defined(ICONV_ON_WINDOWS) + // + // 28605 == ISO 8859-15 codepage + // + initData.stringConverter = new Ice::WindowsStringConverter(28605); + useIconv = false; + +#elif defined(__hpux) if(useLocale) { initData.stringConverter = new Ice::IconvStringConverter; @@ -132,11 +147,15 @@ Client::run(int, char*[]) char oe = char(0xBD); // A single character in ISO Latin 9 string msg = string("tu me fends le c") + oe + "ur!"; - cout << "testing iconv string converter"; + cout << "testing string converter"; if(useLocale) { cout << " (using locale)"; } + if(useIconv) + { + cout << " (using iconv)"; + } cout << "..." << flush; wstring wmsg = clientPrx->widen(msg); test(clientPrx->narrow(wmsg) == msg); diff --git a/cpp/test/Ice/stringConverter/Makefile.mak b/cpp/test/Ice/stringConverter/Makefile.mak index adf6d97b850..5b266e2c656 100755 --- a/cpp/test/Ice/stringConverter/Makefile.mak +++ b/cpp/test/Ice/stringConverter/Makefile.mak @@ -19,14 +19,18 @@ SRCS = $(OBJS:.obj=.cpp) !include $(top_srcdir)/config/Make.rules.mak -CPPFLAGS = -I. -I../../include -I$(ICONV_HOME)/include $(CPPFLAGS) -DICE_NO_ERRNO -DWIN32_LEAN_AND_MEAN +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN +!if "$(ICONV_HOME)" != "" +CPPFLAGS = $(CPPFLAGS) -I$(ICONV_HOME)\include -DICONV_ON_WINDOWS -DICE_NO_ERRNO +LIBS = $(LIBS) -LIBPATH:$(ICONV_HOME)\lib $(ICONV_LIB) +!endif !if "$(CPP_COMPILER)" != "BCC2006" && "$(OPTIMIZE)" != "yes" PDBFLAGS = /pdb:$(CLIENT:.exe=.pdb) !endif $(CLIENT): $(OBJS) - $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(SETARGV) $(OBJS) $(PREOUT)$@ $(PRELIBS)$(LIBNAME) $(LIBS) /LIBPATH:$(ICONV_HOME)\lib $(ICONV_LIB) + $(LINK) $(LD_EXEFLAGS) $(PDBFLAGS) $(SETARGV) $(OBJS) $(PREOUT)$@ $(PRELIBS)$(LIBNAME) $(LIBS) @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest -- cgit v1.2.3