AMViewerOps.mesa
Russ Atkinson, April 13, 1983 6:59 pm
Paul Rovner, October 27, 1983 8:20 pm
DIRECTORY
AMTypes USING [TV],
AMModel USING [Context, Section],
AMModelBridge USING [LoadedSection],
FileViewerOps USING [SelectionOption],
Rope USING [ROPE],
ViewerClasses USING [Viewer],
WorldVM USING [World];
AMViewerOps: CEDAR DEFINITIONS
= BEGIN OPEN AMTypes, Rope, WorldVM;
Section: TYPE = AMModel.Section;
LoadedSection: TYPE = AMModelBridge.LoadedSection;
SelectionOption: TYPE = FileViewerOps.SelectionOption;
primary => use primary selection
feedback => use feedback selection
Viewers/Section translations
ViewerFromSection: PROC
[section: AMModel.Section, report: ReportProc] RETURNS [viewer: ViewerClasses.Viewer];
... returns an open viewer for the given Section; Reports through report if not possible.
SectionFromSource: PROC
[world: World ← NIL, name: ROPENIL, index: INT ← 0]
RETURNS [section: AMModel.Section, contexts: LIST OF AMModel.Context];
... returns a section for the given source (the name can be a long path name); !AMTypes.Error if this cannot be done. If world = NIL then world ← LocalWorld. warn = TRUE => the version of the source file for the given location does not correspond to the viewer (although this is no guarantee that the wrong thing happened). The name given MUST be for an open viewer, and the index given MUST be in the proper source range.
SectionFromSelection: PROC
[world: World ← NIL, which: SelectionOption ← primary]
RETURNS [section: AMModel.Section, contexts: LIST OF AMModel.Context];
... returns a loaded section for the given viewer; !AMTypes.Error if this cannot be done. If world = NIL then world ← LocalWorld. warn = TRUE => the version of the source file for the given location does not correspond to the viewer (although this is no guarantee that the wrong thing happened). The name given MUST be for an open viewer, and the index given MUST be in the proper source range.
SourceFromTV: PROC [tv: TV, report: ReportProc] RETURNS [name: ROPE, index: INT];
... gets the source file name and the source index for the given TV, which must be a local frame or global frame; if not successful, then name = NIL & index < 0.
ERRORS
Severity: TYPE = {success, comment, warning, fatal};
success => operation is completed
comment => intermediate information
warning => something is wrong, but not fatal
fatal => operation is completed, but did not succeed
ReportProc: TYPE = PROC [msg: ROPE, severity: Severity];
... is the type of user-supplied procedure used to report results in above operations
END.