|
|
@@ -28,15 +28,7 @@ typedef struct PyVar{
|
|
|
};
|
|
|
} PyVar;
|
|
|
|
|
|
-
|
|
|
-#define PyVar__as(T, self) _Generic((T), \
|
|
|
- int64_t: self->_i64, \
|
|
|
- double: self->_f64, \
|
|
|
- PyObject*: self->_obj, \
|
|
|
- void*: self->_ptr, \
|
|
|
-)
|
|
|
-
|
|
|
-static_assert(sizeof(PyVar) == 16, "sizeof(PyVar) != 16");
|
|
|
+static_assert(sizeof(PyVar) <= 16, "!sizeof(PyVar) <= 16");
|
|
|
|
|
|
/* predefined vars */
|
|
|
static const py_Type tp_object = {1}, tp_type = {2};
|
|
|
@@ -52,24 +44,6 @@ static const py_Type tp_ellipsis = {26};
|
|
|
static const py_Type tp_op_call = {27}, tp_op_yield = {28};
|
|
|
static const py_Type tp_syntax_error = {29}, tp_stop_iteration = {30};
|
|
|
|
|
|
-PK_INLINE bool PyVar__is_null(const PyVar* self) { return self->type == 0; }
|
|
|
-PK_INLINE int64_t PyVar__hash(const PyVar* self) { return self->extra + self->_i64; }
|
|
|
-
|
|
|
-PK_INLINE void PyVar__ctor(PyVar* self, py_Type type, PyObject* obj){
|
|
|
- self->type = type;
|
|
|
- self->is_ptr = true;
|
|
|
- self->_obj = obj;
|
|
|
-}
|
|
|
-
|
|
|
-void PyVar__ctor3(PyVar* self, PyObject* existing);
|
|
|
-
|
|
|
-PK_INLINE bool PyVar__IS_OP(const PyVar* a, const PyVar* b){
|
|
|
- return a->is_ptr && b->is_ptr && a->_obj == b->_obj;
|
|
|
-}
|
|
|
-
|
|
|
-#define pkpy_Var__is_null(self) ((self)->type == 0)
|
|
|
-#define pkpy_Var__set_null(self) do { (self)->type = 0; } while(0)
|
|
|
-
|
|
|
extern PyVar PY_NULL, PY_OP_CALL, PY_OP_YIELD;
|
|
|
|
|
|
#ifdef __cplusplus
|