- improve the interface of rtti to pass meta_obj_t* as parameter of type function to easy to access private/data
- rename some macro with RTTI - add RTTI_MAGIC in object header - add new rtti api
This commit is contained in:
parent
c8c1749347
commit
f78ed03591
15 changed files with 252 additions and 114 deletions
11
src/str.c
11
src/str.c
|
|
@ -5,13 +5,20 @@
|
|||
|
||||
char* toString(var v, ...)
|
||||
{
|
||||
meta_obj_t* obj = NULL;
|
||||
to_string_fn_t method = NULL;
|
||||
va_list ap;
|
||||
char* s = NULL;
|
||||
|
||||
RTTI_GET_METHOD(method, v, toString, toString);
|
||||
obj = RTTI_DATA_TO_OBJ(v);
|
||||
if (RTTI_OBJ_INVALID(obj)) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RTTI_GET_METHOD(method, obj, toString, toString);
|
||||
if (method == NULL) {
|
||||
errno = -EINVAL;
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue