Mercurial > repos > tabletprog
view runtime/object.h @ 333:577406b25f89
Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 29 Mar 2015 09:43:24 -0700 |
parents | d2b70cba661e |
children |
line wrap: on
line source
#ifndef OBJECT_H_ #define OBJECT_H_ #include <stdint.h> #include <stdarg.h> #define LAST_METHOD 0xFFFFFFFF typedef struct obj_meta obj_meta; typedef struct object { obj_meta * meta; struct object * parent; } object; typedef object * (*method)(uint32_t method_id, uint32_t num_args, object * self, va_list args); typedef object * (*closure_func)(void *, uint32_t, ...); /* typedef struct closure { object header; void * env; closure_func func; } closure; */ struct obj_meta { uint32_t size; method meth_lookup[16]; uint32_t *methods[16]; }; extern obj_meta lambda_meta; object * mcall(uint32_t method_id, uint32_t num_args, object * self, ...); #define ccall(clos, num_args, ...) (((lambda *)clos)->func(((lambda *)clos)->env, num_args,##__VA_ARGS__)) void * make_object(obj_meta * meta, void * parent, int num_props, ...); object * make_lambda(void * env, closure_func func); object * make_array(uint32_t num_els, ...); object * make_list(uint32_t num_els, ...); int object_understands(object * obj, uint32_t method_id); #endif //OBJECT_H_