TIPUser.mesa; Last Edited by McGregor, October 21, 1982 10:16 am
Last Edited by: Maxwell, January 3, 1983 11:01 am
DIRECTORY
ClassIncreek USING [Increek, SetAtLatest],
Process USING [Abort],
Rope USING [ROPE],
TIPTables USING [TIPTable, TIPScreenCoords, TIPScreenCoordsRec, TIPTime];
TIPUser: CEDAR DEFINITIONS IMPORTS ClassIncreek, Process = BEGIN
Documentation on [Indigo]<Cedar>TIP>TIP.documentation
These two basic handles may eventually become opaque types
TIPClient: TYPE = REF TIPClientRec; -- Handle on a TIP input process
TIPTable: TYPE = TIPTables.TIPTable; -- TIP parsing table
TIPScreenCoords are used to pass the hardware cursor information. [0,0] is lower left.
TIPScreenCoords: TYPE = TIPTables.TIPScreenCoords;
TIPScreenCoordsRec: TYPE = TIPTables.TIPScreenCoordsRec;
CreateClient: PROC [notify: TIPNotifyProc ← NIL, buttons: TIPButtonProc ← NIL]
RETURNS [self: TIPClient] ;
Creates (and FORKs) a new TIP process.
DestroyClient: PROC [self: TIPClient] ;
Cleanly destroys a TIP process.
CreateParseInfo: PROC [parseTable: TIPTable ← NIL] RETURNS [new: TIPParseInfo] ;
For convenience in creating a ParseInfo from scratch
ParseOneEvent: PROC [parseInfo: TIPParseInfo] RETURNS [result: LIST OF REF ANY] ;
given a TIP Parse Table and state, tries to parse a single event. If the first action does not match the start of a valid event, then NIL is returned. Note that the parseInfo.inCreek holds state info on CALL and RETURN.
InstantiateNewTIPTable: PROC [file: Rope.ROPENIL] RETURNS [table: TIPTable] ;
TIP tables are user-editable and normally live in the CIFS file system. Clients may instantiate new tables with this routine. An error in reading in a new table can produce the continuable InvalidTable signal.
TransparentTIPTable: PROC RETURNS [table: TIPTable] ;
In rare cases, a client wishes to gain access to the lower level increek actions. This TIPTable always returns each action as a list of: {ClassIncreek.Increek, REF ClassIncreek.ActionBody)..
InvalidTable: SIGNAL [errorMsg: Rope.ROPE];
PushTIPTable: PROC [user: TIPClient, table: TIPTable, opaque: BOOLEAN] ;
Layer a new TIP table to the input device interpreter. If opaque is TRUE, then unrecognised actions will be discarded without searching the complete TIP table stack past the top entry.
PopTIPTable: PROC [user: TIPClient] RETURNS [old: TIPTable] ;
discard the topmost entry in the device input interpreter stack. This may cause the popped entry to be garbage-collected unless the client saves a reference to it.
DiscardTypeAhead: PROC [user: TIPClient] = TRUSTED INLINE
{ClassIncreek.SetAtLatest[user.parseInfo.inCreek]};
discard any mouse/keyboard events not yet processed
ResetTIPContext: PROC [user: TIPClient, table: TIPTable, notify: TIPNotifyProc,
interrupt: BOOLEANFALSE] ;
Smashes a new TIP table and NotifyProc into the input device interpreter.
Experts/hackers only, please.
InterruptTIP: UNSAFE PROC [self: TIPUser.TIPClient] = UNCHECKED INLINE {
Process.Abort[self.matcher]};
Forces TIP interpreter to top level state.
Experts/hackers only, please.
TIPClientRec: TYPE = PRIVATE RECORD [
parseInfo: TIPParseInfo,    -- increeks and parse tables for matching
notifyProc: TIPNotifyProc ← NIL, -- notification of table recognised events
buttonProc: TIPButtonProc ← NIL, -- special button handling (for Cedar InputFocus)
discardProc: TIPNotifyProc ← NIL, -- discarded actions (currently unused)
matcher: PROCESS     -- the parser process
];
TIPParseInfo: TYPE = REF TIPParseInfoRec;
TIPParseInfoRec: TYPE = RECORD [
inCreek, localCreek, timeCreek: ClassIncreek.Increek,
creekStack: ARRAY [0..10) OF ClassIncreek.Increek,
tableHead: TIPTable
];
TIPNotifyProc: TYPE = PROC [results: LIST OF REF ANY] ;
TIPButtonProc: TYPE = PROC [screenXY: TIPTables.TIPScreenCoords,
mouseEvent: MouseEvent, state: ClassIncreek.Increek]
RETURNS [consume: BOOLEANFALSE] ;
MouseEvent: TYPE = {buttonUp, buttonDown, motion} ;
MatchProcess: PRIVATE PROC [self: TIPClient] ;
TIPPredicate: TYPE = PROC RETURNS [BOOLEAN] ;
RegisterTIPPredicate: PROC [key: ATOM, p: TIPPredicate];
a user-defined predicate may be included in the enables list of a TIPTable via this association mechanism.
TIP replaces $Char, $Coords, and $TIME with the following real addresses when constructing a TIPTable.
stdChar: REF CHARACTER;
stdCoords: TIPTables.TIPScreenCoords;
stdTime: TIPTables.TIPTime;
Start: PROC ; -- hack to fix VMSegmentsBug 8/14/81; call this before using
END.