feature: add RFC 8259 JSON parser/serializer and string utility extensions
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Add core.fmt.json — a complete RFC 8259 JSON library with recursive-descent
parser, serializer, builders, dot/bracket path accessors, and full cleanup.
Supports all 6 JSON value types plus JSON_ERROR for parse error reporting.
Numbers stored as Double via x87 FPU. Unicode \uXXXX escapes handled
(ASCII range emitted, non-ASCII replaced with '?').

Supporting changes:
- core.strings: add int64ToString, doubleToStr (scientific notation for
  very large/small values, fixed-point for normal range, trailing zero
  trimming), plus unit tests for both
- asuro.pas: wire core.fmt.json.UnitTest into the boot test suite
- mkdocs.yml: add JSON nav entry under Formats
- doc/src/core/fmt/core.fmt.json.md: full API documentation
- doc/src/core/core.strings.md: document int64ToString and doubleToStr
- doc/planning/json.md: implementation plan and design spec
- doc/planning/webgpu.md: WebGPU-over-WASM design plan (software
  rasterizer backend for WASM apps importing webgpu.h)
This commit is contained in:
2026-03-10 11:51:48 +00:00
parent 97b4460c48
commit 63f6c5ecc1
8 changed files with 2457 additions and 1 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+12
View File
@@ -106,6 +106,12 @@ function intToString(i : uint32) : pchar;
```
Returns a heap-allocated decimal string representation of `i`.
### int64ToString
```pascal
function int64ToString(i : int64) : pchar;
```
Returns a heap-allocated decimal string representation of the signed 64-bit integer `i`. Negative values are prefixed with `'-'`.
### hexStringToInt
```pascal
function hexStringToInt(str : pchar) : uint32;
@@ -118,6 +124,12 @@ function boolToString(b : boolean; ext : boolean) : pchar;
```
Returns a heap-allocated string for the boolean `b`. When `ext` is `true`, returns `'true'` or `'false'`; when `false`, returns `'1'` or `'0'`.
### doubleToStr
```pascal
function doubleToStr(d : Double) : pchar;
```
Returns a heap-allocated decimal string representation of the 64-bit floating-point value `d`. Integer values are emitted without a decimal point (e.g. `42`). Fractional values include up to 15 significant digits with trailing zeros removed. Very large or very small values use scientific notation (e.g. `1.5e+20`).
### UnitTest
```pascal
procedure UnitTest;
File diff suppressed because it is too large Load Diff
+1
View File
@@ -136,6 +136,7 @@ nav:
- MD5: src/core/enc/core.enc.md5.md
- SHA-1: src/core/enc/core.enc.sha1.md
- Formats:
- JSON: src/core/fmt/core.fmt.json.md
- Targa (TGA): src/core/fmt/core.fmt.targa.md
- Graphics:
- Color: src/core/gfx/core.gfx.color.md
+4 -1
View File
@@ -117,7 +117,8 @@ uses
wasm.test,
wasm.test.framework,
driver.video.windows,
driver.bus.usb.xhci;
driver.bus.usb.xhci,
core.fmt.json;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -352,9 +353,11 @@ begin
core.ds.prio.UnitTest;
driver.storage.vfs.UnitTest;
driver.storage.test.UnitTest;
boot.splash.update(95, 'Running test suite...');
core.enc.fnv1a.UnitTest;
core.enc.djb2.UnitTest;
core.ds.bloom.UnitTest;
core.fmt.json.UnitTest;
{ Initialize driver.video.desktop environment }
boot.splash.update(100, 'Booting desktop...');
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff