JunoProcViewer.mesa (ex OldParseWindow.mesa)
Coded September 6, 1982 12:25 am
Last Edited by: Gnelson, October 11, 1983 9:29 pm
Last Edited by: Stolfi, June 6, 1984 4:39:04 am PDT

Maintains a text viewer containing the current set of Juno procedures. Exports procedures that search this list and that append new procedures to it.

TO FIX: Implement it.

TO FIX: Should we have procedures to lock/unlock the proc viewer while an evaluation is in progress? Or should there be a procedure that returns the current a-list, called once at the beginning of a command?.

DIRECTORY

JunoAlgebra USING [Se];

JunoProcViewer: DEFINITIONS =

BEGIN

OPEN Alg: JunoAlgebra;

StartUp: PUBLIC PROC;

Opens the Juno source viewer and initializes data structures.

GetCurrentDef: PUBLIC PROC [name: ATOM] RETURNS [value: Alg.Se];

Get definition of name by searching proc viewer.
Will re-parse viewer if necessary.

AddDef: PUBLIC PROC [name: ATOM, value: Alg.Se];

Adds a new procedure to the current set, unparses it and displays on the viewer

Terminate: PUBLIC PROC;

Destroys the Juno source viewer and sets the procedure Alist to NIL.

END.

- - - - OLD JUNK

ROPE
: TYPE = Rope.ROPE;

- - - - XXX

Moved here from JunoStorage on April 6, 1984 3:52:04 pm PST; need to be fixed!!!

GetBody: PUBLIC PROC [name: REF ANY] RETURNS [REF ANY];

GetLocals: PUBLIC PROC [name: REF ANY] RETURNS [REF ANY];

AddDef: PUBLIC PROC [name, locals, body: REF ANY]; -- adds to lambdaAlist the definition of name

- - - - XXX

Handle: TYPE = REF HandleRep;

NewHandle: PROC [v: ViewerClasses.Viewer]
RETURNS [h: Handle];

HandleRep: TYPE = RECORD [
ph: Parser.Handle,
viewer: ViewerClasses.Viewer,
WellFormed: SyntacticPredicate,
content: LIST OF NodeContent,
contentValid: BOOL];

NodeContent: TYPE = RECORD [text1: ROPE, text2: ROPE, tree: REF ANY];

SyntacticPredicate: TYPE =
PROC [f: REF ANY] RETURNS [VerdictAndCulprit];

VerdictAndCulprit: TYPE =
RECORD [verdict: Verdict, culprit: REF ANY];
culprit relevant only if verdict is No or OfCourseNot

Verdict: TYPE = {Yes, No, OfCourseNot}; -- Yes == innocent

HasForm: PROC[f: REF ANY, op: ATOM,
Arg1: SyntacticPredicate, Arg2: SyntacticPredicate ← NIL]
RETURNS [VerdictAndCulprit];
HasForm tests if Car[f] is of the form (op x y) where x is of the form Arg1 and y is of the form Arg2,unless Arg2 = NIL in which case the test is for the form (op x). It is assumed that Arg1 # NIL and (Arg1 = NIL => Arg2 = NIL).

Or: PROC [aw1, aw2: VerdictAndCulprit]
RETURNS [r: VerdictAndCulprit];

ParseViewer: PUBLIC PROC [pw: Handle];

AddTree: PUBLIC PROC[pw: Handle, tree: REF];
unparses the tree, adds the text, and repaints the viewer.

AddText: PUBLIC PROC[pw: Handle, text1: ROPE, text2: ROPE];
adds a new last node to the viewer, with header text1 and body text2. Does not parse the viewer or alter pw.content. The idea is that text1 and text2 will have fields to be filled in by the user.

AddOp: PROC[h: Handle, op: ROPE, alias: ROPE, -- alternate form; op is preferred
bp: INTEGER, f: OperatorType, c: ROPE, u: INT ← 0];

OperatorType: TYPE = {infix, matchfix, subfixMatchfix, prefix, infixPrefix, closefix};