JXX-Commands: "Jump If ..."

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > JXX. - Jump - Instructions >

JXX-Commands: "Jump If ..."

JNF. - Jump New File

Previous Top Next


MiniRobotLanguage (MRL)

 

JNF. Unconditional Script-Call

Jump New File

 

 

Intention

 

Continues Script Execution in another File (Sub-Script).

 

Can use Parameters. You give the parameter separated with a | (Pipe) Symbol after the JNF.-call. Like this:

 

JNF.MySubscript.mrt|Param01|Param02

END.

 

In the Target script that is called, the parameters appear in:

 

§§_00 -> number of given parameters (here 2)

§§_01 -> first Parameter (here "Param01")

§§_02 -> second Parameter (here "Param02")

 

You can use up to 25 Parameters in case you need them.

If you specify just Variables as Parameter, the Content is only copied,

and the Type of the Variable is preserved.

 

' Example

VAN.$$NUM=5.09

JNF.AddMe|$$NUM|§§NUX

ENR.

 

' File "AddME.mrt" in ?path\

VAO.$$PAA=§§_01

GVT.$$PAA|$$RES

MBX.We preserved the Variabletype: $$RES (=5, numeric)

ENR.

 

Can use script-local variables that are local to each file.

 

JNF.'s can be nested to unlimited depth, even recursive.

 

Return to the calling Script with RTS.(ReTurn from Subroutine)-Command or ENR. (End-Return). This will restore the script-local variables of the calling script, including the parameter-variables.

 

If you need to leave a Sub-Program that was called with JNF. to a higher level then just the next, you can add a number behind the RET. Like this:

 

RET.2

 

If you want to leave to the Top-Level in your script, just write:

 

RET.all

 

 

Syntax

 

 

JNF.P1[|P2..Px]

 

 

Parameter Explanation

 

P1 - Scriptfilename to call as subprogram

P2 - (optional) - up to 25 Parameters

 

 

 

 

Example

 

We need to have 2 Script Files for this simple Example.

Both need to be in the same folder.

 

The first Scriptfile, "First.txt" is the Main-Scriptfile.

It automatically defines ?path\ as its own path. That is, the folder where it is located.

It calls the second file "second.txt" which is also in "?path\" (in the same folder).

 

'***********************************************

' Example 1 - without Parameters,

' with local and global variables

'***********************************************

 

[First.txt]

: §§WHE=In First.txt

: $$GLO=1

PRT. $$WHE, Global=$$GLO

JNF.Second.txt

PRT. $$WHE, Global=$$GLO

END.

 

[Second.txt]

: §§WHE=In Second.txt

: $$GLO=2

PRT. $$WHE, Global=$$GLO

RTS.

 

'***********************************************

' Example 2 - with 2 Parameters

'***********************************************

 

[First.txt]

JNF.Second.txt|Hallo|$$GLO2

END.

 

[Second.txt]

PRT.§§_01 - §§_02

RTS.

 

 

 

 

Remarks

 

§§_00 is the number of parameters given to the Script using JNF. or JNJ.

§§_01 ... §§_25 are used for Parameters in the target Script file.

 

 

 

Limitations:

 

You can use up to 25 Parameters. If you need more, use Global variables or the Block-Commands (SIB. etc).

 

 

See also:

 

    RTS. - ReTurn from Subroutine

    ENR. - End Return

    1.B Error handling

    END. - End Script

    SEC. - Set Exit Code

    JNJ. - JumpNewFile-Jump to Label