CLERIC reference

Version 0.0.8.

This is the reference document for CLERIC (Common Lisp Erlang Interface). It describes all symbols exported from packages BERT and CLERIC.

The latest version of this document is available here: http://common-lisp.net/project/cleric/doc/reference.html

Note that the API is in flux as long as CLERIC is at version 0.0.X.


The BERT package

CLERIC implements the BERT binary data interchange format and exports these functions through the BERT package.

Classes

[Standard class]
bert-regex

Represents a BERT regex term.


[Standard class]
bert-time

Represents a BERT time term.


[Standard class]
erlang-binary

Inherited from CLERIC. See cleric:erlang-binary.

[Standard class]
erlang-tuple

Inherited from CLERIC. See cleric:erlang-tuple.

Functions

[Generic function]
arity tuple => size

Inherited from CLERIC. See cleric:arity.


[Function]
binary &rest bytes => binary

Inherited from CLERIC. See cleric:binary.


[Function]
binary-to-string binary => string

Inherited from CLERIC. See cleric:binary-to-string.


[Function]
bool value => bert-boolean

Returns the value of bert:true if value is true, otherwise returns the value of bert:false.


[Generic function]
bytes binary => bytes

Inherited from CLERIC. See cleric:bytes.


[Function]
bytes-to-binary bytes => binary

Inherited from CLERIC. See cleric:bytes-to-binary.


[Function]
decode bytes => bert-term, position

Decodes the sequence bytes into BERT terms. position is the number of bytes consumed from bytes.


[Generic function]
elements tuple => vector

Inherited from CLERIC. See cleric:elements.


[Generic function]
encode object &key berp-header => bytes

berp-header defaults to NIL.

Encodes object according to BERT into a vector of bytes. If berp-header is true the resulting byte vector is prepended with a BERP header, a four byte length header.


[Generic function]
size tuple-or-binary => size

Inherited from CLERIC. See cleric:size.


[Function]
string-to-binary string => binary

Inherited from CLERIC. See cleric:string-to-binary.


[Function]
tuple &rest objects => tuple

Inherited from CLERIC. See cleric:tuple.


Variables

[Special variable]
*lisp-string-is-erlang-binary*

Inherited from CLERIC. See cleric:*lisp-string-is-erlang-binary*.


[Constant variable]
false

Value: #<ERLANG-TUPLE {|bert| |false|}>


[Constant variable]
true

Value: #<ERLANG-TUPLE {|bert| |true|}>


Conditions

[Condition]
unexpected-message-length-error

Inherited from CLERIC. See cleric:unexpected-message-length-error.


[Condition]
unexpected-message-tag-error

Inherited from CLERIC. See cleric:unexpected-message-tag-error.


[Condition]
untranslatable-lisp-object-error

Inherited from CLERIC. See cleric:untranslatable-lisp-object-error.



The CLERIC package

CLERIC is an implementation of the Erlang distribution protocol, making it possible for a Lisp program to act as an Erlang node. Similar libraries exist for other languages; erl_interface for C and jinterface for Java are part of the official Erlang distribution.

Types and Classes

[Type]
erlang-translatable

The type erlang-translatable contains all types of Lisp objects that may be translated to Erlang objects.

[Standard class]
erlang-binary

Represents an Erlang binary.

[Standard class]
erlang-external-fun

Represents an Erlang external fun.

[Standard class]
erlang-internal-fun

Represents an Erlang internal fun.

[Standard class]
erlang-new-internal-fun

Represents an Erlang 'new' internal fun.

[Standard class]
erlang-pid

Represents an Erlang Pid.

[Standard class]
erlang-port

Represents an Erlang Port.

[Standard class]
erlang-reference

Represents an Erlang reference.

[Standard class]
erlang-tuple

Represents an Erlang tuple.


[Standard class]
remote-node

Represents a remote Erlang node.

[Standard class]
exit

Exit message object.

[Standard class]
exit2

Exit2 message object.

[Standard class]
group-leader

Group leader message object.

[Standard class]
link

Link message object.

[Standard class]
node-link

Node link message object.

[Standard class]
reg-send

Reg send message object.

[Standard class]
send

Send message object.

[Standard class]
unlink

Unlink message object.

Functions

[Generic function]
arity tuple-or-fun => arity

Returns the arity of tuple-or-fun. For tuples that means the number of elements and for Funs the number of arguments.


[Function]
binary &rest bytes => binary

Creates a new binary from bytes.


[Function]
binary-to-string binary => string

Converts binary to a string.


[Generic function]
bits-in-last-byte binary => number-of-bits

Returns the number of bits used in the last byte of binary.

[Generic function]
bytes binary => bytes

Returns a vector of bytes from binary.


[Function]
bytes-to-binary bytes => binary

Creates a new binary from the byte sequence bytes.


[Generic function]
cookie control-message => cookie

Returns the cookie in control-message.

[Function]
decode bytes &key start version-tag => erlang-term, position

Decodes the sequence bytes into Erlang terms. position is the number of bytes consumed from bytes.

[Function]
decode-control-message bytes &key start version-tag => control-message, position

Decodes the sequence bytes into a Erlang control message. position is the number of bytes consumed from bytes.

[Generic function]
elements tuple => elements

Returns a vector with the elements in tuple.


[Generic function]
encode erlang-translatable-object &key version-tag atom-cache-entries => bytes

Encodes erlang-translatable-object into a sequence of bytes.

[Generic function]
encode-control-message control-message &key version-tag atom-cache-entries => bytes

Encodes control-message into a sequence of bytes.

[Function]
epmd-lookup-node node-name &optional host => remote-node

host defaults to "localhost".

Queries the EPMD at host for node node-name. If the node exists, a remote-node object is returned representing that node. Otherwise NIL is returned.


[Function]
erlang-translatable-p object => boolean

Returns true if object can be encoded to an Erlang term.

[Generic function]
from-pid control-message => pid

Returns the Pid from which control-message was sent.

[Function]
link from-pid to-pid => nil

Establish a process link between from-pid and to-pid. Sends a Link control message to the node where the process to-pid is located.

[Function]
make-pid => pid

Creates a Pid object. Useful for sending and receiving messages.

[Generic function]
message control-message => message

Returns the message part of control-message.

[Generic function]
module erlang-fun => symbol

Returns the module of erlang-fun.

[Generic function]
node erlang-identifier => symbol

Returns the node of erlang-identifier. An Erlang identifier is either a Pid, Port, or a reference object.

[Generic function]
reason exit-control-message => term

Returns the reason of exit-control-message.

[Function]
receive-node-messages &key timeout => control-messages

timeout defaults to NIL.

Waits for and receives messages from connected nodes. Returns a list of received messages.


[Function]
reg-send from-pid to-name node message => nil

Sends message from from-pid to registered process to-name on node.

[Function]
remote-node-connect remote-node cookie => t

Connect and perform handshake with remote-node. If the connection and handshake is successful the node is added to *remote-nodes* and the full node name, protocol version, and feature flags are printed on standard output.


[Generic function]
remote-node-host remote-node => host-string

Returns the host where remote-node is located.

[Generic function]
remote-node-name remote-node => node-name

Returns the node name of remote-node.

[Generic function]
remote-node-port remote-node => port-number

Returns the port on which remote-node listens.

[Generic function]
remote-node-socket remote-node => socket-object

Returns the usocket socket object used for communicating with remote-node.

[Function]
send to-pid message => nil

Sends message to to-pid.

[Generic function]
size tuple-or-binary => size

Returns the size of tuple-or-binary which means the number of elements in a tuple or the number of bytes in a binary.


[Function]
string-to-binary string => binary

Creates a new binary from string.


[Generic function]
to-name reg-send-control-message => registered-name

Returns the registered process name of the receiver of reg-send-control-message.

[Generic function]
to-pid control-message => pid

Returns the receiving Pid of control-message.

[Generic function]
trace-token control-message => trace-token

Returns the trace token of control-message.

[Function]
tuple &rest objects => tuple

Creates a new tuple containing objects.


[Function]
unlink from-pid to-pid => nil

Unlinks from-pid and to-pid. Sends an Unlink control message to the node where to-pid is located.

Variables

[Special variable]
*erlang-false-is-lisp-nil-symbol*

Initial value: NIL

[Special variable]
*erlang-string-is-lisp-string*

Initial value: NIL

[Special variable]
*erlang-true-is-lisp-t-symbol*

Initial value: NIL

[Special variable]
*lisp-nil-at-tail-is-erlang-empty-list*

Initial value: T

[Special variable]
*lisp-nil-is-erlang-empty-list*

Initial value: T

[Special variable]
*lisp-nil-symbol-is-erlang-false*

Initial value: NIL

[Special variable]
*lisp-string-is-erlang-binary*

Initial value: NIL


[Special variable]
*lisp-t-symbol-is-erlang-true*

Initial value: NIL

[Special variable]
*remote-nodes*

Initial value: ()

[Special variable]
*this-node*

Initial value: "lispnode@localhost"

[Constant variable]
+highest-version-supported+

Value: 5

[Constant variable]
+lowest-version-supported+

Value: 5

Conditions

[Condition]
connection-closed-error


[Condition]
epmd-host-unknown-error


[Condition]
epmd-response-error


[Condition]
epmd-unreachable-error


[Condition]
handshake-failed-error


[Condition]
malformed-external-erlang-term-error


[Condition]
malformed-message-error


[Condition]
node-unreachable-error


[Condition]
not-implemented-error


[Condition]
try-again


[Condition]
unexpected-message-length-error


[Condition]
unexpected-message-tag-error


[Condition]
untranslatable-lisp-object-error