@salang/sa 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/sa.js +19 -1
- package/package.json +8 -7
- package/sa_std/alloc/layout.sal +12 -0
- package/sa_std/alloc/prelude.sa +1 -0
- package/sa_std/alloc/prelude.sal +1 -0
- package/sa_std/alloc/string.sa +3 -0
- package/sa_std/alloc/vec.sa +684 -0
- package/sa_std/alloc/vec.sal +4 -0
- package/sa_std/any.sa +130 -0
- package/sa_std/any.sal +23 -0
- package/sa_std/array.sa +1876 -0
- package/sa_std/ascii.sa +2 -0
- package/sa_std/ascii.sal +1 -0
- package/sa_std/async.sla +116 -0
- package/sa_std/binary_heap.sa +3003 -0
- package/sa_std/binary_heap.sal +7 -0
- package/sa_std/borrow.sa +171 -0
- package/sa_std/borrow.sal +13 -0
- package/sa_std/btree_map.sa +2210 -0
- package/sa_std/btree_map.sal +11 -0
- package/sa_std/btree_set.sa +1072 -0
- package/sa_std/btree_set.sal +6 -0
- package/sa_std/char.sa +1309 -0
- package/sa_std/char.sal +50 -0
- package/sa_std/cmp.sa +554 -0
- package/sa_std/cmp.sal +14 -0
- package/sa_std/collections/binary_heap.sa +1 -0
- package/sa_std/collections/btree_map.sa +1 -0
- package/sa_std/collections/btree_set.sa +1 -0
- package/sa_std/collections/hashmap.sa +1 -0
- package/sa_std/collections/hashset.sa +1 -0
- package/sa_std/collections/linked_list.sa +1120 -0
- package/sa_std/collections/linked_list.sal +10 -0
- package/sa_std/collections/prelude.sa +7 -0
- package/sa_std/collections/prelude.sal +1 -0
- package/sa_std/collections/vec_deque.sa +1 -0
- package/sa_std/collections.sal +13 -0
- package/sa_std/convert.sa +1115 -0
- package/sa_std/convert.sal +24 -0
- package/sa_std/core/arc.sa +233 -0
- package/sa_std/core/arc.sal +4 -0
- package/sa_std/core/ascii.sa +784 -0
- package/sa_std/core/ascii.sal +34 -0
- package/sa_std/core/bit.sa +41 -0
- package/sa_std/core/box.sa +1 -0
- package/sa_std/core/box.sal +2 -0
- package/sa_std/core/cell.sa +108 -0
- package/sa_std/core/cell.sal +5 -0
- package/sa_std/core/cleanup.sa +26 -0
- package/sa_std/core/control.sa +20 -0
- package/sa_std/core/derive.sa +60 -0
- package/sa_std/core/derive.sal +1 -0
- package/sa_std/core/dispatch.sa +7 -0
- package/sa_std/core/dispatch.sal +5 -0
- package/sa_std/core/future.sa +777 -0
- package/sa_std/core/future.sal +73 -0
- package/sa_std/core/hash.sa +48 -0
- package/sa_std/core/iter.sa +2805 -0
- package/sa_std/core/iter.sal +4 -0
- package/sa_std/core/loop.sa +60 -0
- package/sa_std/core/mem.sa +220 -0
- package/sa_std/core/option.sa +825 -0
- package/sa_std/core/option.sal +11 -0
- package/sa_std/core/panic.sa +23 -0
- package/sa_std/core/panic.sal +12 -0
- package/sa_std/core/prelude.sa +18 -0
- package/sa_std/core/prelude.sal +18 -0
- package/sa_std/core/rc.sa +225 -0
- package/sa_std/core/rc.sal +4 -0
- package/sa_std/core/refcell.sa +283 -0
- package/sa_std/core/refcell.sal +13 -0
- package/sa_std/core/result.sa +708 -0
- package/sa_std/core/result.sal +6 -0
- package/sa_std/core/rust_patterns.sal +295 -0
- package/sa_std/core/sa_core.sa +84 -0
- package/sa_std/core/slice.sa +4021 -0
- package/sa_std/core/slice.sal +7 -0
- package/sa_std/core/task.sa +112 -0
- package/sa_std/core/task.sal +15 -0
- package/sa_std/core/trait_object.sa +26 -0
- package/sa_std/core/trait_object.sal +4 -0
- package/sa_std/core/waker.sa +289 -0
- package/sa_std/core/waker.sal +31 -0
- package/sa_std/core/weak.sa +2 -0
- package/sa_std/core/weak.sal +4 -0
- package/sa_std/cow.sa +3 -0
- package/sa_std/cow.sal +2 -0
- package/sa_std/cstring.sa +3 -0
- package/sa_std/cstring.sal +2 -0
- package/sa_std/default.sa +99 -0
- package/sa_std/duration.sa +3 -0
- package/sa_std/duration.sal +2 -0
- package/sa_std/encoding/json.sa +259 -0
- package/sa_std/encoding/json.sai +54 -0
- package/sa_std/encoding/json.sal +35 -0
- package/sa_std/encoding/prelude.sa +1 -0
- package/sa_std/encoding/prelude.sal +0 -0
- package/sa_std/env.sa +390 -0
- package/sa_std/env.sai +25 -0
- package/sa_std/error.sa +253 -0
- package/sa_std/error.sal +44 -0
- package/sa_std/ffi/cstring.sa +3 -0
- package/sa_std/ffi/cstring.sal +1 -0
- package/sa_std/ffi/prelude.sa +2 -0
- package/sa_std/ffi/prelude.sal +2 -0
- package/sa_std/ffi.sa +635 -0
- package/sa_std/ffi.sal +51 -0
- package/sa_std/fmt.sa +2 -0
- package/sa_std/fmt.sai +18 -0
- package/sa_std/fmt.sal +35 -0
- package/sa_std/fs.sa +1023 -0
- package/sa_std/fs.sai +127 -0
- package/sa_std/fs.sal +51 -0
- package/sa_std/future.sa +2 -0
- package/sa_std/future.sal +1 -0
- package/sa_std/hash.sa +1486 -0
- package/sa_std/hash.sal +13 -0
- package/sa_std/hashmap.sa +1962 -0
- package/sa_std/hashmap.sal +20 -0
- package/sa_std/hashset.sa +1004 -0
- package/sa_std/hashset.sal +18 -0
- package/sa_std/http2.sa +78 -0
- package/sa_std/http2.sai +26 -0
- package/sa_std/http2.sal +36 -0
- package/sa_std/instant.sa +3 -0
- package/sa_std/instant.sal +2 -0
- package/sa_std/io/buf_reader.sa +43 -0
- package/sa_std/io/buf_writer.sa +35 -0
- package/sa_std/io/bufio.sa +4 -0
- package/sa_std/io/bufio.sal +4 -0
- package/sa_std/io/prelude.sa +1 -0
- package/sa_std/io/prelude.sal +1 -0
- package/sa_std/io/print.sa +2 -0
- package/sa_std/io/print.sai +3 -0
- package/sa_std/io.sa +925 -0
- package/sa_std/io.sai +25 -0
- package/sa_std/io.sal +84 -0
- package/sa_std/iter.sa +2 -0
- package/sa_std/iter.sal +1 -0
- package/sa_std/join_handle.sa +3 -0
- package/sa_std/join_handle.sal +2 -0
- package/sa_std/libsa_async.sa +80 -0
- package/sa_std/m_async.sa +137 -0
- package/sa_std/m_async.sal +30 -0
- package/sa_std/m_async.sla +2 -0
- package/sa_std/manually_drop.sa +3 -0
- package/sa_std/manually_drop.sal +2 -0
- package/sa_std/marker/phantom_data.sa +3 -0
- package/sa_std/marker/phantom_data.sal +1 -0
- package/sa_std/marker/prelude.sa +4 -0
- package/sa_std/marker/prelude.sal +4 -0
- package/sa_std/marker.sa +220 -0
- package/sa_std/marker.sal +15 -0
- package/sa_std/math.sa +84 -0
- package/sa_std/math.sai +10 -0
- package/sa_std/mem/manually_drop.sa +3 -0
- package/sa_std/mem/manually_drop.sal +1 -0
- package/sa_std/mem/prelude.sa +2 -0
- package/sa_std/mem/prelude.sal +2 -0
- package/sa_std/mem.sa +564 -0
- package/sa_std/mem.sal +40 -0
- package/sa_std/modstate.sai +19 -0
- package/sa_std/net.sa +4227 -0
- package/sa_std/net.sai +239 -0
- package/sa_std/net.sal +159 -0
- package/sa_std/netx.sa +85 -0
- package/sa_std/netx.sai +11 -0
- package/sa_std/netx.sal +39 -0
- package/sa_std/nonzero.sa +3 -0
- package/sa_std/nonzero.sal +2 -0
- package/sa_std/num/nonzero.sa +3 -0
- package/sa_std/num/nonzero.sal +1 -0
- package/sa_std/num/prelude.sa +3 -0
- package/sa_std/num/prelude.sal +3 -0
- package/sa_std/num.sa +17302 -0
- package/sa_std/num.sai +11 -0
- package/sa_std/num.sal +341 -0
- package/sa_std/ops.sa +1884 -0
- package/sa_std/ops.sal +68 -0
- package/sa_std/option.sa +2 -0
- package/sa_std/option.sal +1 -0
- package/sa_std/os/fd.sa +96 -0
- package/sa_std/os/fd.sai +7 -0
- package/sa_std/os/fd.sal +11 -0
- package/sa_std/os/prelude.sa +2 -0
- package/sa_std/os/prelude.sal +1 -0
- package/sa_std/os/unix_ffi.sa +271 -0
- package/sa_std/panic.sa +1 -0
- package/sa_std/panic.sal +1 -0
- package/sa_std/path.sa +3170 -0
- package/sa_std/path.sal +12 -0
- package/sa_std/phantom_data.sa +3 -0
- package/sa_std/phantom_data.sal +2 -0
- package/sa_std/pin.sa +79 -0
- package/sa_std/pin.sal +5 -0
- package/sa_std/plugin_async.sa +90 -0
- package/sa_std/plugin_async.sal +29 -0
- package/sa_std/plugin_async.sla +4 -0
- package/sa_std/plugin_http_async.sa +46 -0
- package/sa_std/plugin_http_server.sa +61 -0
- package/sa_std/plugin_http_server.sla +2 -0
- package/sa_std/plugin_sqlite.sa +106 -0
- package/sa_std/plugin_sqlite.sla +2 -0
- package/sa_std/prelude.sa +60 -0
- package/sa_std/prelude.sal +55 -0
- package/sa_std/process.sa +916 -0
- package/sa_std/process.sai +57 -0
- package/sa_std/process.sal +27 -0
- package/sa_std/ptr.sa +503 -0
- package/sa_std/ptr.sal +2 -0
- package/sa_std/result.sa +2 -0
- package/sa_std/result.sal +1 -0
- package/sa_std/rust_core.sa +51 -0
- package/sa_std/rust_core.sal +26 -0
- package/sa_std/sa.mod +7 -0
- package/sa_std/sort.sa +156 -0
- package/sa_std/str.sla +13 -0
- package/sa_std/string.sa +12240 -0
- package/sa_std/string.sai +25 -0
- package/sa_std/string.sal +17 -0
- package/sa_std/string_format.sa +269 -0
- package/sa_std/sync/atomic.sa +1500 -0
- package/sa_std/sync/atomic.sal +45 -0
- package/sa_std/sync/barrier.sa +105 -0
- package/sa_std/sync/barrier.sal +7 -0
- package/sa_std/sync/condvar.sa +240 -0
- package/sa_std/sync/condvar.sal +4 -0
- package/sa_std/sync/mpsc.sa +758 -0
- package/sa_std/sync/mpsc.sal +42 -0
- package/sa_std/sync/mpsc_list.sa +255 -0
- package/sa_std/sync/mpsc_list.sal +3 -0
- package/sa_std/sync/mutex.sa +182 -0
- package/sa_std/sync/mutex.sal +7 -0
- package/sa_std/sync/once.sa +371 -0
- package/sa_std/sync/once.sal +31 -0
- package/sa_std/sync/poison.sa +36 -0
- package/sa_std/sync/poison.sal +11 -0
- package/sa_std/sync/prelude.sa +8 -0
- package/sa_std/sync/prelude.sal +7 -0
- package/sa_std/sync/rwlock.sa +369 -0
- package/sa_std/sync/rwlock.sal +13 -0
- package/sa_std/task.sa +2 -0
- package/sa_std/task.sal +1 -0
- package/sa_std/term.sa +2 -0
- package/sa_std/term.sai +10 -0
- package/sa_std/term.sal +33 -0
- package/sa_std/testing/assert.sai +4 -0
- package/sa_std/testing/mock_io.sa +174 -0
- package/sa_std/testing/mock_io.sal +5 -0
- package/sa_std/testing/prelude.sa +2 -0
- package/sa_std/testing/prelude.sal +1 -0
- package/sa_std/text/prelude.sa +1 -0
- package/sa_std/text/prelude.sal +1 -0
- package/sa_std/text/regex.sa +2 -0
- package/sa_std/text/regex.sai +9 -0
- package/sa_std/text/regex.sal +33 -0
- package/sa_std/thread/join_handle.sa +3 -0
- package/sa_std/thread/join_handle.sal +1 -0
- package/sa_std/thread/prelude.sa +4 -0
- package/sa_std/thread/prelude.sal +3 -0
- package/sa_std/thread.sa +160 -0
- package/sa_std/thread.sai +11 -0
- package/sa_std/thread.sal +4 -0
- package/sa_std/thread_local.sa +45 -0
- package/sa_std/thread_local.sai +9 -0
- package/sa_std/time/duration.sa +3 -0
- package/sa_std/time/duration.sal +1 -0
- package/sa_std/time/instant.sa +3 -0
- package/sa_std/time/instant.sal +1 -0
- package/sa_std/time/prelude.sa +4 -0
- package/sa_std/time/prelude.sal +4 -0
- package/sa_std/time.sa +850 -0
- package/sa_std/time.sai +37 -0
- package/sa_std/time.sal +35 -0
- package/sa_std/time.sla +67 -0
- package/sa_std/tls_client.sai +39 -0
- package/sa_std/vec.sa +5754 -0
- package/sa_std/vec.sal +1 -0
- package/sa_std/vec_deque.sa +4925 -0
- package/sa_std/vec_deque.sal +8 -0
- package/sa_std/vec_runtime_macros.sa +11 -0
- package/sa_std/ws_client.sai +57 -0
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
@import "ascii.sal"
|
|
2
|
+
@import "slice.sal"
|
|
3
|
+
@import "slice.sa"
|
|
4
|
+
|
|
5
|
+
[MACRO] ASCII_IS_ASCII %out_bool, %byte
|
|
6
|
+
%out_bool = ule %byte, ASCII_MAX
|
|
7
|
+
[END_MACRO]
|
|
8
|
+
|
|
9
|
+
[MACRO] ASCII_SLICE_IS_ASCII %out_bool, %slice_reg
|
|
10
|
+
__ascii_slice_ptr_%out_bool = load %slice_reg+Slice_ptr as ptr
|
|
11
|
+
__ascii_slice_len_%out_bool = load %slice_reg+Slice_len as u64
|
|
12
|
+
__ascii_slice_idx_slot_%out_bool = stack_alloc 8
|
|
13
|
+
store __ascii_slice_idx_slot_%out_bool+0, 0 as u64
|
|
14
|
+
jmp L_ASCII_SLICE_IS_HEAD_%out_bool
|
|
15
|
+
|
|
16
|
+
L_ASCII_SLICE_IS_HEAD_%out_bool:
|
|
17
|
+
__ascii_slice_idx_%out_bool = load __ascii_slice_idx_slot_%out_bool+0 as u64
|
|
18
|
+
__ascii_slice_done_%out_bool = eq __ascii_slice_idx_%out_bool, __ascii_slice_len_%out_bool
|
|
19
|
+
br __ascii_slice_done_%out_bool -> L_ASCII_SLICE_IS_TRUE_%out_bool, L_ASCII_SLICE_IS_BODY_%out_bool
|
|
20
|
+
|
|
21
|
+
L_ASCII_SLICE_IS_BODY_%out_bool:
|
|
22
|
+
__ascii_slice_byte_ptr_%out_bool = ptr_add __ascii_slice_ptr_%out_bool, __ascii_slice_idx_%out_bool
|
|
23
|
+
__ascii_slice_byte_%out_bool = load __ascii_slice_byte_ptr_%out_bool+0 as u8
|
|
24
|
+
EXPAND ASCII_IS_ASCII __ascii_slice_byte_ok_%out_bool, __ascii_slice_byte_%out_bool
|
|
25
|
+
br __ascii_slice_byte_ok_%out_bool -> L_ASCII_SLICE_IS_NEXT_%out_bool, L_ASCII_SLICE_IS_FALSE_%out_bool
|
|
26
|
+
|
|
27
|
+
L_ASCII_SLICE_IS_NEXT_%out_bool:
|
|
28
|
+
__ascii_slice_next_%out_bool = add __ascii_slice_idx_%out_bool, 1
|
|
29
|
+
store __ascii_slice_idx_slot_%out_bool+0, __ascii_slice_next_%out_bool as u64
|
|
30
|
+
!__ascii_slice_next_%out_bool
|
|
31
|
+
!__ascii_slice_byte_ok_%out_bool
|
|
32
|
+
!__ascii_slice_byte_%out_bool
|
|
33
|
+
!__ascii_slice_byte_ptr_%out_bool
|
|
34
|
+
!__ascii_slice_done_%out_bool
|
|
35
|
+
!__ascii_slice_idx_%out_bool
|
|
36
|
+
jmp L_ASCII_SLICE_IS_HEAD_%out_bool
|
|
37
|
+
|
|
38
|
+
L_ASCII_SLICE_IS_TRUE_%out_bool:
|
|
39
|
+
%out_bool = add 0, 1
|
|
40
|
+
!__ascii_slice_done_%out_bool
|
|
41
|
+
!__ascii_slice_idx_%out_bool
|
|
42
|
+
!__ascii_slice_len_%out_bool
|
|
43
|
+
!__ascii_slice_ptr_%out_bool
|
|
44
|
+
jmp L_ASCII_SLICE_IS_END_%out_bool
|
|
45
|
+
|
|
46
|
+
L_ASCII_SLICE_IS_FALSE_%out_bool:
|
|
47
|
+
%out_bool = add 0, 0
|
|
48
|
+
!__ascii_slice_byte_ok_%out_bool
|
|
49
|
+
!__ascii_slice_byte_%out_bool
|
|
50
|
+
!__ascii_slice_byte_ptr_%out_bool
|
|
51
|
+
!__ascii_slice_done_%out_bool
|
|
52
|
+
!__ascii_slice_idx_%out_bool
|
|
53
|
+
!__ascii_slice_len_%out_bool
|
|
54
|
+
!__ascii_slice_ptr_%out_bool
|
|
55
|
+
|
|
56
|
+
L_ASCII_SLICE_IS_END_%out_bool:
|
|
57
|
+
[END_MACRO]
|
|
58
|
+
|
|
59
|
+
[MACRO] ASCII_SLICE_AS_ASCII %out_ok, %out_slice, %slice_reg
|
|
60
|
+
EXPAND ASCII_SLICE_IS_ASCII __ascii_as_ok_%out_ok, %slice_reg
|
|
61
|
+
br __ascii_as_ok_%out_ok -> L_ASCII_SLICE_AS_OK_%out_ok, L_ASCII_SLICE_AS_BAD_%out_ok
|
|
62
|
+
|
|
63
|
+
L_ASCII_SLICE_AS_OK_%out_ok:
|
|
64
|
+
EXPAND ASCII_SLICE_AS_ASCII_UNCHECKED %out_slice, %slice_reg
|
|
65
|
+
%out_ok = add 0, 1
|
|
66
|
+
!__ascii_as_ok_%out_ok
|
|
67
|
+
jmp L_ASCII_SLICE_AS_END_%out_ok
|
|
68
|
+
|
|
69
|
+
L_ASCII_SLICE_AS_BAD_%out_ok:
|
|
70
|
+
__ascii_as_empty_ptr_%out_ok = 0 as ptr
|
|
71
|
+
EXPAND SLICE_NEW %out_slice, __ascii_as_empty_ptr_%out_ok, 0
|
|
72
|
+
%out_ok = add 0, 0
|
|
73
|
+
!__ascii_as_empty_ptr_%out_ok
|
|
74
|
+
!__ascii_as_ok_%out_ok
|
|
75
|
+
|
|
76
|
+
L_ASCII_SLICE_AS_END_%out_ok:
|
|
77
|
+
[END_MACRO]
|
|
78
|
+
|
|
79
|
+
[MACRO] ASCII_SLICE_AS_ASCII_UNCHECKED %out_slice, %slice_reg
|
|
80
|
+
__ascii_unchecked_ptr_%out_slice = load %slice_reg+Slice_ptr as ptr
|
|
81
|
+
__ascii_unchecked_len_%out_slice = load %slice_reg+Slice_len as u64
|
|
82
|
+
EXPAND SLICE_NEW %out_slice, __ascii_unchecked_ptr_%out_slice, __ascii_unchecked_len_%out_slice
|
|
83
|
+
!__ascii_unchecked_len_%out_slice
|
|
84
|
+
!__ascii_unchecked_ptr_%out_slice
|
|
85
|
+
[END_MACRO]
|
|
86
|
+
|
|
87
|
+
[MACRO] ASCII_SLICE_AS_ASCII_MUT %out_ok, %out_slice, %slice_reg
|
|
88
|
+
EXPAND ASCII_SLICE_AS_ASCII %out_ok, %out_slice, %slice_reg
|
|
89
|
+
[END_MACRO]
|
|
90
|
+
|
|
91
|
+
[MACRO] ASCII_IS_UPPERCASE %out_bool, %byte
|
|
92
|
+
__ascii_ge_%out_bool = uge %byte, ASCII_UPPER_A
|
|
93
|
+
__ascii_le_%out_bool = ule %byte, ASCII_UPPER_Z
|
|
94
|
+
%out_bool = and __ascii_ge_%out_bool, __ascii_le_%out_bool
|
|
95
|
+
!__ascii_ge_%out_bool
|
|
96
|
+
!__ascii_le_%out_bool
|
|
97
|
+
[END_MACRO]
|
|
98
|
+
|
|
99
|
+
[MACRO] ASCII_IS_LOWERCASE %out_bool, %byte
|
|
100
|
+
__ascii_ge_%out_bool = uge %byte, ASCII_LOWER_A
|
|
101
|
+
__ascii_le_%out_bool = ule %byte, ASCII_LOWER_Z
|
|
102
|
+
%out_bool = and __ascii_ge_%out_bool, __ascii_le_%out_bool
|
|
103
|
+
!__ascii_ge_%out_bool
|
|
104
|
+
!__ascii_le_%out_bool
|
|
105
|
+
[END_MACRO]
|
|
106
|
+
|
|
107
|
+
[MACRO] ASCII_IS_ALPHABETIC %out_bool, %byte
|
|
108
|
+
EXPAND ASCII_IS_UPPERCASE __ascii_upper_%out_bool, %byte
|
|
109
|
+
EXPAND ASCII_IS_LOWERCASE __ascii_lower_%out_bool, %byte
|
|
110
|
+
%out_bool = or __ascii_upper_%out_bool, __ascii_lower_%out_bool
|
|
111
|
+
!__ascii_upper_%out_bool
|
|
112
|
+
!__ascii_lower_%out_bool
|
|
113
|
+
[END_MACRO]
|
|
114
|
+
|
|
115
|
+
[MACRO] ASCII_IS_DIGIT %out_bool, %byte
|
|
116
|
+
__ascii_ge_%out_bool = uge %byte, ASCII_DIGIT_0
|
|
117
|
+
__ascii_le_%out_bool = ule %byte, ASCII_DIGIT_9
|
|
118
|
+
%out_bool = and __ascii_ge_%out_bool, __ascii_le_%out_bool
|
|
119
|
+
!__ascii_ge_%out_bool
|
|
120
|
+
!__ascii_le_%out_bool
|
|
121
|
+
[END_MACRO]
|
|
122
|
+
|
|
123
|
+
[MACRO] ASCII_IS_OCTDIGIT %out_bool, %byte
|
|
124
|
+
__ascii_ge_%out_bool = uge %byte, ASCII_DIGIT_0
|
|
125
|
+
__ascii_le_%out_bool = ule %byte, ASCII_DIGIT_7
|
|
126
|
+
%out_bool = and __ascii_ge_%out_bool, __ascii_le_%out_bool
|
|
127
|
+
!__ascii_ge_%out_bool
|
|
128
|
+
!__ascii_le_%out_bool
|
|
129
|
+
[END_MACRO]
|
|
130
|
+
|
|
131
|
+
[MACRO] ASCII_IS_HEXDIGIT %out_bool, %byte
|
|
132
|
+
EXPAND ASCII_IS_DIGIT __ascii_digit_%out_bool, %byte
|
|
133
|
+
__ascii_ge_upper_%out_bool = uge %byte, ASCII_UPPER_A
|
|
134
|
+
__ascii_le_upper_%out_bool = ule %byte, ASCII_UPPER_F
|
|
135
|
+
__ascii_upper_%out_bool = and __ascii_ge_upper_%out_bool, __ascii_le_upper_%out_bool
|
|
136
|
+
__ascii_ge_lower_%out_bool = uge %byte, ASCII_LOWER_A
|
|
137
|
+
__ascii_le_lower_%out_bool = ule %byte, ASCII_LOWER_F
|
|
138
|
+
__ascii_lower_%out_bool = and __ascii_ge_lower_%out_bool, __ascii_le_lower_%out_bool
|
|
139
|
+
__ascii_letter_%out_bool = or __ascii_upper_%out_bool, __ascii_lower_%out_bool
|
|
140
|
+
%out_bool = or __ascii_digit_%out_bool, __ascii_letter_%out_bool
|
|
141
|
+
!__ascii_digit_%out_bool
|
|
142
|
+
!__ascii_ge_upper_%out_bool
|
|
143
|
+
!__ascii_le_upper_%out_bool
|
|
144
|
+
!__ascii_upper_%out_bool
|
|
145
|
+
!__ascii_ge_lower_%out_bool
|
|
146
|
+
!__ascii_le_lower_%out_bool
|
|
147
|
+
!__ascii_lower_%out_bool
|
|
148
|
+
!__ascii_letter_%out_bool
|
|
149
|
+
[END_MACRO]
|
|
150
|
+
|
|
151
|
+
[MACRO] ASCII_IS_ALPHANUMERIC %out_bool, %byte
|
|
152
|
+
EXPAND ASCII_IS_ALPHABETIC __ascii_alpha_%out_bool, %byte
|
|
153
|
+
EXPAND ASCII_IS_DIGIT __ascii_digit_%out_bool, %byte
|
|
154
|
+
%out_bool = or __ascii_alpha_%out_bool, __ascii_digit_%out_bool
|
|
155
|
+
!__ascii_alpha_%out_bool
|
|
156
|
+
!__ascii_digit_%out_bool
|
|
157
|
+
[END_MACRO]
|
|
158
|
+
|
|
159
|
+
[MACRO] ASCII_IS_PUNCTUATION %out_bool, %byte
|
|
160
|
+
__ascii_r1_ge_%out_bool = uge %byte, 33
|
|
161
|
+
__ascii_r1_le_%out_bool = ule %byte, 47
|
|
162
|
+
__ascii_r1_%out_bool = and __ascii_r1_ge_%out_bool, __ascii_r1_le_%out_bool
|
|
163
|
+
__ascii_r2_ge_%out_bool = uge %byte, 58
|
|
164
|
+
__ascii_r2_le_%out_bool = ule %byte, 64
|
|
165
|
+
__ascii_r2_%out_bool = and __ascii_r2_ge_%out_bool, __ascii_r2_le_%out_bool
|
|
166
|
+
__ascii_r3_ge_%out_bool = uge %byte, 91
|
|
167
|
+
__ascii_r3_le_%out_bool = ule %byte, 96
|
|
168
|
+
__ascii_r3_%out_bool = and __ascii_r3_ge_%out_bool, __ascii_r3_le_%out_bool
|
|
169
|
+
__ascii_r4_ge_%out_bool = uge %byte, 123
|
|
170
|
+
__ascii_r4_le_%out_bool = ule %byte, 126
|
|
171
|
+
__ascii_r4_%out_bool = and __ascii_r4_ge_%out_bool, __ascii_r4_le_%out_bool
|
|
172
|
+
__ascii_r12_%out_bool = or __ascii_r1_%out_bool, __ascii_r2_%out_bool
|
|
173
|
+
__ascii_r34_%out_bool = or __ascii_r3_%out_bool, __ascii_r4_%out_bool
|
|
174
|
+
%out_bool = or __ascii_r12_%out_bool, __ascii_r34_%out_bool
|
|
175
|
+
!__ascii_r1_ge_%out_bool
|
|
176
|
+
!__ascii_r1_le_%out_bool
|
|
177
|
+
!__ascii_r1_%out_bool
|
|
178
|
+
!__ascii_r2_ge_%out_bool
|
|
179
|
+
!__ascii_r2_le_%out_bool
|
|
180
|
+
!__ascii_r2_%out_bool
|
|
181
|
+
!__ascii_r3_ge_%out_bool
|
|
182
|
+
!__ascii_r3_le_%out_bool
|
|
183
|
+
!__ascii_r3_%out_bool
|
|
184
|
+
!__ascii_r4_ge_%out_bool
|
|
185
|
+
!__ascii_r4_le_%out_bool
|
|
186
|
+
!__ascii_r4_%out_bool
|
|
187
|
+
!__ascii_r12_%out_bool
|
|
188
|
+
!__ascii_r34_%out_bool
|
|
189
|
+
[END_MACRO]
|
|
190
|
+
|
|
191
|
+
[MACRO] ASCII_IS_GRAPHIC %out_bool, %byte
|
|
192
|
+
__ascii_ge_%out_bool = uge %byte, ASCII_GRAPHIC_MIN
|
|
193
|
+
__ascii_le_%out_bool = ule %byte, ASCII_GRAPHIC_MAX
|
|
194
|
+
%out_bool = and __ascii_ge_%out_bool, __ascii_le_%out_bool
|
|
195
|
+
!__ascii_ge_%out_bool
|
|
196
|
+
!__ascii_le_%out_bool
|
|
197
|
+
[END_MACRO]
|
|
198
|
+
|
|
199
|
+
[MACRO] ASCII_IS_WHITESPACE %out_bool, %byte
|
|
200
|
+
__ascii_tab_%out_bool = eq %byte, ASCII_TAB
|
|
201
|
+
__ascii_lf_%out_bool = eq %byte, ASCII_LF
|
|
202
|
+
__ascii_ff_%out_bool = eq %byte, ASCII_FF
|
|
203
|
+
__ascii_cr_%out_bool = eq %byte, ASCII_CR
|
|
204
|
+
__ascii_space_%out_bool = eq %byte, ASCII_SPACE
|
|
205
|
+
__ascii_tl_%out_bool = or __ascii_tab_%out_bool, __ascii_lf_%out_bool
|
|
206
|
+
__ascii_fc_%out_bool = or __ascii_ff_%out_bool, __ascii_cr_%out_bool
|
|
207
|
+
__ascii_control_space_%out_bool = or __ascii_tl_%out_bool, __ascii_fc_%out_bool
|
|
208
|
+
%out_bool = or __ascii_control_space_%out_bool, __ascii_space_%out_bool
|
|
209
|
+
!__ascii_tab_%out_bool
|
|
210
|
+
!__ascii_lf_%out_bool
|
|
211
|
+
!__ascii_ff_%out_bool
|
|
212
|
+
!__ascii_cr_%out_bool
|
|
213
|
+
!__ascii_space_%out_bool
|
|
214
|
+
!__ascii_tl_%out_bool
|
|
215
|
+
!__ascii_fc_%out_bool
|
|
216
|
+
!__ascii_control_space_%out_bool
|
|
217
|
+
[END_MACRO]
|
|
218
|
+
|
|
219
|
+
[MACRO] ASCII_IS_CONTROL %out_bool, %byte
|
|
220
|
+
__ascii_low_control_%out_bool = ule %byte, 31
|
|
221
|
+
__ascii_delete_%out_bool = eq %byte, ASCII_DELETE
|
|
222
|
+
%out_bool = or __ascii_low_control_%out_bool, __ascii_delete_%out_bool
|
|
223
|
+
!__ascii_low_control_%out_bool
|
|
224
|
+
!__ascii_delete_%out_bool
|
|
225
|
+
[END_MACRO]
|
|
226
|
+
|
|
227
|
+
[MACRO] ASCII_TO_UPPERCASE %out_byte, %byte
|
|
228
|
+
EXPAND ASCII_IS_LOWERCASE __ascii_lower_%out_byte, %byte
|
|
229
|
+
br __ascii_lower_%out_byte -> L_ASCII_TO_UPPERCASE_LOWER_%out_byte, L_ASCII_TO_UPPERCASE_KEEP_%out_byte
|
|
230
|
+
|
|
231
|
+
L_ASCII_TO_UPPERCASE_LOWER_%out_byte:
|
|
232
|
+
%out_byte = sub %byte, ASCII_CASE_MASK
|
|
233
|
+
!__ascii_lower_%out_byte
|
|
234
|
+
jmp L_ASCII_TO_UPPERCASE_END_%out_byte
|
|
235
|
+
|
|
236
|
+
L_ASCII_TO_UPPERCASE_KEEP_%out_byte:
|
|
237
|
+
%out_byte = add %byte, 0
|
|
238
|
+
!__ascii_lower_%out_byte
|
|
239
|
+
|
|
240
|
+
L_ASCII_TO_UPPERCASE_END_%out_byte:
|
|
241
|
+
[END_MACRO]
|
|
242
|
+
|
|
243
|
+
[MACRO] ASCII_TO_LOWERCASE %out_byte, %byte
|
|
244
|
+
EXPAND ASCII_IS_UPPERCASE __ascii_upper_%out_byte, %byte
|
|
245
|
+
br __ascii_upper_%out_byte -> L_ASCII_TO_LOWERCASE_UPPER_%out_byte, L_ASCII_TO_LOWERCASE_KEEP_%out_byte
|
|
246
|
+
|
|
247
|
+
L_ASCII_TO_LOWERCASE_UPPER_%out_byte:
|
|
248
|
+
%out_byte = add %byte, ASCII_CASE_MASK
|
|
249
|
+
!__ascii_upper_%out_byte
|
|
250
|
+
jmp L_ASCII_TO_LOWERCASE_END_%out_byte
|
|
251
|
+
|
|
252
|
+
L_ASCII_TO_LOWERCASE_KEEP_%out_byte:
|
|
253
|
+
%out_byte = add %byte, 0
|
|
254
|
+
!__ascii_upper_%out_byte
|
|
255
|
+
|
|
256
|
+
L_ASCII_TO_LOWERCASE_END_%out_byte:
|
|
257
|
+
[END_MACRO]
|
|
258
|
+
|
|
259
|
+
[MACRO] ASCII_EQ_IGNORE_CASE %out_bool, %left_byte, %right_byte
|
|
260
|
+
EXPAND ASCII_TO_LOWERCASE __ascii_left_%out_bool, %left_byte
|
|
261
|
+
EXPAND ASCII_TO_LOWERCASE __ascii_right_%out_bool, %right_byte
|
|
262
|
+
%out_bool = eq __ascii_left_%out_bool, __ascii_right_%out_bool
|
|
263
|
+
!__ascii_left_%out_bool
|
|
264
|
+
!__ascii_right_%out_bool
|
|
265
|
+
[END_MACRO]
|
|
266
|
+
|
|
267
|
+
[MACRO] ASCII_BYTE_MAKE_UPPERCASE %out_ok, %byte_ptr
|
|
268
|
+
__ascii_byte_%out_ok = load %byte_ptr+0 as u8
|
|
269
|
+
EXPAND ASCII_TO_UPPERCASE __ascii_upper_%out_ok, __ascii_byte_%out_ok
|
|
270
|
+
store %byte_ptr+0, __ascii_upper_%out_ok as u8
|
|
271
|
+
%out_ok = add 0, 1
|
|
272
|
+
!__ascii_upper_%out_ok
|
|
273
|
+
!__ascii_byte_%out_ok
|
|
274
|
+
[END_MACRO]
|
|
275
|
+
|
|
276
|
+
[MACRO] ASCII_BYTE_MAKE_LOWERCASE %out_ok, %byte_ptr
|
|
277
|
+
__ascii_byte_%out_ok = load %byte_ptr+0 as u8
|
|
278
|
+
EXPAND ASCII_TO_LOWERCASE __ascii_lower_%out_ok, __ascii_byte_%out_ok
|
|
279
|
+
store %byte_ptr+0, __ascii_lower_%out_ok as u8
|
|
280
|
+
%out_ok = add 0, 1
|
|
281
|
+
!__ascii_lower_%out_ok
|
|
282
|
+
!__ascii_byte_%out_ok
|
|
283
|
+
[END_MACRO]
|
|
284
|
+
|
|
285
|
+
[MACRO] ASCII_SLICE_MAKE_UPPERCASE %out_ok, %slice_reg
|
|
286
|
+
__ascii_ptr_%out_ok = load %slice_reg+Slice_ptr as ptr
|
|
287
|
+
__ascii_len_%out_ok = load %slice_reg+Slice_len as u64
|
|
288
|
+
__ascii_idx_slot_%out_ok = stack_alloc 8
|
|
289
|
+
store __ascii_idx_slot_%out_ok+0, 0 as u64
|
|
290
|
+
jmp L_ASCII_SLICE_UPPER_HEAD_%out_ok
|
|
291
|
+
|
|
292
|
+
L_ASCII_SLICE_UPPER_HEAD_%out_ok:
|
|
293
|
+
__ascii_idx_%out_ok = load __ascii_idx_slot_%out_ok+0 as u64
|
|
294
|
+
__ascii_done_%out_ok = eq __ascii_idx_%out_ok, __ascii_len_%out_ok
|
|
295
|
+
br __ascii_done_%out_ok -> L_ASCII_SLICE_UPPER_DONE_%out_ok, L_ASCII_SLICE_UPPER_BODY_%out_ok
|
|
296
|
+
|
|
297
|
+
L_ASCII_SLICE_UPPER_BODY_%out_ok:
|
|
298
|
+
__ascii_byte_ptr_%out_ok = ptr_add __ascii_ptr_%out_ok, __ascii_idx_%out_ok
|
|
299
|
+
__ascii_byte_%out_ok = load __ascii_byte_ptr_%out_ok+0 as u8
|
|
300
|
+
EXPAND ASCII_TO_UPPERCASE __ascii_upper_%out_ok, __ascii_byte_%out_ok
|
|
301
|
+
store __ascii_byte_ptr_%out_ok+0, __ascii_upper_%out_ok as u8
|
|
302
|
+
__ascii_next_%out_ok = add __ascii_idx_%out_ok, 1
|
|
303
|
+
store __ascii_idx_slot_%out_ok+0, __ascii_next_%out_ok as u64
|
|
304
|
+
!__ascii_next_%out_ok
|
|
305
|
+
!__ascii_upper_%out_ok
|
|
306
|
+
!__ascii_byte_%out_ok
|
|
307
|
+
!__ascii_byte_ptr_%out_ok
|
|
308
|
+
!__ascii_done_%out_ok
|
|
309
|
+
!__ascii_idx_%out_ok
|
|
310
|
+
jmp L_ASCII_SLICE_UPPER_HEAD_%out_ok
|
|
311
|
+
|
|
312
|
+
L_ASCII_SLICE_UPPER_DONE_%out_ok:
|
|
313
|
+
%out_ok = add 0, 1
|
|
314
|
+
!__ascii_done_%out_ok
|
|
315
|
+
!__ascii_idx_%out_ok
|
|
316
|
+
!__ascii_len_%out_ok
|
|
317
|
+
!__ascii_ptr_%out_ok
|
|
318
|
+
[END_MACRO]
|
|
319
|
+
|
|
320
|
+
[MACRO] ASCII_SLICE_MAKE_LOWERCASE %out_ok, %slice_reg
|
|
321
|
+
__ascii_ptr_%out_ok = load %slice_reg+Slice_ptr as ptr
|
|
322
|
+
__ascii_len_%out_ok = load %slice_reg+Slice_len as u64
|
|
323
|
+
__ascii_idx_slot_%out_ok = stack_alloc 8
|
|
324
|
+
store __ascii_idx_slot_%out_ok+0, 0 as u64
|
|
325
|
+
jmp L_ASCII_SLICE_LOWER_HEAD_%out_ok
|
|
326
|
+
|
|
327
|
+
L_ASCII_SLICE_LOWER_HEAD_%out_ok:
|
|
328
|
+
__ascii_idx_%out_ok = load __ascii_idx_slot_%out_ok+0 as u64
|
|
329
|
+
__ascii_done_%out_ok = eq __ascii_idx_%out_ok, __ascii_len_%out_ok
|
|
330
|
+
br __ascii_done_%out_ok -> L_ASCII_SLICE_LOWER_DONE_%out_ok, L_ASCII_SLICE_LOWER_BODY_%out_ok
|
|
331
|
+
|
|
332
|
+
L_ASCII_SLICE_LOWER_BODY_%out_ok:
|
|
333
|
+
__ascii_byte_ptr_%out_ok = ptr_add __ascii_ptr_%out_ok, __ascii_idx_%out_ok
|
|
334
|
+
__ascii_byte_%out_ok = load __ascii_byte_ptr_%out_ok+0 as u8
|
|
335
|
+
EXPAND ASCII_TO_LOWERCASE __ascii_lower_%out_ok, __ascii_byte_%out_ok
|
|
336
|
+
store __ascii_byte_ptr_%out_ok+0, __ascii_lower_%out_ok as u8
|
|
337
|
+
__ascii_next_%out_ok = add __ascii_idx_%out_ok, 1
|
|
338
|
+
store __ascii_idx_slot_%out_ok+0, __ascii_next_%out_ok as u64
|
|
339
|
+
!__ascii_next_%out_ok
|
|
340
|
+
!__ascii_lower_%out_ok
|
|
341
|
+
!__ascii_byte_%out_ok
|
|
342
|
+
!__ascii_byte_ptr_%out_ok
|
|
343
|
+
!__ascii_done_%out_ok
|
|
344
|
+
!__ascii_idx_%out_ok
|
|
345
|
+
jmp L_ASCII_SLICE_LOWER_HEAD_%out_ok
|
|
346
|
+
|
|
347
|
+
L_ASCII_SLICE_LOWER_DONE_%out_ok:
|
|
348
|
+
%out_ok = add 0, 1
|
|
349
|
+
!__ascii_done_%out_ok
|
|
350
|
+
!__ascii_idx_%out_ok
|
|
351
|
+
!__ascii_len_%out_ok
|
|
352
|
+
!__ascii_ptr_%out_ok
|
|
353
|
+
[END_MACRO]
|
|
354
|
+
|
|
355
|
+
[MACRO] ASCII_SLICE_EQ_IGNORE_CASE %out_bool, %left_slice, %right_slice
|
|
356
|
+
__ascii_left_ptr_%out_bool = load %left_slice+Slice_ptr as ptr
|
|
357
|
+
__ascii_right_ptr_%out_bool = load %right_slice+Slice_ptr as ptr
|
|
358
|
+
__ascii_left_len_%out_bool = load %left_slice+Slice_len as u64
|
|
359
|
+
__ascii_right_len_%out_bool = load %right_slice+Slice_len as u64
|
|
360
|
+
__ascii_same_len_%out_bool = eq __ascii_left_len_%out_bool, __ascii_right_len_%out_bool
|
|
361
|
+
br __ascii_same_len_%out_bool -> L_ASCII_SLICE_EQ_INIT_%out_bool, L_ASCII_SLICE_EQ_FALSE_LEN_%out_bool
|
|
362
|
+
|
|
363
|
+
L_ASCII_SLICE_EQ_INIT_%out_bool:
|
|
364
|
+
__ascii_idx_slot_%out_bool = stack_alloc 8
|
|
365
|
+
store __ascii_idx_slot_%out_bool+0, 0 as u64
|
|
366
|
+
jmp L_ASCII_SLICE_EQ_HEAD_%out_bool
|
|
367
|
+
|
|
368
|
+
L_ASCII_SLICE_EQ_HEAD_%out_bool:
|
|
369
|
+
__ascii_idx_%out_bool = load __ascii_idx_slot_%out_bool+0 as u64
|
|
370
|
+
__ascii_done_%out_bool = eq __ascii_idx_%out_bool, __ascii_left_len_%out_bool
|
|
371
|
+
br __ascii_done_%out_bool -> L_ASCII_SLICE_EQ_TRUE_%out_bool, L_ASCII_SLICE_EQ_BODY_%out_bool
|
|
372
|
+
|
|
373
|
+
L_ASCII_SLICE_EQ_BODY_%out_bool:
|
|
374
|
+
__ascii_left_byte_ptr_%out_bool = ptr_add __ascii_left_ptr_%out_bool, __ascii_idx_%out_bool
|
|
375
|
+
__ascii_right_byte_ptr_%out_bool = ptr_add __ascii_right_ptr_%out_bool, __ascii_idx_%out_bool
|
|
376
|
+
__ascii_left_byte_%out_bool = load __ascii_left_byte_ptr_%out_bool+0 as u8
|
|
377
|
+
__ascii_right_byte_%out_bool = load __ascii_right_byte_ptr_%out_bool+0 as u8
|
|
378
|
+
EXPAND ASCII_EQ_IGNORE_CASE __ascii_eq_%out_bool, __ascii_left_byte_%out_bool, __ascii_right_byte_%out_bool
|
|
379
|
+
br __ascii_eq_%out_bool -> L_ASCII_SLICE_EQ_NEXT_%out_bool, L_ASCII_SLICE_EQ_FALSE_BYTE_%out_bool
|
|
380
|
+
|
|
381
|
+
L_ASCII_SLICE_EQ_NEXT_%out_bool:
|
|
382
|
+
__ascii_next_%out_bool = add __ascii_idx_%out_bool, 1
|
|
383
|
+
store __ascii_idx_slot_%out_bool+0, __ascii_next_%out_bool as u64
|
|
384
|
+
!__ascii_next_%out_bool
|
|
385
|
+
!__ascii_eq_%out_bool
|
|
386
|
+
!__ascii_right_byte_%out_bool
|
|
387
|
+
!__ascii_left_byte_%out_bool
|
|
388
|
+
!__ascii_right_byte_ptr_%out_bool
|
|
389
|
+
!__ascii_left_byte_ptr_%out_bool
|
|
390
|
+
!__ascii_done_%out_bool
|
|
391
|
+
!__ascii_idx_%out_bool
|
|
392
|
+
jmp L_ASCII_SLICE_EQ_HEAD_%out_bool
|
|
393
|
+
|
|
394
|
+
L_ASCII_SLICE_EQ_TRUE_%out_bool:
|
|
395
|
+
%out_bool = add 0, 1
|
|
396
|
+
!__ascii_done_%out_bool
|
|
397
|
+
!__ascii_idx_%out_bool
|
|
398
|
+
!__ascii_same_len_%out_bool
|
|
399
|
+
!__ascii_right_len_%out_bool
|
|
400
|
+
!__ascii_left_len_%out_bool
|
|
401
|
+
!__ascii_right_ptr_%out_bool
|
|
402
|
+
!__ascii_left_ptr_%out_bool
|
|
403
|
+
jmp L_ASCII_SLICE_EQ_END_%out_bool
|
|
404
|
+
|
|
405
|
+
L_ASCII_SLICE_EQ_FALSE_BYTE_%out_bool:
|
|
406
|
+
%out_bool = add 0, 0
|
|
407
|
+
!__ascii_eq_%out_bool
|
|
408
|
+
!__ascii_right_byte_%out_bool
|
|
409
|
+
!__ascii_left_byte_%out_bool
|
|
410
|
+
!__ascii_right_byte_ptr_%out_bool
|
|
411
|
+
!__ascii_left_byte_ptr_%out_bool
|
|
412
|
+
!__ascii_done_%out_bool
|
|
413
|
+
!__ascii_idx_%out_bool
|
|
414
|
+
!__ascii_same_len_%out_bool
|
|
415
|
+
!__ascii_right_len_%out_bool
|
|
416
|
+
!__ascii_left_len_%out_bool
|
|
417
|
+
!__ascii_right_ptr_%out_bool
|
|
418
|
+
!__ascii_left_ptr_%out_bool
|
|
419
|
+
jmp L_ASCII_SLICE_EQ_END_%out_bool
|
|
420
|
+
|
|
421
|
+
L_ASCII_SLICE_EQ_FALSE_LEN_%out_bool:
|
|
422
|
+
%out_bool = add 0, 0
|
|
423
|
+
!__ascii_same_len_%out_bool
|
|
424
|
+
!__ascii_right_len_%out_bool
|
|
425
|
+
!__ascii_left_len_%out_bool
|
|
426
|
+
!__ascii_right_ptr_%out_bool
|
|
427
|
+
!__ascii_left_ptr_%out_bool
|
|
428
|
+
|
|
429
|
+
L_ASCII_SLICE_EQ_END_%out_bool:
|
|
430
|
+
[END_MACRO]
|
|
431
|
+
|
|
432
|
+
[MACRO] ASCII_CHAR_FROM_U8 %out_ok, %char_ptr, %byte
|
|
433
|
+
EXPAND ASCII_IS_ASCII %out_ok, %byte
|
|
434
|
+
store %char_ptr+AsciiChar_value, %byte as u8
|
|
435
|
+
[END_MACRO]
|
|
436
|
+
|
|
437
|
+
[MACRO] ASCII_CHAR_FROM_U8_UNCHECKED %char_ptr, %byte
|
|
438
|
+
store %char_ptr+AsciiChar_value, %byte as u8
|
|
439
|
+
[END_MACRO]
|
|
440
|
+
|
|
441
|
+
[MACRO] ASCII_CHAR_DIGIT %out_ok, %char_ptr, %digit
|
|
442
|
+
__ascii_char_digit_ok_%out_ok = ult %digit, 10
|
|
443
|
+
%out_ok = add __ascii_char_digit_ok_%out_ok, 0
|
|
444
|
+
__ascii_char_digit_byte_%out_ok = add ASCII_DIGIT_0, %digit
|
|
445
|
+
store %char_ptr+AsciiChar_value, __ascii_char_digit_byte_%out_ok as u8
|
|
446
|
+
!__ascii_char_digit_byte_%out_ok
|
|
447
|
+
!__ascii_char_digit_ok_%out_ok
|
|
448
|
+
[END_MACRO]
|
|
449
|
+
|
|
450
|
+
[MACRO] ASCII_CHAR_DIGIT_UNCHECKED %char_ptr, %digit
|
|
451
|
+
__ascii_char_digit_byte_%char_ptr = add ASCII_DIGIT_0, %digit
|
|
452
|
+
store %char_ptr+AsciiChar_value, __ascii_char_digit_byte_%char_ptr as u8
|
|
453
|
+
!__ascii_char_digit_byte_%char_ptr
|
|
454
|
+
[END_MACRO]
|
|
455
|
+
|
|
456
|
+
[MACRO] ASCII_CHAR_TO_U8 %out_byte, %char_ptr
|
|
457
|
+
%out_byte = load %char_ptr+AsciiChar_value as u8
|
|
458
|
+
[END_MACRO]
|
|
459
|
+
|
|
460
|
+
[MACRO] ASCII_CHAR_TO_CHAR %out_scalar, %char_ptr
|
|
461
|
+
%out_scalar = load %char_ptr+AsciiChar_value as u8
|
|
462
|
+
[END_MACRO]
|
|
463
|
+
|
|
464
|
+
[MACRO] ASCII_CHAR_AS_BYTES %out_slice, %char_ptr
|
|
465
|
+
store %out_slice+Slice_ptr, %char_ptr as ptr
|
|
466
|
+
store %out_slice+Slice_len, 1 as u64
|
|
467
|
+
[END_MACRO]
|
|
468
|
+
|
|
469
|
+
[MACRO] ASCII_CHAR_TO_UPPERCASE %out_char_ptr, %char_ptr
|
|
470
|
+
__ascii_char_byte_%out_char_ptr = load %char_ptr+AsciiChar_value as u8
|
|
471
|
+
EXPAND ASCII_TO_UPPERCASE __ascii_char_upper_%out_char_ptr, __ascii_char_byte_%out_char_ptr
|
|
472
|
+
store %out_char_ptr+AsciiChar_value, __ascii_char_upper_%out_char_ptr as u8
|
|
473
|
+
!__ascii_char_upper_%out_char_ptr
|
|
474
|
+
!__ascii_char_byte_%out_char_ptr
|
|
475
|
+
[END_MACRO]
|
|
476
|
+
|
|
477
|
+
[MACRO] ASCII_CHAR_TO_LOWERCASE %out_char_ptr, %char_ptr
|
|
478
|
+
__ascii_char_byte_%out_char_ptr = load %char_ptr+AsciiChar_value as u8
|
|
479
|
+
EXPAND ASCII_TO_LOWERCASE __ascii_char_lower_%out_char_ptr, __ascii_char_byte_%out_char_ptr
|
|
480
|
+
store %out_char_ptr+AsciiChar_value, __ascii_char_lower_%out_char_ptr as u8
|
|
481
|
+
!__ascii_char_lower_%out_char_ptr
|
|
482
|
+
!__ascii_char_byte_%out_char_ptr
|
|
483
|
+
[END_MACRO]
|
|
484
|
+
|
|
485
|
+
[MACRO] ASCII_CHAR_MAKE_UPPERCASE %char_ptr
|
|
486
|
+
EXPAND ASCII_CHAR_TO_UPPERCASE %char_ptr, %char_ptr
|
|
487
|
+
[END_MACRO]
|
|
488
|
+
|
|
489
|
+
[MACRO] ASCII_CHAR_MAKE_LOWERCASE %char_ptr
|
|
490
|
+
EXPAND ASCII_CHAR_TO_LOWERCASE %char_ptr, %char_ptr
|
|
491
|
+
[END_MACRO]
|
|
492
|
+
|
|
493
|
+
[MACRO] ASCII_CHAR_EQ_IGNORE_CASE %out_bool, %left_char, %right_char
|
|
494
|
+
__ascii_char_left_%out_bool = load %left_char+AsciiChar_value as u8
|
|
495
|
+
__ascii_char_right_%out_bool = load %right_char+AsciiChar_value as u8
|
|
496
|
+
EXPAND ASCII_EQ_IGNORE_CASE %out_bool, __ascii_char_left_%out_bool, __ascii_char_right_%out_bool
|
|
497
|
+
!__ascii_char_right_%out_bool
|
|
498
|
+
!__ascii_char_left_%out_bool
|
|
499
|
+
[END_MACRO]
|
|
500
|
+
|
|
501
|
+
[MACRO] ASCII_CHAR_IS_ALPHABETIC %out_bool, %char_ptr
|
|
502
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
503
|
+
EXPAND ASCII_IS_ALPHABETIC %out_bool, __ascii_char_byte_%out_bool
|
|
504
|
+
!__ascii_char_byte_%out_bool
|
|
505
|
+
[END_MACRO]
|
|
506
|
+
|
|
507
|
+
[MACRO] ASCII_CHAR_IS_UPPERCASE %out_bool, %char_ptr
|
|
508
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
509
|
+
EXPAND ASCII_IS_UPPERCASE %out_bool, __ascii_char_byte_%out_bool
|
|
510
|
+
!__ascii_char_byte_%out_bool
|
|
511
|
+
[END_MACRO]
|
|
512
|
+
|
|
513
|
+
[MACRO] ASCII_CHAR_IS_LOWERCASE %out_bool, %char_ptr
|
|
514
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
515
|
+
EXPAND ASCII_IS_LOWERCASE %out_bool, __ascii_char_byte_%out_bool
|
|
516
|
+
!__ascii_char_byte_%out_bool
|
|
517
|
+
[END_MACRO]
|
|
518
|
+
|
|
519
|
+
[MACRO] ASCII_CHAR_IS_ALPHANUMERIC %out_bool, %char_ptr
|
|
520
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
521
|
+
EXPAND ASCII_IS_ALPHANUMERIC %out_bool, __ascii_char_byte_%out_bool
|
|
522
|
+
!__ascii_char_byte_%out_bool
|
|
523
|
+
[END_MACRO]
|
|
524
|
+
|
|
525
|
+
[MACRO] ASCII_CHAR_IS_DIGIT %out_bool, %char_ptr
|
|
526
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
527
|
+
EXPAND ASCII_IS_DIGIT %out_bool, __ascii_char_byte_%out_bool
|
|
528
|
+
!__ascii_char_byte_%out_bool
|
|
529
|
+
[END_MACRO]
|
|
530
|
+
|
|
531
|
+
[MACRO] ASCII_CHAR_IS_OCTDIGIT %out_bool, %char_ptr
|
|
532
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
533
|
+
EXPAND ASCII_IS_OCTDIGIT %out_bool, __ascii_char_byte_%out_bool
|
|
534
|
+
!__ascii_char_byte_%out_bool
|
|
535
|
+
[END_MACRO]
|
|
536
|
+
|
|
537
|
+
[MACRO] ASCII_CHAR_IS_HEXDIGIT %out_bool, %char_ptr
|
|
538
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
539
|
+
EXPAND ASCII_IS_HEXDIGIT %out_bool, __ascii_char_byte_%out_bool
|
|
540
|
+
!__ascii_char_byte_%out_bool
|
|
541
|
+
[END_MACRO]
|
|
542
|
+
|
|
543
|
+
[MACRO] ASCII_CHAR_IS_PUNCTUATION %out_bool, %char_ptr
|
|
544
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
545
|
+
EXPAND ASCII_IS_PUNCTUATION %out_bool, __ascii_char_byte_%out_bool
|
|
546
|
+
!__ascii_char_byte_%out_bool
|
|
547
|
+
[END_MACRO]
|
|
548
|
+
|
|
549
|
+
[MACRO] ASCII_CHAR_IS_GRAPHIC %out_bool, %char_ptr
|
|
550
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
551
|
+
EXPAND ASCII_IS_GRAPHIC %out_bool, __ascii_char_byte_%out_bool
|
|
552
|
+
!__ascii_char_byte_%out_bool
|
|
553
|
+
[END_MACRO]
|
|
554
|
+
|
|
555
|
+
[MACRO] ASCII_CHAR_IS_WHITESPACE %out_bool, %char_ptr
|
|
556
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
557
|
+
EXPAND ASCII_IS_WHITESPACE %out_bool, __ascii_char_byte_%out_bool
|
|
558
|
+
!__ascii_char_byte_%out_bool
|
|
559
|
+
[END_MACRO]
|
|
560
|
+
|
|
561
|
+
[MACRO] ASCII_CHAR_IS_CONTROL %out_bool, %char_ptr
|
|
562
|
+
__ascii_char_byte_%out_bool = load %char_ptr+AsciiChar_value as u8
|
|
563
|
+
EXPAND ASCII_IS_CONTROL %out_bool, __ascii_char_byte_%out_bool
|
|
564
|
+
!__ascii_char_byte_%out_bool
|
|
565
|
+
[END_MACRO]
|
|
566
|
+
|
|
567
|
+
[MACRO] ASCII_CHAR_ESCAPE_DEFAULT_WRITE %out_ok, %out_len, %dst_ptr, %dst_len, %char_ptr
|
|
568
|
+
__ascii_char_escape_byte_%out_ok = load %char_ptr+AsciiChar_value as u8
|
|
569
|
+
EXPAND ASCII_ESCAPE_DEFAULT_WRITE %out_ok, %out_len, %dst_ptr, %dst_len, __ascii_char_escape_byte_%out_ok
|
|
570
|
+
!__ascii_char_escape_byte_%out_ok
|
|
571
|
+
[END_MACRO]
|
|
572
|
+
|
|
573
|
+
[MACRO] ASCII_NIBBLE_TO_LOWER_HEX %out_byte, %nibble
|
|
574
|
+
__ascii_hex_digit_%out_byte = ult %nibble, 10
|
|
575
|
+
br __ascii_hex_digit_%out_byte -> L_ASCII_HEX_DIGIT_%out_byte, L_ASCII_HEX_ALPHA_%out_byte
|
|
576
|
+
L_ASCII_HEX_DIGIT_%out_byte:
|
|
577
|
+
%out_byte = add ASCII_DIGIT_0, %nibble
|
|
578
|
+
!__ascii_hex_digit_%out_byte
|
|
579
|
+
jmp L_ASCII_HEX_END_%out_byte
|
|
580
|
+
L_ASCII_HEX_ALPHA_%out_byte:
|
|
581
|
+
__ascii_hex_alpha_base_%out_byte = sub %nibble, 10
|
|
582
|
+
%out_byte = add ASCII_LOWER_A, __ascii_hex_alpha_base_%out_byte
|
|
583
|
+
!__ascii_hex_alpha_base_%out_byte
|
|
584
|
+
!__ascii_hex_digit_%out_byte
|
|
585
|
+
L_ASCII_HEX_END_%out_byte:
|
|
586
|
+
[END_MACRO]
|
|
587
|
+
|
|
588
|
+
[MACRO] ASCII_ESCAPE_DEFAULT_WRITE %out_ok, %out_len, %dst_ptr, %dst_len, %byte
|
|
589
|
+
__ascii_escape_pair_slot_%out_ok = stack_alloc 8
|
|
590
|
+
__ascii_escape_is_tab_%out_ok = eq %byte, ASCII_TAB
|
|
591
|
+
br __ascii_escape_is_tab_%out_ok -> L_ASCII_ESCAPE_TAB_%out_ok, L_ASCII_ESCAPE_CHECK_LF_%out_ok
|
|
592
|
+
|
|
593
|
+
L_ASCII_ESCAPE_CHECK_LF_%out_ok:
|
|
594
|
+
__ascii_escape_is_lf_%out_ok = eq %byte, ASCII_LF
|
|
595
|
+
br __ascii_escape_is_lf_%out_ok -> L_ASCII_ESCAPE_LF_%out_ok, L_ASCII_ESCAPE_CHECK_CR_%out_ok
|
|
596
|
+
|
|
597
|
+
L_ASCII_ESCAPE_CHECK_CR_%out_ok:
|
|
598
|
+
__ascii_escape_is_cr_%out_ok = eq %byte, ASCII_CR
|
|
599
|
+
br __ascii_escape_is_cr_%out_ok -> L_ASCII_ESCAPE_CR_%out_ok, L_ASCII_ESCAPE_CHECK_BACKSLASH_%out_ok
|
|
600
|
+
|
|
601
|
+
L_ASCII_ESCAPE_CHECK_BACKSLASH_%out_ok:
|
|
602
|
+
__ascii_escape_is_backslash_%out_ok = eq %byte, ASCII_BACKSLASH
|
|
603
|
+
br __ascii_escape_is_backslash_%out_ok -> L_ASCII_ESCAPE_BACKSLASH_%out_ok, L_ASCII_ESCAPE_CHECK_SINGLE_%out_ok
|
|
604
|
+
|
|
605
|
+
L_ASCII_ESCAPE_CHECK_SINGLE_%out_ok:
|
|
606
|
+
__ascii_escape_is_single_%out_ok = eq %byte, ASCII_SINGLE_QUOTE
|
|
607
|
+
br __ascii_escape_is_single_%out_ok -> L_ASCII_ESCAPE_SINGLE_%out_ok, L_ASCII_ESCAPE_CHECK_DOUBLE_%out_ok
|
|
608
|
+
|
|
609
|
+
L_ASCII_ESCAPE_CHECK_DOUBLE_%out_ok:
|
|
610
|
+
__ascii_escape_is_double_%out_ok = eq %byte, ASCII_DOUBLE_QUOTE
|
|
611
|
+
br __ascii_escape_is_double_%out_ok -> L_ASCII_ESCAPE_DOUBLE_%out_ok, L_ASCII_ESCAPE_CHECK_PRINTABLE_%out_ok
|
|
612
|
+
|
|
613
|
+
L_ASCII_ESCAPE_CHECK_PRINTABLE_%out_ok:
|
|
614
|
+
__ascii_escape_ge_space_%out_ok = uge %byte, ASCII_SPACE
|
|
615
|
+
__ascii_escape_le_tilde_%out_ok = ule %byte, ASCII_GRAPHIC_MAX
|
|
616
|
+
__ascii_escape_printable_%out_ok = and __ascii_escape_ge_space_%out_ok, __ascii_escape_le_tilde_%out_ok
|
|
617
|
+
br __ascii_escape_printable_%out_ok -> L_ASCII_ESCAPE_RAW_%out_ok, L_ASCII_ESCAPE_HEX_%out_ok
|
|
618
|
+
|
|
619
|
+
L_ASCII_ESCAPE_TAB_%out_ok:
|
|
620
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_ESCAPE_T as u8
|
|
621
|
+
!__ascii_escape_is_tab_%out_ok
|
|
622
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
623
|
+
|
|
624
|
+
L_ASCII_ESCAPE_LF_%out_ok:
|
|
625
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_ESCAPE_N as u8
|
|
626
|
+
!__ascii_escape_is_lf_%out_ok
|
|
627
|
+
!__ascii_escape_is_tab_%out_ok
|
|
628
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
629
|
+
|
|
630
|
+
L_ASCII_ESCAPE_CR_%out_ok:
|
|
631
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_ESCAPE_R as u8
|
|
632
|
+
!__ascii_escape_is_cr_%out_ok
|
|
633
|
+
!__ascii_escape_is_lf_%out_ok
|
|
634
|
+
!__ascii_escape_is_tab_%out_ok
|
|
635
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
636
|
+
|
|
637
|
+
L_ASCII_ESCAPE_BACKSLASH_%out_ok:
|
|
638
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_BACKSLASH as u8
|
|
639
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
640
|
+
!__ascii_escape_is_cr_%out_ok
|
|
641
|
+
!__ascii_escape_is_lf_%out_ok
|
|
642
|
+
!__ascii_escape_is_tab_%out_ok
|
|
643
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
644
|
+
|
|
645
|
+
L_ASCII_ESCAPE_SINGLE_%out_ok:
|
|
646
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_SINGLE_QUOTE as u8
|
|
647
|
+
!__ascii_escape_is_single_%out_ok
|
|
648
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
649
|
+
!__ascii_escape_is_cr_%out_ok
|
|
650
|
+
!__ascii_escape_is_lf_%out_ok
|
|
651
|
+
!__ascii_escape_is_tab_%out_ok
|
|
652
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
653
|
+
|
|
654
|
+
L_ASCII_ESCAPE_DOUBLE_%out_ok:
|
|
655
|
+
store __ascii_escape_pair_slot_%out_ok+0, ASCII_DOUBLE_QUOTE as u8
|
|
656
|
+
!__ascii_escape_is_double_%out_ok
|
|
657
|
+
!__ascii_escape_is_single_%out_ok
|
|
658
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
659
|
+
!__ascii_escape_is_cr_%out_ok
|
|
660
|
+
!__ascii_escape_is_lf_%out_ok
|
|
661
|
+
!__ascii_escape_is_tab_%out_ok
|
|
662
|
+
jmp L_ASCII_ESCAPE_PAIR_%out_ok
|
|
663
|
+
|
|
664
|
+
L_ASCII_ESCAPE_PAIR_%out_ok:
|
|
665
|
+
__ascii_pair_fits_%out_ok = uge %dst_len, 2
|
|
666
|
+
br __ascii_pair_fits_%out_ok -> L_ASCII_ESCAPE_PAIR_WRITE_%out_ok, L_ASCII_ESCAPE_PAIR_FAIL_%out_ok
|
|
667
|
+
L_ASCII_ESCAPE_PAIR_WRITE_%out_ok:
|
|
668
|
+
__ascii_pair_byte_%out_ok = load __ascii_escape_pair_slot_%out_ok+0 as u8
|
|
669
|
+
store %dst_ptr+0, ASCII_BACKSLASH as u8
|
|
670
|
+
__ascii_pair_p1_%out_ok = ptr_add %dst_ptr, 1
|
|
671
|
+
store __ascii_pair_p1_%out_ok+0, __ascii_pair_byte_%out_ok as u8
|
|
672
|
+
%out_len = add 0, 2
|
|
673
|
+
%out_ok = add 0, 1
|
|
674
|
+
!__ascii_pair_p1_%out_ok
|
|
675
|
+
!__ascii_pair_byte_%out_ok
|
|
676
|
+
!__ascii_pair_fits_%out_ok
|
|
677
|
+
jmp L_ASCII_ESCAPE_END_%out_ok
|
|
678
|
+
L_ASCII_ESCAPE_PAIR_FAIL_%out_ok:
|
|
679
|
+
%out_len = add 0, 0
|
|
680
|
+
%out_ok = add 0, 0
|
|
681
|
+
!__ascii_pair_fits_%out_ok
|
|
682
|
+
jmp L_ASCII_ESCAPE_END_%out_ok
|
|
683
|
+
|
|
684
|
+
L_ASCII_ESCAPE_RAW_%out_ok:
|
|
685
|
+
__ascii_escape_raw_fits_%out_ok = uge %dst_len, 1
|
|
686
|
+
br __ascii_escape_raw_fits_%out_ok -> L_ASCII_ESCAPE_RAW_WRITE_%out_ok, L_ASCII_ESCAPE_FAIL_RAW_%out_ok
|
|
687
|
+
L_ASCII_ESCAPE_RAW_WRITE_%out_ok:
|
|
688
|
+
store %dst_ptr+0, %byte as u8
|
|
689
|
+
%out_len = add 0, 1
|
|
690
|
+
%out_ok = add 0, 1
|
|
691
|
+
!__ascii_escape_raw_fits_%out_ok
|
|
692
|
+
!__ascii_escape_printable_%out_ok
|
|
693
|
+
!__ascii_escape_le_tilde_%out_ok
|
|
694
|
+
!__ascii_escape_ge_space_%out_ok
|
|
695
|
+
!__ascii_escape_is_double_%out_ok
|
|
696
|
+
!__ascii_escape_is_single_%out_ok
|
|
697
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
698
|
+
!__ascii_escape_is_cr_%out_ok
|
|
699
|
+
!__ascii_escape_is_lf_%out_ok
|
|
700
|
+
!__ascii_escape_is_tab_%out_ok
|
|
701
|
+
jmp L_ASCII_ESCAPE_END_%out_ok
|
|
702
|
+
L_ASCII_ESCAPE_FAIL_RAW_%out_ok:
|
|
703
|
+
%out_len = add 0, 0
|
|
704
|
+
%out_ok = add 0, 0
|
|
705
|
+
!__ascii_escape_raw_fits_%out_ok
|
|
706
|
+
!__ascii_escape_printable_%out_ok
|
|
707
|
+
!__ascii_escape_le_tilde_%out_ok
|
|
708
|
+
!__ascii_escape_ge_space_%out_ok
|
|
709
|
+
!__ascii_escape_is_double_%out_ok
|
|
710
|
+
!__ascii_escape_is_single_%out_ok
|
|
711
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
712
|
+
!__ascii_escape_is_cr_%out_ok
|
|
713
|
+
!__ascii_escape_is_lf_%out_ok
|
|
714
|
+
!__ascii_escape_is_tab_%out_ok
|
|
715
|
+
jmp L_ASCII_ESCAPE_END_%out_ok
|
|
716
|
+
|
|
717
|
+
L_ASCII_ESCAPE_HEX_%out_ok:
|
|
718
|
+
EXPAND ASCII_ESCAPE_DEFAULT_WRITE_HEX %out_ok, %out_len, %dst_ptr, %dst_len, %byte
|
|
719
|
+
!__ascii_escape_printable_%out_ok
|
|
720
|
+
!__ascii_escape_le_tilde_%out_ok
|
|
721
|
+
!__ascii_escape_ge_space_%out_ok
|
|
722
|
+
!__ascii_escape_is_double_%out_ok
|
|
723
|
+
!__ascii_escape_is_single_%out_ok
|
|
724
|
+
!__ascii_escape_is_backslash_%out_ok
|
|
725
|
+
!__ascii_escape_is_cr_%out_ok
|
|
726
|
+
!__ascii_escape_is_lf_%out_ok
|
|
727
|
+
!__ascii_escape_is_tab_%out_ok
|
|
728
|
+
|
|
729
|
+
L_ASCII_ESCAPE_END_%out_ok:
|
|
730
|
+
[END_MACRO]
|
|
731
|
+
|
|
732
|
+
[MACRO] ASCII_ESCAPE_DEFAULT_WRITE_PAIR %out_ok, %out_len, %dst_ptr, %dst_len, %escaped_byte
|
|
733
|
+
__ascii_pair_fits_%out_ok = uge %dst_len, 2
|
|
734
|
+
br __ascii_pair_fits_%out_ok -> L_ASCII_ESCAPE_PAIR_WRITE_%out_ok, L_ASCII_ESCAPE_PAIR_FAIL_%out_ok
|
|
735
|
+
L_ASCII_ESCAPE_PAIR_WRITE_%out_ok:
|
|
736
|
+
store %dst_ptr+0, ASCII_BACKSLASH as u8
|
|
737
|
+
__ascii_pair_p1_%out_ok = ptr_add %dst_ptr, 1
|
|
738
|
+
store __ascii_pair_p1_%out_ok+0, %escaped_byte as u8
|
|
739
|
+
%out_len = add 0, 2
|
|
740
|
+
%out_ok = add 0, 1
|
|
741
|
+
!__ascii_pair_p1_%out_ok
|
|
742
|
+
!__ascii_pair_fits_%out_ok
|
|
743
|
+
jmp L_ASCII_ESCAPE_PAIR_END_%out_ok
|
|
744
|
+
L_ASCII_ESCAPE_PAIR_FAIL_%out_ok:
|
|
745
|
+
%out_len = add 0, 0
|
|
746
|
+
%out_ok = add 0, 0
|
|
747
|
+
!__ascii_pair_fits_%out_ok
|
|
748
|
+
L_ASCII_ESCAPE_PAIR_END_%out_ok:
|
|
749
|
+
[END_MACRO]
|
|
750
|
+
|
|
751
|
+
[MACRO] ASCII_ESCAPE_DEFAULT_WRITE_HEX %out_ok, %out_len, %dst_ptr, %dst_len, %byte
|
|
752
|
+
__ascii_hex_fits_%out_ok = uge %dst_len, 4
|
|
753
|
+
br __ascii_hex_fits_%out_ok -> L_ASCII_ESCAPE_HEX_WRITE_%out_ok, L_ASCII_ESCAPE_HEX_FAIL_%out_ok
|
|
754
|
+
L_ASCII_ESCAPE_HEX_WRITE_%out_ok:
|
|
755
|
+
__ascii_hex_hi_raw_%out_ok = shr %byte, 4
|
|
756
|
+
__ascii_hex_hi_%out_ok = and __ascii_hex_hi_raw_%out_ok, 15
|
|
757
|
+
__ascii_hex_lo_%out_ok = and %byte, 15
|
|
758
|
+
EXPAND ASCII_NIBBLE_TO_LOWER_HEX __ascii_hex_hi_byte_%out_ok, __ascii_hex_hi_%out_ok
|
|
759
|
+
EXPAND ASCII_NIBBLE_TO_LOWER_HEX __ascii_hex_lo_byte_%out_ok, __ascii_hex_lo_%out_ok
|
|
760
|
+
store %dst_ptr+0, ASCII_BACKSLASH as u8
|
|
761
|
+
__ascii_hex_p1_%out_ok = ptr_add %dst_ptr, 1
|
|
762
|
+
__ascii_hex_p2_%out_ok = ptr_add %dst_ptr, 2
|
|
763
|
+
__ascii_hex_p3_%out_ok = ptr_add %dst_ptr, 3
|
|
764
|
+
store __ascii_hex_p1_%out_ok+0, ASCII_ESCAPE_X as u8
|
|
765
|
+
store __ascii_hex_p2_%out_ok+0, __ascii_hex_hi_byte_%out_ok as u8
|
|
766
|
+
store __ascii_hex_p3_%out_ok+0, __ascii_hex_lo_byte_%out_ok as u8
|
|
767
|
+
%out_len = add 0, 4
|
|
768
|
+
%out_ok = add 0, 1
|
|
769
|
+
!__ascii_hex_p3_%out_ok
|
|
770
|
+
!__ascii_hex_p2_%out_ok
|
|
771
|
+
!__ascii_hex_p1_%out_ok
|
|
772
|
+
!__ascii_hex_lo_byte_%out_ok
|
|
773
|
+
!__ascii_hex_hi_byte_%out_ok
|
|
774
|
+
!__ascii_hex_lo_%out_ok
|
|
775
|
+
!__ascii_hex_hi_%out_ok
|
|
776
|
+
!__ascii_hex_hi_raw_%out_ok
|
|
777
|
+
!__ascii_hex_fits_%out_ok
|
|
778
|
+
jmp L_ASCII_ESCAPE_HEX_END_%out_ok
|
|
779
|
+
L_ASCII_ESCAPE_HEX_FAIL_%out_ok:
|
|
780
|
+
%out_len = add 0, 0
|
|
781
|
+
%out_ok = add 0, 0
|
|
782
|
+
!__ascii_hex_fits_%out_ok
|
|
783
|
+
L_ASCII_ESCAPE_HEX_END_%out_ok:
|
|
784
|
+
[END_MACRO]
|