mruby/c VM Source Code release 4.0.0
Loading...
Searching...
No Matches
vm_config.h
Go to the documentation of this file.
1
14
15#ifndef MRBC_SRC_VM_CONFIG_H_
16#define MRBC_SRC_VM_CONFIG_H_
17
18// maximum number of VMs
19#if !defined(MAX_VM_COUNT)
20#define MAX_VM_COUNT 5
21#endif
22
23// maximum size of registers
24#if !defined(MAX_REGS_SIZE)
25#define MAX_REGS_SIZE 110
26#endif
27
28// maximum number of symbols
29#if !defined(MAX_SYMBOLS_COUNT)
30#define MAX_SYMBOLS_COUNT 255
31#endif
32
33
34// memory management
35// MRBC_ALLOC_16BIT or MRBC_ALLOC_24BIT
36#define MRBC_ALLOC_24BIT
37
38
39/* USE Float. Support Float class.
40 0: NOT USE
41 1: USE float
42 2: USE double
43*/
44#if !defined(MRBC_USE_FLOAT)
45#define MRBC_USE_FLOAT 2
46#endif
47
48// Use math. Support Math class.
49#if !defined(MRBC_USE_MATH)
50#define MRBC_USE_MATH 0
51#endif
52
53// USE String. Support String class.
54#if !defined(MRBC_USE_STRING)
55#define MRBC_USE_STRING 1
56#endif
57
58/* USE UTF-8 String. Enable UTF-8 encoding support for String class.
59 When enabled, String methods like size, [], []=, index work with
60 UTF-8 character indices instead of byte indices.
61 0: NOT USE (ASCII/binary mode - default)
62 1: USE UTF-8
63*/
64#if !defined(MRBC_USE_STRING_UTF8)
65#define MRBC_USE_STRING_UTF8 0
66#endif
67
68/* USE Unicode case mapping. Enable full BMP Unicode case conversion.
69 Requires MRBC_USE_STRING_UTF8 to be enabled.
70 When enabled, upcase/downcase work with Greek, Cyrillic, etc.
71 Adds ~5KB to binary size.
72 0: NOT USE (ASCII-only case conversion - default)
73 1: USE full Unicode BMP case mapping
74*/
75#if !defined(MRBC_USE_UNICODE_CASE)
76#define MRBC_USE_UNICODE_CASE 0
77#endif
78
79
80/* Hardware dependent flags
81
82 Use the MRBC_BIG_ENDIAN, MRBC_LITTLE_ENDIAN and MRBC_REQUIRE_*BIT_ALIGNMENT
83 macros.
84 for conversion functions from binary (byte array) to each data type.
85
86 (each cases)
87 Little endian, no alignment.
88 MRBC_LITTLE_ENDIAN && !MRBC_REQUIRE_32BIT_ALIGNMENT
89 (e.g.) ARM Cortex-M4, Intel x86
90
91 Big endian, no alignment.
92 MRBC_BIG_ENDIAN && !MRBC_REQUIRE_32BIT_ALIGNMENT
93 (e.g.) IBM PPC405
94
95 Little endian, 32bit alignment required.
96 MRBC_LITTLE_ENDIAN && MRBC_REQUIRE_32BIT_ALIGNMENT
97 (e.g.) ARM Cortex-M0
98
99 Big endian, 32bit alignment required.
100 MRBC_BIG_ENDIAN) && MRBC_REQUIRE_32BIT_ALIGNMENT
101 (e.g.) OpenRISC
102*/
103
104/* Endian
105 Define either MRBC_BIG_ENDIAN or MRBC_LITTLE_ENDIAN.
106*/
107#if !defined(MRBC_BIG_ENDIAN) && !defined(MRBC_LITTLE_ENDIAN)
108# define MRBC_LITTLE_ENDIAN
109#endif
110
111/* Word alignment
112 If 32bit and/or 64bit alignment is required, enable the following line.
113*/
114// #define MRBC_REQUIRE_32BIT_ALIGNMENT
115#define MRBC_REQUIRE_64BIT_ALIGNMENT
116
117
118/* Others */
119
120// Compile with debug code.
121#if !defined(NDEBUG)
122#define MRBC_DEBUG
123#endif
124
125// #define MRBC_NO_TIMER
126
127// Console new-line mode.
128// If you need to convert LF to CRLF in console output, enable the following:
129// #define MRBC_CONVERT_CRLF
130
131// If you need 64bit integer.
132// #define MRBC_INT64
133
134// If you get exception with message "Not support op_ext..." when runtime.
135// #define MRBC_SUPPORT_OP_EXT
136
137// If you use LIBC malloc instead of mruby/c malloc
138// #define MRBC_ALLOC_LIBC
139
140// Nesting level for exception printing (default 8)
141// #define MRBC_EXCEPTION_CALL_NEST_LEVEL 8
142
143// Set the following constant to 1 to enable user-defined destructors;
144// otherwise, set it to 0. The default is 1.
145// #define MRBC_INSTANCE_DESTRUCTOR 0
146
147// Override actions when some fatal errors.
148// Default behavior for MRBC_OUT_OF_MEMORY is to print error and call mrbc_hal_abort().
149// Uncomment and customize if you need different behavior:
150// #define MRBC_OUT_OF_MEMORY() mrbc_alloc_print_memory_pool(); mrbc_hal_abort(0)
151// #define MRBC_ABORT_BY_EXCEPTION(vm) mrbc_p( &vm->exception ); mrbc_hal_abort(0)
152
153#endif // MRBC_SRC_VM_CONFIG_H_