Files
zeekay 2aa8261f86 rebrand: complete capnp → ZAP across all C# source/build files
Finishes the in-flight capnp→ZAP rebrand on this branch. The prior commits
renamed identifiers/namespaces/files/projects (Capnp.Net.Runtime→Zap.Net.Runtime,
CapnpC→ZapC, .capnp→.zap) but left the human-readable brand name "Cap'n Proto"
throughout doc-comments, .csproj/.nuspec descriptions, README, MSBuild .xaml
rule display names, and the generated XML doc. This completes brand neutrality:

- Replace 154 "Cap'n Proto" / 4 "Cap'n-Proto" / 1 "Cap'n'p" prose occurrences
  with "ZAP" across 32 first-party files (runtime, generator, zapc-csharp,
  MSBuild integration, chocolatey nuspecs, README, docs, XML doc).
- Revert the LICENSE provenance URL to the real upstream fork
  (c80k/capnproto-dotnetcore) — upstream-fork license headers must stay.
- Canonicalize project/repo URLs to github.com/zap-proto/cs (were fabricated
  c80k/zap-dotnetcore) in csproj/nuspec/VERIFICATION/README badges.
- Canonicalize docs URLs zap-protocol(.github.io|/zap-cs|/zap-cpp-core)
  → zap-proto.dev / github.com/zap-proto/{cs,cpp-core}.
- Collapse redundant "zap \"ZAP\"" PackageTags to "zap".

Verified consistent (no toolchain on host): every .sln/.csproj ProjectReference
resolves; all namespaces are Zap*/ZapC*; MSBuild task chain
(GenerateZapFileCodeBehindTask, ZapFiles ItemGroup, _ZapcCsharp_TaskAssembly)
is uniformly renamed; props/targets/xaml/coverage/chocolatey carry no capnp.

Deliberately preserved as upstream-derived test data (not first-party source):
upstream Cap'n Proto schema fixtures (rpc.zap, rpc-twoparty.zap, json.zap,
rpc-csharp.zap), golden compiler-error outputs (errors.txt), and the
machine-generated DO-NOT-EDIT test.zap.{c++,h}. Their "Cap'n Proto" strings are
the literal output of the external schema compiler the compat test matches.
2026-06-19 23:46:57 -07:00

220 lines
5.6 KiB
C#

using Zap;
using Zap.Rpc;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace ZapGen
{
[TypeId(0xb706e295e5860f3dUL)]
public class RpcRequest<TRequest> : IZapSerializable where TRequest : class
{
public const UInt64 typeId = 0xb706e295e5860f3dUL;
void IZapSerializable.Deserialize(DeserializerState arg_)
{
var reader = READER.create(arg_);
Method = reader.Method;
Request = ZapSerializable.Create<TRequest>(reader.Request);
applyDefaults();
}
public void serialize(WRITER writer)
{
writer.Method = Method;
writer.Request.SetObject(Request);
}
void IZapSerializable.Serialize(SerializerState arg_)
{
serialize(arg_.Rewrap<WRITER>());
}
public void applyDefaults()
{
}
public string Method
{
get;
set;
}
public TRequest Request
{
get;
set;
}
public struct READER
{
readonly DeserializerState ctx;
public READER(DeserializerState ctx)
{
this.ctx = ctx;
}
public static READER create(DeserializerState ctx) => new READER(ctx);
public static implicit operator DeserializerState(READER reader) => reader.ctx;
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
public string Method => ctx.ReadText(0, "");
public DeserializerState Request => ctx.StructReadPointer(1);
}
public class WRITER : SerializerState
{
public WRITER()
{
this.SetStruct(0, 2);
}
public string Method
{
get => this.ReadText(0, "");
set => this.WriteText(0, value, "");
}
public DynamicSerializerState Request
{
get => BuildPointer<DynamicSerializerState>(1);
set => Link(1, value);
}
}
}
[TypeId(0xca749dac8d513c9fUL)]
public class ArithmeticOperationRequest : IZapSerializable
{
public const UInt64 typeId = 0xca749dac8d513c9fUL;
void IZapSerializable.Deserialize(DeserializerState arg_)
{
var reader = READER.create(arg_);
NumA = reader.NumA;
NumB = reader.NumB;
applyDefaults();
}
public void serialize(WRITER writer)
{
writer.NumA = NumA;
writer.NumB = NumB;
}
void IZapSerializable.Serialize(SerializerState arg_)
{
serialize(arg_.Rewrap<WRITER>());
}
public void applyDefaults()
{
}
public int NumA
{
get;
set;
}
public int NumB
{
get;
set;
}
public struct READER
{
readonly DeserializerState ctx;
public READER(DeserializerState ctx)
{
this.ctx = ctx;
}
public static READER create(DeserializerState ctx) => new READER(ctx);
public static implicit operator DeserializerState(READER reader) => reader.ctx;
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
public int NumA => ctx.ReadDataInt(0UL, 0);
public int NumB => ctx.ReadDataInt(32UL, 0);
}
public class WRITER : SerializerState
{
public WRITER()
{
this.SetStruct(1, 0);
}
public int NumA
{
get => this.ReadDataInt(0UL, 0);
set => this.WriteData(0UL, value, 0);
}
public int NumB
{
get => this.ReadDataInt(32UL, 0);
set => this.WriteData(32UL, value, 0);
}
}
}
[TypeId(0xc64f52df07418506UL)]
public class ArithmeticOperationReply : IZapSerializable
{
public const UInt64 typeId = 0xc64f52df07418506UL;
void IZapSerializable.Deserialize(DeserializerState arg_)
{
var reader = READER.create(arg_);
Result = reader.Result;
applyDefaults();
}
public void serialize(WRITER writer)
{
writer.Result = Result;
}
void IZapSerializable.Serialize(SerializerState arg_)
{
serialize(arg_.Rewrap<WRITER>());
}
public void applyDefaults()
{
}
public int Result
{
get;
set;
}
public struct READER
{
readonly DeserializerState ctx;
public READER(DeserializerState ctx)
{
this.ctx = ctx;
}
public static READER create(DeserializerState ctx) => new READER(ctx);
public static implicit operator DeserializerState(READER reader) => reader.ctx;
public static implicit operator READER(DeserializerState ctx) => new READER(ctx);
public int Result => ctx.ReadDataInt(0UL, 0);
}
public class WRITER : SerializerState
{
public WRITER()
{
this.SetStruct(1, 0);
}
public int Result
{
get => this.ReadDataInt(0UL, 0);
set => this.WriteData(0UL, value, 0);
}
}
}
}