Mercurial > repos > rhope
annotate runtime/blueprint.c @ 180:c40e0faa1c92
Add Call to Dict and List
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 19 Jun 2011 10:43:11 -0700 |
parents | 9fab36cc706b |
children |
rev | line source |
---|---|
39 | 1 #include "blueprint.h" |
2 #include "builtin.h" | |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
3 #include "context.h" |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
39
diff
changeset
|
4 #include <stddef.h> |
39 | 5 |
6 typedef struct | |
7 { | |
8 blueprint * bp; | |
9 } l_Build; | |
10 | |
11 object * make_Blueprint(int32_t type_id) | |
12 { | |
13 t_Blueprint * obj; | |
14 object * ret = new_object(TYPE_BLUEPRINT); | |
15 obj = (t_Blueprint *)ret; | |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
39
diff
changeset
|
16 obj->bp = type_id ? get_blueprint_byid(type_id) : NULL; |
39 | 17 return ret; |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
18 } |
49
3e20ed8959c4
Added initial FFI implementation, Array type and 64-bit integers
Mike Pavone <pavone@retrodev.com>
parents:
39
diff
changeset
|
19 |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
20 int32_t _internal_blueprint_eq(object * left, object * right) |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
21 { |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
22 t_Blueprint * l = (t_Blueprint *)left; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
23 t_Blueprint * r = (t_Blueprint *)right; |
105
43cc42df26cc
Various compiler improvements
Mike Pavone <pavone@retrodev.com>
parents:
66
diff
changeset
|
24 release_ref(left); |
43cc42df26cc
Various compiler improvements
Mike Pavone <pavone@retrodev.com>
parents:
66
diff
changeset
|
25 release_ref(right); |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
26 return l->bp == r->bp; |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
27 } |
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
28 |
163
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
29 int32_t _internal_blueprint_rawsize(object * bp) |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
30 { |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
31 int32_t ret; |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
32 t_Blueprint * bprint = (t_Blueprint *)bp; |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
33 ret = bprint->bp->size; |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
34 release_ref(bp); |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
35 return ret; |
9fab36cc706b
Add Raw Size method to blueprint to allow code to query the raw size of a type in bytes
Mike Pavone <pavone@retrodev.com>
parents:
105
diff
changeset
|
36 } |
66
d4b44ae2e34a
New variant of C backend works now
Mike Pavone <pavone@retrodev.com>
parents:
49
diff
changeset
|
37 |