MODULE; IMPORT Color, ColorName, ObLib, ObLibUI, ObValue, Obliq, SynLocation; PROCEDURE ObColor M3ToObliq (val : Color.T) : T = BEGIN RETURN NEW (T, what := "<a Color.T>", color := val); END M3ToObliq; PROCEDUREObliqToM3 (val : ObValue.Val) : Color.T RAISES {ObValue.Error} = BEGIN TYPECASE val OF | ObValue.ValText (node) => TRY RETURN ColorName.ToRGB (node.text); EXCEPT ColorName.NotFound => Obliq.RaiseError ("unknown color name"); <* ASSERT FALSE *> END; | ObLibUI.ValColor (node) => RETURN node.color; ELSE Obliq.RaiseError ("expected color or text"); <* ASSERT FALSE *> END; END ObliqToM3; PROCEDUREGetArg (args : ObValue.ArgArray; idx : INTEGER; package : ObLib.T; opCode : ObLib.OpCode; loc : SynLocation.T) : Color.T RAISES {ObValue.Error} = BEGIN TYPECASE args[idx] OF | ObValue.ValText (node) => TRY RETURN ColorName.ToRGB(node.text); EXCEPT ColorName.NotFound => RETURN Color.Black; END; | T (node) => RETURN node.color; ELSE ObValue.BadArgType (idx, "color", package.name, opCode.name, loc); RETURN Color.Black; (* ... only to suppress compiler warning *) END; END GetArg; BEGIN END ObColor.