## control.api
# Compiled by:
#
src/lib/global-controls/global-controls.libapi Global_Control {
#
Menu_Slot = List( Int );
Global_Control(X);
# A converter for control values:
#
Value_Converter X
=
{ name_of_type: String,
from_string: String -> Null_Or(X),
to_string: X -> String
};
make_control
:
{ name: String, # Name of the control.
menu_slot: Menu_Slot, # Positions control within the control menu hierarchy.
obscurity: Int, # Control's detail level; higher means more obscure.
# #
help: String, # Control's description # XXX SUCKO FIXME So rename it 'description'!!
control: Ref(X) # Ref cell holding control's state # XXX SUCKO FIXME So rename it 'state' or such!! Geez... :(
}
->
Global_Control(X);
# This exception is raised to announce
# that there is a syntax error in a
# string representation of a control value:
#
exception
BAD_VALUE_SYNTAX
{
name_of_type: String,
control_name: String,
value: String
};
# Create a string control from a typed control:
#
make_string_control # XXX BUGGO FIXME so rename it "make_..." or whatever !!
:
Value_Converter(X)
-> Global_Control(X)
-> Global_Control( String );
# Control operations:
name: Global_Control(X) -> String;
get: Global_Control(X) -> X;
set: (Global_Control(X), X) -> Void;
set' : (Global_Control(X), X) -> Void -> Void; # Delayed set with error checking in 1st stage.
info: Global_Control(X)
->
{ menu_slot: Menu_Slot,
obscurity: Int,
help: String
};
save_controller_state # Generate a thunk containing current controller state, which when run will restore controller to that state.
:
Global_Control(X)
->
Void # Capture control's current value...
->
Void; # ... and then restore control's value.
menu_rank_gt # Compare the menu ranks of two controls.
:
(Global_Control(X), Global_Control(X))
->
Order;
};
## COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.