From owner-p4-projects@FreeBSD.ORG Tue Aug 19 14:50:22 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 483791065671; Tue, 19 Aug 2008 14:50:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AADD1065680 for ; Tue, 19 Aug 2008 14:50:22 +0000 (UTC) (envelope-from konrad@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id F2D8E8FC28 for ; Tue, 19 Aug 2008 14:50:21 +0000 (UTC) (envelope-from konrad@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7JEoL8Q034353 for ; Tue, 19 Aug 2008 14:50:21 GMT (envelope-from konrad@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7JEoLj2034351 for perforce@freebsd.org; Tue, 19 Aug 2008 14:50:21 GMT (envelope-from konrad@FreeBSD.org) Date: Tue, 19 Aug 2008 14:50:21 GMT Message-Id: <200808191450.m7JEoLj2034351@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to konrad@FreeBSD.org using -f From: Konrad Jankowski To: Perforce Change Reviews Cc: Subject: PERFORCE change 147809 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Aug 2008 14:50:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=147809 Change 147809 by konrad@vspredator on 2008/08/19 14:49:35 With this change we pass the regression tests for much more languages. Affected files ... .. //depot/projects/soc2008/konrad_collation/colldef.apple/parse.y#8 edit Differences ... ==== //depot/projects/soc2008/konrad_collation/colldef.apple/parse.y#8 (text+ko) ==== @@ -89,9 +89,9 @@ static DB *chaindb; static int nchain = 0; static DB *stringdb; -static struct symbol *prev_weight_table[COLL_WEIGHTS_MAX]; -static struct symbol *prev2_weight_table[COLL_WEIGHTS_MAX]; -static struct symbol *weight_table[COLL_WEIGHTS_MAX]; +static struct symbol prev_weight_table[COLL_WEIGHTS_MAX]; +static struct symbol prev2_weight_table[COLL_WEIGHTS_MAX]; +static struct symbol weight_table[COLL_WEIGHTS_MAX]; static int prev_line = LINE_NONE; static struct symbol *prev_elem; static int weight_index = 0; @@ -548,7 +548,7 @@ yyerror("Can't specify weights for collating symbol <%s>", showwcs($1, CHARMAP_SYMBOL_LEN)); } else if (weight_index == 0) { for(i = 0; i < directive_count; i++) - weight_table[i] = s; + weight_table[i] = *s; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); memcpy(prev_weight_table, weight_table, sizeof(weight_table)); @@ -565,13 +565,13 @@ yyerror("Ellipsis line must follow a collating identifier lines"); if (weight_index == 0) { for(i = 0; i < directive_count; i++) - weight_table[i] = &sym_ellipsis; + weight_table[i] = sym_ellipsis; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); for(i = 0; i < directive_count; i++) { - if (weight_table[i]->type != SYMBOL_ELLIPSIS) + if (weight_table[i].type != SYMBOL_ELLIPSIS) continue; - switch (prev_weight_table[i]->type) { + switch (prev_weight_table[i].type) { case SYMBOL_CHAIN: yyerror("Startpoint of ellipsis can't be a collating element"); case SYMBOL_IGNORE: @@ -596,9 +596,9 @@ } weights { int i; if (weight_index == 0) { - weight_table[0] = &sym_undefined; + weight_table[0] = sym_undefined; for(i = 1; i < directive_count; i++) - weight_table[i] = &sym_ellipsis; + weight_table[i] = sym_ellipsis; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); memcpy(prev_weight_table, weight_table, sizeof(weight_table)); @@ -620,13 +620,13 @@ yyerror("Can't specify weights for collating symbol <%s>", showwcs($1, CHARMAP_SYMBOL_LEN)); } else if (weight_index == 0) { for(i = 0; i < directive_count; i++) - weight_table[i] = s; + weight_table[i] = *s; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); if (prev_line == LINE_ELLIPSIS) { int w, x; for(i = 0; i < directive_count; i++) { - switch (prev_weight_table[i]->type) { + switch (prev_weight_table[i].type) { case SYMBOL_CHAR: case SYMBOL_CHAIN: case SYMBOL_IGNORE: @@ -635,12 +635,12 @@ struct __collate_st_char_pri *p = getpri(w); if (p->pri[i] != PRI_UNDEFINED) yyerror("Char 0x%02x previously defined", w); - p->pri[i] = prev_weight_table[i]->val; + p->pri[i] = prev_weight_table[i].val; } break; case SYMBOL_ELLIPSIS: - switch (weight_table[i]->type) { + switch (weight_table[i].type) { case SYMBOL_STRING: yyerror("Strings can't be endpoints of ellipsis"); case SYMBOL_CHAIN: @@ -650,9 +650,9 @@ case SYMBOL_SYMBOL: yyerror("Collation symbols can't be endpoints of ellipsis"); } - if (s->val - prev_elem->val != weight_table[i]->val - prev2_weight_table[i]->val) + if (s->val - prev_elem->val != weight_table[i].val - prev2_weight_table[i].val) yyerror("Range mismatch in weight %d", i); - x = prev2_weight_table[i]->val + 1; + x = prev2_weight_table[i].val + 1; for (w = prev_elem->u.wc + 1; w < s->u.wc; w++) { struct __collate_st_char_pri *p = getpri(w); if (p->pri[i] != PRI_UNDEFINED) @@ -665,8 +665,8 @@ struct __collate_st_char_pri *p = getpri(w); if (p->pri[i] != PRI_UNDEFINED) yyerror("Char 0x%02x previously defined", w); - putsubst(w, i, prev_weight_table[i]->u.str); - p->pri[i] = prev_weight_table[i]->val; + putsubst(w, i, prev_weight_table[i].u.str); + p->pri[i] = prev_weight_table[i].val; } break; } @@ -676,20 +676,20 @@ case SYMBOL_CHAR: { struct __collate_st_char_pri *p = getpri(s->u.wc); for(i = 0; i < directive_count; i++) { - switch (weight_table[i]->type) { + switch (weight_table[i].type) { case SYMBOL_CHAR: case SYMBOL_CHAIN: case SYMBOL_IGNORE: case SYMBOL_SYMBOL: if (p->pri[i] != PRI_UNDEFINED) yyerror("Char 0x%02x previously defined", s->u.wc); - p->pri[i] = weight_table[i]->val; + p->pri[i] = weight_table[i].val; break; case SYMBOL_STRING: if (p->pri[i] != PRI_UNDEFINED) yyerror("Char 0x%02x previously defined", s->u.wc); - putsubst(s->u.wc, i, weight_table[i]->u.str); - p->pri[i] = weight_table[i]->val; + putsubst(s->u.wc, i, weight_table[i].u.str); + p->pri[i] = weight_table[i].val; break; } } @@ -698,24 +698,24 @@ case SYMBOL_CHAIN: { struct __collate_st_chain_pri *p = getchain(s->u.str, EXISTS); for(i = 0; i < directive_count; i++) { - switch (weight_table[i]->type) { + switch (weight_table[i].type) { case SYMBOL_CHAR: case SYMBOL_CHAIN: case SYMBOL_IGNORE: case SYMBOL_SYMBOL: if (p->pri[i] != PRI_UNDEFINED) yyerror("Chain %s previously defined", showwcs(s->u.str, STR_LEN)); - p->pri[i] = weight_table[i]->val; + p->pri[i] = weight_table[i].val; break; case SYMBOL_STRING : - if (wcsncmp(s->u.str, weight_table[i]->u.str, STR_LEN) != 0) + if (wcsncmp(s->u.str, weight_table[i].u.str, STR_LEN) != 0) yyerror("Chain/string mismatch"); if (p->pri[i] != PRI_UNDEFINED) yyerror("Chain %s previously defined", showwcs(s->u.str, STR_LEN)); /* negative value mean don't substitute * the chain, but it is in an * equivalence class */ - p->pri[i] = -weight_table[i]->val; + p->pri[i] = -weight_table[i].val; } } break; @@ -735,13 +735,13 @@ yyerror("Ellipsis line must follow a collating identifier lines"); if (weight_index == 0) { for(i = 0; i < directive_count; i++) - weight_table[i] = &sym_ellipsis; + weight_table[i] = sym_ellipsis; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); for(i = 0; i < directive_count; i++) { - if (weight_table[i]->type != SYMBOL_ELLIPSIS) + if (weight_table[i].type != SYMBOL_ELLIPSIS) continue; - switch (prev_weight_table[i]->type) { + switch (prev_weight_table[i].type) { case SYMBOL_CHAIN: yyerror("Startpoint of ellipsis can't be a collating element"); case SYMBOL_IGNORE: @@ -761,18 +761,18 @@ int i; if (weight_index == 0) { - weight_table[0] = &sym_undefined; + weight_table[0] = sym_undefined; for(i = 1; i < directive_count; i++) - weight_table[i] = &sym_ellipsis; + weight_table[i] = sym_ellipsis; } else if (weight_index != directive_count) yyerror("Not enough weights specified"); for(i = 0; i < directive_count; i++) { - switch (weight_table[i]->type) { + switch (weight_table[i].type) { case SYMBOL_CHAR: case SYMBOL_CHAIN: case SYMBOL_IGNORE: case SYMBOL_SYMBOL: - info.undef_pri[i] = weight_table[i]->val; + info.undef_pri[i] = weight_table[i].val; break; case SYMBOL_ELLIPSIS : /* Negative values mean that the priority is @@ -815,19 +815,19 @@ yyerror("More weights than specified by order_start"); if (!allow_ellipsis) yyerror("Ellipsis weight not allowed"); - weight_table[weight_index++] = &sym_ellipsis; + weight_table[weight_index++] = sym_ellipsis; } | IGNORE { if (weight_index >= directive_count) yyerror("More weights than specified by order_start"); - weight_table[weight_index++] = &sym_ignore; + weight_table[weight_index++] = sym_ignore; } | STRING { if (weight_index >= directive_count) yyerror("More weights than specified by order_start"); if (wcslen($1) > STR_LEN) yyerror("String '%s' is too long", showwcs($1, STR_LEN)); - weight_table[weight_index++] = getstring($1); + weight_table[weight_index++] = *getstring($1); } ; weight_ex1 : weight_ex { weight_index++; } @@ -841,7 +841,7 @@ s = getsymbol($1, EXISTS); if (order_pass && s->val == PRI_UNDEFINED) printf("<%s> is undefined\n", showwcs($1, CHARMAP_SYMBOL_LEN)); - weight_table[weight_index] = s; + weight_table[weight_index] = *s; } ; weight_ex_null : ELEM { @@ -853,6 +853,7 @@ s = getsymbol($1, EXISTS); if (order_pass && s->val == PRI_UNDEFINED) printf("<%s> is undefined\n", showwcs($1, CHARMAP_SYMBOL_LEN)); + weight_table[weight_index].val += s->val; } ; order_end : ORDER_END '\n' @@ -1449,6 +1450,8 @@ 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++) { + if (p2->val == 0) + break; printf("\t%s :", show(ntohl(p2->val))); for(z = 0; z < info.directive_count; z++) printf(" %d", ntohl(p2->pri.pri[z]));