Mercurial > repos > rhope
comparison runtime/builtin.c @ 50:689fb73e7612
Add support for various integer literals and add support for raw pointers to objects and raw pointers to arrays in the FFI
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 16 Apr 2010 01:57:04 -0400 |
parents | a24eb366195c |
children | 079200bc3e75 |
comparison
equal
deleted
inserted
replaced
49:3e20ed8959c4 | 50:689fb73e7612 |
---|---|
35 puts("Don't know how to print this type"); | 35 puts("Don't know how to print this type"); |
36 } | 36 } |
37 release_ref(cdata->params[0]); | 37 release_ref(cdata->params[0]); |
38 Ret(0, make_Int32(0)) | 38 Ret(0, make_Int32(0)) |
39 EndFunc | 39 EndFunc |
40 | |
41 object * make_Int64(int64_t val) | |
42 { | |
43 t_Int64 * obj; | |
44 object * ret = new_object(TYPE_INT64); | |
45 obj = (t_Int64 *)ret; | |
46 obj->Num = val; | |
47 return ret; | |
48 } | |
49 | |
50 | |
40 object * make_Int32(int32_t val) | 51 object * make_Int32(int32_t val) |
41 { | 52 { |
42 t_Int32 * obj; | 53 t_Int32 * obj; |
43 object * ret = new_object(TYPE_INT32); | 54 object * ret = new_object(TYPE_INT32); |
44 obj = (t_Int32 *)ret; | 55 obj = (t_Int32 *)ret; |
56 obj->Num = val; | |
57 return ret; | |
58 } | |
59 | |
60 object * make_Int16(int16_t val) | |
61 { | |
62 t_Int16 * obj; | |
63 object * ret = new_object(TYPE_INT16); | |
64 obj = (t_Int16 *)ret; | |
65 obj->Num = val; | |
66 return ret; | |
67 } | |
68 | |
69 object * make_Int8(int8_t val) | |
70 { | |
71 t_Int8 * obj; | |
72 object * ret = new_object(TYPE_INT8); | |
73 obj = (t_Int8 *)ret; | |
74 obj->Num = val; | |
75 return ret; | |
76 } | |
77 | |
78 object * make_UInt64(uint64_t val) | |
79 { | |
80 t_UInt64 * obj; | |
81 object * ret = new_object(TYPE_UINT64); | |
82 obj = (t_UInt64 *)ret; | |
83 obj->Num = val; | |
84 return ret; | |
85 } | |
86 | |
87 object * make_UInt32(uint32_t val) | |
88 { | |
89 t_UInt32 * obj; | |
90 object * ret = new_object(TYPE_UINT32); | |
91 obj = (t_UInt32 *)ret; | |
92 obj->Num = val; | |
93 return ret; | |
94 } | |
95 | |
96 object * make_UInt16(uint16_t val) | |
97 { | |
98 t_UInt16 * obj; | |
99 object * ret = new_object(TYPE_UINT16); | |
100 obj = (t_UInt16 *)ret; | |
101 obj->Num = val; | |
102 return ret; | |
103 } | |
104 | |
105 object * make_UInt8(uint8_t val) | |
106 { | |
107 t_UInt8 * obj; | |
108 object * ret = new_object(TYPE_UINT8); | |
109 obj = (t_UInt8 *)ret; | |
45 obj->Num = val; | 110 obj->Num = val; |
46 return ret; | 111 return ret; |
47 } | 112 } |
48 | 113 |
49 #define lval ((t_Boolean *)(cdata->params[0]))->Val | 114 #define lval ((t_Boolean *)(cdata->params[0]))->Val |