calculator/derived/CalculatorBundle.m3


MODULE CalculatorBundle;
Generated by m3bundle; see its manpage.

IMPORT Bundle, BundleRep, Text;

TYPE T = Bundle.T OBJECT OVERRIDES
           get      := LookUp;
           getNames := GetNames;
         END;

TYPE Texts = REF ARRAY OF TEXT;

VAR
  bundle: T     := NIL;
  names : Texts := NIL;

PROCEDURE Get(): Bundle.T =
  BEGIN
    IF (bundle = NIL) THEN bundle := NEW (T) END;
    RETURN bundle;
  END Get;

PROCEDURE GetNames (<*UNUSED*> self: T): Texts =
  BEGIN
    IF names = NIL THEN
      names := NEW (Texts, NUMBER (Names));
      names^ := Names;
    END;
    RETURN names;
  END GetNames;

PROCEDURE LookUp (<*UNUSED*> self: T;  element: TEXT): TEXT =
  BEGIN
    FOR i := 0 TO LAST (Names)-1 DO
      IF Text.Equal (Names[i], element) THEN
        RETURN Elements[i];
      END;
    END;
    RETURN NIL;
  END LookUp;

CONST Names = ARRAY [0..1] OF TEXT {
  "Calculator.fv",
  NIL
};

CONST Elements = ARRAY [0..1] OF TEXT {
  E0,
  NIL
};

CONST E0 =
   "(Rim (Pen 15)\n  (Macro Key BOA (name text)\n    `(Rim (Pen 1) \n      "
 & " (Shape (Width 20) (Height 20) (Button (Name ,name) (Text ,text)))))\n "
 & " (VBox\n    (Frame Lowered (TypeIn (BgColor \"White\") %display))\n    "
 & "(Glue 8)\n    (HBox\n      (Font \"vtboldp\")\n      (VBox\n        (HB"
 & "ox (Key b1 \"1\") (Key b2 \"2\") (Key b3 \"3\"))\n        (HBox (Key b4"
 & " \"4\") (Key b5 \"5\") (Key b6 \"6\"))\n        (HBox (Key b7 \"7\") (K"
 & "ey b8 \"8\") (Key b9 \"9\"))\n        (HBox Fill (Key b0 \"0\") Fill))\n"
 & "      (Glue 16)\n      (VBox\n        Fill\n        (HBox (Key bAdd \"+"
 & "\") (Key bSub \"-\"))\n        (HBox (Key bMult \"*\") (Key bDiv \"/\")"
 & ")\n        (Glue 8)\n        (Key bEquals \"=\")\n        Fill))\n     "
 & "(Glue 16)\n     (Guard (Button %quit \"QUIT\") )\n  ))\n";

BEGIN
END CalculatorBundle.