# HG changeset patch # User Shinji KONO # Date 1396407647 -32400 # Node ID 34ecf0e6304a62e01f5edd41fe738a758ffe36ba # Parent 3454953b3df009c59648ed0248fa37bac2d770b9 parse_mode worked ( but wrong result on struct initiaization ) diff -r 3454953b3df0 -r 34ecf0e6304a mc-parse.c --- a/mc-parse.c Tue Apr 01 23:25:05 2014 +0900 +++ b/mc-parse.c Wed Apr 02 12:00:47 2014 +0900 @@ -1561,7 +1561,6 @@ decl_data_field(int type1,int v,int offset) { int t1,t2,period=0; - int foffset; // int offset0 = offset+size(type); int mode_save=mode; int type0=type_value(type1); @@ -1587,8 +1586,7 @@ if (size(t2)==size(type0)) { // direct assingn case , including (struct hoge){ ... } if (inmode) { - offset = list3(DECL_DATA,e,type0); - return offset; + return e; } offset = assign_data(e,type0,v,offset); return offset; @@ -1596,7 +1594,7 @@ // missing brace case error(SIERR); if (inmode) { - offset = list4(DECL_DATA_LIST,offset,list3(DECL_DATA,e,car(t1)),car(t1)); + offset = list4(DECL_DATA_LIST,offset,list3(DECL_DATA,e,t2),car(t1)); } else { offset = assign_data(e,car(t1),v,offset); } @@ -1610,6 +1608,7 @@ period=1; getsym(0); if (sym==IDENT) { + int foffset; nptr1 = nptr; t2 = search_struct_type(type1,nptr1->nm,&foffset); if (!t2) error(UFLDERR); @@ -1665,7 +1664,6 @@ // if initialization contains expressions, // we cannot do it in STADECL, but we can assign later in this mode if (inmode) error(-1); - if (local_nptr) error(-1); local_nptr = n; // will be clear in flush @@ -1874,7 +1872,8 @@ // we cannot handle direct struct assign ( struct hoge a = f(); ) here, because of missing brace case if (inmode) { int offset1=decl_data_field(t,v,0); - offset1 = reverse0(offset1); + if (car(offset1)==DECL_DATA_FIELD||car(offset1)==DECL_DATA_LIST) + offset1 = reverse0(offset1); offset=list3(DECL_DATA,offset1,t); } else { offset=decl_data_field(t,v,offset);