LIB2 / FILE VIEW

USER_MANUAL.md

DOWNLOAD ORIGINAL ↓

# STR / generation 2 — User manual

**Library:** `src/lib2/str/2/`  
**Edition:** 2026-11-18, source/document review (documentation only)  
**Qualification:** CLARITAS Wave 5 source/native parity accepted for versioned code; separate working-source r003 17/17 emulator witness exists, not a fresh proof of every versioned integration.

## What this member does

Provide six capacity-bounded NUL byte-string routines with explicit status codes and no UI/serial/math ownership.

## Public interfaces

| Entry point or group | Inputs, outputs and behavior |
|---|---|
| `STR_LEN` | `$10/11` src, `$12` cap; `$0` status, `$8` length. |
| `STR_COPY` | `$10/11` src, `$12` cap; `$13/14` dest, `$15` cap; status `$0`, copied length `$8`. |
| `STR_CMP` | Two bounded spans as above; `$8` FFh/00h/01h compare on success. |
| `STR_APPEND` | Copy-like pointers/caps; append source to destination; `$8` final length. |
| `STR_SKIPWS` | `$10/11` src, `$12` cap, `$13` offset; `$8` first non-whitespace, `$9` count. |
| `STR_INDEX` | Haystack+needle bounded spans; `$8` first zero-based match, `$0=5` if not found. |

## How to integrate

Include `str_abi.inc` once, selected method includes, and `str_copy.inc` whenever using `str_append.inc`. Initialize capacity/pointer registers, `CAL STR_*`, inspect `$0` before interpreting `$8/$9`.

**Composition sketch (not an independently assembled client):**

```asm
#INCLUDE (lib2/str/2/str_abi.inc)
#INCLUDE (lib2/str/2/str_copy.inc)
#INCLUDE (lib2/str/2/str_append.inc)
        ; Set RAM pointer/capacity pairs
        CAL     STR_APPEND
```

## Environment, dependencies and memory

Current RAM bank selected by caller; 1..255-byte capacities include NUL. `$SY` names a register holding 1, stack valid. `str_abi.inc` status 0..5 (`STR_OK`, `STR_UNTR`, `STR_NOSP`, `STR_BCAP`, `STR_BOFF`, `STR_NFND`). Input registers preserved per source contract; IX/flags clobbered.

## Limits and evidence

Do not use outdated `lib/str` paths or assume old r002a runtime behavior from dated notes. Historical `$SZ` alias bug was corrected in a separate working-source r003; verify actual versioned bytes and runtime.

**This documentation does not introduce a new build or runtime PASS.** Source equivalence, native assembler parity, emulator execution and physical-machine evidence remain distinct.

## Actual source and further reference

- [This exact member folder in Google Drive](https://drive.google.com/drive/folders/1LE6MRyc6sJAzdWRJ1-xyrMxAmLza6MS0)
- Source modules: `str_abi.inc`, `str_len.inc`, `str_copy.inc`, `str_cmp.inc`, `str_append.inc`, `str_skipws.inc`, `str_index.inc`.
- Further contracts/source notes: API.md, README.md. These may include dated donor paths or older acceptance statements.
- For a new consumer, pin exact source files and hashes, verify full include closure, inspect register/bank/resource conflicts and test the resulting application on each claimed target.

*Praeteritum ad futurum servamus.*