diff options
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -163,8 +163,8 @@ typedef mp_obj_t (*mp_call_fun_t)(mp_obj_t fun, uint n_args, uint n_kw, const mp typedef mp_obj_t (*mp_unary_op_fun_t)(int op, mp_obj_t); typedef mp_obj_t (*mp_binary_op_fun_t)(int op, mp_obj_t, mp_obj_t); typedef void (*mp_load_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t *dest); // for fail, do nothing; for attr, dest[0] = value; for method, dest[0] = method, dest[1] = self -typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded -typedef bool (*mp_store_item_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); // return true if store succeeded +typedef bool (*mp_store_attr_fun_t)(mp_obj_t self_in, qstr attr, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete +typedef bool (*mp_store_item_fun_t)(mp_obj_t self_in, mp_obj_t index, mp_obj_t value); // return true if store succeeded; if value==MP_OBJ_NULL then delete typedef struct _mp_method_t { qstr name; @@ -196,6 +196,8 @@ typedef struct _buffer_info_t { typedef struct _mp_buffer_p_t { machine_int_t (*get_buffer)(mp_obj_t obj, buffer_info_t *bufinfo, int flags); } mp_buffer_p_t; +bool mp_get_buffer(mp_obj_t obj, buffer_info_t *bufinfo); +void mp_get_buffer_raise(mp_obj_t obj, buffer_info_t *bufinfo); // Stream protocol typedef struct _mp_stream_p_t { @@ -217,9 +219,10 @@ struct _mp_obj_type_t { mp_binary_op_fun_t binary_op; // can return NULL if op not supported mp_load_attr_fun_t load_attr; - mp_store_attr_fun_t store_attr; - // Implements container[index] = val; note that load_item is implemented - // by binary_op(RT_BINARY_OP_SUBSCR) + mp_store_attr_fun_t store_attr; // if value is MP_OBJ_NULL, then delete that attribute + + // Implements container[index] = val. If val == MP_OBJ_NULL, then it's a delete. + // Note that load_item is implemented by binary_op(RT_BINARY_OP_SUBSCR) mp_store_item_fun_t store_item; mp_fun_1_t getiter; @@ -259,6 +262,7 @@ extern const mp_obj_type_t mp_type_bool; extern const mp_obj_type_t mp_type_int; extern const mp_obj_type_t mp_type_str; extern const mp_obj_type_t mp_type_bytes; +extern const mp_obj_type_t mp_type_bytearray; extern const mp_obj_type_t mp_type_float; extern const mp_obj_type_t mp_type_complex; extern const mp_obj_type_t mp_type_tuple; @@ -365,6 +369,7 @@ void mp_obj_print(mp_obj_t o, mp_print_kind_t kind); void mp_obj_print_exception(mp_obj_t exc); int mp_obj_is_true(mp_obj_t arg); +bool mp_obj_is_integer(mp_obj_t o_in); // returns true if o_in is bool, small int, or long int bool mp_obj_is_callable(mp_obj_t o_in); machine_int_t mp_obj_hash(mp_obj_t o_in); bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2); |