Mercurial > repos > rhope
comparison 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 |
comparison
equal
deleted
inserted
replaced
29:3cc5e4a42344 | 30:914ad38f9b59 |
---|---|
1 #include "builtin.h" | 1 #include "builtin.h" |
2 #include "object.h" | 2 #include "object.h" |
3 #include "integer.h" | 3 #include "integer.h" |
4 #include "bool.h" | 4 #include "bool.h" |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdio.h> | |
6 | 7 |
7 void register_builtin_type(uint32_t type) | 8 void register_builtin_type(uint32_t type) |
8 { | 9 { |
9 blueprint * bp; | 10 blueprint * bp; |
10 switch(type) | 11 switch(type) |
32 uint32_t i; | 33 uint32_t i; |
33 for(i = 0; i < TYPE_FIRST_USER; ++i) | 34 for(i = 0; i < TYPE_FIRST_USER; ++i) |
34 register_builtin_type(i); | 35 register_builtin_type(i); |
35 } | 36 } |
36 | 37 |
38 //TODO: Remove this when it's possible to write Print in Rhope | |
39 FuncNoLocals(Print, | |
40 NumParams 1, | |
41 CallSpace 0) | |
42 | |
43 if(get_blueprint(cdata->params[0]) == get_blueprint_byid(TYPE_INT32)) | |
44 { | |
45 printf("%d\n", ((t_Int32 *)(cdata->params[0]))->num); | |
46 } else { | |
47 puts("Don't know how to print this type"); | |
48 } | |
49 release_ref(cdata->params[0]); | |
50 Ret(0, make_Int32(0)) | |
51 EndFunc |