[sword-cvs] icu-sword/source/tools/genccode genccode.8.in,1.3,1.4 genccode.c,1.4,1.5 genccode.vcproj,1.1,1.2

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:11:04 -0700


Update of /cvs/core/icu-sword/source/tools/genccode
In directory www:/tmp/cvs-serv8911/source/tools/genccode

Modified Files:
	genccode.8.in genccode.c genccode.vcproj 
Log Message:
ICU 2.8 sync

Index: genccode.8.in
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/genccode/genccode.8.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- genccode.8.in	10 Sep 2003 02:42:55 -0000	1.3
+++ genccode.8.in	6 Apr 2004 10:10:00 -0000	1.4
@@ -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 @@
 .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 @@
 .SH VERSION
 @VERSION@
 .SH COPYRIGHT
-Copyright (C) 2000-2001 IBM, Inc. and others.
+Copyright (C) 2000-2003 IBM, Inc. and others.

Index: genccode.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/genccode/genccode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- genccode.c	10 Sep 2003 02:42:55 -0000	1.4
+++ genccode.c	6 Apr 2004 10:10:00 -0000	1.5
@@ -31,9 +31,12 @@
 #include <time.h>
 
 /* _M_IA64 should be defined in windows.h */
-#ifdef _M_IA64
+#if defined(_M_IA64)
 #   define ICU_OBJECT_MACHINE_TYPE IMAGE_FILE_MACHINE_IA64
 #   define ICU_ENTRY_OFFSET 0
+#elif defined(_M_AMD64)
+#   define ICU_OBJECT_MACHINE_TYPE IMAGE_FILE_MACHINE_AMD64
+#   define ICU_ENTRY_OFFSET 0
 #else
 #   define ICU_OBJECT_MACHINE_TYPE IMAGE_FILE_MACHINE_I386
 #   define ICU_ENTRY_OFFSET 1
@@ -49,6 +52,7 @@
 #include "cstring.h"
 #include "filestrm.h"
 #include "toolutil.h"
+#include "unicode/uclean.h"
 #include "uoptions.h"
 
 #define MAX_COLUMN ((uint32_t)(0xFFFFFFFFU))
@@ -81,16 +85,28 @@
 #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 +117,7 @@
 
     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 +130,7 @@
             "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 +144,13 @@
 #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 +165,7 @@
                 fprintf(stdout, message, filename);
             }
             column=MAX_COLUMN;
-            writeCode(filename, options[2].value);
+            writeCode(filename, options[kOptDestDir].value);
         }
     }
 
@@ -273,7 +290,7 @@
         char longNames[100];
     } symbolNames;
     FileStream *in, *out;
-    size_t i, entryLength, length, size;
+    DWORD i, entryLength, length, size;
 
     in=T_FileStream_open(filename, "rb");
     if(in==NULL) {
@@ -285,12 +302,12 @@
     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 */
-    entryLength=uprv_strlen(entry);
+    entryLength=(int32_t)uprv_strlen(entry);
     for(i=0; i<entryLength; ++i) {
         if(entry[i]=='-') {
             entry[i]='_';
@@ -359,7 +376,7 @@
         if(length==0) {
             break;
         }
-        T_FileStream_write(out, buffer, length);
+        T_FileStream_write(out, buffer, (int32_t)length);
     }
 
     /* write the symbol table */
@@ -404,9 +421,14 @@
     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 {
+        char *saveOutFilename = outFilename;
         /* copy basename */
         while(inFilename<suffix) {
             if(*inFilename=='-') {
@@ -430,8 +452,13 @@
 
         *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);
+        }
     }
 }
 
@@ -487,5 +514,4 @@
     T_FileStream_writeLine(out, s);
 }
 #endif
-
 

Index: genccode.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/genccode/genccode.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- genccode.vcproj	10 Sep 2003 02:42:55 -0000	1.1
+++ genccode.vcproj	6 Apr 2004 10:10:00 -0000	1.2
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="7.00"
+	Version="7.10"
 	Name="genccode"
 	SccProjectName=""
 	SccLocalPath="">
@@ -36,9 +36,9 @@
 				CompileAs="0"/>
 			<Tool
 				Name="VCCustomBuildTool"
-				CommandLine="copy $(TargetPath) ..\..\..\bin
+				CommandLine="copy &quot;$(TargetPath)&quot; ..\..\..\bin
 "
-				Outputs="..\..\..\bin\$(InputName).exe"/>
+				Outputs="..\..\..\bin\$(TargetFileName)"/>
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
@@ -65,7 +65,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Debug|Win32"
@@ -94,9 +100,9 @@
 				CompileAs="0"/>
 			<Tool
 				Name="VCCustomBuildTool"
-				CommandLine="copy $(TargetPath) ..\..\..\bin
+				CommandLine="copy &quot;$(TargetPath)&quot; ..\..\..\bin
 "
-				Outputs="..\..\..\bin\$(InputName).exe"/>
+				Outputs="..\..\..\bin\$(TargetFileName)"/>
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
@@ -124,9 +130,17 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Source Files"