[sword-cvs] icu-sword/source/tools/makeconv gencnvex.c,NONE,1.1 Makefile.in,1.4,1.5 genmbcs.c,1.3,1.4 genmbcs.h,1.3,1.4 makeconv.c,1.3,1.4 makeconv.dsp,1.3,1.4 makeconv.h,1.3,1.4 makeconv.vcproj,1.1,1.2 readme.htm,1.3,NONE

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


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

Modified Files:
	Makefile.in genmbcs.c genmbcs.h makeconv.c makeconv.dsp 
	makeconv.h makeconv.vcproj 
Added Files:
	gencnvex.c 
Removed Files:
	readme.htm 
Log Message:
ICU 2.8 sync

--- NEW FILE: gencnvex.c ---
/*
*******************************************************************************
*
*   Copyright (C) 2003, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
*******************************************************************************
*   file name:  gencnvex.c
*   encoding:   US-ASCII
*   tab size:   8 (not used)
*   indentation:4
*
*   created on: 2003oct12
*   created by: Markus W. Scherer
*/

#include <stdio.h>
#include "unicode/utypes.h"
#include "unicode/ustring.h"
[...1020 lines suppressed...]
    if(table->unicodeMask&UCNV_HAS_SURROGATES) {
        fprintf(stderr, "error: contains mappings for surrogate code points\n");
        return FALSE;
    }

    staticData->conversionType=UCNV_MBCS;

    extData=(CnvExtData *)cnvData;

    /*
     * assume that the table is sorted
     *
     * call the functions in this order because
     * makeToUTable() modifies the original reverseMap,
     * makeFromUTable() writes a whole new mapping into reverseMap
     */
    return
        makeToUTable(extData, table) &&
        makeFromUTable(extData, table);
}

Index: Makefile.in
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/Makefile.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.in	10 Sep 2003 02:42:59 -0000	1.4
+++ Makefile.in	6 Apr 2004 10:10:25 -0000	1.5
@@ -34,7 +34,7 @@
 CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(srcdir)/../toolutil
 LIBS = $(LIBICUTOOLUTIL) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
 
-OBJECTS = makeconv.o ucnvstat.o genmbcs.o
+OBJECTS = makeconv.o ucnvstat.o genmbcs.o gencnvex.o
 
 DEPS = $(OBJECTS:.o=.d)
 

Index: genmbcs.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/genmbcs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- genmbcs.c	10 Sep 2003 02:42:59 -0000	1.3
+++ genmbcs.c	6 Apr 2004 10:10:25 -0000	1.4
@@ -21,49 +21,26 @@
 #include "unewdata.h"
 #include "ucnv_cnv.h"
 #include "ucnvmbcs.h"
+#include "ucm.h"
 #include "makeconv.h"
 #include "genmbcs.h"
 
-enum {
-    MBCS_STATE_FLAG_DIRECT=1,
-    MBCS_STATE_FLAG_SURROGATES,
-
[...1609 lines suppressed...]
-    udata_writeBlock(pData, mbcsData->stateTable, mbcsData->header.countStates*1024);
-    udata_writeBlock(pData, mbcsData->toUFallbacks, mbcsData->header.countToUFallbacks*sizeof(_MBCSToUFallback));
-    udata_writeBlock(pData, mbcsData->unicodeCodeUnits, mbcsData->countToUCodeUnits*2);
+    udata_writeBlock(pData, &header, sizeof(_MBCSHeader));
+    udata_writeBlock(pData, mbcsData->ucm->states.stateTable, header.countStates*1024);
+    udata_writeBlock(pData, mbcsData->toUFallbacks, mbcsData->countToUFallbacks*sizeof(_MBCSToUFallback));
+    udata_writeBlock(pData, mbcsData->unicodeCodeUnits, mbcsData->ucm->states.countToUCodeUnits*2);
     udata_writeBlock(pData, mbcsData->stage1, stage1Top*2);
-    if(mbcsData->maxCharLength==1) {
+    if(mbcsData->ucm->states.maxCharLength==1) {
         udata_writeBlock(pData, mbcsData->stage2Single, mbcsData->stage2Top);
     } else {
         udata_writeBlock(pData, mbcsData->stage2, mbcsData->stage2Top);
@@ -1732,5 +1096,5 @@
     udata_writeBlock(pData, mbcsData->fromUBytes, mbcsData->stage3Top);
 
     /* return the number of bytes that should have been written */
-    return mbcsData->header.offsetFromUBytes+mbcsData->header.fromUBytesLength;
+    return header.offsetFromUBytes+header.fromUBytesLength;
 }

Index: genmbcs.h
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/genmbcs.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- genmbcs.h	10 Sep 2003 02:42:59 -0000	1.3
+++ genmbcs.h	6 Apr 2004 10:10:26 -0000	1.4
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2000, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -19,10 +19,27 @@
 
 #include "makeconv.h"
 
+enum {
+    MBCS_STAGE_2_BLOCK_SIZE=0x40, /* 64; 64=1<<6 for 6 bits in stage 2 */
+    MBCS_STAGE_2_BLOCK_SIZE_SHIFT=6, /* log2(MBCS_STAGE_2_BLOCK_SIZE) */
+    MBCS_STAGE_1_SIZE=0x440, /* 0x110000>>10, or 17*64 for one entry per 1k code points */
+    MBCS_STAGE_2_SIZE=0xfbc0, /* 0x10000-MBCS_STAGE_1_SIZE */
+    MBCS_MAX_STAGE_2_TOP=MBCS_STAGE_2_SIZE,
+    MBCS_STAGE_2_MAX_BLOCKS=MBCS_STAGE_2_SIZE>>MBCS_STAGE_2_BLOCK_SIZE_SHIFT,
+
+    MBCS_STAGE_2_ALL_UNASSIGNED_INDEX=0, /* stage 1 entry for the all-unassigned stage 2 block */
+    MBCS_STAGE_2_FIRST_ASSIGNED=MBCS_STAGE_2_BLOCK_SIZE, /* start of the first stage 2 block after the all-unassigned one */
+
+    MBCS_STAGE_3_BLOCK_SIZE=16, /* 16; 16=1<<4 for 4 bits in stage 3 */
+    MBCS_STAGE_3_FIRST_ASSIGNED=MBCS_STAGE_3_BLOCK_SIZE, /* start of the first stage 3 block after the all-unassigned one */
+
+    MBCS_MAX_FALLBACK_COUNT=8192
+};
+
 U_CFUNC NewConverter *
-MBCSOpen(uint8_t maxCharLength);
+MBCSOpen(UCMFile *ucm);
 
-U_CFUNC UBool
-MBCSAddState(NewConverter *cnvData, const char *s);
+U_CFUNC NewConverter *
+CnvExtOpen(UCMFile *ucm);
 
 #endif

Index: makeconv.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/makeconv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- makeconv.c	10 Sep 2003 02:42:59 -0000	1.3
+++ makeconv.c	6 Apr 2004 10:10:26 -0000	1.4
@@ -29,12 +29,44 @@
 #include "uoptions.h"
 #include "unicode/udata.h"
 #include "unewdata.h"
-#include "ucmpwrit.h"
+#include "uparse.h"
+#include "ucm.h"
 #include "makeconv.h"
 #include "genmbcs.h"
 
 #define DEBUG 0
 
[...1261 lines suppressed...]
+                } else if(1!=ucm_countChars(baseStates, &staticData->subChar1, 1)) {
+                    fprintf(stderr, "       the subchar1 byte is illegal in this codepage structure!\n");
+                    *pErrorCode=U_INVALID_TABLE_FORMAT;
 
-    return mySharedData;
+                } else if(
+                    !ucm_checkValidity(data->ucm->ext, baseStates) ||
+                    !ucm_checkBaseExt(baseStates, baseData.ucm->base, data->ucm->ext, data->ucm->ext, FALSE) ||
+                    !data->extData->addTable(data->extData, data->ucm->ext, &data->staticData)
+                ) {
+                    *pErrorCode=U_INVALID_TABLE_FORMAT;
+                }
+            }
+        }
+
+        cleanupConvData(&baseData);
+    }
 }
 
 /*

Index: makeconv.dsp
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/makeconv.dsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- makeconv.dsp	10 Sep 2003 02:42:59 -0000	1.3
+++ makeconv.dsp	6 Apr 2004 10:10:26 -0000	1.4
@@ -183,6 +183,10 @@
 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
 # Begin Source File
 
+SOURCE=.\gencnvex.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\genmbcs.c
 # End Source File
 # Begin Source File

Index: makeconv.h
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/makeconv.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- makeconv.h	10 Sep 2003 02:42:59 -0000	1.3
+++ makeconv.h	6 Apr 2004 10:10:26 -0000	1.4
@@ -1,7 +1,7 @@
 /*
 *******************************************************************************
 *
-*   Copyright (C) 2000-2001, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
@@ -20,10 +20,19 @@
 #include "unicode/utypes.h"
 #include "ucnv_bld.h"
 #include "unewdata.h"
+#include "ucm.h"
 
 /* exports from makeconv.c */
 U_CFUNC UBool VERBOSE;
 
+/* converter table type for writing */
+enum {
+    TABLE_NONE,
+    TABLE_BASE,
+    TABLE_EXT,
+    TABLE_BASE_AND_EXT
+};
+
 /* abstract converter generator struct, C++ - style */
 struct NewConverter;
 typedef struct NewConverter NewConverter;
@@ -32,32 +41,17 @@
     void
     (*close)(NewConverter *cnvData);
 
-    UBool
-    (*startMappings)(NewConverter *cnvData);
-
     /** is this byte sequence valid? */
     UBool
     (*isValid)(NewConverter *cnvData,
-               const uint8_t *bytes, int32_t length,
-               uint32_t b);
-
-    UBool
-    (*addToUnicode)(NewConverter *cnvData,
-                    const uint8_t *bytes, int32_t length,
-                    UChar32 c, uint32_t b,
-                    int8_t isFallback);
+               const uint8_t *bytes, int32_t length);
 
     UBool
-    (*addFromUnicode)(NewConverter *cnvData,
-                      const uint8_t *bytes, int32_t length,
-                      UChar32 c, uint32_t b,
-                      int8_t isFallback);
-
-    void
-    (*finishMappings)(NewConverter *cnvData, const UConverterStaticData *staticData);
+    (*addTable)(NewConverter *cnvData, UCMTable *table, UConverterStaticData *staticData);
 
     uint32_t
-    (*write)(NewConverter *cnvData, const UConverterStaticData *staticData, UNewDataMemory *pData);
+    (*write)(NewConverter *cnvData, const UConverterStaticData *staticData,
+             UNewDataMemory *pData, int32_t tableType);
 };
 
 #endif

Index: makeconv.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/makeconv/makeconv.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- makeconv.vcproj	10 Sep 2003 02:42:59 -0000	1.1
+++ makeconv.vcproj	6 Apr 2004 10:10:26 -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="makeconv"
 	SccProjectName=""
 	SccLocalPath="">
@@ -39,9 +39,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"
@@ -69,7 +69,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
@@ -96,9 +102,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"
@@ -125,13 +131,24 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Source Files"
 			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+			<File
+				RelativePath=".\gencnvex.c">
+			</File>
 			<File
 				RelativePath=".\genmbcs.c">
 			</File>

--- readme.htm DELETED ---