cli: add safe UTF-8 and supplied-buffer hex/base64 std modules
This commit is contained in:
42 files changed
+2807
-14
No files matched your search
+4
-2
@@ -1,6 +1,6 @@
|
||||
# Aji standard library
|
||||
|
||||
Implementation in ordinary safe `.aji`: `math.aji` and `bytes.aji`, with 29 functions and seven public result enums. They are embedded with the compiler and compiled through the normal frontend/verifier when imported. They are library modules, not standalone `main` programs.
|
||||
Implementation in ordinary safe `.aji`: bytes, math, UTF-8, hex and Base64, with 35 functions and 13 public result enums. They are embedded with the compiler and compiled through the normal frontend/verifier when imported. They are library modules, not standalone `main` programs.
|
||||
|
||||
```aji
|
||||
module example
|
||||
@@ -23,6 +23,8 @@ Endian APIs read/write u16/u32/u64 in LE/BE order. Reads return `std.bytes.ReadU
|
||||
|
||||
`std.bytes.copy` reuses `WriteResult` and preserves the whole destination on short output. `find_slice` returns `FindResult::found(index)` / `not_found`; explicit slices compose a split without returned borrows. `std.math.checked_add/sub/mul_u64` and the `_usize` forms return typed `ok(value)` / `overflow` enums; wrapping stays with `+%`, `-%`, `*%`. The [bounded example](../examples/std/bounded.aji) returns 10 without grants.
|
||||
|
||||
`std.utf8.next/validate` use Unicode scalar values and explicit byte offsets. `std.encoding.hex` and `std.encoding.base64` encode/decode into caller-provided buffers; malformed input and short capacity are enum results, with no destination mutation on returned errors. Hex emits lowercase and accepts mixed case. Base64 is canonical, padded and uses the standard alphabet. The [text example](../examples/std/text.aji) returns 8364 without grants.
|
||||
|
||||
The compiler uses its embedded copy, so rebuild after editing these files. An installed compiler needs neither this checkout nor a runtime std search path. Standard enum types use fully qualified names in signatures, constructors and matches. General user imports, imported struct literals, generics and owning collections are still future work.
|
||||
|
||||
[API reference](../docs/reference/std.md) · [Specification](../docs/spec/16-standard-library.md) · [Plan](../docs/plan/standard-library.md) · [Import RFC](../docs/rfcs/0016-standard-library-bootstrap.md) · [Endian RFC](../docs/rfcs/0017-standard-endian-results.md) · [Bounded operations RFC](../docs/rfcs/0018-bounded-standard-operations.md)
|
||||
[API reference](../docs/reference/std.md) · [Specification](../docs/spec/16-standard-library.md) · [Plan](../docs/plan/standard-library.md) · [Import RFC](../docs/rfcs/0016-standard-library-bootstrap.md) · [Endian RFC](../docs/rfcs/0017-standard-endian-results.md) · [Bounded operations RFC](../docs/rfcs/0018-bounded-standard-operations.md) · [Text RFC](../docs/rfcs/0019-standard-text-encodings.md)
|
||||
Reference in new issue
Block a user