skip to content
[readonly]

A set of u64 job items as disjoint half-open ranges: insert, remove, intersect, take, nth, and its a-b,c- text form

sh
$ sexc add @ajax/mesh-jobs-ranges
  • total 3
  • drwxr-xr-x-../
  • drwxr-xr-x-Oct 27 05:23v/# 1 version
  • drwxr-xr-x-Oct 27 05:23files/# the files of 0.1.0
latest
0.1.0, published Oct 27 05:23 by ajax
owners
ajax
license
MIT
dependencies
@ajax/mesh-check ^0.1.0, @ajax/mesh-strbuf ^0.1.0, @ajax/mesh-debug-str ^0.1.0
dependents
@ajax/mesh-driver, @ajax/mesh-jobs-frame, @ajax/mesh-jobs-node, @ajax/mesh-jobs-op, @ajax/mesh-jobs-req, @ajax/mesh-jobs-spec, @ajax/mesh-jobs-table, @ajax/mesh-jobs-wire
keywords
mesh alphaos jobs ranges intervals
homepage
https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-jobs-ranges
repository
https://github.com/thomasdavis/alpha-c-mesh
==> README.md <==
1# @ajax/mesh-jobs-ranges
2
3A set of u64 items as disjoint, non-touching half-open ranges `[s, e)`, in order: a job's items (a
4Slurm-like array, or endless: `[s, UINT64_MAX)`). Insert, remove, union, subtract, intersect, take
5from the front, the n-th item, and the text form `a-b,c-d` (`a-` is endless, `-` is empty) with its
6parser (which also takes single items `a`).
7
8```c
9#include "mesh/jobs/ranges.h"
10mj_ranges r = mj_ranges_of(0, 100);
11mj_ranges_take(&r, 7);            /* 0-7,8-100 */
12mj_ranges front = mj_ranges_take_front(&r, 10);
13```
14
15A zeroed `mj_ranges` is the empty set; free with `mj_ranges_free`.
16
17## Ported from
18
19[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT):
20`crates/mesh-host/src/jobs.rs`, `Ranges` (a `BTreeMap<u64, u64>` there; a sorted array of pairs here,
21with the same results).
22
23## Tests
24
25`tests/ranges.c`: jobs.rs's `ranges` test, the parse error text, and 20 000 random inserts, removes,
26intersections, `nth` and `contains` against a bitset, with the word form parsed back.
27
28## Licence
29
30MIT. See the repository's LICENSE.