Parma Polyhedra Library requirements
Low-Level Requirements: C Interface

Low-Level Requirements: C Interface

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
LLR
1
PPL-LLR-000201
PPL-LLR-000201
Explicit C library lifecycle

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.

APPROVED
C_INTERFACE
IF_C
Test, Review

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.

LLR
2
PPL-LLR-000202
PPL-LLR-000202
C object ownership and borrowed access

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.

APPROVED
C_INTERFACE
IF_C
Test, Review

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.

LLR
3
PPL-LLR-000203
PPL-LLR-000203
C boundary error reporting

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.

APPROVED
C_INTERFACE
IF_C
Test, Review

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.