Mercurial > repos > tabletprog
diff runtime/progfoot.inc @ 31:668f533e5284
Add initial version of C backend
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 07 Jul 2012 16:48:36 -0700 |
parents | |
children | bf5e88f6419d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runtime/progfoot.inc Sat Jul 07 16:48:36 2012 -0700 @@ -0,0 +1,23 @@ + +int main(int argc, char ** argv) +{ + object * params[64]; + params[0] = mainModule(); + object * ret = mcall(METHOD_ID_MAIN, 1, params); + printf("%p:%p\n", ret->meta, &obj_int32_meta); + if (ret->meta == &obj_int32_meta) { + obj_int32 * reti32 = (obj_int32 *) ret; + printf("%d\n", reti32->num); + } else if(ret->meta == &lambda_meta) { + puts("returned lambda????"); + } else { + int i = 0; + for(; i < 16; ++i) { + if (ret->meta->meth_lookup[i] != &no_impl) { + printf("slot %d is set\n", i); + } + } + } + return 0; +} +