VoiceUtils.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Last modified by D. Swinehart, November 14, 1985 2:04:51 pm PST
This interface implements a number of utility routines used by all of the voice system components.
DIRECTORY
Commander USING [ Handle ],
GVBasics USING [ Password ],
IO USING [ STREAM, Value ],
Rope USING [ ROPE ],
RPC USING [ EncryptionKey ],
RPCPkt USING [ Machine ]
;
VoiceUtils: CEDAR DEFINITIONS = {
Variables
PD:
TYPE =
RECORD [
attended: BOOLEAN←FALSE,
sysIn: IO.STREAM,
sysOut: IO.STREAM, -- IOs for error and system status reporting
ch: Commander.Handle←NIL
];
pd: REF PD;
Types
ROPE: TYPE=Rope.ROPE;
Rname: TYPE = ROPE;
NetAddress: TYPE = RPCPkt.Machine;
Status reporting, Error reporting and management
Report finds an appropriate stream and prints a time-stamped version of remark. Clients can register procedures to interpret the WhereToReport atoms and obtain the appropriate stream for a given call, aided by the whereData supplied in the Report call.
Problem is intended for reporting unexpected errors and conditions. It will raise an internal SIGNAL if the system is currently attended (there's an executive command.) In any case, it will Report the remark argument. It will return automatically or if the operator proceeds from the signal, so the caller needs to do what is necessary to recover after calling Problem.
The defaultIfNotFound parameter to the registration procedure indicates whether the message should be ignored (FALSE) or printed (TRUE) when the corresponding stream-finding procedure returns NIL.
WhereToReport: TYPE=ATOM;
WhereProc: TYPE = PROC[fixedWhereData: REF, whereData: REF] RETURNS[s: IO.STREAM←NIL];
nullValue: IO.Value = [null[]];
DNFProc: TYPE = PROC[fixedWhereData: REF, whereData: REF] RETURNS[default: BOOL];
RegisterWhereToReport:
PROC[
proc: WhereProc←NIL, where: WhereToReport, fixedWhereData: REF←NIL, defaultIfNotFound: DNFProc←NIL];
IF defaultIfNotFound=NIL, answer assumed TRUE
FindWhere: PROC[where: WhereToReport, whereData: REF] RETURNS [s: IO.STREAM←NIL];
Report: PROC[remark: ROPE, where: WhereToReport←NIL, whereData: REF ←NIL];
ReportFR:
PROC[remark:
ROPE, where: WhereToReport←
NIL, whereData:
REF ←
NIL,
a1, a2, a3: IO.Value ← nullValue];
Problem:
PROC[
remark: ROPE←NIL, where: WhereToReport←NIL, whereData: REF ←NIL];
ProblemFR:
PROC[
remark:
ROPE←
NIL, where: WhereToReport←
NIL, whereData:
REF ←
NIL,
a1, a2: IO.Value ← nullValue];
Simple RName, password, net address manipulations. These just look at local machine global information or do various kinds of parsing; they don't do any communicating.
Registrize:
PROC[name:
ROPE]
RETURNS [
ROPE];
Adds the Default registry to the name if the name doesn't have a registry field.
CurrentRName:
PROC
RETURNS [
ROPE];
Current logged-in name.
CurrentPasskey: PROC[passwordText: ROPE←NIL] RETURNS [RPC.EncryptionKey];
CurrentPassword:
PROC[passwordText:
ROPE←
NIL]
RETURNS [GVBasics.Password] =
INLINE {
RETURN[LOOPHOLE[CurrentPasskey[passwordText]]]; };
Keys made from logged in password. The two types are based on client needs.
OwnNetAddress: PROC RETURNS [netAddress: NetAddress];
Rspec: TYPE = REF RspecBody;
RspecBody:
TYPE =
RECORD [
simpleName: ROPE←NIL,
registry: ROPE←NIL];
InstanceFromNetAddress:
PROC[netAddress: NetAddress, suffix:
ROPE←
NIL]
RETURNS [instance: Rname];
Returns instance name, concatenated with suffix.
Suffix could be "0" to complete a text version of a socket ID, or ".lark" to complete an RName.
RnameToRspec:
PROC[name: Rname, defaultRegistry:
ROPE←
NIL]
RETURNS [spec: Rspec];
Takes the fields of an Rname apart.
RspecToRname:
PROC[spec: Rspec]
RETURNS [name: Rname];
Puts one back together.
RspecToSortName:
PROC[spec: Rspec]
RETURNS [name:
ROPE];
Produces a rope of the form registry.name
MakeAtom:
PROC[rName: Rname, case:
BOOL←
FALSE]
RETURNS [
ATOM];
Produces a case-independent (if case=FALSE) unique atom from the RName
CommandTool parsing aid
CmdOrToken:
PROC[cmd: Commander.Handle, key:
ROPE, default:
ROPE←
NIL]
RETURNS [value: ROPE];
}.
Swinehart, July 19, 1985 2:34:21 pm PDT
Clean up, eliminate SLOG stuff (Break Tool, Spy, Celtics dominate), DIRECTORY, Log
Swinehart, October 24, 1985 3:48:07 pm PDT
This was always Log until now.
Eliminate CLog stuff, GetBinding stuff, combine with Names (also pruned severely), CurrentPasskey, ROPE, NetAddress, Rname
Swinehart, October 28, 1985 10:02:53 am PST
Eliminate ProblemBool, ProblemHandle
changes to: WhereToReport, ProblemFR