DIRECTORY ClassIncreek USING [Increek], IO USING [STREAM], RefTab USING [Ref], Rope USING [ROPE], TerminalDefs USING [KeyName], TIPUser USING [TIPScreenCoords, TIPScreenCoordsRec, TIPTable, TIPTime]; TIPPrivate: CEDAR DEFINITIONS = BEGIN TIPTable: TYPE ~ TIPUser.TIPTable; TIPScreenCoords: TYPE ~ TIPUser.TIPScreenCoords; TIPScreenCoordsRec: TYPE ~ TIPUser.TIPScreenCoordsRec; TIPTime: TYPE ~ TIPUser.TIPTime; TIPClient: TYPE = REF TIPClientRec; -- Handle on a TIP input process 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: TIPScreenCoords, mouseEvent: MouseEvent, state: ClassIncreek.Increek ] RETURNS [consume: BOOL _ FALSE]; MouseEvent: TYPE = {buttonUp, buttonDown, motion}; CreateClient: PROC [notify: TIPNotifyProc _ NIL, buttons: TIPButtonProc _ NIL] RETURNS [self: TIPClient]; DestroyClient: PROC [self: TIPClient]; CreateParseInfo: PROC [parseTable: TIPTable _ NIL] RETURNS [new: TIPParseInfo]; ParseOneEvent: PROC [parseInfo: TIPParseInfo] RETURNS [result: LIST OF REF ANY]; PushTIPTable: PROC [user: TIPClient, table: TIPTable, opaque: BOOL]; PopTIPTable: PROC [user: TIPClient] RETURNS [old: TIPTable]; DiscardTypeAhead: PROC [user: TIPClient]; ResetTIPContext: PROC [user: TIPClient, table: TIPTable, notify: TIPNotifyProc, interrupt: BOOL _ FALSE]; InterruptTIP: UNSAFE PROC [self: TIPClient]; MatchProcess: PRIVATE PROC [self: TIPClient]; stdChar: REF CHAR; stdCoords: TIPScreenCoords; stdTime: TIPTime; ReadTIPTable: PROC [s: IO.STREAM] RETURNS [table: TIPTable, keyOption: KeyOption _ none]; BadTable: ERROR; -- raised by ReadTIPTable WriteTIPTable: PROC [table: TIPTable, keyOption: KeyOption, s: IO.STREAM]; EqualTables: PROC [t1, t2: TIPTable]; version: CHAR = '1; -- table syntax version number predTable: RefTab.Ref; -- table for user defined predicates KeyOption: TYPE = {none, printKeys, defaultKeys}; Symbol: TYPE = {OptionSym, Small, Fast, FastMouse, SlowMouse, PrintKeys, DefaultKeys, Opaque, Select, Trigger, Enable, From, Endcase, End, While, And, Up, Down, Mouse, After, Before, RightArrow, Comma, Semicolon, LeftCurly, RightCurly, Greater, Dot, VertBar, Char, Coords, Time, KeyIdent, Ident, Number, String, Illegal}; nrOfErrors: CARDINAL = 30; errorText: REF ARRAY [0..nrOfErrors] OF Rope.ROPE; keyNames: REF ARRAY TerminalDefs.KeyName OF Rope.ROPE; InitBuilder: PROC; END. The syntax of "compiled" tip table files follows: capital letters, numbers and parens are character literals lower case id's are names of syntax equations id* means 0 or more instances is a primitive of some sort such as text file = TIPTABLE version opaque link ignore variant version = opaque = flag link = N --none-- | P --printKeys-- | D --defaultKeys-- ignore = up down move up = flag down = flag move = flag variant = S small | F fast small = choiceseries fast = choice U choicearray D choicearray time time = choice choicearray = ( choiceitem* ) choiceitem = ( key choice ) choiceseries = ( choice* ) choice = ( term* ) term = 1 keytrigger | 2 --mousetrigger-- | 3 timetrigger | 4 keyenable | 5 predenable | 6 --CHAR-- | 7 --COORDS-- | 8 choiceseries | 9 results | A key2Enable | B keyEnableList | C --TIME-- keytrigger = key keystate key = keystate = U --up-- | D --down-- timetrigger = timeoutflavor msecs timeoutflavor = G --gt-- | L --lt-- msecs = high low high = low = keyenable = key keystate key2Enable = keyenable keyenable keyEnableList = ( keyenable* ) predenable = atom results = ( result* ) result = 1 atom | 2 --TIPUser.stdChar-- | 3 | 4 len | 5 --TIPScreenCoords-- | 6 --TIPUser.stdTime-- flag = T | F -- true or false atom = len pname pname = len = stored as series of characters. length limited to 255 chars stored as 4 bytes and stored as themselves TIPPrivate.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by McGregor, June 10, 1982 10:29 am Last Edited by: Maxwell, December 17, 1982 9:52 am Last Edited by: Paul Rovner, June 14, 1983 5:39 pm Doug Wyatt, April 14, 1985 9:45:07 pm PST Creates (and FORKs) a new TIP process. Cleanly destroys a TIP process. For convenience in creating a ParseInfo from scratch 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. 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. 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. discard any mouse/keyboard events not yet processed Smashes a new TIP table and NotifyProc into the input device interpreter. Experts/hackers only, please. Forces TIP interpreter to top level state. Experts/hackers only, please. TIP replaces $Char, $Coords, and $TIME with the above real addresses when constructing a TIPTable. Κ– "Mesa" style˜codešΟc™Kšœ Οmœ1™