Path: utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!granite.pa.dec.com!mwm From: mwm@raven.pa.dec.com (Mike (Real Amigas have keyboard garages) Meyer) Newsgroups: comp.sys.amiga Subject: Re: ARexx and mg3 questions Message-ID: Date: 6 Jul 90 21:02:19 GMT References: <9007061951.AA00834@human-torch.lockheed.com> Sender: news@wrl.dec.com (News) Organization: Missionaria Phonibalonica Lines: 147 In-Reply-To: kosma%human-torch@STC.LOCKHEED.COM's message of 6 Jul 90 19:51:23 GMT In article <9007061951.AA00834@human-torch.lockheed.com> kosma%human-torch@STC.LOCKHEED.COM (Monty Kosma) writes: I don't know if this should be in c.s.a or c.s.a.tech, so I figure I'll post it to c.s.a since the c.s.a.tech people tend to react more viciously to stuff incorrectly posted there :-) Since Rexx is going to be bundled, and I'd like mg3 to be bundled :-), I think c.s.a is right. Note: I've not got a running mg + rexx port here, so the examples are untested. 1. In an Arexx script file, typing address 'mg' works fine, but typing address mg does not. Address is slightly wierd, in that it expects a variable or a simple expression. Address 'mg' is a string, and it uses the text you gave it. The second is a variable, so you get it's value. Rexx gives all variables a default value of upper(variable), so you did the same as address 'MG'. If you really want to say "address mg", try "mg = 'mg'" somewhere beforehand. 2. Also, in an Arexx script file, typing 'rexx-insert "hello"' works (inserts hello into the current mg buffer), but say 'rexx-insert "hello"' does not work; it merely echos 'rexx-insert "hello"' to the shell. The first is issued as a command to the host, which does what you say it should do. The second uses the rexx command 'say' to print a string to the console. mg doesn't fool with the standard IO streams for rexx. For one thing, I couldn't decide what to do with them. Suggestions are welcome. 3. From within mg, the command M-x rexx ^M "'rexx-insert' "hi-there"" hangs mg completely. (mg bug? or should I have guessed that?) Actually, you might be hung in Rexx. You're issuing something that doesn't parse to Rexx.. Remember all the rexx command does is passes it's argument to rexx to be dealt with. So you need to double the internal quotes to make them work, like so: M-x rexx C-m "'rexx-insert ""hi-there""" However, it shouldn't hang in any case. I'll add that to the list of things to look at before the next release (that's a long list, and a long time....) 4. From within mg, the command M-x rexx ^M 'rexx-insert "hello"' gives error 47, arithmetic conversion error (trying to subtract insert from rexx); apparently rexx-insert not get correctly quoted, so M-x rexx ^M ' 'rexx-insert "hello" ' ' does nothing. Absolutlely nothing. Then M-x rexx ^M ' "rexx-insert" "hello" ' works! Yes, you failed to quote 'rexx-insert' correctly. All mg does is pass the string across; rexx parses it (normally, see below). The second example should generate an error inside of Rexx. Strange that it doesn't. The last one worked because you got the quoting right. Rexx parsed the "'"'s and saw "rexx-insert" "hello". It would have worked equally well to say "'rexx-insert hello'". Getting strings right is a pain, because the two systems come from different places and have utterly unrelated conventions. For instance, Rexx recognizes "'", but mg doesn't; mg knows '\', rexx doesn't, and so on. I recommend doing the following: 1) Quote all commands to mg (a good stylistic practice anyway) with single quotes. 2) To get the right number of arguments, use double-quotes inside of that to surround each argument. Note that using double quotes causes '\' to be magic; not using double quotes causes whitespace to terminated arguments, and '\' isn't special. 3) Inside the double quotes, use '\' to quote characters. Using these rules, what you're trying to do would be written in a script as: 'rexx-insert "hello"' Trying to pass this through Rexx as a string command means you've got to get a second set of quotes inside of it. So you do something like: "'rexx-insert ""hello""'" or maybe: '''rexx-insert "hello"''' or, since you've got a single word as an argument, "'rexx-insert hello'" 5. related to (4) above, what help would doing C-u M-x rexx ... provide (ctrl-u is supposed to somehow quote the args, but unfortunately the mg docs could be clearer. The doc's say "the rest of the string will be tokenized by rexx", and that's what it means. The only difference between the two is that with C-u, mg turns on the RXFF_TOKEN bit in the message it sends to rexx. Without that bit on, the rexx macro invoked will have one argument, the string after the command name. If the C-u is used, then rexx will pre-parse that string into multiple arguments, ala a function call. In have no idea what rexx will do if you hand it a string macro with the RXFF_TOKEN bit turned on. 6. finally, doing a M-x rexx-do-region on a region which includes the line "address 'mg'" gives a code 3 return error (mg port locked). I have a clue but would appreciate some more explanation. More details needed, like did you really quote the command in the region you sent to rexx? If so, then you tried to issue a command to Rexx, and it should have worked. If instead you tried to address mg from the region and then issue a command - well, the port was locked. The problem is that anytime you invoke rexx from inside of mg (as opposed to running a program outside of mg), it lock's mg so nothing else (including the user) can fool with that mg while the script is doing it's thing. Part of what happens in this case is that mg creates a new port for the locked script to use. Doing an "address 'mg'" from there goes back to the public port, which is currently refusing messages because it's running a macro for the user. Just leave out the "address 'mg'", and things should work. p.s. Mike, you really ought to put in a short example on how to use the commands name-last-kbd-macro and insert-kbd-macro ...it took me quite a bit of trial and error to figure them out :-) I know, I know, I know. I may do a real manual in the near future, including a discussion on tailoring mg with mg-startup. There's just to much to do, and not enough time to do it in....