Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2008 08:06:24 GMT
From:      Konrad Jankowski <konrad@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 145271 for review
Message-ID:  <200807150806.m6F86OD3090767@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145271

Change 145271 by konrad@vspredator on 2008/07/15 08:06:10

	Make it also work on the older charmap encoding format.

Affected files ...

.. //depot/projects/soc2008/konrad_collation/colldef.apple/scan.l#3 edit

Differences ...

==== //depot/projects/soc2008/konrad_collation/colldef.apple/scan.l#3 (text+ko) ====

@@ -42,6 +42,8 @@
 #include "common.h"
 #include "y.tab.h"
 
+void yyerror(char *, ...);
+
 int line_no = 1, save_no, fromsubs;
 wchar_t buf0[BUFSIZE], *ptr;
 wchar_t *buf = buf0;
@@ -154,7 +156,14 @@
 	yylval.ch = v;
 	return CHAR;
 }
-<INITIAL,nchar,subs>(\\x([0-9a-fA-F]{2})){1,3}   {
+<INITIAL,nchar,subs>\\x([0-9a-fA-F]{2})   {
+	u_int v;
+ 
+	sscanf(&yytext[2], "%x", &v);
+	yylval.ch = v;
+	return CHAR;
+}
+<INITIAL,nchar,subs>(\\x([0-9a-fA-F]{2})){2,3}   {
 	u_int v;
 	char synthesis[4], *p;
 	int i;
@@ -167,7 +176,8 @@
 	}
 	synthesis[i] = 0;
 	if ((int)(v = mbtowc(&ret, synthesis, i)) != i && synthesis[0])
-		errx(EX_UNAVAILABLE, "charmap symbol value decoding error (%d != %d)", v, i);
+		yyerror("charmap symbol value decoding error (%d != %d), "
+		    "text was: %s", v, i, yytext);
 	yylval.ch = ret;
 
 	return CHAR;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807150806.m6F86OD3090767>