m3totex/derived/B.m3


MODULE B;
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..4] OF TEXT {
  "tex",
  "xmpl",
  "make",
  "header",
  NIL
};

CONST Elements = ARRAY [0..4] OF TEXT {
  E0,
  E1,
  E2,
  E3,
  NIL
};

CONST E0 =
   "%\n% Copyright (C) 1992, Digital Equipment Corporation \n% All rights r"
 & "eserved.\n% See the file COPYRIGHT for a full description.\n%\n% Last m"
 & "odified on Thu Jan  7 10:55:10 PST 1993 by muller                     ."
 & "\n%\n\\documentstyle{article}\n\n\\begin{document}\n\n\\section{Example"
 & " interface}\n\n\\input{Example.i.tex}\n\n\\end{document}\n";

CONST E1 =
   "(* Copyright (C) 1992, Digital Equipment Corporation                   "
 & "      *)\n(* All rights reserved.                                      "
 & "                *)\n(* See the file COPYRIGHT for a full description.  "
 & "                          *)\n(*                                       "
 & "                                    *)\n(* Last modified on Thu Jan  7 "
 & "10:54:49 PST 1993 by muller                   *)\n(*                   "
 & "                                                        *)\n(* The abov"
 & "e lines, and this line, and all lines up \n   to the first blank line, "
 & "will be skipped by M3ToTex *)\n\n(* The \"Example\" interface shows how"
 & " to use \"m3totex\". *)\n\nINTERFACE Example;\n\nTYPE T <: ROOT;\n\n(* "
 & "An \"Example.T\" is an opaque object type. *)\n\nPROCEDURE P(t: T; VAR "
 & "(*OUT*) n: INTEGER);\n(* Replace \"t\" by its hyperbolic completion and"
 & "\n   store its specular index in \"n\". *)\n\n(* Comments that do not s"
 & "tart in the first column are\n   typeset like program text (for example"
 & ", the comment\n   \"OUT\" in the signature of \"P\").\n\n   Comments th"
 & "at start in the first column and are not\n   preceded by a blank line a"
 & "re indented and slanted.\n   They are intended to be used for short sum"
 & "mary procedure\n   specifications, like the one following the declarati"
 & "on\n   of \"P\".\n\n   Comments that start in the first column and are\n"
 & "   preceded by a blank line are typeset in ordinary\n   roman text, exc"
 & "ept that quoted words are typeset\n   like program text (for example, \""
 & "Example.T\"). \n\n   If you want to include some verbatim material in a"
 & " comment, precede\n   each verbatim line by a vertical-bar and a space."
 & "  For example,\n\n| VAR t := NEW(t); n: INTEGER; BEGIN\t\n|   WHILE n #"
 & " 0 DO \n|     P(t, n);\n|     `reduce the specular index of \"t\"`.\n| "
 & "  END\n| END\n\nNotice that you can escape into roman type by using \nb"
 & "ack-quotes. *)\n\nEND Example.\n";

CONST E2 =
   "# Copyright (C) 1992, Digital Equipment Corporation \n# All rights rese"
 & "rved.\n# See the file COPYRIGHT for a full description.\n#\n# Last modi"
 & "fied on Thu Jan  7 10:55:33 PST 1993 by muller                     .\n\n"
 & "\nTEXFILES = Example.i.tex\nDOCNAME = Example\n\n# TEXFILES should be a"
 & " list of names of the tex files that\n# are generated by m3totex\n\n# D"
 & "OCNAME should be the name of the document\n\n# make DOCNAME.dvi will ma"
 & "ke TeX\'s dvi (device independent file)\n\n# make proof will make DOCNA"
 & "ME.ps (a postscript file) which can\n# be viewed with psview\n\n# make "
 & "print will print the document.\n\nall: $(TEXFILES) $(DOCNAME).dvi\n\n$("
 & "DOCNAME).dvi: $(DOCNAME).tex $(TEXFILES)\n\tlatex $(DOCNAME).tex\n\npri"
 & "nt: $(DOCNAME).dvi\n\tdvips $(DOCNAME).dvi\n\nproof: $(DOCNAME).dvi\n\t"
 & "dvips -o $(DOCNAME).ps $(DOCNAME).dvi\n\tpsview $(DOCNAME).ps\n\n.SUFFI"
 & "XES: .i3 .i.tex .m3 .m.tex\n\n.i3.i.tex: \n\tm3totex $*.i3\n\n.m3.m.tex"
 & ": \n\tm3totex $*.m3\n\n\n";

CONST E3 =
   "% Copyright (C) 1992, Digital Equipment Corporation\n% All rights reser"
 & "ved.\n% See the file COPYRIGHT for a full description.\n%\n% Last modif"
 & "ied on Thu Jan  7 10:51:40 PST 1993 by muller\n%\n\\font\\ttslant=cmslt"
 & "t10\n\\font\\ttstraight=cmtt10\n\\font\\rmslant=cmsl10\n\\def\\tt{\\tts"
 & "traight}\n\\def\\indentation{24pt}\n\\def\\tab{$ $\\hbox to \\indentati"
 & "on{\\hss}}\n\\long\\def\\procspec#1{{\\advance\\leftskip by \\indentati"
 & "on\n  \\noindent\\rightskip = 0pt plus2em\\rmslant\\def\\tt{\\ttslant}\\"
 & "ignorerm#1}}\n\\def\\ignorerm\\rm{}\n\\def\\display{\\tab\\parskip=0pt\\"
 & "advance\\baselineskip by -0.5pt\\tt }\n\\def\\progmode{\\advance\\basel"
 & "ineskip by -0.5pt}\n";

BEGIN
END B.