C+
Archived manual for C+ v0.0.27. 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).

v0.0.27 is a macOS / AppKit release. Start here:

  • appkit — typed Cocoa / AppKit bindings for native macOS apps.
  • quartzcore — generated Core Animation (CALayer).
  • facet — platform-free UI: @ui trees, components, screens, App, theme, services. A backend draws.
  • facet_appkit — macOS AppKit backend (install(), then App::run).
  • flex_layout — CSS Flexbox + Grid. facet's tree is this tree.
  • agent_appkit — live NSView tree → agent surface.
  • agent_core — the framework-agnostic authorization brain.
  • agent_mcp — the JSON-RPC 2.0 / MCP bridge.
  • agent_inapp — the same verbs in-process, no transport.
  • inspector — developer-only live inspector of the mounted facet tree. Not the agent surface.

See Agent surface for the full agent story.

In the tree, wait

These packages exist. They are not recommended on v0.0.27. Do not ship on them; wait for a later version.

  • uikit — typed UIKit bindings for native iOS apps.
  • gtk — generated GTK 4 (gtk4 package).
  • adwaita — generated libadwaita 1, over gtk4.
  • gobject — GObject runtime, signals, and the string bridge.
  • facet_gtk — GTK 4 backend (type-checked; not run on a Linux host).
  • win32 — native Win32 GUI bindings.
  • agent_gtk — the GTK agent backend.
  • agent_win32 — the Win32 agent backend.
  • android_view — Android View bindings.
  • jni — Java Native Interface bindings (the full JNI 1.6 table).

The generated GObject stack also ships glib, gio, cairo, pango, gdk, and related peers. Import them by package name ("glib/glib", "gio/gio", …); they do not each have a site page.

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

  • json — a typed-enum JSON parser and serializer.
  • log — a leveled, zero-allocation structured logger.
  • uuid — RFC 4122 v4 UUIDs.
  • sqlite — idiomatic SQLite (Connection / Statement).
  • 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 36 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.

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 UI framework: describe a live flex tree in @ui builder blocks. A backend draws it. Updates are keyed and direct; there is no re-render.

facet_appkit Apple

The macOS AppKit backend for facet: install() fills the Renderer vtable, then App::run mounts a window and drives the event loop.

gtk4 Linux / GTK

Generated GTK 4 bindings from GObject Introspection: Application, widgets, and the rest of the Gtk-4.0 namespace as one module.

adwaita Linux / GTK

Generated libadwaita 1 bindings over gtk4: Application, ApplicationWindow, and the Adw-* widget set from Adw-1.gir.

flex_layout Facet UI

Pure-C+ CSS Flexbox and CSS Grid: a Node tree, calculate_layout, absolute Frames. Optional @flex DSL and caller-named breakpoints.

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.

sqlite Cross-platform

Idiomatic SQLite: Connection and Statement, Result errors, owned column text. Drop closes and finalizes.

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.

quartzcore Apple

Generated QuartzCore / Core Animation bindings: CALayer so NSView.layer() is a typed object, not a stub.

inspector Facet UI

Developer-only live inspector of the mounted facet tree: declared and computed props, structural edit, highlight overlay. Not the agent surface.

agent_inapp Agent

The agent surface in-process: the same backend verbs as MCP, no transport and no authorization. The binary already trusts itself.

facet_gtk Linux / GTK

facet's GTK 4 backend: the same Renderer vtable as facet_appkit. Type-checked against gtk4; not yet run on a Linux host.

gobject Linux / GTK

GObject runtime for generated GTK/GIR bindings: handles, signals, and the string bridge. The Linux analog of objc.