mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-17 05:09:24 +08:00
- CLI: the core verb becomes `scriptc build --lib --profile <p.json>` (no positional; profile names the entry); artifact renames to <name>.lib.a with .lib.ll/.lib.c/.lib.ir.json siblings - SC4xxx diagnostic text and hints say library, never core; trap-message strings likewise (LIBRARY RC AUDIT, library reset registry, library inbound bytes) - internals: compileLibrary/compileLibArchive, IrModule.lib + IrLibSection/IrLibExport, moduleLibAsyncSurface, libRoots, loadLibraryProfile/LibraryProfile under src/library/, frontend/lib-exports.ts, emitLibEntries/emitLibDefs - runtime: scr_core.c -> scr_library.c with scr_library_* symbols and the SCR_LIB macro (scr_lib_* was taken by the stdlib unit); scr_lib_session_cleanup - tests: tests/library-mode/ fixtures (entries lib.ts), library-*.test.ts harness files
29 lines
820 B
TypeScript
29 lines
820 B
TypeScript
// K3 fixture: string/bytes round-trips and result lifetime under both
|
|
// arena postures (the harness builds this library twice — once with the
|
|
// auto-reset profile as written, once with a declared reset symbol patched
|
|
// in). The regex-using export additionally proves the gated matcher unit
|
|
// rides the library archive.
|
|
export function shout(s: string): string {
|
|
return s.toUpperCase() + "!";
|
|
}
|
|
|
|
export function strlen(s: string): number {
|
|
return s.length;
|
|
}
|
|
|
|
export function wrap(b: Uint8Array): Uint8Array {
|
|
const out = new Uint8Array(b.length + 2);
|
|
out[0] = 60; // '<'
|
|
for (let i = 0; i < b.length; i = i + 1) {
|
|
out[i + 1] = b[i]!;
|
|
}
|
|
out[out.length - 1] = 62; // '>'
|
|
return out;
|
|
}
|
|
|
|
export function dashes(s: string): string {
|
|
return s.replace(/x+/g, "-");
|
|
}
|
|
|
|
console.log("buffers ready");
|