changeset 352:48aeb7379759

name table reconfig done except self compile.
author kono
date Sat, 03 Jul 2004 02:13:11 +0900
parents 000c509b663d
children 41ed77cb9c67
files mc-parse.c
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mc-parse.c	Sat Jul 03 00:32:27 2004 +0900
+++ b/mc-parse.c	Sat Jul 03 02:13:11 2004 +0900
@@ -345,6 +345,7 @@
     nptr_pool = nptr_pool0;
     for(p=nptr_pool;p;p=p->next) p->ptr=p->first;
     free_nptr_list = 0;
+    for(i=0;i<GSYMS;i++) htable[i] = 0;
 
     heap_init();
 
@@ -1000,10 +1001,10 @@
 
     int ndsp,ch,len=0;
     char *p = cheap->ptr;
+    char *q = name;
     unsigned int hash = 0;
     struct cheap scheap;
     NMTBL *n;
-    save_cheap(&scheap,cheap);
 
     while((ch = *name++)) {
 	hash_value(hash,*cheap->ptr = ch);
@@ -1011,18 +1012,21 @@
     }
     ndsp = ++stat_no;
     *cheap->ptr = delimit;
-    increment_cheap(cheap,&p); //len++;
+    increment_cheap(cheap,&p); if (delimit=='_') len++;
     while(ndsp>0) {
 	ch = ndsp%10+'0';
-	// hash_value(hash,*cheap->ptr = ch);
-	*cheap->ptr = ch;
-	increment_cheap(cheap,&p);//len++;
+	if (delimit=='_')
+	    hash_value(hash,*cheap->ptr = ch);
+	else
+	    *cheap->ptr = ch;
+	increment_cheap(cheap,&p);if (delimit=='_') len++;
 	ndsp /= 10;
     }
     *cheap->ptr = 0;
     increment_cheap(cheap,&p);
+    save_cheap(&scheap,cheap);
     n = name_space_search(
-	name_space_search(hash_search(p,&scheap,len,hash,DEF),LDECL),0);
+	name_space_search(hash_search(delimit=='_'?p:q,&scheap,len,hash,DEF),LDECL),0);
     n->nm = p;
     return n;
 }
@@ -1050,6 +1054,7 @@
 	// uninitialized part should be 0.
 	// local var init cannot postponed because of assign_expr0/type
 	nptr0=new_static_name("__lstruct",'_');
+	nptr0->next = local_static_list; local_static_list = nptr0;
 	nptr0->sc = GVAR;
 	e = size(type);
 	nptr0->ty = type;
@@ -2658,6 +2663,7 @@
 		smode = mode;
 		type = t;
 		nptr0=new_static_name("__lstruct",'_');
+		nptr0->next = local_static_list; local_static_list = nptr0;
 		nptr0->sc = GVAR;
 		e1 = size(type);
 		nptr0->ty = type;
@@ -2958,13 +2964,13 @@
 	if (mode==NONDEF) return 0;
 	hptr = get_nptr();
 	hptr->nm = name; /* name should be in the safe place (cheap) */
+	*iptr = hptr;
     }
     if (hptr->sc == 0) {
 	hptr->sc=EMPTY;
     } else {
 	cheap = reset_cheap(scheap);
     }
-    *iptr = hptr;
     return hptr;
 }