Compiler intrinsic functions
The SPL compiler provides these built-in functions.
rstring getThisFileName()
: This function returns the name of the file in which the call appears. The name is the base name of the file, as in HelloWorld.spl.rstring getThisFilePath()
: This function returns an expression that can be used to get the absolute compile-time or run time path of the file that contains the call. For example, /homes/foo/sample/HelloWorld.spl.rstring getThisFileDir()
: This function returns an expression that can be used to get the absolute compile-time or run time directory of the file that contains the call. For example, /homes/foo/sample.rstring getThisToolkitDir()
: This function returns an expression that can be used to get the compile-time or run time root directory of the toolkit that contains the SPL code that makes this call.rstring getApplicationDir()
: This function returns an expression that can be used to get the absolute path to the application directory at compile-time or run time. It can be called from SPL in any toolkit.int32 getThisLine()
: This function returns the line number for the line on which the call appears. The line numbers start from 1.rstring getThisCompositeInstanceName()
: This function returns the name of the composite operator instance whose definition in the SPL code contains the call. This function can be only used in a composite operator definition. After the composite expansion, there might be multiple instances of a composite operator, and each one will get a unique value as a return of this call. The return value is the name of the composite operator instance. The following code is an example:composite Other { graph stream<int32 a> Out = FileSource() { param file : getThisCompositeInstanceName()+".txt"; } } composite Main { graph () as Op1 = Other(){} // will open file Op1.txt () as Op2 = Other(){} // will open file Op2.txt }
<tuple T> int32 inputPort(T)
: This function returns the zero-based index of the input port that is passed to it as a parameter. This call can appear only in an operator invocation. The parameter that is passed to it must either be an input port alias or an input stream.<tuple T> int32 outputPort(T)
: This function returns the zero-based index of the output port that is passed to it as a parameter. This call can appear only in an operator invocation. The parameter that is passed to it must either be an output port alias or an output stream.