PERFORCE change 145271 for review

Konrad Jankowski konrad at FreeBSD.org
Tue Jul 15 08:06:24 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=145271

Change 145271 by konrad at 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;


More information about the p4-projects mailing list