DIRECTORY AMModel USING [Context, Section], AMModelBridge USING [LoadedSection], BcdDefs USING [VersionStamp], Rope USING [ROPE], RTBasic USING [TV], ViewerClasses USING [Viewer], WorldVM USING [World]; AMViewerOps: CEDAR DEFINITIONS = BEGIN OPEN Rope, RTBasic, WorldVM; Section: TYPE = AMModel.Section; LoadedSection: TYPE = AMModelBridge.LoadedSection; SourceError: PUBLIC ERROR [reason: ROPE]; SelectionOption: TYPE = {primary, feedback}; ViewerFromSection: PROC [section: AMModel.Section, report: ReportProc] RETURNS [viewer: ViewerClasses.Viewer]; SectionFromSource: PROC [world: World _ NIL, name: ROPE _ NIL, index: INT _ 0] RETURNS [section: AMModel.Section, contexts: LIST OF AMModel.Context]; SectionFromSelection: PROC [world: World _ NIL, which: SelectionOption _ primary] RETURNS [section: AMModel.Section, contexts: LIST OF AMModel.Context]; SourceFromSelection: PROC [which: SelectionOption _ primary] RETURNS [name: ROPE _ NIL, index: INT _ -1]; GFToVersionStamps: PUBLIC PROC [gf: TV] RETURNS [source,object: BcdDefs.VersionStamp]; FileVersion: PUBLIC PROC [name: ROPE] RETURNS [version: BcdDefs.VersionStamp]; SourceFromTV: PROC [tv: TV, report: ReportProc] RETURNS [name: ROPE, index: INT]; OpenSource: PROC [name: ROPE, index: INT, chars: INT _ 2, report: ReportProc]; ReportProc: TYPE = PROC [msg: ROPE, severity: Severity]; ReportError: ERROR [msg: ROPE, severity: Severity]; Severity: TYPE = {success, comment, warning, fatal}; END. dAMViewerOps.mesa Russ Atkinson, April 13, 1983 6:59 pm This file started life as a concatenation of BBVOps and BBVForUserExec. It has changed somewhat to reflect its existance as a lower-level interface exported form BugBaneLower. ... occurs when we can't make a viewer from a global frame TV. The reason explains why (at least at a gross level). primary => use primary selection feedback => use feedback selection Viewers/Section translations ... returns an open viewer for the given LoadedSection; Reports through report if not possible. ... returns a section for the given source (the name can be a long path name); ERROR SourceError 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. ... returns a loaded section for the given viewer; ERROR SourceError 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. **** Utility routines **** These routines are hardly essential ... returns the file name and position within the file for the selected viewer (returns [NIL, -1] if no valid Tioga viewer is selected). This is not essential here, but it can be useful. ... returns the source and object version stamps for the given global frame TV, or returns BcdDefs.NullVersion for both if this cannot be done. ... returns the version stamp (create date) for the named file (the path name can be long). This routine does not return the correct version stamp for a BCD file, but after all, this module just supports source mapping! ... 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. ... uses the results of GetSource to open a viewer on the source. If index >= 0, then also set the feedback selection to the given index (for chars characters). ... is the type of user-supplied procedure used to report results in above operations ... is the error used if supplied ReportProc = NIL and severity IN [warning..fatal] success => operation is completed comment => intermediate information warning => something is wrong, but not fatal fatal => operation is completed, but did not succeed ʘJšœ™Jšœ%™%J™J™°J™šÏk ˜ Jšœœ˜!Jšœœ˜$Jšœœ˜Jšœœœ˜Jšœœœ˜Jšœœ ˜Jšœœ ˜J˜—šœ œ ˜Jšœœœ˜$J˜Jšœ œ˜ Jšœœ˜2J˜Jšœ œœ œ˜)Jšœt™tJ˜šœœ˜,Jšœ ™ Jšœ"™"J˜—Jšœ™J˜šÏnœ˜Jšœ/œ ˜VJšœ_™_J˜—šžœ˜Jš œœœœ œ˜6Jšœ&œœ˜GJšœ¬™¬J˜—šžœ˜Jšœœ#˜6Jšœ&œœ˜GJšœ™J˜—šœ™J™#—J˜šžœ˜Jšœ"˜"Jšœœœ œ˜-Jšœ»™»J˜—šžœœ˜Jšœœœ'˜7Jšœ™J˜—šž œœ˜Jšœœœ"˜6JšœÜ™ÜJ˜—š ž œœœœœ œ˜QJšœ¡™¡J˜—š ž œœœ œ œ˜NJšœ¡™¡J˜—šž œœœœ˜8JšœU™UJ˜—šœ œœ˜3JšœT™TJ˜—šœ œ&˜4Jšœ!™!Jšœ#™#Jšœ,™,Jšœ4™4J˜—Jšœ˜J˜J˜——…—Ê/