• [How] do external functions work in Regina Rexx?

    From Alfred Singlestone@21:1/5 to All on Sat Apr 14 14:05:25 2018
    I'm running Regina Rexx in Ubuntu Linux. I've tried writing and using external functions, but they only seem to work if they're in the current directory.

    For example, here's a function called INLIST:

    #!/usr/bin/rexx
    exit wordpos(arg(1), arg(2)) > 0

    And here's a base Rexx exec, testfunc, that invokes it:

    #!/usr/bin/rexx
    say inlist('a', 'a b c')

    If I run the testfunc exec from the directory where the execs live, I get the expected result: 1. If I run it from a different directory, I get a null string as the result.

    The problem is that in the second case, both arguments are concatenated into a single one. In INLIST, arg(1) is "a a b c" and arg(2) is a null string.

    I don't understand the behavior. What is it about Regina Rexx that makes it behave this way? Is there a way to make it work as expected? Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alfred Singlestone@21:1/5 to All on Sat Apr 14 14:25:55 2018
    One thing I didn't know: The -a flag will break the arguments up. Unfortunately, if a single argument consists of more than one word, it gets broken up into multiple arguments. For example, arguments for "inlist('a', 'a b c')" are received as if the call
    was "inlist('a', 'a', 'b', 'c')".

    Is there a way to make it work consistently regardless of the directory you're in?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alfred Singlestone@21:1/5 to Blue Bullet on Sun Apr 15 12:01:28 2018
    On Sunday, April 15, 2018 at 2:54:55 PM UTC-4, Blue Bullet wrote:
    On Saturday, April 14, 2018 at 3:25:56 PM UTC-6, Alfred Singlestone wrote:
    One thing I didn't know: The -a flag will break the arguments up. Unfortunately, if a single argument consists of more than one word, it gets broken up into multiple arguments. For example, arguments for "inlist('a', 'a b c')" are received as if the
    call was "inlist('a', 'a', 'b', 'c')".

    Is there a way to make it work consistently regardless of the directory you're in?

    I put all my rexx routines in a directory in Dropbox that all users access when they log in by putting it in their path. I my case I put an export statement in /home/user/.kde/env/path.sh. Here is the export statement:

    export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:"$HOME"/Dropbox/shared_rcss_complex:/usr/local/share/rcss"

    In a terminal session "echo $PATH" shows:

    usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/rob/Dropbox/shared_rcss_complex:/usr/local/share/rcss:/home/rob/bin:/home/rob/sdk/android-sdk-linux/tools:/home/rob/sdk/android-sdk-linux/platform-tools

    Works for me. Hope this helps.

    My execs are all in the PATH now. They can be found; it's just that they behave differently depending on whether you're in the directory where they live. Bizarre!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Blue Bullet@21:1/5 to Alfred Singlestone on Sun Apr 15 11:54:54 2018
    On Saturday, April 14, 2018 at 3:25:56 PM UTC-6, Alfred Singlestone wrote:
    One thing I didn't know: The -a flag will break the arguments up. Unfortunately, if a single argument consists of more than one word, it gets broken up into multiple arguments. For example, arguments for "inlist('a', 'a b c')" are received as if the
    call was "inlist('a', 'a', 'b', 'c')".

    Is there a way to make it work consistently regardless of the directory you're in?

    I put all my rexx routines in a directory in Dropbox that all users access when they log in by putting it in their path. I my case I put an export statement in /home/user/.kde/env/path.sh. Here is the export statement:

    export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:"$HOME"/Dropbox/shared_rcss_complex:/usr/local/share/rcss"

    In a terminal session "echo $PATH" shows:

    usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/rob/Dropbox/shared_rcss_complex:/usr/local/share/rcss:/home/rob/bin:/home/rob/sdk/android-sdk-linux/tools:/home/rob/sdk/android-sdk-linux/platform-tools

    Works for me. Hope this helps.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)