Berry 'introspect.solidified()' to know if a Berry object is solidified in Flash or in RAM (#23063)

* Berry 'introspect.isconst()' to know if a Berry object is solidified or in RAM

* change to solidified

* fix typo
This commit is contained in:
s-hadinger 2025-02-24 14:05:58 +01:00 committed by GitHub
parent 375864b23b
commit 670fab7ead
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View File

@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- LVGL experimental mirroring of display on Web UI (#23041)
- Allow acl in mqtt when client certificate is in use with `#define USE_MQTT_CLIENT_CERT` (#22998)
- Berry `tasmota.when_network_up()` and simplified Matter using it
- Berry `introspect.solidified()` to know if a Berry object is solidified or in RAM
### Breaking Changed

View File

@ -137,6 +137,20 @@ static int m_toptr(bvm *vm)
be_return_nil(vm);
}
static int m_solidified(bvm *vm)
{
int top = be_top(vm);
if (top >= 1) {
bvalue *v = be_indexof(vm, 1);
if (var_basetype(v) >= BE_FUNCTION || var_type(v) == BE_COMPTR) {
bbool isconst = gc_isconst((bgcobject*)var_toobj(v));
be_pushbool(vm, isconst);
be_return(vm);
}
}
be_return_nil(vm);
}
static int m_fromptr(bvm *vm)
{
int top = be_top(vm);
@ -245,6 +259,7 @@ be_native_module_attr_table(introspect) {
be_native_module_function("toptr", m_toptr),
be_native_module_function("fromptr", m_fromptr),
be_native_module_function("solidified", m_solidified),
be_native_module_function("name", m_name),
@ -266,6 +281,7 @@ module introspect (scope: global, depend: BE_USE_INTROSPECT_MODULE) {
toptr, func(m_toptr)
fromptr, func(m_fromptr)
solidified, func(m_solidified)
name, func(m_name)

View File

@ -107,7 +107,7 @@ class be_class_tasmota (scope: global, name: Tasmota) {
init, closure(class_Tasmota_init_closure)
get_free_heap, func(l_getFreeHeap)
arch, func(l_arch)
arch, static_func(l_arch)
publish, func(be_mqtt_publish)
publish_result, func(l_publish_result)
publish_rule, func(l_publish_rule)

View File

@ -982,7 +982,7 @@ extern "C" {
be_return(vm);
}
// Berry: `arvh() -> string`
// Berry: `arch() -> string`
// ESP object
int32_t l_arch(bvm *vm);
int32_t l_arch(bvm *vm) {