01 / std/binary_linux.zi
binary_linux
Little-endian binary fields for native Linux programs. No file format or application record layout is imposed by this module.
Import with #import "binary_linux" and pass --module-path std.
ReadU64LE :: (bytes: []u8, at: s32) -> u64WriteU64LE :: (bytes: []u8, at: s32, value: u64) -> boolReadF64LE :: (bytes: []u8, at: s32) -> float64WriteF64LE :: (bytes: []u8, at: s32, value: float64) -> bool02 / std/bundle_host.zi
bundle_host
Native C ABI for embedding a portable Ziran bundle. The runtime owns the bundle and instance; callers own binding contexts and borrowed result data.
Import with #import "bundle_host" and pass --module-path std.
HostValueKind :: enum { HostVoid = 0; HostInteger = 1; HostUnsigned = 2; HostReal = 3; HostString = 4; HostRecord = 5; HostSlice = 6; HostPointer = 7; HostArray = 8; }HostValue :: struct { kind: s32; type_name: *u8; integer: s64; bits: u64; real: float64; data: *u8; length: u64; fields: *HostField; field_count: u64; elements: *HostValue; pointer: *void; }HostField :: struct { name: *u8; value: HostValue; }HostCall :: #type (context: *void, module: *u8, function: *u8, arguments: *HostValue, count: s32, result: *HostValue) -> s32HostBinding :: struct { module: *u8; function: *u8; call: HostCall; context: *void; }OpenBundle :: (path: *u8) -> *voidCloseBundle :: (bundle: *void)InstantiateBundle :: (bundle: *void, bindings: *HostBinding, count: u64) -> *voidRunBundleInstance :: (instance: *void, result: *s64, has_result: *s32) -> s32CloseBundleInstance :: (instance: *void)03 / std/byte_text_linux.zi
byte_text_linux
Borrow UTF-8 bytes as a Ziran string at native foreign-function boundaries. The caller must keep the byte storage alive while the string is in use.
Import with #import "byte_text_linux" and pass --module-path std.
TextDescriptor :: struct { data: *u8; length: usize; }ByteDescriptor :: struct { data: *u8; length: s64; }TextFromBytes :: (buffer: []u8) -> stringBytesFromPointer :: (data: *u8, count: u64) -> []u8Borrow native storage at a foreign-function boundary. The caller must keep it allocated and writable throughout the slice's use.
TextFromCString :: (value: *u8) -> stringThe returned string borrows the C buffer and retains its lifetime.
04 / std/c_string.zi
c_string
Copies a borrowed Ziran string into caller-owned, NUL-terminated storage. Reject embedded NUL bytes and insufficient capacity before exposing the buffer to a native C API.
Import with #import "c_string" and pass --module-path std.
CopyCString :: (value: string, output: []u8) -> bool05 / std/constant_time.zi
constant_time
Constant-time equality for caller-owned byte spans. The length check is intentionally explicit; callers protecting secret tags should use fixed-size buffers so unequal lengths do not become an oracle.
Import with #import "constant_time" and pass --module-path std.
ConstantTimeEqual :: (left: []u8, right: []u8) -> boolConstantTimeTextEqual :: (left: string, right: string) -> boolText carries arbitrary bytes without a mutable borrowed view. Compare every byte of equal-length tags just as for caller-owned byte spans.
06 / std/date_parse.zi
date_parse
UTC calendar parsing for feeds and dated data sources.
Import with #import "date_parse" and pass --module-path std.
DateDigit :: (value: u8) -> s32DateNumber :: (value: string, start: s32, count: s32) -> s32DaysFromCivil :: (year: s32, month: s32, day: s32) -> s64DateValid :: (year: s32, month: s32, day: s32) -> boolUtcDate :: struct { year: s32; month: s32; day: s32; hour: s32; minute: s32; second: s32; }CivilFromUnix :: (timestamp: s64) -> UtcDateDateWriteDigits :: (output: []u8, at: s32, value: s32, digits: s32) -> s32WriteCompactUtc :: (timestamp: s64, output: []u8) -> s32WriteIsoDay :: (timestamp: s64, output: []u8) -> s32UtcSeconds :: (year: s32, month: s32, day: s32, hour: s32, minute: s32, second: s32) -> s64ParseCompactUtc :: (value: string) -> s64DateMonth :: (value: string, at: s32) -> s32ParseRfc822Utc :: (value: string) -> s6407 / std/date_time.zi
date_time
Import with #import "date_time" and pass --module-path std.
LocalDateTime :: struct { year: s32; month: s32; day: s32; day_of_year: s32; hour: s32; minute: s32; second: s32; valid: bool; }The host supplies local civil time, including timezone and daylight-saving decisions. day_of_year is zero-based, matching the platform tm convention.
LocalNow :: () -> LocalDateTimeNeeds a host capability.
UnixNow :: () -> s64Needs a host capability.
08 / std/date_time_linux.zi
date_time_linux
Unix clock for native Linux programs.
Import with #import "date_time_linux" and pass --module-path std.
UnixNow :: () -> s6409 / std/file_linux.zi
file_linux
Import with #import "file_linux" and pass --module-path std.
FileHandle :: struct { fd: s32; valid: bool; }OpenRead :: (path: string) -> FileHandleOpenUpdate :: (path: string) -> FileHandleOpenReplace :: (path: string) -> FileHandleOpenExclusivePrivate :: (path: string) -> FileHandleRemoveFile :: (path: string) -> boolPathExists :: (path: string) -> boolDirectoryExists :: (path: string) -> boolRenamePath :: (source: string, destination: string) -> boolRenameNoReplace :: (source: string, destination: string) -> boolLinkFile :: (source: string, destination: string) -> boolCreateDirectory :: (path: string) -> boolCreatePrivateDirectory :: (path: string) -> boolFileSize :: (file: FileHandle) -> s64ReadAt :: (file: FileHandle, output: []u8, offset: s64) -> s64WriteAt :: (file: FileHandle, input: []u8, offset: s64) -> s64WriteTextAt :: (file: FileHandle, input: string, offset: s64) -> s64Copy immutable text through a bounded buffer before writing it. The string may borrow read-only storage, so it must not be exposed as a mutable slice.
CloseFile :: (file: FileHandle) -> boolSyncFile :: (file: FileHandle) -> bool10 / std/hmac_sha256_go.zi
hmac_sha256_go
Import with #import "hmac_sha256_go" and pass --module-path std.
DigestResult :: struct { value: string; error: string; }HMACSHA256 :: (key: []u8, message: string) -> DigestResultHMAC over arbitrary text bytes. SHA-256 itself comes from Go's crypto package; this module owns only RFC 2104's key normalization and pads.
11 / std/http_get_linux.zi
http_get_linux
Import with #import "http_get_linux" and pass --module-path std.
GetHttps :: (url: string, output: []u8) -> CaptureResultNative HTTPS GET. curl owns TLS and redirects; the caller owns storage.
12 / std/json_scan.zi
json_scan
Import with #import "json_scan" and pass --module-path std.
JsonSpan :: struct { start: s32; end: s32; after: s32; valid: bool; }A small allocation-free JSON scanner. Positions are UTF-8 byte offsets. String spans retain escapes; member lookup matches unescaped ASCII names.
JsonNumber :: struct { value: float64; after: s32; valid: bool; }Space :: (text: string, at: s32) -> s32Digit :: (ch: u8) -> boolHex :: (ch: u8) -> boolReadString :: (text: string, at: s32) -> JsonSpanSpanEqualsASCII :: (text: string, span: JsonSpan, expected: string) -> boolSpanContainsFoldASCII :: (text: string, span: JsonSpan, needle: string) -> boolReadNumber :: (text: string, at: s32) -> JsonNumberMatchLiteral :: (text: string, at: s32, literal: string) -> boolValueEnd :: (text: string, at: s32, depth: s32) -> s32FieldAt :: (text: string, object_at: s32, name: string) -> s32ElementAt :: (text: string, array_at: s32, index: s32) -> s32ArrayCount :: (text: string, array_at: s32) -> s3213 / std/mapped_file_linux.zi
mapped_file_linux
Import with #import "mapped_file_linux" and pass --module-path std.
MappedFile :: struct { data: *u8; length: u64; valid: bool; }MapPrivate :: (path: string) -> MappedFileMappedBytes :: (file: MappedFile) -> []u8UnmapFile :: (file: MappedFile) -> bool14 / std/math.zi
math
Portable float32 helpers for native and bundled Ziran programs.
Import with #import "math" and pass --module-path std.
Finite32 :: (value: float32) -> boolFloorInteger :: (value: float32) -> s32CeilInteger :: (value: float32) -> s32SineDegrees :: (degrees: float32) -> float32Reduce to [-pi/2, pi/2] before the Taylor polynomial.
CosineDegrees :: (degrees: float32) -> float3215 / std/net_http.zi
net_http
Import with #import "net_http" and pass --module-path std.
HttpHeader :: struct { name: string; value: string; }Network transport is an explicit host capability. The host adds a Bearer Authorization header when token is nonempty. It must not log that token. The request and response records have the same meaning in native targets and portable bundles.
HttpRequest :: struct { method: string; url: string; token: string; accept: string; content_type: string; body: string; headers: []HttpHeader; }HttpResponse :: struct { status: s32; body: string; error: string; }Send :: (request: HttpRequest) -> HttpResponseNeeds a host capability.
16 / std/net_http_curl_linux.zi
net_http_curl_linux
Import with #import "net_http_curl_linux" and pass --module-path std.
CurlInitRoutine :: #type ()CurlUrl :: 10002CurlMethod :: 10036CurlWriteData :: 10001CurlWriteFunction :: 20011CurlHeaders :: 10023CurlPostFields :: 10015CurlPostSize :: 30120CurlTimeoutMs :: 155CurlConnectTimeoutMs :: 156CurlNoSignal :: 99CurlResponseCode :: 2097154curl_once: s32curl_init_result: s32InitCurl :: ()CurlReady :: () -> boolStartsWith :: (value: string, prefix: string) -> boolMethodToken :: (value: string) -> boolHeaderName :: (value: string) -> boolCurlResult :: struct { status: s32; length: s64; code: s32; truncated: bool; }CurlOutput :: struct { data: *u8; capacity: s64; length: s64; truncated: bool; }CurlWriteCallback64 :: #type (data: *u8, size: u64, count: u64, user: *void) -> u64CurlWriteCallback32 :: #type (data: *u8, size: u32, count: u32, user: *void) -> u32AppendCurlOutput :: (data: *u8, size: u64, count: u64, context: *CurlOutput) -> u64CurlWrite64 :: (data: *u8, size: u64, count: u64, user: *void) -> u64CurlWrite32 :: (data: *u8, size: u32, count: u32, user: *void) -> u32SetCurlLong :: (handle: *void, option: s32, value: s32) -> boolReadCurlStatus :: (handle: *void) -> s32HeaderText :: (prefix: string, value: string, output: []u8) -> boolAddCurlHeader :: (headers: **void, prefix: string, value: string, buffer: []u8) -> boolAddNamedHeader :: (headers: **void, name: string, value: string, buffer: []u8) -> boolSendCurl :: (request: HttpRequest, output: []u8) -> CurlResultThe caller owns output. It remains NUL terminated, including on failure. HTTP errors retain their status and body for protocol-level decisions.
17 / std/net_http_linux.zi
net_http_linux
Import with #import "net_http_linux" and pass --module-path std.
PostJson :: (url: string, body: string, output: []u8) -> CaptureResultNative HTTPS JSON transport. curl owns TLS and HTTP framing; Ziran owns the request arguments and caller-provided response buffer.
18 / std/net_ws_curl_linux.zi
net_ws_curl_linux
Blocking, bounded WebSocket text receive for native libcurl hosts. The protocol consumer owns URL construction and JSON validation.
Import with #import "net_ws_curl_linux" and pass --module-path std.
CurlWsFrame :: struct { age: s32; flags: s32; offset: s64; bytes_left: s64; length: u64; }PollDescriptor :: struct { fd: s32; events: s16; returned: s16; }CurlConnectOnly :: 141CurlActiveSocket :: 5242924CurlAgain :: 81CurlWsText :: 1CurlWsContinue :: 4CurlWsClose :: 8PollRead :: 1Output is NUL terminated on success. status is 401 on an unauthorized
ReceiveWebSocketCurl :: (context: *void, url: string, token: string, output: []u8, status: *s32) -> bool19 / std/number_text.zi
number_text
Import with #import "number_text" and pass --module-path std.
FormatInteger :: (value: s64, output: []u8) -> stringA whole number in base ten. The buffer needs 21 bytes for any s64.
FormatDecimal :: (value: float64, places: s32, output: []u8) -> stringA number rounded to `places` digits after the point (at most 9), with trailing zeros dropped: 0.5, 12, -3.25. The buffer needs 32 bytes.
20 / std/option.zi
option
Import with #import "option" and pass --module-path std.
Option :: struct($T: Type) { has_value: bool; value: T; }21 / std/pair.zi
pair
Import with #import "pair" and pass --module-path std.
Pair :: struct($A: Type, $B: Type) { first: A; second: B; }22 / std/process.zi
process
Import with #import "process" and pass --module-path std.
ProcessRequest :: struct { executable: string; cwd: string; stdin: string; credential_name: string; credential_value: string; isolate_desktop: bool; timeout_ms: s64; }A line-oriented child-process capability. The host receives explicit arguments, stdin, and one optional secret environment binding. Hosts must honor isolate_desktop before starting any child. Handles are host-owned; callers consume lines and then wait exactly once.
ProcessStart :: struct { handle: s32; error: string; }ProcessLine :: struct { text: string; eof: bool; error: string; }ProcessExit :: struct { code: s32; stderr: string; error: string; }Start :: (request: ProcessRequest, args: []string) -> ProcessStartNeeds a host capability.
NextLine :: (handle: s32) -> ProcessLineNeeds a host capability.
Wait :: (handle: s32) -> ProcessExitNeeds a host capability.
23 / std/process_capture_linux.zi
process_capture_linux
Import with #import "process_capture_linux" and pass --module-path std.
CapturePointer :: struct { value: *u8; }CaptureArgument :: struct { bytes: [4096]u8; }CaptureResult :: struct { code: s32; length: s32; error: bool; truncated: bool; }CaptureOutput :: (arguments: []string, output: []u8) -> CaptureResult24 / std/queue.zi
queue
Allocation-free bounded FIFO queue over caller-owned byte storage. Queue state is passed and returned by value; every operation receives the backing bytes explicitly so their lifetime remains visible to the caller.
Import with #import "queue" and pass --module-path std.
BoundedQueue :: struct { capacity: s64; head: s64; count: s64; }QueueByte :: struct { queue: BoundedQueue; valid: bool; value: u8; }QueueBytes :: struct { queue: BoundedQueue; count: s64; }QueueStart :: (storage: []u8) -> BoundedQueueQueueCapacity :: (queue: BoundedQueue) -> s64QueueCount :: (queue: BoundedQueue) -> s64QueuePush :: (queue: BoundedQueue, storage: []u8, value: u8) -> BoundedQueueQueuePushBytes :: (queue: BoundedQueue, storage: []u8, input: []u8) -> BoundedQueueQueuePop :: (queue: BoundedQueue, storage: []u8) -> QueueByteQueuePopBytes :: (queue: BoundedQueue, storage: []u8, output: []u8) -> QueueBytesQueueClear :: (queue: BoundedQueue) -> BoundedQueue25 / std/random_linux.zi
random_linux
Secure operating-system randomness for native Linux programs. The caller owns the destination bytes and no fallback generator is permitted.
Import with #import "random_linux" and pass --module-path std.
FillSecure :: (output: []u8) -> bool26 / std/result.zi
result
Import with #import "result" and pass --module-path std.
Result :: struct($T: Type, $E: Type) { is_ok: bool; value: T; error: E; }27 / std/rss_scan.zi
rss_scan
Import with #import "rss_scan" and pass --module-path std.
FeedSpan :: struct { start: s32; end: s32; after: s32; valid: bool; }FeedMatch :: (document: string, at: s32, needle: string) -> boolFeedFind :: (document: string, from: s32, needle: string) -> s32FeedNextItem :: (document: string, from: s32) -> FeedSpanFeedTag :: (document: string, item: FeedSpan, tag: string) -> FeedSpanFeedEntity :: (document: string, at: s32, end: s32, output: *u8) -> s32FeedCopyText :: (document: string, span: FeedSpan, output: []u8) -> s32Copies a text or CDATA field into caller-owned storage. Tags in summaries become spaces, and a malformed/truncated field is rejected.
28 / std/socket_linux.zi
socket_linux
Bounded, cancellation-aware TCP client sockets for native Linux programs. The caller supplies a literal IPv4 address; this module performs no DNS, HTTP, TLS, or plaintext-protocol fallback.
Import with #import "socket_linux" and pass --module-path std.
LinuxSocket :: struct { fd: s32; valid: bool; error: s32; }LinuxSocketEvent :: struct { ready: s32; error: s32; }LinuxSocketAddress :: struct { family: u16; port: u16; address: u32; zero: [8]u8; }LinuxPollFd :: struct { fd: s32; events: s16; revents: s16; }LinuxErrno :: () -> s32SocketWaitForEvents :: (socket: LinuxSocket, events: s32, timeout_ms: s32) -> LinuxSocketEventSocketConnectError :: (socket: LinuxSocket) -> s32OpenTCPv4 :: (address: [4]u8, port: u16, timeout_ms: s32) -> LinuxSocketSocketCancel :: (socket: LinuxSocket) -> boolSocketSendAll :: (socket: LinuxSocket, input: []u8, timeout_ms: s32) -> s64SocketReceive :: (socket: LinuxSocket, output: []u8, timeout_ms: s32) -> s64SocketClose :: (socket: *LinuxSocket) -> bool29 / std/sort.zi
sort
Sorting and searching for slices of any type ordered by the < operator. Sorting is an in-place heapsort: O(n log n) comparisons, no allocation, no recursion, and not stable.
Import with #import "sort" and pass --module-path std.
Sort :: (values: []$T)Sorts values in ascending order.
IsSorted :: (values: []$T) -> boolReports whether values are in ascending order.
LowerBound :: (values: []$T, target: T) -> s64Returns the first index whose value is not less than target, or values.count when every value is less. values must be sorted.
BinarySearch :: (values: []$T, target: T) -> s64Returns an index holding target, or -1 when values has none. values must be sorted.
30 / std/string_range.zi
string_range
A byte range of an immutable borrowed string. Bounds are checked by Ziran. Callers working with UTF-8 text should choose codepoint boundaries.
Import with #import "string_range" and pass --module-path std.
Substring :: (source: string, start: s32, length: s32) -> string31 / std/text.zi
text
ASCII-only case folding keeps the result identical across native targets and the portable runner. UTF-8 bytes outside ASCII compare unchanged.
Import with #import "text" and pass --module-path std.
LowerASCII :: (value: u8) -> u8StartsWithFoldASCII :: (value: string, prefix: string) -> boolContainsFoldASCII :: (value: string, needle: string) -> bool32 / std/text_buffer.zi
text_buffer
Bounded NUL-terminated byte buffer to borrowed text. The caller keeps the buffer alive until the returned view is no longer used.
Import with #import "text_buffer" and pass --module-path std.
TextUntilNul :: (buffer: []u8) -> string33 / std/timer_linux.zi
timer_linux
Monotonic timing and interruptible sleeps for native glibc Linux programs. Wall-clock time is intentionally unavailable from this module.
Import with #import "timer_linux" and pass --module-path std.
ClockValue :: struct { seconds: s64; nanoseconds: s64; }MonotonicMilliseconds :: () -> s64MakeClockValue :: (milliseconds: s64) -> ClockValueSleepMilliseconds :: (milliseconds: s64) -> bool34 / std/update.zi
update
Import with #import "update" and pass --module-path std.
Artifact :: struct { url: [512]u8; sha256: [65]u8; size: s64; available: bool; }Release metadata and version decisions are portable. Downloading and installing an artifact remain explicit host operations.
Appcast :: struct { version: [32]u8; notes_url: [512]u8; artifact: Artifact; valid: bool; }CompareVersions :: (left: string, right: string) -> s32ParseAppcast :: (json: string, channel: string) -> AppcastSelect one channel from the release manifest. A missing channel still yields a valid appcast: package-managed installs show the release page.
35 / std/utf8.zi
utf8
Advance one Unicode scalar in an immutable UTF-8 string. An invalid byte advances by one so callers always make progress and never split a valid multibyte sequence.
Import with #import "utf8" and pass --module-path std.
Continuation :: (byte: u8) -> boolDecoded :: struct { value: u32; after: s32; valid: bool; }Decode :: (text: string, at: s32) -> DecodedDecode one scalar. A malformed sequence consumes its lead byte and yields U+FFFD so callers can continue scanning without splitting valid text.
Next :: (value: string, at: s32) -> s32Count :: (value: string) -> s3236 / std/vec.zi
vec
Owned growable storage. Operations on Vec values are compiler primitives; the data pointer is private to those operations.
Import with #import "vec" and pass --module-path std.
Vec :: struct($T: Type) { data: *T; count: s64; capacity: s64; }37 / std/web.zi
web
Browser access for Ziran code compiled to WebAssembly. Any Web API is reachable through objects held in the page's handle table: read and write properties, call methods, construct objects, pass Ziran functions as callbacks, and wait on promises. The page side is web/ziran_web.js. A handle is an s32; 0 means null or undefined, 1 is the global object, and 2 is Emscripten's Module. Names are interned once with WebName and reused, which keeps each call cheap. Handles the bridge returns are temporary: they all die when the current scope ends. A callback is its own scope; a long-running loop should wrap each pass in WebScope and WebEnd. WebKeep turns a temporary handle into one that lasts until WebRelease, for objects a program holds on to.
Import with #import "web" and pass --module-path std.
WebValue :: struct { tag: s32; aux: s32; number: float64; }A value crossing the boundary: a tag, a length or handle, and a number.
WebUndefinedTag :: 0WebNullTag :: 1WebBoolTag :: 2WebNumberTag :: 3WebTextTag :: 4WebObjectTag :: 5WebStringTag :: 6WebGlobal :: 1WebModule :: 2WebBytesUint8 :: 0The kinds of typed array WebBytes builds.
WebBytesUint8Clamped :: 1WebBytesInt16 :: 2WebBytesInt32 :: 3WebBytesFloat32 :: 4WebTypeUndefined :: 0What WebTypeOf reports.
WebTypeNull :: 1WebTypeBool :: 2WebTypeNumber :: 3WebTypeString :: 4WebTypeObject :: 5WebTypeFunction :: 6Receives a JS function's first three arguments as handles that are valid
WebCallback :: #type (context: s32, first: s32, second: s32, third: s32)web_failed: boolWebName :: (text: string) -> s32Interns a name for property and method access. Do this once per name.
WebUndefined :: () -> WebValueWebNull :: () -> WebValueWebBool :: (value: bool) -> WebValueWebNumber :: (value: float64) -> WebValueWebText :: (text: string) -> WebValueThe text is read while the call it is passed to runs, so it must stay alive until then.
WebObject :: (handle: s32) -> WebValueWebAsNumber :: (value: WebValue) -> float64WebAsBool :: (value: WebValue) -> boolWebAsObject :: (value: WebValue) -> s32The handle of an object or string result, or 0.
WebIsUndefined :: (value: WebValue) -> boolWebFailed :: () -> boolWhether the last property access, call, or construction threw. The exception is WebLastError.
WebLastError :: () -> s32WebGet :: (object: s32, name: s32) -> WebValueWebGetNumber :: (object: s32, name: s32) -> float64WebGetObject :: (object: s32, name: s32) -> s32WebSet :: (object: s32, name: s32, value: WebValue)WebAt :: (object: s32, index: s32) -> WebValueWebSetAt :: (object: s32, index: s32, value: WebValue)WebCall :: (object: s32, name: s32, args: *WebValue, count: s32) -> WebValueWebCall0 :: (object: s32, name: s32) -> WebValueWebCall1 :: (object: s32, name: s32, a: WebValue) -> WebValueWebCall2 :: (object: s32, name: s32, a: WebValue, b: WebValue) -> WebValueWebCall3 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue) -> WebValueWebCall4 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue) -> WebValueWebCall5 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue) -> WebValueWebCall6 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue, f: WebValue) -> WebValueWebCall8 :: (object: s32, name: s32, a: WebValue, b: WebValue, c: WebValue, d: WebValue, e: WebValue, f: WebValue, g: WebValue, h: WebValue) -> WebValueWebNew :: (constructor: s32, args: *WebValue, count: s32) -> s32Constructs `new constructor(args...)`; returns the new object's handle.
WebNew0 :: (constructor: s32) -> s32WebNew1 :: (constructor: s32, a: WebValue) -> s32WebNew2 :: (constructor: s32, a: WebValue, b: WebValue) -> s32WebNew3 :: (constructor: s32, a: WebValue, b: WebValue, c: WebValue) -> s32WebValueOf :: (handle: s32) -> WebValueThe value a handle holds, such as the number a callback argument carries.
WebNewObject :: () -> s32WebNewArray :: () -> s32WebRelease :: (handle: s32)Frees a handle made by WebKeep or WebFunction. Temporary handles need no release.
WebScope :: () -> s32Starts a scope; WebEnd(mark) frees every temporary handle made since.
WebEnd :: (mark: s32)WebKeep :: (handle: s32) -> s32A handle to the same object that lasts until WebRelease, unlike the temporary one it came from.
WebLiveHandles :: () -> s32How many handles are live, for checking a program does not leak them.
WebTypeOf :: (handle: s32) -> s32WebInstanceOf :: (handle: s32, constructor: s32) -> boolWebFunction :: (callback: WebCallback, context: s32) -> s32A JS function that runs `callback` with `context` and up to three argument handles, kept until released.
WebStringLength :: (handle: s32) -> s32The length in bytes of a string handle's text.
WebCopyString :: (handle: s32, buffer: []u8) -> s32Copies a string handle's text into `buffer`, NUL-terminated, and returns its length in bytes.
WebBytes :: (kind: s32, data: *void, count: s32) -> s32A typed array holding a copy of `count` elements from `data`.
WebCopyOut :: (handle: s32, data: *void, capacity: s32) -> s32Copies a typed array's bytes into `data`, at most `capacity`; returns the number copied.
WebCopyIn :: (handle: s32, data: *void, length: s32) -> s32Copies `length` bytes from `data` over the start of a typed array.
WebAwait :: (promise: s32, result: *WebValue) -> boolSuspends until the promise settles. Returns whether it resolved, with its value in `result`.
WebSleep :: (milliseconds: s32)WebNextFrame :: (minimum_delay: float64)Suspends until the browser draws its next frame, and at least `minimum_delay` milliseconds have passed.
38 / std/zip.zi
zip
Classic ZIP directory reader for byte buffers. The caller owns the archive bytes and decides which named entries are allowed in its application. ZIP64, encrypted entries, split archives, and ambiguous names are rejected.
Import with #import "zip" and pass --module-path std.
ZipEntry :: struct { data_start: u64; compressed_size: u64; size: u64; crc32: u32; method: u32; found: bool; }ZipDirectory :: struct { start: u64; end: u64; cursor: u64; count: u64; index: u64; valid: bool; }ZipNamedEntry :: struct { directory: ZipDirectory; entry: ZipEntry; name_start: u64; name_size: u64; valid: bool; }ZipWriteItem :: struct { name_start: u64; name_size: u64; data_start: u64; data_size: u64; }ZipU16 :: (bytes: []u8, at: u64) -> u32ZipU32 :: (bytes: []u8, at: u64) -> u32ZipNameEqual :: (bytes: []u8, at: u64, size: u64, wanted: string) -> boolOpenZipDirectory :: (bytes: []u8) -> ZipDirectoryZipNamesMatch :: (bytes: []u8, first: u64, second: u64, size: u64) -> boolNextZipEntry :: (bytes: []u8, directory: ZipDirectory) -> ZipNamedEntryOn malformed input, both the returned record and the cursor become invalid.
FindZipEntry :: (bytes: []u8, wanted: string) -> ZipEntryA missing or invalid entry has found=false. Duplicate names are invalid.
ZipCRC32Update :: (crc_start: u32, bytes: []u8) -> u32ZipCRC32 :: (bytes: []u8) -> u32CopyStoredZipEntry :: (bytes: []u8, entry: ZipEntry, output: []u8) -> boolZipPut16 :: (output: []u8, at: u64, value: u32)ZipPut32 :: (output: []u8, at: u64, value: u32)StoredZipSize :: (input: []u8, items: []ZipWriteItem) -> u64Returns the exact output size or zero when classic ZIP limits are exceeded.
ZipCopyBytes :: (output: []u8, at: u64, input: []u8, input_at: u64, size: u64)ZipCRC32Range :: (bytes: []u8, at: u64, size: u64) -> u32WriteStoredZip :: (output: []u8, input: []u8, items: []ZipWriteItem) -> u64Writes uncompressed ZIP entries into caller-owned memory. An app can choose compression separately; this keeps the archive format portable and usable even where no native compression library is installed.
39 / std/zip_file_linux.zi
zip_file_linux
Import with #import "zip_file_linux" and pass --module-path std.
ZipFileRecord :: struct { local_offset: u64; size: u64; name_size: u32; crc32: u32; valid: bool; }ZipFilePut16 :: (bytes: []u8, at: s32, value: u32)ZipFilePut32 :: (bytes: []u8, at: s32, value: u32)ZipFileWriteAll :: (file: FileHandle, bytes: []u8, at: u64) -> boolZipFileWriteName :: (file: FileHandle, name: string, at: u64) -> boolWriteStoredZipFileEntry :: (file: FileHandle, at: u64, name: string, data: []u8) -> ZipFileRecordStoredZipFileNext :: (record: ZipFileRecord) -> u64WriteStoredZipFileDirectoryEntry :: (file: FileHandle, at: u64, name: string, record: ZipFileRecord) -> u64FinishStoredZipFile :: (file: FileHandle, directory_start: u64, directory_end: u64, count: u32) -> bool40 / std/zip_linux.zi
zip_linux
Import with #import "zip_linux" and pass --module-path std.
ZStream :: struct { next_in: *u8; avail_in: u32; total_in: usize; next_out: *u8; avail_out: u32; total_out: usize; msg: *u8; state: *void; zalloc: *void; zfree: *void; opaque: *void; data_type: s32; adler: usize; reserved: usize; }ExtractZipEntry :: (archive: []u8, entry: ZipEntry, output: []u8) -> boolZipExtractWriteAll :: (file: FileHandle, bytes: []u8, offset: u64) -> boolExtractZipEntryToFile :: (archive: []u8, entry: ZipEntry, file: FileHandle) -> bool