Mercurial > repos > rhope
diff runtime/builtin.c @ 30:914ad38f9b59
Compiler now works for some simple programs
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 28 Sep 2009 19:42:33 -0400 |
parents | 31f8182f3433 |
children | 495dddadd058 |
line wrap: on
line diff
--- a/runtime/builtin.c Sat Jun 27 01:50:33 2009 -0400 +++ b/runtime/builtin.c Mon Sep 28 19:42:33 2009 -0400 @@ -3,6 +3,7 @@ #include "integer.h" #include "bool.h" #include <stddef.h> +#include <stdio.h> void register_builtin_type(uint32_t type) { @@ -34,3 +35,17 @@ register_builtin_type(i); } +//TODO: Remove this when it's possible to write Print in Rhope +FuncNoLocals(Print, + NumParams 1, + CallSpace 0) + + if(get_blueprint(cdata->params[0]) == get_blueprint_byid(TYPE_INT32)) + { + printf("%d\n", ((t_Int32 *)(cdata->params[0]))->num); + } else { + puts("Don't know how to print this type"); + } + release_ref(cdata->params[0]); + Ret(0, make_Int32(0)) +EndFunc