file.tm
file.tm
is a WSTP template file.
Details
- WSTP template files contain templates for linking external C functions to Wolfram Language functions.
- Each template can contain the following:
-
:Begin: begin the template for a particular function :Function: the name of the function in the external program :Pattern: the pattern to be defined to call the function :Arguments: the arguments to the function :ArgumentTypes: the types of the arguments to the function :ReturnType: the type of value returned from the function :End: end the template :Evaluate: Wolfram Language input to evaluate when the function is installed ::text treat as a comment - Arbitrary C code can be interspersed between templates in a .tm file.
- The following argument and return type specifications can be used:
-
Integer16 short Integer32 int Integer64 mlint64 Real32 float Real64 double Real128 mlextended_double Integer16List short*, int (length) Integer32List int*, int (length) Integer64List mlint64*, int (length) Real32List float*, int (length) Real64List double*, int (length) Real128List mlextended_double*, int (length) String char* ByteString unsigned char* and int (length) UCS2String unsigned short* UTF8String unsigned char*, int (bytes), int (characters) UTF16String unsigned short*, int (length), int (characters) UTF32String unsigned int*, and int (length) Symbol char* ByteSymbol unsigned char*, int (length) UCS2Symbol unsigned short*, int (length) UTF8Symbol unsigned char*, int (bytes), int (characters) UTF16Symbol unsigned short*, int (length), int (characters) UTF32Symbol unsigned int*, int (length) ThisLink WSLINK $CurrentLink WSLINK Manual void - In order to use UCS2String, UCS2Symbol, UTF8String, UTF8Symbol, UTF16String, UTF16Symbol, UTF32String, and UTF32Symbol as a return type, the programmer must allocate a WSUnicodeContainer object to return in place of the Unicode string.
- The WSUnicodeContainer object is a wrapper that contains a copy of the Unicode string and its length for easily passing Unicode strings between functions in a template file.
- wsprep will only generate function signatures with WSUnicodeContainer as the return type when the return type is one of the listed Unicode string or symbol types. wsprep will not generate code that passes a WSUnicodeContainer object as an argument to a function when one of the arguments is a Unicode string or symbol type.
- WSTP template files are converted to C code using wsprep. They are also processed automatically by wscc when available.