Add archive helpers and harden task runtime

This commit is contained in:
udo
2026-05-21 00:00:23 +00:00
parent 9f7625c7fd
commit 02e153a6a7
71 changed files with 12817 additions and 305 deletions
+57
View File
@@ -0,0 +1,57 @@
:sig
String yaml_encode(DTree t)
:params
t : tree to serialize as YAML
return value : YAML string
:see
>markup
yaml_decode
json_encode
xml_encode
0_DTree
:content
Serializes a `DTree` into a compact YAML string for configuration files.
`yaml_encode()` focuses on the ordinary data shapes UCE apps use for config: nested maps, lists, strings, booleans, and numeric `f64` values. It does not emit YAML tags, anchors, aliases, or custom schema features.
Try the live example in the [YAML demo](../demo/yaml.uce).
Example:
```uce
DTree cfg;
cfg["app"]["name"] = "UCE Starter";
cfg["app"]["debug"].set_bool(true);
cfg["app"]["port"] = (f64)8080;
DTree path;
path = "site";
cfg["app"]["paths"].push(path);
path = "cache";
cfg["app"]["paths"].push(path);
String yaml = yaml_encode(cfg);
```
Typical result:
```yaml
app:
debug: true
name: UCE Starter
paths:
- site
- cache
port: 8080
```
Notes:
- Map keys are emitted in `DTree` map iteration order.
- Strings are left plain when safe and quoted when needed.
- Multiline strings are emitted as literal block scalars with `|`.
- Empty strings are emitted as `""` so they are not confused with YAML null.
- Decoded numeric-looking config values are strings unless the original `DTree` value was explicitly numeric.