Function Overview
This section provides an overview of the various interface functions and their usage. For full details of syntax, allowed parameters, return values etc. click on the Function Name on the left to switch to the detailed description for the function.
Understanding SPFLite status values
A macro you run from your edit session, by placing a macro name on the primary command line, or on the sequence area of a data line, will return a status when it completes. A status consists of two values: a numeric Return Code value (often referred to as RC), and a Message string. This status is displayed on the upper-right portion of the edit screen, in the form of the Message string, and an optional Warning or Error message prefix in case a non-zero Return Code has been set.
When you call an SPFLite-supplied interface function (such as Get_Line$), that function will also return a status. You may retrieve this status using the functions Get_RC and Get_Msg$.
There are thus two sets of status information. The status returned to you (as an edit user that executed a macro command) that is visible on the edit screen as a message is called the top-level status. The status returned to a user-defined macro by a call to an SPFLite interface function is called the function-level status.
It it important to understand that the top-level status and the function-level status are completely different and separate values.
This means that if you issue a call to Set_Msg(my_RC, my_Message) it will change the top-level status values for the RC and Message, but will not change the function-level values that are returned by Get_RC and Get_Msg$. Another way to look at this is that the function-level status is "lower" than the top-level status, and that status values can go "up" (via Set_Msg) but cannot go "down".
Example:
DIM rc as NUMBER
DIM msg as STRING
' ... some macro code
Set_Msg (8, "user defined error occurred")
rc = Get_RC
msg = Get_Msg$
' at this point, rc = 0, and msg = "", not the values set by Set_Msg
The other key point to keep in mind is that SPFLite interface functions do not "communicate" the function-level RC and Message values between themselves. So, if one SPFLite function set an RC value of 8, the next SPFLite function you call will know nothing about that; it won't "look" at the RC=8 value set by the prior function call. Each function "starts over from scratch" in terms of setting the function-level status values, by assuming each time that the RC will be 0 and the Message will be an empty (null) string, unless conditions require them to be changed.
Return codes and returned messages from SPF-supplied functions
All SPF-supplied functions set the function-level Return Code (RC) variable and the standard Message text appropriately based on the success of the function. This is done in addition to providing the return value from the function directly. In a few cases, the value returned by the function will be the RC value itself, but most functions will return values other than the RC.
Functions built into thinBasic do not set the RC and message values. That only applies to functions we provide as part of the SPFLite macro interface. So, if you call a thinBasic function like MID$ to get a substring of a value, that does not change the RC or message.
The function-level status values can be obtained with the Get_RC and Get_Msg$ functions. A successful return will usually result in RC=0 and a message text of "" (null). However, some successful functions may result in a RC=0 but with a completed message text string. For example, invoking an SPF_Cmd("DCB ?") function may result in a RC=0, but a Get_Msg$ return string of "DCB set to RECFM=U, EOL=CRLF, LRECL=0".
When a function returns a value which is not important to you, you can call it directly without assigning its returned value to a variable. For example, you can call
RC = SPF_Exec("MyProgram")
but if the return code isn't important, you can shorten this to:
SPF_Exec("MyProgram")
Return codes and returned messages from Set_Msg to the edit user
The function Set_Msg is used to pass back a top-level return code and message to the edit user (you) that is displayed in the upper-right corner of the edit screen.
It is important to understand that function-level RC and message values passed back by other functions (like Get_Line$, for instance) are not automatically passed through to the edit user, even when the RC value is non-zero, signifying a warning or error condition was detected. You must explicitly call Set_Msg yourself if you wish a top-level status message to be displayed back to the user once the macro completes execution.
The values set by Set_Msg will be overridden by any other subsequent call to Set_Msg. If you call this function more than once, only the RC and Message of the last call will be used as the top-level status, and displayed on the edit screen when the macro completes.
If you execute a macro that never calls Set_Msg, it is treated the same as if Set_Msg(0,"") were called; that is, no message will appear on the edit screen when the macro completes.
Supposing you wanted to "pass along" the function-level status values up to the top-level status after an SPFLite function call, it would require you to call the Set_Msg function. If you did this, the call would take the form Set_Msg(Get_RC, Get_Msg$).
Example:
SPF_Cmd ("LINE 'R5' .1234")
Set_Msg (Get_RC, Get_Msg$)
' at this point, the visible top-level RC and Message are
' set to the status returned by the SPF_Cmd function call
List of available macro functions
With the introduction of macro support for File Manager, it meant a new series of functions were created to interface with File Manager. Obviously, if these functions are invoked by a macro running in a normal Edit session, they would not work. Similarly, many of the original functions designed for an Edit session will not function in the File Manager tab.
So we have three classes of functions:
- Those that will work in all environments
- Those that will work only in File Manager
- Those that will work only in Edit sessions.
SPFLite will check for these conditions and terminate a macro which is using a function in the incorrect environment.
The functions here are divided by categories of interest, for ease of lookup.
|
Functions for handling command line arguments |
FM |
Edit |
Returns a specified macro operand number n, or a range of operand numbers separated by single blanks. |
Yes |
Yes |
|
Returns the number of supplied macro arguments. |
Yes |
Yes |
|
Returns the name of the current macro |
Yes |
Yes |
|
Returns the name of the last issued Primary command. |
Yes |
Yes |
|
Performs full operand parsing of command operands |
Yes |
Yes |
|
Returns True/False based on a Keywords presence in the macro command line |
Yes |
Yes |
|
Returns the entered keyword from a list of mutually exclusive items |
Yes |
Yes |
|
Returns the requested relative Line Reference from the macro command line |
Yes |
Yes |
|
Returns the number of Line Reference type macro operands. |
Yes |
Yes |
|
Returns the requested relative Tag Operand from the macro command line |
Yes |
Yes |
|
Returns the number of Tag type macro operands. |
Yes |
Yes |
|
Returns the requested relative Text Literal from the macro command line |
Yes |
Yes |
|
Returns the number of Text Literal type macro operands. |
Yes |
Yes |
|
Returns the requested relative Numeric Literal from the macro command line |
Yes |
Yes |
|
Returns the number of Numeric Literal type macro operands. |
Yes |
Yes |
|
Returns a string value properly enclosed in quotes |
Yes |
Yes |
|
Returns a string value with any existing paired outer quotes removed. |
Yes |
Yes |
|
Returns a string with invalid display characters 'cleaned up' |
Yes |
Yes |
|
Returns a fully qualified path for a filename. |
Yes |
Yes |
|
Returns TRUE if macro launched as a line-command macro, otherwise FALSE |
Yes |
Yes |
|
Returns TRUE if macro launched as a primary-command macro, otherwise FALSE |
Yes |
Yes |
|
Returns TRUE if macro launched in the File Manager tab, otherwise FALSE. |
Yes |
Yes |
|
Sets the visible (top-level) return code and message that is returned to the user |
Yes |
Yes |
|
Sets the visible (top-level) return code and message that is returned to the user and then immediately terminates the macro. |
Yes |
Yes |
|
Contains the Return Code from the last executed SPFLite function call. |
Yes |
Yes |
|
Contains the Return Code from the last executed SPFLite function call. |
Yes |
Yes |
|
Returns the full path of the folder where SPFLite.EXE resides. |
Yes |
Yes |
|
Returns the full path of the SPFLite data storage folder. |
Yes |
Yes |
|
Execute the provided command under the System's CMD.EXE command processor. |
Yes |
Yes |
|
Execute the provided command directly, not under the CMD.EXE command shell. |
Yes |
Yes |
|
|
Specify a standard DO macro string which will be executed immediately when this macro has terminated. |
Yes |
Yes |
|
Functions that manage globally-stored values |
FM |
Edit |
Deletes a current item (key-str) from the specified table (Tblnum) |
Yes |
Yes |
|
Deletes a current item (key-str) from the specified table (Tblnum) |
Yes |
Yes |
|
Stores the numeric value under the associated string key. |
Yes |
Yes |
|
Stores the string value under the associated string key. |
Yes |
Yes |
|
Retrieves the numeric value associated with key. |
Yes |
Yes |
|
Retrieves the string value associated with key. |
Yes |
Yes |
|
Returns the current number of variables stored in the Numeric pool. |
Yes |
Yes |
|
Returns the current number of variables stored in the String pool. |
Yes |
Yes |
|
Returns the key name of the specified item in the Numeric pool. |
Yes |
Yes |
|
Returns the Table-number and key name of the specified item in the Numeric pool. |
Yes |
Yes |
|
Returns the key name of the specified item in the String pool. |
Yes |
Yes |
|
Returns the Table-number and key name of the specified item in the String pool. |
Yes |
Yes |
|
Deletes the entire contents of the Gbl_Num storage area; all Keys and Values are deleted |
Yes |
Yes |
|
Deletes the entire contents of the Gbl_Str storage area; all Keys and Values are deleted |
Yes |
Yes |
|
|
Functions that manage environment and SET variables |
FM |
Edit |
Returns the specified Windows Environment Variable data. |
Yes |
Yes |
|
Returns the name of the Instance for the current SPFLite session. |
Yes |
Yes |
|
Returns the specified variable value from the SPFLite SET variable pool. |
Yes |
Yes |
|
Sets the specified variable value in the SPFLite SET variable pool. |
Yes |
Yes |
|
|
Functions that manage macro debugging |
FM |
Edit |
Display a message on the debugging console |
Yes |
Yes |
|
Fetch and Set the SPFLite Macro loop monitoring function ON or OFF. |
Yes |
Yes |
|
Set SPFLite trace mode to ON, OFF or ERROR |
Yes |
Yes |
|
|
Functions that manage the Edit file |
FM |
Edit |
Returns the current file path for the current file. |
No |
Yes |
|
Returns the base filename of the current edit file. |
No |
Yes |
|
Returns the filename of the current edit file. |
No |
Yes |
|
Returns the current file extension. |
No |
Yes |
|
Returns the last modified date of the current file. |
No |
Yes |
|
Returns the last modified time of the current file. |
No |
Yes |
|
Returns a Line Pointer to the first line of the Edit session |
No |
Yes |
|
Returns a Line Pointer to the last line of the Edit session |
No |
Yes |
|
Returns a Line Pointer to the first line of a selected text block |
No |
Yes |
|
Returns a Line Pointer to the last line of a selected text block |
No |
Yes |
|
Returns a number indicating the leftmost selected column |
No |
Yes |
|
Returns a number indicating the length of the selected data |
No |
Yes |
|
Returns a string containing the EOL specified in the current Profile |
No |
Yes |
|
Return a PROFILE setting as a string. |
No |
Yes |
|
Returns NONE or the current MARK line contents |
No |
Yes |
|
Returns the current BNDS line. |
No |
Yes |
|
Sets a new value for the MARK line |
No |
Yes |
|
Return the current MASK line contents |
No |
Yes |
|
Sets a new value for the MASK line |
No |
Yes |
|
Return the current TABS line contents |
No |
Yes |
|
Sets a new value for the TABS line |
No |
Yes |
|
Return the current WORD line contents |
No |
Yes |
|
Sets a new value for the WORD line |
No |
Yes |
|
|
Functions that manage the Edit session |
FM |
Edit |
Adds all lines in an array to the edit session. |
No |
Yes |
|
Adds a new line to the edit following the line-ptr |
No |
Yes |
|
Returns a unique ID number that identifies this particular edit session. |
No |
Yes |
|
Set the desired location for the cursor following macro execution. |
No |
Yes |
|
Returns the column number of the current cursor line |
No |
Yes |
|
Returns the line pointer of the line containing the cursor |
No |
Yes |
|
Returns the line pointer of the line which is currently at the top of screen. |
No |
Yes |
|
Returns the line pointer of the last datra line on the screen. |
No |
Yes |
|
Returns the column number of the Left side of the screen |
No |
Yes |
|
Returns the column number of the Right side of the screen |
No |
Yes |
|
Sets the line pointer which is to appear at the top of screen on macro exit. |
No |
Yes |
|
Gets the unique Track-ID for a single LPtr |
No |
Yes |
|
Gets the LPtr for a single Track-ID |
No |
Yes |
|
Gets the positioning info from an entry in the Track stack. |
No |
Yes |
|
Returns the contents of the data line where the cursor was located at the start of macro processing |
No |
Yes |
|
Returns the contents of the current 'word' where the cursor was located at the start of macro processing |
No |
Yes |
|
Returns the full path of the Windows current working directory |
No |
Yes |
|
Returns the current Left bounds value. |
No |
Yes |
|
Returns the current Right bounds value |
No |
Yes |
|
Returns the current file modified status as TRUE or FALSE. |
No |
Yes |
|
Returns the modified status for an individual file within an MEdit session |
No |
Yes |
|
Returns a string containing the 'type' of the current edit tab. |
No |
Yes |
|
|
Functions that manage Edit text data |
FM |
Edit |
|
Returns a 256 byte string translate table to convert from ANSI to the current SOURCE format. Returns a 256 byte string translate table to convert from the current SOURCE format to ANSI. |
Yes |
Yes |
Returns the current Edit text data for the specified line-ptr |
No |
Yes |
|
Returns the current color control line for the specified line-ptr |
No |
Yes |
|
Returns the length of the current Edit text data for the specified line-ptr |
No |
Yes |
|
Returns a text string indicating the particular line type |
No |
Yes |
|
Returns the number of Excluded lines in an Exclude block |
No |
Yes |
|
Returns an X/NX string value indicating the Exclude status of a data line |
No |
Yes |
|
Tests if a specific line (line-ptr) is a particular line type |
No |
Yes |
|
Will replace the current Edit text data for the specified line-ptr with the new string specified by data-str |
No |
Yes |
|
Will replace the current color control string for the specified line-ptr with the new string specified by clr-str |
No |
Yes |
|
Will insert StrVar into the text of line-ptr at the indicated column col-num |
No |
Yes |
|
Will replace text in line-ptr with StrVar starting at the indicated column col-num |
No |
Yes |
|
Will overlay text in line-ptr with StrVar starting at the indicated column col-num |
No |
Yes |
|
Will overlay replace text in line-ptr with StrVar starting at the indicated column col-num |
No |
Yes |
|
Will adjust a line-pointer by moving it either forward or backward a specified number of lines of a specified line type. |
No |
Yes |
|
Convert an external line reference to a line pointer |
No |
Yes |
|
Convert a line pointer to an external line number |
No |
Yes |
|
Test if a file extension is in the Text-Exempt list |
No |
Yes |
|
Execute an Edit Primary command. |
No |
Yes |
|
|
Functions that manage FIND and LOCATE commands |
FM |
Edit |
Returns the line pointer of the last line found by the LOCATE command |
No |
Yes |
|
Returns the line pointer of the last line found by a FIND / CHANGE command |
No |
Yes |
|
Returns the column number where the last FIND / CHANGE was located |
No |
Yes |
|
Returns the length of the last FIND / CHANGE search argument |
No |
Yes |
|
|
Functions that manage line command operands |
FM |
Edit |
Returns the .HANDLE for a given data line. Handles are only created by the Get-Handls$ function. |
No |
Yes |
|
Removes a previously assigned Handle |
No |
Yes |
|
Returns True / False as to whether a Handle exists for a line. |
No |
Yes |
|
Returns the .LABEL/HANDLE for a given data line. If a User created label exists it is selected first. If no User created label, the HANDLE is returned. If neither exist, a Null is returned. |
No |
Yes |
|
These functions return the current Lowest or Highest issues Handle for the file. |
No |
Yes |
|
These functions support looping through the assigned Handles. Each will return the Previous or Next Handle (in Handle issued sequence). A Null ("") is returned when no more exist in the specified direction |
No |
Yes |
|
Returns the :TAG for a given data line |
No |
Yes |
|
Returns a string containing the name of the source line command. |
No |
Yes |
|
Returns the line pointer of the last line in the source line range, or 0 if not applicable. |
No |
Yes |
|
Returns the line pointer of the last line in the source line range, or 0 if not applicable. |
No |
Yes |
|
Returns the optional n value on the source line range. |
No |
Yes |
|
Returns the source line command modifiers. |
No |
Yes |
|
Returns a string containing the name of the source line command. |
No |
Yes |
|
Returns the line pointer of the first line in the destination line range, or 0 if not applicable. |
No |
Yes |
|
Returns the line pointer of the last line in the destination line range, or 0 if not applicable. |
No |
Yes |
|
Returns the optional n value on the destination line range command. |
No |
Yes |
|
Returns the destination line command modifiers. |
No |
Yes |
|
|
Functions that retrieve File Manager Overall Data |
FM |
Edit |
|
Returns the general Mode of the File Manager display. |
Yes |
No |
|
Returns the contents of the File Path field - EVEN IF the display is not in FilePath mode. |
Yes |
No |
|
Returns the current File Pattern mask - EVEN IF the display is not in FilePath mode. |
Yes |
No |
|
Returns the current FLIST name being displayed. If in FilePath mode, Null is returned. |
Yes |
No |
|
Returns the current number of line of file data being displayed. |
Yes |
No |
FMGet_Folder_Class({pathname}) |
Returns the Backup / Normal class of the folder. If a Pathname provided, it returns the status of that folder. If no Pathname, and in FilePath mode, returns the status of the current FilePath.
|
Yes |
No |
|
Functions that retrieve File Manager Individual File Line Items |
Fm |
Edit |
Returns an abbreviated version of the Filename. Useful when a long filename might cause formatting problems when including the filename in messages. The length parameter allows you to specify the desired length. |
Yes |
No |
|
Returns a short string of 1 character designations representing the file attributes |
|
|
|
|
Returns the available # of Backup versions for the specified file at line number FNum. |
Yes |
No |
|
Returns the current contents of the Line command area for the specified file at line number FNum. |
Yes |
No |
|
Returns the file extension (including the period) for the specified file at line number FNum. |
Yes |
No |
|
Returns the file attribute area for the specified file at line number FNum. This is a binary DWORD of bit flags describing the type of file system entry. |
Yes |
No |
|
Returns the general file class for the specified file at line number FNum. The Class is one of: a normal file; a Backup of a data file; or a Backup of an associated STATE file. |
Yes |
No |
|
Returns the filename for the specified file at line number FNum. |
Yes |
No |
|
Returns the size of the file specified at line number FNum. The value is returned as a QUAD integer |
Yes |
No |
Returns the size of the file specified at line number FNum. The value is returned as a formatted string value. e.g. 9,999,999. |
Yes |
No |
|
|
Returns the type of File Manager entry for the line specified by FNum. e.g. Directory folder (Up or Down), file, FLIST entry etc. |
Yes |
No |
|
Returns the number of Lines in the file (if available) for the file specified at line number FNum. If the Lines value is not available, -1 will be returned |
Yes |
No |
|
Returns the contents of the Note field (if available) for the file specified at line number FNum. If the Note field is not available, a Null is returned. |
Yes |
No |
|
Returns the Path to the file (including the trailing \) for the file specified at line number FNum. |
Yes |
No |
Returns the extended property selected by the PRPn column specification |
|
|
|
|
Returns the Creation time for the file specified at line number FNum. The format returned is: yyyy-mm-dd hh:mm |
Yes |
No |
Returns the Last Write time for the file specified at line number FNum. The format returned is: yyyy-mm-dd hh:mm |
Yes |
No |
|
|
Functions that Act on or modify the File Manager Environment |
FM |
Edit |
|
Execute a normal FM line command against a specified file at line number FNum. See the Function details for the supported line commands. |
Yes |
No |
|
Modify the line command field for a specified file at line number FNum. |
Yes |
No |
|
Issue a message to temporarily overlay the filename for a file line specified by FNum. |
Yes |
No |
|
|
|
|
|
|
|
|
|
|
Created with the Personal Edition of HelpNDoc: Ensure High-Quality Documentation with HelpNDoc's Hyperlink and Library Item Reports