]> granicus.if.org Git - icu/commitdiff
ICU-8784 improve pointer toc code, however still not working on i- document as such...
authorSteven R. Loomis <srl@icu-project.org>
Wed, 21 Sep 2011 20:00:24 +0000 (20:00 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Wed, 21 Sep 2011 20:00:24 +0000 (20:00 +0000)
X-SVN-Rev: 30702

icu4c/readme.html
icu4c/source/common/putilimp.h
icu4c/source/tools/genccode/genccode.c
icu4c/source/tools/pkgdata/pkgdata.cpp
icu4c/source/tools/toolutil/pkg_genc.c
icu4c/source/tools/toolutil/pkg_genc.h
icu4c/source/tools/toolutil/pkg_gencmn.c
icu4c/source/tools/toolutil/toolutil.h

index 39e63e1c461771ff44289d50be1ff51d393c28fa..fcfb904cf909504ed66ba44cd7f53663e207d6d5 100644 (file)
@@ -18,7 +18,7 @@
     <h1>International Components for Unicode<br />
      <abbr title="International Components for Unicode">ICU</abbr> 49 ReadMe</h1>
 
-    <p>Last updated: 2011-Sep-15<br />
+    <p>Last updated: 2011-Sep-20<br />
      Copyright &copy; 1997-2011 International Business Machines Corporation and
     others. All Rights Reserved.</p>
     <!-- Remember that there is a copyright at the end too -->
@@ -1254,7 +1254,7 @@ CHGJOB CCSID(37)</samp>
       <li>Change your current directory to icu/source.</li>
 
       <li>Run <tt>'./runConfigureICU IBMi'</tt>  (See <a href="#HowToConfigureICU">configuration
-      note</a> for details).</li>
+      note</a> for details). Note that --with-data-packaging=archive and setting the --prefix are recommended, building in default (dll) mode is currently not supported.</li>
 
       <li>Run <tt>'gmake'</tt> to build ICU. (Do not use the -j option)</li>
 
index 39f2554c3fc40571e948cb71591cb4a8a2f8c0ed..1e324913c274a1ee7c0512b65b8b2d2ae8d87b8c 100644 (file)
@@ -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)
index 98e9bb33d5eeaec9ea0bf9c97ce9b178dca0e26c..d489fd5d9c3dfe72c53e8ef4f01e80e31d532cb4 100644 (file)
 #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,
index 8bdc68dbb04c3e108226f587cb3cf2b75de87cf9..71e3462f8f6c6843bb8ae467003cab2d796c9fee 100644 (file)
 #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,
index c065d57f37f71cc15b68418761d2749e4ad7ece5..57c6f6192d7a540e86ec2a5c8b8b9fba1427a4bc 100644 (file)
@@ -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"
index 750b363a36669d065647d809813696c496eef02f..763cf86cc1481a8b3fb54b242898eaafde4c3ce9 100644 (file)
@@ -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);
index cc02c513eefd896586b044b7d4dbd158374caf47..e98740b1bd5b4faccb30e7fc1da8f8203b082a75 100644 (file)
@@ -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) {
index 980d2dbc548b949434d05b326f485a3fc54a3cb6..c6a941cb567aaeb052f1758703f4eab975b9e096 100644 (file)
 
 #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"