From caa88a9b36d9e1dfae40ecb31aee05bc2891fa17 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 27 Oct 2026 14:07:24 +0000 Subject: docs(preprocessor): document switches and library regions Add manuals and aliases for all five PP directives, replace the retired #LIB page, and update compiler and shared-editor architecture notes. Co-Authored-By: Claude Opus 5.5 --- AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md') diff --git a/AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md b/AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md index 8ee97ec..0b8a887 100644 --- a/AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md +++ b/AGENTS/CONVENTIONS/EXCEPTIONS_AND_UNITS.md @@ -35,10 +35,16 @@ Part of [Load-bearing conventions](../CONVENTIONS.md). through ExceptionHandler, truncates its result and retains the final uncaught handler. -**Library units.** Line-leading `#LIB` marks SourceUnit::IsLibrary. RuntimeCheck uses -the externally visible i32 `__cps_user_line`; FunctionGen's shared call hook updates -it only on non-library to library calls. Runtime helper line arguments use -RuntimeCheck::lineValue too. Compiler diagnostics retain the owning file location. +**Library regions.** PP_DEFINE __LIB enables library mode for subsequent source +positions; PP_UNDEF __LIB disables it, including inside functions. SourceUnit owns +LibraryLines and answers isLibrary(Line). RuntimeCheck queries the current unit's +map with each original source line and uses the shared external i32 __cps_user_line +only in enabled regions. FunctionGen's call hook updates that global for calls +from ordinary positions, regardless of the callee's header mode: a callee can +enable __LIB inside its body. Library calls preserve it. Runtime helper arguments +also use RuntimeCheck::lineValue. Templates keep definition source lines and +owning units; deferred object cleanup keeps its registration's line and unit. +Compiler diagnostics retain the owning file location. **Default standard library.** The driver extracts embedded std.cps, its imported units and matching objects to a content-keyed cache (or temporary fallback) that survives -- cgit v1.3.1-4-g156e