## reactive.api
# Compiled by:
#
src/lib/reactive/reactive.lib# A simple reactive engine modelled after RC and SugarCubes.
api Reactive {
Machine;
Instruction;
Signal;
Config;
In_Signal;
Out_Signal;
machine: { inputs: List( Signal ),
outputs: List( Signal ),
body: Instruction
}
->
Machine;
run: Machine -> Bool;
#
# Run the machine one instant.
# Returns TRUE, iff the machine ends
# in a terminal state.
reset: Machine -> Void;
#
# Reset a machine to its initial state.
inputs_of: Machine -> List( In_Signal );
outputs_of: Machine -> List( Out_Signal );
input_signal: In_Signal -> Signal;
output_signal: Out_Signal -> Signal;
set_in_signal: ((In_Signal, Bool)) -> Void;
get_in_signal: In_Signal -> Bool;
get_out_signal: Out_Signal -> Bool;
||| : ((Instruction, Instruction)) -> Instruction;
&&& : ((Instruction, Instruction)) -> Instruction;
nothing: Instruction;
stop: Instruction;
suspend: Instruction;
action: (Machine -> Void) -> Instruction;
exec: (Machine -> { stop: Void -> Void, done: Void -> Bool } )
-> Instruction;
if_then_else: (((Machine -> Bool), Instruction, Instruction)) -> Instruction;
repeat: ((Int, Instruction)) -> Instruction;
loop: Instruction -> Instruction;
close: Instruction -> Instruction;
signal: ((Signal, Instruction)) -> Instruction;
rebind: ((Signal, Signal, Instruction)) -> Instruction;
when: ((Config, Instruction, Instruction)) -> Instruction;
trap: ((Config, Instruction)) -> Instruction;
trap_with: ((Config, Instruction, Instruction)) -> Instruction;
emit: Signal -> Instruction;
await: Config -> Instruction;
# Signal configurations:
#
pos_config: Signal -> Config;
neg_config: Signal -> Config;
or_config: ((Config, Config)) -> Config;
and_config: ((Config, Config)) -> Config;
};
## COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.