ComputeUtilsImpl.mesa
The Compute Server Utilities program running on the server/controller.
This EXPORTs to ComputeServerCallbacks for the Error code. Run this once if testing in a single machine, and in each machine during normal operation.
Last Edited by: Bob Hagmann, November 5, 1985 1:05:25 pm PST
Copyright © 1984 by Xerox Corporation. All rights reserved.
DIRECTORY
ComputeServerCallbacks,
ComputeUtils,
FS,
IO,
Rope;
ComputeUtilsImpl: CEDAR PROGRAM
IMPORTS IO, Rope
EXPORTS ComputeServerCallbacks, ComputeUtils
= BEGIN
Variable Declarations
STREAM: TYPE = IO.STREAM;
ROPE: TYPE = Rope.ROPE;
Error: PUBLIC ERROR [error: FS.ErrorDesc] = CODE;
DF File Parsing
SkipWhite: PUBLIC PROC [packageListStream: STREAM, flushLines: BOOLFALSE] RETURNS [c: CHAR] = {
DO
ENABLE IO.Error, IO.EndOfStream => GO TO stop;
c ← packageListStream.PeekChar[];
SELECT c FROM
'\n => IF NOT flushLines THEN RETURN;
<= 40C => {};
'- => {-- could be a comment
[] ← packageListStream.GetChar[];
IF packageListStream.PeekChar[] # '- THEN {
it is not a comment
packageListStream.Backup[c];
RETURN [c];
};
DO
the end of a comment is either a '\n or a double -
c ← packageListStream.GetChar[];
SELECT c FROM
'\n => {
Only flush the \n if it was requested
packageListStream.Backup[c];
IF flushLines THEN EXIT;
RETURN;
};
'- => IF packageListStream.PeekChar[] = '- THEN EXIT;
ENDCASE;
ENDLOOP;
};
ENDCASE => RETURN;
[] ← packageListStream.GetChar[];
ENDLOOP;
EXITS stop => {c ← 0C};
};
LocalToken: PUBLIC PROC [packageListStream: STREAM, flushLines: BOOLFALSE] RETURNS [token:ROPENIL] = {
stop: CHAR ← SkipWhite[packageListStream, flushLines];
token ← NIL;
SELECT stop FROM
0C, '\n => RETURN;
'" => token ← packageListStream.GetRopeLiteral[];
ENDCASE => token ← packageListStream.GetTokenRope[tokenProc].token;
};
tokenProc: IO.BreakProc = {
RETURN[SELECT char FROM
IO.SP, IO.TAB, ', => sepr,
IO.CR, ': => break,
ENDCASE => other
];
};
trueOrFalse: PUBLIC PROC [token: ROPE] RETURNS [tOfF: ComputeUtils.threeValueLogic] = {
IF token = NIL THEN RETURN[other];
IF token.Equal["TRUE", FALSE] THEN RETURN[true];
IF token.Equal["FALSE", FALSE] THEN RETURN[false];
RETURN[other];
};
END.
Bob Hagmann November 5, 1985 1:05:25 pm PST
changes to: DIRECTORY, ComputeUtilsImpl, ROPE, Error