GetInterFileImpl.mesa
Copyright © 1985, 1986 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, August 28, 1986 5:39:49 pm PDT
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: Node] = {
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 [Node] = {
RETURN [FromRope[RopeIO.FromFileC[file,start,len]]];
};
FromStream: PUBLIC PROC [stream: IO.STREAM, len: INT ← MaxLen] RETURNS [Node] = {
RETURN [FromRope[RopeIO.GetRope[stream,len]]];
};
FromRope: PUBLIC PROC [rope: ROPE, start: INT ← 0, len: INT ← MaxLen] RETURNS [Node] = {
source: RopeReader.Ref ← RopeReader.Create[];
RopeReader.SetPosition[source,Rope.Substr[rope,start,len]];
RETURN [Tree[source]];
};
Tree: PROC [source: RopeReader.Ref]
RETURNS [root: Node] = {
-- not implemented yet
RETURN [TextEdit.DocFromNode[TextEdit.FromRope[RopeReader.GetRope[source]]]];
};
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