GetInterFileImpl.Mesa
written by Paxton. January 1981
Paxton. August 24, 1982 10:40 am
Russ Atkinson, July 25, 1983 3:14 pm
DIRECTORY
FS,
InterFile,
TextEdit,
RopeFrom,
IO,
RopeEdit,
RopeIO,
RopeReader;
GetInterFileImpl: CEDAR PROGRAM
IMPORTS FS, RopeFrom, RopeEdit, RopeIO, RopeReader, TextEdit
EXPORTS InterFile
= BEGIN OPEN InterFile;
FromFileError: PUBLIC ERROR = CODE;
FromFile: PUBLIC PROC [fileName: ROPE, start: Offset ← 0, len: Offset ← MaxLen]
RETURNS [root: Ref] = {
file: FS.OpenFile = FS.Open[fileName, read];
root ← FromFileC[file,start,len];
FS.Close[file];
};
FromFileC: PUBLIC PROC
[file: FS.OpenFile, start: Offset ← 0, len: Offset ← MaxLen] RETURNS [Ref] = {
RETURN [FromRope[RopeFrom.File[file,start,len]]];
};
FromStream: PUBLIC PROC [stream: IO.STREAM, len: Offset ← MaxLen] RETURNS [Ref] = {
RETURN [FromRope[RopeIO.GetRope[stream,len]]];
};
FromRope: PUBLIC PROC [rope: ROPE, start: Offset ← 0, len: Offset ← MaxLen] RETURNS [Ref] = {
source: RopeReader.Ref ← RopeReader.Create[];
RopeReader.SetPosition[source,RopeEdit.Substr[rope,start,len]];
RETURN [Tree[source]];
};
Tree: PROC [source: RopeReader.Ref]
RETURNS [root: Ref] = {
-- not implemented yet
RETURN [TextEdit.DocFromNode[TextEdit.FromRope[RopeReader.GetRope[source]]]];
};
StartGetFile: PUBLIC PROC = {
};
END.
Current limited syntax for Tioga InterDoc files:
node = '{ typename property* contents child* '}
property = propname '= ( text | node )
text = '< character* '>
contents = ( text | run )* | other
run = '{ looks text '}
looks = "looks=" text
other = varietyname '[ text ']
child = node