Files
nim/caprpc/twopartyschema.nim
zeekay 68037f9ca4 Rebrand Cap'n Proto Nim port to ZAP
Rename the capnp/ module set to zap/ and the capnpc compiler to zapc;
rename all .capnp schemas and fixtures to .zap; update every import,
include guard (isInZap), generated-code emission, exception type
(ZapFormatError), and the macro-generated zapUnpackStructImpl/
zapPackStructImpl identifiers to the ZAP brand. Zero capnp/Cap'n Proto
references remain in source or build files; upstream MIT attribution
(Sandstorm, Michał Zieliński) is preserved.

Raise the nimble nim floor from the fictional 0.12.0 to the locked,
verified 0.15.2 (matches nimenv.cfg/build.sh; code carries fixes through
Nim 0.18). Rewrite TODO.md as honest, source-anchored known-limitations
(two-word intersegment pointers, nested/named-union codegen, RPC
interface inheritance) instead of a bare wishlist.
2026-06-19 23:42:02 -07:00

58 lines
960 B
Nim

import zap, zap/gensupport, collections/iface
# file: caprpc/rpc-twoparty.zap
type
Side* {.pure.} = enum
server = 0, client = 1
VatId* = ref object
side*: Side
ProvisionId* = ref object
joinId*: uint32
RecipientId* = ref object
ThirdPartyCapId* = ref object
JoinKeyPart* = ref object
joinId*: uint32
partCount*: uint16
partNum*: uint16
JoinResult* = ref object
joinId*: uint32
succeeded*: bool
cap*: AnyPointer
makeStructCoders(VatId, [
(side, 0, Side(0), true)
], [], [])
makeStructCoders(ProvisionId, [
(joinId, 0, 0, true)
], [], [])
makeStructCoders(RecipientId, [], [], [])
makeStructCoders(ThirdPartyCapId, [], [], [])
makeStructCoders(JoinKeyPart, [
(joinId, 0, 0, true),
(partCount, 4, 0, true),
(partNum, 6, 0, true)
], [], [])
makeStructCoders(JoinResult, [
(joinId, 0, 0, true)
], [
(cap, 0, PointerFlag.none, true)
], [
(succeeded, 32, false, true)
])