fx: support for registering callable functions with types
This commit is contained in:
@@ -12,12 +12,22 @@ struct fx_type_p {
|
||||
|
||||
extern struct fx_type_info *fx_type_info_get_by_id(const union fx_type_id *key);
|
||||
extern struct fx_type_info *fx_type_info_get_by_name(const char *name);
|
||||
extern fx_function *fx_type_info_get_function_by_name(
|
||||
const struct fx_type_info *ty,
|
||||
const char *name);
|
||||
|
||||
static const char *type_get_name(const struct fx_type_p *ty)
|
||||
{
|
||||
return ty->ty_info->ty_name;
|
||||
}
|
||||
|
||||
const fx_function *type_get_function(
|
||||
const struct fx_type_p *ty,
|
||||
const char *name)
|
||||
{
|
||||
return fx_type_info_get_function_by_name(ty->ty_info, name);
|
||||
}
|
||||
|
||||
/*** PUBLIC FUNCTIONS *********************************************************/
|
||||
|
||||
fx_type *__fx_type_create(struct fx_type_info *type_info)
|
||||
@@ -40,6 +50,15 @@ const char *fx_type_get_name(const fx_type *ty)
|
||||
FX_CLASS_DISPATCH_STATIC_0(FX_REFLECTION_TYPE_TYPE, type_get_name, ty);
|
||||
}
|
||||
|
||||
const fx_function *fx_type_get_function(const fx_type *ty, const char *name)
|
||||
{
|
||||
FX_CLASS_DISPATCH_STATIC(
|
||||
FX_REFLECTION_TYPE_TYPE,
|
||||
type_get_function,
|
||||
ty,
|
||||
name);
|
||||
}
|
||||
|
||||
const fx_type *fx_type_get_by_id(fx_type_id id)
|
||||
{
|
||||
struct fx_type_info *ty = fx_type_info_get_by_id(id);
|
||||
|
||||
Reference in New Issue
Block a user