Berry compile local Berry with int64 (#21151)

* Berry compile local Berry with int64

* Revert solidify
This commit is contained in:
s-hadinger 2024-04-11 22:18:59 +02:00 committed by GitHub
parent 918faf3af6
commit 5e60d5217d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
CFLAGS = -Wall -Wextra -std=c99 -O2 -Wno-zero-length-array -Wno-empty-translation-unit CFLAGS = -Wall -Wextra -std=c99 -O2 -Wno-zero-length-array -Wno-empty-translation-unit -DUSE_BERRY_INT64
DEBUG_FLAGS = -O0 -g -DBE_DEBUG DEBUG_FLAGS = -O0 -g -DBE_DEBUG
TEST_FLAGS = $(DEBUG_FLAGS) --coverage -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined TEST_FLAGS = $(DEBUG_FLAGS) --coverage -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined
LIBS = -lm LIBS = -lm
@ -7,8 +7,8 @@ CC = clang # install clang!! gcc seems to produce a defect berry binary
MKDIR = mkdir MKDIR = mkdir
LFLAGS = LFLAGS =
INCPATH = src default ../re1.5 INCPATH = src default ../re1.5 ../berry_mapping/src ../berry_int64/src generate
SRCPATH = src default ../re1.5 SRCPATH = src default ../re1.5 ../berry_mapping/src ../berry_int64/src
GENERATE = generate GENERATE = generate
CONFIG = default/berry_conf.h CONFIG = default/berry_conf.h
COC = tools/coc/coc COC = tools/coc/coc

View File

@ -308,10 +308,11 @@ BERRY_LOCAL bclass_array be_class_table = {
&be_native_class(AudioOpusDecoder), &be_native_class(AudioOpusDecoder),
&be_native_class(AudioInputI2S), &be_native_class(AudioInputI2S),
#endif // defined(USE_I2S_AUDIO_BERRY) && (ESP_IDF_VERSION_MAJOR >= 5) #endif // defined(USE_I2S_AUDIO_BERRY) && (ESP_IDF_VERSION_MAJOR >= 5)
#endif // TASMOTA
#if defined(USE_BERRY_INT64) || defined(USE_MATTER_DEVICE) #if defined(USE_BERRY_INT64) || defined(USE_MATTER_DEVICE)
&be_native_class(int64), &be_native_class(int64),
#endif #endif
#endif // TASMOTA
NULL, /* do not remove */ NULL, /* do not remove */
}; };

View File

@ -14,6 +14,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "be_mapping.h"
/* using GNU/readline library */ /* using GNU/readline library */
#if defined(USE_READLINE_LIB) #if defined(USE_READLINE_LIB)
#include <readline/readline.h> #include <readline/readline.h>
@ -403,6 +405,7 @@ int main(int argc, char *argv[])
{ {
int res; int res;
bvm *vm = be_vm_new(); /* create a virtual machine instance */ bvm *vm = be_vm_new(); /* create a virtual machine instance */
be_set_ctype_func_hanlder(vm, be_call_ctype_func);
res = analysis_args(vm, argc, argv); res = analysis_args(vm, argc, argv);
be_vm_delete(vm); /* free all objects and vm */ be_vm_delete(vm); /* free all objects and vm */
return res; return res;

View File

@ -147,7 +147,7 @@ static void m_solidify_map(bvm *vm, bbool str_literal, bmap * map, const char *c
#if BE_INTGER_TYPE == 2 #if BE_INTGER_TYPE == 2
logfmt(" { be_const_key_int(%lli, %i), ", node->key.v.i, key_next); logfmt(" { be_const_key_int(%lli, %i), ", node->key.v.i, key_next);
#else #else
logfmt(" { be_const_key_int(%li, %i), ", node->key.v.i, key_next); logfmt(" { be_const_key_int(%i, %i), ", node->key.v.i, key_next);
#endif #endif
m_solidify_bvalue(vm, str_literal, &node->value, class_name, NULL, fout); m_solidify_bvalue(vm, str_literal, &node->value, class_name, NULL, fout);
} else { } else {
@ -190,14 +190,14 @@ static void m_solidify_bvalue(bvm *vm, bbool str_literal, bvalue * value, const
#if BE_INTGER_TYPE == 2 #if BE_INTGER_TYPE == 2
logfmt("be_const_int(%lli)", var_toint(value)); logfmt("be_const_int(%lli)", var_toint(value));
#else #else
logfmt("be_const_int(%li)", var_toint(value)); logfmt("be_const_int(%i)", var_toint(value));
#endif #endif
break; break;
case BE_INDEX: case BE_INDEX:
#if BE_INTGER_TYPE == 2 #if BE_INTGER_TYPE == 2
logfmt("be_const_var(%lli)", var_toint(value)); logfmt("be_const_var(%lli)", var_toint(value));
#else #else
logfmt("be_const_var(%li)", var_toint(value)); logfmt("be_const_var(%i)", var_toint(value));
#endif #endif
break; break;
case BE_REAL: case BE_REAL: