mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
...
This commit is contained in:
parent
e33d9fe595
commit
e5d5f09d83
10
src/obj.h
10
src/obj.h
@ -12,17 +12,23 @@ struct Function;
|
|||||||
class VM;
|
class VM;
|
||||||
|
|
||||||
typedef PyObject* (*NativeFuncC)(VM*, ArgsView);
|
typedef PyObject* (*NativeFuncC)(VM*, ArgsView);
|
||||||
typedef shared_ptr<CodeObject> CodeObject_;
|
typedef int (*LuaStyleFuncC)(VM*);
|
||||||
|
|
||||||
struct NativeFunc {
|
struct NativeFunc {
|
||||||
NativeFuncC f;
|
NativeFuncC f;
|
||||||
int argc; // DONOT include self
|
int argc; // DONOT include self
|
||||||
bool method;
|
bool method;
|
||||||
|
|
||||||
NativeFunc(NativeFuncC f, int argc, bool method) : f(f), argc(argc), method(method) {}
|
// this is designed for lua style C bindings
|
||||||
|
// access it via `CAST(NativeFunc&, args[-2])._lua_f`
|
||||||
|
LuaStyleFuncC _lua_f;
|
||||||
|
|
||||||
|
NativeFunc(NativeFuncC f, int argc, bool method) : f(f), argc(argc), method(method), _lua_f(nullptr) {}
|
||||||
PyObject* operator()(VM* vm, ArgsView args) const;
|
PyObject* operator()(VM* vm, ArgsView args) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef shared_ptr<CodeObject> CodeObject_;
|
||||||
|
|
||||||
struct FuncDecl {
|
struct FuncDecl {
|
||||||
struct KwArg {
|
struct KwArg {
|
||||||
int key; // index in co->varnames
|
int key; // index in co->varnames
|
||||||
|
Loading…
x
Reference in New Issue
Block a user