mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-19 12:27:16 +00:00
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:
parent
375864b23b
commit
670fab7ead
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user