Mercurial > repos > rhope
diff 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 |
line wrap: on
line diff
--- a/runtime/blueprint.c Tue Mar 02 00:18:49 2010 -0500 +++ b/runtime/blueprint.c Thu Apr 08 01:02:18 2010 -0400 @@ -1,6 +1,7 @@ #include "blueprint.h" #include "builtin.h" -#include "context.h" +#include "context.h" +#include <stddef.h> typedef struct { @@ -18,6 +19,18 @@ release_ref(cdata->params[0]); Ret(0, new_object_bp(locals->bp)) +EndFunc + +Func(BlueprintSP_Of, + NumParams 1, + CallSpace 1, + l_Build) + + locals->bp = get_blueprint(cdata->params[0]); + release_ref(cdata->params[0]); + + Ret(0, new_object(TYPE_BLUEPRINT)) + ((t_Blueprint *)cdata->params[0])->bp = locals->bp; EndFunc object * make_Blueprint(int32_t type_id) @@ -25,6 +38,15 @@ t_Blueprint * obj; object * ret = new_object(TYPE_BLUEPRINT); obj = (t_Blueprint *)ret; - obj->bp = get_blueprint_byid(type_id); + obj->bp = type_id ? get_blueprint_byid(type_id) : NULL; return ret; -} +} + +int32_t _internal_blueprint_eq(object * left, object * right) +{ + t_Blueprint * l = (t_Blueprint *)left; + t_Blueprint * r = (t_Blueprint *)right; + return l->bp == r->bp; +} + +