mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
...
This commit is contained in:
parent
67ae21d18d
commit
3bbcb384bd
@ -38,10 +38,10 @@ typedef py_TValue* py_TmpRef;
|
|||||||
/// @return true if the function is successful.
|
/// @return true if the function is successful.
|
||||||
typedef bool (*py_CFunction)(int argc, py_StackRef argv);
|
typedef bool (*py_CFunction)(int argc, py_StackRef argv);
|
||||||
|
|
||||||
enum BindType {
|
enum py_BindType {
|
||||||
BindType_FUNCTION,
|
py_FUNCTION,
|
||||||
BindType_STATICMETHOD,
|
py_STATICMETHOD,
|
||||||
BindType_CLASSMETHOD,
|
py_CLASSMETHOD,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum py_CompileMode { EXEC_MODE, EVAL_MODE, REPL_MODE, CELL_MODE };
|
enum py_CompileMode { EXEC_MODE, EVAL_MODE, REPL_MODE, CELL_MODE };
|
||||||
@ -153,13 +153,13 @@ void py_bind(py_Ref obj, const char* sig, py_CFunction f);
|
|||||||
py_ObjectRef py_bind2(py_Ref obj,
|
py_ObjectRef py_bind2(py_Ref obj,
|
||||||
const char* sig,
|
const char* sig,
|
||||||
py_CFunction f,
|
py_CFunction f,
|
||||||
enum BindType bt,
|
enum py_BindType bt,
|
||||||
const char* docstring,
|
const char* docstring,
|
||||||
int slots);
|
int slots);
|
||||||
|
|
||||||
// old style argc-based bindings
|
// old style argc-based bindings
|
||||||
void py_bindmethod(py_Type type, const char* name, py_CFunction f);
|
void py_bindmethod(py_Type type, const char* name, py_CFunction f);
|
||||||
void py_bindmethod2(py_Type type, const char* name, py_CFunction f, enum BindType bt);
|
void py_bindmethod2(py_Type type, const char* name, py_CFunction f, enum py_BindType bt);
|
||||||
void py_bindfunc(py_Ref obj, const char* name, py_CFunction f);
|
void py_bindfunc(py_Ref obj, const char* name, py_CFunction f);
|
||||||
|
|
||||||
/// Get the reference to the i-th register.
|
/// Get the reference to the i-th register.
|
||||||
|
@ -49,10 +49,10 @@ void py_newnativefunc(py_Ref out, py_CFunction f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void py_bindmethod(py_Type type, const char* name, py_CFunction f) {
|
void py_bindmethod(py_Type type, const char* name, py_CFunction f) {
|
||||||
py_bindmethod2(type, name, f, BindType_FUNCTION);
|
py_bindmethod2(type, name, f, py_FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void py_bindmethod2(py_Type type, const char* name, py_CFunction f, enum BindType bt) {
|
void py_bindmethod2(py_Type type, const char* name, py_CFunction f, enum py_BindType bt) {
|
||||||
py_TValue tmp;
|
py_TValue tmp;
|
||||||
py_newnativefunc(&tmp, f);
|
py_newnativefunc(&tmp, f);
|
||||||
py_setdict(py_tpobject(type), py_name(name), &tmp);
|
py_setdict(py_tpobject(type), py_name(name), &tmp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user