01 / std/atomic_go.zi
atomic_go
Go unsigned 64-bit atomic counters. Keep counters in shared storage and pass their addresses.
Import with #import "atomic_go" and pass --module-path std.
Uint64 :: structAdd :: (value: *Uint64, delta: u64) -> u64Load :: (value: *Uint64) -> u6402 / 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) -> bool03 / 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)04 / 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.
05 / 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) -> bool06 / std/calendar.zi
calendar
Import with #import "calendar" and pass --module-path std.
LeapYear :: (year: s32) -> boolDaysInMonth :: (year: s32, month: s32) -> s32DayOfWeek :: (year: s32, month: s32, day: s32) -> s32Sunday is zero. Gregorian arithmetic avoids mktime's timezone changes when asking for the weekday of a calendar date.
DayOfYear :: (year: s32, month: s32, day: s32) -> s32DateTimeValid :: (value: LocalDateTime) -> boolFormatDateTime :: (value: LocalDateTime, pattern: string, output: []u8) -> stringLocale-independent English names and common strftime-style civil tokens. Unsupported tokens, invalid readings, or insufficient space return an empty view and clear output[0]. A successful result is NUL-terminated.
07 / std/channel_go.zi
channel_go
Native Go channels with runtime element types. Keep the reflective channel value as the handle; Interface supplies its native value to select_go.
Import with #import "channel_go" and pass --module-path std.
Channel :: structElementType :: structDirection :: structNew :: (element: Any, capacity: isize) -> ChannelInterface :: (channel: Channel) -> AnyTrySend :: (channel: Channel, value: Any) -> boolClose :: (channel: Channel)08 / 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.
09 / std/context_go.zi
context_go
Native Go contexts retain cancellation, deadlines and interface identity.
Import with #import "context_go" and pass --module-path std.
Context :: structCancelFunc :: structCancellation :: struct { value: Context; cancel: CancelFunc; }Background :: () -> ContextCanceled :: () -> ErrorDeadlineExceeded :: () -> ErrorDone :: (value: Context) -> AnyWithCancel :: (value: Context) -> CancellationWithTimeout :: (value: Context, duration: clock.Duration) -> CancellationCancel :: (callback: CancelFunc)10 / 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) -> s6411 / std/date_time.zi
date_time
Import with #import "date_time" and pass --module-path std.
LocalNow :: () -> LocalDateTimeNeeds a host capability.
UnixNow :: () -> s64Needs a host capability.
12 / std/date_time_linux.zi
date_time_linux
Import with #import "date_time_linux" and pass --module-path std.
UnixNow :: () -> s64UnixMilliseconds :: () -> s64LocalAt :: (seconds: s64) -> LocalDateTimeUtcAt :: (seconds: s64) -> LocalDateTimeLocalNow :: () -> LocalDateTime13 / std/date_time_plan9.zi
date_time_plan9
Import with #import "date_time_plan9" and pass --module-path std.
UnixNow :: () -> s64UnixMilliseconds :: () -> s64Plan 9 libc interprets the signed long argument as an unsigned 32-bit epoch count. Preserve its full 1970..2106 range, including after 2038,
LocalAt :: (seconds: s64) -> LocalDateTimePlan 9 libc interprets the signed long argument as an unsigned 32-bit epoch count. Preserve its full 1970..2106 range, including after 2038, and reject seconds outside that range instead of silently wrapping.
UtcAt :: (seconds: s64) -> LocalDateTimeLocalNow :: () -> LocalDateTime14 / std/date_time_types.zi
date_time_types
A local or UTC civil clock reading. Months and days are one-based; day_of_year is zero-based. Timezone rules belong to the clock provider.
Import with #import "date_time_types" 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; }15 / std/ed25519_go.zi
ed25519_go
Ed25519 keys and signatures retain Go's native types and validation behavior.
Import with #import "ed25519_go" and pass --module-path std.
PublicKey :: structPrivateKey :: structKeyPairResult :: struct { publicKey: PublicKey; privateKey: PrivateKey; error: Error; }GenerateKey :: () -> KeyPairResultNewKeyFromSeed :: (seed: []u8) -> PrivateKeySign :: (key: PrivateKey, message: []u8) -> []u8Verify :: (key: PublicKey, message: []u8, signature: []u8) -> boolEqual :: (key: PublicKey, other: PublicKey) -> bool16 / std/errors_go.zi
errors_go
Native Go error creation, identity, wrapping and exact error messages.
Import with #import "errors_go" and pass --module-path std.
New :: (message: string) -> ErrorIs :: (error: Error, target: Error) -> boolUnwrap :: (error: Error) -> ErrorMessage :: (error: Error) -> string17 / std/file.zi
file
Files on every native C target under one import: Linux, Android, the web, and Windows use file_linux, and Plan 9 (--target=plan9-c defines PLAN9) uses file_plan9. Both provide OpenRead, OpenWrite, OpenUpdate, OpenReplace, Read, Write, ReadAt, WriteAt, FileSize, CloseFile, RemoveFile, RenameNoReplace, PathExists, DirectoryExists, CreateDirectory, CreatePrivateDirectory, OpenDirectory, NextDirectoryEntry, and CloseDirectory, plus the whole-file helpers here. ok := WriteEntireFile("notes.txt", "hello\n") text, found := ReadEntireFile("notes.txt")
Import with #import "file" and pass --module-path std.
ReadEntireFile :: (path: string) -> (string, bool)The whole file's bytes as text, and whether it could be read.
WriteEntireFile :: (path: string, text: string) -> boolReplace the file at PATH with TEXT; false when it cannot be written whole.
18 / std/file_go.zi
file_go
Native Go file operations preserve filesystem permissions and error identity.
Import with #import "file_go" and pass --module-path std.
FileMode :: structFileReadResult :: struct { value: []u8; error: Error; }ReadFile :: (path: string) -> FileReadResultWriteFile :: (path: string, data: []u8, mode: FileMode) -> ErrorMkdirAll :: (path: string, mode: FileMode) -> ErrorRename :: (oldPath: string, newPath: string) -> ErrorRemove :: (path: string) -> ErrorDir :: (path: string) -> stringNotExist :: () -> Error19 / std/file_linux.zi
file_linux
Import with #import "file_linux" and pass --module-path std.
FileHandle :: struct { fd: s32; valid: bool; }DirectoryCursor :: struct { storage: *void; valid: bool; }DirectoryEntry :: struct { name: [256]u8; name_count: s32; valid: bool; }OpenRead :: (path: string) -> FileHandleOpenUpdate :: (path: string) -> FileHandleOpenWrite :: (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) -> boolRead :: (file: FileHandle, output: []u8) -> s64Write :: (file: FileHandle, input: []u8) -> s64OpenDirectory :: (path: string) -> DirectoryCursorNextDirectoryEntry :: (cursor: *DirectoryCursor) -> DirectoryEntryCloseDirectory :: (cursor: *DirectoryCursor) -> bool20 / std/file_plan9.zi
file_plan9
Import with #import "file_plan9" and pass --module-path std.
FileHandle :: struct { fd: s32; valid: bool; }FileInfo :: struct { valid: bool; type: u16; device: u32; identity: u64; version: u32; identity_type: u8; mode: u32; modified: u32; length: s64; }A value snapshot owns no libc allocation. The device and Qid fields identify a file; its version/length/timestamp can detect changed content.
LastError :: (output: []u8) -> stringPathInfo :: (path: string) -> FileInfoHandleInfo :: (file: FileHandle) -> FileInfoSetFileAttributes :: (file: FileHandle, permissions: u32, modified: u32) -> boolApply ordinary permissions and a timestamp to an already-open file. Special mode flags cannot be introduced through this operation.
CurrentDirectory :: (output: []u8) -> stringDirectoryCursor :: struct { storage: *void; count: s64; next: s64; valid: bool; failed: bool; }A cursor owns the native directory snapshot. Close it exactly once.
DirectoryEntry :: struct { name: [256]u8; name_count: s32; valid: bool; }OpenRead :: (path: string) -> FileHandleOpenUpdate :: (path: string) -> FileHandleOpenWrite :: (path: string) -> FileHandleOpenReplace :: (path: string) -> FileHandleOpenPrivateReplace :: (path: string) -> FileHandleAtomically create an owner-only file, refusing an existing name. A temporary lease is removed when its last descriptor closes, including
CreatePrivateExclusive :: (path: string, remove_on_close: bool) -> FileHandleAtomically create an owner-only file, refusing an existing name. A temporary lease is removed when its last descriptor closes, including process exit. OCEXEC prevents a lease from leaking into an executed child.
PathExists :: (path: string) -> boolDirectoryExists :: (path: string) -> boolCreateDirectory :: (path: string) -> boolCreatePrivateDirectory :: (path: string) -> boolCreatePrivateDirectoryExclusive :: (path: string) -> boolCreate a new directory without accepting or replacing an existing name.
CreatePrivateDirectoryHandle :: (path: string) -> FileHandleKeep the descriptor from an exclusive directory create. Its identity and attributes remain accessible even after restrictive permissions are set.
RemoveFile :: (path: string) -> boolRenameNoReplace :: (source: string, destination: string) -> boolPlan 9 wstat changes the basename within its current directory. Refuse cross-directory requests instead of silently moving to the wrong path.
FileSize :: (file: FileHandle) -> s64ReadAt :: (file: FileHandle, output: []u8, offset: s64) -> s64WriteAt :: (file: FileHandle, input: []u8, offset: s64) -> s64CloseFile :: (file: FileHandle) -> boolRead :: (file: FileHandle, output: []u8) -> s64Stream operations read/write at the descriptor's current position. This supports devices whose first read is a snapshot and whose next read blocks.
Write :: (file: FileHandle, input: []u8) -> s64OpenDirectory :: (path: string) -> DirectoryCursorNextDirectoryEntry :: (cursor: *DirectoryCursor) -> DirectoryEntryCloseDirectory :: (cursor: *DirectoryCursor) -> bool21 / std/format.zi
format
Text built on an owned Vec(u8) builder. Append adds one value's text, and BuilderPrint(*builder, "x=%\n", x) appends a whole formatted piece: each % takes the next argument's text and %% writes one percent. BuilderFinish turns the builder into a string. line: Vec(u8) BuilderPrint(*line, "% of % done\n", finished, total) text := BuilderFinish(line) Integers are written in base ten, bools as true or false, and floats with up to six digits after the point, trailing zeros dropped.
Import with #import "format" and pass --module-path std.
Append :: (builder: *Vec(u8), text: string)Append :: (builder: *Vec(u8), value: s64)Append :: (builder: *Vec(u8), value: u32)Unsigned values up to 32 bits; also the closest match for u8 and u16.
Append :: (builder: *Vec(u8), value: u64)Append :: (builder: *Vec(u8), value: bool)Append :: (builder: *Vec(u8), value: float64)22 / std/go_types.zi
go_types
Predeclared Go interface types at the foreign-library boundary.
Import with #import "go_types" and pass --module-path std.
Any :: structError :: struct23 / std/hash_map.zi
hash_map
A hash map from keys to values that runs the same on every target and the portable runner. Keys are strings or integers. The table doubles when half its slots are in use, and HashMapFree releases it. ages: HashMap(string, s32) HashMapSet(*ages, "ada", 36) age: s32 if HashMapGet(*ages, "ada", *age) { print("%\n", age) } HashMapFree(*ages)
Import with #import "hash_map" and pass --module-path std.
HashMap :: struct($K: Type, $V: Type) { keys: Vec(K); values: Vec(V); states: Vec(u8); count: s64; }HashKey :: (key: string) -> u64FNV-1a over the key's bytes.
HashKey :: (key: u64) -> u64SplitMix64's finalizer spreads nearby integers across the table.
HashKey :: (key: s64) -> u64HashKey :: (key: u32) -> u64HashMapFind :: (map: *HashMap($K, $V), key: K) -> s64The slot holding KEY, or -1.
HashMapHas :: (map: *HashMap($K, $V), key: K) -> boolHashMapGet :: (map: *HashMap($K, $V), key: K, value: *V) -> boolCopies KEY's value into VALUE and returns true, or returns false.
HashMapSet :: (map: *HashMap($K, $V), key: K, value: V)HashMapRemove :: (map: *HashMap($K, $V), key: K) -> boolRemoves KEY and returns whether it was present.
HashMapFree :: (map: *HashMap($K, $V))HashMapGrow :: (map: *HashMap($K, $V))Doubles the table, to at least 8 slots, and reinserts every entry.
24 / 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.
25 / 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.
26 / std/http_go.zi
http_go
Go HTTP requests, response writers and headers retain their native types and behavior.
Import with #import "http_go" and pass --module-path std.
Request :: structHeader :: structResponseWriter :: structClient :: structResponse :: structRequestResult :: struct { value: *Request; error: Error; }ResponseResult :: struct { value: *Response; error: Error; }RemoteAddress :: (request: *Request) -> stringHeaders :: (request: *Request) -> HeaderMethod :: (request: *Request) -> stringRequestURL :: (request: *Request) -> *url.URLBody :: (request: *Request) -> io.ReadCloserContext :: (request: *Request) -> ctx.ContextMaxBytesReader :: (writer: ResponseWriter, reader: io.ReadCloser, limit: s64) -> io.ReadCloserWriteHeader :: (writer: ResponseWriter, status: isize)HeaderValue :: (header: Header, name: string) -> stringResponseHeaders :: (writer: ResponseWriter) -> HeaderSetHeader :: (header: Header, name: string, value: string)NewClient :: (timeout: clock.Duration) -> *ClientClientTimeout :: (client: *Client) -> clock.DurationNewRequest :: (context: ctx.Context, method: string, target: string, body: io.Reader) -> RequestResultDo :: (client: *Client, request: *Request) -> ResponseResultResponseBody :: (response: *Response) -> io.ReadCloserStatus :: (response: *Response) -> stringStatusCode :: (response: *Response) -> isize27 / std/io_go.zi
io_go
Native Go stream interfaces retain resource ownership and error identity.
Import with #import "io_go" and pass --module-path std.
Reader :: structReadCloser :: structWriter :: structBytesReader :: structReadAllResult :: struct { value: []u8; error: Error; }ReadAll :: (reader: Reader) -> ReadAllResultClose :: (reader: ReadCloser) -> ErrorLimitReader :: (reader: Reader, count: s64) -> ReaderFromBytes :: (data: []u8) -> Reader28 / std/json_go.zi
json_go
Go JSON serialization keeps native error values, field tags and byte storage.
Import with #import "json_go" and pass --module-path std.
Encoder :: structDecoder :: structJSONResult :: struct { value: []u8; error: Error; }Marshal :: (value: Any) -> JSONResultUnmarshal :: (data: []u8, value: Any) -> ErrorValid :: (data: []u8) -> boolNewEncoder :: (writer: io.Writer) -> *EncoderEncode :: (encoder: *Encoder, value: Any) -> ErrorNewDecoder :: (reader: io.Reader) -> *DecoderDecode :: (decoder: *Decoder, value: Any) -> Error29 / 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) -> JsonSpanHexValue :: (ch: u8) -> s32ReadHex4 :: (text: string, at: s32, end: s32) -> s32The four hex digits at `at` as a number, or -1.
AppendUtf8 :: (output: []u8, length: s32, codepoint: s32) -> s32Appends codepoint as UTF-8, leaving room for a NUL. Returns the new length, or -1 when it does not fit.
ReadStringText :: (text: string, at: s32, output: []u8) -> s32Copies the JSON string at `at` into output as UTF-8 with its escapes decoded, including \uXXXX surrogate pairs; a lone surrogate becomes U+FFFD. Returns the byte length, or -1 when the value is not a string or does not fit. Output is always NUL-terminated.
SpanEqualsASCII :: (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) -> s3230 / std/map_go.zi
map_go
Go maps share their storage when copied or passed to a function. The private fields describe type arguments; access goes through Map operations. Go target only. Import option to use MapLookup, whose result is Option(V). MapSet initializes nil storage; MapInit preserves an existing map. MapGet returns a zero value for absent keys. MapKeys returns an unordered snapshot.
Import with #import "map_go" and pass --module-path std.
Map :: struct($K: Type, $V: Type) { key: K; value: V; }31 / 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) -> bool32 / 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) -> float3233 / std/net_go.zi
net_go
Go IP parsing, canonical formatting, loopback classification and host/port splitting.
Import with #import "net_go" and pass --module-path std.
IP :: structHostPort :: struct { host: string; port: string; error: Error; }SplitHostPort :: (address: string) -> HostPortParseIP :: (address: string) -> IPValidIP :: (value: IP) -> boolFormatIP :: (value: IP) -> stringIsLoopback :: (value: IP) -> bool34 / 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.
35 / 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 :: 10023CurlAcceptEncoding :: 10102CurlPostFields :: 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.
36 / 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.
37 / 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.
PollDescriptor :: struct { fd: s32; events: s16; returned: s16; }PollRead :: 1NoSocket :: () -> PollDescriptorValidSocket :: (descriptor: PollDescriptor) -> boolCurlWsFrame :: struct { age: s32; flags: s32; offset: s64; bytes_left: s64; length: u64; }CurlConnectOnly :: 141CurlActiveSocket :: 5242924CurlAgain :: 81CurlWsText :: 1CurlWsContinue :: 4CurlWsClose :: 8Output is NUL terminated on success. status is 401 on an unauthorized
ReceiveWebSocketCurl :: (context: *void, url: string, token: string, output: []u8, status: *s32) -> bool38 / 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.
39 / std/option.zi
option
Import with #import "option" and pass --module-path std.
Option :: struct($T: Type) { has_value: bool; value: T; }40 / std/pair.zi
pair
Import with #import "pair" and pass --module-path std.
Pair :: struct($A: Type, $B: Type) { first: A; second: B; }41 / std/path.zi
path
Import with #import "path" and pass --module-path std.
CleanAbsolute :: (value: string, output: []u8) -> stringLexical slash-path operations. These do not resolve links or mount points. Returned text borrows output until the caller changes that storage.
WithinDirectory :: (value: string, directory: string) -> boolBoth arguments must be canonical absolute slash paths. A directory prefix matches only itself or a complete component boundary, never a sibling.
42 / 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.
43 / 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) -> CaptureResult44 / std/process_plan9.zi
process_plan9
Import with #import "process_plan9" and pass --module-path std.
ProcessGroup :: struct { pid: s32; note_id: s32; valid: bool; }A detached child has its own descriptor, environment, and note groups. The note ID identifies the child and descendants that inherit its group.
CurrentProcessId :: () -> s32Plan 9's path environment is a NUL-separated list, including directory
ExecutablePath :: (name: string, output: []u8) -> stringPlan 9's path environment is a NUL-separated list, including directory names with spaces. Resolve an executable before passing its argv to exec.
StartDetached :: (arguments: []string) -> ProcessGroupProcessInGroup :: (group: ProcessGroup, pid: s32) -> bool45 / std/py_types.zi
py_types
A Python value at the py: foreign boundary, for the Python target only. null is None. Every foreign Python type with the same py: target is the same type, so modules may also declare Object themselves.
Import with #import "py_types" and pass --module-path std.
Object :: struct46 / 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) -> BoundedQueue47 / std/random_go.zi
random_go
Cryptographic random bytes from Go, preserving its count and error results.
Import with #import "random_go" and pass --module-path std.
ReadResult :: struct { count: isize; error: Error; }Fill :: (output: []u8) -> ReadResult48 / 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) -> bool49 / 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; }50 / 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.
51 / std/select_go.zi
select_go
Select native Go channels through their boxed interface values. Channels retain native storage and direction; reflect.Select validates the channel and send-value types at runtime and preserves Go's ready-case selection.
Import with #import "select_go" and pass --module-path std.
Case :: structDirection :: structValue :: structSelectResult :: struct { chosen: isize; value: Value; receiveOK: bool; }Receive :: (channel: Any) -> CaseSend :: (channel: Any, send: Any) -> CaseDefault :: () -> CaseSelect :: (cases: []Case) -> SelectResult52 / 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) -> bool53 / 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.
54 / std/sql_go.zi
sql_go
Native Go SQL handles, nullable strings and transaction cleanup primitives.
Import with #import "sql_go" and pass --module-path std.
Database :: structTransaction :: structTransactionOptions :: structRow :: structRows :: structResult :: structNullString :: structAffectedRowsResult :: struct { value: s64; error: Error; }Next :: (rows: *Rows) -> boolRowsError :: (rows: *Rows) -> ErrorCloseRows :: (rows: *Rows) -> ErrorCommit :: (transaction: *Transaction) -> ErrorRollback :: (transaction: *Transaction) -> ErrorNullStringValid :: (value: NullString) -> boolNullStringValue :: (value: NullString) -> stringNoRows :: () -> ErrorTransactionDone :: () -> ErrorRowsAffected :: (result: Result) -> AffectedRowsResult55 / 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) -> string56 / std/sync_go.zi
sync_go
Go mutexes. Keep one mutex in shared storage and pass its address.
Import with #import "sync_go" and pass --module-path std.
Mutex :: structLock :: (mutex: *Mutex)Unlock :: (mutex: *Mutex)57 / 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) -> bool58 / 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) -> string59 / std/text_go.zi
text_go
Copy between Go-owned byte slices and strings, preserving every byte.
Import with #import "text_go" and pass --module-path std.
FromBytes :: (value: []u8) -> stringToBytes :: (value: string) -> []u860 / std/text_py.zi
text_py
Copy between Python bytes and Ziran strings, preserving every byte, on the Python target. A string crosses into Python as str decoded with surrogateescape, so encoding it the same way returns its exact bytes.
Import with #import "text_py" and pass --module-path std.
FromBytes :: (value: []u8) -> stringToBytes :: (value: string) -> []u861 / std/thread_linux.zi
thread_linux
Background work for native Linux and Android programs. A thread runs one procedure while the thread that started it keeps going, and that thread can ask whether the work has finished without waiting, so a frame loop keeps drawing while a request is in flight. A Thread record must stay at one address from ThreadStart until ThreadFinished or ThreadWait reports the end. Once it has, everything the procedure wrote is visible to the thread that asked, and the record can start another procedure.
Import with #import "thread_linux" and pass --module-path std.
ThreadProcedure :: #type (argument: *void)PosixThreadEntry :: #type (argument: *void) -> *voidThread :: struct { handle: usize; lock: [8]u64; procedure: ThreadProcedure; argument: *void; running: bool; finished: bool; }ThreadLock :: (thread: *Thread) -> *voidThreadRun :: (argument: *void) -> *voidThreadStart :: (thread: *Thread, procedure: ThreadProcedure, argument: *void) -> boolThreadRunning :: (thread: *Thread) -> boolWhether the record is running a procedure that has not been reported finished yet.
ThreadFinished :: (thread: *Thread) -> boolWhether the procedure started on `thread` has finished. Never waits; the first time it reports true the thread is joined and the record is free.
ThreadWait :: (thread: *Thread)Waits until the procedure started on `thread` has finished.
62 / std/time_go.zi
time_go
Go wall-clock and monotonic timestamps retain their native time.Time behavior.
Import with #import "time_go" and pass --module-path std.
Time :: structDuration :: structTicker :: structParseResult :: struct { value: Time; error: Error; }Now :: () -> TimeAfter :: (value: Time, other: Time) -> boolAdd :: (value: Time, duration: Duration) -> TimeParse :: (layout: string, value: string) -> ParseResultUTC :: (value: Time) -> TimeFormat :: (value: Time, layout: string) -> stringUnix :: (value: Time) -> s64FromUnix :: (seconds: s64, nanos: s64) -> TimeUntil :: (value: Time) -> DurationNewTicker :: (duration: Duration) -> *TickerStopTicker :: (ticker: *Ticker)TickerChannel :: (ticker: *Ticker) -> Any63 / 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) -> bool64 / 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.
65 / std/url_go.zi
url_go
Native Go URLs preserve escaped-path selection and their original encoding.
Import with #import "url_go" and pass --module-path std.
URL :: structValues :: structParseURLResult :: struct { value: *URL; error: Error; }Parse :: (value: string) -> ParseURLResultHost :: (value: *URL) -> stringScheme :: (value: *URL) -> stringPath :: (value: *URL) -> stringEscapedPath :: (value: *URL) -> stringQuery :: (value: *URL) -> ValuesValue :: (values: Values, name: string) -> string66 / 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) -> s3267 / 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; }68 / 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.
69 / 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.
70 / 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) -> bool71 / 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