mirror of https://github.com/arendst/Tasmota.git
Merge pull request #13142 from s-hadinger/berry_resolifify
Berry update and global resolidify
This commit is contained in:
commit
6b48d9949b
|
@ -23,7 +23,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 1]) { /* code */
|
||||
0x80000000, // 0000 RET 0 R0
|
||||
0x80000000, // 0000 RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
|
@ -44,12 +44,12 @@ be_local_closure(get_tasmota, /* name */
|
|||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 1]) { /* constants */
|
||||
be_nested_string("tasmota", 424643812, 7), /* R256 - K0 */
|
||||
/* K0 */ be_nested_string("tasmota", 424643812, 7),
|
||||
}),
|
||||
(be_nested_const_str("get_tasmota", 334356779, 11)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 2]) { /* code */
|
||||
0xB8060000, // 0000 GETNGBL R1 R256
|
||||
0xB8060000, // 0000 GETNGBL R1 K0
|
||||
0x80040200, // 0001 RET 1 R1
|
||||
})
|
||||
)
|
||||
|
@ -98,19 +98,19 @@ be_local_closure(add_cmd, /* name */
|
|||
}),
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 2]) { /* constants */
|
||||
be_nested_string("tasmota", 424643812, 7), /* R256 - K0 */
|
||||
be_nested_string("add_cmd", -933336417, 7), /* R257 - K1 */
|
||||
/* K0 */ be_nested_string("tasmota", 424643812, 7),
|
||||
/* K1 */ be_nested_string("add_cmd", -933336417, 7),
|
||||
}),
|
||||
(be_nested_const_str("add_cmd", -933336417, 7)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 7]) { /* code */
|
||||
0xB80E0000, // 0000 GETNGBL R3 R256
|
||||
0x8C0C0701, // 0001 GETMET R3 R3 R257
|
||||
0xB80E0000, // 0000 GETNGBL R3 K0
|
||||
0x8C0C0701, // 0001 GETMET R3 R3 K1
|
||||
0x5C140200, // 0002 MOVE R5 R1
|
||||
0x84180000, // 0003 CLOSURE R6 P0
|
||||
0x7C0C0600, // 0004 CALL R3 3
|
||||
0xA0000000, // 0005 CLOSE 0
|
||||
0x80000000, // 0006 RET 0 R0
|
||||
0xA0000000, // 0005 CLOSE R0
|
||||
0x80000000, // 0006 RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
|
@ -11,19 +11,11 @@
|
|||
|
||||
extern int b_nrg_read(bvm *vm);
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
be_native_module_attr_table(energy) {
|
||||
be_native_module_function("read", b_nrg_read),
|
||||
};
|
||||
|
||||
be_define_native_module(energy, NULL);
|
||||
#else
|
||||
/* @const_object_info_begin
|
||||
module energy (scope: global) {
|
||||
read, func(b_nrg_read)
|
||||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_energy.h"
|
||||
#endif
|
||||
|
||||
#endif // USE_ENERGY_SENSOR
|
|
@ -11,16 +11,6 @@ extern int p_flash_read(bvm *vm);
|
|||
extern int p_flash_write(bvm *vm);
|
||||
extern int p_flash_erase(bvm *vm);
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
be_native_module_attr_table(flash) {
|
||||
be_native_module_function("read", p_flash_read),
|
||||
be_native_module_function("write", p_flash_write),
|
||||
be_native_module_function("erase", p_flash_erase),
|
||||
|
||||
};
|
||||
|
||||
be_define_native_module(flash, NULL);
|
||||
#else
|
||||
/* @const_object_info_begin
|
||||
module flash (scope: global) {
|
||||
read, func(p_flash_read)
|
||||
|
@ -29,4 +19,3 @@ module flash (scope: global) {
|
|||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_flash.h"
|
||||
#endif
|
||||
|
|
|
@ -476,7 +476,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 9]) { /* code */
|
||||
0x60040014, // 0000 GETGBL R1 G20
|
||||
0x60040003, // 0000 GETGBL R1 G3
|
||||
0x5C080000, // 0001 MOVE R2 R0
|
||||
0xB80E0000, // 0002 GETNGBL R3 K0
|
||||
0x7C040400, // 0003 CALL R1 2
|
||||
|
|
|
@ -11,333 +11,6 @@
|
|||
|
||||
extern bclass* be_class_Driver; // Parent class
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: init
|
||||
********************************************************************/
|
||||
be_local_closure(init, /* name */
|
||||
be_nested_proto(
|
||||
10, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[10]) { /* constants */
|
||||
be_nested_string("get_tasmota", 334356779, 11),
|
||||
be_nested_string("i2c_enabled", 218388101, 11),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("wire_scan", -1623691416, 9),
|
||||
be_nested_string("function", -1630125495, 8),
|
||||
be_nested_string("name", -1925595674, 4),
|
||||
be_nested_string("I2C:", 813483371, 4),
|
||||
be_nested_string("detected on bus", 1432002650, 15),
|
||||
be_nested_string("bus", 1607822841, 3),
|
||||
}),
|
||||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[44]) { /* code */
|
||||
0x8C100100, // 0000 GETMET R4 R0 R256
|
||||
0x7C100200, // 0001 CALL R4 1
|
||||
0x4C140000, // 0002 LDNIL 5
|
||||
0x20140605, // 0003 NE R5 R3 R5
|
||||
0x78160004, // 0004 JMPF R5 #000A
|
||||
0x8C140901, // 0005 GETMET R5 R4 R257
|
||||
0x5C1C0600, // 0006 MOVE R7 R3
|
||||
0x7C140400, // 0007 CALL R5 2
|
||||
0x74160000, // 0008 JMPT R5 #000A
|
||||
0x80000A00, // 0009 RET 0 R5
|
||||
0x90020402, // 000A SETMBR R0 R258 R2
|
||||
0x8C140904, // 000B GETMET R5 R4 R260
|
||||
0x881C0102, // 000C GETMBR R7 R0 R258
|
||||
0x7C140400, // 000D CALL R5 2
|
||||
0x90020605, // 000E SETMBR R0 R259 R5
|
||||
0x88140103, // 000F GETMBR R5 R0 R259
|
||||
0x78160019, // 0010 JMPF R5 #002B
|
||||
0x60140015, // 0011 GETGBL R5 G21
|
||||
0x5C180200, // 0012 MOVE R6 R1
|
||||
0x7C140200, // 0013 CALL R5 1
|
||||
0x1C140B05, // 0014 EQ R5 R5 R261
|
||||
0x78160004, // 0015 JMPF R5 #001B
|
||||
0x5C140200, // 0016 MOVE R5 R1
|
||||
0x5C180000, // 0017 MOVE R6 R0
|
||||
0x7C140200, // 0018 CALL R5 1
|
||||
0x90020C05, // 0019 SETMBR R0 R262 R5
|
||||
0x70020000, // 001A JMP #001C
|
||||
0x90020C01, // 001B SETMBR R0 R262 R1
|
||||
0x88140106, // 001C GETMBR R5 R0 R262
|
||||
0x4C180000, // 001D LDNIL 6
|
||||
0x1C140A06, // 001E EQ R5 R5 R6
|
||||
0x78160001, // 001F JMPF R5 #0022
|
||||
0x4C140000, // 0020 LDNIL 5
|
||||
0x90020605, // 0021 SETMBR R0 R259 R5
|
||||
0x88140103, // 0022 GETMBR R5 R0 R259
|
||||
0x78160006, // 0023 JMPF R5 #002B
|
||||
0x6014000F, // 0024 GETGBL R5 G15
|
||||
0x58180007, // 0025 LDCONST R6 K7
|
||||
0x881C0106, // 0026 GETMBR R7 R0 R262
|
||||
0x58200008, // 0027 LDCONST R8 K8
|
||||
0x88240103, // 0028 GETMBR R9 R0 R259
|
||||
0x88241309, // 0029 GETMBR R9 R9 R265
|
||||
0x7C140800, // 002A CALL R5 4
|
||||
0x80000000, // 002B RET 0 R0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: write8
|
||||
********************************************************************/
|
||||
be_local_closure(write8, /* name */
|
||||
be_nested_proto(
|
||||
9, /* nstack */
|
||||
3, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("write", -1104765092, 5),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("write8", -1160975764, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 8]) { /* code */
|
||||
0x880C0100, // 0000 GETMBR R3 R0 R256
|
||||
0x8C0C0701, // 0001 GETMET R3 R3 R257
|
||||
0x88140102, // 0002 GETMBR R5 R0 R258
|
||||
0x5C180200, // 0003 MOVE R6 R1
|
||||
0x5C1C0400, // 0004 MOVE R7 R2
|
||||
0x58200003, // 0005 LDCONST R8 K3
|
||||
0x7C0C0A00, // 0006 CALL R3 5
|
||||
0x80040600, // 0007 RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: write_bit
|
||||
********************************************************************/
|
||||
be_local_closure(write_bit, /* name */
|
||||
be_nested_proto(
|
||||
11, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
be_const_int(0),
|
||||
be_const_int(1),
|
||||
be_nested_string("write8", -1160975764, 6),
|
||||
be_nested_string("read8", -1492179129, 5),
|
||||
}),
|
||||
(be_nested_const_str("write_bit", -1633976860, 9)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[26]) { /* code */
|
||||
0x14100500, // 0000 LT R4 R2 R256
|
||||
0x74120002, // 0001 JMPT R4 #0005
|
||||
0x54120006, // 0002 LDINT R4 7
|
||||
0x24100404, // 0003 GT R4 R2 R4
|
||||
0x78120000, // 0004 JMPF R4 #0006
|
||||
0x80000800, // 0005 RET 0 R4
|
||||
0x38120202, // 0006 SHL R4 R257 R2
|
||||
0x780E0007, // 0007 JMPF R3 #0010
|
||||
0x8C140102, // 0008 GETMET R5 R0 R258
|
||||
0x5C1C0200, // 0009 MOVE R7 R1
|
||||
0x8C200103, // 000A GETMET R8 R0 R259
|
||||
0x5C280200, // 000B MOVE R10 R1
|
||||
0x7C200400, // 000C CALL R8 2
|
||||
0x30201004, // 000D OR R8 R8 R4
|
||||
0x7C140600, // 000E CALL R5 3
|
||||
0x70020008, // 000F JMP #0019
|
||||
0x8C140102, // 0010 GETMET R5 R0 R258
|
||||
0x5C1C0200, // 0011 MOVE R7 R1
|
||||
0x8C200103, // 0012 GETMET R8 R0 R259
|
||||
0x5C280200, // 0013 MOVE R10 R1
|
||||
0x7C200400, // 0014 CALL R8 2
|
||||
0x542600FE, // 0015 LDINT R9 255
|
||||
0x04241204, // 0016 SUB R9 R9 R4
|
||||
0x2C201009, // 0017 AND R8 R8 R9
|
||||
0x7C140600, // 0018 CALL R5 3
|
||||
0x80000000, // 0019 RET 0 R0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read8
|
||||
********************************************************************/
|
||||
be_local_closure(read8, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("read", -824204347, 4),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read8", -1492179129, 5)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 7]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 R256
|
||||
0x8C080501, // 0001 GETMET R2 R2 R257
|
||||
0x88100102, // 0002 GETMBR R4 R0 R258
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x80040400, // 0006 RET 1 R2
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read12
|
||||
********************************************************************/
|
||||
be_local_closure(read12, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("read_bytes", -718234123, 10),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(2),
|
||||
be_const_int(0),
|
||||
be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read12", -3890326, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 R256
|
||||
0x8C080501, // 0001 GETMET R2 R2 R257
|
||||
0x88100102, // 0002 GETMBR R4 R0 R258
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 R260
|
||||
0x54120003, // 0007 LDINT R4 4
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 R261
|
||||
0x000C0604, // 000A ADD R3 R3 R4
|
||||
0x80040600, // 000B RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read13
|
||||
********************************************************************/
|
||||
be_local_closure(read13, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("read_bytes", -718234123, 10),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(2),
|
||||
be_const_int(0),
|
||||
be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read13", 12887293, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 R256
|
||||
0x8C080501, // 0001 GETMET R2 R2 R257
|
||||
0x88100102, // 0002 GETMBR R4 R0 R258
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 R260
|
||||
0x54120004, // 0007 LDINT R4 5
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 R261
|
||||
0x000C0604, // 000A ADD R3 R3 R4
|
||||
0x80040600, // 000B RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read24
|
||||
********************************************************************/
|
||||
be_local_closure(read24, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 7]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("read_bytes", -718234123, 10),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(3),
|
||||
be_const_int(0),
|
||||
be_const_int(1),
|
||||
be_const_int(2),
|
||||
}),
|
||||
(be_nested_const_str("read24", 1808533811, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[16]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 R256
|
||||
0x8C080501, // 0001 GETMET R2 R2 R257
|
||||
0x88100102, // 0002 GETMBR R4 R0 R258
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 R260
|
||||
0x5412000F, // 0007 LDINT R4 16
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 R261
|
||||
0x54160007, // 000A LDINT R5 8
|
||||
0x38100805, // 000B SHL R4 R4 R5
|
||||
0x000C0604, // 000C ADD R3 R3 R4
|
||||
0x94100506, // 000D GETIDX R4 R2 R262
|
||||
0x000C0604, // 000E ADD R3 R3 R4
|
||||
0x80040600, // 000F RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read32
|
||||
********************************************************************/
|
||||
|
@ -352,35 +25,35 @@ be_local_closure(read32, /* name */
|
|||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 7]) { /* constants */
|
||||
be_nested_string("wire", -212213352, 4),
|
||||
be_nested_string("read_bytes", -718234123, 10),
|
||||
be_nested_string("addr", 1087856498, 4),
|
||||
be_const_int(0),
|
||||
be_const_int(1),
|
||||
be_const_int(2),
|
||||
be_const_int(3),
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(0),
|
||||
/* K4 */ be_const_int(1),
|
||||
/* K5 */ be_const_int(2),
|
||||
/* K6 */ be_const_int(3),
|
||||
}),
|
||||
(be_nested_const_str("read32", 1741276240, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[20]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 R256
|
||||
0x8C080501, // 0001 GETMET R2 R2 R257
|
||||
0x88100102, // 0002 GETMBR R4 R0 R258
|
||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||
0x8C080501, // 0001 GETMET R2 R2 K1
|
||||
0x88100102, // 0002 GETMBR R4 R0 K2
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x541A0003, // 0004 LDINT R6 4
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0503, // 0006 GETIDX R3 R2 R259
|
||||
0x940C0503, // 0006 GETIDX R3 R2 K3
|
||||
0x54120017, // 0007 LDINT R4 24
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100504, // 0009 GETIDX R4 R2 R260
|
||||
0x94100504, // 0009 GETIDX R4 R2 K4
|
||||
0x5416000F, // 000A LDINT R5 16
|
||||
0x38100805, // 000B SHL R4 R4 R5
|
||||
0x000C0604, // 000C ADD R3 R3 R4
|
||||
0x94100505, // 000D GETIDX R4 R2 R261
|
||||
0x94100505, // 000D GETIDX R4 R2 K5
|
||||
0x54160007, // 000E LDINT R5 8
|
||||
0x38100805, // 000F SHL R4 R4 R5
|
||||
0x000C0604, // 0010 ADD R3 R3 R4
|
||||
0x94100506, // 0011 GETIDX R4 R2 R262
|
||||
0x94100506, // 0011 GETIDX R4 R2 K6
|
||||
0x000C0604, // 0012 ADD R3 R3 R4
|
||||
0x80040600, // 0013 RET 1 R3
|
||||
})
|
||||
|
@ -389,6 +62,339 @@ be_local_closure(read32, /* name */
|
|||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: write8
|
||||
********************************************************************/
|
||||
be_local_closure(write8, /* name */
|
||||
be_nested_proto(
|
||||
9, /* nstack */
|
||||
3, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("write", -1104765092, 5),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("write8", -1160975764, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 8]) { /* code */
|
||||
0x880C0100, // 0000 GETMBR R3 R0 K0
|
||||
0x8C0C0701, // 0001 GETMET R3 R3 K1
|
||||
0x88140102, // 0002 GETMBR R5 R0 K2
|
||||
0x5C180200, // 0003 MOVE R6 R1
|
||||
0x5C1C0400, // 0004 MOVE R7 R2
|
||||
0x58200003, // 0005 LDCONST R8 K3
|
||||
0x7C0C0A00, // 0006 CALL R3 5
|
||||
0x80040600, // 0007 RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read12
|
||||
********************************************************************/
|
||||
be_local_closure(read12, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(2),
|
||||
/* K4 */ be_const_int(0),
|
||||
/* K5 */ be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read12", -3890326, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||
0x8C080501, // 0001 GETMET R2 R2 K1
|
||||
0x88100102, // 0002 GETMBR R4 R0 K2
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 K4
|
||||
0x54120003, // 0007 LDINT R4 4
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 K5
|
||||
0x000C0604, // 000A ADD R3 R3 R4
|
||||
0x80040600, // 000B RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: write_bit
|
||||
********************************************************************/
|
||||
be_local_closure(write_bit, /* name */
|
||||
be_nested_proto(
|
||||
11, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
/* K0 */ be_const_int(0),
|
||||
/* K1 */ be_const_int(1),
|
||||
/* K2 */ be_nested_string("write8", -1160975764, 6),
|
||||
/* K3 */ be_nested_string("read8", -1492179129, 5),
|
||||
}),
|
||||
(be_nested_const_str("write_bit", -1633976860, 9)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[26]) { /* code */
|
||||
0x14100500, // 0000 LT R4 R2 K0
|
||||
0x74120002, // 0001 JMPT R4 #0005
|
||||
0x54120006, // 0002 LDINT R4 7
|
||||
0x24100404, // 0003 GT R4 R2 R4
|
||||
0x78120000, // 0004 JMPF R4 #0006
|
||||
0x80000800, // 0005 RET 0
|
||||
0x38120202, // 0006 SHL R4 K1 R2
|
||||
0x780E0007, // 0007 JMPF R3 #0010
|
||||
0x8C140102, // 0008 GETMET R5 R0 K2
|
||||
0x5C1C0200, // 0009 MOVE R7 R1
|
||||
0x8C200103, // 000A GETMET R8 R0 K3
|
||||
0x5C280200, // 000B MOVE R10 R1
|
||||
0x7C200400, // 000C CALL R8 2
|
||||
0x30201004, // 000D OR R8 R8 R4
|
||||
0x7C140600, // 000E CALL R5 3
|
||||
0x70020008, // 000F JMP #0019
|
||||
0x8C140102, // 0010 GETMET R5 R0 K2
|
||||
0x5C1C0200, // 0011 MOVE R7 R1
|
||||
0x8C200103, // 0012 GETMET R8 R0 K3
|
||||
0x5C280200, // 0013 MOVE R10 R1
|
||||
0x7C200400, // 0014 CALL R8 2
|
||||
0x542600FE, // 0015 LDINT R9 255
|
||||
0x04241204, // 0016 SUB R9 R9 R4
|
||||
0x2C201009, // 0017 AND R8 R8 R9
|
||||
0x7C140600, // 0018 CALL R5 3
|
||||
0x80000000, // 0019 RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read24
|
||||
********************************************************************/
|
||||
be_local_closure(read24, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 7]) { /* constants */
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(3),
|
||||
/* K4 */ be_const_int(0),
|
||||
/* K5 */ be_const_int(1),
|
||||
/* K6 */ be_const_int(2),
|
||||
}),
|
||||
(be_nested_const_str("read24", 1808533811, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[16]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||
0x8C080501, // 0001 GETMET R2 R2 K1
|
||||
0x88100102, // 0002 GETMBR R4 R0 K2
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 K4
|
||||
0x5412000F, // 0007 LDINT R4 16
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 K5
|
||||
0x54160007, // 000A LDINT R5 8
|
||||
0x38100805, // 000B SHL R4 R4 R5
|
||||
0x000C0604, // 000C ADD R3 R3 R4
|
||||
0x94100506, // 000D GETIDX R4 R2 K6
|
||||
0x000C0604, // 000E ADD R3 R3 R4
|
||||
0x80040600, // 000F RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read8
|
||||
********************************************************************/
|
||||
be_local_closure(read8, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 4]) { /* constants */
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("read", -824204347, 4),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read8", -1492179129, 5)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[ 7]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||
0x8C080501, // 0001 GETMET R2 R2 K1
|
||||
0x88100102, // 0002 GETMBR R4 R0 K2
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x80040400, // 0006 RET 1 R2
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: init
|
||||
********************************************************************/
|
||||
be_local_closure(init, /* name */
|
||||
be_nested_proto(
|
||||
10, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[10]) { /* constants */
|
||||
/* K0 */ be_nested_string("get_tasmota", 334356779, 11),
|
||||
/* K1 */ be_nested_string("i2c_enabled", 218388101, 11),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K4 */ be_nested_string("wire_scan", -1623691416, 9),
|
||||
/* K5 */ be_nested_string("function", -1630125495, 8),
|
||||
/* K6 */ be_nested_string("name", -1925595674, 4),
|
||||
/* K7 */ be_nested_string("I2C:", 813483371, 4),
|
||||
/* K8 */ be_nested_string("detected on bus", 1432002650, 15),
|
||||
/* K9 */ be_nested_string("bus", 1607822841, 3),
|
||||
}),
|
||||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[44]) { /* code */
|
||||
0x8C100100, // 0000 GETMET R4 R0 K0
|
||||
0x7C100200, // 0001 CALL R4 1
|
||||
0x4C140000, // 0002 LDNIL R5
|
||||
0x20140605, // 0003 NE R5 R3 R5
|
||||
0x78160004, // 0004 JMPF R5 #000A
|
||||
0x8C140901, // 0005 GETMET R5 R4 K1
|
||||
0x5C1C0600, // 0006 MOVE R7 R3
|
||||
0x7C140400, // 0007 CALL R5 2
|
||||
0x74160000, // 0008 JMPT R5 #000A
|
||||
0x80000A00, // 0009 RET 0
|
||||
0x90020402, // 000A SETMBR R0 K2 R2
|
||||
0x8C140904, // 000B GETMET R5 R4 K4
|
||||
0x881C0102, // 000C GETMBR R7 R0 K2
|
||||
0x7C140400, // 000D CALL R5 2
|
||||
0x90020605, // 000E SETMBR R0 K3 R5
|
||||
0x88140103, // 000F GETMBR R5 R0 K3
|
||||
0x78160019, // 0010 JMPF R5 #002B
|
||||
0x60140004, // 0011 GETGBL R5 G4
|
||||
0x5C180200, // 0012 MOVE R6 R1
|
||||
0x7C140200, // 0013 CALL R5 1
|
||||
0x1C140B05, // 0014 EQ R5 R5 K5
|
||||
0x78160004, // 0015 JMPF R5 #001B
|
||||
0x5C140200, // 0016 MOVE R5 R1
|
||||
0x5C180000, // 0017 MOVE R6 R0
|
||||
0x7C140200, // 0018 CALL R5 1
|
||||
0x90020C05, // 0019 SETMBR R0 K6 R5
|
||||
0x70020000, // 001A JMP #001C
|
||||
0x90020C01, // 001B SETMBR R0 K6 R1
|
||||
0x88140106, // 001C GETMBR R5 R0 K6
|
||||
0x4C180000, // 001D LDNIL R6
|
||||
0x1C140A06, // 001E EQ R5 R5 R6
|
||||
0x78160001, // 001F JMPF R5 #0022
|
||||
0x4C140000, // 0020 LDNIL R5
|
||||
0x90020605, // 0021 SETMBR R0 K3 R5
|
||||
0x88140103, // 0022 GETMBR R5 R0 K3
|
||||
0x78160006, // 0023 JMPF R5 #002B
|
||||
0x60140001, // 0024 GETGBL R5 G1
|
||||
0x58180007, // 0025 LDCONST R6 K7
|
||||
0x881C0106, // 0026 GETMBR R7 R0 K6
|
||||
0x58200008, // 0027 LDCONST R8 K8
|
||||
0x88240103, // 0028 GETMBR R9 R0 K3
|
||||
0x88241309, // 0029 GETMBR R9 R9 K9
|
||||
0x7C140800, // 002A CALL R5 4
|
||||
0x80000000, // 002B RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read13
|
||||
********************************************************************/
|
||||
be_local_closure(read13, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
2, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
/* K0 */ be_nested_string("wire", -212213352, 4),
|
||||
/* K1 */ be_nested_string("read_bytes", -718234123, 10),
|
||||
/* K2 */ be_nested_string("addr", 1087856498, 4),
|
||||
/* K3 */ be_const_int(2),
|
||||
/* K4 */ be_const_int(0),
|
||||
/* K5 */ be_const_int(1),
|
||||
}),
|
||||
(be_nested_const_str("read13", 12887293, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||
0x8C080501, // 0001 GETMET R2 R2 K1
|
||||
0x88100102, // 0002 GETMBR R4 R0 K2
|
||||
0x5C140200, // 0003 MOVE R5 R1
|
||||
0x58180003, // 0004 LDCONST R6 K3
|
||||
0x7C080800, // 0005 CALL R2 4
|
||||
0x940C0504, // 0006 GETIDX R3 R2 K4
|
||||
0x54120004, // 0007 LDINT R4 5
|
||||
0x380C0604, // 0008 SHL R3 R3 R4
|
||||
0x94100505, // 0009 GETIDX R4 R2 K5
|
||||
0x000C0604, // 000A ADD R3 R3 R4
|
||||
0x80040600, // 000B RET 1 R3
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
#include "../generate/be_fixed_be_class_I2C_Driver.h"
|
||||
|
||||
void be_load_driver_i2c_lib(bvm *vm) {
|
||||
|
|
|
@ -32,7 +32,6 @@ extern int i2s_file_source_fs_deinit(bvm *vm);
|
|||
#endif // USE_UFILESYS
|
||||
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_audio_output.h"
|
||||
#include "../generate/be_fixed_be_class_audio_output_i2s.h"
|
||||
#include "../generate/be_fixed_be_class_audio_generator.h"
|
||||
|
@ -40,7 +39,6 @@ extern int i2s_file_source_fs_deinit(bvm *vm);
|
|||
#include "../generate/be_fixed_be_class_audio_generator_mp3.h"
|
||||
#include "../generate/be_fixed_be_class_audio_file_source.h"
|
||||
#include "../generate/be_fixed_be_class_audio_file_source_fs.h"
|
||||
#endif
|
||||
|
||||
void be_load_driver_audio_lib(bvm *vm) {
|
||||
be_pushntvclass(vm, &be_class_audio_output);
|
||||
|
|
|
@ -13,22 +13,6 @@ extern int l_gamma8(bvm *vm);
|
|||
extern int l_gamma10(bvm *vm);
|
||||
extern int l_rev_gamma10(bvm *vm);
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
|
||||
be_native_module_attr_table(light) {
|
||||
|
||||
be_native_module_function("get", l_getlight),
|
||||
be_native_module_function("set", l_setlight),
|
||||
|
||||
be_native_module_function("gamma8", l_gamma8),
|
||||
be_native_module_function("gamma10", l_gamma10),
|
||||
be_native_module_function("reverse_gamma10", l_rev_gamma10),
|
||||
|
||||
};
|
||||
|
||||
be_define_native_module(light, NULL);
|
||||
|
||||
#else
|
||||
/* @const_object_info_begin
|
||||
module light (scope: global) {
|
||||
get, func(l_getlight)
|
||||
|
@ -40,6 +24,5 @@ module light (scope: global) {
|
|||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_light.h"
|
||||
#endif
|
||||
|
||||
#endif // USE_LIGHT
|
|
@ -102,94 +102,32 @@ class be_lvgl_cb (scope: global, name: lv_cb) {
|
|||
// 'lv_gauge_format_cb'
|
||||
//
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_lv_group_focus_cb.h"
|
||||
#include "../generate/be_fixed_be_lv_event_cb.h"
|
||||
#include "../generate/be_fixed_be_lv_signal_cb.h"
|
||||
#include "../generate/be_fixed_be_lv_design_cb.h"
|
||||
#include "../generate/be_fixed_be_lv_gauge_format_cb.h"
|
||||
#endif
|
||||
|
||||
void be_load_lvgl_cb_all_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members_lv_group_focus_cb[] = {
|
||||
{ "()", lv_group_focus_cb_call },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_group_focus_cb", members);
|
||||
be_getglobal(vm, "lv_group_focus_cb");
|
||||
be_getglobal(vm, "lv_cb");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_lv_group_focus_cb);
|
||||
be_setglobal(vm, "lv_group_focus_cb");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members_lv_event_cb[] = {
|
||||
{ "()", lv_event_cb_call },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_event_cb", members);
|
||||
be_getglobal(vm, "lv_event_cb");
|
||||
be_getglobal(vm, "lv_cb");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_lv_event_cb);
|
||||
be_setglobal(vm, "lv_event_cb");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members_lv_signal_cb[] = {
|
||||
{ "()", lv_signal_cb_call },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_signal_cb", members);
|
||||
be_getglobal(vm, "lv_signal_cb");
|
||||
be_getglobal(vm, "lv_cb");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_lv_signal_cb);
|
||||
be_setglobal(vm, "lv_signal_cb");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members_lv_design_cb[] = {
|
||||
{ "()", lv_design_cb_call },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_design_cb", members);
|
||||
be_getglobal(vm, "lv_design_cb");
|
||||
be_getglobal(vm, "lv_cb");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_lv_design_cb);
|
||||
be_setglobal(vm, "lv_design_cb");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members_lv_gauge_format_cb[] = {
|
||||
{ "()", lv_gauge_format_cb_call },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_gauge_format_cb", members);
|
||||
be_getglobal(vm, "lv_gauge_format_cb");
|
||||
be_getglobal(vm, "lv_cb");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_lv_gauge_format_cb);
|
||||
be_setglobal(vm, "lv_gauge_format_cb");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
/* @const_object_info_begin
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[76]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
@ -260,7 +260,7 @@ be_local_closure(del, /* name */
|
|||
(be_nested_const_str("del", -816214454, 3)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[10]) { /* code */
|
||||
0x60040014, // 0000 GETGBL R1 G20
|
||||
0x60040003, // 0000 GETGBL R1 G3
|
||||
0x5C080000, // 0001 MOVE R2 R0
|
||||
0x7C040200, // 0002 CALL R1 1
|
||||
0x8C040300, // 0003 GETMET R1 R1 K0
|
||||
|
|
|
@ -12,28 +12,12 @@ extern int lco_tostring(bvm *vm); // generic function
|
|||
extern int lco_toint(bvm *vm); // generic function
|
||||
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_lv_color.h"
|
||||
#endif
|
||||
|
||||
void be_load_lvgl_color_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ ".p", NULL }, // keeping track of styles to avoid GC
|
||||
{ "init", lco_init },
|
||||
{ "tostring", lco_tostring },
|
||||
{ "toint", lco_toint },
|
||||
|
||||
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_color", members);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_lv_color);
|
||||
be_setglobal(vm, "lv_color");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @const_object_info_begin
|
||||
|
|
|
@ -311,31 +311,12 @@ int be_ctypes_setmember(bvm *vm) {
|
|||
|
||||
BE_EXPORT_VARIABLE extern const bclass be_class_bytes;
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_lv_ctypes.h"
|
||||
#endif
|
||||
|
||||
void be_load_lvgl_ctypes_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ ".def", NULL }, // pointer to definition
|
||||
{ "init", be_ctypes_init },
|
||||
{ "copy", be_ctypes_copy },
|
||||
{ "member", be_ctypes_member },
|
||||
{ "setmember", be_ctypes_setmember },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "ctypes_bytes", members);
|
||||
|
||||
be_getglobal(vm, "ctypes_bytes");
|
||||
be_getglobal(vm, "bytes");
|
||||
be_setsuper(vm, -2);
|
||||
be_pop(vm, 2);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_lv_ctypes);
|
||||
be_setglobal(vm, "ctypes_bytes");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @const_object_info_begin
|
||||
|
|
|
@ -10,27 +10,12 @@
|
|||
extern int lvx_init(bvm *vm); // generic function
|
||||
extern int lvx_tostring(bvm *vm); // generic function
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_lv_font.h"
|
||||
#endif
|
||||
|
||||
void be_load_lvgl_font_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ ".p", NULL }, // keeping track of styles to avoid GC
|
||||
{ "init", lvx_init },
|
||||
{ "tostring", lvx_tostring },
|
||||
|
||||
// { NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "lv_font", members);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_lv_font);
|
||||
be_setglobal(vm, "lv_font");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @const_object_info_begin
|
||||
|
|
|
@ -157,14 +157,14 @@ be_local_closure(my_design_cb, /* name */
|
|||
0x04380A08, // 0046 SUB R14 R5 R8
|
||||
0x0C3C0D03, // 0047 DIV R15 R6 K3
|
||||
0x043C1E09, // 0048 SUB R15 R15 R9
|
||||
0x60400007, // 0049 GETGBL R16 G7
|
||||
0x60400009, // 0049 GETGBL R16 G9
|
||||
0x54460059, // 004A LDINT R17 90
|
||||
0x8C480719, // 004B GETMET R18 R3 K25
|
||||
0x8C50071A, // 004C GETMET R20 R3 K26
|
||||
0x60580011, // 004D GETGBL R22 G17
|
||||
0x6058000A, // 004D GETGBL R22 G10
|
||||
0x5C5C1E00, // 004E MOVE R23 R15
|
||||
0x7C580200, // 004F CALL R22 1
|
||||
0x605C0011, // 0050 GETGBL R23 G17
|
||||
0x605C000A, // 0050 GETGBL R23 G10
|
||||
0x5C601C00, // 0051 MOVE R24 R14
|
||||
0x7C5C0200, // 0052 CALL R23 1
|
||||
0x0C582C17, // 0053 DIV R22 R22 R23
|
||||
|
@ -327,7 +327,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[28]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
|
|
@ -149,7 +149,7 @@ be_local_closure(my_design_cb, /* name */
|
|||
0xB83E0800, // 003F GETNGBL R15 K4
|
||||
0x883C1F16, // 0040 GETMBR R15 R15 K22
|
||||
0x7C300600, // 0041 CALL R12 3
|
||||
0x60340000, // 0042 GETGBL R13 G0
|
||||
0x60340010, // 0042 GETGBL R13 G16
|
||||
0x403A3102, // 0043 CONNECT R14 K24 K2
|
||||
0x7C340200, // 0044 CALL R13 1
|
||||
0xA802002C, // 0045 EXBLK 0 #0073
|
||||
|
@ -268,7 +268,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[28]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
|
|
@ -41,7 +41,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[52]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
|
|
@ -84,7 +84,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[15]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
@ -126,7 +126,7 @@ be_local_closure(del, /* name */
|
|||
(be_nested_const_str("del", -816214454, 3)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[10]) { /* code */
|
||||
0x60040014, // 0000 GETGBL R1 G20
|
||||
0x60040003, // 0000 GETGBL R1 G3
|
||||
0x5C080000, // 0001 MOVE R2 R0
|
||||
0x7C040200, // 0002 CALL R1 1
|
||||
0x8C040300, // 0003 GETMET R1 R1 K0
|
||||
|
|
|
@ -40,7 +40,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[49]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
|
|
@ -84,7 +84,7 @@ be_local_closure(init, /* name */
|
|||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[15]) { /* code */
|
||||
0x600C0014, // 0000 GETGBL R3 G20
|
||||
0x600C0003, // 0000 GETGBL R3 G3
|
||||
0x5C100000, // 0001 MOVE R4 R0
|
||||
0x7C0C0200, // 0002 CALL R3 1
|
||||
0x8C0C0700, // 0003 GETMET R3 R3 K0
|
||||
|
@ -126,7 +126,7 @@ be_local_closure(del, /* name */
|
|||
(be_nested_const_str("del", -816214454, 3)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[10]) { /* code */
|
||||
0x60040014, // 0000 GETGBL R1 G20
|
||||
0x60040003, // 0000 GETGBL R1 G3
|
||||
0x5C080000, // 0001 MOVE R2 R0
|
||||
0x7C040200, // 0002 CALL R1 1
|
||||
0x8C040300, // 0003 GETMET R1 R1 K0
|
||||
|
|
|
@ -11,27 +11,12 @@ extern int m_md5_init(bvm *vm);
|
|||
extern int m_md5_update(bvm *vm);
|
||||
extern int m_md5_finish(bvm *vm);
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_md5.h"
|
||||
#endif
|
||||
|
||||
void be_load_md5_lib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ ".p", NULL },
|
||||
|
||||
{ "init", m_md5_init },
|
||||
{ "update", m_md5_update },
|
||||
{ "finish", m_md5_finish },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "MD5", members);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_md5);
|
||||
be_setglobal(vm, "MD5");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
/* @const_object_info_begin
|
||||
|
||||
|
|
|
@ -27,19 +27,9 @@ static int m_path_exists(bvm *vm)
|
|||
be_return(vm);
|
||||
}
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
be_native_module_attr_table(path) {
|
||||
be_native_module_function("exists", m_path_exists),
|
||||
};
|
||||
|
||||
static be_define_native_module(path, NULL);
|
||||
|
||||
#else
|
||||
/* @const_object_info_begin
|
||||
module path (scope: global, file: tasmota_path) {
|
||||
exists, func(m_path_exists)
|
||||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_tasmota_path.h"
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,32 +19,32 @@ be_local_closure(tostring, /* name */
|
|||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
be_nested_string("string", 398550328, 6), /* R256 - K0 */
|
||||
be_nested_string("format", -1180859054, 6), /* R257 - K1 */
|
||||
be_nested_string("<instance: %s(%s, %s, %s)", 257363333, 25), /* R258 - K2 */
|
||||
be_nested_string("due", -399437003, 3), /* R259 - K3 */
|
||||
be_nested_string("f", -485742695, 1), /* R260 - K4 */
|
||||
be_nested_string("id", 926444256, 2), /* R261 - K5 */
|
||||
/* K0 */ be_nested_string("string", 398550328, 6),
|
||||
/* K1 */ be_nested_string("format", -1180859054, 6),
|
||||
/* K2 */ be_nested_string("<instance: %s(%s, %s, %s)", 257363333, 25),
|
||||
/* K3 */ be_nested_string("due", -399437003, 3),
|
||||
/* K4 */ be_nested_string("f", -485742695, 1),
|
||||
/* K5 */ be_nested_string("id", 926444256, 2),
|
||||
}),
|
||||
(be_nested_const_str("tostring", -1995258651, 8)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
(be_nested_const_str("Tasmota.be", 825809411, 10)),
|
||||
( &(const binstruction[19]) { /* code */
|
||||
0xA4060000, // 0000 IMPORT R1 R256
|
||||
0x8C080301, // 0001 GETMET R2 R1 R257
|
||||
0xA4060000, // 0000 IMPORT R1 K0
|
||||
0x8C080301, // 0001 GETMET R2 R1 K1
|
||||
0x58100002, // 0002 LDCONST R4 K2
|
||||
0x60140013, // 0003 GETGBL R5 G19
|
||||
0x60180004, // 0004 GETGBL R6 G4
|
||||
0x60140008, // 0003 GETGBL R5 G8
|
||||
0x60180006, // 0004 GETGBL R6 G6
|
||||
0x5C1C0000, // 0005 MOVE R7 R0
|
||||
0x7C180200, // 0006 CALL R6 1
|
||||
0x7C140200, // 0007 CALL R5 1
|
||||
0x60180013, // 0008 GETGBL R6 G19
|
||||
0x881C0103, // 0009 GETMBR R7 R0 R259
|
||||
0x60180008, // 0008 GETGBL R6 G8
|
||||
0x881C0103, // 0009 GETMBR R7 R0 K3
|
||||
0x7C180200, // 000A CALL R6 1
|
||||
0x601C0013, // 000B GETGBL R7 G19
|
||||
0x88200104, // 000C GETMBR R8 R0 R260
|
||||
0x601C0008, // 000B GETGBL R7 G8
|
||||
0x88200104, // 000C GETMBR R8 R0 K4
|
||||
0x7C1C0200, // 000D CALL R7 1
|
||||
0x60200013, // 000E GETGBL R8 G19
|
||||
0x88240105, // 000F GETMBR R9 R0 R261
|
||||
0x60200008, // 000E GETGBL R8 G8
|
||||
0x88240105, // 000F GETMBR R9 R0 K5
|
||||
0x7C200200, // 0010 CALL R8 1
|
||||
0x7C080C00, // 0011 CALL R2 6
|
||||
0x80040400, // 0012 RET 1 R2
|
||||
|
@ -68,17 +68,17 @@ be_local_closure(init, /* name */
|
|||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 3]) { /* constants */
|
||||
be_nested_string("due", -399437003, 3), /* R256 - K0 */
|
||||
be_nested_string("f", -485742695, 1), /* R257 - K1 */
|
||||
be_nested_string("id", 926444256, 2), /* R258 - K2 */
|
||||
/* K0 */ be_nested_string("due", -399437003, 3),
|
||||
/* K1 */ be_nested_string("f", -485742695, 1),
|
||||
/* K2 */ be_nested_string("id", 926444256, 2),
|
||||
}),
|
||||
(be_nested_const_str("init", 380752755, 4)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
(be_nested_const_str("Tasmota.be", 825809411, 10)),
|
||||
( &(const binstruction[ 4]) { /* code */
|
||||
0x90020001, // 0000 SETMBR R0 R256 R1
|
||||
0x90020202, // 0001 SETMBR R0 R257 R2
|
||||
0x90020403, // 0002 SETMBR R0 R258 R3
|
||||
0x80000000, // 0003 RET 0 R0
|
||||
0x90020001, // 0000 SETMBR R0 K0 R1
|
||||
0x90020202, // 0001 SETMBR R0 K1 R2
|
||||
0x90020403, // 0002 SETMBR R0 K2 R3
|
||||
0x80000000, // 0003 RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
|
@ -27,32 +27,7 @@ extern int w_webserver_arg(bvm *vm);
|
|||
extern int w_webserver_arg_name(bvm *vm);
|
||||
extern int w_webserver_has_arg(bvm *vm);
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
be_native_module_attr_table(webserver) {
|
||||
be_native_module_function("member", w_webserver_member),
|
||||
|
||||
be_native_module_function("on", w_webserver_on),
|
||||
be_native_module_function("state", w_webserver_state),
|
||||
|
||||
be_native_module_function("check_privileged_access", w_webserver_check_privileged_access),
|
||||
be_native_module_function("redirect", w_webserver_redirect),
|
||||
be_native_module_function("content_start", w_webserver_content_start),
|
||||
be_native_module_function("content_send", w_webserver_content_send),
|
||||
be_native_module_function("content_send_style", w_webserver_content_send_style),
|
||||
be_native_module_function("content_flush", w_webserver_content_flush),
|
||||
be_native_module_function("content_start", w_webserver_content_start),
|
||||
be_native_module_function("content_stop", w_webserver_content_stop),
|
||||
be_native_module_function("content_button", w_webserver_content_button),
|
||||
|
||||
be_native_module_function("arg_size", w_webserver_argsize),
|
||||
be_native_module_function("arg", w_webserver_arg),
|
||||
be_native_module_function("arg_name", w_webserver_arg_name),
|
||||
be_native_module_function("has_arg", w_webserver_has_arg),
|
||||
|
||||
};
|
||||
|
||||
be_define_native_module(webserver, NULL);
|
||||
#else
|
||||
/* @const_object_info_begin
|
||||
module webserver (scope: global) {
|
||||
member, func(w_webserver_member)
|
||||
|
@ -77,6 +52,5 @@ module webserver (scope: global) {
|
|||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_webserver.h"
|
||||
#endif
|
||||
|
||||
#endif // USE_WEBSERVER
|
||||
|
|
|
@ -25,18 +25,43 @@ extern int b_wire_validread(bvm *vm);
|
|||
extern int b_wire_detect(bvm *vm);
|
||||
|
||||
/********************************************************************
|
||||
"def read_bytes(addr,reg,size) "
|
||||
"self._begin_transmission(addr) "
|
||||
"self._write(reg) "
|
||||
"self._end_transmission(false) "
|
||||
"self._request_from(addr,size) "
|
||||
"var ret=bytes(size) "
|
||||
"while (self._available()) "
|
||||
"ret..self._read() "
|
||||
"end "
|
||||
"return ret "
|
||||
"end "
|
||||
** Solidified function: write_bytes
|
||||
********************************************************************/
|
||||
be_local_closure(write_bytes, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 3]) { /* constants */
|
||||
/* K0 */ be_nested_string("_begin_transmission", -1515506120, 19),
|
||||
/* K1 */ be_nested_string("_write", -2079504471, 6),
|
||||
/* K2 */ be_nested_string("_end_transmission", -1057486896, 17),
|
||||
}),
|
||||
(be_nested_const_str("write_bytes", 1227543792, 11)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x8C100100, // 0000 GETMET R4 R0 K0
|
||||
0x5C180200, // 0001 MOVE R6 R1
|
||||
0x7C100400, // 0002 CALL R4 2
|
||||
0x8C100101, // 0003 GETMET R4 R0 K1
|
||||
0x5C180400, // 0004 MOVE R6 R2
|
||||
0x7C100400, // 0005 CALL R4 2
|
||||
0x8C100101, // 0006 GETMET R4 R0 K1
|
||||
0x5C180600, // 0007 MOVE R6 R3
|
||||
0x7C100400, // 0008 CALL R4 2
|
||||
0x8C100102, // 0009 GETMET R4 R0 K2
|
||||
0x7C100200, // 000A CALL R4 1
|
||||
0x80000000, // 000B RET 0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: read_bytes
|
||||
|
@ -51,37 +76,37 @@ be_local_closure(read_bytes, /* name */
|
|||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 6]) { /* upvals */
|
||||
{ { .s=be_nested_const_str("_begin_transmission", -1515506120, 19) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_write", -2079504471, 6) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_end_transmission", -1057486896, 17) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_request_from", -329818692, 13) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_available", 1306196581, 10) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_read", 346717030, 5) }, BE_STRING},
|
||||
( &(const bvalue[ 6]) { /* constants */
|
||||
/* K0 */ be_nested_string("_begin_transmission", -1515506120, 19),
|
||||
/* K1 */ be_nested_string("_write", -2079504471, 6),
|
||||
/* K2 */ be_nested_string("_end_transmission", -1057486896, 17),
|
||||
/* K3 */ be_nested_string("_request_from", -329818692, 13),
|
||||
/* K4 */ be_nested_string("_available", 1306196581, 10),
|
||||
/* K5 */ be_nested_string("_read", 346717030, 5),
|
||||
}),
|
||||
(be_nested_const_str("read_bytes", -718234123, 10)),
|
||||
(be_nested_const_str("string", 398550328, 6)),
|
||||
(be_nested_const_str("input", -103256197, 5)),
|
||||
( &(const binstruction[24]) { /* code */
|
||||
0x8C100100, // 0000 GETMET R4 R0 R256
|
||||
0x8C100100, // 0000 GETMET R4 R0 K0
|
||||
0x5C180200, // 0001 MOVE R6 R1
|
||||
0x7C100400, // 0002 CALL R4 2
|
||||
0x8C100101, // 0003 GETMET R4 R0 R257
|
||||
0x8C100101, // 0003 GETMET R4 R0 K1
|
||||
0x5C180400, // 0004 MOVE R6 R2
|
||||
0x7C100400, // 0005 CALL R4 2
|
||||
0x8C100102, // 0006 GETMET R4 R0 R258
|
||||
0x8C100102, // 0006 GETMET R4 R0 K2
|
||||
0x50180000, // 0007 LDBOOL R6 0 0
|
||||
0x7C100400, // 0008 CALL R4 2
|
||||
0x8C100103, // 0009 GETMET R4 R0 R259
|
||||
0x8C100103, // 0009 GETMET R4 R0 K3
|
||||
0x5C180200, // 000A MOVE R6 R1
|
||||
0x5C1C0600, // 000B MOVE R7 R3
|
||||
0x7C100600, // 000C CALL R4 3
|
||||
0x60100002, // 000D GETGBL R4 G2
|
||||
0x60100015, // 000D GETGBL R4 G21
|
||||
0x5C140600, // 000E MOVE R5 R3
|
||||
0x7C100200, // 000F CALL R4 1
|
||||
0x8C140104, // 0010 GETMET R5 R0 R260
|
||||
0x8C140104, // 0010 GETMET R5 R0 K4
|
||||
0x7C140200, // 0011 CALL R5 1
|
||||
0x78160003, // 0012 JMPF R5 #0017
|
||||
0x8C140105, // 0013 GETMET R5 R0 R261
|
||||
0x8C140105, // 0013 GETMET R5 R0 K5
|
||||
0x7C140200, // 0014 CALL R5 1
|
||||
0x40140805, // 0015 CONNECT R5 R4 R5
|
||||
0x7001FFF8, // 0016 JMP #0010
|
||||
|
@ -92,85 +117,12 @@ be_local_closure(read_bytes, /* name */
|
|||
/*******************************************************************/
|
||||
|
||||
|
||||
/********************************************************************
|
||||
"def write_bytes(addr,reg,b) "
|
||||
"self._begin_transmission(addr) "
|
||||
"self._write(reg) "
|
||||
"self._write(b) "
|
||||
"self._end_transmission() "
|
||||
"end "
|
||||
********************************************************************/
|
||||
|
||||
/********************************************************************
|
||||
** Solidified function: write_bytes
|
||||
********************************************************************/
|
||||
be_local_closure(write_bytes, /* name */
|
||||
be_nested_proto(
|
||||
7, /* nstack */
|
||||
4, /* argc */
|
||||
0, /* varg */
|
||||
0, /* has upvals */
|
||||
NULL, /* no upvals */
|
||||
0, /* has sup protos */
|
||||
NULL, /* no sub protos */
|
||||
1, /* has constants */
|
||||
( &(const bvalue[ 3]) { /* upvals */
|
||||
{ { .s=be_nested_const_str("_begin_transmission", -1515506120, 19) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_write", -2079504471, 6) }, BE_STRING},
|
||||
{ { .s=be_nested_const_str("_end_transmission", -1057486896, 17) }, BE_STRING},
|
||||
}),
|
||||
(be_nested_const_str("write_bytes", 1227543792, 11)),
|
||||
(be_nested_const_str("string", 398550328, 6)),
|
||||
( &(const binstruction[12]) { /* code */
|
||||
0x8C100100, // 0000 GETMET R4 R0 R256
|
||||
0x5C180200, // 0001 MOVE R6 R1
|
||||
0x7C100400, // 0002 CALL R4 2
|
||||
0x8C100101, // 0003 GETMET R4 R0 R257
|
||||
0x5C180400, // 0004 MOVE R6 R2
|
||||
0x7C100400, // 0005 CALL R4 2
|
||||
0x8C100101, // 0006 GETMET R4 R0 R257
|
||||
0x5C180600, // 0007 MOVE R6 R3
|
||||
0x7C100400, // 0008 CALL R4 2
|
||||
0x8C100102, // 0009 GETMET R4 R0 R258
|
||||
0x7C100200, // 000A CALL R4 1
|
||||
0x80000000, // 000B RET 0 R0
|
||||
})
|
||||
)
|
||||
);
|
||||
/*******************************************************************/
|
||||
|
||||
#if BE_USE_PRECOMPILED_OBJECT
|
||||
#include "../generate/be_fixed_be_class_tasmota_wire.h"
|
||||
#endif
|
||||
|
||||
void be_load_wirelib(bvm *vm) {
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
static const bnfuncinfo members[] = {
|
||||
{ "bus", NULL }, // bus number
|
||||
{ "init", b_wire_init },
|
||||
{ "_begin_transmission", b_wire_begintransmission },
|
||||
{ "_end_transmission", b_wire_endtransmission },
|
||||
{ "_request_from", b_wire_requestfrom },
|
||||
{ "_available", b_wire_available },
|
||||
{ "_write", b_wire_write },
|
||||
{ "_read", b_wire_read },
|
||||
{ "scan", b_wire_scan },
|
||||
{ "write", b_wire_validwrite },
|
||||
{ "read", b_wire_validread },
|
||||
{ "detect", b_wire_detect },
|
||||
|
||||
{ NULL, (bntvfunc) BE_CLOSURE }, /* mark section for berry closures */
|
||||
{ "read_bytes", (bntvfunc) &read_bytes_closure },
|
||||
{ "write_bytes", (bntvfunc) &write_bytes_closure },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
be_regclass(vm, "Wire", members);
|
||||
#else
|
||||
be_pushntvclass(vm, &be_class_tasmota_wire);
|
||||
be_setglobal(vm, "Wire");
|
||||
be_pop(vm, 1);
|
||||
#endif
|
||||
}
|
||||
/* @const_object_info_begin
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#- Native code used for testing and code solidification -#
|
||||
#- Do not use it -#
|
||||
|
||||
class Wire
|
||||
var bus
|
||||
|
||||
def read_bytes(addr,reg,size)
|
||||
self._begin_transmission(addr)
|
||||
self._write(reg)
|
||||
self._end_transmission(false)
|
||||
self._request_from(addr,size)
|
||||
var ret=bytes(size)
|
||||
while (self._available())
|
||||
ret..self._read()
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def write_bytes(addr,reg,b)
|
||||
self._begin_transmission(addr)
|
||||
self._write(reg)
|
||||
self._write(b)
|
||||
self._end_transmission()
|
||||
end
|
||||
end
|
|
@ -325,7 +325,6 @@ extern const bcstring be_const_str_SYMBOL_SHUFFLE;
|
|||
extern const bcstring be_const_str_strftime;
|
||||
extern const bcstring be_const_str_lv_draw_line_dsc;
|
||||
extern const bcstring be_const_str_lv_dropdown;
|
||||
extern const bcstring be_const_str_vcall;
|
||||
extern const bcstring be_const_str_SERIAL_6E1;
|
||||
extern const bcstring be_const_str_SYMBOL_LIST;
|
||||
extern const bcstring be_const_str_SI7021;
|
||||
|
|
|
@ -324,8 +324,7 @@ be_define_const_str(SM2135_CLK, "SM2135_CLK", 2383410011u, 0, 10, &be_const_str_
|
|||
be_define_const_str(SYMBOL_SHUFFLE, "SYMBOL_SHUFFLE", 1123310147u, 0, 14, &be_const_str_strftime);
|
||||
be_define_const_str(strftime, "strftime", 187738851u, 0, 8, NULL);
|
||||
be_define_const_str(lv_draw_line_dsc, "lv_draw_line_dsc", 2422805236u, 0, 16, NULL);
|
||||
be_define_const_str(lv_dropdown, "lv_dropdown", 2797165301u, 0, 11, &be_const_str_vcall);
|
||||
be_define_const_str(vcall, "vcall", 2639337069u, 0, 5, NULL);
|
||||
be_define_const_str(lv_dropdown, "lv_dropdown", 2797165301u, 0, 11, NULL);
|
||||
be_define_const_str(SERIAL_6E1, "SERIAL_6E1", 334249486u, 0, 10, &be_const_str_SYMBOL_LIST);
|
||||
be_define_const_str(SYMBOL_LIST, "SYMBOL_LIST", 70793990u, 0, 11, NULL);
|
||||
be_define_const_str(SI7021, "SI7021", 864377911u, 0, 6, &be_const_str_content_button);
|
||||
|
@ -1059,6 +1058,6 @@ static const bstring* const m_string_table[] = {
|
|||
|
||||
static const struct bconststrtab m_const_string_table = {
|
||||
.size = 344,
|
||||
.count = 689,
|
||||
.count = 688,
|
||||
.table = m_string_table
|
||||
};
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
static be_define_const_map_slots(m_libintrospect_map) {
|
||||
{ be_const_key(members, -1), be_const_func(m_attrlist) },
|
||||
{ be_const_key(vcall, -1), be_const_func(m_vcall) },
|
||||
{ be_const_key(set, -1), be_const_func(m_setmember) },
|
||||
{ be_const_key(get, -1), be_const_func(m_findmember) },
|
||||
{ be_const_key(set, 2), be_const_func(m_setmember) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
m_libintrospect_map,
|
||||
4
|
||||
3
|
||||
);
|
||||
|
||||
static be_define_const_module(
|
||||
|
|
|
@ -1,62 +1,64 @@
|
|||
#include "be_constobj.h"
|
||||
|
||||
static be_define_const_map_slots(m_builtin_map) {
|
||||
{ be_const_key(print, 19), be_const_int(15) },
|
||||
{ be_const_key(isinstance, -1), be_const_int(8) },
|
||||
{ be_const_key(classname, -1), be_const_int(3) },
|
||||
{ be_const_key(module, -1), be_const_int(12) },
|
||||
{ be_const_key(size, -1), be_const_int(18) },
|
||||
{ be_const_key(type, 9), be_const_int(21) },
|
||||
{ be_const_key(compile, -1), be_const_int(5) },
|
||||
{ be_const_key(open, -1), be_const_int(14) },
|
||||
{ be_const_key(real, -1), be_const_int(17) },
|
||||
{ be_const_key(__iterator__, -1), be_const_int(0) },
|
||||
{ be_const_key(super, -1), be_const_int(20) },
|
||||
{ be_const_key(issubclass, -1), be_const_int(9) },
|
||||
{ be_const_key(classof, -1), be_const_int(4) },
|
||||
{ be_const_key(map, 8), be_const_int(11) },
|
||||
{ be_const_key(int, 2), be_const_int(7) },
|
||||
{ be_const_key(input, 3), be_const_int(6) },
|
||||
{ be_const_key(number, -1), be_const_int(13) },
|
||||
{ be_const_key(list, 7), be_const_int(10) },
|
||||
{ be_const_key(str, 1), be_const_int(19) },
|
||||
{ be_const_key(range, -1), be_const_int(16) },
|
||||
{ be_const_key(bytes, -1), be_const_int(2) },
|
||||
{ be_const_key(assert, -1), be_const_int(1) },
|
||||
{ be_const_key(number, 16), be_const_int(7) },
|
||||
{ be_const_key(map, -1), be_const_int(19) },
|
||||
{ be_const_key(classname, 22), be_const_int(5) },
|
||||
{ be_const_key(bytes, 2), be_const_int(21) },
|
||||
{ be_const_key(int, 12), be_const_int(9) },
|
||||
{ be_const_key(module, -1), be_const_int(11) },
|
||||
{ be_const_key(print, 20), be_const_int(1) },
|
||||
{ be_const_key(issubclass, -1), be_const_int(14) },
|
||||
{ be_const_key(assert, -1), be_const_int(0) },
|
||||
{ be_const_key(list, -1), be_const_int(18) },
|
||||
{ be_const_key(__iterator__, -1), be_const_int(16) },
|
||||
{ be_const_key(real, -1), be_const_int(10) },
|
||||
{ be_const_key(super, 21), be_const_int(3) },
|
||||
{ be_const_key(isinstance, 8), be_const_int(15) },
|
||||
{ be_const_key(classof, 4), be_const_int(6) },
|
||||
{ be_const_key(input, -1), be_const_int(2) },
|
||||
{ be_const_key(call, 19), be_const_int(22) },
|
||||
{ be_const_key(compile, -1), be_const_int(13) },
|
||||
{ be_const_key(open, -1), be_const_int(17) },
|
||||
{ be_const_key(size, -1), be_const_int(12) },
|
||||
{ be_const_key(range, -1), be_const_int(20) },
|
||||
{ be_const_key(str, -1), be_const_int(8) },
|
||||
{ be_const_key(type, -1), be_const_int(4) },
|
||||
};
|
||||
|
||||
static be_define_const_map(
|
||||
m_builtin_map,
|
||||
22
|
||||
23
|
||||
);
|
||||
|
||||
static const bvalue __vlist_array[] = {
|
||||
be_const_func(l_iterator),
|
||||
be_const_func(l_assert),
|
||||
be_const_class(be_class_bytes),
|
||||
be_const_func(l_classname),
|
||||
be_const_func(l_classof),
|
||||
be_const_func(l_compile),
|
||||
be_const_func(l_input),
|
||||
be_const_func(l_int),
|
||||
be_const_func(l_isinstance),
|
||||
be_const_func(l_issubclass),
|
||||
be_const_class(be_class_list),
|
||||
be_const_class(be_class_map),
|
||||
be_const_func(l_module),
|
||||
be_const_func(l_number),
|
||||
be_const_func(be_nfunc_open),
|
||||
be_const_func(l_print),
|
||||
be_const_class(be_class_range),
|
||||
be_const_func(l_real),
|
||||
be_const_func(l_size),
|
||||
be_const_func(l_str),
|
||||
be_const_func(l_input),
|
||||
be_const_func(l_super),
|
||||
be_const_func(l_type),
|
||||
be_const_func(l_classname),
|
||||
be_const_func(l_classof),
|
||||
be_const_func(l_number),
|
||||
be_const_func(l_str),
|
||||
be_const_func(l_int),
|
||||
be_const_func(l_real),
|
||||
be_const_func(l_module),
|
||||
be_const_func(l_size),
|
||||
be_const_func(l_compile),
|
||||
be_const_func(l_issubclass),
|
||||
be_const_func(l_isinstance),
|
||||
be_const_func(l_iterator),
|
||||
be_const_func(be_nfunc_open),
|
||||
be_const_class(be_class_list),
|
||||
be_const_class(be_class_map),
|
||||
be_const_class(be_class_range),
|
||||
be_const_class(be_class_bytes),
|
||||
be_const_func(l_call),
|
||||
};
|
||||
|
||||
static be_define_const_vector(
|
||||
m_builtin_vector,
|
||||
__vlist_array,
|
||||
22
|
||||
23
|
||||
);
|
||||
|
|
|
@ -277,6 +277,55 @@ static int l_iterator(bvm *vm)
|
|||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
/* call a function with variable number of arguments */
|
||||
/* first argument is a callable object (function, closure, native function, native closure) */
|
||||
/* then all subsequent arguments are pushed except the last one */
|
||||
/* If the last argument is a 'list', then all elements are pushed as arguments */
|
||||
/* otherwise the last argument is pushed as well */
|
||||
static int l_call(bvm *vm)
|
||||
{
|
||||
int top = be_top(vm);
|
||||
if (top >= 1 && be_isfunction(vm, 1)) {
|
||||
size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */
|
||||
/* test if last argument is a list */
|
||||
|
||||
if (top > 1 && be_isinstance(vm, top) && be_getmember(vm, top, ".p") && be_islist(vm, top + 1)) {
|
||||
int32_t list_size = be_data_size(vm, top + 1);
|
||||
|
||||
if (list_size > 0) {
|
||||
be_stack_require(vm, list_size + 3); /* make sure we don't overflow the stack */
|
||||
for (int i = 0; i < list_size; i++) {
|
||||
be_pushnil(vm);
|
||||
}
|
||||
be_moveto(vm, top + 1, top + 1 + list_size);
|
||||
be_moveto(vm, top, top + list_size);
|
||||
|
||||
be_refpush(vm, -2);
|
||||
be_pushiter(vm, -1);
|
||||
while (be_iter_hasnext(vm, -2)) {
|
||||
be_iter_next(vm, -2);
|
||||
be_moveto(vm, -1, top);
|
||||
top++;
|
||||
be_pop(vm, 1);
|
||||
}
|
||||
be_pop(vm, 1); /* remove iterator */
|
||||
be_refpop(vm);
|
||||
}
|
||||
be_pop(vm, 2);
|
||||
arg_count = arg_count - 1 + list_size;
|
||||
}
|
||||
/* actual call */
|
||||
be_call(vm, arg_count);
|
||||
/* remove args */
|
||||
be_pop(vm, arg_count);
|
||||
/* return value */
|
||||
|
||||
be_return(vm);
|
||||
}
|
||||
be_raise(vm, "value_error", "first argument must be a function");
|
||||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
static int l_str(bvm *vm)
|
||||
{
|
||||
if (be_top(vm)) {
|
||||
|
@ -407,6 +456,12 @@ void be_load_baselib(bvm *vm)
|
|||
be_regfunc(vm, "isinstance", l_isinstance);
|
||||
be_regfunc(vm, "__iterator__", l_iterator);
|
||||
}
|
||||
|
||||
/* call must be added later to respect order of builtins */
|
||||
void be_load_baselib_call(bvm *vm)
|
||||
{
|
||||
be_regfunc(vm, "call", l_call);
|
||||
}
|
||||
#else
|
||||
extern const bclass be_class_list;
|
||||
extern const bclass be_class_map;
|
||||
|
@ -437,6 +492,7 @@ vartab m_builtin (scope: local) {
|
|||
map, class(be_class_map)
|
||||
range, class(be_class_range)
|
||||
bytes, class(be_class_bytes)
|
||||
call, func(l_call)
|
||||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_m_builtin.h"
|
||||
|
|
|
@ -76,62 +76,12 @@ static int m_setmember(bvm *vm)
|
|||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
/* call a function with variable number of arguments */
|
||||
/* first argument is a callable object (function, closure, native function, native closure) */
|
||||
/* then all subsequent arguments are pushed except the last one */
|
||||
/* If the last argument is a 'list', then all elements are pushed as arguments */
|
||||
/* otherwise the last argument is pushed as well */
|
||||
static int m_vcall(bvm *vm)
|
||||
{
|
||||
int top = be_top(vm);
|
||||
if (top >= 1 && be_isfunction(vm, 1)) {
|
||||
size_t arg_count = top - 1; /* we have at least 'top - 1' arguments */
|
||||
/* test if last argument is a list */
|
||||
|
||||
if (top > 1 && be_isinstance(vm, top) && be_getmember(vm, top, ".p") && be_islist(vm, top + 1)) {
|
||||
int32_t list_size = be_data_size(vm, top + 1);
|
||||
|
||||
if (list_size > 0) {
|
||||
be_stack_require(vm, list_size + 3); /* make sure we don't overflow the stack */
|
||||
for (int i = 0; i < list_size; i++) {
|
||||
be_pushnil(vm);
|
||||
}
|
||||
be_moveto(vm, top + 1, top + 1 + list_size);
|
||||
be_moveto(vm, top, top + list_size);
|
||||
|
||||
be_refpush(vm, -2);
|
||||
be_pushiter(vm, -1);
|
||||
while (be_iter_hasnext(vm, -2)) {
|
||||
be_iter_next(vm, -2);
|
||||
be_moveto(vm, -1, top);
|
||||
top++;
|
||||
be_pop(vm, 1);
|
||||
}
|
||||
be_pop(vm, 1); /* remove iterator */
|
||||
be_refpop(vm);
|
||||
}
|
||||
be_pop(vm, 2);
|
||||
arg_count = arg_count - 1 + list_size;
|
||||
}
|
||||
/* actual call */
|
||||
be_call(vm, arg_count);
|
||||
/* remove args */
|
||||
be_pop(vm, arg_count);
|
||||
/* return value */
|
||||
|
||||
be_return(vm);
|
||||
}
|
||||
be_raise(vm, "value_error", "first argument must be a function");
|
||||
be_return_nil(vm);
|
||||
}
|
||||
|
||||
#if !BE_USE_PRECOMPILED_OBJECT
|
||||
be_native_module_attr_table(introspect) {
|
||||
be_native_module_function("members", m_attrlist),
|
||||
|
||||
be_native_module_function("get", m_findmember),
|
||||
be_native_module_function("set", m_setmember),
|
||||
be_native_module_function("vcall", m_vcall),
|
||||
};
|
||||
|
||||
be_define_native_module(introspect, NULL);
|
||||
|
@ -142,7 +92,6 @@ module introspect (scope: global, depend: BE_USE_INTROSPECT_MODULE) {
|
|||
|
||||
get, func(m_findmember)
|
||||
set, func(m_setmember)
|
||||
vcall, func(m_vcall)
|
||||
}
|
||||
@const_object_info_end */
|
||||
#include "../generate/be_fixed_introspect.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "be_libs.h"
|
||||
|
||||
extern void be_load_baselib(bvm *vm);
|
||||
extern void be_load_baselib_call(bvm *vm);
|
||||
extern void be_load_listlib(bvm *vm);
|
||||
extern void be_load_maplib(bvm *vm);
|
||||
extern void be_load_rangelib(bvm *vm);
|
||||
|
@ -23,5 +24,6 @@ void be_loadlibs(bvm *vm)
|
|||
be_load_rangelib(vm);
|
||||
be_load_filelib(vm);
|
||||
be_load_byteslib(vm);
|
||||
be_load_baselib_call(vm);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -33,10 +33,12 @@ block_builder::block_builder(const object_block *object, const macro_table *macr
|
|||
m_strtab.push_back(it->second);
|
||||
}
|
||||
|
||||
for (auto i : object->data) {
|
||||
if (i.second.depend.empty() || macro->query(i.second.depend)) {
|
||||
m_block.data[i.first] = i.second.value;
|
||||
m_strtab.push_back(i.first);
|
||||
for (auto key : object->data_ordered) {
|
||||
auto second = object->data.at(key);
|
||||
if (second.depend.empty() || macro->query(second.depend)) {
|
||||
m_block.data[key] = second.value;
|
||||
m_strtab.push_back(key);
|
||||
m_block.data_ordered.push_back(key); /* record insertion order */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,10 +108,9 @@ std::string block_builder::vartab_tostring(const block &block)
|
|||
|
||||
idxblk = block;
|
||||
idxblk.data.clear();
|
||||
for (auto it : block.data) {
|
||||
varvec.push_back(it.second);
|
||||
it.second = "int(" + std::to_string(index++) + ")";
|
||||
idxblk.data.insert(it);
|
||||
for (auto key : block.data_ordered) {
|
||||
varvec.push_back(block.data.at(key));
|
||||
idxblk.data[key] = "int(" + std::to_string(index++) + ")";
|
||||
}
|
||||
|
||||
ostr << map_tostring(idxblk, block.name + "_map", true) << std::endl;
|
||||
|
|
|
@ -28,6 +28,7 @@ private:
|
|||
std::string name;
|
||||
std::map<std::string, std::string> attr;
|
||||
std::map<std::string, std::string> data;
|
||||
std::vector<std::string> data_ordered; /* used to retrieve in insertion order */
|
||||
};
|
||||
|
||||
std::string block_tostring(const block &block);
|
||||
|
|
|
@ -186,4 +186,5 @@ void coc_parser::parse_body_item(object_block *object)
|
|||
if (parse_char_continue(','))
|
||||
value.depend = parse_tonewline();
|
||||
object->data[key] = value;
|
||||
object->data_ordered.push_back(key);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ struct object_block {
|
|||
std::string name;
|
||||
std::map<std::string, std::string> attr;
|
||||
std::map<std::string, data_value> data;
|
||||
std::vector<std::string> data_ordered; /* preserve order of keys */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -80,7 +80,7 @@ class:
|
|||
method_count: 4 -- number of method
|
||||
method_table: [
|
||||
string -- method name
|
||||
function -- method function body
|
||||
function | nil -- method function body or nil (static member) if the first byte is null (which would be an empty func name)
|
||||
](method_count)
|
||||
member_index_table -> [
|
||||
string -- member name
|
||||
|
|
|
@ -17,7 +17,7 @@ func_body = '(' [arg_field {',' arg_field}] ')' block 'end';
|
|||
arg_field = ['*'] ID;
|
||||
(* class define statement *)
|
||||
class_stmt = 'class' ID [':' ID] class_block 'end';
|
||||
class_block = {'var' ID {',' ID} | func_stmt};
|
||||
class_block = {'var' ID {',' ID} | 'static' ID ['=' expr] {',' ID ['=' expr] } | func_stmt};
|
||||
import_stmt = 'import' (ID (['as' ID] | {',' ID}) | STRING 'as' ID);
|
||||
(* exceptional handling statement *)
|
||||
try_stmt = 'try' block except_block {except_block} 'end';
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue