diff --git a/icu4c/source/tools/genccode/genccode.8.in b/icu4c/source/tools/genccode/genccode.8.in index 6632628d50..45f1993129 100644 --- a/icu4c/source/tools/genccode/genccode.8.in +++ b/icu4c/source/tools/genccode/genccode.8.in @@ -2,9 +2,9 @@ .\" .\" genccode.8: manual page for the gennames utility .\" -.\" Copyright (C) 2000 IBM, Inc. and others. +.\" Copyright (C) 2003 IBM, Inc. and others. .\" -.TH GENCCODE 8 "19 November 2001" "ICU MANPAGE" "ICU @VERSION@ Manual" +.TH GENCCODE 8 "17 July 2003" "ICU MANPAGE" "ICU @VERSION@ Manual" .SH NAME .B genccode \- generate C code from an ICU data file @@ -23,6 +23,9 @@ .BI "\-e\fP, \fB\-\-entrypoint" " name" ] [ +.BI "\-f\fP, \fB\-\-filename" " name" +] +[ .IR filename " .\|.\|." ] .SH DESCRIPTION @@ -66,6 +69,11 @@ indicated big endian data, and the letter .I l indicates little endian ones). .TP +.BI "\-f\fP, \fB\-\-filename" " name" +Normally, an ICU data file such as mydata.icu will be turned into mydata_icu.c and mydata_icu.o. +However, if this parameter was set to "somedata", the output files will be somedata.o and +somedata.c, respectively. +.TP .BI "\-e\fP, \fB\-\-entrypoint" " name" Set the data entry point (used for linking against the data in a shared library form) to @@ -78,4 +86,4 @@ option). .SH VERSION @VERSION@ .SH COPYRIGHT -Copyright (C) 2000-2001 IBM, Inc. and others. +Copyright (C) 2000-2003 IBM, Inc. and others. diff --git a/icu4c/source/tools/genccode/genccode.c b/icu4c/source/tools/genccode/genccode.c index 6b9fc1663a..7256434905 100644 --- a/icu4c/source/tools/genccode/genccode.c +++ b/icu4c/source/tools/genccode/genccode.c @@ -81,16 +81,28 @@ write8str(FileStream *out, uint8_t byte); #endif /* -------------------------------------------------------------------------- */ +enum { + kOptHelpH = 0, + kOptHelpQuestionMark, + kOptDestDir, + kOptName, + kOptEntryPoint, +#ifdef CAN_GENERATE_OBJECTS + kOptObject, +#endif + kOptFilename +}; + static UOption options[]={ /*0*/UOPTION_HELP_H, UOPTION_HELP_QUESTION_MARK, UOPTION_DESTDIR, UOPTION_DEF("name", 'n', UOPT_REQUIRES_ARG), - UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG) + UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG), #ifdef CAN_GENERATE_OBJECTS -/*5*/, UOPTION_DEF("object", 'o', UOPT_NO_ARG) +/*5*/, UOPTION_DEF("object", 'o', UOPT_NO_ARG), #endif - + UOPTION_DEF("filename", 'f', UOPT_REQUIRES_ARG) }; char symPrefix[100]; @@ -101,7 +113,7 @@ main(int argc, char* argv[]) { U_MAIN_INIT_ARGS(argc, argv); - options[2].value = "."; + options[kOptDestDir].value = "."; /* read command line options */ argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); @@ -114,7 +126,7 @@ main(int argc, char* argv[]) { "error in command line argument \"%s\"\n", argv[-argc]); } - if(argc<0 || options[0].doesOccur || options[1].doesOccur) { + if(argc<0 || options[kOptHelpH].doesOccur || options[kOptHelpQuestionMark].doesOccur) { fprintf(stderr, "usage: %s [-options] filename1 filename2 ...\n" "\tread each binary input file and \n" @@ -128,12 +140,13 @@ main(int argc, char* argv[]) { #ifdef CAN_GENERATE_OBJECTS "\t-o or --object write a .obj file instead of .c\n" #endif + "\t-f or --filename Specify an alternate base filename. (default: symbolname_typ)\n" , argv[0]); } else { const char *message, *filename; void (*writeCode)(const char *, const char *); #ifdef CAN_GENERATE_OBJECTS - if(options[5].doesOccur) { + if(options[kOptObject].doesOccur) { message="generating object code for %s\n"; writeCode=&writeObjectCode; } else @@ -148,7 +161,7 @@ main(int argc, char* argv[]) { fprintf(stdout, message, filename); } column=MAX_COLUMN; - writeCode(filename, options[2].value); + writeCode(filename, options[kOptDestDir].value); } } @@ -285,8 +298,8 @@ writeObjectCode(const char *filename, const char *destdir) { entry[0]='_'; getOutFilename(filename, destdir, buffer, entry+ICU_ENTRY_OFFSET, ".obj"); - if(options[4].doesOccur) { - uprv_strcpy(entry+ICU_ENTRY_OFFSET, options[4].value); + if(options[kOptEntryPoint].doesOccur) { + uprv_strcpy(entry+ICU_ENTRY_OFFSET, options[kOptEntryPoint].value); uprv_strcat(entry, "_dat"); } /* turn dashes in the entry name into underscores */ @@ -404,9 +417,14 @@ getOutFilename(const char *inFilename, const char *destdir, char *outFilename, c if(suffix==NULL) { /* the filename does not have a suffix */ uprv_strcpy(entryName, inFilename); - uprv_strcpy(outFilename, inFilename); + if(options[kOptFilename].doesOccur) { + uprv_strcpy(outFilename, options[kOptFilename].value); + } else { + uprv_strcpy(outFilename, inFilename); + } uprv_strcat(outFilename, newSuffix); } else { + const char *saveOutFilename = outFilename; /* copy basename */ while(inFilenamefilePaths; @@ -171,17 +173,23 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, continue; } - 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 == '-' ) { - *tmpPtr = '_'; + 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 == '-' ) { + *tmpPtr = '_'; + } } } @@ -196,6 +204,12 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, /* make up commands.. */ sprintf(stanza, "@$(INVOKE) $(GENCCODE) -n $(ENTRYPOINT) -d $(TEMP_DIR) $<"); + + if(o->numeric) { + strcat(stanza, " -f "); + strcat(stanza,serName); + } + commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza)); if(genFileOffset > 0) { /* for AS/400 */ diff --git a/icu4c/source/tools/pkgdata/pkgdata.1.in b/icu4c/source/tools/pkgdata/pkgdata.1.in index 1c3eb7f371..b8b68a577c 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.1.in +++ b/icu4c/source/tools/pkgdata/pkgdata.1.in @@ -2,7 +2,7 @@ .\" .\" pkgdata.1: manual page for the pkgdata utility .\" -.\" Copyright (C) 2000-2002 IBM, Inc. and others. +.\" Copyright (C) 2000-2003 IBM, Inc. and others. .\" .\" Manual page by Yves Arrouye . .\" Modified by Steven R. Loomis . @@ -51,6 +51,9 @@ .BI "\-n\fP, \fB\-\-nooutput" ] [ +.BI "\-N\fP, \fB\-\-numaric" +] +[ .BI "\-s\fP, \fB\-\-sourcedir" " source" ] [ @@ -250,6 +253,12 @@ is set it will be used for installation. .BI "\-n\fP, \fB\-\-nooutput" Do not produce any output but simply a list of affected files. .TP +.BI "\-N\fP, \fB\-\-numeric" +Instead of using temporary filenames similar to the input symbols, use numeric filenames such +as t0002.c, etc. May be needed for systems which don't allow many similar long filenames, or +for systems that tend to run out of argument space. Note, using this option +implies "\-F\fP, \fB\-\-rebuild" - all packaging will be rebuilt every time pkgdata is run. +.TP .BI "\-s\fP, \fB\-\-sourcedir" " source" Set the source directory to .IR source . @@ -275,5 +284,5 @@ Yves Arrouye .SH VERSION @VERSION@ .SH COPYRIGHT -Copyright (C) 2000-2002 IBM, Inc. and others. +Copyright (C) 2000-2003 IBM, Inc. and others. diff --git a/icu4c/source/tools/pkgdata/pkgdata.c b/icu4c/source/tools/pkgdata/pkgdata.c index 2427c4fc08..5a5ad1121a 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.c +++ b/icu4c/source/tools/pkgdata/pkgdata.c @@ -83,7 +83,8 @@ static UOption options[]={ /*15*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG), /*16*/ UOPTION_DEF( "revision", 'r', UOPT_REQUIRES_ARG), /*17*/ UOPTION_DEF( 0, 'M', UOPT_REQUIRES_ARG), - /*18*/ UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG) + /*18*/ UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG), + /*19*/ UOPTION_DEF( "numerictmp", 'N', UOPT_NO_ARG) }; const char options_help[][160]={ @@ -109,7 +110,8 @@ const char options_help[][160]={ "Specify a custom entrypoint name (default: short name)", "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" + "Add package to all file names if not present", + "Use short numeric temporary file names such as t1234.c" }; const char *progname = "PKGDATA"; @@ -293,6 +295,12 @@ main(int argc, char* argv[]) { 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 */ + } + + if( options[12].doesOccur ) { o.tmpDir = options[12].value; } else { diff --git a/icu4c/source/tools/pkgdata/pkgtypes.h b/icu4c/source/tools/pkgdata/pkgtypes.h index b6d3370314..860c958f80 100644 --- a/icu4c/source/tools/pkgdata/pkgtypes.h +++ b/icu4c/source/tools/pkgdata/pkgtypes.h @@ -119,6 +119,7 @@ typedef struct UPKGOptions_ UBool nooutput; UBool verbose; 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 */ UPKGMODE *fcn; /* Handler function */ } UPKGOptions;