mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +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
32 lines
858 B
TypeScript
32 lines
858 B
TypeScript
// K1/K2/K8 fixture: scalar marshalling round-trips (f64 including -0, NaN,
|
|
// MAX_SAFE_INTEGER; bool both directions; the u8/u32/i32 plumbing classes)
|
|
// plus the archive-level symbol and ambient audits the harness runs over
|
|
// this fixture's artifacts.
|
|
export function add(a: number, b: number): number {
|
|
return a + b;
|
|
}
|
|
|
|
export function passthrough(x: number): number {
|
|
return x;
|
|
}
|
|
|
|
export function negZero(): number {
|
|
return -0;
|
|
}
|
|
|
|
export function isNan(x: number): boolean {
|
|
return Number.isNaN(x);
|
|
}
|
|
|
|
export function invert(f: boolean): boolean {
|
|
return !f;
|
|
}
|
|
|
|
// Host-produced inbound plumbing (tags, indices, deltas) carries no
|
|
// TS-side proof obligation: the classes convert to f64 on entry.
|
|
export function plumb(tag: number, idx: number, delta: number): number {
|
|
return tag * 1000 + idx * 10 + delta;
|
|
}
|
|
|
|
console.log("scalars ready");
|