- 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:
Rongsong Shen 2026-01-30 12:26:23 +08:00
parent c8c1749347
commit f78ed03591
15 changed files with 252 additions and 114 deletions

View file

@ -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;
}