- Move the Compat-A print prototype into stdlib/ as the official offline bundle with stdlib.json (version 0.1.0 + sha256 content digest). - Add std:<relative> import resolution in the loader with bundle path confinement, extension inference and fail-closed digest verification. - Record the verified version/digest/instance_id in Analysis v2 project.stdlib; stdlib modules get a std:name@version#digest instance id. - Add CLI tests: std:io execution, digest-tamper rejection, missing manifest, Analysis identity, no foreign/plugin calls, and frozen binary hash equality. - Update ADR-0028, specs, status, changelog and evidence. Gate: fmt, clippy -D warnings, 415 tests passed.
1.1 KiB
1.1 KiB
utf8编码
(文本, 内存, 基址)
把 Unicode 标量序列按 UTF-8 写入 Memory,返回字节长度。
点 = text.codepoints(文本)
下标 = 0
偏移 = 0
-
下标 < 长度(点)码点 = 点[下标]
-
码点 < 128内存[基址 + 偏移] = 码点偏移 = 偏移 + 1
-
码点 < 2048内存[基址 + 偏移] = 192 + 码点 // 64内存[基址 + 偏移 + 1] = 128 + 码点 % 64偏移 = 偏移 + 2
-
码点 < 65536内存[基址 + 偏移] = 224 + 码点 // 4096内存[基址 + 偏移 + 1] = 128 + 码点 // 64 % 64内存[基址 + 偏移 + 2] = 128 + 码点 % 64偏移 = 偏移 + 3
-
true内存[基址 + 偏移] = 240 + 码点 // 262144内存[基址 + 偏移 + 1] = 128 + 码点 // 4096 % 64内存[基址 + 偏移 + 2] = 128 + 码点 // 64 % 64内存[基址 + 偏移 + 3] = 128 + 码点 % 64偏移 = 偏移 + 4
下标 = 下标 + 1
-
偏移