Low-Level Requirements: C Interface
The C interface shall provide explicit initialization and finalization of library state. Repeated initialization without an intervening finalization, and repeated finalization without an intervening initialization, shall report an invalid lifecycle request.
C clients need an explicit lifecycle for resources managed by the native library.
Verification covers C library lifecycle entry points and their state-dependent outcomes. Sequence tests and inspection verify initialization ownership and duplicate-request reporting. Use of other operations outside their documented initialization preconditions is not required to be detected by this requirement. Thread-entry obligations are allocated separately by 🔗 6. Thread entry and shared-facility use.
A valid initialization and finalization sequence succeeds; a duplicate request in each state reports the documented invalid-argument outcome; reinitialization after finalization succeeds.
interfaces/C/ppl_c_header.h, Library Initialization and Finalization; interfaces/C/ppl_c_implementation_common.cc, library lifecycle operations.
- PPL-SPEC-001554 C generated domain values and conversions (Specified by)
- PPL-SPEC-001555 C generated domain observations (Specified by)
- PPL-SPEC-001556 C generated system extraction ownership (Specified by)
- PPL-SPEC-001557 C generated domain transformations (Specified by)
- PPL-SPEC-001558 C generated affine transformations (Specified by)
- PPL-SPEC-001559 C generated dimension arrays and maps (Specified by)
- PPL-SPEC-001560 C generated convergence operations (Specified by)
- PPL-SPEC-001561 C finite-disjunction ownership and traversal (Specified by)
- PPL-SPEC-001562 C partition result ownership (Specified by)
- PPL-SPEC-001563 C affine-ranking outcomes and coefficient spaces (Specified by)
- PPL-SPEC-001564 C bounded integer wrapping (Specified by)
- PPL-SPEC-001539 C mixed integer problem values (Specified by)
- PPL-SPEC-001540 C mixed integer descriptors and borrowing (Specified by)
- PPL-SPEC-001541 C mixed integer incremental updates (Specified by)
- PPL-SPEC-001542 C mixed integer solution outcomes and witnesses (Specified by)
- PPL-SPEC-001543 C mixed integer controls, validity and memory (Specified by)
- PPL-SPEC-001520 C textual output and allocated buffers (Specified by)
- PPL-SPEC-001521 C line wrapping and pointer failure result (Specified by)
- PPL-SPEC-001522 C reloadable FILE representations (Specified by)
- PPL-SPEC-001544 C parametric problem values and ownership (Specified by)
- PPL-SPEC-001545 C parametric descriptors and parameter lists (Specified by)
- PPL-SPEC-001546 C parametric incremental updates (Specified by)
- PPL-SPEC-001547 C parametric outcomes and borrowed solution trees (Specified by)
- PPL-SPEC-001548 C parametric controls, big parameter and memory (Specified by)
- PPL-SPEC-001549 C solution-tree kind, guards, children and values (Specified by)
- PPL-SPEC-001550 C artificial-parameter expression and coefficient queries (Specified by)
- PPL-SPEC-001551 C artificial-parameter sequence traversal (Specified by)
- PPL-SPEC-001534 C constraint systems (Specified by)
- PPL-SPEC-001535 C generator systems (Specified by)
- PPL-SPEC-001536 C congruence systems (Specified by)
- PPL-SPEC-001537 C grid generator systems (Specified by)
- PPL-SPEC-001538 C descriptor-system iterator lifetimes (Specified by)
- PPL-SPEC-001514 C handles, arguments and successful outcomes (Specified by)
- PPL-SPEC-001523 C coefficient ownership, conversion and bounds (Specified by)
- PPL-SPEC-001524 C affine expression values and updates (Specified by)
- PPL-SPEC-001525 C affine expression queries (Specified by)
- PPL-SPEC-001526 C linear constraint values (Specified by)
- PPL-SPEC-001527 C linear constraint queries (Specified by)
- PPL-SPEC-001528 C polyhedral generator values (Specified by)
- PPL-SPEC-001529 C polyhedral generator queries (Specified by)
- PPL-SPEC-001530 C rational congruence values (Specified by)
- PPL-SPEC-001531 C rational congruence queries (Specified by)
- PPL-SPEC-001532 C grid generator values (Specified by)
- PPL-SPEC-001533 C grid generator queries (Specified by)
The C interface shall distinguish caller-owned objects from borrowed access to an existing object's contents. Creating an owned object shall establish a separate lifetime, whereas obtaining a borrowed handle shall not transfer ownership or extend the owner's lifetime.
Handle values alone do not express ownership, and copying a handle must not be mistaken for copying its object.
Verification covers owned creation, copying, deletion, borrowed access and invalidation contracts. Ownership tests and inspection verify separate owned lifetimes and valid borrowing. Automatic detection of stale handles, double deletion or violations of borrowed-access preconditions is not required. Failure cleanup is governed by 🔗 3. Failure and resource safety.
Creation, copying and deletion tests establish independent lifetimes for owned copies; accessor tests establish that borrowed results describe the owner's contents; documentation states the owner-lifetime and invalidation preconditions for borrowed results.
interfaces/C/ppl_c_header.h, Handle Ownership and Lifetimes; interfaces/C/ppl_interface_generator_c_h_code.m4, borrowed-system and owned-system accessors.
- PPL-SPEC-001554 C generated domain values and conversions (Specified by)
- PPL-SPEC-001555 C generated domain observations (Specified by)
- PPL-SPEC-001556 C generated system extraction ownership (Specified by)
- PPL-SPEC-001557 C generated domain transformations (Specified by)
- PPL-SPEC-001558 C generated affine transformations (Specified by)
- PPL-SPEC-001559 C generated dimension arrays and maps (Specified by)
- PPL-SPEC-001560 C generated convergence operations (Specified by)
- PPL-SPEC-001561 C finite-disjunction ownership and traversal (Specified by)
- PPL-SPEC-001562 C partition result ownership (Specified by)
- PPL-SPEC-001563 C affine-ranking outcomes and coefficient spaces (Specified by)
- PPL-SPEC-001564 C bounded integer wrapping (Specified by)
- PPL-SPEC-001539 C mixed integer problem values (Specified by)
- PPL-SPEC-001540 C mixed integer descriptors and borrowing (Specified by)
- PPL-SPEC-001541 C mixed integer incremental updates (Specified by)
- PPL-SPEC-001542 C mixed integer solution outcomes and witnesses (Specified by)
- PPL-SPEC-001543 C mixed integer controls, validity and memory (Specified by)
- PPL-SPEC-001519 C variable formatting and callback failures (Specified by)
- PPL-SPEC-001520 C textual output and allocated buffers (Specified by)
- PPL-SPEC-001521 C line wrapping and pointer failure result (Specified by)
- PPL-SPEC-001522 C reloadable FILE representations (Specified by)
- PPL-SPEC-001544 C parametric problem values and ownership (Specified by)
- PPL-SPEC-001545 C parametric descriptors and parameter lists (Specified by)
- PPL-SPEC-001546 C parametric incremental updates (Specified by)
- PPL-SPEC-001547 C parametric outcomes and borrowed solution trees (Specified by)
- PPL-SPEC-001548 C parametric controls, big parameter and memory (Specified by)
- PPL-SPEC-001549 C solution-tree kind, guards, children and values (Specified by)
- PPL-SPEC-001550 C artificial-parameter expression and coefficient queries (Specified by)
- PPL-SPEC-001551 C artificial-parameter sequence traversal (Specified by)
- PPL-SPEC-001516 C failures and installed error notification (Specified by)
- PPL-SPEC-001552 C signal timeout lifecycle (Specified by)
- PPL-SPEC-001553 C deterministic timeout lifecycle (Specified by)
- PPL-SPEC-001534 C constraint systems (Specified by)
- PPL-SPEC-001535 C generator systems (Specified by)
- PPL-SPEC-001536 C congruence systems (Specified by)
- PPL-SPEC-001537 C grid generator systems (Specified by)
- PPL-SPEC-001538 C descriptor-system iterator lifetimes (Specified by)
- PPL-SPEC-001514 C handles, arguments and successful outcomes (Specified by)
- PPL-SPEC-001523 C coefficient ownership, conversion and bounds (Specified by)
- PPL-SPEC-001524 C affine expression values and updates (Specified by)
- PPL-SPEC-001525 C affine expression queries (Specified by)
- PPL-SPEC-001526 C linear constraint values (Specified by)
- PPL-SPEC-001527 C linear constraint queries (Specified by)
- PPL-SPEC-001528 C polyhedral generator values (Specified by)
- PPL-SPEC-001529 C polyhedral generator queries (Specified by)
- PPL-SPEC-001530 C rational congruence values (Specified by)
- PPL-SPEC-001531 C rational congruence queries (Specified by)
- PPL-SPEC-001532 C grid generator values (Specified by)
- PPL-SPEC-001533 C grid generator queries (Specified by)
The C interface shall report every failure designated by its supported failure model through the corresponding negative error status and invoke the installed error handler with the error category and a textual description. Native C++ exceptions raised by supported operations shall be contained at the C language boundary rather than escaping to the caller.
C clients require observable error reporting without reliance on C++ exception handling.
Verification covers C status categories, handler invocation, output validity and native exception containment. Category-specific tests and inspection of the boundary translation paths provide evidence. Arithmetic-overflow cases apply when checked bounded coefficients are selected. The handler's description need only remain valid during its invocation. Resource cleanup is governed by 🔗 3. Failure and resource safety.
Exercise the supported failure categories, including invalid arguments, domain and size errors, allocation failure, checked-coefficient overflow, and supported interruptions. Check status categories and handler notifications independently of their descriptions, distinguish successful mathematical results from failures, and inspect exception containment and output-validity rules at the boundary.
interfaces/C/ppl_c_header.h, Error Handling; interfaces/C/ppl_c_implementation_common_defs.hh, exception-to-error translation; interfaces/C/ppl_c_implementation_common.cc, error-handler management.