Mercurial > repos > rhope
comparison runtime/object.c @ 56:d2f9b0a9403d
Initial experiment with goto and switch
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Oct 2009 01:52:38 -0400 |
parents | 640f541e9116 |
children | b218af069da7 |
comparison
equal
deleted
inserted
replaced
38:7f05bbe82f24 | 56:d2f9b0a9403d |
---|---|
6 | 6 |
7 blueprint ** registered_types = NULL; | 7 blueprint ** registered_types = NULL; |
8 uint32_t max_registered_type = 0; | 8 uint32_t max_registered_type = 0; |
9 uint32_t type_storage = 0; | 9 uint32_t type_storage = 0; |
10 | 10 |
11 /* | |
11 returntype call_method(uint32_t methodid, calldata * params) | 12 returntype call_method(uint32_t methodid, calldata * params) |
12 { | 13 { |
13 int i; | 14 int i; |
14 blueprint * bp = get_blueprint(params->params[0]); | 15 blueprint * bp = get_blueprint(params->params[0]); |
15 if(methodid >= bp->first_methodid && methodid < bp->last_methodid && bp->method_lookup[methodid - bp->first_methodid]) | 16 if(methodid >= bp->first_methodid && methodid < bp->last_methodid && bp->method_lookup[methodid - bp->first_methodid]) |
119 //TODO: Add useful info to exception | 120 //TODO: Add useful info to exception |
120 for(i = 0; i < params->num_params; ++i) | 121 for(i = 0; i < params->num_params; ++i) |
121 release_ref(params->params[i]); | 122 release_ref(params->params[i]); |
122 params->params[0] = new_object(TYPE_WRONGTYPEEXCEPTION); | 123 params->params[0] = new_object(TYPE_WRONGTYPEEXCEPTION); |
123 return EXCEPTION_RETURN; | 124 return EXCEPTION_RETURN; |
124 } | 125 }*/ |
125 | 126 |
126 object * alloc_object(blueprint * bp) | 127 object * alloc_object(blueprint * bp) |
127 { | 128 { |
128 //TODO: Replace with something more performant | 129 //TODO: Replace with something more performant |
129 return malloc(bp->boxed_size); | 130 return malloc(bp->boxed_size); |
273 if(bp) | 274 if(bp) |
274 { | 275 { |
275 bp->size = size; | 276 bp->size = size; |
276 bp->boxed_size = size >= 0 ? size + sizeof(object) : size; | 277 bp->boxed_size = size >= 0 ? size + sizeof(object) : size; |
277 bp->method_lookup = bp->getter_lookup = bp->setter_lookup = bp->convert_to = bp->convert_from = NULL; | 278 bp->method_lookup = bp->getter_lookup = bp->setter_lookup = bp->convert_to = bp->convert_from = NULL; |
279 bp->type_id = type; | |
278 bp->init = init ? init : default_action; | 280 bp->init = init ? init : default_action; |
279 bp->copy = copy ? copy : default_action; | 281 bp->copy = copy ? copy : default_action; |
280 bp->cleanup = cleanup ? cleanup : default_action; | 282 bp->cleanup = cleanup ? cleanup : default_action; |
281 bp->first_methodid = bp->last_methodid = bp->first_getfieldid = bp->last_getfieldid = bp->first_setfieldid = bp->last_setfieldid = bp->first_convertto = bp->last_convertto = bp->first_convertfrom = bp->last_convertfrom = 0; | 283 bp->first_methodid = bp->last_methodid = bp->first_getfieldid = bp->last_getfieldid = bp->first_setfieldid = bp->last_setfieldid = bp->first_convertto = bp->last_convertto = bp->first_convertfrom = bp->last_convertfrom = 0; |
282 //TODO: Handle names | 284 //TODO: Handle names |