Compare commits
10 Commits
a052fbb0cb
...
50a77995bc
Author | SHA1 | Date |
---|---|---|
Emery Hemingway | 50a77995bc | |
Emery Hemingway | 3e324e2de4 | |
Emery Hemingway | aadf7a3dc7 | |
Emery Hemingway | a2849b18c9 | |
Emery Hemingway | f3d6e578cb | |
Emery Hemingway | 39cb3790df | |
Emery Hemingway | 46dca031fa | |
Emery Hemingway | 79c621e979 | |
Emery Hemingway | a05cfa37eb | |
Emery Hemingway | d6a8b31812 |
10
lock.json
10
lock.json
|
@ -52,12 +52,12 @@
|
|||
"packages": [
|
||||
"preserves"
|
||||
],
|
||||
"path": "/nix/store/fpkhfxnfbdcri6k7mac21r3byg738bs4-source",
|
||||
"ref": "20240108",
|
||||
"rev": "a01ba8c96d65f670862ba074bf82b50cbda6ed99",
|
||||
"sha256": "0n8pghy2qfywx0psr54yzjvhdhi5av204150jyyzfxhigczd8sr4",
|
||||
"path": "/nix/store/6nnn5di5vip1vladlb7z56rbw18d1y7j-source",
|
||||
"ref": "20240208",
|
||||
"rev": "2825bceecf33a15b9b7942db5331a32cbc39b281",
|
||||
"sha256": "145vf46fy3wc52j6vs509fm9bi5lx7c53gskbkpcfbkv82l86dgk",
|
||||
"srcDir": "src",
|
||||
"url": "https://git.syndicate-lang.org/ehmry/preserves-nim/archive/a01ba8c96d65f670862ba074bf82b50cbda6ed99.tar.gz"
|
||||
"url": "https://git.syndicate-lang.org/ehmry/preserves-nim/archive/2825bceecf33a15b9b7942db5331a32cbc39b281.tar.gz"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
let pkgs = import <nixpkgs> { };
|
||||
in pkgs.buildNimPackage {
|
||||
name = "noiseprotocol";
|
||||
buildInputs = [ pkgs.noise-c ];
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
pkgs.buildNimPackage {
|
||||
name = "dummy";
|
||||
lockFile = ./lock.json;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,6 @@ proc match(bindings: var Bindings; p: Pattern; v: Value): bool =
|
|||
of PatternKind.Patom:
|
||||
result = case p.patom
|
||||
of PAtom.Boolean: v.isBoolean
|
||||
of PAtom.Float: v.isFloat
|
||||
of PAtom.Double: v.isDouble
|
||||
of PAtom.Signedinteger: v.isInteger
|
||||
of PAtom.String: v.isString
|
||||
|
|
|
@ -70,9 +70,7 @@ proc grab*(pr: Value): Pattern =
|
|||
of pkBoolean:
|
||||
AnyAtom(orKind: AnyAtomKind.`bool`, bool: pr.bool).toPattern
|
||||
of pkFloat:
|
||||
AnyAtom(orKind: AnyAtomKind.`float`, float: pr.float).toPattern
|
||||
of pkDouble:
|
||||
AnyAtom(orKind: AnyAtomKind.`double`, double: pr.double).toPattern
|
||||
AnyAtom(orKind: AnyAtomKind.`double`, double: pr.float).toPattern
|
||||
of pkRegister:
|
||||
AnyAtom(orKind: AnyAtomKind.`int`, int: pr.register).toPattern
|
||||
of pkString:
|
||||
|
|
|
@ -6,6 +6,7 @@ modules += http.nim
|
|||
modules += noise.nim
|
||||
modules += protocol.nim
|
||||
modules += service.nim
|
||||
modules += stdenv.nim
|
||||
modules += stream.nim
|
||||
modules += sturdy.nim
|
||||
modules += tcp.nim
|
||||
|
|
|
@ -4,17 +4,14 @@ import
|
|||
|
||||
type
|
||||
AnyAtomKind* {.pure.} = enum
|
||||
`bool`, `float`, `double`, `int`, `string`, `bytes`, `symbol`, `embedded`
|
||||
`bool`, `double`, `int`, `string`, `bytes`, `symbol`, `embedded`
|
||||
`AnyAtom`* {.preservesOr.} = object
|
||||
case orKind*: AnyAtomKind
|
||||
of AnyAtomKind.`bool`:
|
||||
`bool`*: bool
|
||||
|
||||
of AnyAtomKind.`float`:
|
||||
`float`*: float32
|
||||
|
||||
of AnyAtomKind.`double`:
|
||||
`double`*: float64
|
||||
`double`*: float
|
||||
|
||||
of AnyAtomKind.`int`:
|
||||
`int`*: BiggestInt
|
||||
|
|
|
@ -8,18 +8,18 @@ type
|
|||
`detail`*: Value
|
||||
|
||||
Turn* = seq[TurnEvent]
|
||||
Message* {.preservesRecord: "message".} = object
|
||||
Message* {.preservesRecord: "M".} = object
|
||||
`body`*: Assertion
|
||||
|
||||
Retract* {.preservesRecord: "retract".} = object
|
||||
Retract* {.preservesRecord: "R".} = object
|
||||
`handle`*: Handle
|
||||
|
||||
Assert* {.preservesRecord: "assert".} = object
|
||||
Assert* {.preservesRecord: "A".} = object
|
||||
`assertion`*: Assertion
|
||||
`handle`*: Handle
|
||||
|
||||
Extension* = Value
|
||||
Sync* {.preservesRecord: "sync".} = object
|
||||
Sync* {.preservesRecord: "S".} = object
|
||||
`peer`* {.preservesEmbedded.}: Value
|
||||
|
||||
TurnEvent* {.preservesTuple.} = object
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
import
|
||||
preserves, sturdy, gatekeeper
|
||||
|
||||
type
|
||||
StandardTransportKind* {.pure.} = enum
|
||||
`wsUrl`, `other`
|
||||
`StandardTransport`* {.preservesOr.} = object
|
||||
case orKind*: StandardTransportKind
|
||||
of StandardTransportKind.`wsUrl`:
|
||||
`wsurl`*: string
|
||||
|
||||
of StandardTransportKind.`other`:
|
||||
`other`*: Value
|
||||
|
||||
|
||||
StandardRouteKind* {.pure.} = enum
|
||||
`standard`, `general`
|
||||
StandardRouteStandard* {.preservesTuple.} = object
|
||||
`transports`*: seq[StandardTransport]
|
||||
`key`*: seq[byte]
|
||||
`service`*: Value
|
||||
`sig`*: seq[byte]
|
||||
`oid`*: Value
|
||||
`caveats`* {.preservesTupleTail.}: seq[sturdy.Caveat]
|
||||
|
||||
`StandardRoute`* {.preservesOr.} = object
|
||||
case orKind*: StandardRouteKind
|
||||
of StandardRouteKind.`standard`:
|
||||
`standard`*: StandardRouteStandard
|
||||
|
||||
of StandardRouteKind.`general`:
|
||||
`general`*: gatekeeper.Route
|
||||
|
||||
|
||||
proc `$`*(x: StandardTransport | StandardRoute): string =
|
||||
`$`(toPreserves(x))
|
||||
|
||||
proc encode*(x: StandardTransport | StandardRoute): seq[byte] =
|
||||
encode(toPreserves(x))
|
|
@ -107,8 +107,7 @@ type
|
|||
|
||||
SturdyPathStepDetail* = Parameters
|
||||
`PAtom`* {.preservesOr, pure.} = enum
|
||||
`Boolean`, `Float`, `Double`, `SignedInteger`, `String`, `ByteString`,
|
||||
`Symbol`
|
||||
`Boolean`, `Double`, `SignedInteger`, `String`, `ByteString`, `Symbol`
|
||||
PDiscard* {.preservesRecord: "_".} = object
|
||||
|
||||
TemplateKind* {.pure.} = enum
|
||||
|
|
|
@ -5,17 +5,17 @@ import
|
|||
type
|
||||
TimerExpired* {.preservesRecord: "timer-expired".} = object
|
||||
`label`*: Value
|
||||
`seconds`*: float64
|
||||
`seconds`*: float
|
||||
|
||||
SetTimer* {.preservesRecord: "set-timer".} = object
|
||||
`label`*: Value
|
||||
`seconds`*: float64
|
||||
`seconds`*: float
|
||||
`kind`*: TimerKind
|
||||
|
||||
`TimerKind`* {.preservesOr, pure.} = enum
|
||||
`relative`, `absolute`, `clear`
|
||||
LaterThan* {.preservesRecord: "later-than".} = object
|
||||
`seconds`*: float64
|
||||
`seconds`*: float
|
||||
|
||||
proc `$`*(x: TimerExpired | SetTimer | LaterThan): string =
|
||||
`$`(toPreserves(x))
|
||||
|
|
|
@ -86,11 +86,11 @@ type
|
|||
`reason`*: LinkedTaskReleaseReason
|
||||
|
||||
TurnCausePeriodicActivation* {.preservesRecord: "periodic-activation".} = object
|
||||
`period`*: float64
|
||||
`period`*: float
|
||||
|
||||
TurnCauseDelay* {.preservesRecord: "delay".} = object
|
||||
`causingTurn`*: TurnId
|
||||
`amount`*: float64
|
||||
`amount`*: float
|
||||
|
||||
TurnCauseExternal* {.preservesRecord: "external".} = object
|
||||
`description`*: Value
|
||||
|
@ -170,7 +170,7 @@ type
|
|||
|
||||
|
||||
TraceEntry* {.preservesRecord: "trace".} = object
|
||||
`timestamp`*: float64
|
||||
`timestamp`*: float
|
||||
`actor`*: ActorId
|
||||
`item`*: ActorActivation
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "20240120"
|
||||
version = "20240208"
|
||||
author = "Emery Hemingway"
|
||||
description = "Syndicated actors for conversational concurrency"
|
||||
license = "Unlicense"
|
||||
|
@ -9,4 +9,4 @@ srcDir = "src"
|
|||
|
||||
# Dependencies
|
||||
|
||||
requires "https://github.com/ehmry/hashlib.git#f9455d4be988e14e3dc7933eb7cc7d7c4820b7ac", "nim >= 2.0.0", "https://git.syndicate-lang.org/ehmry/preserves-nim.git >= 20240116"
|
||||
requires "https://github.com/ehmry/hashlib.git#f9455d4be988e14e3dc7933eb7cc7d7c4820b7ac", "nim >= 2.0.0", "https://git.syndicate-lang.org/ehmry/preserves-nim.git >= 20240208"
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
#!/usr/bin/env spry
|
||||
|
||||
title = "Simple Chat Demo"
|
||||
|
||||
# Initialize libui
|
||||
uiInit
|
||||
|
||||
username = "user"
|
||||
|
||||
menu = newMenu "Menu"
|
||||
|
||||
# menu addItem: "Username" onClicked: [
|
||||
# dialog = newWindow: "Username" width: 200 height: 40 hasBar: false
|
||||
# entry = newEntryText: username onChanged: []
|
||||
# quitit = newButton: "Quit" onClicked: [
|
||||
# destroy dialog
|
||||
# true
|
||||
# ]
|
||||
# layout = newHorizontalBox
|
||||
# #layout add: entry stretch: true
|
||||
# layout.add: quitit stretch: false
|
||||
# group = newGroup "Username"
|
||||
# group setChild: layout
|
||||
# dialog setChild: quitit
|
||||
# dialog show
|
||||
# ]
|
||||
|
||||
menu menuAppendAboutItem
|
||||
|
||||
menu addQuitItemShouldClose: [
|
||||
win destroy
|
||||
uiQuit
|
||||
true
|
||||
]
|
||||
|
||||
# Create a new Window
|
||||
win = newWindow: title width: 640 height: 400 hasBar: true
|
||||
win margined: true
|
||||
|
||||
# create text boxes
|
||||
scrollback = newMultilineEntryText
|
||||
scrollback readonly: true
|
||||
|
||||
sendEntry = newMultilineEntryText
|
||||
|
||||
# create layouts
|
||||
layout = newVerticalBox
|
||||
sendBox = newHorizontalBox
|
||||
|
||||
# Some buttons and their handlers
|
||||
sendButton = newButton: "Send" onClicked: [
|
||||
msg = (sendEntry text)
|
||||
msg != "" then: [
|
||||
scrollback addText: (msg, "\x0a")
|
||||
sendEntry text: ""
|
||||
]
|
||||
]
|
||||
|
||||
# Group
|
||||
group = newGroup "Workspace"
|
||||
group margined: false
|
||||
group setChild: layout
|
||||
|
||||
sendBox add: sendEntry stretch: true
|
||||
sendBox add: sendButton stretch: false
|
||||
|
||||
# Put things in the boxes
|
||||
layout padded: true
|
||||
layout add: scrollback stretch: true
|
||||
layout add: sendBox stretch: false
|
||||
|
||||
# Add box to window
|
||||
win setChild: group
|
||||
|
||||
# Set initial text
|
||||
sendEntry text: "compose a message here"
|
||||
|
||||
# Close handler
|
||||
closeHandler = [
|
||||
win destroy
|
||||
uiQuit
|
||||
true
|
||||
]
|
||||
|
||||
# Set a handler on closing window
|
||||
win onClosingShouldClose: [ true ]
|
||||
|
||||
# Show the window
|
||||
win show
|
||||
|
||||
# Enter libui's event loop
|
||||
uiMain
|
Loading…
Reference in New Issue