[sword-cvs] icu-sword/source/tools/gennames gennames.c,1.5,1.6 gennames.vcproj,1.1,1.2

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:10:38 -0700


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

Modified Files:
	gennames.c gennames.vcproj 
Log Message:
ICU 2.8 sync

Index: gennames.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/gennames/gennames.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gennames.c	10 Sep 2003 02:42:56 -0000	1.5
+++ gennames.c	6 Apr 2004 10:10:06 -0000	1.6
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 1999-2001, International Business Machines
+*   Copyright (C) 1999-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -124,6 +124,7 @@
 #include "unicode/putil.h"
 #include "cmemory.h"
 #include "cstring.h"
+#include "unicode/uclean.h"
 #include "unicode/udata.h"
 #include "unewdata.h"
 #include "uoptions.h"
@@ -282,9 +283,22 @@
 main(int argc, char* argv[]) {
     UVersionInfo version;
     UBool store10Names=FALSE;
+    UErrorCode errorCode = U_ZERO_ERROR;
 
     U_MAIN_INIT_ARGS(argc, argv);
 
+    /* Initialize ICU */
+    u_init(&errorCode);
+    if (U_FAILURE(errorCode) && errorCode != U_FILE_ACCESS_ERROR) {
+        /* Note: u_init() will try to open ICU property data.
+         *       failures here are expected when building ICU from scratch.
+         *       ignore them.
+         */
+        fprintf(stderr, "%s: can not initialize ICU.  errorCode = %s\n",
+            argv[0], u_errorName(errorCode));
+        exit(1);
+    }
+
     /* preset then read command line options */
     options[5].value=u_getDataDirectory();
     options[6].value="3.2";
@@ -340,6 +354,7 @@
     compress();
     generateData(options[5].value);
 
+    u_cleanup();
     return 0;
 }
 
@@ -354,6 +369,22 @@
 
 /* parsing ------------------------------------------------------------------ */
 
+/* get a name, strip leading and trailing whitespace */
+static int16_t
+getName(char **pStart, char *limit) {
+    /* strip leading whitespace */
+    char *start=(char *)u_skipWhitespace(*pStart);
+
+    /* strip trailing whitespace */
+    while(start<limit && (*(limit-1)==' ' || *(limit-1)=='\t')) {
+        --limit;
+    }
+
+    /* return results */
+    *pStart=start;
+    return (int16_t)(limit-start);
+}
+
 static void U_CALLCONV
 lineFn(void *context,
        char *fields[][2], int32_t fieldCount,
@@ -371,9 +402,8 @@
 
     /* get the character name */
     names[0]=fields[1][0];
-    if(fields[1][0][0]!='<') {
-        lengths[0]=(int16_t)(fields[1][1]-names[0]);
-    } else {
+    lengths[0]=getName(names+0, fields[1][1]);
+    if(names[0][0]=='<') {
         /* do not store pseudo-names in <> brackets */
         lengths[0]=0;
     }
@@ -382,15 +412,16 @@
     /* get the second character name, the one from Unicode 1.0 */
     /* do not store pseudo-names in <> brackets */
     names[1]=fields[10][0];
-    if(*(UBool *)context && fields[10][0][0]!='<') {
-        lengths[1]=(int16_t)(fields[10][1]-names[1]);
+    lengths[1]=getName(names+1, fields[10][1]);
+    if(*(UBool *)context && names[1][0]!='<') {
+        /* keep the name */
     } else {
         lengths[1]=0;
     }
 
     /* get the ISO 10646 comment */
     names[2]=fields[11][0];
-    lengths[2]=(int16_t)(fields[11][1]-names[2]);
+    lengths[2]=getName(names+2, fields[11][1]);
 
     if(lengths[0]+lengths[1]+lengths[2]==0) {
         return;

Index: gennames.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/gennames/gennames.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gennames.vcproj	10 Sep 2003 02:42:56 -0000	1.1
+++ gennames.vcproj	6 Apr 2004 10:10:06 -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="gennames"
 	SccProjectName=""
 	SccLocalPath="">
@@ -37,9 +37,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"
@@ -66,7 +66,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Debug|Win32"
@@ -97,9 +103,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"
@@ -127,9 +133,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"