C RUNTIME
ppl_initialize shall initialize native library state, published symbolic constants and the calling thread's C variable formatter. ppl_finalize shall release C-owned interruption objects and its native library-initialization owner and restore the preceding native variable formatter. Initialization and finalization shall return zero on success and invalid-argument status for duplicate lifecycle requests. Reinitialization after a completed finalization shall succeed. Independently owned client objects shall be released before finalization.
New participating threads shall enter and leave using the thread functions in supported configurations. The initializing thread shall use the library lifecycle rather than duplicate thread entry or exit. Thread finalization shall restore that thread's preceding native formatter. Shared lifecycle and interruption ownership shall obey the native synchronization prerequisites.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
Binding-owned timers must not survive the library state on which their callbacks depend.
Public header: <ppl_c.h>.
int ppl_initialize(void); int ppl_finalize(void); int ppl_thread_initialize(void); int ppl_thread_finalize(void);
Check initialize/finalize/reinitialize sequences, duplicate calls, thread entry where configured, formatter restoration and finalization with armed C interruption facilities.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc; interfaces/C/tests/cerrorsspec1.cc.
Supported native exceptions shall be contained at the C boundary and translated to the corresponding negative category: allocation, invalid argument, domain, size, logic, checked arithmetic overflow, internal runtime error, other standard exception, unexpected exception or interruption. The installed non-null error handler shall receive that category and a description exactly once for each reported failure, including directly detected I/O, buffer-allocation and unsupported-operation failures. Its description shall be borrowed only during the callback. A null handler shall disable notification. Handlers shall return normally and obey synchronization and reentrancy prerequisites.
ppl_set_error_handler shall replace the calling thread's handler where thread-local state is configured. Direct C I/O errors shall preserve their errno detail across notification. Pointer-returning text wrapping shall use null on failure, with handler notification, rather than allowing a C++ exception to escape.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
An error status and its callback are two observations of the same failed operation.
Public header: <ppl_c.h>.
enum ppl_enum_error_code { PPL_ERROR_OUT_OF_MEMORY = -2, PPL_ERROR_INVALID_ARGUMENT = -3, PPL_ERROR_DOMAIN_ERROR = -4, PPL_ERROR_LENGTH_ERROR = -5, PPL_ARITHMETIC_OVERFLOW = -6, PPL_STDIO_ERROR = -7, PPL_ERROR_INTERNAL_ERROR = -8, PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION = -9, PPL_ERROR_UNEXPECTED_ERROR = -10, PPL_TIMEOUT_EXCEPTION = -11, PPL_ERROR_LOGIC_ERROR = -12 }; int ppl_set_error_handler(void (*h)(enum ppl_enum_error_code code, const char *description));
Check every supported category, callback counts, null-handler operation, errno preservation and native exception containment; inject both C++ allocation and output-buffer allocation failures.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/ppl_c_implementation_common_defs.hh; interfaces/C/tests/ccontractsspec1.cc; interfaces/C/tests/partitions.c; interfaces/C/tests/polyhedra.c; interfaces/C/tests/cerrorsspec1.cc.
Version and banner accessors shall expose the built library's version components and borrowed static strings. Dimension accessors shall assign the native maximum extent and reserved non-dimension sentinel without changing them numerically. Initialization shall publish relation flags, complexity classes, optimizer statuses, modes and controls corresponding to the native values. Callers shall use these symbolic values in the operations that accept them. Version component functions shall return their nonnegative component directly.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
C clients require values matching the library they actually link.
Public header: <ppl_c.h>.
int ppl_version_major(void); int ppl_version_minor(void); int ppl_version_revision(void); int ppl_version_beta(void); int ppl_version(const char **p); int ppl_banner(const char **p); int ppl_max_space_dimension(ppl_dimension_type *m); int ppl_not_a_dimension(ppl_dimension_type *m);
Compare version components and strings, extent/sentinel values, and initialized symbolic values with independently observed operation outcomes.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.
Rounding controls shall apply the native PPL rounding mode or restore the calling thread's saved preceding mode. The precision query shall assign the current irrational-result precision, and setting shall apply the native admission and precision semantics. These controls shall not change exact integer or rational values. Calls involving floating arithmetic shall satisfy the applicable native rounding and thread-entry prerequisites.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
C forwarding must retain thread-local numerical prerequisites.
Public header: <ppl_c.h>.
int ppl_set_rounding_for_PPL(void); int ppl_restore_pre_PPL_rounding(void); int ppl_irrational_precision(unsigned *p); int ppl_set_irrational_precision(unsigned p);
Check precision round trips, invalid settings where supported and rounding restoration/control in configured floating-point environments.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/ccontractsspec1.cc.
Supported signal-timeout requests shall arm the native watchdog for the positive centisecond duration under its thread/signal ownership prerequisites. Replacing a timeout shall cancel the preceding signal timeout before admitting and arming its replacement; failure after cancellation shall not restore the old one. Reset shall release the C-owned signal watchdog and its binding-owned notification state. A delivered signal interruption shall report the timeout category and release that signal timeout before notification. Thread-safe C configurations shall reject the unsupported request without arming it. C library finalization shall release any remaining C-owned signal watchdog before native watchdog finalization.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
A C-owned timer must have a finite lifetime and a distinct interruption outcome.
Public header: <ppl_c.h>.
int ppl_set_timeout(unsigned csecs); int ppl_reset_timeout(void);
Check supported/unsupported requests, invalid and excessive durations, replacement/reset effects, timeout translation and finalization with an armed timer.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/watchdog1.c; interfaces/C/tests/cerrorsspec1.cc.
Supported deterministic requests shall use the native positive scaled computational-weight increment, its admitted circular threshold domain and cooperative checkpoints. Replacing shall cancel the preceding deterministic setting before admitting the replacement; reset shall release its C-owned watcher and notification state. A deterministic interruption shall release that deterministic watcher before reporting the timeout category. It shall not remain active merely because the signal-timeout cleanup path was selected instead. Reset shall clear only the C-owned deterministic request and preserve unrelated borrowed interruption requests. In thread-safe C configurations, each initialized thread shall own its independent watcher, threshold queue, checker and budget counter. Setting, canceling or expiring one thread's budget shall not alter another's. Thread and library finalization shall release the calling thread's remaining C-owned deterministic state before native teardown; a later thread session shall inherit no pending C deterministic timeout.
The valid-use and result-category conditions in 🔗 1. C handles, arguments and successful outcomes shall apply.
An observed timeout must not repeatedly poison independent later computations.
Public header: <ppl_c.h>.
int ppl_set_deterministic_timeout(unsigned long unscaled_weight, unsigned scale); int ppl_reset_deterministic_timeout(void);
Force a threshold crossing, check exactly one translated notification, then run an independent query without an explicit client reset; check invalid/replacement/reset/finalization transitions. Exercise simultaneous thread budgets, cross-module native/C watchers, unrelated borrowed requests and finalization/reentry with a pending budget.
interfaces/C/ppl_c_header.h; interfaces/C/ppl_c_implementation_common.cc; interfaces/C/tests/weightwatch1.c; interfaces/C/tests/cerrorsspec1.cc; interfaces/C/tests/deterministictimeouts1.cc.