C+
Archived manual for C+ v0.0.26. Read the current manual (v0.0.30)
Packages · View as Markdown

Packages

C+ is C plus packages. The language core is small on purpose; capability comes from packages, including the standard library. stdlib is a vendored package like any other, not a language built-in.

How a package works

Every package is a directory under vendor/ with a Cplus.toml manifest, a <package-name>.cplus library entry, and in-package #[test] functions you can run with cd vendor/<pkg> && cpc test. To use one, add it to your manifest and import it:

[dependencies]
stdlib = "*"
json   = "*"
import "stdlib/io" as io;
import "json/json" as json;

The driver walks one directory up from your project to resolve sibling vendor dependencies, so no per-package symlinks are needed beyond the canonical vendor/ checkout.

You can populate vendor/ by hand, or let cplus-pm, the standalone package manager, resolve and fetch dependencies for you (cplus-pm install).

The standard library

  • stdlib — I/O, collections, ownership wrappers, concurrency, files, and networking. The package you reach for first.

GPU & numerics

C+ talks to GPUs and BLAS as a consumer of the vendor SDKs, through plain C FFI with Drop-managed handles. See GPU & numerics for the backend matrix and how to pick one.

  • metal — typed Metal and MPS bindings for Apple GPU compute.
  • cuda — CUDA Runtime + cuBLAS bindings for NVIDIA GPUs.
  • accelerate — Apple CPU numerics (BLAS, vDSP).
  • cblas — cross-platform CPU BLAS (OpenBLAS / Netlib / MKL).
  • simd — portable f32x4 math plus integer lane helpers.

AI

  • llama_cpp — bindings for llama.cpp with a safe Session facade for LLM inference.
  • coreai — a Swift bridge to Apple's CoreAI (macOS).

Agent surface

Expose a C+ app to an external agent — described, driven, and observed over a consent-gated bridge. See Agent surface for the full story.

  • agent_core — the framework-agnostic authorization brain.
  • agent_appkit — the macOS GUI backend (live NSView tree → surface).
  • agent_mcp — the JSON-RPC 2.0 / MCP bridge.

Platform

  • appkit — typed Cocoa / AppKit bindings for native macOS apps.
  • uikit — typed UIKit bindings for native iOS apps.
  • android_view — Android View bindings (build a native View tree from C+, receive taps).
  • jni — Java Native Interface bindings (the full JNI 1.6 table).

Embedded

C+ cross-compiles to microcontrollers; see Targets and Embedded & ESP32.

  • espidf — ESP-IDF bindings (GPIO, timer, task, UART) for the esp32-xtensa target.

Utilities

  • clap — command-line argument parsing with a fluent builder.
  • json — a typed-enum JSON parser and serializer.
  • log — a leveled, zero-allocation structured logger.
  • uuid — RFC 4122 v4 UUIDs.
  • arena — a growable bump-pointer arena.
  • static-arena — a fixed-size, stack-resident arena.

Real-time

  • rt — lock-free primitives for the real-time contracts (rt and the platform rt_darwin).

Filter all 30 packages

stdlib Cross-platform

The C+ standard library: I/O, vectors, hash maps, files, networking, ownership wrappers (Box, Arc, Rc), concurrency, and result/option types. A vendored package, imported per module.

accelerate Apple

Bindings to Apple's Accelerate.framework: pre-tuned CPU numerics (BLAS via cblas, element-wise and reductions via v_dsp) that ship in every macOS binary.

agent_appkit Apple

The macOS GUI backend for the agent surface: open(window) walks a live NSView tree into a Surface, describe_ui returns a UiNode snapshot, and authorized click / set_text / scroll_to run through the agent_core brain.

agent_core Agent

The framework-agnostic core for agent-controllable apps: a build-time-stable agent-id tree, curated describe, the consent AuthGate with exposure and an affordance ceiling, bubbling {node,verb,role} events, and optimistic-concurrency action/text authorization.

agent_mcp Agent

The MCP bridge for the agent surface: JSON-RPC 2.0 (describe_ui / actions / events) over Unix-domain sockets (serve_uds / serve_fd), with every request gated by an agent_core consent AuthGate.

android_view Android

Android View bindings for C+, layered on vendor/jni: build a native View tree from C+, and receive Button taps through a package-shipped DEX adapter. Validated end to end on the emulator.

appkit Apple

Typed Cocoa / AppKit bindings for native macOS desktop apps: application lifecycle, windows, views, controls, and closure-free callbacks.

arena Cross-platform

A growable, multi-chunk bump-pointer arena for allocate-many, free-all workloads like parsers, compilers, and request-scoped allocations.

cblas GPU & AI

Reference CBLAS bindings (OpenBLAS / Netlib / MKL): the cross-platform CPU BLAS path. Level 1/2/3 routines — sdot, saxpy, sscal, snrm2, sasum, sgemv, sgemm, and d-variants — with typed Order and Transpose enums.

clap Cross-platform

Command-line argument parsing with a fluent builder: flags, long and short options, positional arguments, and typed match accessors.

coreai Apple

A Swift bridge to Apple's CoreAI, adapted to the real API on Xcode 27 / macOS 27.

cuda GPU & AI

Typed CUDA Runtime + cuBLAS bindings for NVIDIA GPUs: device management, Drop-managed DeviceBuffer (cudaFree) and cuBLAS Handle (cublasDestroy_v2), and column-major sgemm / sgemv. Plain C FFI, no kernel language.

espidf Cross-platform

ESP-IDF bindings for the esp32-xtensa target: GPIO, the esp_timer microsecond clock, task sleep, and UART console output. The gpio/timer externs are #[no_alloc] + #[no_block], so a #[realtime] loop can use them.

jni Android

Java Native Interface bindings: #[repr(C)] mirrors of the JVM dispatch tables covering the full JNI 1.6 function table, called through a function-pointer table exactly as C's JNI does.

json Cross-platform

A typed-enum JSON parser and serializer: a recursive Value enum, parse and to_text entry points, and is_* / as_* accessors. Drops payloads recursively.

llama_cpp GPU & AI

C+ bindings for llama.cpp's C API: raw FFI generated from the upstream headers with cpc-bindgen, plus a hand-written safe Session facade (load / generate / tokenize / decode / sample).

log Cross-platform

A leveled, zero-allocation structured logger to stderr: configure level and colors once, then log at trace / debug / info / warn / error with no malloc per call.

metal GPU & AI

Typed Metal bindings for Apple GPU compute: devices, command queues, buffers, libraries, functions, and compute pipeline state, generated over Apple's Metal framework.

simd GPU & AI

3D math on f32x4 plus integer-widening lane helpers: Vec3, Vec4, Mat4x4, and composable integer lane ops like a 16-lane signed-byte dot product.

static-arena Cross-platform

A fixed-size bump-pointer arena whose buffer lives on the stack or in static storage: zero malloc, zero free, composes with the #[no_alloc] real-time contract.

uikit Apple

Typed UIKit bindings for native iOS apps, mirroring vendor/appkit: windows, view controllers, controls, text, containers, data views, graphics, Auto Layout, and app-delegate synthesis, with the cplus_app_main entry convention.

uuid Cross-platform

RFC 4122 v4 UUIDs sourced from /dev/urandom, portable across macOS, Linux, and BSD. Generate, parse, and format with an infallible to_text.

rt Cross-platform

Lock-free, allocation-free real-time building blocks: the SpscRingU64 ring and FixedPoolU64 object pool, plus the rt_darwin platform controls (clock, thread QoS, page locking).

facet Facet UI

A platform-free, declarative UI framework: describe a view tree in @facet { } builder blocks (label / button / stack + .on_click) that a per-platform renderer turns into native widgets.

facet_appkit Apple

The AppKit (macOS) renderer for facet: render walks a facet::Node tree into a native NSView/NSStackView/NSButton/NSTextField tree, and run opens a window and mounts it.

gtk Cross-platform

Typed GTK 4 bindings for native Linux desktop apps: application lifecycle, windows, widgets, controls, containers, dialogs, and closure-free signal handlers.

adwaita Linux / GTK

libadwaita 1 bindings for Linux — GNOME's adaptive widgets, boxed-list preferences, in-app toasts, and light/dark recoloring, layered on top of gtk.

win32 Windows

Native Win32 GUI bindings for Windows: top-level windows, the common controls, menu bars, message + file dialogs, and GDI painting — direct extern calls to the always-present system DLLs.

agent_win32 Windows

The Windows GUI backend for the agent surface: open(window) walks a live HWND tree into a Surface, describe() returns a UiNode snapshot, and authorized click / set_text / focus run through the agent_core brain.

agent_gtk Linux / GTK

The GTK 4 GUI backend for the agent surface: open(window) walks a live GtkWidget tree into a Surface, describe() returns a UiNode snapshot, and authorized click / set_text / focus run through the agent_core brain.