mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
some fix
This commit is contained in:
parent
b99540854e
commit
e82cad5b25
@ -46,14 +46,6 @@ struct VoidP{
|
|||||||
static void _register(VM* vm, PyObject* mod, PyObject* type);
|
static void _register(VM* vm, PyObject* mod, PyObject* type);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline PyObject* py_var(VM* vm, void* p){
|
|
||||||
return VAR_T(VoidP, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline PyObject* py_var(VM* vm, const void* p){
|
|
||||||
return VAR_T(VoidP, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define POINTER_VAR(Tp, NAME) \
|
#define POINTER_VAR(Tp, NAME) \
|
||||||
inline PyObject* py_var(VM* vm, Tp val){ \
|
inline PyObject* py_var(VM* vm, Tp val){ \
|
||||||
const static std::pair<StrName, StrName> P("c", NAME); \
|
const static std::pair<StrName, StrName> P("c", NAME); \
|
||||||
|
@ -133,12 +133,6 @@ struct Mat3x3{
|
|||||||
Vec2 _s() const;
|
Vec2 _s() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline PyObject* py_var(VM* vm, Vec2 obj){ return VAR_T(Vec2, obj); }
|
|
||||||
inline PyObject* py_var(VM* vm, Vec3 obj){ return VAR_T(Vec3, obj); }
|
|
||||||
inline PyObject* py_var(VM* vm, Vec4 obj){ return VAR_T(Vec4, obj); }
|
|
||||||
inline PyObject* py_var(VM* vm, const Mat3x3& obj){ return VAR_T(Mat3x3, obj); }
|
|
||||||
|
|
||||||
void add_module_linalg(VM* vm);
|
void add_module_linalg(VM* vm);
|
||||||
|
|
||||||
static_assert(sizeof(Py_<Mat3x3>) <= 64);
|
static_assert(sizeof(Py_<Mat3x3>) <= 64);
|
||||||
|
@ -210,6 +210,7 @@ inline void gc_mark_namedict(NameDict& t){
|
|||||||
|
|
||||||
StrName _type_name(VM* vm, Type type);
|
StrName _type_name(VM* vm, Type type);
|
||||||
template<typename T> T to_void_p(VM*, PyObject*);
|
template<typename T> T to_void_p(VM*, PyObject*);
|
||||||
|
PyObject* from_void_p(VM*, void*);
|
||||||
|
|
||||||
#define VAR(x) py_var(vm, x)
|
#define VAR(x) py_var(vm, x)
|
||||||
#define CAST(T, x) py_cast<T>(vm, x)
|
#define CAST(T, x) py_cast<T>(vm, x)
|
||||||
|
@ -504,6 +504,8 @@ PyObject* py_var(VM* vm, __T&& value){
|
|||||||
}else if constexpr(is_floating_point_v<T>){
|
}else if constexpr(is_floating_point_v<T>){
|
||||||
// float
|
// float
|
||||||
return tag_float(static_cast<f64>(std::forward<__T>(value)));
|
return tag_float(static_cast<f64>(std::forward<__T>(value)));
|
||||||
|
}else if constexpr(std::is_pointer_v<T>){
|
||||||
|
return from_void_p(vm, (void*)value);
|
||||||
}else{
|
}else{
|
||||||
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
||||||
if constexpr(const_type.index >= 0){
|
if constexpr(const_type.index >= 0){
|
||||||
|
@ -271,4 +271,8 @@ void add_module_c(VM* vm){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* from_void_p(VM* vm, void* p){
|
||||||
|
return VAR_T(VoidP, p);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace pkpy
|
} // namespace pkpy
|
Loading…
x
Reference in New Issue
Block a user