From a24534df382d650e1b6a30f8e3d0f5fd9330d8e1 Mon Sep 17 00:00:00 2001 From: Helena Chapman Date: Fri, 10 Mar 2000 01:52:03 +0000 Subject: [PATCH] ICU-84 S/390 DLL code update. X-SVN-Rev: 937 --- icu4c/source/common/putil.c | 6 +- icu4c/source/common/udata.c | 107 ++++++++++++++++------------- icu4c/source/config/mh-os390 | 9 +-- icu4c/source/tools/gentz/gentz.cpp | 7 +- 4 files changed, 69 insertions(+), 60 deletions(-) diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.c index 22fd25d27e4..8f859d921e5 100644 --- a/icu4c/source/common/putil.c +++ b/icu4c/source/common/putil.c @@ -1002,10 +1002,6 @@ u_getDataDirectory(void) { /* puts(__environ[i]); */ /* } */ # endif -#ifdef OS390BATCH - path = "DD:ICUDATA"; -#endif - # ifdef WIN32 /* next, try to read the path from the registry */ if(path==NULL || *path==0) { @@ -1365,7 +1361,7 @@ const char* uprv_getDefaultCodepage() #if defined(OS400) return "ibm-37"; #elif defined(OS390) - return "ibm-1047"; + return "ibm-37-s390"; #elif defined(XP_MAC) /* TBD */ #elif defined(WIN32) diff --git a/icu4c/source/common/udata.c b/icu4c/source/common/udata.c index 1b9a76814c6..1b5c231586b 100644 --- a/icu4c/source/common/udata.c +++ b/icu4c/source/common/udata.c @@ -34,6 +34,11 @@ #define COMMON_DATA_NAME_LENGTH 7 #define DATA_TYPE "dat" +#ifdef OS390BATCH +/* prefixed with "//" to search MVS first regardless of the POSIX setting */ +#define MVS_COMMON_DATA_NAME "//icudata" +#endif + static UDataMemory * doOpenChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, @@ -223,7 +228,7 @@ udata_close(UDataMemory *pData) { /* POSIX implementations ---------------------------------------------------- */ -#elif defined (LINUX)||defined(POSIX)||defined(SOLARIS)||defined(AIX)||defined(HPUX) +#elif defined (LINUX)||defined(POSIX)||defined(SOLARIS)||defined(AIX)||defined(HPUX)||defined(OS390) /* If you are excruciatingly bored turn this on .. */ /* #define UDATA_DEBUG 1 */ @@ -257,7 +262,7 @@ struct UDataMemory { #if defined(ICU_USE_SHL_LOAD) - +#if !defined(OS390) # include /* HPUX compatibility stubs: shl_load, etc.. */ #define RTLD_LAZY 0 @@ -311,13 +316,60 @@ int dlclose (void *handle) return shl_unload((shl_t)handle); } +#elif defined(OS390) /* OS390 */ + +#include + +#define RTLD_LAZY 0 +#define RTLD_GLOBAL 0 + +void *dlopen (const char *filename, int flag) +{ + dllhandle *handle; + +#ifdef UDATA_DEBUG + fprintf(stderr, "dllload: %s ", filename); +#endif + + handle = dllload(filename); + +#ifdef UDATA_DEBUG + fprintf(stderr, " -> %08X\n", handle ); +#endif + + return handle; +} + +void *dlsym(void *h, const char *symbol) +{ + void *val = 0; + + val = dllqueryvar((dllhandle*)h,symbol); + +#ifdef UDATA_DEBUG + fprintf(stderr, "dllqueryvar(%08X, %s) -> %08X\n", h, + symbol, val); +#endif + + return val; + +} + +int dlclose (void *handle) +{ +#ifdef UDATA_DEBUG + fprintf(stderr, "dllfree: %08X\n", handle); +#endif + + return dllfree((dllhandle*)handle); +} #else /* 'de facto standard' dlopen etc */ # include #endif - +#endif typedef void *Library; @@ -711,11 +763,6 @@ doOpenChoice(const char *path, const char *type, const char *name, MappedData *p; UErrorCode errorCode=U_ZERO_ERROR; -#ifdef OS390BATCH - /* Try DD:ICUDATA first */ - char *c; - char tmpPathName[23]; -#endif /* set up path and basename */ if(path==NULL) { isICUData=TRUE; @@ -838,43 +885,6 @@ doOpenChoice(const char *path, const char *type, const char *name, /* try the common data first */ p=NULL; -#ifdef OS390BATCH - /* - Try DD:ICUDATA first. - */ - uprv_strcpy(tmpPathName, "//DD:ICUDATA("); - /* - Delete the '-' character from the file name. It is not a vaild - charater for a MVS data set name. - We could convert it to '@', but because icu supports 9 character - converter file name(for example, ibm-12712.cnv), it's better to - delete it(member name of a PDS must be <= 8 characters). - */ - c = uprv_strstr(name, "-"); - if (c != NULL) { - uprv_strncat(tmpPathName, name, c-name); - uprv_strcat(tmpPathName, c+1); - } - else - uprv_strcat(tmpPathName, name); - uprv_strcat(tmpPathName, ")"); - lib=LOAD_LIBRARY(tmpPathName, name, FALSE); - - if(IS_LIBRARY(lib)) { - /* look for the entry point */ -# ifdef UDATA_MAP - /* entryName passed as NULL: prevent TOC lookup for single, mapped files */ - p=getChoice(lib, NULL, type, name, isAcceptable, context, &errorCode); -# else - p=getChoice(lib, entryName, type, name, isAcceptable, context, &errorCode); -# endif - if(p==NULL) - UNLOAD_LIBRARY(lib); - } - - if(p==NULL) { - -#endif # ifdef UDATA_INDIRECT if(hasBasename) { /* get the common data */ @@ -889,7 +899,11 @@ doOpenChoice(const char *path, const char *type, const char *name, if(!IS_LIBRARY(lib)) { /* try path/basename first */ uprv_strcpy(suffix, LIB_SUFFIX); +#ifdef OS390BATCH + lib=LOAD_LIBRARY(MVS_COMMON_DATA_NAME, MVS_COMMON_DATA_NAME, TRUE); +# else lib=LOAD_LIBRARY(path, basename, TRUE); +#endif if(!IS_LIBRARY(lib)) { /* try basename only next */ lib=LOAD_LIBRARY(basename, basename, TRUE); @@ -931,9 +945,6 @@ doOpenChoice(const char *path, const char *type, const char *name, } # endif -#ifdef OS390BATCH - } -#endif /* if the data is not found in the common data, then look for a separate library */ /* try basename+"_"+entryName[+LIB_SUFFIX] first */ diff --git a/icu4c/source/config/mh-os390 b/icu4c/source/config/mh-os390 index aa66db1cb8a..47c32d6a2c5 100644 --- a/icu4c/source/config/mh-os390 +++ b/icu4c/source/config/mh-os390 @@ -26,12 +26,12 @@ else ICU_IEEE = endif -CFLAGS390= -Wc,"langlvl(extended),spill(2000)" $(ICU_IEEE) -Wc,dll,expo +CFLAGS390= -Wc,"langlvl(extended),spill(2000)" $(ICU_BUILD_OPTIONS) $(ICU_IEEE) -Wc,dll,expo ## OS390BATCH ifeq (${OS390BATCH},1) -DEFS390= -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -DOS390BATCH -D_SHARE_EXT_VARS +DEFS390= -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -DOS390BATCH -D_SHR_TZNAME -D_SHR_TIMEZONE else -DEFS390= -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -D_SHARE_EXT_VARS +DEFS390= -D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED -D_SHR_TZNAME -D_SHR_TIMEZONE endif ARFLAGS= -cr @@ -77,9 +77,6 @@ LIBICU-TOOLUTIL=$(top_builddir)/tools/toolutil/libicu-toolutil.x %.o :$(srcdir)/%.cpp $(COMPILE.cc) -o $@ $< -../data/%.o : ../data/%.c - $(COMPILE.c) -o $@ $< - ## Dependency rules %.d : %.u @$(SHELL) -ec 'cat $< \ diff --git a/icu4c/source/tools/gentz/gentz.cpp b/icu4c/source/tools/gentz/gentz.cpp index 493b23f7477..7453c1f6b48 100644 --- a/icu4c/source/tools/gentz/gentz.cpp +++ b/icu4c/source/tools/gentz/gentz.cpp @@ -141,7 +141,12 @@ int main(int argc, char *argv[]) { const int32_t gentz::MAX_GMT_OFFSET = (int32_t)24*60*60; // seconds const char gentz::COMMENT = '#'; const char gentz::CR = ((char)13); +// OS390 uses x'15' NL new line for LF +#ifdef OS390 +const char gentz::LF = ((char)21); +#else const char gentz::LF = ((char)10); +#endif const char gentz::MINUS = '-'; const char gentz::SPACE = ' '; const char gentz::TAB = ((char)9); @@ -482,7 +487,7 @@ void gentz::parseDSTRule(char*& p, TZRule& rule) { if (*p++ != SEP) { die("Separator missing"); } - switch (rule.mode) { + switch ((char)rule.mode) { case 'w': rule.mode = WALL_TIME; break;