CreateRexxPort(name$)
Please remember that Rexx port names are always given in case sensitive notation. Thus, "MYPORT" and "myport" denote two different Rexx ports. For style reasons it is suggested that you use only upper case characters for your port name. Furthermore, each Rexx port must be unique in the system. If you specify a port name which is already in use, this function will fail. Thus, make sure that you use a unique name.
Please note that every Hollywood script can only have one ARexx port. Hence, this function can only be called once in your script. You cannot delete the port created by this function. It will be automatically destroyed when Hollywood exits.
An example how to catch ARexx messages is provided below. See InstallEventHandler for more information on how the user callback function will be called.
Function p_EventFunc(msg) Switch msg.action Case "OnARexx" Switch msg.command Case "RealFunc" Return(100) Default Local t = SplitStr(msg.args, "\0") DebugPrint(msg.command, "called with", msg.argc, "argument(s)") For Local k = 1 To msg.argc DebugPrint("Argument", k .. ":", t[k - 1]) Next EndSwitch EndSwitch EndFunction CreateRexxPort("MY_COOL_REXX_PORT_123") InstallEventHandler({OnARexx = p_EventFunc}) Repeat WaitEvent ForeverSave the code above as a Hollywood script and run it with Hollywood. Then save the following code as a Rexx script and execute it from a Shell with "RX test.rx":
/* remember the first line of every Rexx script must be a comment */ OPTIONS RESULTS /* the port of our Hollywood script is now the host */ ADDRESS MY_COOL_REXX_PORT_123 /* send commands from Rexx to Hollywood and watch the debug output */ DummyFunc_1 '"Dummy Arg 1"' DummyFunc_2 1 2 3 DummyFunc_3 '"First arg"' '"Second arg"' '"Third arg"' DummyFunc_4 /* no args */ DummyFunc_5 "These will be handled as separate arguments" DummyFunc_6 '"This is a single argument (use double quotes!)"' 'RealFunc' SAY RESULT /* this will print 100; it is the result from RealFunc */ |