<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 © 1997-2011 International Business Machines Corporation and
others. All Rights Reserved.</p>
<!-- Remember that there is a copyright at the end too -->
<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>
* 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)
#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,
#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"
#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);
#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");
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,
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) {
}
}
+ 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
}
}
#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,
#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
[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"
#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"
/******************************************************************************
- * Copyright (C) 2008-2009, International Business Machines
+ * Copyright (C) 2008-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#define __PKG_GENC_H__
#include "unicode/utypes.h"
+#include "toolutil.h"
U_INTERNAL void U_EXPORT2
printAssemblyHeadersToStdErr(void);
}
/* 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;
}
if (linePtr) {
- uprv_free(linePtr);
+ uprv_free(linePtr);
}
if(in!=T_FileStream_stdin()) {
/* 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);
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);
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);
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) {
#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"