-
Notifications
You must be signed in to change notification settings - Fork 92
Tools
The compiler, cscompile
will compile a CalvinScript source file into a
JSON representation. By default, the output will be written to a file with the
same name as the input file, but with the extension replaced by 'json' instead
of whatever extension the input file had (if any).
For up-to-date information, run it with an -h
argument.
In general, the compiler is not invoked directly. Instead, the workflow is as follows:
-
A runtime is started
$ csruntime --host <address> --port <port> --controlport <controlport> --keep-alive
From this line we get two uris: The control uri which is used to send commands to a runtime using a REST-interface, and has the form http://<address>:<controlport>
and an internal runtime uri calvinip://<address>:<port>
which is used for runtime to runtime communication.
Optionally and with the possibility to setup up listeners on multiple interfaces for runtime to runtime communication, uris can be specified with the argument -uri
. A uri is specified in the form <schema>://<address>:<port>
, supported schemas and interfaces are calvinip for TCP/IP and calvinbt for Bluetooth RFCOMM. Example:
$ csruntime --uri calvinip://<address>:<port> --uri calvinbt://<bluetoothid>:<port>
-
An application is compiled and deployed
$ cscontrol http://<address>:<controlport> deploy <calvin script>
Invoking
$ csruntime --host localhost <scriptfile>
with a CalvinScript file as argument will start a runtime, invoke the compiler for you, and then deploy the resulting application. By default, the program will exit after 3 seconds. This is not the recommended way of deploying applications, only intended for one-shots during development.
Finally, the actor store is where we can find documentation about actors.
$ csdocs std.Join
will show the documentation for Join
in the std
namespace:
std.Join(): Join two streams of tokens
Inputs: token_1, token_2
Outputs: token
It is also possible to get a more verbose description in markdown format:
$ csdocs --format detailed std.Join
#### std.Join()
Join two streams of tokens
##### Inputs
token_1
: first token stream
token_2
: second token stream
##### Outputs
token
: resulting token stream
For components, additional information on which actors they make use of is included:
$ csdocs std.DelayedCounter
std.DelayedCounter(delay): Counts from 0 and up, waiting 'delay' seconds between numbers
Requires: std.Delay, std.Counter
Outputs: integer