X11Tcl.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, January 17, 1992 8:20:45 pm PST
Christian Jacobi, June 19, 1992 12:26 pm PDT
Interprocess communication using the Tcl protocol.
(Without implied use of Tcl for interpretation.)
DIRECTORY Rope, Xl;
X11Tcl: CEDAR DEFINITIONS ~ BEGIN
TclCode: TYPE = MACHINE DEPENDENT {ok(0), error(1), return(2), break(3), continue(4), noInterpreter(CARD32.LAST-1), timeout(CARD32.LAST)};
timeout, noInterpreter are not used by Tcl but generated locally by Send
ListenerProc: TYPE = PROC [c: Xl.Connection, interpreterName: Rope.ROPE, command: Rope.ROPE, clientData: REF] RETURNS [code: TclCode ¬ ok, reply: Rope.ROPE ¬ NIL];
Type for procedure called when a command is received
c: could be NIL if interpreter is local and local interpreter are shortcut
UnregisterNotifyProc: TYPE = PROC [c: Xl.Connection, interpreterName: Rope.ROPE, clientData: REF];
Called when a registered interpreter has been superceeded
Not called when reason for unregister was a closed connection
RegisterInterpreter: PROC [c: Xl.Connection, interpreterName: Rope.ROPE, listener: ListenerProc, unregisterNotify: UnregisterNotifyProc ¬ NIL, clientData: REF ¬ NIL, thread: Xl.TQ ¬ NIL, overwrite: BOOL ¬ FALSE, replyOnPing: BOOL ¬ TRUE, refCounting: BOOL ¬ FALSE] RETURNS [ok: BOOL];
Registers an interpreter "interpreterName" listening for arbitrary commands.
This is not atomic; other applications will notice only after the changes are made and the corresponding X events arrive.
listener: Procedure called when a request is received. NIL to remove interpreter.
unregisterNotify: Procedure called listener has been superceeded.
thread: For executing listener commands, and, unregisterNotify; NIL to fork.
clientData: handed to listener and unregisterNotify.
overwrite: Overwrites already existing interpreter even if registered from different host. (Local listeners are overwritten without hesitation).
replyOnPing: interpreter automatically sends a reply to the empty command. (On the right thread; this is usefull for wedge detection.)
refCounting: increment connection ref-count until interpreter is unregistered
Send: PROC [c: Xl.Connection, interpreterName: Rope.ROPE, command: Rope.ROPE ¬ NIL, timeout: INT ¬ 4000] RETURNS [replyCode: TclCode, reply: Rope.ROPE];
timeout: approximate, in milliseconds; 0 means don't wait at all.
Local interpreters might or might not be shortcut; shortcut interpreters might or might not ignore timeouts.
END.