|
RUN |
|
|
exitcode = RUN( strFileName AS STRING, [par1, [par2]... ] ) AS INTEGER
Runs a Basic Sub Program with optional parameters. The Sub Program can return an INTEGER exit code using END [code] or STOP [code]. The Sub Program passed to the function is the name of a file that can be either a MyBASIC2 source or compiled file. The filename can include any of the Session Variables
Sub Programs can access the arguments by declaring parameters by BYREF or BYVAL. Parameters are declared positional. For example
BYREF kalle AS STRING ' This is in/out first parameter passed BYVAL anka AS INTEGER ' in only second parameter passed
Uses "MyBASIC2_Run" environment variable to search for file if no folder is specified.
Example
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Create a Sine Waveform and Plot it using ArrayPlot.BAS. The Waveform ' array is passed to ArrayPlot as a REFERENCE so we can use the return ' reference value from MAL.Waveform as input to Arrayplot ' ' The Parameters of ArrayPlot are declared as ' ' BYVAL arr AS REFERENCE ' BYVAL bLog AS INTEGER ' OPTION EXPLICIT ON OPTION BASE 1
' Include the MaxMAL Library $INCLUDE "MyBASIC2_MaxMAL /once" $LIBRARY "MyBASIC2_MaxMALLib"
' Declare variables and arrays DIM arrSine( 1000 ) AS REAL
' Create the Waveform and run ArrayPlot to plot the result RUN( "ArrayPlot.bas",_ MAL.Waveform( arrSine, ML_SINE, 100, 100, 0, 0, 0 ),_ FALSE )
END
|