From 76b7b75211b535c4896119320ea3e232dee13ea8 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 1 Mar 2023 20:50:46 -0600 Subject: [PATCH] Regenerate protocol modules --- src/protocol.nim | 27 ++++++++++----------------- src/uri_runner.nim | 4 ++-- src/xdg_open.nim | 2 +- xdg_open_ng.nimble | 2 +- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/protocol.nim b/src/protocol.nim index a342e00..2d7d398 100644 --- a/src/protocol.nim +++ b/src/protocol.nim @@ -8,32 +8,25 @@ type UriRunnerConfigKind* {.pure.} = enum `ListenOn`, `ActionHandler` - `UriRunnerConfig`*[E] {.preservesOr.} = ref object + `UriRunnerConfig`* {.preservesOr.} = object case orKind*: UriRunnerConfigKind of UriRunnerConfigKind.`ListenOn`: - `listenon`*: ListenOn[E] + `listenon`*: ListenOn of UriRunnerConfigKind.`ActionHandler`: - `actionhandler`*: ActionHandler[E] + `actionhandler`*: ActionHandler - ListenOn*[E] {.preservesRecord: "listen-on".} = ref object - `dataspace`*: Preserve[E] + ListenOn* {.preservesRecord: "listen-on".} = object + `dataspace`* {.preservesEmbedded.}: Preserve[void] - ActionHandler*[E] {.preservesRecord: "action-handler".} = ref object + ActionHandler* {.preservesRecord: "action-handler".} = object `pat`*: string - `action`*: Preserve[E] - `entity`*: Preserve[E] + `entity`* {.preservesEmbedded.}: Preserve[void] + `action`*: Preserve[void] -proc `$`*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): string = - `$`(toPreserve(x, E)) - -proc encode*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): seq[ - byte] = - encode(toPreserve(x, E)) - -proc `$`*(x: XdgOpen): string = +proc `$`*(x: XdgOpen | UriRunnerConfig | ListenOn | ActionHandler): string = `$`(toPreserve(x)) -proc encode*(x: XdgOpen): seq[byte] = +proc encode*(x: XdgOpen | UriRunnerConfig | ListenOn | ActionHandler): seq[byte] = encode(toPreserve(x)) diff --git a/src/uri_runner.nim b/src/uri_runner.nim index 54742ab..2dae10c 100644 --- a/src/uri_runner.nim +++ b/src/uri_runner.nim @@ -18,10 +18,10 @@ bootDataspace("main") do (root: Ref; turn: var Turn): connectStdio(root, turn) - onPublish(turn, root, ?ActionHandler[Ref]) do (pat: string; entity: Ref; response: Assertion): + onPublish(turn, root, ?ActionHandler) do (pat: string; entity: Ref; response: Assertion): handlers.add (re(pat, {reIgnoreCase, reStudy}), entity, response,) - during(turn, root, ?ListenOn[Ref]) do (ds: Ref): + during(turn, root, ?ListenOn) do (ds: Ref): onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]): for uri in uris: var matched: bool diff --git a/src/xdg_open.nim b/src/xdg_open.nim index 3218923..a14cf36 100644 --- a/src/xdg_open.nim +++ b/src/xdg_open.nim @@ -13,7 +13,7 @@ proc unixSocketPath: string = proc mintCap: SturdyRef = var key: array[16, byte] - mint(key, "syndicate") + cast[SturdyRef](mint(key, "syndicate")) bootDataspace("main") do (root: Ref; turn: var Turn): connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref): diff --git a/xdg_open_ng.nimble b/xdg_open_ng.nimble index 2268568..0d01f04 100644 --- a/xdg_open_ng.nimble +++ b/xdg_open_ng.nimble @@ -1,6 +1,6 @@ # Package -version = "99999999" +version = "20230301" author = "Emery" description = "A better xdg-open" license = "Unlicense"