-- BBVOps.mesa
-- Russ Atkinson, November 15, 1982 11:16 am

DIRECTORY
BBObjectLocation USING [Location],
BcdDefs USING [VersionStamp],
Rope USING [ROPE],
RTBasic USING [TV],
VersionMap USING [Map, MapList],
ViewerClasses USING [Viewer],
WorldVM USING [World];

BBVOps: CEDAR DEFINITIONS
= BEGIN OPEN Rope, RTBasic, WorldVM;

SourceError: PUBLIC ERROR [reason: ROPE];
-- this error occurs when we can't make a viewer from a global frame TV
-- the reason explains why (at least at a gross level)

-- default source version map operations

FileNameFromSourceVersion: PUBLIC PROC
[sourceVersion: BcdDefs.VersionStamp] RETURNS [name: ROPE];
-- returns a name corresponding to the given version stamp
-- does not check for multiple names

GetVersionMapList: PUBLIC PROC RETURNS [VersionMap.MapList];
-- gets the current version map for source files

SetVersionMapList: PUBLIC PROC [list: VersionMap.MapList ← NIL];
-- sets the current version map for source files
-- should not be casually used!

AddToVersionMapList: PUBLIC PROC [map: VersionMap.Map];
-- adds a new map to the lookup list
-- to be used for adding personal version maps

-- Viewers/Location translations

ViewerFromLocation: PROC
[loc: BBObjectLocation.Location] RETURNS [viewer: ViewerClasses.Viewer];
-- opens a Tioga viewer for the given source location
-- ERROR SourceError occurs if this cannot be done

LocationFromSelection: PROC
[world: World ← NIL, entry,exit: BOOLFALSE]
RETURNS [loc: BBObjectLocation.Location];
-- returns a location for the given selection
-- returns NIL if can't do it
-- world = NIL => use LocalWorld

GFHToVersionStamps: PUBLIC PROC
[gf: TV] RETURNS [source,object: BcdDefs.VersionStamp];
-- returns the source and object version stamps for the given global frame TV
-- returns BcdDefs.NullVersion for both if this cannot be done

LocalFileVersion: PUBLIC PROC
[name: ROPE] RETURNS [version: BcdDefs.VersionStamp];
-- returns the version stamp (create date) for the named file on the local disk
-- does not return the correct version stamp for a BCD file, but who cares?
-- after all, this module just supports source mapping!

END.