Updated Build Troubleshooting (markdown)
parent
ef95d18d06
commit
88dd01eb22
|
@ -61,6 +61,24 @@ MP_OBJ_TYPE_GET_SLOT(type, slot) # equivalent to type->slot (but you must know t
|
||||||
MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, slot) # marginally less efficient but will return NULL if the slot is not set
|
MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, slot) # marginally less efficient but will return NULL if the slot is not set
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If your code needs to access fields on `mp_obj_type_t` (this should be relatively rare), then you will now need to do so via the helper macros. Code that previously did:
|
||||||
|
|
||||||
|
```c
|
||||||
|
if (type->call) {} // See if field is set.
|
||||||
|
mp_call_fun_t f = type->call; // Access field.
|
||||||
|
type->call = f; // Set field.
|
||||||
|
```
|
||||||
|
|
||||||
|
will need to be changed to:
|
||||||
|
|
||||||
|
```c
|
||||||
|
if (MP_OBJ_TYPE_HAS_SLOT(type, call)) {}
|
||||||
|
mp_call_fun_t f = MP_OBJ_TYPE_GET_SLOT(type, call); // Or MP_OBJ_TYPE_GET_SLOT_OR_NULL(type, call) if you do not know whether the slot is set.
|
||||||
|
MP_OBJ_TYPE_SET_SLOT(type, call, f, index);
|
||||||
|
```
|
||||||
|
|
||||||
|
In the last case, you need to know the index (likely this is being used in a situation where you're initialising a new mp_obj_type_t instance so you can generate the slots sequentially).
|
||||||
|
|
||||||
## buffer
|
## buffer
|
||||||
|
|
||||||
The definition for a type with a buffer slot has been simplified and no longer requires a nested struct.
|
The definition for a type with a buffer slot has been simplified and no longer requires a nested struct.
|
||||||
|
|
Loading…
Reference in New Issue