## global-control-forms.pkg
# Compiled by:
#
src/lib/global-controls/global-controls.libstipulate
package lst = list; # list is from
src/lib/std/src/list.pkg package qht = quickstring_hashtable; # quickstring_hashtable is from
src/lib/src/quickstring-hashtable.pkg package qs = quickstring__premicrothread; # quickstring__premicrothread is from
src/lib/src/quickstring--premicrothread.pkgherein
package global_control_forms {
#
# Menu_Ranks are used for ordering help messages (lexical order)
#
Menu_Slot = List( Int );
Global_Control(X)
=
GLOBAL_CONTROL
{
name: qs::Quickstring, # Name of the control.
get: Void -> X, # Return the control's value.
menu_slot: Menu_Slot, # Positions control in the control menu hierarchy.
obscurity: Int, # Control's detail level; higher means more obscure.
help: String, # Control's description.
set: Null_Or(X) -> Void -> Void # function to set the control's value;
# it is delayed (error checking in 1st
# stage, actual assignment in 2nd);
# if the argument is NULL, then
# the 2nd stage will restore the
# value that was present during the
# first stage.
}
withtype Global_Control_Set (X, Y)
=
qht::Hashtable
{ control: Global_Control(X),
info: Y
};
Value_Converter(X) # Conversion functions for control values. =
=
{ name_of_type: String,
from_string: String -> Null_Or(X),
to_string: X -> String
};
fun menu_rank_gt ranks
=
lst::compare_sequences int::compare ranks == GREATER;
};
end;
## COPYRIGHT (c) 2002 Bell Labs, Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.