SystemInterface.mesa
Copyright Ó 1990 by Xerox Corporation. All rights reserved.
Theimer, October 14, 1989 10:22:52 pm PDT
Last changed by Theimer on October 31, 1989 8:15:21 pm PST
Last tweaked by Mike Spreitzer on May 23, 1991 9:40 am PDT
Coolidge, July 17, 1990 3:26 pm PDT
Laurie Horton, October 10, 1990 5:12 pm PDT
Philip James, December 26, 1991 9:58 am PST
This package is intended to hide the details of the Cedar programming environment from Cirio. That is, the details of the user interface and the file system convention (mostly naming conventions such as the []<> notation) are abstracted behind the procedures in the module.
Trivial change by MJS May 23, 1991 9:40:30 am PDT, on 11-Dec-90 19:51:57 PST version, to change opaque TYPE ids.
DIRECTORY
PFS USING [nullUniqueID, UniqueID],
PFSNames USING [PATH],
IO USING [STREAM],
MobDefs USING [VersionStamp],
Rope USING [ROPE],
SourceFileOpsExtras USING [Position];
SystemInterface: CEDAR DEFINITIONS
= BEGIN OPEN IO, Rope;
Useful shorthand
ROPE: TYPE ~ Rope.ROPE;
RopeList: TYPE ~ LIST OF ROPE;
PATH: TYPE ~ PFSNames.PATH;
PathList: TYPE ~ LIST OF PATH;
Useful, since many packages wish to deliver reports
ShowReport: SIGNAL[msgText: ROPE, priority: ATOM];
priority is one of the following:
$urgent, $normal, $debug
Routines that abstract the FileViewerOps interface.
ShowSource: PROC [desc: ROPE, pos: SourceFileOpsExtras.Position, feedBack: STREAMNIL];
Directs the user's attention to the given location.
Routines that hide the details of file naming conventions.
All routines that know about the differences between D-machine and PCedar file names are (supposedly) here.
DebuggeeUnixNameToDebuggerCedarName: PROC [unixName: PATH, debuggee: ROPE] RETURNS [PATH];
MesaFileNameToCFileName: PROC [mesaFileName: ROPE, reports: IO.STREAM] RETURNS [ROPE];
Returns the name of the C file that was compiled from the specified mesa file.
CFileNameToDotOFileName: PROC [cFileName: ROPE, reports: IO.STREAM] RETURNS [ROPE];
Returns the name of the dotO file that was compiled from the specified C file.
DotOFileNameToCFileName: PROC [dotOFileName: ROPE, searchDirectories: LIST OF ROPE, reports: IO.STREAM] RETURNS [ROPE];
Returns the name of the C file from which the specified dotO file was compiled. If the C file can't be found in the same directory (or immediate ancestor thereof if the directory is a "machine-dependent" subdirectory) as the dotO file then the connection's search directories are tried as well. Returns NIL if a C file can't be found.
CFileNameToMesaFileName: PROC [dotCFileName: ROPE, reports: IO.STREAM] RETURNS [ROPE];
Returns the name of the mesa file from which the specified C file was compiled. Returns NIL if not found.
DetermineFileSystemView: PROC [fileName: ROPE, reports: IO.STREAM] RETURNS [ROPE];
ConvertFileNameToLocalFormat: PROC [fileName: ROPE, defaultDirectory: ROPE ← NIL] RETURNS [ROPE];
Converts a file name to the format used on the machine on which Cirio is running. For example, the PCedar file name /net/palain/palain/theimer/foo.c would be converted to the name /palain-ux/palain/theimer/foo.c if Cirio is running on a D-machine. If the file name is not full-qualified then the defaultDirectory is prepended to it.
ConvertToDirectoryFormat: PROC [dirName: ROPE] RETURNS [ROPE];
Makes sure the directory name ends in a pathname separator character.
ReplaceDirectory: PROC [fileName: ROPE, newDirectoryName: ROPE ← NIL] RETURNS [ROPE];
Replaces the directory part of a (fully-qualified) file name.
MachineDependentSubdirectoryName: PROC [] RETURNS [ROPE];
Returns the name of the machine-dependent subdirectory that Cedar .o files might reside in.
File Sets
So that we can keep a moderate number of streams open, without having to worry about the details in the main Cirio code
A FileSet is a collection of files.
FileSet: TYPE = REF FileSetBody;
FileSetBody: TYPE;
CirioFile: TYPE = REF CirioFileBody;
CirioFileBody: TYPE;
MJS 11-Dec-90: CirioFiles were partly mutable, partly immutable; I'm changing them to be consistently immutable (which should enable debugging of successive versions of a program).
CirioFileInfo: TYPE = RECORD[uniqueID: PFS.UniqueID, bytes: INT, fullName: PATH];
CreateFileSet: PROC RETURNS[FileSet];
the number of actually open streams is held low
CloseFileSet: PROC[set: FileSet];
no references to the files in this set may be made after closure
all streams will be automatically closed, whether or not they are active.
GetCirioFile: PROC[set: FileSet, name: PATH, uniqueID: PFS.UniqueID ← PFS.nullUniqueID] RETURNS[CirioFile];
The name is a PFS name intended for interpretation on the debugger machine.
GetCirioFileFromDebuggee: PROC[set: FileSet, name: PATH, debuggee: ROPE, uniqueID: PFS.UniqueID ← PFS.nullUniqueID] RETURNS[CirioFile];
The name is a UNIX name intended for interpretation on the debuggee machine.
GenCirioFilesForInfo: PROC[set: FileSet, pattern: PATH, for: PROC[CirioFileInfo] RETURNS[thisIsIt: BOOLEAN]] RETURNS[found: CirioFile];
generation stops when the returned Boolean is TRUE. Found is non NIL if the generation was stopped, in which case found is the file whose information for was examining when for returned TRUE. If the generation was not stopped, then found will be NIL.
GenVersionMapFilesForInfo: PROC [set: FileSet, map: ATOM, versionStamp: MobDefs.VersionStamp, stems: PathList, suffixes: RopeList, testName: BOOL, for: PROC[CirioFileInfo] RETURNS[thisIsIt: BOOLEAN], wantedUniqueID: PFS.UniqueID ← PFS.nullUniqueID] RETURNS[found: CirioFile];
IF NOT testName THEN stems=NIL and suffixes=NIL and only stamp and wantedUniqueID are used to lookup files; otherwise, file short names match some Concat[stem, suffix]. Either the given version stamp is null, or the files have the given version stamp. Either the given UniqueID is null, or the files have the given UniqueID.
GetNameOfFile: PROC[file: CirioFile] RETURNS[PATH];
GetFileInfo: PROC[file: CirioFile] RETURNS[CirioFileInfo];
GetStreamForFile: PROC[file: CirioFile] RETURNS[IO.STREAM];
Creates a new stream if all existing streams on this file are active, otherwise returns n existing stream.
The returned stream is at index 0 and is considered active.
ReleaseStreamForFile: PROC[file: CirioFile, stream: IO.STREAM];
The stream becomes inactive.
Subsequent references to this stream are illegal, however, there is no check.
This does not necessarily close the stream. Only if streams are opened on other files, so that the active stream count gets high, will this stream be closed.
FmtUniqueID: PROC [PFS.UniqueID] RETURNS [ROPE];
Raises no errors.
VersionStampToUniqueID: PROC [MobDefs.VersionStamp] RETURNS [PFS.UniqueID];
For version stamps that encode create date. Raises CCError for others.
UniqueIDToVersionStamp: PROC [PFS.UniqueID] RETURNS [MobDefs.VersionStamp];
Raises CCError if it can't faithfully convert.
END.