From: Steven R. Loomis Date: Wed, 21 Sep 2011 20:00:24 +0000 (+0000) Subject: ICU-8784 improve pointer toc code, however still not working on i- document as such... X-Git-Tag: milestone-59-0-1~4497 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e73e4ea280bea265ee19561a34b51f56cd66b70f;p=icu ICU-8784 improve pointer toc code, however still not working on i- document as such for now. X-SVN-Rev: 30702 --- diff --git a/icu4c/readme.html b/icu4c/readme.html index 39e63e1c461..fcfb904cf90 100644 --- a/icu4c/readme.html +++ b/icu4c/readme.html @@ -18,7 +18,7 @@

International Components for Unicode
ICU 49 ReadMe

-

Last updated: 2011-Sep-15
+

Last updated: 2011-Sep-20
Copyright © 1997-2011 International Business Machines Corporation and others. All Rights Reserved.

@@ -1254,7 +1254,7 @@ CHGJOB CCSID(37)
  • Change your current directory to icu/source.
  • Run './runConfigureICU IBMi' (See configuration - note for details).
  • + note for details). Note that --with-data-packaging=archive and setting the --prefix are recommended, building in default (dll) mode is currently not supported.
  • Run 'gmake' to build ICU. (Do not use the -j option)
  • diff --git a/icu4c/source/common/putilimp.h b/icu4c/source/common/putilimp.h index 39f2554c3fc..1e324913c27 100644 --- a/icu4c/source/common/putilimp.h +++ b/icu4c/source/common/putilimp.h @@ -517,7 +517,7 @@ U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symb * Define malloc and related functions * @internal */ -#if defined(OS400) +#if U_PLATFORM == U_PF_OS400 # define uprv_default_malloc(x) _C_TS_malloc(x) # define uprv_default_realloc(x,y) _C_TS_realloc(x,y) # define uprv_default_free(x) _C_TS_free(x) diff --git a/icu4c/source/tools/genccode/genccode.c b/icu4c/source/tools/genccode/genccode.c index 98e9bb33d5e..d489fd5d9c3 100644 --- a/icu4c/source/tools/genccode/genccode.c +++ b/icu4c/source/tools/genccode/genccode.c @@ -57,10 +57,6 @@ #include "uoptions.h" #include "pkg_genc.h" -#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) -#define CAN_GENERATE_OBJECTS -#endif - enum { kOptHelpH = 0, kOptHelpQuestionMark, diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index 8bdc68dbb04..71e3462f8f6 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -23,13 +23,6 @@ #include "unicode/putil.h" #include "putilimp.h" -#if U_HAVE_POPEN -#if (U_PF_MINGW <= U_PLATFORM || U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) -/* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */ -#undef __STRICT_ANSI__ -#endif -#endif - #include "cmemory.h" #include "cstring.h" #include "filestrm.h" @@ -55,44 +48,6 @@ U_CDECL_BEGIN #include "pkgtypes.h" U_CDECL_END -#if U_PLATFORM_HAS_WIN32_API -#ifdef __GNUC__ -#define WINDOWS_WITH_GNUC -#else -#define WINDOWS_WITH_MSVC -#endif -#endif -#if !defined(WINDOWS_WITH_MSVC) && !U_PLATFORM_IS_LINUX_BASED -#define BUILD_DATA_WITHOUT_ASSEMBLY -#endif -#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED -#define CAN_WRITE_OBJ_CODE -#endif -#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) -#define USING_CYGWIN -#endif - -/* - * When building the data library without assembly, - * some platforms use a single c code file for all of - * the data to generate the final data library. This can - * increase the performance of the pkdata tool. - */ -#if U_PLATFORM == U_PF_OS400 -#define USE_SINGLE_CCODE_FILE -#endif - -/* Need to fix the file seperator character when using MinGW. */ -#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) -#define PKGDATA_FILE_SEP_STRING "/" -#else -#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING -#endif - -#define LARGE_BUFFER_MAX_SIZE 2048 -#define SMALL_BUFFER_MAX_SIZE 512 -#define SMALL_BUFFER_FLAG_NAMES 32 -#define BUFFER_PADDING_SIZE 20 static void loadLists(UPKGOptions *o, UErrorCode *status); @@ -725,6 +680,9 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { #endif #elif defined(BUILD_DATA_WITHOUT_ASSEMBLY) result = pkg_createWithoutAssemblyCode(o, targetDir, mode); +#else + fprintf(stderr, "Error- neither CAN_WRITE_OBJ_CODE nor BUILD_DATA_WITHOUT_ASSEMBLY are defined. Internal error.\n"); + return 1; #endif if (result != 0) { fprintf(stderr, "Error generating package data.\n"); @@ -1338,6 +1296,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD char tempObjectFile[SMALL_BUFFER_MAX_SIZE] = ""; #ifdef USE_SINGLE_CCODE_FILE char icudtAll[SMALL_BUFFER_MAX_SIZE] = ""; + FileStream *icudtAllFile = NULL; sprintf(icudtAll, "%s%s%sall.c", o->tmpDir, @@ -1348,6 +1307,11 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD fprintf(stderr, "Unable to remove old icudtall file: %s\n", icudtAll); return result; } + + if((icudtAllFile = T_FileStream_open(icudtAll, "w"))==NULL) { + fprintf(stderr, "Unable to write to icudtall file: %s\n", icudtAll); + return result; + } #endif if (list == NULL || listNames == NULL) { @@ -1430,20 +1394,16 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD } } + if(o->verbose) { + printf("# Generating %s \n", gencmnFile); + } + writeCCode(file, o->tmpDir, dataName[0] != 0 ? dataName : o->shortName, newName[0] != 0 ? newName : NULL, gencmnFile); + #ifdef USE_SINGLE_CCODE_FILE - sprintf(cmd, "cat %s >> %s", gencmnFile, icudtAll); - - result = runCommand(cmd); - if (result != 0) { - break; - } else { - /* Remove the c code file after concatenating it to icudtall.c file. */ - if ((result = remove(gencmnFile)) != 0) { - fprintf(stderr, "Unable to remove c code file: %s\n", gencmnFile); - return result; - } - } + sprintf(cmd, "#include \"%s\"\n", gencmnFile); + T_FileStream_writeLine(icudtAllFile, cmd); + /* don't delete the file */ #endif } @@ -1474,10 +1434,11 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD } #ifdef USE_SINGLE_CCODE_FILE + T_FileStream_close(icudtAllFile); uprv_strcpy(tempObjectFile, icudtAll); tempObjectFile[uprv_strlen(tempObjectFile) - 1] = 'o'; - sprintf(cmd, "%s %s -o %s %s", + sprintf(cmd, "%s %s -I. -o %s %s", pkgDataFlags[COMPILER], pkgDataFlags[LIBFLAGS], tempObjectFile, diff --git a/icu4c/source/tools/toolutil/pkg_genc.c b/icu4c/source/tools/toolutil/pkg_genc.c index c065d57f37f..57c6f6192d7 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.c +++ b/icu4c/source/tools/toolutil/pkg_genc.c @@ -51,9 +51,6 @@ #define HEX_0X 0 /* 0x1234 */ #define HEX_0H 1 /* 01234h */ -#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) -#define CAN_GENERATE_OBJECTS -#endif /* prototypes --------------------------------------------------------------- */ static void @@ -373,8 +370,11 @@ writeCCode(const char *filename, const char *destdir, const char *optName, const [grhoten 4/24/2003] */ sprintf(buffer, + "#ifndef IN_GENERATED_CCODE\n" + "#define IN_GENERATED_CCODE\n" "#define U_DISABLE_RENAMING 1\n" "#include \"unicode/umachine.h\"\n" + "#endif\n" "U_CDECL_BEGIN\n" "const struct {\n" " double bogus;\n" @@ -397,8 +397,11 @@ writeCCode(const char *filename, const char *destdir, const char *optName, const #else /* Function renaming shouldn't be done in data */ sprintf(buffer, + "#ifndef IN_GENERATED_CCODE\n" + "#define IN_GENERATED_CCODE\n" "#define U_DISABLE_RENAMING 1\n" "#include \"unicode/umachine.h\"\n" + "#endif\n" "U_CDECL_BEGIN\n" "const struct {\n" " double bogus;\n" diff --git a/icu4c/source/tools/toolutil/pkg_genc.h b/icu4c/source/tools/toolutil/pkg_genc.h index 750b363a366..763cf86cc14 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.h +++ b/icu4c/source/tools/toolutil/pkg_genc.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 2008-2009, International Business Machines + * Copyright (C) 2008-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* */ @@ -8,6 +8,7 @@ #define __PKG_GENC_H__ #include "unicode/utypes.h" +#include "toolutil.h" U_INTERNAL void U_EXPORT2 printAssemblyHeadersToStdErr(void); diff --git a/icu4c/source/tools/toolutil/pkg_gencmn.c b/icu4c/source/tools/toolutil/pkg_gencmn.c index cc02c513eef..e98740b1bd5 100644 --- a/icu4c/source/tools/toolutil/pkg_gencmn.c +++ b/icu4c/source/tools/toolutil/pkg_gencmn.c @@ -165,7 +165,8 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi } /* read the list of files and get their lengths */ - while((s != NULL && *s != 0) || T_FileStream_readLine(in, line, LINE_BUFFER_SIZE)!=NULL) { + while((s != NULL && *s != 0) || (s=T_FileStream_readLine(in, (line=linePtr), + LINE_BUFFER_SIZE))!=NULL) { /* remove trailing newline characters and parse space separated items */ if (s != NULL && *s != 0) { line=s; @@ -203,7 +204,7 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi } if (linePtr) { - uprv_free(linePtr); + uprv_free(linePtr); } if(in!=T_FileStream_stdin()) { @@ -337,14 +338,14 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi /* write the source file */ sprintf(buffer, "/*\n" - " * ICU common data table of contents for %s.%s ,\n" + " * ICU common data table of contents for %s.%s\n" " * Automatically generated by icu/source/tools/gencmn/gencmn .\n" " */\n\n" "#include \"unicode/utypes.h\"\n" "#include \"unicode/udata.h\"\n" "\n" - "/* external symbol declarations for data */\n", - name, type); + "/* external symbol declarations for data (%d files) */\n", + name, type, fileCount); T_FileStream_writeLine(out, buffer); sprintf(buffer, "extern const char\n %s%s[]", symPrefix?symPrefix:"", files[0].pathname); @@ -424,7 +425,6 @@ addFile(const char *filename, const char *name, const char *source, UBool source exit(U_ILLEGAL_ARGUMENT_ERROR); } fullPath = pathToFullPath(filename, source); - /* store the pathname */ length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(name) + 1); s=allocString(length); @@ -467,7 +467,6 @@ addFile(const char *filename, const char *name, const char *source, UBool source files[fileCount].fileSize=length; } else { char *t; - /* get and store the basename */ /* need to include the package name */ length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(name) + 1); @@ -477,8 +476,6 @@ addFile(const char *filename, const char *name, const char *source, UBool source uprv_strcat(s, filename); fixDirToTreePath(s); files[fileCount].basename=s; - - /* turn the basename into an entry point name and store in the pathname field */ t=files[fileCount].pathname=allocString(length); while(--length>0) { diff --git a/icu4c/source/tools/toolutil/toolutil.h b/icu4c/source/tools/toolutil/toolutil.h index 980d2dbc548..c6a941cb567 100644 --- a/icu4c/source/tools/toolutil/toolutil.h +++ b/icu4c/source/tools/toolutil/toolutil.h @@ -21,6 +21,69 @@ #include "unicode/utypes.h" +#include "unicode/putil.h" +#include "putilimp.h" + +/*** Platform #defines move here ***/ +#if U_PLATFORM_HAS_WIN32_API +#ifdef __GNUC__ +#define WINDOWS_WITH_GNUC +#else +#define WINDOWS_WITH_MSVC +#endif +#endif + + +#if !defined(WINDOWS_WITH_MSVC) && !U_PLATFORM_IS_LINUX_BASED +#define BUILD_DATA_WITHOUT_ASSEMBLY +#endif + +#ifndef U_DISABLE_OBJ_CODE /* testing */ +#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED +#define CAN_WRITE_OBJ_CODE +#endif +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) +#define CAN_GENERATE_OBJECTS +#endif +#endif + +#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) +#define USING_CYGWIN +#endif + +/* + * When building the data library without assembly, + * some platforms use a single c code file for all of + * the data to generate the final data library. This can + * increase the performance of the pkdata tool. + */ +#if U_PLATFORM == U_PF_OS400 +#define USE_SINGLE_CCODE_FILE +#endif + +/* Need to fix the file seperator character when using MinGW. */ +#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) +#define PKGDATA_FILE_SEP_STRING "/" +#else +#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING +#endif + +#define LARGE_BUFFER_MAX_SIZE 2048 +#define SMALL_BUFFER_MAX_SIZE 512 +#define SMALL_BUFFER_FLAG_NAMES 32 +#define BUFFER_PADDING_SIZE 20 + + +#if U_HAVE_POPEN +#if (U_PF_MINGW <= U_PLATFORM || U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) +/* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */ +#undef __STRICT_ANSI__ +#endif +#endif + +/** End platform defines **/ + + #ifdef __cplusplus #include "unicode/errorcode.h"