This commit is contained in:
@@ -530,6 +530,60 @@ PH7_APIEXPORT int ph7_vm_reset(ph7_vm *pVm);
|
||||
PH7_APIEXPORT int ph7_vm_release(ph7_vm *pVm);
|
||||
PH7_APIEXPORT int ph7_vm_dump(ph7_vm *pVm, int (*xConsumer)(const void *, unsigned int, void *), void *pUserData);
|
||||
/* In-process Extending Interfaces */
|
||||
/*
|
||||
* Public native class declarations. Names are NUL-terminated identifiers.
|
||||
* A NULL initializer pointer means no initializer; a value containing NULL is
|
||||
* an explicit initializer. Descriptors and values are copied by registration.
|
||||
* Callback code and user data must remain valid until the VM is released.
|
||||
*/
|
||||
enum ph7_type {
|
||||
PH7_TYPE_BOOL = 1, PH7_TYPE_CALLBACK, PH7_TYPE_CHAR, PH7_TYPE_FLOAT,
|
||||
PH7_TYPE_INT, PH7_TYPE_MIXED, PH7_TYPE_OBJECT, PH7_TYPE_RESOURCE,
|
||||
PH7_TYPE_STRING, PH7_TYPE_VOID, PH7_TYPE_NAMED
|
||||
};
|
||||
typedef struct ph7_type_def {
|
||||
int iType;
|
||||
const char *zClass; /* Required only for PH7_TYPE_NAMED; self is allowed. */
|
||||
int bArray; /* Zero or one: the language's T[] annotation. */
|
||||
} ph7_type_def;
|
||||
typedef struct ph7_field_def {
|
||||
const char *zName;
|
||||
ph7_type_def sType;
|
||||
const ph7_value *pInitial;
|
||||
unsigned int iFlags;
|
||||
} ph7_field_def;
|
||||
typedef struct ph7_constant_def {
|
||||
const char *zName;
|
||||
const ph7_value *pValue;
|
||||
} ph7_constant_def;
|
||||
typedef struct ph7_param_def {
|
||||
const char *zName; /* Exact lowercase this/parent are reserved, even for static methods. */
|
||||
ph7_type_def sType;
|
||||
} ph7_param_def;
|
||||
typedef struct ph7_method_def {
|
||||
const char *zName;
|
||||
ph7_type_def sResult;
|
||||
const ph7_param_def *aParam;
|
||||
unsigned int nParam;
|
||||
int (*xFunc)(ph7_context *, int, ph7_value **);
|
||||
void *pUserData;
|
||||
unsigned int iFlags;
|
||||
} ph7_method_def;
|
||||
typedef struct ph7_class_def {
|
||||
const char *zName;
|
||||
const ph7_field_def *aField;
|
||||
unsigned int nField;
|
||||
const ph7_constant_def *aConstant;
|
||||
unsigned int nConstant;
|
||||
const ph7_method_def *aMethod;
|
||||
unsigned int nMethod;
|
||||
} ph7_class_def;
|
||||
#define PH7_MEMBER_STATIC 0x01
|
||||
/* Return an exception object using ph7_result_value(), then this status. */
|
||||
#define PH7_EXCEPTION (-255)
|
||||
PH7_APIEXPORT int ph7_create_class(ph7_vm *pVm, const ph7_class_def *pDef);
|
||||
/* Borrowed receiver, valid only during this callback; NULL for static calls. */
|
||||
PH7_APIEXPORT ph7_value *ph7_context_this(ph7_context *pCtx);
|
||||
PH7_APIEXPORT int ph7_create_function(ph7_vm *pVm, const char *zName, int (*xFunc)(ph7_context *, int, ph7_value **), void *pUserData);
|
||||
PH7_APIEXPORT int ph7_delete_function(ph7_vm *pVm, const char *zName);
|
||||
PH7_APIEXPORT int ph7_create_constant(ph7_vm *pVm, const char *zName, void (*xExpand)(ph7_value *, void *), void *pUserData);
|
||||
|
||||
Reference in New Issue
Block a user