Path: utzoo!attcan!uunet!lll-winken!decwrl!granite.pa.dec.com!mwm From: mwm@raven.pa.dec.com (Mike (Real Amiga have keyboard garages) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: Tcl - Tool command language Message-ID: Date: 5 Mar 90 19:56:27 GMT References: <5213@sugar.hackercorp.com> <132344@sun.Eng.Sun.COM> <363@stcvax.STORTEK.COM> <5232@sugar.hackercorp.com> <5241@sugar.hackercorp.com> Sender: news@decwrl.dec.com Organization: Missionaria Phonibalonica Lines: 51 In-reply-to: peter@sugar.hackercorp.com's message of 4 Mar 90 16:57:15 GMT In article <5241@sugar.hackercorp.com> peter@sugar.hackercorp.com (Peter da Silva) writes: > Following through on that to make the AmigaTCL IP use Rexx messages > would give TCL isntant access to RexxArpLib & the like. Such > facilities may already be in AmigaTCL, though... Yes, since the TCL command is already built up of a simply structured list of strings, it's kind of silly to package them into a string and pull them apart again at the other end. That's why I said use RXFUNC messages. If you look at Rexx messages, you'll notice they have an array of pointers to characters imbedded in them (sound familiar?). When sending RXCOMM (what you're thinking of) messages, all but the first one are ignored. However, when you send RXFUNC messages, the first one contains the name of the script (SOP), and the others contain pointers to argument strings. You can safely treat the strings on the recieving end as C strings. You can pass C strings, but it's safer to call CreateRexxArg (or somesuch - I don't have the docs here) to generate doped strings that will be correctly dealt with by ClearRexxMsg (ditto). In other words, the (fast & sloppy) TCL command to send a Rexx message would look like (done sans manuals, so don't quote me): int SendToRexx(ClientData data, Tcl_Interp *interp, int argc, char *argv[]) { struct RexxMsg *msg ; int out ; if (argc > 14) return TCL_ERROR ; /* Limit of ARexx */ msg = CreateRexxMsg(...) ; for (i = 0; i < argc; i++) msg->Rm_Arg[i] = argv[i] ; SendRexxMsg(msg) ; out = msg->rm_Result1 ; DeleteRexxMsg(msg) ; return out ; } I do similar things in mg3a to allow the user to run a region as a function and insert the result back into the buffer. Makes for some interesting possibilities.