ICU-5081 Remove support for the old naming scheme.

X-SVN-Rev: 19273
This commit is contained in:
George Rhoten 2006-02-24 19:47:47 +00:00
parent 21694002ed
commit ba00f9b408
16 changed files with 347 additions and 711 deletions

View File

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2005, International Business Machines
* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -1012,7 +1012,7 @@ checkDataItem
/**
* @return 0 if not loaded, 1 if loaded or err
*/
static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, const char *oldIndFileName,
static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
const char *dataPath, const char *tocEntryPathSuffix, const char *inBasename,
/* following arguments are the same as doOpenChoice itself */
const char *path, const char *type, const char *name,
@ -1020,109 +1020,64 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName, const char *o
UErrorCode *subErrorCode,
UErrorCode *pErrorCode)
{
UDataMemory *retVal = NULL;
const char *pathBuffer;
UDataMemory dataMemory;
UDataMemory *pEntryData;
UDataMemory *retVal = NULL;
const char *pathBuffer;
UDataMemory dataMemory;
UDataMemory *pEntryData;
UDataPathIterator iter;
/* #1a look in ind. files: package\nam.typ ========================= */
/* init path iterator for individual files */
udata_pathiter_init(&iter, dataPath, pkgName, path, tocEntryPathSuffix, FALSE);
UDataPathIterator iter;
/* look in ind. files: package\nam.typ ========================= */
/* init path iterator for individual files */
udata_pathiter_init(&iter, dataPath, pkgName, path, tocEntryPathSuffix, FALSE);
while((pathBuffer = udata_pathiter_next(&iter)))
while((pathBuffer = udata_pathiter_next(&iter)))
{
#ifdef UDATA_DEBUG
fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
#endif
if( uprv_mapFile(&dataMemory, pathBuffer) ||
(inBasename!=pathBuffer && uprv_mapFile(&dataMemory, inBasename)))
{
#ifdef UDATA_DEBUG
fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
#endif
if( uprv_mapFile(&dataMemory, pathBuffer) ||
(inBasename!=pathBuffer && uprv_mapFile(&dataMemory, inBasename)))
{
pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
if (pEntryData != NULL) {
/* Data is good.
* Hand off ownership of the backing memory to the user's UDataMemory.
* and return it. */
pEntryData->mapAddr = dataMemory.mapAddr;
pEntryData->map = dataMemory.map;
pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
if (pEntryData != NULL) {
/* Data is good.
* Hand off ownership of the backing memory to the user's UDataMemory.
* and return it. */
pEntryData->mapAddr = dataMemory.mapAddr;
pEntryData->map = dataMemory.map;
#ifdef UDATA_DEBUG
fprintf(stderr, "** Mapped file: %s\n", pathBuffer);
fprintf(stderr, "** Mapped file: %s\n", pathBuffer);
#endif
retVal = pEntryData;
goto commonReturn;
}
/* the data is not acceptable, or some error occured. Either way, unmap the memory */
udata_close(&dataMemory);
/* If we had a nasty error, bail out completely. */
if (U_FAILURE(*pErrorCode)) {
retVal = NULL;
goto commonReturn;
}
/* Otherwise remember that we found data but didn't like it for some reason */
*subErrorCode=U_INVALID_FORMAT_ERROR;
retVal = pEntryData;
goto commonReturn;
}
#ifdef UDATA_DEBUG
fprintf(stderr, "%s\n", UDataMemory_isLoaded(&dataMemory)?"LOADED":"not loaded");
#endif
}
udata_pathiter_dt(&iter);
/* #1b look in ind. files - with old naming (package_nam.typ not package\nam.typ) ==================== */
/* init path iterator for individual files */
udata_pathiter_init(&iter, dataPath, "", path, oldIndFileName, FALSE);
/* the data is not acceptable, or some error occured. Either way, unmap the memory */
udata_close(&dataMemory);
while((pathBuffer = udata_pathiter_next(&iter)))
{
#ifdef UDATA_DEBUG
fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
#endif
if( uprv_mapFile(&dataMemory, pathBuffer) ||
(inBasename!=pathBuffer && uprv_mapFile(&dataMemory, inBasename)))
{
pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
if (pEntryData != NULL) {
/* Data is good.
* Hand off ownership of the backing memory to the user's UDataMemory.
* and return it. */
pEntryData->mapAddr = dataMemory.mapAddr;
pEntryData->map = dataMemory.map;
#ifdef UDATA_DEBUG
fprintf(stderr, "** Mapped file: %s\n", pathBuffer);
#endif
retVal = pEntryData;
goto commonReturn;
}
/* the data is not acceptable, or some error occured. Either way, unmap the memory */
udata_close(&dataMemory);
/* If we had a nasty error, bail out completely. */
if (U_FAILURE(*pErrorCode)) {
retVal = NULL;
goto commonReturn;
}
/* Otherwise remember that we found data but didn't like it for some reason */
*subErrorCode=U_INVALID_FORMAT_ERROR;
/* If we had a nasty error, bail out completely. */
if (U_FAILURE(*pErrorCode)) {
retVal = NULL;
goto commonReturn;
}
#ifdef UDATA_DEBUG
fprintf(stderr, "%s\n", UDataMemory_isLoaded(&dataMemory)?"LOADED":"not loaded");
#endif
/* Otherwise remember that we found data but didn't like it for some reason */
*subErrorCode=U_INVALID_FORMAT_ERROR;
}
#ifdef UDATA_DEBUG
fprintf(stderr, "%s\n", UDataMemory_isLoaded(&dataMemory)?"LOADED":"not loaded");
#endif
}
commonReturn:
udata_pathiter_dt(&iter);
return retVal;
udata_pathiter_dt(&iter);
return retVal;
}
/**
* @return 0 if not loaded, 1 if loaded or err
*/
static UDataMemory *doLoadFromCommonData(UBool isICUData, const char *pkgName, const char *oldIndFileName,
static UDataMemory *doLoadFromCommonData(UBool isICUData, const char *pkgName,
const char *dataPath, const char *tocEntryPathSuffix, const char *tocEntryName, const char *inBasename,
/* following arguments are the same as doOpenChoice itself */
const char *path, const char *type, const char *name,
@ -1154,13 +1109,6 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char *pkgName, c
#ifdef UDATA_DEBUG
fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, pHeader, u_errorName(*subErrorCode));
#endif
if((pHeader == NULL) && !U_FAILURE(*subErrorCode)) {
pHeader=pCommonData->vFuncs->Lookup(pCommonData, oldIndFileName, /* oldIndFileName is preceded by a slash */
&length, subErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "[OLD name] %s: pHeader=%p - %s\n", oldIndFileName, pHeader, u_errorName(*subErrorCode));
#endif
}
if(pHeader!=NULL) {
pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
@ -1231,9 +1179,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
TinyString tocEntryName; /* entry name in tree format. ex: 'icudt28b/coll/ar.res' */
TinyString tocEntryPath; /* entry name in path format. ex: 'icudt28b\\coll\\ar.res' */
TinyString oldIndFileName; /* ex: icudt28b_ar.res */
TinyString oldStylePath;
TinyString oldStylePathBasename;
TinyString pkgName;
TinyString treeName;
@ -1281,11 +1226,8 @@ doOpenChoice(const char *path, const char *type, const char *name,
}
#endif
TinyString_init(&oldIndFileName);
TinyString_init(&tocEntryName);
TinyString_init(&tocEntryPath);
TinyString_init(&oldStylePath);
TinyString_init(&oldStylePathBasename);
TinyString_init(&pkgName);
TinyString_init(&treeName);
@ -1343,7 +1285,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
/* prepend the package */
TinyString_append(&tocEntryName, pkgName.s);
TinyString_append(&tocEntryPath, pkgName.s);
TinyString_append(&oldIndFileName, pkgName.s);
tocEntrySuffixIndex = tocEntryName.length;
if(treeName.s[0]) {
@ -1354,10 +1295,8 @@ doOpenChoice(const char *path, const char *type, const char *name,
TinyString_append(&tocEntryPath, treeName.s);
}
TinyString_append(&oldIndFileName, "_");
TinyString_append(&tocEntryName, U_TREE_ENTRY_SEP_STRING);
TinyString_append(&tocEntryPath, U_FILE_SEP_STRING);
TinyString_append(&oldIndFileName, name);
TinyString_append(&tocEntryName, name);
TinyString_append(&tocEntryPath, name);
if(type!=NULL && *type!=0) {
@ -1365,8 +1304,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
TinyString_append(&tocEntryName, type);
TinyString_append(&tocEntryPath, ".");
TinyString_append(&tocEntryPath, type);
TinyString_append(&oldIndFileName, ".");
TinyString_append(&oldIndFileName, type);
}
tocEntrySuffix = tocEntryName.s+tocEntrySuffixIndex; /* suffix starts here */
tocEntryPathSuffix = tocEntryPath.s+tocEntrySuffixIndex; /* suffix starts here */
@ -1374,7 +1311,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
#ifdef UDATA_DEBUG
fprintf(stderr, " tocEntryName = %s\n", tocEntryName.s);
fprintf(stderr, " tocEntryPath = %s\n", tocEntryName.s);
fprintf(stderr, " oldIndFileName = %s\n", oldIndFileName.s);
#endif
/* try to get an individual data file */
@ -1394,33 +1330,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, "IND: inBasename = %s, pkg=%s\n", inBasename, packageNameFromPath(path));
#endif
/* Deal with a null basename */
if( (*inBasename==0) && (uprv_strlen(path) > 3) ) {
/* the purpose of this exercise is to turn /tmp/foo/bar/ into
path= /tmp/foo/bar/bar and basename= bar
(i.e. /tmp/foo/bar/bar.dat or /tmp/foo/bar/bar_en_US.res )
*/
char *rightSlash;
TinyString_append(&oldStylePath, path);
/* chop off trailing slash */
oldStylePath.length--;
oldStylePath.s[oldStylePath.length] = 0;
rightSlash = (char*)uprv_strrchr(oldStylePath.s, U_FILE_SEP_CHAR);
if(rightSlash != NULL) {
rightSlash++;
TinyString_append(&oldStylePathBasename, rightSlash);
inBasename = oldStylePathBasename.s;
TinyString_append(&oldStylePath, U_FILE_SEP_STRING);
TinyString_append(&oldStylePath, inBasename); /* one more time, for the base name */
path = oldStylePath.s;
} else {
*pErrorCode = U_FILE_ACCESS_ERROR; /* hopelessly bad case */
retVal = NULL;
goto commonReturn;
}
}
/* End of dealing with a null basename */
dataPath = u_getDataDirectory();
@ -1431,7 +1340,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
#endif
/* #2 */
retVal = doLoadFromCommonData(isICUData,
pkgName.s, oldIndFileName.s, dataPath, tocEntryPathSuffix,
pkgName.s, dataPath, tocEntryPathSuffix,
tocEntryName.s, inBasename,
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
@ -1447,7 +1356,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
#endif
/* Check to make sure that there is a dataPath to iterate over */
if ((dataPath && *dataPath) || !isICUData) {
retVal = doLoadFromIndividualFiles(pkgName.s, oldIndFileName.s, dataPath, tocEntryPathSuffix, inBasename,
retVal = doLoadFromIndividualFiles(pkgName.s, dataPath, tocEntryPathSuffix, inBasename,
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
goto commonReturn;
@ -1462,7 +1371,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, "Trying packages (UDATA_ONLY_PACKAGES || UDATA_FILES_FIRST)\n");
#endif
retVal = doLoadFromCommonData(isICUData,
pkgName.s, oldIndFileName.s, dataPath, tocEntryPathSuffix,
pkgName.s, dataPath, tocEntryPathSuffix,
tocEntryName.s, inBasename,
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
@ -1478,7 +1387,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, "Trying common data (UDATA_NO_FILES)\n");
#endif
retVal = doLoadFromCommonData(isICUData,
pkgName.s, oldIndFileName.s, "", tocEntryPathSuffix,
pkgName.s, "", tocEntryPathSuffix,
tocEntryName.s, inBasename,
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
@ -1500,9 +1409,6 @@ doOpenChoice(const char *path, const char *type, const char *name,
commonReturn:
TinyString_dt(&tocEntryName);
TinyString_dt(&tocEntryPath);
TinyString_dt(&oldIndFileName);
TinyString_dt(&oldStylePath);
TinyString_dt(&oldStylePathBasename);
TinyString_dt(&pkgName);
TinyString_dt(&treeName);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2004, International Business Machines
* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -98,7 +98,6 @@ typedef struct {
static File files[MAX_FILE_COUNT];
static uint32_t fileCount=0;
static UBool embed = FALSE;
/* prototypes --------------------------------------------------------------- */
@ -131,7 +130,6 @@ static UOption options[]={
/*8*/ UOPTION_DEF( "source", 'S', UOPT_NO_ARG),
/*9*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG),
/*10*/UOPTION_SOURCEDIR,
/*11*/UOPTION_DEF( "embed", 'E', UOPT_NO_ARG)
};
static char *symPrefix = NULL;
@ -165,10 +163,6 @@ main(int argc, char* argv[]) {
argc=-1;
}
if(options[11].doesOccur) {
embed = TRUE;
}
if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
FILE *where = argc < 0 ? stderr : stdout;
@ -389,21 +383,6 @@ main(int argc, char* argv[]) {
}
#if 0
if(!embed) {
symPrefix = (char *) uprv_malloc(uprv_strlen(entrypointName) + 2);
/* test for NULL */
if (symPrefix == NULL) {
sprintf(buffer, "U_MEMORY_ALLOCATION_ERROR");
exit(U_MEMORY_ALLOCATION_ERROR);
}
uprv_strcpy(symPrefix, entrypointName);
uprv_strcat(symPrefix, "_");
}
#endif
/* write the source file */
sprintf(buffer,
"/*\n"
@ -490,20 +469,11 @@ addFile(const char *filename, UBool sourceTOC, UBool verbose) {
fullPath = pathToFullPath(filename);
/* store the pathname */
if(!embed) {
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
} else {
/* compatibility mode */
const char *base;
base = findBasename(filename);
length = (uint32_t)(uprv_strlen(base) + 1);
s=allocString(length);
uprv_memcpy(s, base, length);
}
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
/* get the basename */
fixDirToTreePath(s);
@ -541,22 +511,13 @@ addFile(const char *filename, UBool sourceTOC, UBool verbose) {
} else {
char *t;
if(embed) {
filename = findBasename(filename);
}
/* get and store the basename */
if(!embed) {
/* need to include the package name */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
} else {
length = (uint32_t)(uprv_strlen(filename) + 1);
s=allocString(length);
uprv_memcpy(s, filename, length);
}
/* need to include the package name */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
fixDirToTreePath(s);
files[fileCount].basename=s;
@ -610,26 +571,24 @@ pathToFullPath(const char *path) {
n = (int32_t)uprv_strlen(fullPath);
uprv_strcat(fullPath, path);
if(!embed) {
#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
}
#endif
#endif
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
#endif
}
#endif
return fullPath;
}

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1998-2004, International Business Machines
* Copyright (C) 1998-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -50,7 +50,6 @@ enum
PACKAGE_NAME,
BUNDLE_NAME,
WRITE_XLIFF,
TOUCHFILE,
STRICT,
NO_BINARY_COLLATION,
/*added by Jing*/
@ -72,16 +71,13 @@ UOption options[]={
UOPTION_PACKAGE_NAME,
UOPTION_BUNDLE_NAME,
UOPTION_DEF( "write-xliff", 'x', UOPT_OPTIONAL_ARG),
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG),
UOPTION_DEF( "strict", 'k', UOPT_NO_ARG), /* 14 */
UOPTION_DEF( "noBinaryCollation", 'C', UOPT_NO_ARG),/* 15 */
/*added by Jing*/
UOPTION_DEF( "language", 'l', UOPT_REQUIRES_ARG)
};
static UBool write_java = FALSE;
static UBool write_xliff = FALSE;
static UBool touchfile = FALSE;
static const char* outputEnc ="";
static const char* gPackageName=NULL;
static const char* bundleName=NULL;
@ -146,9 +142,7 @@ main(int argc,
"\t-j or --write-java write a Java ListResourceBundle for ICU4J, followed by optional encoding\n"
"\t defaults to ASCII and \\uXXXX format.\n"
"\t-p or --package-name For ICU4J: package name for writing the ListResourceBundle for ICU4J,\n"
"\t defaults to com.ibm.icu.impl.data\n"
"\t For ICU4C: Package name for the .res files on output. Specfiying\n"
"\t 'ICUDATA' defaults to the current ICU4C data name.\n");
"\t defaults to com.ibm.icu.impl.data\n");
fprintf(stderr,
"\t-b or --bundle-name bundle name for writing the ListResourceBundle for ICU4J,\n"
"\t defaults to LocaleElements\n"
@ -193,15 +187,6 @@ main(int argc,
}
}
if(options[TOUCHFILE].doesOccur) {
if(gPackageName == NULL) {
fprintf(stderr, "%s: Don't use touchfile (-t) option with no package.\n",
argv[0]);
return -1;
}
touchfile = TRUE;
}
if(options[ENCODING].doesOccur) {
encoding = options[ENCODING].value;
}
@ -388,37 +373,6 @@ processFile(const char *filename, const char *cp, const char *inputDir, const ch
/* Determine the target rb filename */
rbname = make_res_filename(filename, outputDir, packageName, status);
if(touchfile == TRUE) {
FileStream *q;
char msg[1024];
char *tfname = NULL;
tfname = make_res_filename(filename, outputDir, NULL, status);
if(U_FAILURE(*status))
{
fprintf(stderr, "Error writing touchfile for \"%s\"\n", filename);
*status = U_FILE_ACCESS_ERROR;
} else {
uprv_strcat(tfname, ".res");
sprintf(msg, "This empty file tells nmake that %s in package %s has been updated.\n",
filename, packageName);
q = T_FileStream_open(tfname, "w");
if(q == NULL)
{
fprintf(stderr, "Error writing touchfile \"%s\"\n", tfname);
*status = U_FILE_ACCESS_ERROR;
}
else
{
T_FileStream_write(q, msg, (int32_t)uprv_strlen(msg));
T_FileStream_close(q);
}
uprv_free(tfname);
}
}
if(U_FAILURE(*status)) {
fprintf(stderr, "couldn't make the res fileName for bundle %s. Error:%s\n", filename,u_errorName(*status));
goto finish;

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2005, International Business Machines
* Copyright (C) 2003-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -63,7 +63,6 @@ static UOption options[]={
UOPTION_DESTDIR,
UOPTION_SOURCEDIR,
UOPTION_ICUDATADIR,
UOPTION_PACKAGE_NAME,
UOPTION_BUNDLE_NAME,
{ "normalization", NULL, NULL, NULL, 'n', UOPT_REQUIRES_ARG, 0 },
{ "check-bidi", NULL, NULL, NULL, 'k', UOPT_NO_ARG, 0},
@ -78,7 +77,6 @@ enum{
DESTDIR,
SOURCEDIR,
ICUDATADIR,
PACKAGE_NAME,
BUNDLE_NAME,
NORMALIZE,
CHECK_BIDI,
@ -110,7 +108,6 @@ static int printHelp(int argc, char* argv[]){
"\t followed by path, defaults to %s\n",
u_getDataDirectory());
fprintf(stderr,
"\t-p or --package-name prepend the output data file name with the package name specified\n"
"\t-n or --normalize turn on the option for normalization and include mappings\n"
"\t from NormalizationCorrections.txt from the given path,\n"
"\t e.g: /test/icu/source/data/unidata\n"
@ -127,7 +124,7 @@ main(int argc, char* argv[]) {
char* filename = NULL;
#endif
const char *srcDir=NULL, *destDir=NULL, *icuUniDataDir=NULL;
const char *packageName=NULL, *bundleName=NULL, *inputFileName = NULL;
const char *bundleName=NULL, *inputFileName = NULL;
char *basename=NULL;
int32_t sprepOptions = 0;
@ -140,7 +137,6 @@ main(int argc, char* argv[]) {
options[SOURCEDIR].value="";
options[UNICODE_VERSION].value="0"; /* don't assume the unicode version */
options[BUNDLE_NAME].value = DATA_NAME;
options[PACKAGE_NAME].value = NULL;
options[NORMALIZE].value = "";
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
@ -161,7 +157,6 @@ main(int argc, char* argv[]) {
haveCopyright=options[COPYRIGHT].doesOccur;
srcDir=options[SOURCEDIR].value;
destDir=options[DESTDIR].value;
packageName = options[PACKAGE_NAME].value;
bundleName = options[BUNDLE_NAME].value;
icuUniDataDir = options[NORMALIZE].value;
@ -183,7 +178,7 @@ main(int argc, char* argv[]) {
"gensprep writes dummy " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE
" because UCONFIG_NO_IDNA is set, \n"
"see icu/source/common/unicode/uconfig.h\n");
generateData(destDir, packageName, bundleName);
generateData(destDir, bundleName);
#else
@ -243,9 +238,9 @@ main(int argc, char* argv[]) {
/* process parsed data */
if(U_SUCCESS(errorCode)) {
/* write the data file */
generateData(destDir, packageName, bundleName);
generateData(destDir, bundleName);
cleanUpData();
cleanUpData();
}
uprv_free(filename);

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2004, International Business Machines
* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -52,7 +52,7 @@ storeRange(uint32_t start, uint32_t end, UStringPrepType type,UErrorCode* status
#endif
extern void
generateData(const char *dataDir, const char* packageName, const char* bundleName);
generateData(const char *dataDir, const char* bundleName);
extern void
setOptions(int32_t options);

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2005, International Business Machines
* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -574,7 +574,7 @@ getFoldedValue(UNewTrie *trie, UChar32 start, int32_t offset) {
#endif /* #if !UCONFIG_NO_IDNA */
extern void
generateData(const char *dataDir, const char *packageName, const char* bundleName) {
generateData(const char *dataDir, const char* bundleName) {
static uint8_t sprepTrieBlock[100000];
UNewDataMemory *pData;
@ -610,12 +610,7 @@ generateData(const char *dataDir, const char *packageName, const char* bundleNam
#endif
if(packageName != NULL) {
uprv_strcpy(fileName,packageName);
uprv_strcat(fileName,"_");
} else {
fileName[0]=0;
}
fileName[0]=0;
uprv_strcat(fileName,bundleName);
/* write the data */
pData=udata_create(dataDir, DATA_TYPE, fileName, &dataInfo,

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2004, International Business Machines
* Copyright (C) 1999-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -28,7 +28,6 @@
#include "uoptions.h"
#include "gentest.h"
#define DATA_PKG "testdata"
#define DATA_NAME "test"
#define DATA_TYPE "icu"
@ -73,7 +72,7 @@ main(int argc, char* argv[]) {
if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
fprintf(stderr,
"usage: %s [-options]\n"
"\tcreate the test file " DATA_PKG "_" DATA_NAME "." DATA_TYPE " unless the -r option is given.\n"
"\tcreate the test file " DATA_NAME "." DATA_TYPE " unless the -r option is given.\n"
"\toptions:\n"
"\t\t-h or -? or --help this usage text\n"
"\t\t-d or --destdir destination directory, followed by the path\n"
@ -101,7 +100,7 @@ createData(const char* outputDirectory, UErrorCode *errorCode) {
long dataLength;
uint32_t size;
pData=udata_create(outputDirectory, DATA_TYPE, DATA_PKG "_" DATA_NAME, &dataInfo,
pData=udata_create(outputDirectory, DATA_TYPE, DATA_NAME, &dataInfo,
U_COPYRIGHT_STRING, errorCode);
if(U_FAILURE(*errorCode)) {
fprintf(stderr, "gentest: unable to create data memory, error %d\n", *errorCode);

View File

@ -1,7 +1,7 @@
/*
********************************************************************************
*
* Copyright (C) 1998-2005, International Business Machines
* Copyright (C) 1998-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
********************************************************************************
@ -76,7 +76,6 @@ extern const UConverterStaticData * ucnv_converterStaticData[UCNV_NUMBER_OF_SUPP
* Global - verbosity
*/
UBool VERBOSE = FALSE;
UBool TOUCHFILE = FALSE;
static void
createConverter(ConvData *data, const char* converterName, UErrorCode *pErrorCode);
@ -171,8 +170,6 @@ static UOption options[]={
UOPTION_VERSION, /* 3 */
UOPTION_DESTDIR, /* 4 */
UOPTION_VERBOSE, /* 5 */
UOPTION_PACKAGE_NAME, /* 6 */
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG) /* 7 */
};
int main(int argc, char* argv[])
@ -180,9 +177,7 @@ int main(int argc, char* argv[])
ConvData data;
UErrorCode err = U_ZERO_ERROR, localError;
char outFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
char touchFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
const char* destdir, *arg;
const char *pkgName = NULL;
size_t destdirlen;
char* dot = NULL, *outBasename;
char cnvName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
@ -221,48 +216,16 @@ int main(int argc, char* argv[])
"\t-d or --destdir destination directory, followed by the path\n"
"\t-v or --verbose Turn on verbose output\n",
argv[0]);
fprintf(stderr,
"\t-p or --pkgname sets the 'package' name for output files.\n"
"\t If name is ICUDATA, then the default icu package\n"
"\t name will be used.\n"
"\t-t or --touchfile Generate additional small file without packagename, for nmake\n");
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}
if(options[3].doesOccur) {
fprintf(stderr,"makeconv version %hu.%hu, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
fprintf(stderr,"makeconv version %hu.%hu, ICU tool to read .ucm codepage mapping files and write .cnv files\n",
dataInfo.formatVersion[0], dataInfo.formatVersion[1]);
fprintf(stderr, "Copyright (C) 1998-2000, International Business Machines\n");
fprintf(stderr,"Corporation and others. All Rights Reserved.\n");
fprintf(stderr, U_COPYRIGHT_STRING "\n");
exit(0);
}
TOUCHFILE = options[7].doesOccur;
if(!options[6].doesOccur)
{
pkgName=NULL;
}
else
{
pkgName =options[6].value;
if(!strcmp(pkgName, "ICUDATA"))
{
pkgName = U_ICUDATA_NAME;
}
if(pkgName[0] == 0)
{
pkgName = NULL;
if(TOUCHFILE)
{
fprintf(stderr, "%s: Don't use touchfile option with an empty packagename.\n",
argv[0]);
exit(1);
}
}
}
/* get the options values */
haveCopyright = options[2].doesOccur;
destdir = options[4].value;
@ -323,21 +286,6 @@ int main(int argc, char* argv[])
/* the basename without extension is the converter name */
uprv_strcpy(cnvName, outBasename);
if(TOUCHFILE)
{
uprv_strcpy(touchFileName, outBasename);
uprv_strcat(touchFileName, ".cnv");
}
if(pkgName != NULL)
{
/* changes both basename and filename */
uprv_strcpy(outBasename, pkgName);
uprv_strcat(outBasename, "_");
uprv_strcat(outBasename, cnvName);
}
/*Adds the target extension*/
uprv_strcat(outBasename, CONVERTER_FILE_EXTENSION);
@ -381,40 +329,10 @@ int main(int argc, char* argv[])
}
}
if(pkgName == NULL)
{
uprv_strcpy(cnvNameWithPkg, cnvName);
}
else
{
uprv_strcpy(cnvNameWithPkg, pkgName);
uprv_strcat(cnvNameWithPkg, "_");
uprv_strcat(cnvNameWithPkg, cnvName);
}
uprv_strcpy(cnvNameWithPkg, cnvName);
localError = U_ZERO_ERROR;
writeConverterData(&data, cnvNameWithPkg, destdir, &localError);
if(TOUCHFILE)
{
FileStream *q;
char msg[1024];
sprintf(msg, "This empty file tells nmake that %s in package %s has been updated.\n",
cnvName, pkgName);
q = T_FileStream_open(touchFileName, "w");
if(q == NULL)
{
fprintf(stderr, "Error writing touchfile \"%s\"\n", touchFileName);
localError = U_FILE_ACCESS_ERROR;
}
else
{
T_FileStream_write(q, msg, (int32_t)uprv_strlen(msg));
T_FileStream_close(q);
}
}
if(U_FAILURE(localError))
{

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2000-2004, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -76,13 +76,8 @@ void pkg_mode_common(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
sprintf(tmp, "all: $(TARGET)\n\n");
T_FileStream_writeLine(makefile, tmp);
if(!o->embed) {
T_FileStream_writeLine(makefile, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)\n"
"\t$(INVOKE) $(GENCMN) -n $(CNAME) -c -s $(SRCDIR) -d $(TARGETDIR) 0 $(CMNLIST)\n\n");
} else {
T_FileStream_writeLine(makefile, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)\n"
"\t$(INVOKE) $(GENCMN) -n $(CNAME) -c -d $(TARGETDIR) 0 -E $(CMNLIST)\n\n");
}
if(o->hadStdin == FALSE) { /* shortcut */
T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n"

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2000-2005, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -165,13 +165,8 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
T_FileStream_writeLine(makefile, "# 'TOCOBJ' contains C Table of Contents objects [if any]\n");
if(!o->embed) {
sprintf(tmp, "$(TEMP_DIR)/$(NAME)_dat.c: $(CMNLIST)\n"
sprintf(tmp, "$(TEMP_DIR)/$(NAME)_dat.c: $(CMNLIST)\n"
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -s $(SRCDIR) -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
} else {
sprintf(tmp, "$(TEMP_DIR)/$(NAME)_dat.c: $(CMNLIST)\n"
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -E -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
}
T_FileStream_writeLine(makefile, tmp);
sprintf(tmp, "TOCOBJ= $(NAME)_dat%s \n\n", OBJ_SUFFIX);

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2000-2004, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -55,139 +55,128 @@ install: all
void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
{
char tmp[1024], tmp2[1024], srcPath[1024];
char stanza[3072];
char tmp[1024], tmp2[1024], srcPath[1024];
char stanza[3072];
CharList *tail = NULL, *infiles = NULL;
CharList *tail = NULL, *infiles = NULL;
CharList *copyFilesLeft = NULL; /* left hand side of the copy rule*/
CharList *copyFilesRight = NULL; /* rhs "" "" */
CharList *copyFilesInstall = NULL;
CharList *copyFilesLeft = NULL; /* left hand side of the copy rule*/
CharList *copyFilesRight = NULL; /* rhs "" "" */
CharList *copyFilesInstall = NULL;
CharList *copyFilesLeftTail = NULL;
CharList *copyFilesRightTail = NULL;
CharList *copyFilesInstallTail = NULL;
CharList *copyFilesLeftTail = NULL;
CharList *copyFilesRightTail = NULL;
CharList *copyFilesInstallTail = NULL;
CharList *copyDirs = NULL; /* list of dirs to create for copying */
CharList *installDirs = NULL; /* list of dirs to create for installation */
CharList *copyDirs = NULL; /* list of dirs to create for copying */
CharList *installDirs = NULL; /* list of dirs to create for installation */
/* CharList *copyCommands = NULL;*/
/* CharList *copyCommands = NULL;*/
const char *baseName;
const char *baseName;
T_FileStream_writeLine(makefile, "\n.PHONY: $(NAME) all install clean\n\nall: $(NAME)\n\n");
T_FileStream_writeLine(makefile, "\n.PHONY: $(NAME) all install clean\n\nall: $(NAME)\n\n");
if(o->embed) {
infiles = o->filePaths;
} else {
infiles = o->files; /* raw files - no paths other than tree paths */
}
/* Dont' copy files already in tmp */
for(;infiles;infiles = infiles->next)
{
uprv_strcpy(tmp, o->targetDir);
uprv_strcat(tmp, U_FILE_SEP_STRING);
if(o->embed) {
baseName = findBasename(infiles->str);
uprv_strcpy(srcPath, baseName);
} else {
baseName = infiles->str;
uprv_strcat(tmp, o->shortName);
uprv_strcat(tmp, U_FILE_SEP_STRING);
uprv_strcpy(srcPath, "$(SRCDIR)/");
uprv_strcat(srcPath, infiles->str);
}
uprv_strcat(tmp, baseName);
/* Dont' copy files already in tmp */
for(;infiles;infiles = infiles->next)
{
uprv_strcpy(tmp, o->targetDir);
uprv_strcat(tmp, U_FILE_SEP_STRING);
baseName = infiles->str;
uprv_strcat(tmp, o->shortName);
uprv_strcat(tmp, U_FILE_SEP_STRING);
uprv_strcpy(srcPath, "$(SRCDIR)/");
uprv_strcat(srcPath, infiles->str);
uprv_strcat(tmp, baseName);
copyDirs = pkg_appendUniqueDirToList(copyDirs, NULL, tmp);
copyDirs = pkg_appendUniqueDirToList(copyDirs, NULL, tmp);
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
if(strcmp(tmp, infiles->str) == 0)
{
/* fprintf(stderr, "### NOT copying: %s\n", tmp); */
/* no copy needed.. */
} else {
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp, srcPath);
T_FileStream_writeLine(makefile, stanza);
if(strcmp(tmp, infiles->str) == 0)
{
/* fprintf(stderr, "### NOT copying: %s\n", tmp); */
/* no copy needed.. */
} else {
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp, srcPath);
T_FileStream_writeLine(makefile, stanza);
}
uprv_strcpy(tmp2, "$(INSTALLTO)" U_FILE_SEP_STRING);
uprv_strcat(tmp2, o->shortName);
uprv_strcat(tmp2, U_FILE_SEP_STRING);
uprv_strcat(tmp2, baseName);
installDirs = pkg_appendUniqueDirToList(installDirs, NULL, tmp2);
if(strcmp(tmp2, infiles->str) == 0) {
/* fprintf(stderr, "### NOT copying: %s\n", tmp2); */
/* no copy needed.. */
} else {
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp2, tmp);
T_FileStream_writeLine(makefile, stanza);
/* left hand side: target path, target name */
copyFilesLeft = pkg_appendToList(copyFilesLeft, &copyFilesLeftTail, uprv_strdup(tmp));
/* fprintf(stderr, "##### COPY %s from %s\n", tmp, infiles->str); */
/* rhs: source path */
copyFilesRight = pkg_appendToList(copyFilesRight, &copyFilesRightTail, uprv_strdup(infiles->str));
/* install: installed path */
copyFilesInstall = pkg_appendToList(copyFilesInstall, &copyFilesInstallTail, uprv_strdup(tmp2));
}
}
uprv_strcpy(tmp2, "$(INSTALLTO)" U_FILE_SEP_STRING);
if(!o->embed) {
uprv_strcat(tmp2, o->shortName);
uprv_strcat(tmp2, U_FILE_SEP_STRING);
if(o->nooutput || o->verbose) {
CharList *i;
fprintf(stdout, "# Output files: ");
for(i = o->outFiles; i; i=i->next) {
printf("%s ", i->str);
}
printf("\n");
}
uprv_strcat(tmp2, baseName);
installDirs = pkg_appendUniqueDirToList(installDirs, NULL, tmp2);
if(strcmp(tmp2, infiles->str) == 0) {
/* fprintf(stderr, "### NOT copying: %s\n", tmp2); */
/* no copy needed.. */
} else {
sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp2, tmp);
T_FileStream_writeLine(makefile, stanza);
/* left hand side: target path, target name */
copyFilesLeft = pkg_appendToList(copyFilesLeft, &copyFilesLeftTail, uprv_strdup(tmp));
/* fprintf(stderr, "##### COPY %s from %s\n", tmp, infiles->str); */
/* rhs: source path */
copyFilesRight = pkg_appendToList(copyFilesRight, &copyFilesRightTail, uprv_strdup(infiles->str));
/* install: installed path */
copyFilesInstall = pkg_appendToList(copyFilesInstall, &copyFilesInstallTail, uprv_strdup(tmp2));
if(o->nooutput) {
*status = U_ZERO_ERROR;
return;
}
}
if(o->nooutput || o->verbose) {
CharList *i;
fprintf(stdout, "# Output files: ");
for(i = o->outFiles; i; i=i->next) {
printf("%s ", i->str);
}
printf("\n");
}
if(o->nooutput) {
*status = U_ZERO_ERROR;
return;
}
/* these are also the files to delete */
T_FileStream_writeLine(makefile, "COPIEDDEST= ");
pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
T_FileStream_writeLine(makefile, "INSTALLEDDEST= ");
pkg_writeCharListWrap(makefile, copyFilesInstall, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
T_FileStream_writeLine(makefile, "COPYDIRS= ");
pkg_writeCharListWrap(makefile, copyDirs, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
T_FileStream_writeLine(makefile, "INSTALLDIRS= ");
pkg_writeCharListWrap(makefile, installDirs, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
if(copyFilesRight != NULL)
{
T_FileStream_writeLine(makefile, "$(NAME): copy-dirs $(COPIEDDEST)\n\n");
T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)");
/* these are also the files to delete */
T_FileStream_writeLine(makefile, "COPIEDDEST= ");
pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
}
else
{
T_FileStream_writeLine(makefile, "clean:\n\n");
}
T_FileStream_writeLine(makefile, "install: install-dirs $(INSTALLEDDEST)\n\n");
T_FileStream_writeLine(makefile, "install-dirs:\n\t$(MKINSTALLDIRS) $(INSTALLDIRS)\n\n");
T_FileStream_writeLine(makefile, "copy-dirs:\n\t$(MKINSTALLDIRS) $(COPYDIRS)\n\n");
T_FileStream_writeLine(makefile, "INSTALLEDDEST= ");
pkg_writeCharListWrap(makefile, copyFilesInstall, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
T_FileStream_writeLine(makefile, "COPYDIRS= ");
pkg_writeCharListWrap(makefile, copyDirs, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
T_FileStream_writeLine(makefile, "INSTALLDIRS= ");
pkg_writeCharListWrap(makefile, installDirs, " ", " \\\n", 0);
T_FileStream_writeLine(makefile, "\n\n");
if(copyFilesRight != NULL)
{
T_FileStream_writeLine(makefile, "$(NAME): copy-dirs $(COPIEDDEST)\n\n");
T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)");
T_FileStream_writeLine(makefile, "\n\n");
}
else
{
T_FileStream_writeLine(makefile, "clean:\n\n");
}
T_FileStream_writeLine(makefile, "install: install-dirs $(INSTALLEDDEST)\n\n");
T_FileStream_writeLine(makefile, "install-dirs:\n\t$(MKINSTALLDIRS) $(INSTALLDIRS)\n\n");
T_FileStream_writeLine(makefile, "copy-dirs:\n\t$(MKINSTALLDIRS) $(COPYDIRS)\n\n");
}

View File

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright (C) 2000-2005, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
***************************************************************************
@ -271,14 +271,12 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects,
CharList *infiles;
CharList *parents = NULL, *commands = NULL;
int32_t genFileOffset = 0; /* offset from beginning of .c and .o file name, use to chop off package name for AS/400 */
static int serNo = 0; /* counter for numeric file names */
char serName[100];
char *parentPath;
const char *tchar;
char tree[1024];
if(o->embed) {
infiles = o->filePaths;
} else {
infiles = o->files; /* raw files - no paths other than tree paths */
}
infiles = o->files; /* raw files - no paths other than tree paths */
#if defined (OS400)
if(infiles != NULL) {
@ -291,36 +289,26 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects,
#endif
for(;infiles;infiles = infiles->next) {
if(o->embed) {
baseName = findBasename(infiles->str);
} else {
baseName = infiles->str; /* skip the icudt28b/ part */
}
baseName = infiles->str; /* skip the icudt28b/ part */
p = uprv_strrchr(baseName, '.');
if( (p == NULL) || (*p == '\0' ) ) {
continue;
}
if(o->numeric) {
sprintf(serName, "t%04x", serNo++);
uprv_strcpy(tmp,serName);
uprv_strcat(tmp, objSuffix);
} else {
uprv_strncpy(tmp, baseName, p-baseName);
p++;
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
uprv_strcat(tmp, p);
uprv_strcat(tmp, objSuffix );
/* iSeries cannot have '-' in the .o objects. */
for( tmpPtr = tmp; *tmpPtr; tmpPtr++ ) {
if ( *tmpPtr == U_FILE_SEP_CHAR ) { /* map tree names with underscores */
*tmpPtr = '_';
}
if ( *tmpPtr == '-' ) {
*tmpPtr = '_';
}
uprv_strncpy(tmp, baseName, p-baseName);
p++;
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
uprv_strcat(tmp, p);
uprv_strcat(tmp, objSuffix );
/* iSeries cannot have '-' in the .o objects. */
for( tmpPtr = tmp; *tmpPtr; tmpPtr++ ) {
if ( *tmpPtr == U_FILE_SEP_CHAR ) { /* map tree names with underscores */
*tmpPtr = '_';
}
if ( *tmpPtr == '-' ) {
*tmpPtr = '_';
}
}
@ -331,20 +319,12 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects,
uprv_strcpy(cfile+uprv_strlen(cfile)-uprv_strlen(objSuffix), ".c" ); /* replace .o with .c */
/* Make up parents.. */
if(!o->embed) {
char *parentPath;
parentPath = uprv_malloc(1+uprv_strlen(baseName) + uprv_strlen("$(SRCDIR)/"));
sprintf(parentPath, "$(SRCDIR)/%s", baseName);
parents = pkg_appendToList(parents, NULL, parentPath);
} else {
parents = pkg_appendToList(parents, NULL, uprv_strdup(infiles->str));
}
parentPath = uprv_malloc(1+uprv_strlen(baseName) + uprv_strlen("$(SRCDIR)/"));
sprintf(parentPath, "$(SRCDIR)/%s", baseName);
parents = pkg_appendToList(parents, NULL, parentPath);
/* make up commands.. */
if(!o->embed) {
/* search for tree.. */
const char *tchar;
char tree[1024];
if((tchar=uprv_strchr(baseName, '/'))) {
tree[0]='_';
strncpy(tree+1,baseName,tchar-baseName);
@ -357,18 +337,8 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects,
#else
sprintf(stanza, "$(INVOKE) $(GENCCODE) -n $(CNAME)%s -d $(TEMP_DIR) $<", tree);
#endif
} else {
#ifdef OS400
sprintf(stanza, "$(INVOKE) $(GENCCODE) -d $(TEMP_DIR) %s", infiles->str);
#else
sprintf(stanza, "$(INVOKE) $(GENCCODE) -d $(TEMP_DIR) $<");
#endif
}
if(o->numeric) {
strcat(stanza, " -f ");
strcat(stanza,serName);
} else if(!o->embed && uprv_strchr(baseName, '/')) {
if(uprv_strchr(baseName, '/')) {
/* append actual file - ex: coll_en_res otherwise the tree name will be lost */
strcat(stanza, " -f ");
strncat(stanza, tmp, (strlen(tmp)-strlen(objSuffix)));
@ -421,11 +391,7 @@ pkg_mak_writeAssemblyHeader(FileStream *f, const UPKGOptions *o)
T_FileStream_writeLine(f, "BASE_OBJECTS=$(NAME)_dat.o\n");
T_FileStream_writeLine(f, "\n");
T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME).dat: $(CMNLIST) $(DATAFILEPATHS)\n");
if(!o->embed) {
T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -s $(SRCDIR) -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n");
} else {
T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -E -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n");
}
T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -s $(SRCDIR) -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n");
T_FileStream_writeLine(f, "\n");
T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME)_dat.o : $(TEMP_DIR)/$(NAME).dat\n");
T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCCODE) $(GENCCODE_ASSEMBLY) -n $(NAME) -e $(ENTRYPOINT) -d $(TEMP_DIR) $<\n");

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2000-2005, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -72,6 +72,30 @@ static struct
#endif /*#ifdef U_MAKE_IS_NMAKE*/
};
enum {
NAME,
BLDOPT,
MODE,
HELP,
HELP_QUESTION_MARK,
VERBOSE,
COPYRIGHT,
COMMENT,
DESTDIR,
CLEAN,
NOOUTPUT,
REBUILD,
TEMPDIR,
INSTALL,
SOURCEDIR,
ENTRYPOINT,
REVISION,
MAKEARG,
FORCE_PREFIX,
LIBNAME,
QUIET
};
static UOption options[]={
/*00*/ UOPTION_DEF( "name", 'p', UOPT_REQUIRES_ARG),
/*01*/ UOPTION_DEF( "bldopt", 'O', UOPT_REQUIRES_ARG), /* on Win32 it is release or debug */
@ -90,12 +114,10 @@ static UOption options[]={
/*14*/ UOPTION_SOURCEDIR ,
/*15*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG),
/*16*/ UOPTION_DEF( "revision", 'r', UOPT_REQUIRES_ARG),
/*17*/ UOPTION_DEF( 0, 'M', UOPT_REQUIRES_ARG),
/*17*/ UOPTION_DEF( "makearg", 'M', UOPT_REQUIRES_ARG),
/*18*/ UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG),
/*19*/ UOPTION_DEF( "numerictmp", 'N', UOPT_NO_ARG),
/*20*/ UOPTION_DEF( "embed", 'E', UOPT_NO_ARG),
/*21*/ UOPTION_DEF( "libname", 'L', UOPT_REQUIRES_ARG),
/*22*/ UOPTION_DEF( "quiet", 'q', UOPT_NO_ARG)
/*19*/ UOPTION_DEF( "libname", 'L', UOPT_REQUIRES_ARG),
/*20*/ UOPTION_DEF( "quiet", 'q', UOPT_NO_ARG)
};
const char options_help[][320]={
@ -122,8 +144,6 @@ const char options_help[][320]={
"Specify a version when packaging in DLL or static mode",
"Pass the next argument to make(1)",
"Add package to all file names if not present",
"Use short numeric temporary file names such as t1234.c",
"Use Embedded paths (such as 'mypackage_') - for compatibility.",
"Library name to build (if different than package name)",
"Quite mode. (e.g. Do not output a readme file for static libraries)"
};
@ -144,8 +164,8 @@ main(int argc, char* argv[]) {
progname = argv[0];
options[2].value = "common";
options[17].value = "";
options[MODE].value = "common";
options[MAKEARG].value = "";
/* read command line options */
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
@ -154,7 +174,7 @@ main(int argc, char* argv[]) {
/* I've decided to simply print an error and quit. This tool has too
many options to just display them all of the time. */
if(options[3].doesOccur || options[4].doesOccur) {
if(options[HELP].doesOccur || options[HELP_QUESTION_MARK].doesOccur) {
needsHelp = TRUE;
}
else {
@ -167,7 +187,7 @@ main(int argc, char* argv[]) {
return 1;
}
if(!options[1].doesOccur) {
if(!options[BLDOPT].doesOccur) {
/* Try to fill in from icu-config or equivalent */
fillInMakefileFromICUConfig(&options[1]);
}
@ -179,13 +199,13 @@ main(int argc, char* argv[]) {
}
#endif
if(!options[1].doesOccur) {
if(!options[BLDOPT].doesOccur) {
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(!options[0].doesOccur) /* -O we already have - don't report it. */
if(!options[NAME].doesOccur) /* -O we already have - don't report it. */
{
fprintf(stderr, " required parameter -p is missing \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
@ -234,9 +254,9 @@ main(int argc, char* argv[]) {
/* OK, fill in the options struct */
uprv_memset(&o, 0, sizeof(o));
o.mode = options[2].value;
o.version = options[16].doesOccur ? options[16].value : 0;
o.makeArgs = options[17].value;
o.mode = options[MODE].value;
o.version = options[REVISION].doesOccur ? options[REVISION].value : 0;
o.makeArgs = options[MAKEARG].value;
o.fcn = NULL;
@ -274,24 +294,24 @@ main(int argc, char* argv[]) {
o.cShortName = csname;
}
if(options[21].doesOccur) { /* get libname from shortname, or explicit -L parameter */
o.libName = options[21].value;
if(options[LIBNAME].doesOccur) { /* get libname from shortname, or explicit -L parameter */
o.libName = options[LIBNAME].value;
} else {
o.libName = o.shortName;
}
if(options[22].doesOccur) {
if(options[QUIET].doesOccur) {
o.quiet = TRUE;
} else {
o.quiet = FALSE;
}
o.verbose = options[5].doesOccur;
o.verbose = options[VERBOSE].doesOccur;
#ifdef U_MAKE_IS_NMAKE /* format is R:pathtoICU or D:pathtoICU */
{
char *pathstuff = (char *)options[1].value;
if(options[1].value[uprv_strlen(options[1].value)-1] == '\\') {
pathstuff[uprv_strlen(options[1].value)-1] = '\0';
char *pathstuff = (char *)options[BLDOPT].value;
if(options[1].value[uprv_strlen(options[BLDOPT].value)-1] == '\\') {
pathstuff[uprv_strlen(options[BLDOPT].value)-1] = '\0';
}
if(*pathstuff == PKGDATA_DERIVED_PATH || *pathstuff == 'R' || *pathstuff == 'D') {
o.options = pathstuff;
@ -314,48 +334,42 @@ main(int argc, char* argv[]) {
}
}
#else /* on UNIX, we'll just include the file... */
o.options = options[1].value;
o.options = options[BLDOPT].value;
#endif
if(options[6].doesOccur) {
if(options[COPYRIGHT].doesOccur) {
o.comment = U_COPYRIGHT_STRING;
} else if (options[7].doesOccur) {
o.comment = options[7].value;
} else if (options[COMMENT].doesOccur) {
o.comment = options[COMMENT].value;
}
if( options[8].doesOccur ) {
o.targetDir = options[8].value;
if( options[DESTDIR].doesOccur ) {
o.targetDir = options[DESTDIR].value;
} else {
o.targetDir = "."; /* cwd */
}
o.clean = options[9].doesOccur;
o.nooutput = options[10].doesOccur;
o.rebuild = options[11].doesOccur;
o.numeric = options[19].doesOccur;
if(o.numeric) {
o.rebuild = TRUE; /* force rebuild if numeric */
}
o.clean = options[CLEAN].doesOccur;
o.nooutput = options[NOOUTPUT].doesOccur;
o.rebuild = options[REBUILD].doesOccur;
o.embed = options[20].doesOccur;
if( options[12].doesOccur ) {
o.tmpDir = options[12].value;
if( options[TEMPDIR].doesOccur ) {
o.tmpDir = options[TEMPDIR].value;
} else {
o.tmpDir = o.targetDir;
}
if( options[13].doesOccur ) {
o.install = options[13].value;
if( options[INSTALL].doesOccur ) {
o.install = options[INSTALL].value;
}
if( options[14].doesOccur ) {
o.srcDir = options[14].value;
if( options[SOURCEDIR].doesOccur ) {
o.srcDir = options[SOURCEDIR].value;
} else {
o.srcDir = ".";
}
if( options[15].doesOccur ) {
o.entryName = options[15].value;
if( options[ENTRYPOINT].doesOccur ) {
o.entryName = options[ENTRYPOINT].value;
} else {
o.entryName = o.cShortName;
}
@ -491,19 +505,9 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
char *linePtr, *lineNext;
const uint32_t lineMax = 16300;
char tmp[1024];
char pkgPrefix[1024];
int32_t pkgPrefixLen;
const char *baseName;
char *s;
int32_t ln=0; /* line number */
UBool fixPrefix;
fixPrefix = options[18].doesOccur;
strcpy(pkgPrefix, o->shortName);
strcat(pkgPrefix, "_");
pkgPrefixLen=(int32_t)uprv_strlen(pkgPrefix);
for(l = o->fileListFiles; l; l = l->next) {
if(o->verbose) {
fprintf(stdout, "# Reading %s..\n", l->str);
@ -518,100 +522,75 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
}
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) { /* for each line */
if((ln == 0) && (!o->embed)) {
/* determine if we need to run in 'embed' (compatibility) mode */
if(!strncmp(findBasename(line), pkgPrefix, pkgPrefixLen)) {
fprintf(stderr, "Warning: Found path '%s' in file name. Assuming compatibility (-E) mode.\n", pkgPrefix);
o->embed = 1;
ln++;
if(uprv_strlen(line)>lineMax) {
fprintf(stderr, "%s:%d - line too long (over %d chars)\n", l->str, (int)ln, (int)lineMax);
exit(1);
}
}
ln++;
if(uprv_strlen(line)>lineMax) {
fprintf(stderr, "%s:%d - line too long (over %d chars)\n", l->str, (int)ln, (int)lineMax);
exit(1);
}
/* remove spaces at the beginning */
linePtr = line;
while(isspace(*linePtr)) {
linePtr++;
}
s=linePtr;
/* remove trailing newline characters */
while(*s!=0) {
if(*s=='\r' || *s=='\n') {
*s=0;
break;
/* remove spaces at the beginning */
linePtr = line;
while(isspace(*linePtr)) {
linePtr++;
}
++s;
}
if((*linePtr == 0) || (*linePtr == '#')) {
continue; /* comment or empty line */
}
/* Now, process the line */
lineNext = NULL;
while(linePtr && *linePtr) { /* process space-separated items */
while(*linePtr == ' ') {
linePtr++;
}
/* Find the next quote */
if(linePtr[0] == '"')
{
lineNext = uprv_strchr(linePtr+1, '"');
if(lineNext == NULL) {
fprintf(stderr, "%s:%d - missing trailing double quote (\")\n",
l->str, (int)ln);
exit(1);
} else {
lineNext++;
if(*lineNext) {
if(*lineNext != ' ') {
fprintf(stderr, "%s:%d - malformed quoted line at position %d, expected ' ' got '%c'\n",
l->str, (int)ln, (int)(lineNext-line), (*lineNext)?*lineNext:'0');
exit(1);
}
*lineNext = 0;
lineNext++;
}
s=linePtr;
/* remove trailing newline characters */
while(*s!=0) {
if(*s=='\r' || *s=='\n') {
*s=0;
break;
}
} else {
lineNext = uprv_strchr(linePtr, ' ');
if(lineNext) {
*lineNext = 0; /* terminate at space */
lineNext++;
}
++s;
}
/* add the file */
s = (char*)getLongPathname(linePtr);
if(o->embed == 0) {
/* normal mode.. o->files is just the bare list without package names */
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(linePtr));
uprv_strcpy(tmp, o->srcDir);
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
uprv_strcat(tmp, s);
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
} else {/* embedded package_ mode */
baseName = findBasename(s);
if(s != baseName) {
/* s was something 'long' with a path */
/* paths already have the prefix */
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(baseName));
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(s));
} else { /* s was just a basename, we want to prepend source dir*/
/* check for prefix of package */
if((*linePtr == 0) || (*linePtr == '#')) {
continue; /* comment or empty line */
}
/* Now, process the line */
lineNext = NULL;
while(linePtr && *linePtr) { /* process space-separated items */
while(*linePtr == ' ') {
linePtr++;
}
/* Find the next quote */
if(linePtr[0] == '"')
{
lineNext = uprv_strchr(linePtr+1, '"');
if(lineNext == NULL) {
fprintf(stderr, "%s:%d - missing trailing double quote (\")\n",
l->str, (int)ln);
exit(1);
} else {
lineNext++;
if(*lineNext) {
if(*lineNext != ' ') {
fprintf(stderr, "%s:%d - malformed quoted line at position %d, expected ' ' got '%c'\n",
l->str, (int)ln, (int)(lineNext-line), (*lineNext)?*lineNext:'0');
exit(1);
}
*lineNext = 0;
lineNext++;
}
}
} else {
lineNext = uprv_strchr(linePtr, ' ');
if(lineNext) {
*lineNext = 0; /* terminate at space */
lineNext++;
}
}
/* add the file */
s = (char*)getLongPathname(linePtr);
/* normal mode.. o->files is just the bare list without package names */
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(linePtr));
uprv_strcpy(tmp, o->srcDir);
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(baseName));
uprv_strcat(tmp, s);
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
}
} /* end compatibility mode */
linePtr = lineNext;
} /* for each entry on line */
linePtr = lineNext;
} /* for each entry on line */
} /* for each line */
T_FileStream_close(in);
} /* for each file list file */

View File

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright (C) 2000-2005, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
***************************************************************************
@ -130,10 +130,7 @@ typedef struct UPKGOptions_
UBool verbose;
UBool quiet;
UBool hadStdin; /* Stdin was a dependency - don't make anything depend on the file list coming in. */
UBool numeric; /* use numeric, short, temporary file names */
int32_t embed; /* embedded package - i.e. .../mypkg_myfile.res files */
UPKGMODE *fcn; /* Handler function */
} UPKGOptions;

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2002-2004, International Business Machines
* Copyright (C) 2002-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -204,13 +204,8 @@ void pkg_mode_static(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
T_FileStream_writeLine(makefile, "# 'TOCOBJ' contains C Table of Contents objects [if any]\n");
if(!o->embed) {
sprintf(tmp, "$(TEMP_PATH)$(NAME)_dat.c: $(CMNLIST)\n"
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -s $(SRCDIR) -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
} else {
sprintf(tmp, "$(TEMP_PATH)$(NAME)_dat.c: $(CMNLIST)\n"
"\t$(INVOKE) $(GENCMN) -e $(ENTRYPOINT) -n $(NAME) -S -E -d $(TEMP_DIR) 0 $(CMNLIST)\n\n");
}
T_FileStream_writeLine(makefile, tmp);
sprintf(tmp, "TOCOBJ= $(NAME)_dat.$(STATIC_O)\n\n");

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2000-2004, International Business Machines
* Copyright (C) 2000-2006, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -40,19 +40,13 @@ void writeCmnRules(UPKGOptions *o, FileStream *makefile)
char tmp[1024];
CharList *infiles;
if(!o->embed) {
infiles = o->files;
} else {
infiles = o->filePaths;
}
infiles = o->files;
sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n"
"\t%s\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" %s %s -n \"$(NAME)\" 0 <<\n",
"\t%s\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" -s \"$(SRCDIR)\" -n \"$(NAME)\" 0 <<\n",
(o->verbose ? "" : "@"),
(o->comment ? "-C \"" : ""),
(o->comment ? o->comment : ""),
(o->comment ? "\" " : ""),
(o->embed ? "-E" : ""),
o->embed ? "" : "-s \"$(SRCDIR)\"");
(o->comment ? "\" " : ""));
T_FileStream_writeLine(makefile, tmp);
pkg_writeCharList(makefile, infiles, "\n", -1);