Client Nodes (ie gui).
Luke Gorrie
luke@REDACTED
Wed Mar 27 12:10:57 CET 2002
Eric Merritt <cyberlync@REDACTED> writes:
> In any case, my question is simple. Are there other GUI options?
If you want portability, you can't beat the One True Toolkit - Emacs.
There's an Emacs Lisp package called "distel" which gets you
Erlang-style processes and message passing, and connects them to
regular erlang nodes via the distribution protocol. In other words
it's an Elisp version of erl_interface and jive. You can download it
from http://www.bluetail.com/~luke/misc/distel-0.1.tar.gz
Here's a distel program that takes a callback function, and
node/module/fun/args, then does the RPC to the standard erlang RPC
server, and passes the result to the callback:
(defun erl-rpc (k kargs node m f a)
"Call {M,F,A} on NODE and deliver the result to the function K, as
(apply K (cons rpc-result KARGS))."
(erl-spawn-go
(erl-send (tuple 'rex node) ; Normal erlang-style {RegName, Node}
;; {Who, {M, F, A, GroupLeader}}
(tuple erl-self (tuple 'call m f a erl-group-leader)))
;; Tell the scheduler that our next function is `erl-rpc-receive',
;; for when the reply arrives.
(erl-yield #'erl-rpc-receive k kargs)))
(defun erl-rpc-receive (k kargs)
"This is essentially the receive clause of `erl-rpc'."
(let ((msg (pop erl-mailbox)))
;; Message should be [tuple rex REPLY], i.e. {rex, Reply}
(assert (and (tuplep msg) (eq 'rex (elt msg 1))))
(apply k (cons (elt msg 2) kargs))))
And here's a high-level interface that you can bind to a key or call
from M-x:
(defun erpc (node m f a)
"Make an RPC to an erlang node."
(interactive "SNode: \nSModule: \nSFunction: \nXArguments (expression): ")
(erl-rpc (lambda (result) (message "RPC result: %S" result))
nil
node
m f a))
Just what you were looking for, right? ;-)
There's also a very small pman-clone included in the
distribution. This is quite new and only tested on GNU Emacs 20 and 21
on Linux sofar, and doesn't have some stuff like pattern-matching
receive, process links, etc just yet.
Cheers,
Luke
More information about the erlang-questions
mailing list