FCL basics

FELIX is a member of a broad class of software known as command- or event-driven software. Software in this class waits for you to issue a command, acts upon that command, completes the task, and returns to a standby condition, awaiting the next command.

The FELIX command language (FCL) is the fundamental interactive element in FELIX. FCL is composed primarily of commands and their associated parameters, with a precise and simple syntax. There are currently over two hundred distinct FELIX commands, and nearly two hundred associated reserved symbols. The essentials of practical FCL use are presented here, with the goal of providing an intuitive foundation for their application in simple and advanced implementations.

Although many users interact with FELIX solely through the graphical interface, the interface is in fact written mostly using FCL. You can directly access FCL by clicking the left mouse button in the command line within the main FELIX window or by pressing the <Tab> key. Alternatively, you can type FCL commands directly into the parent shell window, even when the FELIX prompt is not visible. Virtually any task that can be performed with the graphical interface can also be accomplished by using FCL directly. Whether you want to conduct novel processing and/or analysis procedures that are not available through the graphical interface, or to conduct standard tasks directly, you always have the option of issuing FELIX commands directly, either as discrete command statements or as a group of commands in a macro file.


The FCL prompt

Direct access to FCL is usually gained by selecting the Frame/Text Mode menu item from any FELIX module. FCL signals that it is ready to accept input by showing a prompt symbol (usually FELIX>). You may define the prompt's appearance by defining the user symbol prompt.


Commands and command arguments

To use a simple example, a typical FCL command statement might be:

     rn myfile.dat

Here, the command rn (which specifies that a data file be read) is separated by a space from an argument, which in this case specifies the datafile to be read. The standard FELIX delimiter symbol is a single space, although it is permissable to use more spaces. However, while in command-line mode, no spaces are allowed between the command prompt and the beginning of the command.

Many FELIX commands expect and require one or more associated input arguments, although not all of them do. For example, in these commands:

     rn myfile.dat

ft
dr

only the rn command requires an argument, whereas the ft and dr commands execute without additional arguments. FCL operates in two distinct functional states; command-line mode and macro mode. Command-line mode is a fully interactive text interface, as is used in the examples above.

If you are in command-line mode and you issue a command without associated arguments when that command normally requires them, then FELIX asks you for the appropriate input. For example, if the rn command is issued without a datafile name, FELIX asks for one, as shown below:

     rn

file=myfile.dat

Many FELIX command arguments are reserved symbols (see Chapter 3, Symbols and Expressions) and, where a reserved symbol has already been defined, as above (assuming you issued all the above commands), the parameter prompt displays the current value of the symbol. You can then accept the current value (by pressing <Enter>) or supply an alternative value (a filename in this case). If the command argument(s) have no current value, the prompt appears simply as:

     rn

file=

Unlike command-line mode, macro execution mode is not an interactive state. Therefore, in designing a macro you must be certain that all commands used in the macro file are supplied with all the appropriate input. This is not to imply that macros must be written using specific literal input designations, however, and symbolic input and output are discussed in Chapter 3, Symbols and Expressions.


Case sensitivity

FCL is case-insensitive by default, that is, FELIX does not distinguish whether input is upper or lower case. In fact, unaugmented character strings that are composed of mixed or uppercase text are interpreted as if they are all lowercase. For example, the following command statements are equivalent:

     rn myfile.dat

rn MYFILE.DAT
rn MyFiLe.DaT

Of course, you may prefer to distinguish between upper or mixed case in FELIX, and to do so you must signal that you want the input string to be interpreted literally, by enclosing the string in single quotation marks. For example, each command statement below is distinct from the others:

     rn 'myfile.dat'

rn 'MYFILE.DAT'
rn 'MyFiLe.DaT'

For each of these statements, FELIX tries to find and read a datafile whose name is exactly as shown.

It is important to note that although FELIX is case-insensitive with respect to command arguments, the commands themselves must contain only lowercase characters. For example:

     rn myfile.dat

is a perfectly valid command phrase. However:

     RN myfile.dat

and:

     Rn myfile.dat

cannot be interpreted by FELIX.

In addition to providing case-sensitivity, the single quotes may also be used to generate strings containing spaces. For example, using the def command (which allows you to define a symbol value) together with a string in single quotes, you can define phrases as symbol values:

     def mytext 'This is a test message'

lis mytext

User Symbol Value
mytext This is a test message


Errors in FCL commands

If FELIX cannot recognize a submitted command, it prints an error message together with what it interpreted as an erroneous command, for example:

     RN myfile.dat

Not a command: RN

Whenever FELIX indicates that a command phrase is invalid in some way, a special symbol named status also records the event by assuming a non-zero value. In this case the event is said to have generated "bad status". There is little significance to this occurrence if you are in command-line mode, since a subsequent successful command execution resets the status to zero (clear status). The effects are more problematic when such an error occurs during execution of a macro file, however: if "bad status" occurs during execution of a macro, no subsequent commands in the macro are executed. This feature is designed to protect datafiles and to avoid catastrophic failure of FELIX in the event of a fatal command error. The status may always be cleared manually by setting status to zero (see Chapter 3, Symbols and Expressions).


Display and context effects

Although many of the 1D vector-manipulation utilities (e.g., ft, rev, exc, and red) act on the entire contents of the 1D workspace regardless of whether the entire vector is displayed, there is an important class of FELIX commands that are distinctly display- and context-oriented. For example, the pic utility, which discriminates and records local extrema in 1D, 2D, and ND spectra, specifically alters its function to agree with the most recently displayed data. For example, if an expanded region of a 1D vector is drawn and the pic command is issued, that is:

     exp

pic
entity = pic:1d_picks
select mode = 0

Here, the pic command searches for local extrema only along the portion of the 1D workspace that is currently displayed and then records the results in the default entity pic:1d_picks. If, on the other hand, you are considering an expanded region of a 2D matrix file, that is:

     cp

pic
(0=Pos,1=Abs_Mag,2=Neg): 0
entity=xpk:peaks
select mode= 0

then the pic utility searches only the displayed region for 2D local extrema, based on the distinct 2D/ND extrema-discriminating criteria that are specified using the pic command arguments (see the pic command in Appendix A, Command Reference). The results are then recorded in the default 2D/ND entity xpk:peaks. Other commands thatich are display- and/or context-sensitive include drx, fit, and int.


Line continuation

An individual command statement may be longer than is convenient or desirable (maximum allowed length is 256 characters). You may want to continue long command statements over several lines to improve their readability. To do so, indicate that the end of a line is not the end of a command statement by ending the line with a special line-continuation symbol. In FELIX that symbol is the vertical bar |, which is entered by pressing <Shift> \ on most keyboards. Using the pic command example above, we might alternatively have submitted the following equivalent command statements:

     pic 0 xpk:peaks 0

or:

     pic 0 |

xpk:peaks 0

or:

     pic 0 |

xpk:peaks |
0

In command-line mode, FELIX acknowledges the continuation line character by formatting an altered version ( _> ) of the standard FELIX prompt ( > ).

The continuation line symbol must be separated by at least one space from the last character in the command phrase, that is:

     pic 0|

_>xpk:peaks|
_>O

is interpreted literally as the command phrase:

 > pic 0xpk:peaks0

which cannot be interpreted because it does not contain the required spaces.


File prefixes and suffixes

FELIX store datas, graphical objects, processing parameters, and analysis information in a variety of external files. The convention of naming datafiles with the suffix .dat and matrix files with the suffix .mat is a direct result of the mechanism by which FELIX accesses the files it needs for various processing and analysis activities. If you submit the command statement:

 > rn myfile

then the FELIX interpreter recognizes that the rn command has been invoked. FELIX then affixes the directory prefix (i.e., path) to the file using the datpfx symbol and appends the .dat file extension to the file before it begins searching for that file. Alternatively, if you submit the command statement:

 > rn myfile.dat

then FELIX affixes the appropriate directory prefix to the file, but does not add a suffix. This approach provides maximum flexibility and compatibility with other naming conventions. For example, if you submit the command statement:

 > re oldfile.ser

then FELIX affixes the appropriate data directory prefix and searches for a file with the older .ser datafile suffix.


Macro file formats


Comment symbols

It is often convenient to enhance the readability of macro files by using comments. Comments may describe the macro function or remind you of important datafiles or argument dependencies. The FELIX comment symbol is the semi-colon (;). A simple macro that demonstrates the use of comments is:

     ty Here is my macro! ; Type a message

;ty This line will not appear
rn myfile.dat ; Read my data file
dr
end

During execution, this macro prints only the line: "Here is my macro!", then reads the specified data file and draws it. Nothing following any of the comment symbols appears.


Tabs and spacing

As noted previously, in command-line mode there can be no spaces between the command prompt and the beginning of the command. This restriction is relaxed in macros, and spaces and tabs may be freely used to enhance readability, as shown below:

     c**mymac.mac

; This macro counts to 10
for loop 1 10
ty Count=&loop
next
end