File: CmFile.mesa - last edit:
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
JGS: 18-Aug-81 8:33:00
Tom: Aug 29, 1979 10:38 AM
Mark: 19-May-81 11:16:22
SXW : 10-Jul-81 17:25:14
LXR : 15-Oct-82 10:37:24
Philip James, March 13, 1991 3:30 pm PST
Copyright (C) Xerox Corporation 1982. All rights reserved.
DIRECTORY
Rope USING [ROPE],
StringLookUp USING [noMatch, TableDesc],
Token USING [Handle];
CmFile: CEDAR DEFINITIONS =
BEGIN
Routines to process any Cm file
noMatch: CARDINAL = LAST[CARD]; --StringLookUp.noMatch;
TableDesc: TYPE ~ REF Table;
Table: TYPE ~ RECORD[
body: SEQUENCE len: CARD OF Rope.ROPE];
Handle: TYPE = Token.Handle;
Close: PROCEDURE [h: Handle] RETURNS [nil: Handle];
FindItem: PROCEDURE [h: Handle, title, name: Rope.ROPE] RETURNS [found: BOOLEAN];
FindSection: PROCEDURE [h: Handle, title: Rope.ROPE]
RETURNS [opened: BOOLEAN];
FreeString: PROCEDURE [Rope.ROPE] RETURNS [nil: Rope.ROPE];
Line: PROCEDURE [fileName, title, name: Rope.ROPE] RETURNS [Rope.ROPE];
NextItem: PROCEDURE [h: Handle] RETURNS [name, value: Rope.ROPE];
NextValue: PROCEDURE [h: Handle, table: TableDesc]
RETURNS [index: CARDINAL];
index = noMatch is end-of-section indicator
Open: PROCEDURE [fileName: Rope.ROPE] RETURNS [h: Handle];
Use "User.cm" as fileName in above
UserDotCmLine: PROCEDURE [title, name: Rope.ROPE] RETURNS [s: Rope.ROPE];
UserDotCmOpen: PROCEDURE RETURNS [h: Handle];
Utilities
ReadLineOrToken: PROCEDURE [
h: Token.Handle, buffer: Rope.ROPE, terminator: CHARACTER];
TitleMatch: PROCEDURE [buffer, title: Rope.ROPE] RETURNS [matches: BOOLEAN];
SIGNALs (and their codes) that can be raised
ErrorCode: TYPE = {fileNotFound, invalidHandle, other};
Error: SIGNAL [code: ErrorCode];
TableError: SIGNAL [h: Handle, name: Rope.ROPE];
END. -- of CmFile