FCL basics

This chapter describes the essentials of using the FELIX command language (FCL). The intent is to provide a foundation for using FCL commands in simple and advanced implementations.

FELIX is a command- or event-driven software application. 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.

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 more than 200 distinct FELIX commands, and nearly 200 associated reserved symbols.

Although many users interact with FELIX solely through the graphical user interface (GUI), the interface is mostly written using FCL.

Accessing FCL

You can directly access FCL by clicking the primary mouse button in the command window within the main FELIX window. If the command window was closed, you can open it by selecting View/Command Input from the main menu.

Virtually any task that can be performed with the GUI 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 GUI, or to conduct standard tasks directly, you always have the option of issuing FELIX commands, either as discrete command statements or as a group of commands in a macro file.

Commands and command arguments

As an 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.

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


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 prompts you to provide the appropriate input. For example, if the rn command is issued without a datafile name, FELIX asks for one, as shown below:



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:



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

Case sensitivity

FCL is case-insensitive; 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

Of course, you may prefer to distinguish between upper or mixed case in FELIX. 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'

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

CautionRemember 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, FELIX cannot interpret the following:

     RN myfile.dat


     Rn myfile.dat

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 in the output window. 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.

Note: The symbol is a variable. You can check its value by typing the command: lis status in the output window.

In this example, 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, some FELIX commands are 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. If an expanded region of a 1D vector is drawn and the pic command is issued, as in:


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:


(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 -- Peak pick and label command in Appendix A., Command reference). The results are then recorded in the default 2D/ND entity xpk:peaks.

Other commands that 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). When writing a macro, 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


     pic 0 |

xpk:peaks 0


     pic 0 |

xpk:peaks |
Note: Line continuation does not work in command-line mode. It works only in macro mode. The continuation line symbol must be separated by at least one space from the last character in the command phrase. That is:
     pic 0|


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 data, 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 an artifact of the mechanism by which FELIX accesses the files it needs for various processing and analysis activities. For example, if you submit the command statement:

     rn myfile

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

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

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 semicolon (;). Below is a simple macro that demonstrates the use of comments:

     ty Here is my macro! ; Type a message

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

During execution, this macro prints only the line: "Here is my macro!"; then the macro reads the specified data file and draws it. The macro does not display anything following any semicolon on a line.

Tabs and spacing

Spaces and tabs may be freely used in macros to enhance readability, as shown below:


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