Mercurial > repos > rhope
comparison runtime/blueprint.c @ 49:3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Apr 2010 01:02:18 -0400 |
parents | 3d92bc1352c2 |
children | d4b44ae2e34a |
comparison
equal
deleted
inserted
replaced
48:a24eb366195c | 49:3e20ed8959c4 |
---|---|
1 #include "blueprint.h" | 1 #include "blueprint.h" |
2 #include "builtin.h" | 2 #include "builtin.h" |
3 #include "context.h" | 3 #include "context.h" |
4 #include <stddef.h> | |
4 | 5 |
5 typedef struct | 6 typedef struct |
6 { | 7 { |
7 blueprint * bp; | 8 blueprint * bp; |
8 } l_Build; | 9 } l_Build; |
18 release_ref(cdata->params[0]); | 19 release_ref(cdata->params[0]); |
19 | 20 |
20 Ret(0, new_object_bp(locals->bp)) | 21 Ret(0, new_object_bp(locals->bp)) |
21 EndFunc | 22 EndFunc |
22 | 23 |
24 Func(BlueprintSP_Of, | |
25 NumParams 1, | |
26 CallSpace 1, | |
27 l_Build) | |
28 | |
29 locals->bp = get_blueprint(cdata->params[0]); | |
30 release_ref(cdata->params[0]); | |
31 | |
32 Ret(0, new_object(TYPE_BLUEPRINT)) | |
33 ((t_Blueprint *)cdata->params[0])->bp = locals->bp; | |
34 EndFunc | |
35 | |
23 object * make_Blueprint(int32_t type_id) | 36 object * make_Blueprint(int32_t type_id) |
24 { | 37 { |
25 t_Blueprint * obj; | 38 t_Blueprint * obj; |
26 object * ret = new_object(TYPE_BLUEPRINT); | 39 object * ret = new_object(TYPE_BLUEPRINT); |
27 obj = (t_Blueprint *)ret; | 40 obj = (t_Blueprint *)ret; |
28 obj->bp = get_blueprint_byid(type_id); | 41 obj->bp = type_id ? get_blueprint_byid(type_id) : NULL; |
29 return ret; | 42 return ret; |
30 } | 43 } |
44 | |
45 int32_t _internal_blueprint_eq(object * left, object * right) | |
46 { | |
47 t_Blueprint * l = (t_Blueprint *)left; | |
48 t_Blueprint * r = (t_Blueprint *)right; | |
49 return l->bp == r->bp; | |
50 } | |
51 | |
52 |