DIRECTORY ClassIncreek USING [Increek, NewStdIncreek], Process USING [GetCurrent], RefTab USING [Create, Ref, Store], TIPPrivate, TIPUser; TIPUserImpl: CEDAR PROGRAM IMPORTS ClassIncreek, Process, RefTab, TIPUser EXPORTS TIPUser, TIPPrivate SHARES TIPUser = BEGIN OPEN TIPUser, TIPPrivate; predTable: PUBLIC RefTab.Ref _ RefTab.Create[]; -- table for user defined predicates CreateClient: PUBLIC PROC [notify: TIPNotifyProc _ NIL, buttons: TIPButtonProc _ NIL] RETURNS [self: TIPClient] = TRUSTED BEGIN self _ NEW[TIPClientRec _ [ notifyProc: notify, buttonProc: buttons, parseInfo: CreateParseInfo[], matcher: ]]; self.matcher _ LOOPHOLE[Process.GetCurrent[]]; -- so is never NIL when MatchProcess begins self.matcher _ FORK MatchProcess[self]; END; DestroyClient: PUBLIC PROC [self: TIPClient] = TRUSTED BEGIN self.matcher _ NIL; -- force matcher to terminate END; CreateParseInfo: PUBLIC PROC [parseTable: TIPTable _ NIL] RETURNS [new: TIPParseInfo] = TRUSTED BEGIN new _ NEW[TIPParseInfoRec _ [ inCreek: ClassIncreek.NewStdIncreek[], localCreek: ClassIncreek.NewStdIncreek[], timeCreek: ClassIncreek.NewStdIncreek[], creekStack: ALL[ClassIncreek.NewStdIncreek[]], tableHead: parseTable ]]; END; PushTIPTable: PUBLIC PROC [user: TIPClient, table: TIPTable, opaque: BOOLEAN] = BEGIN t: TIPTable; FOR t _ table, t.link UNTIL t.link=NIL DO ENDLOOP; t.link _ user.parseInfo.tableHead; user.parseInfo.tableHead _ table; table.opaque _ opaque; END; PopTIPTable: PUBLIC PROC [user: TIPClient] RETURNS [old: TIPTable] = BEGIN IF (old_user.parseInfo.tableHead)#NIL THEN user.parseInfo.tableHead _ user.parseInfo.tableHead.link; END; RegisterTIPPredicate: PUBLIC PROC [key: ATOM, p: TIPPredicate] = BEGIN [] _ RefTab.Store[predTable, key, NEW[TIPPredicate _ p]]; END; END. &TIPUserImpl.mesa; Edit by McGregor, June 3, 1983 5:46 pm Last Edited by: Maxwell, January 3, 1983 11:06 am garbage collector will get old table unless the client keeps a reference a user-defined predicate may be included in the enables list of a TIPTable via this association mechanism. Κw– "Mesa" style˜JšΟc8™8Jšœ1™1J™šΟk ˜ Jšœ žœ˜,Jšœžœ˜Jšœžœ˜"J˜ J˜J˜—Jšœ ž ˜J˜Jšžœ'˜.Jšžœ˜Jšžœ žœžœ˜0J˜Jšœ žœ$˜TJ˜š Οn œžœžœžœžœ˜Ušžœžœž˜)šœžœ˜J˜J˜J˜Jšœ˜J˜—Jšœžœ+˜ZJšœžœ˜'Jšžœ˜J˜——š Ÿ œžœžœžœž˜