skip to content
[readonly]

Growable strings, formatting, and Rust-style Debug output for faithful error messages

sh
$ sexc add @ajax/mesh-text
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 02:56v/# 1 version
  • drwxr-xr-x-Oct 27 02:56files/# the files of 0.1.0
latest
0.1.0, published Oct 27 02:56 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-check ^0.1.0
dependents
@ajax/cuda-driver, @ajax/cuda-driver-fake, @ajax/mesh-backend, @ajax/mesh-cuda, @ajax/mesh-inproc, @ajax/mesh-loader, @ajax/mesh-log, @ajax/mesh-manifest, @ajax/mesh-manifest-needs, @ajax/mesh-mps, @ajax/mesh-mps-wire, @ajax/mesh-mps-worker, @ajax/mesh-native, @ajax/mesh-native-limits, @ajax/mesh-occupancy, @ajax/mesh-peer-relay, @ajax/mesh-sched-needs, @ajax/mesh-shm, @ajax/mesh-spawn, @ajax/mesh-state-file, @ajax/mesh-toml, @ajax/nvjitlink
keywords
mesh alphaos text format string
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-text
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-text
2
3Growable strings, `printf` into them, error messages (`char **err`), and the pieces of Rust's
4formatting that the Rust implementation's messages show: `{:?}` of strings, `f64` and `f32`,
5`str::trim` (Unicode whitespace), `u32::from_str` and `f64::from_str`. With them, every ported error
6message reads byte for byte as the Rust's.
7
8```c
9#include "mesh/text.h"
10mesh_text t = {0};
11mesh_text_puts(&t, "name ");
12mesh_text_debug_str(&t, name, strlen(name));   /* name "Bad" */
13```
14
15## Ported from
16
17[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT) uses Rust's own
18`format!`; this package reproduces the parts its messages depend on. `src/escapes.c` (the code points
19`{:?}` escapes as `\u{..}`) was generated from Rust 1.88's `char::escape_debug`.
20
21## Tests
22
23`tests/text.c`: `{:?}` of 37 f64s, 7 f32s and 16 strings and 5 `trim`s, each against what Rust 1.88
24printed; the integer and float parsers' edge cases.
25
26## Licence
27
28MIT. See the repository's LICENSE.