ImagerSwitchesImpl.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, October 14, 1988 12:18:04 pm PDT
DIRECTORY ImagerSwitches, Rope;
ImagerSwitchesImpl: CEDAR PROGRAM
EXPORTS ImagerSwitches
~
BEGIN
val:
PUBLIC
ARRAY
CHAR['a..'z]
OF
REF ¬
ALL[
NIL];
default:
ARRAY
CHAR['a..'z]
OF
REF ¬
ALL[
NIL];
names:
ARRAY
CHAR['a..'z]
OF
ATOM ¬
ALL[
NIL];
docs:
ARRAY
CHAR['a..'z]
OF Rope.
ROPE ¬
ALL[
NIL];
MultipleDefinition: PUBLIC ERROR [switch: CHAR] ~ CODE;
Undefined:
PUBLIC
ERROR [switch:
CHAR] ~
CODE;
Define:
PUBLIC
PROC [switch:
CHAR['a..'z], name:
ATOM, doc: Rope.
ROPE, defaultValue:
REF]
RETURNS [
CHAR['a..'z]] ~ {
IF name # names[switch] AND names[switch] # NIL THEN ERROR MultipleDefinition[switch];
names[switch] ¬ name;
docs[switch] ¬ doc;
val[switch] ¬ default[switch] ¬ defaultValue;
RETURN [switch]
};
Describe:
PUBLIC
PROC [switch:
CHAR['a..'z]]
RETURNS [name:
ATOM, doc: Rope.
ROPE, defaultValue:
REF, value:
REF] ~ {
RETURN [name: names[switch], doc: docs[switch], defaultValue: default[switch], value: val[switch]]
};
Set:
PUBLIC
PROC [switch:
CHAR['a..'z], name:
ATOM, value:
REF] ~ {
IF name # names[switch] THEN ERROR Undefined[switch];
val[switch] ¬ value;
};
END.