Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Aug 2008 19:03:11 GMT
From:      Konrad Jankowski <konrad@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 147755 for review
Message-ID:  <200808181903.m7IJ3BgD011326@repoman.freebsd.org>

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

Change 147755 by konrad@vspredator on 2008/08/18 19:02:21

	Fix errors in debug mode of colldef.apple.

Affected files ...

.. //depot/projects/soc2008/konrad_collation/colldef.apple/parse.y#7 edit

Differences ...

==== //depot/projects/soc2008/konrad_collation/colldef.apple/parse.y#7 (text+ko) ====

@@ -395,11 +395,12 @@
 	if (fclose(fp) != 0)
 		err(EX_IOERR, "IO error closing destination file %s",
 		    out_file);
-
 #ifdef COLLATE_DEBUG
+	/* Do it first, before conversion to network byte order. */
 	if (debug)
 		collate_print_tables();
 #endif
+
 	exit(EX_OK);
 }
 ;
@@ -509,6 +510,10 @@
 order_line1 :
 	| ELEM {
 	struct symbol *s = getsymbol($1, EXISTS);
+
+#ifdef VSDEBUG
+	printf("\n%s(%d) ", showwcs(s->name, CHARMAP_SYMBOL_LEN), s->u.wc);
+#endif
 	if (s->val != PRI_UNDEFINED)
 		yyerror("<%s> redefined", showwcs($1, CHARMAP_SYMBOL_LEN));
 	if (prev_line == LINE_ELLIPSIS) {
@@ -789,10 +794,16 @@
 ;
 expansion :
 	  weight_ex
-	| expansion weight_ex
+	| expansion weight_ex_null
 ;
 weight2 : weight
-	| EXPAND expansion EXPAND { weight_index++; }
+	| EXPAND expansion EXPAND {
+#ifdef VSDEBUG
+		printf("[%d]=%d ",
+		    weight_index, weight_table[weight_index]->val);
+#endif
+		weight_index++;
+	}
 ;
 weights :
 	| weight
@@ -833,6 +844,17 @@
 	weight_table[weight_index] = s;
 }
 ;
+weight_ex_null : ELEM {
+	struct symbol *s;
+
+	if (weight_index >= directive_count)
+		yyerror("More weights than specified by order_start (%d >= %d, %s)", weight_index,
+		    directive_count, showwcs($1, CHARMAP_SYMBOL_LEN));
+	s = getsymbol($1, EXISTS);
+	if (order_pass && s->val == PRI_UNDEFINED)
+		printf("<%s> is undefined\n", showwcs($1, CHARMAP_SYMBOL_LEN));
+}
+;
 order_end : ORDER_END '\n'
 ;
 charmap : DEFN CHAR {
@@ -1419,7 +1441,7 @@
 		for (i = 0; i < UCHAR_MAX + 1; i++, p2++) {
 			printf("\t%s :", show(i));
 			for(z = 0; z < info.directive_count; z++)
-				printf(" %d", p2->pri[z]);
+				printf(" %d", ntohl(p2->pri[z]));
 			putchar('\n');
 		}
 	}
@@ -1427,9 +1449,9 @@
 		struct __collate_st_large_char_pri *p2 = __collate_large_char_pri_table;
 		printf("Large priority table:\n");
 		for (i = info.large_pri_count; i-- > 0; p2++) {
-			printf("\t%s :", show(p2->val));
+			printf("\t%s :", show(ntohl(p2->val)));
 			for(z = 0; z < info.directive_count; z++)
-				printf(" %d", p2->pri.pri[z]);
+				printf(" %d", ntohl(p2->pri.pri[z]));
 			putchar('\n');
 		}
 	}



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