Arexx and includes
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Hi.

    I'm currently working on some Arexx code.
    And by now I'm having ~500 lines. So far it's still OK. But there will be some more code.
    Basically much could be extracted into some sub modules.
    I'm not aware Arexx has a concept for including/loading other Arexx code.
    Or? Can this be done somehow?


    Manfred
  • »14.04.16 - 21:07
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    easily:
    Code:
    call submod1()

    will load submod1.rexx
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »15.04.16 - 13:35
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Hmm, yeah, that works, kind of.
    A script 'submod1.rexx' is loaded and executed upon call submod1().
    But when there is a internal function marked as PROCEDURE I'm getting an error: "Invalid PROCEDURE".
    Removing the "PROCEDURE" from the function doesn't produce an error but the function code is executed as well which is önot really wanted.
    Any advice?


    Manfred
  • »15.04.16 - 15:03
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    Indeed, an external procedure is not allowed. What do you mean by "executed as well"?
    > rx main
    FUNCTION 1 SUBMOD1 Work:Developing/submod1.rexx REXX REXX
    COMMAND 0 main Work:Developing/main.rexx REXX REXX

    Code:
    /* main.rexx */
    call submod1()
    call submod2()
    exit

    /* submod2 internal */
    submod2: procedure
    parse source s
    say s
    return

    Code:
    /* submod1.rexx */
    submod1: /*procedure*/
    parse source s
    say s
    return
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »16.04.16 - 17:26
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    asrael22
    Posts: 404 from 2014/6/11
    From: Germany
    Ah, now I got it.
    In main, call submod1() loads a file submod1.rexx and executes any global operation plus it executes the first function it finds.
    However, other functions in submod1.rexx are not visible from main. Can you confirm that?


    Manfred
  • »17.04.16 - 12:01
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    polluks
    Posts: 779 from 2007/10/23
    From: Gelsenkirchen,...
    Right, it's more like chain in BASIC, not linking in C.
    Pegasos II G4: MorphOS 3.9, Zalman M220W · iMac G5 12,1 17", MorphOS 3.18
    Power Mac G3: OSX 10.3 · PowerBook 5,8: OSX 10.5, MorphOS 3.18
  • »17.04.16 - 12:58
    Profile