ICU-3106 add object mangling option to pkgdata,genccode
X-SVN-Rev: 12640
This commit is contained in:
parent
f2508fe78f
commit
ed8c9f8ec2
@ -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.
|
||||
|
@ -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(inFilename<suffix) {
|
||||
if(*inFilename=='-') {
|
||||
@ -430,8 +448,13 @@ getOutFilename(const char *inFilename, const char *destdir, char *outFilename, c
|
||||
|
||||
*entryName=0;
|
||||
|
||||
/* add ".c" */
|
||||
uprv_strcpy(outFilename, newSuffix);
|
||||
if(options[kOptFilename].doesOccur) {
|
||||
uprv_strcpy(saveOutFilename, options[kOptFilename].value);
|
||||
uprv_strcat(saveOutFilename, newSuffix);
|
||||
} else {
|
||||
/* add ".c" */
|
||||
uprv_strcpy(outFilename, newSuffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
/* nothing */
|
||||
T_FileStream_writeLine(f, "\nrebuild: clean all\n");
|
||||
}
|
||||
|
||||
|
||||
@ -151,6 +151,8 @@ 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];
|
||||
|
||||
infiles = o->filePaths;
|
||||
|
||||
@ -171,17 +173,23 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects,
|
||||
continue;
|
||||
}
|
||||
|
||||
uprv_strncpy(tmp, baseName, p-baseName);
|
||||
p++;
|
||||
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 );
|
||||
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 = '_';
|
||||
/* 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 */
|
||||
|
@ -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 <yves@realnames.com>.
|
||||
.\" Modified by Steven R. Loomis <srl@jtcsv.com>.
|
||||
@ -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.
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user