ICU-2487 cygwin/windows fixes for multiple trees

X-SVN-Rev: 15024
This commit is contained in:
Steven R. Loomis 2004-04-22 23:27:20 +00:00
parent bcab367805
commit ce3c8007e8
6 changed files with 66 additions and 19 deletions

View File

@ -1285,6 +1285,9 @@ UBool putil_cleanup(void)
U_CAPI void U_EXPORT2
u_setDataDirectory(const char *directory) {
char *newDataDir;
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
char *p;
#endif
int32_t length;
if(directory==NULL) {
@ -1294,6 +1297,12 @@ u_setDataDirectory(const char *directory) {
newDataDir = (char *)uprv_malloc(length + 2);
uprv_strcpy(newDataDir, directory);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
while(p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) {
*p = U_FILE_SEP_CHAR;
}
#endif
umtx_lock(NULL);
if (gDataDirectory) {
uprv_free(gDataDirectory);
@ -1312,11 +1321,14 @@ uprv_pathIsAbsolute(const char *path)
if(*path == U_FILE_SEP_CHAR) {
return TRUE;
}
#if defined(WIN32)
if(*path == '/') {
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
if(*path == U_FILE_ALT_SEP_CHAR) {
return TRUE;
}
#endif
#if defined(WIN32)
if( (((path[0] >= 'A') && (path[0] <= 'Z')) ||
((path[0] >= 'a') && (path[0] <= 'z'))) &&
path[1] == ':' ) {

View File

@ -634,8 +634,7 @@ static const char *udata_pathiter_next(UDataPathIterator *iter, int32_t *outPath
}
else
{ /* regular dir path */
if(iter->pathBuffer[pathLen-1] != U_FILE_SEP_CHAR) /* trailing sep */
{
if(iter->pathBuffer[pathLen-1] != U_FILE_SEP_CHAR) {
if((pathLen>=4) &&
uprv_strncmp(iter->pathBuffer+(pathLen-4), ".dat", 4) == 0)
{
@ -1067,6 +1066,9 @@ doOpenChoice(const char *path, const char *type, const char *name,
TinyString pkgName;
TinyString treeName;
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
TinyString altSepPath;
#endif
const char *dataPath;
@ -1085,6 +1087,25 @@ doOpenChoice(const char *path, const char *type, const char *name,
isICUData= (UBool)(path==NULL ? TRUE : (!uprv_strncmp(path,U_ICUDATA_NAME U_TREE_SEPARATOR_STRING, uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING))));
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
/* remap from alternate path char to the main one */
TinyString_init(&altSepPath);
if(path) {
char *p;
if((p=uprv_strchr(path,U_FILE_ALT_SEP_CHAR))) {
TinyString_append(&altSepPath, path);
while((p=uprv_strchr(altSepPath.s,U_FILE_ALT_SEP_CHAR))) {
*p = U_FILE_SEP_CHAR;
}
#if defined (UDATA_DEBUG)
fprintf(stderr, "Changed path from [%s] to [%s]\n", path, altSepPath.s);
#endif
path = altSepPath.s;
}
}
#endif
TinyString_init(&oldIndFileName);
TinyString_init(&tocEntryName);
TinyString_init(&tocEntryPath);
@ -1384,6 +1405,9 @@ commonReturn:
TinyString_dt(&oldStylePathBasename);
TinyString_dt(&pkgName);
TinyString_dt(&treeName);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
TinyString_dt(&altSepPath);
#endif
return retVal;
}

View File

@ -242,7 +242,14 @@ main(int argc, char* argv[]) {
}
/* add the file */
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
char *t;
while((t = uprv_strchr(line,U_FILE_ALT_SEP_CHAR))) {
*t = U_FILE_SEP_CHAR;
}
}
#endif
addFile(getLongPathname(line), sourceTOC, verbose);
}
@ -385,8 +392,8 @@ main(int argc, char* argv[]) {
/* test for NULL */
if (symPrefix == NULL) {
sprintf(buffer, "U_MEMORY_ALLOCATION_ERROR");
exit(U_MEMORY_ALLOCATION_ERROR);
sprintf(buffer, "U_MEMORY_ALLOCATION_ERROR");
exit(U_MEMORY_ALLOCATION_ERROR);
}
uprv_strcpy(symPrefix, entrypointName);

View File

@ -33,6 +33,12 @@ char linebuf[2048];
void
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
{
const char *appendVersion = NULL;
if(o->version && !uprv_strstr(o->shortName,o->version)) { /* do not append version if
already contained in the name */
appendVersion = o->version;
}
sprintf(linebuf, "## Makefile for %s (%s) created by pkgdata\n"
"## from ICU Version %s\n"
"\n",
@ -52,7 +58,7 @@ pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
"TARGET_VERSION=%s\n"
"\n\n\n",
o->shortName,
(o->version ? o->version : ""),
(appendVersion ? appendVersion : ""),
o->cShortName,
o->srcDir,
o->targetDir,
@ -60,7 +66,7 @@ pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
o->mode,
o->makeFile,
o->entryName,
(o->version ? o->version : ""));
(appendVersion ? appendVersion : ""));
T_FileStream_writeLine(f, linebuf);
sprintf(linebuf, "## List files [%d] containing data files to process (note: - means stdin)\n"

View File

@ -606,17 +606,13 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
}
} else if(o->embed == 0) {
/* Normal mode Assume ALL paths are relative to srcdir */
uprv_strcpy(tmp, o->shortName);
uprv_strcat(tmp, U_TREE_SEPARATOR_STRING);
uprv_strcat(tmp, linePtr);
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(tmp));
/* 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 {/* compatibliity mode */
} else {/* embedded package_ mode */
baseName = findBasename(s);
if(s != baseName) {

View File

@ -40,17 +40,19 @@ void writeCmnRules(UPKGOptions *o, FileStream *makefile)
char tmp[1024];
CharList *infiles;
if(o->compatMode) {
if(!o->embed) {
infiles = o->files;
} else {
infiles = o->filePaths;
}
sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n"
"\t@\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" %s -n \"$(NAME)\" 0 <<\n",
"\t%s\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" %s %s -n \"$(NAME)\" 0 <<\n",
(o->verbose ? "" : "@"),
(o->comment ? "-C \"" : ""),
(o->comment ? o->comment : ""),
(o->comment ? "\" " : ""),
(o->embed ? "-E" : ""));
(o->embed ? "-E" : ""),
o->embed ? "" : "-s \"$(SRCDIR)\"");
T_FileStream_writeLine(makefile, tmp);
pkg_writeCharList(makefile, infiles, "\n", -1);