@agoric/xsnap 0.14.3-u14.0 → 0.14.3-u16.1
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/README.md +3 -3
- package/api.js +4 -2
- package/build.env +1 -1
- package/moddable/modules/data/base64/base64.js +28 -0
- package/moddable/modules/data/base64/manifest.json +11 -0
- package/moddable/modules/data/base64/modBase64.c +188 -0
- package/moddable/modules/data/binaryMessage/BinaryMessage.js +106 -0
- package/moddable/modules/data/crc/crc.c +205 -0
- package/moddable/modules/data/crc/crc.js +36 -0
- package/moddable/modules/data/crc/manifest.json +8 -0
- package/moddable/modules/data/hex/hex.js +28 -0
- package/moddable/modules/data/hex/manifest.json +11 -0
- package/moddable/modules/data/hex/modHex.c +139 -0
- package/moddable/modules/data/logical/logical.js +32 -0
- package/moddable/modules/data/logical/modLogical.c +98 -0
- package/moddable/modules/data/qrcode/manifest.json +9 -0
- package/moddable/modules/data/qrcode/qrcode.c +93 -0
- package/moddable/modules/data/qrcode/qrcode.js +23 -0
- package/moddable/modules/data/qrcode/qrcodegen.c +1025 -0
- package/moddable/modules/data/qrcode/qrcodegen.h +267 -0
- package/moddable/modules/data/text/decoder/manifest.json +8 -0
- package/moddable/modules/data/text/decoder/textdecoder.c +480 -0
- package/moddable/modules/data/text/decoder/textdecoder.js +27 -0
- package/moddable/modules/data/text/encoder/manifest.json +8 -0
- package/moddable/modules/data/text/encoder/textencoder.c +232 -0
- package/moddable/modules/data/text/encoder/textencoder.js +24 -0
- package/moddable/modules/data/tinyint/tinyint.c +150 -0
- package/moddable/modules/data/tinyint/tinyint.js +53 -0
- package/moddable/modules/data/url/manifest.json +17 -0
- package/moddable/modules/data/url/url.c +1959 -0
- package/moddable/modules/data/url/url.js +210 -0
- package/moddable/modules/data/wavreader/manifest.json +8 -0
- package/moddable/modules/data/wavreader/wavreader.js +128 -0
- package/moddable/modules/data/zlib/deflate.c +161 -0
- package/moddable/modules/data/zlib/deflate.js +63 -0
- package/moddable/modules/data/zlib/inflate.c +145 -0
- package/moddable/modules/data/zlib/inflate.js +66 -0
- package/moddable/modules/data/zlib/manifest_deflate.json +9 -0
- package/moddable/modules/data/zlib/manifest_inflate.json +9 -0
- package/moddable/modules/data/zlib/miniz.c +4924 -0
- package/moddable/xs/includes/xs.d.ts +73 -0
- package/moddable/xs/includes/xs.h +1533 -0
- package/moddable/xs/includes/xsmc.h +206 -0
- package/moddable/xs/makefiles/lin/makefile +33 -0
- package/moddable/xs/makefiles/lin/xsc.mk +118 -0
- package/moddable/xs/makefiles/lin/xsid.mk +90 -0
- package/moddable/xs/makefiles/lin/xsl.mk +168 -0
- package/moddable/xs/makefiles/lin/xst.mk +201 -0
- package/moddable/xs/makefiles/mac/makefile +33 -0
- package/moddable/xs/makefiles/mac/xsc.mk +130 -0
- package/moddable/xs/makefiles/mac/xsid.mk +102 -0
- package/moddable/xs/makefiles/mac/xsl.mk +177 -0
- package/moddable/xs/makefiles/mac/xst.mk +203 -0
- package/moddable/xs/makefiles/mac/xst_no_asan.txt +52 -0
- package/moddable/xs/makefiles/win/build.bat +26 -0
- package/moddable/xs/makefiles/win/xsc.mak +142 -0
- package/moddable/xs/makefiles/win/xsid.mak +113 -0
- package/moddable/xs/makefiles/win/xsl.mak +186 -0
- package/moddable/xs/makefiles/win/xst.mak +195 -0
- package/moddable/xs/platforms/lin_xs.h +99 -0
- package/moddable/xs/platforms/mac_xs.h +97 -0
- package/moddable/xs/platforms/wasm_xs.h +79 -0
- package/moddable/xs/platforms/win_xs.h +104 -0
- package/moddable/xs/platforms/xsHost.h +63 -0
- package/moddable/xs/platforms/xsPlatform.h +618 -0
- package/moddable/xs/sources/xsAPI.c +2555 -0
- package/moddable/xs/sources/xsAll.c +294 -0
- package/moddable/xs/sources/xsAll.h +2741 -0
- package/moddable/xs/sources/xsArguments.c +222 -0
- package/moddable/xs/sources/xsArray.c +2657 -0
- package/moddable/xs/sources/xsAtomics.c +844 -0
- package/moddable/xs/sources/xsBigInt.c +1859 -0
- package/moddable/xs/sources/xsBoolean.c +109 -0
- package/moddable/xs/sources/xsCode.c +4493 -0
- package/moddable/xs/sources/xsCommon.c +1710 -0
- package/moddable/xs/sources/xsCommon.h +1142 -0
- package/moddable/xs/sources/xsDataView.c +2890 -0
- package/moddable/xs/sources/xsDate.c +1541 -0
- package/moddable/xs/sources/xsDebug.c +2710 -0
- package/moddable/xs/sources/xsDefaults.c +134 -0
- package/moddable/xs/sources/xsError.c +353 -0
- package/moddable/xs/sources/xsFunction.c +776 -0
- package/moddable/xs/sources/xsGenerator.c +865 -0
- package/moddable/xs/sources/xsGlobal.c +839 -0
- package/moddable/xs/sources/xsJSON.c +1091 -0
- package/moddable/xs/sources/xsLexical.c +1969 -0
- package/moddable/xs/sources/xsLockdown.c +933 -0
- package/moddable/xs/sources/xsMapSet.c +1649 -0
- package/moddable/xs/sources/xsMarshall.c +1020 -0
- package/moddable/xs/sources/xsMath.c +624 -0
- package/moddable/xs/sources/xsMemory.c +1941 -0
- package/moddable/xs/sources/xsModule.c +3101 -0
- package/moddable/xs/sources/xsNumber.c +560 -0
- package/moddable/xs/sources/xsObject.c +1102 -0
- package/moddable/xs/sources/xsPlatforms.c +480 -0
- package/moddable/xs/sources/xsProfile.c +577 -0
- package/moddable/xs/sources/xsPromise.c +1199 -0
- package/moddable/xs/sources/xsProperty.c +636 -0
- package/moddable/xs/sources/xsProxy.c +1014 -0
- package/moddable/xs/sources/xsRegExp.c +1168 -0
- package/moddable/xs/sources/xsRun.c +4889 -0
- package/moddable/xs/sources/xsScope.c +1293 -0
- package/moddable/xs/sources/xsScript.c +288 -0
- package/moddable/xs/sources/xsScript.h +1186 -0
- package/moddable/xs/sources/xsSnapshot.c +2161 -0
- package/moddable/xs/sources/xsSnapshot.h +51 -0
- package/moddable/xs/sources/xsSourceMap.c +218 -0
- package/moddable/xs/sources/xsString.c +3332 -0
- package/moddable/xs/sources/xsSymbol.c +503 -0
- package/moddable/xs/sources/xsSyntaxical.c +4193 -0
- package/moddable/xs/sources/xsTree.c +1893 -0
- package/moddable/xs/sources/xsType.c +1488 -0
- package/moddable/xs/sources/xsdtoa.c +6672 -0
- package/moddable/xs/sources/xsmc.c +340 -0
- package/moddable/xs/sources/xsre.c +7578 -0
- package/package.json +37 -20
- package/scripts/get_xsnap_version.sh +14 -0
- package/scripts/test-package.sh +21 -0
- package/src/avaAssertXS.js +6 -2
- package/src/avaHandler.cjs +2 -5
- package/src/avaXS.js +7 -8
- package/src/build.js +161 -28
- package/src/replay.js +0 -3
- package/src/xsnap.js +105 -91
- package/src/xsrepl.js +2 -3
- package/xsnap-native/xsnap/makefiles/lin/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +156 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +144 -0
- package/xsnap-native/xsnap/makefiles/mac/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +165 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +153 -0
- package/xsnap-native/xsnap/sources/xsnap-worker.c +1008 -0
- package/xsnap-native/xsnap/sources/xsnap.c +717 -0
- package/xsnap-native/xsnap/sources/xsnap.h +142 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.c +1501 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.h +105 -0
- package/CHANGELOG.md +0 -654
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* QR Code generator library (C)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Project Nayuki. (MIT License)
|
|
5
|
+
* https://www.nayuki.io/page/qr-code-generator-library
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
8
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
9
|
+
* the Software without restriction, including without limitation the rights to
|
|
10
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
11
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
12
|
+
* subject to the following conditions:
|
|
13
|
+
* - The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
* - The Software is provided "as is", without warranty of any kind, express or
|
|
16
|
+
* implied, including but not limited to the warranties of merchantability,
|
|
17
|
+
* fitness for a particular purpose and noninfringement. In no event shall the
|
|
18
|
+
* authors or copyright holders be liable for any claim, damages or other
|
|
19
|
+
* liability, whether in an action of contract, tort or otherwise, arising from,
|
|
20
|
+
* out of or in connection with the Software or the use or other dealings in the
|
|
21
|
+
* Software.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#pragma once
|
|
25
|
+
|
|
26
|
+
#include <stdbool.h>
|
|
27
|
+
#include <stddef.h>
|
|
28
|
+
#include <stdint.h>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/*---- Enum and struct types----*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* The error correction level used in a QR Code symbol.
|
|
35
|
+
*/
|
|
36
|
+
enum qrcodegen_Ecc {
|
|
37
|
+
qrcodegen_Ecc_LOW = 0,
|
|
38
|
+
qrcodegen_Ecc_MEDIUM,
|
|
39
|
+
qrcodegen_Ecc_QUARTILE,
|
|
40
|
+
qrcodegen_Ecc_HIGH,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* The mask pattern used in a QR Code symbol.
|
|
46
|
+
*/
|
|
47
|
+
enum qrcodegen_Mask {
|
|
48
|
+
// A special value to tell the QR Code encoder to
|
|
49
|
+
// automatically select an appropriate mask pattern
|
|
50
|
+
qrcodegen_Mask_AUTO = -1,
|
|
51
|
+
// The eight actual mask patterns
|
|
52
|
+
qrcodegen_Mask_0 = 0,
|
|
53
|
+
qrcodegen_Mask_1,
|
|
54
|
+
qrcodegen_Mask_2,
|
|
55
|
+
qrcodegen_Mask_3,
|
|
56
|
+
qrcodegen_Mask_4,
|
|
57
|
+
qrcodegen_Mask_5,
|
|
58
|
+
qrcodegen_Mask_6,
|
|
59
|
+
qrcodegen_Mask_7,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* The mode field of a segment.
|
|
65
|
+
*/
|
|
66
|
+
enum qrcodegen_Mode {
|
|
67
|
+
qrcodegen_Mode_NUMERIC,
|
|
68
|
+
qrcodegen_Mode_ALPHANUMERIC,
|
|
69
|
+
qrcodegen_Mode_BYTE,
|
|
70
|
+
qrcodegen_Mode_KANJI,
|
|
71
|
+
qrcodegen_Mode_ECI,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* A segment of user/application data that a QR Code symbol can convey.
|
|
77
|
+
* Each segment has a mode, a character count, and character/general data that is
|
|
78
|
+
* already encoded as a sequence of bits. The maximum allowed bit length is 32767,
|
|
79
|
+
* because even the largest QR Code (version 40) has only 31329 modules.
|
|
80
|
+
*/
|
|
81
|
+
struct qrcodegen_Segment {
|
|
82
|
+
// The mode indicator for this segment.
|
|
83
|
+
enum qrcodegen_Mode mode;
|
|
84
|
+
|
|
85
|
+
// The length of this segment's unencoded data. Always in the range [0, 32767].
|
|
86
|
+
// For numeric, alphanumeric, and kanji modes, this measures in Unicode code points.
|
|
87
|
+
// For byte mode, this measures in bytes (raw binary data, text in UTF-8, or other encodings).
|
|
88
|
+
// For ECI mode, this is always zero.
|
|
89
|
+
int numChars;
|
|
90
|
+
|
|
91
|
+
// The data bits of this segment, packed in bitwise big endian.
|
|
92
|
+
// Can be null if the bit length is zero.
|
|
93
|
+
uint8_t *data;
|
|
94
|
+
|
|
95
|
+
// The number of valid data bits used in the buffer. Requires
|
|
96
|
+
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
|
97
|
+
int bitLength;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
/*---- Macro constants and functions ----*/
|
|
103
|
+
|
|
104
|
+
// The minimum and maximum defined QR Code version numbers for Model 2.
|
|
105
|
+
#define qrcodegen_VERSION_MIN 1
|
|
106
|
+
#define qrcodegen_VERSION_MAX 40
|
|
107
|
+
|
|
108
|
+
// Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
|
109
|
+
// as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
|
110
|
+
// can store any single QR Code from version 1 to 25, inclusive.
|
|
111
|
+
// Requires qrcodegen_VERSION_MIN <= n <= qrcodegen_VERSION_MAX.
|
|
112
|
+
#define qrcodegen_BUFFER_LEN_FOR_VERSION(n) ((((n) * 4 + 17) * ((n) * 4 + 17) + 7) / 8 + 1)
|
|
113
|
+
|
|
114
|
+
// The worst-case number of bytes needed to store one QR Code, up to and including
|
|
115
|
+
// version 40. This value equals 3918, which is just under 4 kilobytes.
|
|
116
|
+
// Use this more convenient value to avoid calculating tighter memory bounds for buffers.
|
|
117
|
+
#define qrcodegen_BUFFER_LEN_MAX qrcodegen_BUFFER_LEN_FOR_VERSION(qrcodegen_VERSION_MAX)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/*---- Functions to generate QR Codes ----*/
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* Encodes the given text string to a QR Code symbol, returning true if encoding succeeded.
|
|
125
|
+
* If the data is too long to fit in any version in the given range
|
|
126
|
+
* at the given ECC level, then false is returned.
|
|
127
|
+
* - The input text must be encoded in UTF-8 and contain no NULs.
|
|
128
|
+
* - The variables ecl and mask must correspond to enum constant values.
|
|
129
|
+
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
|
130
|
+
* - The arrays tempBuffer and qrcode must each have a length
|
|
131
|
+
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
|
132
|
+
* - After the function returns, tempBuffer contains no useful data.
|
|
133
|
+
* - If successful, the resulting QR Code may use numeric,
|
|
134
|
+
* alphanumeric, or byte mode to encode the text.
|
|
135
|
+
* - In the most optimistic case, a QR Code at version 40 with low ECC
|
|
136
|
+
* can hold any UTF-8 string up to 2953 bytes, or any alphanumeric string
|
|
137
|
+
* up to 4296 characters, or any digit string up to 7089 characters.
|
|
138
|
+
* These numbers represent the hard upper limit of the QR Code standard.
|
|
139
|
+
* - Please consult the QR Code specification for information on
|
|
140
|
+
* data capacities per version, ECC level, and text encoding mode.
|
|
141
|
+
*/
|
|
142
|
+
bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[],
|
|
143
|
+
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Encodes the given binary data to a QR Code symbol, returning true if encoding succeeded.
|
|
148
|
+
* If the data is too long to fit in any version in the given range
|
|
149
|
+
* at the given ECC level, then false is returned.
|
|
150
|
+
* - The input array range dataAndTemp[0 : dataLen] should normally be
|
|
151
|
+
* valid UTF-8 text, but is not required by the QR Code standard.
|
|
152
|
+
* - The variables ecl and mask must correspond to enum constant values.
|
|
153
|
+
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
|
154
|
+
* - The arrays dataAndTemp and qrcode must each have a length
|
|
155
|
+
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
|
156
|
+
* - After the function returns, the contents of dataAndTemp may have changed,
|
|
157
|
+
* and does not represent useful data anymore.
|
|
158
|
+
* - If successful, the resulting QR Code will use byte mode to encode the data.
|
|
159
|
+
* - In the most optimistic case, a QR Code at version 40 with low ECC can hold any byte
|
|
160
|
+
* sequence up to length 2953. This is the hard upper limit of the QR Code standard.
|
|
161
|
+
* - Please consult the QR Code specification for information on
|
|
162
|
+
* data capacities per version, ECC level, and text encoding mode.
|
|
163
|
+
*/
|
|
164
|
+
bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcode[],
|
|
165
|
+
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
170
|
+
*/
|
|
171
|
+
bool qrcodegen_isAlphanumeric(const char *text);
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
/*
|
|
175
|
+
* Tests whether the given string can be encoded as a segment in numeric mode.
|
|
176
|
+
*/
|
|
177
|
+
bool qrcodegen_isNumeric(const char *text);
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
/*
|
|
181
|
+
* Returns the number of bytes (uint8_t) needed for the data buffer of a segment
|
|
182
|
+
* containing the given number of characters using the given mode. Notes:
|
|
183
|
+
* - Returns SIZE_MAX on failure, i.e. numChars > INT16_MAX or
|
|
184
|
+
* the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
|
185
|
+
* - Otherwise, all valid results are in the range [0, ceil(INT16_MAX / 8)], i.e. at most 4096.
|
|
186
|
+
* - It is okay for the user to allocate more bytes for the buffer than needed.
|
|
187
|
+
* - For byte mode, numChars measures the number of bytes, not Unicode code points.
|
|
188
|
+
* - For ECI mode, numChars must be 0, and the worst-case number of bytes is returned.
|
|
189
|
+
* An actual ECI segment can have shorter data. For non-ECI modes, the result is exact.
|
|
190
|
+
*/
|
|
191
|
+
size_t qrcodegen_calcSegmentBufferSize(enum qrcodegen_Mode mode, size_t numChars);
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* Returns a segment representing the given binary data encoded in byte mode.
|
|
196
|
+
*/
|
|
197
|
+
struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, uint8_t buf[]);
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
202
|
+
*/
|
|
203
|
+
struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]);
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
/*
|
|
207
|
+
* Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
208
|
+
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
209
|
+
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
210
|
+
*/
|
|
211
|
+
struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t buf[]);
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
* Returns a segment representing an Extended Channel Interpretation
|
|
216
|
+
* (ECI) designator with the given assignment value.
|
|
217
|
+
*/
|
|
218
|
+
struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]);
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
/*
|
|
222
|
+
* Renders a QR Code symbol representing the given data segments at the given error correction
|
|
223
|
+
* level or higher. The smallest possible QR Code version is automatically chosen for the output.
|
|
224
|
+
* Returns true if QR Code creation succeeded, or false if the data is too long to fit in any version.
|
|
225
|
+
* This function allows the user to create a custom sequence of segments that switches
|
|
226
|
+
* between modes (such as alphanumeric and binary) to encode text more efficiently.
|
|
227
|
+
* This function is considered to be lower level than simply encoding text or binary data.
|
|
228
|
+
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
|
229
|
+
* result in them being clobbered, but the QR Code output will still be correct.
|
|
230
|
+
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
|
231
|
+
*/
|
|
232
|
+
bool qrcodegen_encodeSegments(const struct qrcodegen_Segment segs[], size_t len,
|
|
233
|
+
enum qrcodegen_Ecc ecl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
/*
|
|
237
|
+
* Renders a QR Code symbol representing the given data segments with the given encoding parameters.
|
|
238
|
+
* Returns true if QR Code creation succeeded, or false if the data is too long to fit in the range of versions.
|
|
239
|
+
* The smallest possible QR Code version within the given range is automatically chosen for the output.
|
|
240
|
+
* This function allows the user to create a custom sequence of segments that switches
|
|
241
|
+
* between modes (such as alphanumeric and binary) to encode text more efficiently.
|
|
242
|
+
* This function is considered to be lower level than simply encoding text or binary data.
|
|
243
|
+
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
|
244
|
+
* result in them being clobbered, but the QR Code output will still be correct.
|
|
245
|
+
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
|
246
|
+
*/
|
|
247
|
+
bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], size_t len, enum qrcodegen_Ecc ecl,
|
|
248
|
+
int minVersion, int maxVersion, int mask, bool boostEcl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
/*---- Functions to extract raw data from QR Codes ----*/
|
|
252
|
+
|
|
253
|
+
/*
|
|
254
|
+
* Returns the side length of the given QR Code, assuming that encoding succeeded.
|
|
255
|
+
* The result is in the range [21, 177]. Note that the length of the array buffer
|
|
256
|
+
* is related to the side length - every 'uint8_t qrcode[]' must have length at least
|
|
257
|
+
* qrcodegen_BUFFER_LEN_FOR_VERSION(version), which equals ceil(size^2 / 8 + 1).
|
|
258
|
+
*/
|
|
259
|
+
int qrcodegen_getSize(const uint8_t qrcode[]);
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
/*
|
|
263
|
+
* Returns the color of the module (pixel) at the given coordinates, which is either
|
|
264
|
+
* false for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
|
265
|
+
* If the given coordinates are out of bounds, then false (white) is returned.
|
|
266
|
+
*/
|
|
267
|
+
bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);
|