fx.reflection: remove fx_function_context
This commit is contained in:
@@ -1,86 +0,0 @@
|
|||||||
#include <fx/macros.h>
|
|
||||||
#include <fx/reflection/function.h>
|
|
||||||
#include <fx/string.h>
|
|
||||||
#include <fx/value.h>
|
|
||||||
#include <platform/callvm.h>
|
|
||||||
|
|
||||||
struct fx_function_context_p {
|
|
||||||
struct callvm ctx_vm;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*** PRIVATE FUNCTIONS ********************************************************/
|
|
||||||
|
|
||||||
static fx_status function_context_reset(
|
|
||||||
const struct fx_function_context_p *func)
|
|
||||||
{
|
|
||||||
return FX_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fx_status function_context_push_arg(
|
|
||||||
const struct fx_function_context_p *func,
|
|
||||||
const fx_value *arg)
|
|
||||||
{
|
|
||||||
return FX_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** PUBLIC FUNCTIONS *********************************************************/
|
|
||||||
|
|
||||||
FX_API fx_function *fx_function_context_create(void)
|
|
||||||
{
|
|
||||||
fx_function_context *ctx
|
|
||||||
= fx_object_create(FX_REFLECTION_TYPE_FUNCTION_CONTEXT);
|
|
||||||
if (!ctx) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct fx_function_context_p *p = fx_object_get_private(
|
|
||||||
ctx,
|
|
||||||
FX_REFLECTION_TYPE_FUNCTION_CONTEXT);
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
FX_API void fx_function_context_reset(fx_function_context *ctx)
|
|
||||||
{
|
|
||||||
FX_CLASS_DISPATCH_STATIC_V0(
|
|
||||||
FX_REFLECTION_TYPE_FUNCTION_CONTEXT,
|
|
||||||
function_context_reset,
|
|
||||||
ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
FX_API void fx_function_context_push_arg(
|
|
||||||
fx_function_context *ctx,
|
|
||||||
const fx_value *value)
|
|
||||||
{
|
|
||||||
FX_CLASS_DISPATCH_STATIC_V(
|
|
||||||
FX_REFLECTION_TYPE_FUNCTION_CONTEXT,
|
|
||||||
function_context_push_arg,
|
|
||||||
ctx,
|
|
||||||
value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** VIRTUAL FUNCTIONS ********************************************************/
|
|
||||||
|
|
||||||
static void function_context_init(fx_object *obj, void *priv)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void function_context_fini(fx_object *obj, void *priv)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** CLASS DEFINITION *********************************************************/
|
|
||||||
|
|
||||||
FX_TYPE_CLASS_DEFINITION_BEGIN(fx_function_context)
|
|
||||||
FX_TYPE_CLASS_INTERFACE_BEGIN(fx_object, FX_TYPE_OBJECT)
|
|
||||||
FX_INTERFACE_ENTRY(to_string) = NULL;
|
|
||||||
FX_TYPE_CLASS_INTERFACE_END(fx_object, FX_TYPE_OBJECT)
|
|
||||||
FX_TYPE_CLASS_DEFINITION_END(fx_function_context)
|
|
||||||
|
|
||||||
FX_TYPE_DEFINITION_BEGIN(fx_function_context)
|
|
||||||
FX_TYPE_ID(0x97d98a1a, 0x6312, 0x409e, 0xb47d, 0xc5d80daf9e50);
|
|
||||||
FX_TYPE_CLASS(fx_function_context_class);
|
|
||||||
FX_TYPE_INSTANCE_PRIVATE(struct fx_function_context_p);
|
|
||||||
FX_TYPE_INSTANCE_INIT(function_context_init);
|
|
||||||
FX_TYPE_INSTANCE_FINI(function_context_fini);
|
|
||||||
FX_TYPE_DEFINITION_END(fx_function_context)
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
FX_DECLS_BEGIN;
|
FX_DECLS_BEGIN;
|
||||||
|
|
||||||
#define FX_REFLECTION_TYPE_FUNCTION (fx_function_get_type())
|
#define FX_REFLECTION_TYPE_FUNCTION (fx_function_get_type())
|
||||||
#define FX_REFLECTION_TYPE_FUNCTION_CONTEXT (fx_function_context_get_type())
|
|
||||||
|
|
||||||
typedef enum fx_function_flags {
|
typedef enum fx_function_flags {
|
||||||
FX_FUNCTION_F_NONE = 0x00u,
|
FX_FUNCTION_F_NONE = 0x00u,
|
||||||
@@ -17,47 +16,14 @@ typedef enum fx_function_flags {
|
|||||||
FX_FUNCTION_F_VARARG = 0x04u,
|
FX_FUNCTION_F_VARARG = 0x04u,
|
||||||
} fx_function_flags;
|
} fx_function_flags;
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define FX_FUNCTION_VALUE(type) \
|
|
||||||
((fx_function_value) { \
|
|
||||||
.v_type = FX_FUNCTION_V_PRIMITIVE, \
|
|
||||||
.v_primitive = (type), \
|
|
||||||
})
|
|
||||||
|
|
||||||
typedef enum fx_function_value_type {
|
|
||||||
FX_FUNCTION_V_NONE = 0,
|
|
||||||
FX_FUNCTION_V_PRIMITIVE,
|
|
||||||
FX_FUNCTION_V_OBJECT,
|
|
||||||
} fx_function_value_type;
|
|
||||||
|
|
||||||
typedef struct fx_function_value {
|
|
||||||
fx_function_value_type v_type;
|
|
||||||
union {
|
|
||||||
fx_value_type v_primitive;
|
|
||||||
fx_type v_object;
|
|
||||||
};
|
|
||||||
} fx_function_value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef void (*fx_function_impl)();
|
typedef void (*fx_function_impl)();
|
||||||
|
|
||||||
FX_DECLARE_TYPE(fx_function);
|
FX_DECLARE_TYPE(fx_function);
|
||||||
FX_DECLARE_TYPE(fx_function_context);
|
|
||||||
|
|
||||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_function)
|
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_function)
|
||||||
FX_TYPE_CLASS_DECLARATION_END(fx_function)
|
FX_TYPE_CLASS_DECLARATION_END(fx_function)
|
||||||
|
|
||||||
FX_TYPE_CLASS_DECLARATION_BEGIN(fx_function_context)
|
|
||||||
FX_TYPE_CLASS_DECLARATION_END(fx_function_context)
|
|
||||||
|
|
||||||
FX_API fx_type fx_function_get_type();
|
FX_API fx_type fx_function_get_type();
|
||||||
FX_API fx_type fx_function_context_get_type();
|
|
||||||
|
|
||||||
FX_API fx_function_context *fx_function_context_create(void);
|
|
||||||
FX_API void fx_function_context_reset(fx_function_context *ctx);
|
|
||||||
FX_API void fx_function_context_push_arg(
|
|
||||||
fx_function_context *ctx,
|
|
||||||
const fx_value *value);
|
|
||||||
|
|
||||||
FX_API fx_function *fx_function_create(
|
FX_API fx_function *fx_function_create(
|
||||||
const char *name,
|
const char *name,
|
||||||
@@ -73,10 +39,6 @@ FX_API fx_status fx_function_invoke(
|
|||||||
const fx_value *args,
|
const fx_value *args,
|
||||||
size_t nr_args,
|
size_t nr_args,
|
||||||
fx_value *return_value);
|
fx_value *return_value);
|
||||||
FX_API fx_status fx_function_invoke_with_context(
|
|
||||||
const fx_function *func,
|
|
||||||
const fx_function_context *ctx,
|
|
||||||
fx_value *return_value);
|
|
||||||
|
|
||||||
FX_DECLS_END;
|
FX_DECLS_END;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user