ICU-84 S/390 DLL code update.

X-SVN-Rev: 937
This commit is contained in:
Helena Chapman 2000-03-10 01:52:03 +00:00
parent fdf872dd09
commit a24534df38
4 changed files with 69 additions and 60 deletions

View File

@ -1002,10 +1002,6 @@ u_getDataDirectory(void) {
/* puts(__environ[i]); */ /* puts(__environ[i]); */
/* } */ /* } */
# endif # endif
#ifdef OS390BATCH
path = "DD:ICUDATA";
#endif
# ifdef WIN32 # ifdef WIN32
/* next, try to read the path from the registry */ /* next, try to read the path from the registry */
if(path==NULL || *path==0) { if(path==NULL || *path==0) {
@ -1365,7 +1361,7 @@ const char* uprv_getDefaultCodepage()
#if defined(OS400) #if defined(OS400)
return "ibm-37"; return "ibm-37";
#elif defined(OS390) #elif defined(OS390)
return "ibm-1047"; return "ibm-37-s390";
#elif defined(XP_MAC) #elif defined(XP_MAC)
/* TBD */ /* TBD */
#elif defined(WIN32) #elif defined(WIN32)

View File

@ -34,6 +34,11 @@
#define COMMON_DATA_NAME_LENGTH 7 #define COMMON_DATA_NAME_LENGTH 7
#define DATA_TYPE "dat" #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 * static UDataMemory *
doOpenChoice(const char *path, const char *type, const char *name, doOpenChoice(const char *path, const char *type, const char *name,
UDataMemoryIsAcceptable *isAcceptable, void *context, UDataMemoryIsAcceptable *isAcceptable, void *context,
@ -223,7 +228,7 @@ udata_close(UDataMemory *pData) {
/* POSIX implementations ---------------------------------------------------- */ /* 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 .. */ /* If you are excruciatingly bored turn this on .. */
/* #define UDATA_DEBUG 1 */ /* #define UDATA_DEBUG 1 */
@ -257,7 +262,7 @@ struct UDataMemory {
#if defined(ICU_USE_SHL_LOAD) #if defined(ICU_USE_SHL_LOAD)
#if !defined(OS390)
# include <dl.h> # include <dl.h>
/* HPUX compatibility stubs: shl_load, etc.. */ /* HPUX compatibility stubs: shl_load, etc.. */
#define RTLD_LAZY 0 #define RTLD_LAZY 0
@ -311,13 +316,60 @@ int dlclose (void *handle)
return shl_unload((shl_t)handle); return shl_unload((shl_t)handle);
} }
#elif defined(OS390) /* OS390 */
#include <dll.h>
#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 #else
/* 'de facto standard' dlopen etc */ /* 'de facto standard' dlopen etc */
# include <dlfcn.h> # include <dlfcn.h>
#endif #endif
#endif
typedef void *Library; typedef void *Library;
@ -711,11 +763,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
MappedData *p; MappedData *p;
UErrorCode errorCode=U_ZERO_ERROR; UErrorCode errorCode=U_ZERO_ERROR;
#ifdef OS390BATCH
/* Try DD:ICUDATA first */
char *c;
char tmpPathName[23];
#endif
/* set up path and basename */ /* set up path and basename */
if(path==NULL) { if(path==NULL) {
isICUData=TRUE; isICUData=TRUE;
@ -838,43 +885,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
/* try the common data first */ /* try the common data first */
p=NULL; 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 # ifdef UDATA_INDIRECT
if(hasBasename) { if(hasBasename) {
/* get the common data */ /* get the common data */
@ -889,7 +899,11 @@ doOpenChoice(const char *path, const char *type, const char *name,
if(!IS_LIBRARY(lib)) { if(!IS_LIBRARY(lib)) {
/* try path/basename first */ /* try path/basename first */
uprv_strcpy(suffix, LIB_SUFFIX); 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); lib=LOAD_LIBRARY(path, basename, TRUE);
#endif
if(!IS_LIBRARY(lib)) { if(!IS_LIBRARY(lib)) {
/* try basename only next */ /* try basename only next */
lib=LOAD_LIBRARY(basename, basename, TRUE); lib=LOAD_LIBRARY(basename, basename, TRUE);
@ -931,9 +945,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
} }
# endif # endif
#ifdef OS390BATCH
}
#endif
/* if the data is not found in the common data, then look for a separate library */ /* if the data is not found in the common data, then look for a separate library */
/* try basename+"_"+entryName[+LIB_SUFFIX] first */ /* try basename+"_"+entryName[+LIB_SUFFIX] first */

View File

@ -26,12 +26,12 @@ else
ICU_IEEE = ICU_IEEE =
endif 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 ## OS390BATCH
ifeq (${OS390BATCH},1) 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 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 endif
ARFLAGS= -cr ARFLAGS= -cr
@ -77,9 +77,6 @@ LIBICU-TOOLUTIL=$(top_builddir)/tools/toolutil/libicu-toolutil.x
%.o :$(srcdir)/%.cpp %.o :$(srcdir)/%.cpp
$(COMPILE.cc) -o $@ $< $(COMPILE.cc) -o $@ $<
../data/%.o : ../data/%.c
$(COMPILE.c) -o $@ $<
## Dependency rules ## Dependency rules
%.d : %.u %.d : %.u
@$(SHELL) -ec 'cat $< \ @$(SHELL) -ec 'cat $< \

View File

@ -141,7 +141,12 @@ int main(int argc, char *argv[]) {
const int32_t gentz::MAX_GMT_OFFSET = (int32_t)24*60*60; // seconds const int32_t gentz::MAX_GMT_OFFSET = (int32_t)24*60*60; // seconds
const char gentz::COMMENT = '#'; const char gentz::COMMENT = '#';
const char gentz::CR = ((char)13); 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); const char gentz::LF = ((char)10);
#endif
const char gentz::MINUS = '-'; const char gentz::MINUS = '-';
const char gentz::SPACE = ' '; const char gentz::SPACE = ' ';
const char gentz::TAB = ((char)9); const char gentz::TAB = ((char)9);
@ -482,7 +487,7 @@ void gentz::parseDSTRule(char*& p, TZRule& rule) {
if (*p++ != SEP) { if (*p++ != SEP) {
die("Separator missing"); die("Separator missing");
} }
switch (rule.mode) { switch ((char)rule.mode) {
case 'w': case 'w':
rule.mode = WALL_TIME; rule.mode = WALL_TIME;
break; break;