04 October 2015, 03:48 | #1 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Returning strings via ARexx port
I've gone through the hoops of creating an ARexx port in an ARexx program (using rexxsupport.library), and it is able to receive commands from another script that opens its port, but what I can't seem to find out from Commodore's scanty documentation is how to send back a result. I can send a return code, but that's the RC code. What I need is to send the RESULT code.
Was this omitted from rexxsupport.library? |
04 October 2015, 09:37 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Code:
if (msg->rm_Result1 == 0) if (msg->rm_Action & RXFF_RESULT) msg->rm_Result2 = (long) CreateArgstring (result,strlen(result)); |
06 October 2015, 13:47 | #3 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
No, I mean that I create a port in an ARexx, not from C.
I'm using OpenPort() in rexxsupport.library to create the port, then an event loop using WaitPkt(), GetPkt() and Reply(). |
06 October 2015, 16:31 | #4 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
I never need/used message ports but I read a bit about so take my answer as it is. You are maybe right that rexxsupport.library doesn`t provide such a function because the docs says that it is limited compared to C functionality. Maybe rmh.library does it better?
Create two ports in each script one seems a bad idea, right? If you do REPLY(Packet, rv) does it help if you use SETCLIP() and GETCLIP() to send your RESULT back? In that case you need to listen on the reply in some way. Don`t know if that works. Can/want you post/upload your script? |
07 October 2015, 03:19 | #5 | ||
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Why that's ingenious — in a stupid kind of way.
Quote:
Quote:
Code:
/* $VER: 1 */ IF ~Init() THEN SIGNAL Quit DO FOREVER CALL WaitPkt('HASH') paket=GetPkt('HASH') IF paket>0 THEN DO medd=GetArg(paket,0) svar=0 SELECT WHEN Left(medd,4)=='HASH' THEN DO PARSE VAR medd 'HASH ' filnamn svar=MakeChecksum(filnamn) END WHEN medd='DIE' THEN DO SAY 'Quitting' CALL Reply(paket,0) EXIT 0 END OTHERWISE SAY 'Unknown command:' medd END END CALL Reply(paket,svar) END EXIT 0 Init: SELECT WHEN Show('LIBRARIES','rexxsupport.library') THEN NOP WHEN ~AddLib('rexxsupport.library',0,-30,0) THEN EXIT 10 OTHERWISE EXIT 20 END IF Show('PORTS','HASH') THEN EXIT 5 IF ~OpenPort('HASH') THEN EXIT 5 IF ~Close(stdin) THEN EXIT 20 IF ~Close(stdout) THEN EXIT 20 IF ~Open(stdout,'CON:////Hashserv/CLOSE/WAIT/AUTO','WRITE') THEN DO SAY 'Could not open stdio' EXIT 20 END RETURN 1 Quit: SAY 'Error in line' SIGL EXIT 10 |
||
07 October 2015, 16:03 | #6 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
I guess you send a message (some kind of string? file name?) to port 'HASH' and it makes a checksum from it? This checksum string you want to send back but it doesn`t work because "Reply(paket,svar)" only support an integer number as result code. It would be interesting to know how the script/command/whatever looks/works you used to send messages to port 'HASH'.
Without that information I would guess at moment that using three different RC values with Reply(paket, rc) what can be send back + fitting SETCLIP() to caller could work. There you should be able to identify/analyse the RC value and get the results via GETCLIP(). However, just an idea. Maybe there are other/better solutions maybe without using ports. |
07 October 2015, 23:47 | #7 | |||
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Quote:
Quote:
Code:
/* rexx */ options results do forever parse pull ord address 'HASH' ord say rc':' result end Quote:
|
|||
08 October 2015, 15:34 | #8 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
Does that mean when your reply with Reply(packet_id,rc_value,result_value) the RESULT var becomes the result_value you send? Maybe I`m doing something wrong because I only get RESULT = RESULT, not the value sent. I used your evaluation program.
|
08 October 2015, 15:53 | #9 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
You have to set OPTIONS RESULTS in the calling program.
|
08 October 2015, 17:20 | #10 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
I did that. Further for both scripts.
|
08 October 2015, 22:46 | #11 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
If you trace the program, you'll find that IF paket>0 THEN DO is never evaluated, because the packet ID is not >0. Change to ~=0.
|
09 October 2015, 00:55 | #12 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
I used the example from ARexx.guide with small changes what uses:
if Packet ~= null() then do |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Returning to Amiga after 25 years ... | hedders | New to Emulation or Amiga scene | 17 | 07 May 2015 23:00 |
Concatenating strings? | christopherpm | Coders. Asm / Hardware | 10 | 10 July 2013 19:43 |
Another one returning | GarethPW | Member Introductions | 5 | 06 July 2011 13:14 |
Strange debugger strings for DFx.... | Alexco | support.WinUAE | 1 | 27 May 2009 22:21 |
Returning to Amigas - new to emulation | antonvaltaz | Member Introductions | 9 | 19 May 2009 12:02 |
|
|