This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

an iconv converter for TSCII


Hi Ulrich,

Here comes the promised iconv converter for TSCII. Written from scratch,
to avoid the copyright problems and the buffer overrun bugs of the converter
found in Mandrake Linux. It is based on info from
  - http://www.tamil.net/tscii/charset17.gif
  - http://www.tamil.net/tscii/faq5.html
  - http://www.unicode.org

The tst-table-from.c test program is modified because this new encoding can
produce 4 Unicode characters per input byte.

ChangeLog:
2002-09-22  Bruno Haible  <bruno@clisp.org>

	* iconvdata/tscii.c: New file.
	* iconvdata/testdata/TSCII: New file.
	* iconvdata/testdata/TSCII..UTF8: New file.
	* iconvdata/TSCII.precomposed: New file.
	* iconvdata/TSCII.irreversible: New file.
	* iconvdata/gconv-modules (TSCII): New module.
	* iconvdata/Makefile (modules): Add TSCII.
	(distribute): Add tscii.c.
	* iconvdata/tst-table-from.c (try, utf8_decode, main): Double output
	buffer size.
	* iconvdata/tst-tables.sh: Add TSCII.
	* iconvdata/TESTS: Add TSCII.

localedata/ChangeLog:
2002-09-22  Bruno Haible  <bruno@clisp.org>

	* charmaps/TSCII: New file.

--- glibc-20020828/iconvdata/gconv-modules.bak	Tue Jul 23 14:12:13 2002
+++ glibc-20020828/iconvdata/gconv-modules	Sun Sep 22 16:17:25 2002
@@ -1523,3 +1539,7 @@
 #	from			to			module		cost
 module	Shift_JISX0213//	INTERNAL		SHIFT_JISX0213	1
 module	INTERNAL		Shift_JISX0213//	SHIFT_JISX0213	1
+
+#	from			to			module		cost
+module	TSCII//			INTERNAL		TSCII		1
+module	INTERNAL		TSCII//			TSCII		1
--- glibc-20020828/iconvdata/tst-table-from.c.bak	Mon Apr 22 13:50:34 2002
+++ glibc-20020828/iconvdata/tst-table-from.c	Sun Sep 22 22:40:35 2002
@@ -57,7 +57,7 @@
   return msg;
 }
 
-/* Attempts to convert a byte buffer BUF (BUFLEN bytes) to OUT (6 bytes)
+/* Attempts to convert a byte buffer BUF (BUFLEN bytes) to OUT (12 bytes)
    using the conversion descriptor CD.  Returns the number of written bytes,
    or 0 if ambiguous, or -1 if invalid.  */
 static int
@@ -66,7 +66,7 @@
   const char *inbuf = (const char *) buf;
   size_t inbytesleft = buflen;
   char *outbuf = (char *) out;
-  size_t outbytesleft = 6;
+  size_t outbytesleft = 12;
   size_t result;
 
   iconv (cd, NULL, NULL, NULL, NULL);
@@ -100,10 +100,10 @@
 	  fprintf (stderr, "%s: inbytes = %ld, outbytes = %ld\n",
 		   hexbuf (buf, buflen),
 		   (long) (buflen - inbytesleft),
-		   (long) (6 - outbytesleft));
+		   (long) (12 - outbytesleft));
 	  exit (1);
 	}
-      return 6 - outbytesleft;
+      return 12 - outbytesleft;
     }
 }
 
@@ -111,7 +111,7 @@
 static const char *
 utf8_decode (const unsigned char *out, unsigned int outlen)
 {
-  static char hexbuf[42];
+  static char hexbuf[84];
   char *p = hexbuf;
 
   while (outlen > 0)
@@ -203,7 +203,7 @@
   search_depth = (strcmp (charset, "UTF-8") == 0 ? 3 : 4);
 
   {
-    unsigned char out[6];
+    unsigned char out[12];
     unsigned char buf[4];
     unsigned int i0, i1, i2, i3;
     int result;
--- glibc-20020828/iconvdata/tst-tables.sh.bak	Thu Jul 11 14:22:49 2002
+++ glibc-20020828/iconvdata/tst-tables.sh	Sun Sep 22 16:18:12 2002
@@ -202,6 +202,7 @@
   MAC-SAMI
   ARMSCII-8
   TCVN5712-1
+  TSCII
   #
   # Multibyte encodings come here
   #
--- glibc-20020828/iconvdata/Makefile.bak	Wed Aug 28 12:51:02 2002
+++ glibc-20020828/iconvdata/Makefile	Sun Sep 22 23:49:26 2002
@@ -51,7 +51,7 @@
 	   GB18030 ISO-2022-CN-EXT VISCII GBBIG5 CP10007 KOI8-T		 \
 	   GEORGIAN-PS GEORGIAN-ACADEMY ISO-IR-209 MAC-SAMI ARMSCII-8	 \
 	   TCVN5712-1 libJISX0213 EUC-JISX0213 SHIFT_JISX0213		 \
-	   ISO-2022-JP-3
+	   ISO-2022-JP-3 TSCII
 
 modules.so := $(addsuffix .so, $(modules))
 
@@ -166,7 +166,7 @@
 	      mac-sami.c ibm1160.c ibm1160.h ibm1161.c ibm1161.h	    \
 	      ibm1163.c ibm1163.h ibm1164.c ibm1164.h jisx0213.c jisx0213.h \
 	      euc-jisx0213.c shift_jisx0213.c iso-2022-jp-3.c		    \
-	      tcvn5712-1.c armscii-8.c
+	      tcvn5712-1.c armscii-8.c tscii.c
 
 # We build the transformation modules only when we build shared libs.
 ifeq (yes,$(build-shared))
--- glibc-20020828/iconvdata/TESTS.bak	Wed May 15 14:29:41 2002
+++ glibc-20020828/iconvdata/TESTS	Sun Sep 22 17:29:56 2002
@@ -118,3 +118,4 @@
 EUC-JISX0213		EUC-JISX0213		Y	UTF8
 SHIFT_JISX0213		SHIFT_JISX0213		Y	UTF8
 ISO-2022-JP-3		ISO-2022-JP-3		N	UTF8
+TSCII			TSCII			Y	UTF8


Attachment: tscii.tar.gz
Description: tscii.tar.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]