Mercurial > hg > CbC > old > device
changeset 702:8eadf0db2970
*** empty log message ***
author | kono |
---|---|
date | Tue, 23 Oct 2007 14:30:59 +0900 |
parents | bf4fd39737e9 |
children | 874adc2528f9 |
files | Makefile mc-codegen.c mc-inline.c test/simp0.c |
diffstat | 4 files changed, 30 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Tue Oct 23 09:58:37 2007 +0900 +++ b/Makefile Tue Oct 23 14:30:59 2007 +0900 @@ -135,7 +135,7 @@ make check-code$(MK) TARGET=test/throw make check-code$(MK) TARGET=test/too-long-argument -check-nkf: +check-nkf: mc ( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c ) ( cd nkf203; ../mc-$(ARCH) -s nkf.c utf8tbl.c ) ( cd nkf203; $(CC) -g -o nkf nkf.s utf8tbl.s )
--- a/mc-codegen.c Tue Oct 23 09:58:37 2007 +0900 +++ b/mc-codegen.c Tue Oct 23 14:30:59 2007 +0900 @@ -3632,7 +3632,9 @@ if (car(init)!=DECL_DATA_ARRAY) { error(-1); } - e = pexpr(caddr(init)); + e = caddr(init); + if (!e) continue; // {...,} case + e = pexpr(e); offset = gen_decl_data0(v,type0,e,offset); } return offset; @@ -3664,7 +3666,7 @@ static int gen_decl_data_list(int v,int init,int target_type,int offset) { - int type0 = caddr(target_type); /* list of fields */ + int type0 = cadr(target_type); /* type of element */ int e; for(; init; init = cadr(init)) { @@ -3673,8 +3675,8 @@ error(-1); } e = caddr(init); - offset = gen_decl_data0(v,car(type0),e,offset); - type0 = cadr(type0); + if (!e) continue; // {...,} case + offset = gen_decl_data0(v,type0,e,offset); } return offset; } @@ -3737,6 +3739,7 @@ } gen_decl_data0(v,t,e,offset); + text_mode(0); if (init_vars) emit_init_vars(); g_expr0(e1);
--- a/mc-inline.c Tue Oct 23 09:58:37 2007 +0900 +++ b/mc-inline.c Tue Oct 23 14:30:59 2007 +0900 @@ -696,8 +696,9 @@ } #endif if (car(e)==ADDRESS||car(e)==GVAR) { - if (scalar(t)||car(t)==ARRAY) { + if (scalar(t)) { t = list2(POINTER,VOID); // fake + } else if (t>0 && car(t)==ARRAY) { } else { error(TYERR); } @@ -707,7 +708,7 @@ return offset+cadr(e); } type = t; - e = rvalue_t(e,t); + // e = rvalue_t(e,t); if (!scalar(type) && (type>0 && (car(type)!=ADDRESS && car(type)!=ARRAY))) e = correct_type(e,target_type); /* If this is a local declared constant, we don't have to assign.
--- a/test/simp0.c Tue Oct 23 09:58:37 2007 +0900 +++ b/test/simp0.c Tue Oct 23 14:30:59 2007 +0900 @@ -1,8 +1,27 @@ int printf(const char *format, ...); +#define LBUFSIZE 10 +static char current_file_dir[LBUFSIZE]; // keep track include file directory + +void +copy_current_file_dir(char *name) +{ + char *s = name; + char *d = current_file_dir; + char *p; + for(p = d;d<current_file_dir+LBUFSIZE && *s; ) { + if (*s=='/') p = d+1; + *d++ = *s++; + } + *p = 0; +} + main(int ac,char *av[]) { printf("#0005:%d %d %d %s\n",1,2,3,&av[ac-1][3]); + copy_current_file_dir("test/hoge"); + printf("#0006:%s\n",current_file_dir); + return 0; }