Mercurial > hg > CbC > old > device
changeset 604:ff033b46cac5
*** empty log message ***
author | kono |
---|---|
date | Mon, 30 Jan 2006 13:42:12 +0900 |
parents | 2baddc88097d |
children | 1078c7e3bfb0 |
files | Changes Makefile Makefile.ia32 Makefile.linuxzaurus Makefile.mips Makefile.powerpc mc-codegen.c test/test2.c test/test2.code-out |
diffstat | 9 files changed, 63 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sat Jan 28 21:58:00 2006 +0900 +++ b/Changes Mon Jan 30 13:42:12 2006 +0900 @@ -8648,5 +8648,9 @@ といけないらしい。type を持ち歩けば、そのあたりは不要な わけなんだけど。むしろ逆にRINDIRECT only でもいいわけね。 - - +typecheck だけど、goto 文の中で local 変数へのpointer を +持ってたら warning を出すのが望ましい。 + +で、expr のconvert ですが、どうするの? inmode 入れちゃって、 +一気にプリントが簡単ですが.... statement level? なんか、 +構造がまったく変わっちゃうな。時間かかるかも。
--- a/Makefile Sat Jan 28 21:58:00 2006 +0900 +++ b/Makefile Mon Jan 30 13:42:12 2006 +0900 @@ -120,6 +120,7 @@ make check-code$(MK) TARGET=test/tmp6 make check-code$(MK) TARGET=test/scope make check-code$(MK) TARGET=test/throw + make check-code$(MK) TARGET=test/test2 make check-code$(MK) TARGET=test/too-long-argument check-nkf:
--- a/Makefile.ia32 Sat Jan 28 21:58:00 2006 +0900 +++ b/Makefile.ia32 Mon Jan 30 13:42:12 2006 +0900 @@ -110,6 +110,7 @@ make check-code$(MK) TARGET=test/fact make check-code$(MK) TARGET=test/goto make check-code$(MK) TARGET=test/test1 + make check-code$(MK) TARGET=test/test2 make check-code$(MK) TARGET=test/tmpa make check-code$(MK) TARGET=test/tmp1 make check-code$(MK) TARGET=test/tmp2
--- a/Makefile.linuxzaurus Sat Jan 28 21:58:00 2006 +0900 +++ b/Makefile.linuxzaurus Mon Jan 30 13:42:12 2006 +0900 @@ -111,6 +111,7 @@ make check-code$(MK) TARGET=test/fact make check-code$(MK) TARGET=test/goto make check-code$(MK) TARGET=test/test1 + make check-code$(MK) TARGET=test/test2 make check-code$(MK) TARGET=test/tmpa make check-code$(MK) TARGET=test/tmp1 make check-code$(MK) TARGET=test/tmp2
--- a/Makefile.mips Sat Jan 28 21:58:00 2006 +0900 +++ b/Makefile.mips Mon Jan 30 13:42:12 2006 +0900 @@ -109,6 +109,7 @@ make check-code$(MK) TARGET=test/fact make check-code$(MK) TARGET=test/goto make check-code$(MK) TARGET=test/test1 + make check-code$(MK) TARGET=test/test2 make check-code$(MK) TARGET=test/tmpa make check-code$(MK) TARGET=test/tmp1 make check-code$(MK) TARGET=test/tmp2
--- a/Makefile.powerpc Sat Jan 28 21:58:00 2006 +0900 +++ b/Makefile.powerpc Mon Jan 30 13:42:12 2006 +0900 @@ -113,6 +113,7 @@ make check-code$(MK) TARGET=test/fact make check-code$(MK) TARGET=test/goto make check-code$(MK) TARGET=test/test1 + make check-code$(MK) TARGET=test/test2 make check-code$(MK) TARGET=test/tmpa make check-code$(MK) TARGET=test/tmp1 make check-code$(MK) TARGET=test/tmp2
--- a/mc-codegen.c Sat Jan 28 21:58:00 2006 +0900 +++ b/mc-codegen.c Mon Jan 30 13:42:12 2006 +0900 @@ -4353,16 +4353,15 @@ } break; default: - // if (t1>0) compatible(cadr(t),cadr(t1)); - if (!scalar(t1)) error(TYERR); + if (!(t1>0&&car(t1)==ARRAY) && !scalar(t1)) error(TYERR); } } else { - if (!scalar(t1)) error(TYERR); + if (!(t1>0&&car(t1)==ARRAY) && !scalar(t1)) error(TYERR); } break; case STRUCT: case UNION: if (scalar(t1)) error(TYERR); - if(size(t)!=size(type)) error(TYERR); + else if(size(t)!=size(type)) error(TYERR); break; } } else {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/test2.c Mon Jan 30 13:42:12 2006 +0900 @@ -0,0 +1,42 @@ +#include <stdio.h> +int sender_bit; + +code (*ret)(int); +void *env; + +struct packet { + int bit; + char *msg; + code (*next)(); +}; + +code print_struct(struct packet pkt) +{ + printf("bit: %d\n", pkt.bit); + printf("message: %s\n", pkt.msg); + goto ret(0), env; +} + +code initSender(int init_bit, struct packet pkt) +{ + sender_bit = init_bit; + pkt.next = print_struct; + printf("initSender bit: %d\n", pkt.bit); + printf("initSender message: %s\n", pkt.msg); + printf("sender_bit: %d\n", sender_bit); + goto print_struct(pkt); +} + +int main(void) +{ + struct packet pkt; + pkt.bit = 1; + pkt.msg = "hogehoge"; + pkt.next = initSender; + ret = return; + env = environment; + printf("main bit: %d\n", pkt.bit); + printf("main message: %s\n", pkt.msg); + goto initSender(0, pkt); +} +