[uClibc-cvs] uClibc/extra/locale gen_collate.c,1.3,1.4

Manuel Novoa III mjn3 at uclibc.org
Mon Aug 18 21:28:36 UTC 2003


Update of /var/cvs/uClibc/extra/locale
In directory winder:/tmp/cvs-serv15437

Modified Files:
	gen_collate.c 
Log Message:
Fixed a bug where locales nontrivially derived from iso14651_t1 did not have
the UNDEFINED entry set properly.


Index: gen_collate.c
===================================================================
RCS file: /var/cvs/uClibc/extra/locale/gen_collate.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- gen_collate.c	1 Aug 2003 20:08:39 -0000	1.3
+++ gen_collate.c	18 Aug 2003 21:28:33 -0000	1.4
@@ -31,7 +31,6 @@
 #include <assert.h>
 #include <search.h>
 
-
 typedef struct {
 	char *name;					/*  */
 
@@ -629,21 +628,21 @@
 
 	switch(order_state) {
 		case 0:
-/* 			printf("no-order weight: %s\n", t); */
+/* 			fprintf(stdout, "no-order weight: %s\n", t); */
 /* 			break; */
 		case IN_ORDER:
 			/* in a section */
-/* 			printf("weight: %s\n", t); */
+/* 			fprintf(stdout, "weight: %s\n", t); */
 			wi = add_weight(t);
 			lli = new_ll_item(DT_WEIGHTED, wi);
 			if (!cur_section->itm_list) {
-/* 				printf("creating new item list: %s\n", wi->symbol); */
+/* 				fprintf(stdout, "creating new item list: %s  %s  %p\n", wi->symbol, cur_section->name, lli); */
 				cur_section->itm_list = lli;
 				lli->prev = lli->next = lli;
 				++cur_section->num_items;
 			} else {
 				insque(lli, cur_section->itm_list->prev);
-/* 				printf("adding item to list: %d - %s\n", ll_len(cur_section->itm_list), wi->symbol); */
+/* 				fprintf(stdout, "adding item to list: %d - %s  %p\n", ll_len(cur_section->itm_list), wi->symbol, lli); */
 				++cur_section->num_items;
 			}
 			add_wi_index(lli);
@@ -653,7 +652,7 @@
 			wi = add_weight(t);
 			lli = new_ll_item(DT_WEIGHTED, wi);
 			mark_reordered(wi->symbol);
-/* 			printf("reorder: %s\n", t); */
+/* 			fprintf(stdout, "reorder: %s  %s  %p\n", t, cur_section->name, lli); */
 			if (!cur_section->itm_list) {
 				cur_section->itm_list = lli;
 				lli->prev = lli->next = lli;
@@ -683,7 +682,7 @@
 				lli = lli->next;
 			} while (lli);
 			error_msg("reorder_sections_after for non-base item currently not supported: %s", t);
-/* 			fprintf(stderr, "reorder_secitons: %s\n", t); */
+/* 			fprintf(stdout, "reorder_secitons: %s\n", t); */
 			break;
 		default:
 			error_msg("invalid order_state %d", order_state);
@@ -717,7 +716,7 @@
 	}
 
 	if (tfind(cur_col, &root_col_locale, col_locale_cmp)) {
-		error_msg("attempt to readd locale: %s", cur_col->name);
+		error_msg("attempt to read locale: %s", cur_col->name);
 	}
 	if (!tsearch(cur_col, &root_col_locale, col_locale_cmp)) {
 		error_msg("OUT OF MEMORY!");
@@ -766,7 +765,14 @@
 			 * definitions in the supported locales derived from iso14651_t1. */
 			if (!strcmp(cur_base->name, "iso14651_t1")) {
 				fprintf(stderr, "Warning: adding UNDEFINED entry for %s\n", cur_col->name);
-				strcpy(linebuf, "order_start forward;backward;forward;forward,position\n");
+				strcpy(linebuf, "script <UNDEFINED_SECTION>\n");
+				pos_e = NULL;
+				pos = linebuf;
+				t = next_token();
+				assert(t);
+				assert(t == pos);
+				do_script();
+				strcpy(linebuf, "order_start <UNDEFINED_SECTION>;forward;backward;forward;forward,position\n");
 				pos_e = NULL;
 				pos = linebuf;
 				t = next_token();
@@ -780,6 +786,13 @@
 				assert(t);
 				assert(t == pos);
 				do_weight(t);
+				strcpy(linebuf, "order_end\n");
+				pos_e = NULL;
+				pos = linebuf;
+				t = next_token();
+				assert(t);
+				assert(t == pos);
+				do_order_end();
 			} else {
 				error_msg("no definition of UNDEFINED for %s", cur_col->name);
 			}
@@ -1782,14 +1795,18 @@
 	} else {					/* need an anonymous section */
 		if ((*cur_section->name != '<') && (cur_section->num_items == 0)) { /* already in an empty anonymous section */
 			sect = cur_section;
+/* 			fprintf(stdout, "using empty anon section %s\n", sect->name); */
 		} else {
 			sect = new_section(NULL);
 			l = find_ll_last(cur_col->section_list);
-			insque(new_ll_item(DT_SECTION, new_section(s)), l);
+			insque(new_ll_item(DT_SECTION, sect), l);
+/* 			fprintf(stdout, "adding order section after section %s\n", ((section_t *)(l->data))->name); */
+/* 			fprintf(stdout, "    last section is %s\n", ((section_t *)(l->next->data))->name); */
 		}
 		sect->num_rules = 0;	/* setting this below so nix default */
 	}
 	cur_section = sect;
+/* 	fprintf(stdout, "cur_section now %s\n", cur_section->name); */
 
 #warning need to add section to weight list?
 
@@ -3090,8 +3107,10 @@
 			}
 			/* we do this in two passes... first all sequences, then all single reorders */
 			for (s = cl->section_list ; s ; s = s->next) {
+/* 				fprintf(stderr, "doing section %s\n", ((section_t *)(s->data))->name); */
 				h = lli = ((section_t *)(s->data))->itm_list;
 				if (!lli) {
+/* 					fprintf(stdout, "EMPTY ITEM LIST IN SECTION %s\n", ((section_t *)(s->data))->name ); */
 					continue;
 				}
 				assert(u16_buf_len +4 < sizeof(u16_buf)/sizeof(u16_buf[0]));
@@ -3106,6 +3125,7 @@
 						u16_buf[u16_buf_len++] = lli->idx; /* start weight */
 					}
 					do {
+						assert(lli->data_type & DT_WEIGHTED);
 						if (lli->data_type & DT_WEIGHTED) {
 /* 							fprintf(stdout, "%11s: S %6d %6d %s\n", */
 /* 									cl->name, lli->idx, */




More information about the uClibc-cvs mailing list