Flipper Developer Docs
Toggle main menu visibility
Main Page
Related Pages
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Files
File List
Globals
All
_
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
v
w
Functions
_
a
b
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
v
w
Variables
Typedefs
a
b
c
d
e
f
g
i
m
n
p
r
s
t
v
Enumerations
a
b
c
d
e
f
g
i
n
o
p
r
s
v
Enumerator
c
e
f
g
i
n
o
r
s
v
Macros
_
d
e
f
r
v
w
Examples
▼
Flipper Developer Docs
►
App Development
►
Developer Tools
►
Expansion Modules
►
File Formats
►
JavaScript
►
Miscellaneous
►
System Programming
►
js_gui__widget
Deprecated List
►
Data Structures
▼
Files
▼
File List
►
applications
►
furi
▼
lib
►
bit_lib
►
ble_profile
►
datetime
►
digital_signal
►
drivers
►
flipper_application
►
flipper_format
►
FreeRTOS-glue
►
ibutton
►
infrared
►
lfrfid
▼
mjs
►
common
►
ffi
mjs_array.h
mjs_array_buf.h
mjs_array_buf_public.h
mjs_array_public.h
mjs_bcode.h
mjs_builtin.h
mjs_core.h
mjs_core_public.h
mjs_dataview.h
mjs_exec.h
mjs_exec_public.h
mjs_features.h
mjs_ffi.h
mjs_ffi_public.h
mjs_gc.h
mjs_gc_public.h
mjs_internal.h
mjs_json.h
mjs_license.h
mjs_mm.h
mjs_object.h
mjs_object_public.h
mjs_parser.h
mjs_primitive.h
mjs_primitive_public.h
mjs_string.h
mjs_string_public.h
mjs_tok.h
mjs_util.h
mjs_util_public.h
►
music_worker
►
nfc
►
one_wire
►
print
►
pulse_reader
►
signal_reader
►
subghz
►
toolbox
►
u8g2
►
update_util
err.h
mbedtls_cfg.h
►
targets
►
Globals
►
Examples
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Loading...
Searching...
No Matches
mjs_bcode.h
1
/*
2
* Copyright (c) 2017 Cesanta Software Limited
3
* All rights reserved
4
*/
5
6
#ifndef MJS_BCODE_H_
7
#define MJS_BCODE_H_
8
9
#include "mjs_internal.h"
10
11
#include "mjs_core.h"
12
13
#if defined(__cplusplus)
14
extern
"C"
{
15
#endif
/* __cplusplus */
16
17
enum
mjs_opcode {
18
OP_NOP,
/* ( -- ) */
19
OP_DROP,
/* ( a -- ) */
20
OP_DUP,
/* ( a -- a a ) */
21
OP_SWAP,
/* ( a b -- b a ) */
22
OP_JMP,
/* ( -- ) */
23
OP_JMP_TRUE,
/* ( -- ) */
24
OP_JMP_NEUTRAL_TRUE,
/* ( -- ) */
25
OP_JMP_FALSE,
/* ( -- ) */
26
OP_JMP_NEUTRAL_FALSE,
/* ( -- ) */
27
OP_FIND_SCOPE,
/* ( a -- a b ) */
28
OP_PUSH_SCOPE,
/* ( -- a ) */
29
OP_PUSH_STR,
/* ( -- a ) */
30
OP_PUSH_TRUE,
/* ( -- a ) */
31
OP_PUSH_FALSE,
/* ( -- a ) */
32
OP_PUSH_INT,
/* ( -- a ) */
33
OP_PUSH_DBL,
/* ( -- a ) */
34
OP_PUSH_NULL,
/* ( -- a ) */
35
OP_PUSH_UNDEF,
/* ( -- a ) */
36
OP_PUSH_OBJ,
/* ( -- a ) */
37
OP_PUSH_ARRAY,
/* ( -- a ) */
38
OP_PUSH_FUNC,
/* ( -- a ) */
39
OP_PUSH_THIS,
/* ( -- a ) */
40
OP_GET,
/* ( key obj -- obj[key] ) */
41
OP_CREATE,
/* ( key obj -- ) */
42
OP_EXPR,
/* ( ... -- a ) */
43
OP_APPEND,
/* ( a b -- ) */
44
OP_SET_ARG,
/* ( a -- a ) */
45
OP_NEW_SCOPE,
/* ( -- ) */
46
OP_DEL_SCOPE,
/* ( -- ) */
47
OP_CALL,
/* ( func param1 param2 ... num_params -- result ) */
48
OP_RETURN,
/* ( -- ) */
49
OP_LOOP,
/* ( -- ) Push break & continue addresses to loop_labels */
50
OP_BREAK,
/* ( -- ) */
51
OP_CONTINUE,
/* ( -- ) */
52
OP_SETRETVAL,
/* ( a -- ) */
53
OP_EXIT,
/* ( -- ) */
54
OP_BCODE_HEADER,
/* ( -- ) */
55
OP_ARGS,
/* ( -- ) Mark the beginning of function call arguments */
56
OP_FOR_IN_NEXT,
/* ( name obj iter_ptr -- name obj iter_ptr_next ) */
57
OP_MAX
58
};
59
60
struct
pstate
;
61
struct
mjs
;
62
63
MJS_PRIVATE
void
emit_byte(
struct
pstate
*
pstate
, uint8_t
byte
);
64
MJS_PRIVATE
void
emit_int(
struct
pstate
*
pstate
, int64_t n);
65
MJS_PRIVATE
void
emit_str(
struct
pstate
*
pstate
,
const
char
* ptr,
size_t
len);
66
67
/*
68
* Inserts provided offset `v` at the offset `offset`.
69
*
70
* Returns delta at which the code was moved; the delta can be any: 0 or
71
* positive or negative.
72
*/
73
MJS_PRIVATE
int
74
mjs_bcode_insert_offset(
struct
pstate
* p,
struct
mjs
*
mjs
,
size_t
offset,
size_t
v);
75
76
/*
77
* Adds a new bcode part; does not retain `bp`.
78
*/
79
MJS_PRIVATE
void
mjs_bcode_part_add(
struct
mjs
*
mjs
,
const
struct
mjs_bcode_part
* bp);
80
81
/*
82
* Returns bcode part by the bcode number
83
*/
84
MJS_PRIVATE
struct
mjs_bcode_part
* mjs_bcode_part_get(
struct
mjs
*
mjs
,
int
num);
85
86
/*
87
* Returns bcode part by the global bcode offset
88
*/
89
MJS_PRIVATE
struct
mjs_bcode_part
* mjs_bcode_part_get_by_offset(
struct
mjs
*
mjs
,
size_t
offset);
90
91
/*
92
* Returns a number of bcode parts
93
*/
94
MJS_PRIVATE
int
mjs_bcode_parts_cnt(
struct
mjs
*
mjs
);
95
96
/*
97
* Adds the bcode being generated (mjs->bcode_gen) as a next bcode part
98
*/
99
MJS_PRIVATE
void
mjs_bcode_commit(
struct
mjs
*
mjs
);
100
101
#if defined(__cplusplus)
102
}
103
#endif
/* __cplusplus */
104
105
#endif
/* MJS_BCODE_H_ */
mjs_bcode_part
Definition
mjs_core.h:41
mjs
Definition
mjs_core.h:63
pstate
Definition
mjs_tok.h:21
lib
mjs
mjs_bcode.h
Generated by
1.12.0