-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathss-rpc-server.scrbl
87 lines (51 loc) · 3.05 KB
/
ss-rpc-server.scrbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#lang scribble/manual
@(require
scribble/eval
scribble/base
(for-label racket ss-rpc-server)
)
@title{SS-RPC server}
@(define server-eval (make-base-eval))
@interaction-eval[#:eval server-eval
(require ss-rpc-server)]
@author[@author+email["Sergey Petrov" "[email protected]"]]
@italic["SS-RPC"] is a Synchronous S-expression-based Remote Procedure Call,
facility to call procedure within remote process and receive
return value. SS-RPC allows you to use Racket as GNU Emacs extension language.
It includes a server described by this page and a
@link["https://github.com/sk1e/ss-rpc-client" "client"] for Emacs.
@section{Features and limitations}
SS-RPC uses S-expressions as message language and TCP/IP
as transport. Main advantages of SS-RPC over other RPCs for
Emacs are lower remote call overhead and a feature of mutual
remote call between server and client.
SS-RPC is limited with synchronous calls and transmitted data structures
which are defined by the intersection of Emacs Lisp and Racket readers.
@section{Server API}
@defmodule[ss-rpc-server]
@defproc[(register-method! [x procedure?] [key symbol?]) void?]{
Puts a procedure @racket[x] to a method table that can be accessed from client by a @racket[key].}
@defform[(define-method (id args) body ...+)
]{
Syntactic wrapper for @racket[define] with a registering as a method with its symbol.
@interaction[#:eval server-eval
(define-method (echo x) x)]
is a shorthand for
@interaction[#:eval server-eval
(define (echo x) x)
(register-method! echo 'echo)]}
@defproc[(serve! [#:log-level log-level (or/c 'none 'fatal 'error 'warning 'info 'debug) 'info]
[#:log-out log-out output-port? (current-output-port)]) void?]{
Enters a serving loop with handling incoming commands.}
@defproc[(call [method symbol?] [arg any/c] ...) any/c]{
Applies a elisp procedure @racket[method] to @racket[arg]s as its arguments and returns the result
of application. On elisp side ss-rpc does not registers remote procedures and @racket[method] can be any
elisp procedure symbol.}
@defproc[(call! [method symbol?] [arg any/c] ...) void?]{
Applies a elisp procedure @racket[method] to @racket[arg]s as its arguments with @bold["ignoring"] the return result
of application. On elisp side ss-rpc does not registers remote procedures and @racket[method] can be any
elisp procedure symbol.}
@defparam[on-terminate proc (-> any/c) #:value void]{
Deinitialization procedure which will be applied on receiving @italic["terminate"] command.}
@defparam[server-readtable x readtable? #:value readtable?]{
Readtable to read incoming message. Currently reads nil symbol as empty list, elisp vectors and hashtables}