GetInterFileImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
written by Paxton. January 1981
Paxton. August 24, 1982 10:40 am
Russ Atkinson, July 25, 1983 3:14 pm
Plass, March 1, 1985 5:18:12 pm PST
Doug Wyatt, March 3, 1985 2:45:38 pm PST
DIRECTORY
FS,
InterFile,
TextEdit,
IO,
Rope,
RopeIO,
RopeReader;
GetInterFileImpl:
CEDAR
PROGRAM
IMPORTS FS, Rope, RopeIO, RopeReader, TextEdit
EXPORTS InterFile
= BEGIN OPEN InterFile;
FromFileError: PUBLIC ERROR = CODE;
FromFile:
PUBLIC
PROC [fileName:
ROPE, start:
INT ← 0, len:
INT ← 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: INT ← 0, len: INT ← MaxLen] RETURNS [Ref] = {
RETURN [FromRope[RopeIO.FromFileC[file,start,len]]];
};
FromStream:
PUBLIC
PROC [stream:
IO.
STREAM, len:
INT ← MaxLen]
RETURNS [Ref] = {
RETURN [FromRope[RopeIO.GetRope[stream,len]]];
};
FromRope:
PUBLIC
PROC [rope:
ROPE, start:
INT ← 0, len:
INT ← MaxLen]
RETURNS [Ref] = {
source: RopeReader.Ref ← RopeReader.Create[];
RopeReader.SetPosition[source,Rope.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