ICU-8784 improve pointer toc code, however still not working on i- document as such for now.

X-SVN-Rev: 30702
This commit is contained in:
Steven R. Loomis 2011-09-21 20:00:24 +00:00
parent 63e25666ad
commit e73e4ea280
8 changed files with 100 additions and 79 deletions

View 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>

View 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)

View file

@ -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,

View file

@ -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
}
}
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;
}
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, "#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,

View 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"

View 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);

View 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) {

View file

@ -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"