\section{\&}

 The `\&' operator forces \fudgit\ to use the built-in following fitting
 mode command and to ignore any existing macro or alias with the same
 name. This can be useful in constructions like:
\nopagebreak\begin{verbatim}
    macro cd 1
        pmode cd "$1"
        &cd $1                  # The built-in cd
    stop
\end{verbatim}

\Seealso
\bq macro, cd \eq

\section{$\backslash$}

 If anywhere in the middle of a line, a `\verb+\+' will indicate
 \fudgit\ to take the following character as is. If at the end of a
 line, a `\verb+\+' indicates that the present line continues on the
 following one, and thus to ignore the following carriage return.

\Seealso
\bq line editing\eq

\section{!}

 Any line beginning with the so-called bang operator `!' will execute
 the system command line with a Bourne shell. Aliased commands as found
 in your interactive C-shell do not hold any more. For example,
 commands like {\tt !rm} will not be interactive (i.e. /bin/rm -i) even
 if you have such an alias in your {\it .cshrc} file. Be careful!  A
 nice turnaround is to alias rm to `{\tt ! rm -i}' in your {\it
 .fudgitrc} file and to use the {\tt rm} command directly from
 \fudgit's shell.

 When used in a macro name or an alias name, the `!' character has
 still another meaning. This tells the parser that characters following
 the `!' are optional. Therefore, if one types the following,
 interactively, (see NOTE)
\nopagebreak\begin{verbatim}
     set noexpand
     alias da!te !date
     set expand
\end{verbatim}
 then the parser will recognize {\tt da}, {\tt dat} and {\tt date} as
 all synonymous to the system command {\tt ! date} run through a Bourne
 shell.

 NOTE: In interactive mode, the history functions will try to interpret
 a history substitution if the `!' is not followed by a space. See the
 appendices. To avoid that the line be scanned for a history event
 designator, use the {\tt set noexpand} command. In some cases, it
 might be simpler to use the {\tt system} command.

\Syntax
\bq !{\it command}\eq

\Example
\bq ! mail\eq

\Seealso
\bq alias, ls, vi, foreach, system, set expand\eq

\section{?}

 A question mark will indicate \fudgit\ to try to get the possible
 options available to the command presently typed. This kind of help is
 context sensitive and works when an insufficient number of arguments
 is supplied. The question mark also serves as a wild character in
 string subtraction.

\Syntax
\bq {\it command} ? \eq

\Examples
\bq ?\\
show ?\\
set function ?\eq

\Seealso
\bq help, strings \eq

\section{\$}

 The `\$' operator expands scalar variables or constants (double
 precision numbers from C-calculator mode lookup table) as well as
 string variables or constants. Existing scalar variables can thus be
 expanded as a string in order to serve as a file name or directory
 name, for example. The expansion is done according to the value given
 to the {\tt set vformat} command which initially defaults to
 ``\%.3g''. Using the scalar variable expansion operator in
 C-calculator mode is not recommanded since a lot of precision might be
 lost (actually it is a waste!). Scalar variable expansion is
 essentially provided to allow alternative procedures in certain cases,
 such as generating filenames from numbers. Math function {\tt scan}
 can be considered as the complement of scalar variable expansion.

 The `\$' character also expands string variables. Expansion is done by
 replacing the \${\it String-Variable-Name} by the value of the string
 variable. This can be used to replace {\tt scan} in cases where the
 string variable or constant represents a number. For example
\nopagebreak\begin{verbatim}
     foreach File in echo 2.2 4.4 6.7 8.32
         let x = $File
         .
         .
         .
     end
\end{verbatim}

 In both cases, if the variable name has to be followed by alphanumeric
 characters, then the variable name can be delimited by braces as in
 standard csh.

 Followed by an integer number, the `\$' character serves to designate
 the arguments of a macro. Refer to the description of {\tt macro},
 concerning this point.

\Syntax
\bq \${\it name}\eq
 or
\bq\$\{{\it name}\}\eq

\Seealso
\bq C, cmode, macro, echo, exit \eq

\section{\_dumplot}

 Command {\tt \_dumplot} is generally used in a macro to dump vectors
 in the plotting pipe. It is described in more detail under {\tt
 special} item.

\section{\_killplot}

 Command {\tt \_killplot} is rarely used. It sends a KILL signal to the
 plotting program. It is described in more detail under {\tt special}
 item.

\section{adjust}

 The {\tt adjust} command is used to specify the parameters to be
 adjusted in the ``least square linear'' and the ``Marquardt-Levenberg
 nonlinear'' fitting methods. Parameters not being adjusted will have
 their standard deviation set to zero.

\Syntax
\bq adjust {\it index-list} \eq

\Example
\bq adjust 1 2 4\eq

\Seealso
\bq set parameters, set method, set function, fit, show fit \eq

\section{alias}

 The {\tt alias} command is used to alias a multiple word command to a
 single word. Although macros and aliases are different objects, it is
 not allowed to define a macro and an alias with the same name since
 aliases are always expanded first. Recall that the bang operator
 (`!'), at the beginning of a line is recognized from a macro, an alias
 or a script file so that an alias like
\nopagebreak\begin{verbatim}
     alias date !date
\end{verbatim}
 is perfectly legal. However, this would have to be typed
\nopagebreak\begin{verbatim}
     alias date ! date
\end{verbatim}
 at the interactive command line, to avoid that the `!' be interpreted
 by the history functions.

 When called without arguments, {\tt alias} will list all the current
 aliases. For obvious reasons, it is not allowed to {\tt alias} {\it
 unalias}. {\tt alias} also supports the command abbreviation character
 `!'. To enter a `!' without having it interpreted by the history
 functions, just {\tt set noexpand} for the time entering the command.
 When a `!' is part of the alias name this indicates that the alias
 command name can be abbreviated down to that point. Since the {\tt \&}
 operator is used to refer to the native commands, it is therefore
 forbidden to start an alias name by character '\&'.

\Syntax
\bq alias {\it command} {\it command-list} \eq

\Examples
\nopagebreak\begin{verbatim}
     alias mv !mv
     alias . quit
     alias da!te !date
\end{verbatim}

\Seealso
\bq !, \&, macro, unalias, set expand \eq

\section{append and save}

 The {\tt append} command can be used to append various things to an
 existing file. If the file does not already exists, it will be
 automatically created.

 The {\tt save} command can be used to save various things to a file.
 If a file with the same name already exists, it will be overwritten
 without any warning.

\subsection{append history}

 History can be saved or appended to a file. Any file saved this way
 can later be executed by the {\tt load} command. Note that {\tt append
 history} will silently fail if the file does not exist.

\Syntax
\bq append history {\it filename}\\
save history {\it filename}\eq 

\Seealso
\bq load, line editing, fmode \eq

\subsection{append macros}

 All the current macros and aliases can be saved or appended to a file.
 Any file saved this way can be subsequently {\tt load}ed at any time.
 To avoid confusion between data files and script files we recommand
 that you use the {\it .ft} extension for your script files.

\Syntax
\bq append macros {\it filename}\\
save macros {\it filename}\eq

\Seealso
\bq alias, unalias, load, show, macro, unmacro \eq

\subsection{append parameters}

 Parameters can be saved into a file at any time. The number output
 format will be the one chosen by the {\tt set format} command. The
 column order will be a parameter followed by its standard deviation.
 All columns are separated by a tab. Therefore, if one has previously
 set parameters, i.e.
\nopagebreak\begin{verbatim}
     set parameters MYPAR 3
      .
      .
      .
     save parameters myfile
\end{verbatim}
 then there will be 6 columns as follows:
\nopagebreak\begin{verbatim}
MYPAR[1]    DMYPAR[1]       . . .      MYPAR[3]     DMYPAR[3]
\end{verbatim}
 in file {\it myfile}. Most of the time, the user will desire to
 save parameters along with some variables or constants. This can be
 done by giving the variable or constant (either string or scalar)
 names on the command line. For example,
\nopagebreak\begin{verbatim}
     let t = 0.23
     set parameters A 2
     .
     .
     .
     save parameters t parfile
\end{verbatim}
 will create a file {\it parfile} containing the value of scalar
 variable {\tt t}, followed by the 2 values of parameters {\tt A},
 alternated with the value of their standard deviations {\tt DA}.
 Note that the given list of variables will be printed first.

\Syntax
\bq append parameters {\it variable-list\optio} {\it filename}\\
save parameters {\it variable-list\optio} {\it filename}\eq

\Seealso
\bq set format, set parameters, show parameters\eq

\subsection{append variables}

 Any variable or number of variables can be saved to a file at any
 time. Vector elements referenced by an explicit index are considered
 as variables. String variables and constants are recognized as well.

\Syntax
\bq append variables {\it variable-list} {\it filename} \\
save variables {\it variable-list} {\it filename}\eq

\Examples
\nopagebreak\begin{verbatim}
     append variables x Y[3] a VECTOR[78] datafile1
     save variables t PARAM[2] DPARAM[2] datafile2
\end{verbatim}

\Seealso
\bq load, cmode, let, C, show, auto \eq

\subsection{append vectors}

 Any vector or number of vectors can be saved to a file. All the values
 are written in columns separated by a tab. The number format will be
 the one chosen by the {\tt set format} command.

\Syntax
\bq append vectors {\it VECTOR-list} {\it filename}\\
save vectors {\it VECTOR-list} {\it filename}\eq

\Examples
\nopagebreak\begin{verbatim}
    append vectors X Y ERROR1 TEST2 datafile1
    save vectors TIME TEMP DT datafile2
\end{verbatim}

\Seealso
\bq set format, set data, read, fit, fft, show, auto \eq

\section{auto}

 The {\tt auto} keyword is used to define automatic variables. The type
 of variable can be a scalar variable, a VECTOR or a String, depending
 on the upper-lower case letters in the variable name. The scope of
 auto variables is delimited by braces as in C. All auto variables are
 stored on the stack and are freed when the scope of the variable is
 left. Definition of variables can only be done right after a brace has
 been opened. Only scalar variables can be assigned as the are defined,
 while vectors are assigned to zero, and strings are empty. Contrarily
 to C, automatic scalar variables are set to zero if not assigned.
 {\tt auto} is a C-calculator mode keyword.

\Syntax
\bq auto {\it var-list} \eq

\Examples
\nopagebreak\begin{verbatim}
     # Some dummy examples
     set data 100
     cmode
        x = y = 1                # These (x, y) are global
        X = y++                  # As well as vector X
        { auto x=2, X, Y         # All these variables are local...
           X=3; Y=sin(x)
            .
            .
            .
        }                        # ...and stop existing here
        x                        # This x still contains 1
     # An example with a procedure
        proc test(x) {
           auto y=2
           z = x + y++           # This z is global
        }
     fmode
\end{verbatim}

\Seealso
\bq C, cmode, func, proc\eq

\section{break}

 The {\tt break} keyword is used as in C to break C-calculator mode
 {\tt for} or {\tt while} loops. {\tt break} is a C-calculator mode
 command.

\Syntax
\bq break \eq

\Seealso
\bq C, continue, cmode, for, while \eq

\section{C}

 The following gives a brief description of the supported C-calculator
 syntax and differences with standard C.

 The following operators are recognized, in order of precedence:
\nopagebreak\begin{verbatim}
    ++, --                          (post and pre) increment-decrement
    -, !                            unary minus and logical NOT
    ^                               exponentiation, right associative
    /, *, %                         division, multiplication, modulo
    +, -                            addition, subtraction
    >, >=, <, <=, ==, !=            relational operators
    &&                              logical AND
    ||                              logical OR
    =, +=, -=, /=, *=               assignments, right associative
\end{verbatim}

 All operators are left associatives except those specified.
 They are all common to C except for the exponentiation operator.

 The following keywords are reserved tokens:  {\tt auto, if, else, while,
 for, break, continue}, and {\tt return}, plus two extra keywords {\tt
 proc, func}. They roughly obey the same syntax as in C so that statements
 like:

\bq if ({\it conditions})\\
    {\it cmode-line-statement}\eq
 or
\bq if ({\it conditions}) {\it cmode-line-statement} \eq
 or
\bq if ({\it conditions}) \{\\
     {\it cmode-statements}\\
\}\eq

 The same thing is true for the else constructions {\tt else} of which
 some examples follow:

\bq if ({\it conditions}) \\
    {\it cmode-line-statement}\\
else\\
    {\it cmode-line-statement}\eq
 or
\bq if ({\it conditions}) \{\\
    {\it cmode-statements}\\
\} else \{\\
    {\it cmode-statements}\\
\}\eq

 Here {\it cmode-line-statement} means any semicolon separated list
 of C-calculator mode statements typed on the same line. Since
 semicolons are separators and not terminators, empty statements are
 defined by empty braces {\tt \{ \}}.

 The {\tt return} keyword must have parentheses when returning a value
 from a function as in {\tt return(x * sin(y))}. A single {\tt return}
 will only be recognized from within a procedure.

 To avoid potential confusion with variables, keywords cannot be
 abbreviated.

 As opposed to C, there exists no integer in the C-calculator mode. All
 scalar variables and numbers are double precision. This means that
 logical true is 1.0 and false is 0.0. As in C, one must be careful
 with comparison operators. The C {\tt switch} syntax is not supported
 (would require integers).

 As an extension, string comparison is possible with the equality
 operators `==' and `!='. This will return true or false if the string
 variables (or constants) are identical or not. Assignments of string
 variables actually copies all characters of the string on the RHS to
 the string variable on the LHS. String additions and subtractions are
 also possible.

 Function and procedure definitions are defined with prototypes, i.e.,
 a list of variables representing the proper kind of variable. At
 run-time, the arguments of the function are checked for type
 compatibility and for their number.

 All variables are global except automatic variables defined using the
 {\tt auto} keyword. 

\Seealso
\bq cmode, let, math, scan, strings, auto \eq

\section{cd}

 The {\tt cd} command changes the working directory. Called with no
 argument, {\tt cd} will bring you to your \$HOME directory. Note that
 {\tt cd} changes the current working directory of \fudgit\ only.
 Therefore, your plotting program will still be in the previous
 directory. To get around this difficulty, you only have to define a
 macro as follows, if your plotting program supports {\tt cd}:
\nopagebreak\begin{verbatim}
     macro Cd 1
         pmode cd "$1"
         &cd $1
     stop
     alias cd Cd
\end{verbatim}

\Syntax
\bq cd {\it filename\optio}\eq

\Examples
\nopagebreak\begin{verbatim}
     cd
     cd /nazgul/users/fulano
\end{verbatim}

\Seealso
\bq \&, pwd, alias\eq

\section{cmode}

 The {\tt cmode} command allows you to go in the C-calculator mode. The
 only way to come back to the main fitting mode is by using the {\tt
 fmode} command or to type \^{ }D in interactive mode. Commands cannot
 be abbreviated in {\tt cmode}. Parallel to the {\tt cmode} command,
 the {\tt let} command can be used to pass one single command, or
 command line to mathematical parser. To be consistent with {\tt pmode}
 command, {\tt cmode} also accepts arguments in which case it is
 equivalent to the {\tt let} command. It is not an error to call {\tt
 cmode} from the C-calculator mode. A warning message will be given
 though.

\Syntax
\bq cmode {\it command-list\optio}\eq

 The C-calculator mode supports most of C syntax (see item C), and most
 of the C math library. Thus, the following functions are supported:
\nopagebreak\begin{verbatim}
    trigo:    hyperbolic:  expo:    special:   conversion:  random:

    cos()     cosh()       ln()      besy0()    trunc()     srand()
    cot()     coth()       log()     besy1()    floor()     rand()
    csc()     csch()       exp()     besj0()    ceil()
    sec()     sech()       sqrt()    besj1()    rint()
    sin()     sinh()       cbrt()    besjn()    abs()
    tan()     tanh()                 besyn()    int()
    acos()   acosh()                 erf()      scan()
    asin()   asinh()                 erfc()     min()
    atan()   atanh()                 lgamma()   max()
    atan2()                          interp()   sum()
                                                vread()
\end{verbatim}

 Any upper case variable (possibly including `\_') possibly mixed with
 digits will be recognized as a vector, e.g., {\tt TEMP\_2, TEST, D},
 etc. Any lower case name will be taken as a scalar variable, e.g.,
 {\tt x, t4}, etc. There are two predefined constants, {\tt pi} $=\pi$
 and {\tt e}$=e$, which should not be unlocked and modified. As well,
 the built-in constant {\tt data} contains the current size of the
 vectors and can be modified through the {\tt set data} command, by the
 {\tt read}/{\tt exec} commands, or by {\tt unlock}ing the constant and
 modifying it directly. The built-in constant {\tt chi2} contains the
 value of $\chi^2$ as obtained from the latest fit. And finally, the
 built-in scalar constant {\tt param} contains the number of parameters
 as defined by {\tt set parameters}.

 A mix of upper case and lower case letters will serve to indicate a
 string variable. Strings values are indicated by double quotes as in
 C. Unlike C, \fudgit\ considers strings as self-contained objects that
 can be added, subtracted, and checked for (in)equality. Thus, string
 objects (i.e. string variables, string constants and string values)
 can: serve as argument to {\tt scan} function; be part of string
 assignment statements or of a truth statement involving (in)equality
 operator; be added (concatenated using the `+' operator) one with
 another; be subtracted (remove string termination using the `-'
 operator) one with another; and finally be argument of string
 functions.
 
 A predefined string constant called {\tt Tmp} contains the string
 "/tmp/fudgitPID" where PID is the process id number of the current
 process. This file, and any file belonging to you, whose name starts
 with the same string, will be erased automatically by the {\tt exit}
 or {\tt quit} commands. This string is typically used by the {\tt
 gnuplot} macro in order to pass data to the \gnuplot\ plotting program
 which cannot read data from standard input. Another predefined string
 constant is {\tt ReadFile} which contains the last data filename that
 has been loaded. Finally, the string constant {\tt Cwd} is made
 available in order to get the current working directory.

 The following table contains all the built-in constants.
\nopagebreak\begin{verbatim}
    chi2               Value of chi^2 from the last fit;
    data               Length of all vectors (< samples) as set by set data;
    e                  Neperian number;
    param              Number of parameters as set by set parameters;
    pi                 Guess this one;

    Cwd                Current working directory;
    ReadFile           The last file (program) read by read (exec);
    Tmp                A temporary filename "/tmp/fudgitPID";
\end{verbatim}

 Constants (either strings and scalars) can also be created by {\tt
 lock}ing a variable. In the same manner, a constant can be modified
 directly if it has been {\tt unlock}ed.

 The algebraic operations applicable to scalar variables can be applied
 to vectors. Vector algebra can be mixed with scalar variable algebra
 in which case the user has to take the implied loop into account. For
 example, although the following operation is not standard C
 programming:
\footnote
 {NOTE: In order to show that some commands can be typed from both
 C-calculator mode and the fitting fmode, the following examples shows
 the typing mode from the first line. However, one can always type the
 same C-calculator mode command from the fitting mode by using the {\tt
 let} command (or {\tt cmode} command).}
\nopagebreak\begin{verbatim}
     cmode
         x = 0
         X = x++
\end{verbatim}
 will define a vector $X$ of size {\tt data} (see {\tt set data})
 ranging from $X[1]$ to $X[data]$ and taking values from 0 to
 $data-1$. Multiple commands can be given with the separator `;', for
 example, another version of the previous command could be written
\nopagebreak\begin{verbatim}
     cmode
         x=0;X=++x
\end{verbatim}
 in which case a vector $X$ taking values from 1 to $data$ will be
 created. (Note that the latter uses a pre-increment whereas the
 former uses a post-increment operator on {\tt x}: results are thus
 different). Vector elements can be referenced by elements using
 standard C grammar. Therefore, the same vector could be created by
 using a {\tt while} construction as in:
\nopagebreak\begin{verbatim}
     fmode
     set data 1000
     let X=0;i=0
     cmode
         while (i++ <= data)
            X[i] = i
     fmode
\end{verbatim}
 or, using a {\tt for} loop, 
\nopagebreak\begin{verbatim}
     cmode
        for (x=0;x<=data;x++) {
            X[x] = x
        }
     fmode
\end{verbatim}

 Noninteger variables will be truncated to the nearest lower integer to
 form a vector index.
\nopagebreak\begin{verbatim}
     cmode
         y= 2.01
         x=2.23; X[2]=Z[y]+5^x 
\end{verbatim}

 Assigning a vector to a constant will assign all the elements to that
 constant.
\nopagebreak\begin{verbatim}
     fmode
     let X = pi
     let Z2 = 0
\end{verbatim}

 The C-calculator checks for undefined variables on the RHS of any
 assignment. From C-calculator mode, variables values can be seen by
 typing the variable name by itself or by using the {\tt print}
 command, if the output is selected to be {\it stdout}. From the
 fitting mode, contents of constants and variables (either strings or
 scalars) is displayed using {\tt show variables} command, or by using
 the `\$' expansion operator. However, vectors can be only be seen from
 the fitting mode by using the {\tt show vector} command.

 Each unknown vector name given on the command line allocates a vector
 of {\tt sample} size.

 To be a calculator as such, the C-calculator prints the value of the
 expression given on the command line. Thus, the statement
\nopagebreak\begin{verbatim}
     cmode
         x + 2
\end{verbatim}
 will print the value of $x + 2.0$. The contents of many variables can
 be displayed at the same time by giving a coma separated list such as
 in
\nopagebreak\begin{verbatim}
     cmode
         x,"temperature", t
\end{verbatim}
 where the string {\it temperature} will be printed between the values
 of variables $x$ and $t$. Note that the C-calculator mode recognizes
 strings by double quotes. Special characters such as '\verb+\n+' are
 also legal in a string.

 We conclude by giving some examples involving string variables:
\nopagebreak\begin{verbatim}
     fmode
     let String = "new.file"
     let x = (String == "new.file")
     let y = ("file1" == "file2")
     let Bing = "\a\a\a"
     let Here = Cwd        # Store the value of the current working directory
     let Input = Read()                       # Read from stdin
     let Test = FileName(ReadFile) - ".data"
     let Dir = DirName(InputFile)
     let y = scan(Read(), "%lf")
     let File = "STRING_23.4"
     let number = scan("%*[_A-Z]%lf", File)
     let Message = "A tab \t and a newline\n"
\end{verbatim}
 where the truth statement could be legally used as a condition for an
 {\tt if}, a {\tt while}, or a {\tt for}.

\Seealso
\bq let, C, data, func, proc, print, fmode, math, while, for, return,\\
auto, if, break, samples, quotes, strings\eq

\section{comments}

 By default, anything following a `{\tt \#}' will be treated as a
 comment and ignored. This holds for data files as well as for command
 script files loaded with the {\tt load} command. This default can be
 changed with the {\tt set comment} command. Sometimes a comment
 character needs to be taken literally in a script file. The comment
 character will be accepted as data if it follows the `\verb+\+' escape
 operator, i.e. `\verb+\+\#', or, in the fitting mode only, whenever the
 comment character is somewhere inside quotes or parentheses. The
 comment character is always accepted literally when typed on the
 interactive command line.

\Seealso
\bq set comment, read, load, show comment, exec \eq

\section{continue}

 The {\tt continue} keyword has the same usage it has in C for sending
 the control to the next iteration of a {\tt for} or {\tt while} loop.
 {\tt continue} is a C-calculator mode command.

\Syntax
\bq continue \eq

\Seealso
\bq for, while, cmode, C \eq

\section{data files}

 Files containing data are loaded by specifying the name of the data
 file to the {\tt read} command. Data files should contain one data
 point per line. A data point can be a 256 dimensional object. By
 default, anything following character `{\tt \#}' will be treated as
 comment and ignored. In all cases, the numbers on each line of a data
 file must be separated by any number of blank spaces or tabs. These
 blanks divide each line into columns. Thus, \fudgit\ can handle up to
 256 columns per line. Warning will be given if a line has a different
 number of columns. Strings such as {\it NaN} or {\it Infinity} are
 recognized and refused. The default compilation gives a maximum line
 size of 1024 characters.

\Seealso
\bq read, exec, set comment \eq

\section{echo}

 The {\tt echo} command allows the user to print a string to the
 standard output. If no argument is given {\tt echo} will only print a
 newline. This command can be used to display a message or, when
 coupled with the variable expansion operator `\$', to see the value of
 a printable (either string or scalar) variable defined in the
 C-calculator.

\Syntax
\bq echo {\it string-list}\eq

\Examples
\nopagebreak\begin{verbatim}
      echo Starting the fit
      echo $Mydir
\end{verbatim}

\Seealso
      \bq cmode, \$ \eq

\section{else}

 The {\tt else} keyword is used in {\tt if} constructions, both in
 C-calculator anf fitting modes. Refer to the {\tt if} entries for a
 complete description.

\section{end}

 The {\tt end} command is used to complete a {\tt foreach} loop or a
 {\tt while} loop. Keyword {\tt end} is also used to tell {\tt read}
 that we are finished writing data to stdin. This command should always
 be found on a line by itself (comments are allowed though).

\Seealso \bq foreach, while, read, stop\eq

\section{endif}

 The {\tt endif} command is used to complete an {\tt if} construction
 in fitting mode. Keyword {\tt endif} must always be used on a line by
 itself (comments are allowed though). Refer to the {\tt if} entries
 for a the complete description.

\section{environment}

 \fudgit\ is sensitive to the following environment variables:

    $\bullet$ PAGER for the program called to format long listings.

    $\bullet$ HOME for the directory to which {\tt cd} defaults.

    $\bullet$ SHELL for the shell called by {\tt system} when this
          latter is called without arguments.

 If not defined, the default pager is {\it /usr/?/more} (path depends
 on system) and the default shell {\it /bin/csh}.

\Seealso
\bq cd, system, show vectors, help \eq

\section{exec}

 The command {\tt exec} executes a program and reads data from it. It
 supports the same syntax {\tt read} does except that the program name
 replaces the file name. A program is a program name or anything that
 can be typed in a shell. If the command line has more than one string,
 it must be glued with quotes. On a successful call, {\tt exec} will
 set the string constant {\tt ReadFile} to the name of the program
 which generated the data.

\Syntax
\bq exec {\it commands} {\it assignment$[$range$]$\optio} \ldots\eq

\Examples
\nopagebreak\begin{verbatim}
     exec simulate X:1 Y:2[0:200]
     exec "cat data | myfilter -g" X1:1[0:*] X2:2 X3:4
\end{verbatim}

\Seealso
\bq read, comments\eq

\section{exit}

 The commands {\tt exit} and {\tt quit} will exit \fudgit.
 See details under item {\tt quit}.

\Syntax
\bq exit\eq

\Seealso
\bq quit, cmode \eq

\section{fft}

 The {\tt fft} command will take the Fourier transform of the specified
 vectors and put the real part in a vector specified by the third
 argument. The imaginary part will be put in a vector specified by the
 fourth argument. Input vectors can be used for output. The resulting
 vectors will contain frequencies ranging from 0 to $N/2$ followed by
 $-(N/2 - 1)$ to $-1$ in units of $1/(N*\Delta)$ where $\Delta$ is the
 sampling rate. If a real vector is transformed $h(t) -> H(f)$, we
 should have $H(-f) = H^*(f)$. Therefore, with $H = R + iI$ and
 $H^* = R - iI$ be the transformed vectors, we should have
 $R(-f) = R(f)$ and $I(-f) = -I(f)$, where $f$ is discrete and ranges
 as mentioned above. In terms of vector indices, these relations
 become $R[i] = R[N-i+2]$ and $I[i] = -I[N-i+2]$ for $1 < i < N/2$ in
 addition to the fact that $I[1] = I[(N/2)+1] = 0$. Therefore, because
 the negative frequency part is the mirror image of the positive one,
 it is common to plot only the positive frequencies of the Fourier
 transform of a real vector. This can be done by reducing {\tt data} to
 half its value.

 Because of the use of a FFT algorithm, the number of data points must
 be an integer power of 2. If not, the user should pad the vector with
 zeros up to the next largest power of two. Each transform is
 normalized by the factor $\sqrt{(N)}$ so that {\tt fft RE IM T\_RE T\_IM}
 followed by {\tt invfft T\_RE T\_IMA RE2 IMA2} will not introduce a
 factor $N$ in vectors {\tt RE2} and {\tt IMA2} (i.e., {\tt RE} = {\tt RE2}
 and {\tt IM} = {\tt IM2}). At his choice, the user can use the
 C-calculator functionality in order to implement windowing.

 The power spectrum can be obtained from:
\nopagebreak\begin{verbatim}
      fft RE IMA T_RE T_IMA
      let POW = T_RE^2 + T_IMA^2
\end{verbatim}
 where $POW[i]$ will contain the power value associated with frequency $f$,
 which goes from 0 to $N/2$ followed by $-(N/2 - 1)$ to $-1$ (in units
 of $1/(N*\Delta)$) as $i$ goes from 1 to $N$.

\Syntax
\bq fft {\it real-VECTOR} {\it ima-VECTOR} {\it real-VECTOR} {\it ima-VECTOR}\eq

\Examples
\nopagebreak\begin{verbatim}
      # real vector X
      let IM=0
      # re-use IM vector for output
      fft X IM Z IM
      # complex vectors X+iY where i = sqrt(-1) transformed in V+iW  
      fft X Y V W
\end{verbatim}

\Seealso
\bq invfft, smooth, cmode, let, read, math, data \eq

\section{fit}

 The {\tt fit} command is used to fit a function, chosen by {\tt set
 function}, to a pair of vectors containing the independent and
 dependent variables. Depending on the type of fit, selected by the
 {\tt set method} command, a third vector containing the standard
 deviation might be required. {\tt fit} allocates a vector having the
 name of the dependent variable appended with the string {\tt FIT}.
 This vector contains the computed values of the function for the given
 independent vector. Depending on the method, the built-in constant
 {\tt chi2} will contain the value of the mean square deviation
 weighted by vector {\it $\sigma$-VECTOR} or the mean absolute deviation.

\Syntax
\bq fit {\it independent-VECTOR} {\it dependent-VECTOR} {\it $\sigma$-VECTOR}\eq

\Example
\nopagebreak\begin{verbatim}
     fit X Y DY
\end{verbatim}
 will create a vector {\tt YFIT} containing the value of the fitted
 function for each of the values of the independent vector {\tt X}.
 Note that the standard deviation is required for most fitting routines
 since it is used to weigh the value of local square deviation from the
 fit (in fact, this is the definition of $\chi^2$). If {\it
 $\sigma$-VECTOR} is unavailable just use
\nopagebreak\begin{verbatim}
     let DY=1
\end{verbatim}
 using the previous example. This simply gives the same weight to all
 data points.

\Seealso
\bq set method, set function, show fit, show parameters, append\eq

\section{fmode}

 The {\tt fmode} command allows you to return to the fitting mode, when
 the program is in one of the C-calculator or plotting modes. The
 fitting mode, is the main mode of the program. The two other modes are
 the C-calculator mode, accessed by the {\tt cmode} command, and the
 plotting mode, accessed by the {\tt pmode} command. When used
 interactively, \^{ }D returns to the fitting mode from either of the
 C-calculator mode or from the plotting mode. It is not an error to
 call {\tt fmode} from the fitting mode. A warning message will be
 given though.

\Syntax
\bq fmode\eq

\Seealso
\bq cmode, pmode, let\eq

\section{for}

 The {\tt for} command is a C-calculator mode command. It behaves
 roughly like a standard C {\tt for} construction. In interactive
 mode, any new input line will be prompted with a ``n\{\ldots n\verb+\t+''
 where `n' stands for the nesting level and `\verb+\t+' for a tab.
 Keyword {\tt for} is a C-calculator mode command.

\Syntax
\bq for ({\it init-expressions}; {\it cond-expressions}; {\it loop-expressions}) \\
      {\it cmode-line-statement}\eq
 or 
\bq for ({\it init-expressions}; {\it cond-expressions}; {\it loop-expressions}) \{\\
      {\it cmode-statements}\\
\}\eq

\Examples
\nopagebreak\begin{verbatim}
     cmode
         for (i=1,j=2;i+j <= data; i+=2,j+=3) A[i] = X[j]
     fmode
     # Another example:
     # A macro to remove point x in a vector. Syntax: delete "vector" "index"
     macro delete 2
         cmode
             for(i=$2;i<data;i++) {
                 $1[i] = $1[i+1]
             }
         fmode
         unlock data
         let data--
         lock data
     stop
\end{verbatim}

\Seealso
\bq C, break, continue, cmode, if, set data, func, proc, if, lock, math \eq

\section{foreach}

 The {\tt foreach} command loops through the strings obtained from a
 given \unix\ command. Wild card characters are allowed since
 everything following the {\tt in} keyword is passed to a Bourne shell
 for execution. Strings can be obtained from any program including the
 easiest cases {\it echo, ls} and {\it cat}. The variable name must be
 of string type, i.e., consisting of both upper case and lower case
 letters (and possibly \_'s and digits).

\Syntax
\bq foreach {\it StringVarName} in {\it \unix-command}\\
     {\it body of the loop}\\
end\eq

\Example
\nopagebreak\begin{verbatim}
     #convert columns 2 and 3 of the following files in log-log format
     foreach Fname in ls data*.7[0-9] datatest.42 data*.8[4-7]
         echo $Fname ...
         read $Fname X:2[0.001:*] Y:3[0.001:*]
         let X = log(X)
         let Y = log(Y)
         save vectors X Y $Fname.log
     end
\end{verbatim}

\Seealso
\bq for, math function scan, while, macro \eq

\section{free}

 The command {\tt free} is made available for memory management. It is
 used to free vectors, variables, functions, procedures, and numbers
 that were allocated in the C-calculator mode.

 When called with the special argument ``@all'', {\tt free} will erase
 all the user vectors, numbers and variables, as well as all active
 functions and procedures (not macros and aliases). Otherwise, {\tt free}
 will free the specified vector(s) or variable(s). Constants (either
 scalar or string) cannot be removed without first unlocking them.

\Syntax
\bq free {\it VECTOR- or variable-list} \\
free @all\eq

\Examples
\nopagebreak\begin{verbatim}
      free @all
      free X y TEMP
\end{verbatim}

\Seealso
\bq unlock, C, cmode, show table, show memory, samples, let \eq

\section{func}

 The {\tt func} command defines a function. A function is distinct from
 a procedure from the fact that a function must return a value whereas
 a procedure must not. Arguments are given in the definition with any
 name prototype representative of the data type. As in C, the argument
 list must be comma separated when calling the function (after having
 defined it). An example follows. {\tt func} is a C-calculator mode
 command.

 The prototype list defines the type of variable to be used. Although
 all global variables are accessible from within the function,
 variables are always searched for from the prototype list first, then
 from the local list ({\tt auto} variables), and finally from the
 global list. All scalar variables are passed by value: thus any scalar
 expression is legal as scalar argument. String arguments and vector
 arguments are passed by pointer: thus string and vector arguments must
 refer to a variable explicitly. The {\tt show table} can be used to
 list all the installed objects at a given time.

\Syntax
\bq func {\it functionname}({\it proto-list\optio}) {\it cmode-line-statement}; return({\it value})\eq
 or
\bq func {\it functionname}({\it proto-list\optio}) \{\\
     {\it cmode-statements}\\
     return({\it value})\\
\}\eq

\Examples
\nopagebreak\begin{verbatim}
    # The following example will print the factorial of all integers up to 120.
    cmode
        func fac(x) {  # This `x' is a prototype: it does not exist.
            if (x <= 0)  {
               return(1)
            } else {
               return(x * fac(--x))
            }
       }
       x=1  # This `x' is a global scalar variable
       while (x<120) {
           fac(x++)
       }
    fmode
    # The following calculates the average of a vector
    cmode
        func avg(X) {
            auto i,x

            for (x=0,i=1;i<=data;i++) {
                x += X[i]
            }
            return(x/data)
        }
    fmode
\end{verbatim}

\Seealso
\bq C, return, for, while, cmode, math, free, proc, show table, install \eq

\section{help}

 The {\tt help} command displays on-line help. To specify information on a
 particular topic use the syntax:

\bq help {\it topic}\eq

 If {\it topic} is not specified, a short message is displayed about
 \fudgit. Topic names can be abbreviated down to the shortest
 unambiguous string. In case of doubt, {\tt help} will print out all
 possible completions. Thus, {\tt help f} will print all help topics
 starting with the letter `f'. After help for the requested topic has
 been given, help for a subtopic may be requested by typing the
 subtopic name, extending the help request. After that subtopic help
 has been displayed, the request may be extended again, or pressing
 return will return one level back to the previous topic. Eventually,
 the fitting mode prompt will return.

\Seealso
\bq help? \eq

\section{history}

 The {\tt history} command lists all the previous command lines, along
 with a number. History lines can be called using the !{\it string}
 construction or the !{\it number}. History is only available in
 interactive mode. See Appendix A for more details.

\Syntax \bq history\eq

\Seealso
\bq append history, line editing \eq

\section{if}

 There are two kinds of {\tt if} constructions available in \fudgit,
 one in the fitting mode and the other in the C-calculator mode.

\subsection{C-calculator mode if}

 In C-calculator mode, {\tt if} and {\tt else} are reserved keywords.
 C-calculator mode {\tt if} construction is similar to the one in
 standard C. Note that {\it cmode-statements} refers to any sequence of
 C-calculator mode commands and that {\it cmode-line-statement} refers
 to a semicolon separated list of C-calculator mode commands typed on
 the same line.

\Syntax
\bq if ({\it conditions}) {\it cmode-line-statement}\eq
 or
\bq if ({\it conditions})\\
    {\it cmode-line-statement}\eq
 or
\bq if ({\it conditions}) \{\\
     {\it cmode-statements}\\
\}\eq
 or, using the {\tt else} constructions,
\bq if ({\it conditions})\\
     {\it cmode-line-statement}\\
else\\
     {\it cmode-line-statement}\eq
 or, for statements on more than one line,
\bq if ({\it conditions}) \{\\
     {\it cmode-statements}\\
\} else if ({\it conditions}) \{\\
     {\it cmode-statements}\\
\} else \{\\
     {\it cmode-statements}\\
\}\eq

\Seealso
\bq C, cmode \eq

\subsection{Fitting mode if}

 Fitting mode {\tt if} has a syntax very similar to the one in C-shell.
 It requires the keywords {\tt then} and {\tt endif} and supports {\tt
 else} constructions. The difference resides in the fact that the
 conditional statement has to follow C-calculator mode grammar and
 syntax and thus has a richer set of operators. The `\$' expansion
 operator is therefore not needed in the conditional statement, as it
 is in C-shell conditional statements. All active variables, constants,
 and their string counterparts, are directly available to the
 conditional statement. Note that the {\it fmode-statements} can also
 contain C-calculator mode commands (even possibly including
 C-calculator mode {\tt if}'s!).

\Syntax
\bq if ({\it conditions}) then\\
     {\it fmode-statements}\\
endif\eq
 or, using the {\tt else} constructions,
\bq if ({\it conditions}) then\\
     {\it fmode-statements}\\
else if ({\it conditions}) then\\
     {\it fmode-statements}\\
else\\
     {\it fmode-statements}\\
endif\eq

\Seealso
\bq while, foreach, macro\eq

\section{in}

 The {\tt in} keyword is required in {\tt foreach} constructions in
 fitting mode. Refer to the latter for details.

\section{install}

 The {\tt install} command dynamically loads defined routines from an
 object file. The user decides on the internal name of the routine but
 the internal name must consist of lower case letters only. The object
 file is an object compiled by the C or FORTRAN compiler. On IRIX, the
 object must be compiled with the option {\tt -G 0} given to either the
 C or FORTRAN compiler. The {\it rtn-name} is the name of one of the
 procedure(s) or function(s) the user wants to install from the
 object file. The routine will be installed as {\it name} and as a
 procedure (not returning value) or as a function (returning value)
 depending on the name separator being a {\tt :} (colon) or a {\tt =}
 (equal sign) respectively. (See example below).

 NOTE: This option is only available on IRIX and SUNOS for the moment.

 The external routine must expect pointers to double for all its
 arguments. Thus, all arguments are passed by pointers except that
 pointers to variables do not point to the variables as such but to a
 temporary copy of them. This allows us to have expressions like

 {\tt f = mycall(X, sin(x) + 1, data)}

 for which the value {\tt sin(x) + 1} must necessarily be a temporary copy.
 In this example, the prototype is a function {\tt mycall(VEC, expr, expr)}.
 We shall consider an example in more detail below. All arguments are
 strongly typed as vector, parameter, expression or string. Prototyping
 is done using the uppercase-lowercase convention. Parameters are prototyped
 using the word {\tt PARAM} or less (e.g. {\tt PAR}).

 On IRIX, the linker will create a binary file built from the module
 name and with the extension {\it file}.{\tt ld}. This binary is the
 one that will be loaded in memory. Time stamps are included so that
 {\tt ld(1)} will not be called if not necessary. These files are not
 erased at exit, since they are reusable and prevent the linker to be
 called if nothing changed between two sessions of \fudgit.

 Successive calls of {\tt install} with the same module should not be
 done unless the same functions and procedures are reinstalled. If this
 is the case, the user should then reinstall the same modules (that
 could have been modified and recompiled in the mean time) using the
 {\tt reinstall} command. If a module is reinstalled with different
 routines or function or procedure names, the previously defined
 functions or procedures might not be properly installed anymore and
 calling them might result in an undefined behavior.

 The file {\it fudgit.h} describes the functions user-defined programs
 can linked with. Among other things, these functions allow the user to
 have elegant error handling and exit.

 The {\tt show table} command can be used to list all the installed
 objects at a given time.

 A file having the same base name of the module but with the extension
 {\it libs} can be put in the same directory in order to include extra
 libraries while loading the module. On IRIX, these extra libraries
 must all contain objects compiled with the flag {\it -G 0} (see {\tt
 cc(1)}).  (For example, some IRIX systems have a -lm\_G0 math
 library.) User-defined libraries can be specified along with system
 libraries. A typical example could be a line like:

\bq /home/myname/myproject/libmyG0.a /usr/lib/libmG0.a \eq

 for linking with user's library {\it /home/myname/myproject/libmyG0.a}.
 Equivalently, for non-IRIX systems, loading a FORTRAN object might
 require something like this:

\bq /usr/lib/libF77.a /usr/lib/libm.a \eq

 Library names can be on multiple lines. However, the file cannot have
 more than 1024 bytes. A `{\tt \#}' found anywhere in this file will make
 the rest of the file to be ignored.

 Note that when loading FORTRAN code, the user must append an underscore
 to the routine name so that {\tt install} or {\tt reinstall} can find it.

 The IRIX version does not fully support incremental linking, i.e., to
 use, in an object to be installed, symbols that were defined in
 previously {\tt install}ed objects. However, all the symbols contained
 in the original \fudgit\ executable remain at all time available to
 all linked routines. Therefore, IRIX users should make sure that
 external objects are self-contained and only reference to external
 routines that are intrinsic to \fudgit\ or come directly (and once)
 from linked libraries at installation time.

\Syntax
\bq install {\it object-file} {\it rtn-name}[:|=]{\it name}(arg-list)\ldots\eq

\Example
\nopagebreak\begin{verbatim}
    hostname: cat mymodule.c
        #include <math.h>
        #include "fudgit.h"
        
        /* An example of a user-defined routine inversing the order of an even
         * vector. Typical call would be:
         *  myproc(A_VEC, data)
         * from C-calculator mode. NOTE that both VEC and expr are pointers.
         * To make things explicit, fudgit.h contains a few typedef's.
         */
        
        void myproc(X, dn)
        VEC X;
        expr dn;
        {
            int i, half_n;
            int n = (int)*dn;  /* note that dn is a pointer to a double */
            double tmp;
    
            if (n%2 == 1)   /* report error if odd number (Why not?)*/
                Ft_matherror("%s: Called with an odd number %d.", "myproc", n);

            /* You have full use of math and stdio libraries too!!! */
            fprintf(stderr,
            "BTW, Did you know that %lf is the sqrt(pi)?\n", sqrt(M_PI));

            half_n = n >>1;  /* half of n */
            for (i=0;i<half_n;i++) { /* Standard C: indices from 0 to data-1 */
                tmp = X[i];
                X[i] = X[n-i];
                X[n-i] = tmp;
            }
        }
        
        /* 
         * Another example involving a function. The following calculates the
         * non-normalized correlation between vectors A and B as defined by 
         * corr(A, B) = <A*B> - <A> * <B>
         *
         */
        
        double myfunc(A, B, dn)
        VEC A, B;
        expr dn;
        {
            int i, n = (int)*dn;  /* Again, dn is a pointer to a double */
            double sumA, sumB, sumAB;
        
            sumA = sumB = sumAB = 0.0;
            /* sum up the values of interest */    
            for (i=0;i<n; i++) {  /* indices go from 0 to data-1 */
                sumA += A[i];
                sumB += B[i];
                sumAB += A[i] * B[i];
            }
            /* leave it simple */
            sumA /= *dn;
            sumB /= *dn;
            sumAB /= *dn;
        
            return (sumAB - sumA*sumB);
        }
    hostname: cc -G 0 -O -c mymodule.c
    hostname: cat loadex.ft
        # This is an example for loading
        # Install function myfunc as corr() and procedure myproc as inverse()
        # Prototypes are made from any name representing the proper type:
        install mymodule.o myproc:inverse(V, n) myfunc=corr(V, V, n)
        set data 24
        let x=1;X=x++
        let Y=sin(X)
        cmode
            # Inverse order of vector X
            inverse(X, data)
            # Calculate correlation between X and Y
            y=corr(X, Y, data)
            # Print its value
            "correlation:", y
        fmode
    hostname: fudgit loadex.ft
    install: myproc installed as procedure inverse.
    install: myfunc installed as function corr.
    BTW, Did you know that 1.772454 is the sqrt(pi)?
    correlation: 9.20717026e-01 
\end{verbatim}

 When linking FORTRAN functions or subroutines, the user must append an
 underscore after every function or subroutine name. All argument
 variables and vectors have to be defined {\tt double precision} as
 well as returning functions. Typical examples are included in the
 distribution in the {\it tools} directory.

\Seealso
\bq C, cmode, show table, func, proc \eq

\section{invfft}

 Command {\tt invfft} performs the inverse Fourier transform of the
 given vectors. It assumes that the frequencies are ordered from 0 to
 $N/2$ followed by negative frequencies ranging from $-(N-1)/2$ to $-1$
 in units of $1/(N*\Delta)$ where $\Delta$ is the sampling interval.
 The results are normalized by a factor $1/\sqrt{(N)}$ so that a
 transform followed by an inverse transform should give the original
 vector. The resulting vectors are stored in the third and fourth
 arguments. Thus, {\tt invfft X Y V W} inverse transforms X+iY into
 V+iW. Input vectors can be used as output vectors. See {\tt fft} for
 more details.

\Syntax
\bq invfft {\it real-VECTOR} {\it ima-VECTOR} {\it real-VECTOR} {\it ima-VECTOR}\eq

\Seealso
\bq fft, smooth, cmode, let, read, math, data \eq

\section{let}

 The {\tt let} command opens the door to the C-calculator mode from the
 fitting mode, but leaves the program in fitting mode. All the {\tt
 let} commands can always be typed directly from the C-calculator mode
 without having to prepend with the {\tt let} keyword. The converse is
 also true; all the commands given in C-calculator mode could be typed
 from the fitting mode by prepending them with the {\tt let} command.
 Although {\tt let} is typed from the fitting mode, the remainder of
 the line is parsed according to C-calculator mode rules, and thus
 quotes are no longer swallowed. Variable expansion operator `\$' is
 still recognized, but its use is not recommanded for C-calculator
 statements. See `\$' for more details on this point.

\Syntax
\bq let {\it C-calculator-mode-commands}\eq

\Examples
\nopagebreak\begin{verbatim}
      # generate the zero order first kind bessel
      # function between (0, 2*pi]
      fmode
      set data 2000
      let x=1; X=x++
      let tmp = 2*pi/data     # compute sequence only once
      let X *= tmp
      let Y = besj0(X)
\end{verbatim}

\Seealso
\bq cmode, C, math \eq

\section{line editing and history}

 The command shell supports line editing and history. The editing
 commands are based on the basic \emacs\ commands. A short summary
 follows but a more complete description can be found in Appendix B.

 Line editing:

 $\bullet$ \^{ }B moves back a single character.

 $\bullet$ \^{ }F moves forward a single character.

 $\bullet$ \^{ }A moves to the beginning of the line.

 $\bullet$ \^{ }E moves to the end of the line.

 $\bullet$ \^{ }H and DEL delete the previous character.

 $\bullet$ \^{ }D deletes the current character.

 $\bullet$ \^{ }K deletes from current position to the end of line.

 $\bullet$ \^{ }L,\^{ }R redraws line in case it gets trashed.

 $\bullet$ \^{ }U deletes the entire line.

 $\bullet$ \^{ }W deletes the last word.

 History:

 $\bullet$ \^{ }P moves back through history.

 $\bullet$ \^{ }N moves forward through history.

 $\bullet$ !!   previous command.

 $\bullet$ !\$  previous command last argument.

 $\bullet$ !{\it string}  last command starting with {\it string}.

 Completion:

 $\bullet$ tab complete command if first arg, filename otherwise.

 $\bullet$ esc-? or double tab list possible completions.

 Each line of input must be smaller than 1024 bytes which is more than
 sufficient for most applications. Lines can be continued on several
 lines provided carriage returns follow a `\verb+\+' (as in standard
 shells).

\Seealso
\bq append history, \$, history\eq

\section{load}

 The {\tt load} command executes each line of the specified input file
 as if it had been typed in interactively. Files created by the {\tt
 save history} command can be {\tt load}ed directly. Text files
 containing valid commands can be created and then executed by the {\tt
 load} command. Files being {\tt load}ed may themselves contain {\tt
 load} commands. See {\tt comment} for information about comments in
 command scripts. The {\tt load} command is recursive so it can be
 nested. The only limitation is the I/O stack which has a default
 capacity of 32. This value can be easily changed at compilation time
 of the program.

 The current working directory always returns to the value in effect
 before the loaded script was called. This is valid for nested {\tt
 load} commands too.

 In order to avoid confusion between data files and script files we
 strongly recommand you to stick to the conventional {\it .ft} extension
 for your script files.

\Syntax
\bq load {\it filename.ft}\eq

 A {\tt load} command is also performed implicitly on any filenames
 given as arguments to {\tt fudgit}, when called from your \unix\
 session. These are loaded and executed in the order specified, and
 then \fudgit\ exits.

\Seealso
\bq set comment, exec, startup, append history, append macros \eq

\section{lock}

 Variables can be turned into constants using the {\tt lock} command.
 Once a variable is {\tt lock}ed, any assignment trying to change its
 value will result in a parsing error. This is valid for both scalar
 and string variables. It is not an error to try to lock a constant. A
 warning message will be given though. However, trying to lock an
 unexisting variable or something else than a constant or variable will
 result in an error.

\Syntax
\bq lock {\it var-list}\eq

\Seealso
\bq C, cmode, unlock \eq

\section{ls}

 The command {\tt ls} calls ``/bin/ls -FC''. If any arguments are
 given, those are passed to ``/bin/ls -FC''. Wild card characters are
 possible since expansion is done by a Bourne shell.

\Syntax
\bq ls {\it ls-argument-list}\eq

\Examples
\nopagebreak\begin{verbatim}
      ls p* test?
      ls -l datafile
      ls -l *.data
\end{verbatim}

\Seealso
\bq system, alias \eq

\section{macro}

 The {\tt macro} command allows the user to define macros. Macros can
 be embedded, but another macro cannot be defined from within a macro,
 mainly because of their common way to refer to arguments. The name of
 the macro followed by the number of arguments required must be given.
 The maximum number of arguments a macro can have is 16. An exclamation
 mark in the macro name will indicate that the macro name can be
 abbreviated and that the characters following the exclamation point
 are optional. Macros are only recognized in the fitting mode. The
 total length of each macro is limited to 2048 bytes in size. Macros
 can be nested to a maximum of 32. Macros are only recognized from the
 fitting mode.

\Syntax
\bq macro {\it macroname} {\it argument-number}\\
    {\it body of the macro}\\
stop\eq

\Example
\nopagebreak\begin{verbatim}
     # define a macro named fpl!ot (o, t, are optional)
     # requiring 3 arguments . Uses the plotting program gnuplot.
     # Syntax: fplot X Y YFIT
     # plot X Y with data points and X YFIT with solid line
     macro fpl!ot 3
         # save vectors in temp file (will be automatically removed on exit)
         save vec $1 $2 $3 $Tmp.fplot
         # plot second column with points and third with line
         pmode plot '$Tmp.fplot' us 1:2 wi point, \
            '$Tmp.fplot' us 1:3 wi line
     stop
\end{verbatim}

\Seealso
\bq append macros, show macros, load, startup, unmacro, alias, unalias \eq

\section{math functions}

 The C-calculator mode math functions found in \fudgit\ are very close
 to the corresponding functions found in the \unix\ math library. Some
 other functions, not found in the math library, are also part of
 \fudgit. Most of the numerically unstable functions (i.e. ln, log,
 exp,\ldots) check for both an argument out of range and a value out of
 domain at each call. All math functions are double precision and can
 only be called from the C-calculator mode, or by using the {\tt let}
 command from the fitting mode. These functions are also available in
 the conditional statements of the fitting mode {\tt if} and {\tt
 while}, since these statements are C-calculator mode statements,
 although part of fitting mode constructions.

\subsection{math function abs}

 The {\tt abs()} function returns the absolute value of its argument. 

\subsection{math function acos}

 The {\tt acos()} function returns the arc cosine (inverse cosine) of
 its argument. {\tt acos()} returns its argument in radians.

\subsection{math function acosh}

 The {\tt acosh()} function returns the positive (principal) hyperbolic
 arc cosine (inverse cosine) of its argument.

\subsection{math function asin}

 The {\tt asin()} function returns the arc sine (inverse sine) of its
 argument. {\tt asin()} returns its argument in radians.

\subsection{math function asinh}

 The {\tt asinh()} function returns the hyperbolic arc sine (inverse
 sine) of its argument.

\subsection{math function atan}

 The {\tt atan()} function returns the arc tangent (inverse tangent) of
 its argument. {\tt atan()} returns its argument in radians.

\subsection{math function atan2}

 The {\tt atan2(y, x)} function returns the arc tangent (inverse
 tangent) of the ratio of its arguments $(y/x)$. {\tt atan2()} returns
 its argument in radians. The signs of $y$ and $x$ are used to
 determine the quadrant.

\subsection{math function atanh}

 The {\tt atanh()} function returns the hyperbolic arc tangent (inverse
 tangent) of its argument.

\subsection{math function besj0}

 The {\tt besj0()} function returns the j0th Bessel function of its
 argument, i.e it returns the zero$^{th}$ order Bessel function of the
 first kind. {\tt besj0()} expects its argument to be in radians.

\subsection{math function besj1}

 The {\tt besj1()} function returns the j1st Bessel function of its
 argument, i.e it returns the first order Bessel function of the first
 kind. {\tt besj1()} expects its argument to be in radians.

\subsection{math function besjn}

 The {\tt besjn(n, x)} function returns the jnst Bessel function of its
 argument, i.e it returns the $n^{th}$ order Bessel function of the
 first kind. {\tt besjn()} expects its second argument to be in
 radians.

\subsection{math function besy0}

 The {\tt besy0()} function returns the y0th Bessel function of its
 argument, i.e it returns the zero$^{th}$ order Bessel function of the
 second kind. {\tt besy0()} expects its argument to be in radians.

\subsection{math function besy1}

 The {\tt besy1()} function returns the y1st Bessel function of its
 argument, i.e it returns the first order Bessel function of the second
 kind. {\tt besy1()} expects its argument to be in radians.

\subsection{math function besyn}

 The {\tt besyn(n, x)} function returns the ynst Bessel function of its
 argument, i.e it returns the $n^{th}$ order Bessel function of the
 second kind. {\tt besyn()} expects its second argument to be in
 radians.

\subsection{math function cbrt}

 The {\tt cbrt()} function returns the cubic root of its argument.

\subsection{math function ceil}

 The {\tt ceil()} function returns the smallest integer that is not
 less than its argument.

\subsection{math function cos}

 The {\tt cos()} function returns the cosine of its argument. {\tt
 cos()} expects its argument to be in radians.

\subsection{math function cosh}

 The {\tt cosh()} function returns the hyperbolic cosine of its
 argument.

\subsection{math function cot}

 The {\tt cot()} function returns the cotangent of its argument. {\tt
 cot()} expects its argument to be in radians.

\subsection{math function coth}

 The {\tt coth()} function returns the hyperbolic cotangent of its
 argument.

\subsection{math function csc}

 The {\tt csc()} function returns the cosecant of its argument. {\tt
 csc()} expects its argument to be in radians.

\subsection{math function csch}

 The {\tt csch()} function returns the hyperbolic cosecant of its
 argument.

\subsection{math function erf}

 The {\tt erf()} function returns the error function of its argument.
 The error function is defined as
    \[ \frac{2}{\sqrt\pi} \int_0^x e^{-t^2}  dt \]

\subsection{math function erfc}

 The {\tt erfc()} function returns {\tt 1 - erf()} where {\tt erf()} is
 the error function of its argument. It is provided because of the
 extreme loss of relative accuracy if {\tt erf(x)} is called for large
 $x$ and the result subtracted from 1.0 (e.g., for $x = 10$, 12 places
 are lost).

\subsection{math function exp}

 The {\tt exp()} function returns the exponential function of its
 argument ($e$ raised to the power of its argument). Overflow is
 checked on all {\tt exp()} operations.

\subsection{math function floor}

 The {\tt floor()} function returns the largest integer not greater
 than its argument.

\subsection{math function hypot}

 The {\tt hypot(x, y)} function returns sqrt(x*x+y*y) computed in such
 a way that underflow will not happen, and overflow occurs only if the
 final result deserves it.

\subsection{math function int}

 The {\tt int()} function returns the integer part of its argument,
 truncated toward zero. The returned value is still a double. This
 function is equivalent to trunc() is is kept for compatibility.

\subsection{math function interp}

 The {\tt interp()} function returns an interpolated value of the
 function at the value of its argument. The functional relation is
 previously initialized using the fitting mode command {\tt spline}.
 The interpolation is obtained from cubic splines. {\it Natural} (i.e.,
 the second derivative of the interpolating function at either or both
 the first and last point of the original data equal zero) cubic spline
 or specific first derivatives at the extreme points of the original
 data set are specified while initializing the process using {\tt spline}
 command.

\Seealso
\bq spline\eq

\subsection{math function lgamma}

 The {\tt lgamma()} function returns the natural logarithm of the gamma
 function of its argument. For an integer {\tt n, lgamma(n+1) =
 ln(fac(n))} where fac is a factorial function.

\subsection{math function ln}

 The {\tt ln()} function returns the natural logarithm (base $e$ ) of
 its argument. Illegal argument is checked for.

\subsection{math function log}

 The {\tt log()} function returns the logarithm (base 10) of its
 argument.

\subsection{math function max}

 The built-in function {\tt max(x, y)} returns the maximum value of
 x and y. {\tt max(x, max(y, z))} obviously returns the largest value
 of x, y, and z.

\subsection{math function min}

 The built-in function {\tt min(x, y)} returns the minimum value of
 x and y. {\tt min(x, min(y, z))} obviously returns the smallest value
 of x, y, and z.

\subsection{math function rand}

 The {\tt rand()} function returns a random number between [0,1).
 Depending on the machine on which it is compiled, it might use the
 extended 48 bits random number generator or less.

\subsection{math function rint}

 The {\tt rint()} function returns the value of its argument rounded to
 the nearest integer.

\subsection{math function scan}

 This math function is a bit different from others in the fact that it
 handles strings and returns a number. In fact, the {\tt scan({\it
 String, Format})} function returns a double precision number as
 extracted from string {\it String} and according to string format {\it
 Format}. The format is built with the same rules {\tt sscanf} uses.
 See man pages on {\tt scanf(3)}. Note that the format must contain
 one active "\%lf". An example might be of some help here, especially
 to show how to use {\tt scan} in conjunction with C-calculator mode
 defined strings. {\tt scan} is particularly helpful to extract numbers
 from filenames. Recall that strings are defined by double quotes as
 in standard C.

 At this point, it might be useful for you to know the "\%[ ]" scanf
 construction. Let's go through some examples: {\tt "\%*[a-zA-Z]"}
 means to ignore the longest string matched so that it is composed of
 any letter; {\tt "\%*[\^{ }0-9]"} means to ignore the longest string
 matched so that it is NOT composed of any digit; {\tt "\%*[\^{ }\_.]"}
 means to ignore the longest string matched so that it is not composed
 of characters `\_' or `.'.

\Examples
\nopagebreak\begin{verbatim}
     # define a string called Testname
     let Testname = "dummy25.dat"
     # let y be the Neperian log of the number contained in that string
     let y = ln(scan(Testname, "%*[^0-9]%lf.dat"))
     # The following reads a number from stdin
     let input = scan(Read(), "%lf")
\end{verbatim}

\Seealso
\bq \$, strings, C, cmode, quotes \eq

\subsection{math function sec}

 The {\tt sec()} function returns the secant of its argument. {\tt
 sec()} expects its argument to be in radians.

\subsection{math function sech}

 The {\tt sech()} function returns the hyperbolic secant of its
 argument.

\subsection{math function sin}

 The {\tt sin()} function returns the sine of its argument. {\tt
 sin()} expects its argument to be in radians.

\subsection{math function sinh}

 The {\tt sinh()} function returns the hyperbolic sine of its
 argument. {\tt sinh()} expects its argument to be in radians.

\subsection{math function sqrt}

 The {\tt sqrt()} function returns the square root of its argument.

\subsection{math function srand}

 The {\tt srand()} function sets the seed of the random number
 generator. Its argument will always be truncated to an integer
 towards zero. {\tt srand()} returns the truncated value.

\subsection{math function sum}

 The {\tt sum} function returns the sum of the elements of the vector
 passed as an argument. Recall that vector are passed by pointers so
 that {\tt y = sum(X$^2$)} is not legal. Instead, on must explicitly
 calculate
\nopagebreak\begin{verbatim}
 # Given vector X, the following calculates the sum of X^2
 let X2 = X^2
 let y = sum(X2)
\end{verbatim}
 in order to evaluate the sum. The {\tt sum} function can be used to
 calculate basic statistics (mean, standard deviation, correlation, ...)
 and to do basic integration together with a spline-interp algorithm
 if the points are distant and the function smooth enough.

\Seealso
\bq interp, spline \eq

\subsection{math function tan}

 The {\tt tan()} function returns the tangent of its argument. {\tt
 tan()} expects its argument to be in radians.

\subsection{math function tanh}

 The {\tt tanh()} function returns the hyperbolic tangent of its
 argument. {\tt tanh()} expects its argument to be in radians.

\subsection{math function trunc}

 The {\tt trunc()} function returns the value of the argument when
 truncated towards zero.

\section{pause}

The {\tt pause} command displays any text associated with the command
and then waits a specified amount of time or until a carriage return is
pressed if the given time value is a negative integer. The {\tt pause}
command is especially useful in conjunction with {\tt load}ed files.

\Syntax
\bq pause {\it value} {\it string\optio}\eq

\Examples
\nopagebreak\begin{verbatim}
     pause -1
     pause 3
     pause -1  Hit return to continue
     pause 10  This fits equation 4 to file $ReadFile.
\end{verbatim}

\Seealso
\bq echo, load \eq

\section{plot}

 There exists no plot command as such. However two macros are
 predefined. One is {\tt gnu!plot} to use with \gnuplot\ and {\tt
 sgi!plot} to use with \sgiplot. As they currently are, only two
 vectors can be passed to these macros. They serve like examples for
 building your own macros as well. See {\tt show macros} to see the
 contents of the predefined macros of your site.

\Seealso
\bq set plotting, special, macro, show macros \eq

\section{pmode}

 The {\tt pmode} command talks directly to the plotting program chosen
 with the {\tt set plotting} command. Any command usually typed to the
 plotting routine is now valid. Furthermore, all the current variables,
 constants and their string counterparts can be expanded in the
 plotting mode. The fitting macros and aliases are not recognized in
 this mode. The command {\tt fmode} permits the user to return from the
 plotting mode as does \^{ }D when typed interactively. If {\tt pmode}
 is called with trailing arguments, the remainder of the line will be
 passed to the plotting program while remaining in fitting mode. It is
 not an error to call {\tt pmode} from the plotting mode. An warning
 message will be given though.

 If the plotting program is defined as a null string ({\tt set plotting ""})
 then all command lines given in {\tt pmode} will be ignored and
 warning messages will be given accordingly.

\Syntax
\bq pmode {\it command\optio}\eq

\Examples
\nopagebreak\begin{verbatim}
     pmode
     pmode set nokey
     pmode plot "fudgfile" with lines
\end{verbatim}

\Seealso
\bq set plotting, set prompt-pm, special \eq

\section{print}

 The {\tt print} command is a C-calculator mode command that writes the
 value of a valid mathematical expression to a file selected by {\tt
 set output}. The default is {\it stdout}. If there is more than one
 variable, a coma separated list must be given in which case each
 expression value will printed on the same line and separated by a tab.
 As with other number output commands, the output format is the one
 selected by the {\tt set format} command. The default is "% 10.8e".
 The {\tt print} command differs from {\tt show variables} as follows:

 $\bullet$ {\tt print} accepts any expression for indexing vector elements;

 $\bullet$ {\tt print} requires a comma separated list;

 $\bullet$ {\tt print} can be part of a function or procedure;

 $\bullet$ {\tt print} can print strings provided they are in double
          quotes. This includes characters '\verb+\n+', '\verb+\t+', '\verb+\a+', \ldots;

 $\bullet$ {\tt print} does not append a newline.

 $\bullet$ {\tt print} can print any mathemetical expression.

 $\bullet$ {\tt print} is a C-calculator mode command.

 A simpler way to print variables to {\it stdout} from the C-calculator
 mode is to use the feature that any variable or coma separated list of
 variables given on the command line will be displayed, separated by tabs
 and appended with a newline character. Thus the construction @ifhelp

\nopagebreak\begin{verbatim}
     set output stdout
     cmode
         print x, y, "\n"
\end{verbatim}
 is equivalent to
\nopagebreak\begin{verbatim}
     cmode
         x, y
\end{verbatim}
 typed in C-calculator mode (it becomes {\tt let x,y} in fitting mode).
 The only difference between {\tt print} and the automatic printing
 feature of C-calculator mode is that (1) {\tt set output} only affects
 {\tt print} command, and that (2) {\tt print} does not automatically
 append a new line character.

\Syntax
\bq print {\it coma-separated-var-list} \eq

\Examples
\nopagebreak\begin{verbatim}
     cmode
         print x+2
         print String, x, y, z
         print "Warning \a\a\a", "x = ", x, "\n"
\end{verbatim}

\Seealso
\bq cmode, func, C, show table, show variable, math functions, quotes,\\
      set format, set output\eq

\section{proc}

 The {\tt proc} command is a C-calculator command used to define
 procedures. Procedures differs from functions in the fact that they do
 not return any value. The procedure arguments are passed and referred
 to the same way they are in functions. Keyword {\tt proc} is a
 C-calculator mode command. The {\tt show table} command can be used
 to list all the installed objects at a given time.

\Syntax
\bq proc {\it procedurename}({\it proto-list\optio}) {\it cmode-line-statement} \eq
 or
\bq proc {\it procedurename}({\it proto-list\optio}) \{\\
     {\it cmode-statements}\\
\}\eq

\Examples
\nopagebreak\begin{verbatim}
     # The following example will print the Fibonacci numbers lower than 1000
     cmode
         proc fib(x) { 
             a = 0 
             b = 1 
             while (b < x) { 
                 print b
                 c = b 
                 b += a 
                 a = c 
             } 
             print "\n"
         } 
         # The following 'for' loop is equivalent to the preceding fib()
         proc fib2(x) {
             auto a,b,c        # This proc creates no global variable

             for(a=0,b=1;b<x;c=b,b+=a,a=c) {
                 print b
             }
             print "\n"
         }
         fib(1000)  # A procedure as called from C-calculator mode.
    fmode
    let fib2(1000)  # A procedure as called from fitting mode.
    # A short example involving a vector
    set data 10
    let proc init(X, x) X=x
    let b=3
    let init(Y, 2/4 + b) # Shows that scalar can also be expressions.
\end{verbatim}

\Seealso
\bq return, cmode, C, func, auto, math, show table, install \eq

\section{pwd}

 The {\tt pwd} command prints the name of the working directory on
 the screen.

\Syntax
\bq pwd\eq

\Seealso
\bq cd, ls \eq

\section{quit}

 The commands {\tt exit} and {\tt quit} are equivalent and both will
 exit \fudgit. On exit, all temporary files {\it /tmp/fudgitPID*} (note
 the wild card) will be erased. Here PID is the current process number.
 Moreover, if a plotting process is active, it will be sent a KILL
 signal. It is therefore a good habit to use the {\tt \$Tmp} string
 variable to build your temporary files.

\Syntax
\bq quit\eq

\Seealso
\bq cmode, exit \eq

\section{quotes}

 In the fitting mode, single and double quotes serve to indicate that
 all the characters between quotes should be taken as only one word,
 even if there are some blanks (tab or space) among them. The
 difference between single and double quotes is that within the former
 variable expansion (using `\$') does not take place whereas it does in
 the latter. Quotes are not recognized between parentheses.

 In C-calculator mode, double quotes serve to indicate a string and
 parsing is done accordingly. As in C, double quotes can be included in
 a string using the `\verb+\+' operator. Note that C special characters
 as '\verb+\n+' for a newline, '\verb+\a+' for a bell, '\verb+\t+' for
 a tab, and so on, are recognized in a string. Single quotes have no
 special meanings. The only way to pass a `\$' without expanding the
 following name is to escape the `\$' with a `\verb+\+'.

 Thus, a null string is given by {\tt ''} or {\tt ""} in the fitting
 mode and by {\tt ""} only in C-calculator mode.

 In pmode, both single and double quotes are freely passed to the
 plotting program. This is valid when trailing commands are are passed
 to {\tt pmode}, although \fudgit\ implicitly stays in the fitting
 mode. Once again, expansion of a `\$' followed by a string can be
 avoided using the escape character, i.e., by typing `\verb+\+\$'.

\Seealso
\bq exec, set plotting, math function scan, print \eq

\section{read}

 The {\tt read} command is used to read data points from a file or from
 standard input. Each column is assigned to a given vector. Vectors not
 already allocated will automatically be. Range of values can be
 specified on any variable using the [{\it low}:{\it high}] syntax. A
 `{\tt *}' replacing a value will be taken as unexistent. Range of
 lines can be specified on any variable using the \{{\it low}:{\it high}\}
 syntax. The last line range given will be the only one in effect. If
 the file name specified is `\dash' data will be read from the current
 standard input until the keyword {\tt end} is found on a line by
 itself. The {\tt read} \dash and the {\tt load} commands are recursive
 functions so they can be nested insofar as you can understand what is
 going on. An assignment consists in a vector name and a column number
 separated by a colon. After a file has been successfully read, {\tt
 read} will put the name of the data file in string constant {\tt
 ReadFile}.

\Syntax
\bq read {\it filename} {\it assignment$[$range$]$\optio\{linerange\}\optio} \ldots\eq

\Examples
\nopagebreak\begin{verbatim}
     read file1 X:1[0:*] Y:2
     read file2 TIME:2{100:400}
     read - T:1 VALUE:2
     1    2.3
     2    4.7
     .    .
     .    .
     .    .
     end
\end{verbatim}
 The first form will read positive values of the first column in vector
 $X$ and corresponding values of the second in vector $Y$. The second
 will read the second column of file {\it file2} from line 100 to line
 400. The third will read $T$ and {\it VALUE} from stdin. The
 assignment does not need to be in increasing order of column. Also
 note that the first column is 1.

\Seealso
\bq exec, data \eq

\section{reinstall}

 The {\tt reinstall} command is used to perform the dynamical loading
 of a module that was already loaded. Typically, this is done after a
 module has been modified and recompiled. Refer to {\tt install} for
 more detail.

\section{return}

 The C-calculator {\tt return} keyword is used as in standard C to
 return from a function or a procedure. Contrary to C, {\tt return}
 requires parentheses when returning a value from a function. It is an
 error to return a value from a procedure or to not return anything
 from a function. {\tt return} is a C-calculator mode command.

\Syntax
\bq return({\it expression})\\
return \eq
\Seealso
\bq C, cmode, func, proc, auto \eq

\section{save}

 Look under {\tt append} command description.

\section{set}

 The {\tt set} command sets a lot of options, as follows.

\subsection{set comment}

 The {\tt set comment} command selects the character which will cause
 the rest of the line to be ignored. The default value is `{\tt \#}'.
 Note that the effect of a comment character will be void if: (1) found
 somewhere between single quotes in fitting mode or (2) escaped with a
 `\verb+\+'.

\Syntax
\bq set comment {\it character} \eq

\Example
\nopagebreak\begin{verbatim}
     set comment ?
\end{verbatim}

\Seealso
\bq show comment, comments \eq

\subsection{set data}

 The {\tt set data} command changes the effective size of vectors. All
 the vector arithmetic checks for index boundaries. The {\tt data}
 constant is the higher bound of the check and necessarily the size of
 all vectors. Changing the {\tt data} value does not change the values
 nor the capacity of vectors. It only changes the upper bound on the
 value the index can take. The {\tt data} constant is also changed by
 the commands {\tt read} and {\tt exec}, which set it to the number of
 valid data points read. Because the upper bound can never be higher
 than the effective capacity of vectors, a {\tt data} value higher than
 the current {\tt samples} value will be refused. See {\tt set
 samples}. Typically, {\tt set data} is used when one wants the
 C-calculator to generate (and plot) vectors. The {\tt read} and {\tt
 exec} commands take care of adjusting it. {\tt data} constant can also
 be changed from the C-calculator mode if the constant is {\tt
 unlock}ed. However, no check is made to ensure the given value is not
 higher than {\tt sample} size, in which case a segmentation fault will
 crash the whole program. It is always safer to use {\tt set data}.

\Syntax
\bq set data {\it number}\eq

\Example
\nopagebreak\begin{verbatim}
     set data 300
\end{verbatim}

\Seealso
\bq lock, unlock, read, exec, cmode\eq 

\subsection{set debug}

 The {\tt set debug} command puts the reading of {\tt load}ed files in
 verbose mode, so that debugging is more easily done. All the commands,
 expanded macros and/or string variables are echoed as they are
 executed. There are some different debug levels at the present time:

 $\bullet$ 0 clear all the debugging states.

 $\bullet$ 1 echo the expanded lines as they are read. The command is
          parsed and comments are stripped out. This is most useful
          for debugging script files. History substitutions are shown.

 $\bullet$ 2 display all command lines as they are read from the script.

 $\bullet$ 3 display the line numbers of the ignored lines as they are
          read from datafiles.

 $\bullet$ 4 echo command lines as they are passed to the math parser.

 $\bullet$ 5 turn the math parser debugger on. To use this, the program
          must have been compiled with the YYDEBUG preprocessor
          variable on.

 $\bullet$ 6 trace the flow of fitting mode {\tt if} constructions.

 Debugging values are not exclusive so that more than one level
 can be turned on. Levels are subject to change.

\Syntax
\bq set debug {\it value-list} \eq

\Example
\bq set debug 0 1 3\eq

\Seealso
\bq load \eq

\subsection{set error}

 \fudgit\ allows the user to select among different possible error
 checks to be made on each single mathematical operations. The
 {\tt set error} command will set computational error checks as follows:

 $\bullet$ 0: clear all computational error check bits.

 $\bullet$ 1: check for `infinity' values.

 $\bullet$ 2: check for `not a number' values.

 $\bullet$ 3: check for `out of domain' math function errors.

 $\bullet$ 4: check for `out of range' math function errors.

 Error checks are not exclusive and more than one can be specified on
 the command line. The default status has all error check levels
 activated (1 2 3 4).

 It is sometimes desirable to disable one of the checks. For example,
 the operation $y = 1/sinh(x)$ will give a `out of range' error for
 large $x$ ( $> 709$ on most machines), although $y$ is in fact 0.
 If one uses {\tt set error 0 1 2 3}, then no error will be reported
 and $y$ will be set to zero accordingly.

\Syntax
\bq set debug {\it value-list} \eq

\Example
\bq set error 0 2 3\eq

\Seealso
\bq C, cmode \eq

\subsection{set expand}

 In interactive mode, history expansion and substitution will occur
 only if the {\tt expand} variable is set. It is disabled using {\tt
 set noexpand}. The default is on.

\Syntax
\bq set expand \eq

\Seealso
\bq set noexpand, history, line editing \eq

\subsection{set format}

 The command {\tt set format} will set the printf format for variables.
 Use only if you are sure of what you are doing. It defaults to
 ``\% 10.8e". See {\tt man printf(3)} if in doubt.

\Syntax
\bq set format {\it string}\eq

\Examples
\nopagebreak\begin{verbatim}
      set format %6.2lf
      set format "% .8g"
\end{verbatim}

\Seealso
\bq show, append \eq

\subsection{set function}

 The {\tt set function} command is perhaps the most crucial command in
 data fitting. It is used to select a built-in fitting function or to
 enter a user-defined function. The following fitting functions are
 available:
\nopagebreak\begin{verbatim}
     NAME          DESCRIPTION             PARAMETERS REQUIRED
     ----          -----------             -------------------
     straight      Straight line           (2 parameters)
     sine          Sine series             (N parameters)
     cosine        Cosine series           (N parameters)
     legendre      Legendre series         (N parameters)
     polynomial    Power series            (N parameters)
     gauss         Gaussian series         (3N parameters)
     expo          Exponential series      (2N parameters)
     user          User-defined function   (N parameters)
\end{verbatim}

 Assume a variable vector $X$ and a parameter vector $A$ then,
 the nonlinear gauss fitting function is a series of gaussians where
\[ f(X,A) = \sum_{i=1,4,7, \ldots, N} A[i] \times e^{- \left(
\frac{(X - A[i+1])}{A[i+2]}\right)^ 2}. \]

 The nonlinear expo function is a series of exponentials where
 \[ f(X,A) = \sum_{1=1,3,\ldots, N} A[i] \times e^{X*A[i+1]} .\]

 For a user-defined function, the {\tt set function user} will prompt
 for more input. The following input is related to the variable to
 fit. For purposes of clarity, let's say that we have to fit vectors
 {\tt X Y DY}. This requires a fit function {\tt YFIT} (the name is
 made from the dependent variable appended with {\tt FIT}) and all the
 partial derivatives {\tt DYFITD1, DYFITD2, \ldots, DYFITDN} taken with
 respect to the parameters $n=1,\ldots N$. All these functions are
 defined one per line as in the case of a macro until a {\tt stop} is
 entered. Temporary variables are permitted. {\tt set function user}
 actually defines a C-calculator mode macro that will be executed
 before each iteration of the fit. Therefore the complete C-calculator
 mode grammar is fully supported here. Temporary vectors can thus be
 used to speed up the calculation.

 The C-calculator macro can be a simple call to a predefined procedure.
 When defined so, the parsing does not have to be done at each iteration,
 and a slightly faster process should result.

\Example
\nopagebreak\begin{verbatim}
    # read column 1, 2 and 3 of file "file"
    read file T:1 R:2 DR:3
    # make a three parameter fit
    set parameter K 3
    # this is a linear fit; use singular value decomposition
    set method svd_fit
    # enter my function
    set function user
        RFIT = K[1] + K[2]*T^0.5 + K[3]*T^1.5
        DRFITD1 = 1
        DRFITD2 = T^0.5
        DRFITD3 = T^1.5
    stop
    fit T R DR
\end{verbatim}

 The vector {\tt RFIT} will contain the fitted function. The difference
 between the fit and real data can be obtained right away by defining a
 vector
\nopagebreak\begin{verbatim}
   let RDIFF = R - RFIT
\end{verbatim}
that can be plotted with respect to {\tt T}.

 The same thing is done for nonlinear fit with the exception that the
 partial derivatives of the function with respect to the parameters
 will contain reference to some parameter(s). (This is precisely the
 meaning of nonlinear here).

 There is virtually no restriction on the number of parameters (memory
 is the sole limitation: {\tt set parameter} command allocates a
 matrix of {\tt parameters} X {\tt samples} ). The only conditions are
 that a linear regression must have 2 parameters defined (this is
 obvious) and the built-in nonlinear functions must be modulo 3 for the
 series of gaussians and modulo 2 for the series of exponentials.

\Seealso
\bq fit, set method, adjust, proc, auto \eq

\subsection{set input}

 The {\tt set input} command selects the file for the input of the
 C-calculator mode {\tt Read} and {\tt vread} command. The string {\it
 stdin} is valid as a filename. If the selected file does not exist or
 cannot be read, an error message will be given and the value will go
 back to the default value, which is {\it stdin}.

\Syntax
\bq set input {\it filename} \eq

\Seealso
\bq Read, vread \eq

\subsection{set iteration}

 The {\tt set iteration} command permits the user to change the
 iteration number for the Marquardt-Levenberg nonlinear fitting method.
 See {\tt set function}. The default value is 10. However, the fitting
 process will stop if there is no difference in $\chi^2$ for two
 consecutive iterations. However, a negative value will force to
 iterate up to the absolute value of that number, without checking for
 convergence.

\Syntax
\bq set iteration {\it value}\eq

\Example
\bq set iteration 3\eq

\Seealso
\bq fit, set method, set function \eq

\subsection{set method}

 The {\tt set method} command allows the user to select the fitting
 method to be used when calling the {\tt fit} command. The following
 methods are available:
\nopagebreak\begin{verbatim}
     NAME         DESCRIPTION
     ----         -----------
     ls_reg       least square linear regression (2 parameters)
     lad_reg      least absolute deviation linear regression (2 parameters)
     ls_fit       general least square linear fit using QR decomposition
     svd_fit      general least square linear fit using singular value
                   decomposition
     ml_fit       general least square nonlinear fit using
                   Marquardt-Levenberg method
\end{verbatim}

 Among them, only {\tt ml\_fit} and {ls\_fit} depends on {\tt iteration}
 and {\tt adjust}.

 For all methods except {\tt lad\_reg}, the value of $\chi^2$ will be put
 in the scalar constant {\tt chi2}. In the case of {\tt lad\_reg}, %\chi^2$
 will contain the average absolute deviation.

\Syntax
\bq set method {\it method}\eq

\Example
\bq set method svd\eq

\Seealso
\bq fit, set iteration, set function \eq

\subsection{set noexpand}

 The {\tt set noexpand} command disallows history expansion on the
 interactive command line.

\Syntax
\bq set noexpand \eq

\Seealso
\bq set expand \eq

\subsection{set output}

 The {\tt set output} command selects the file for the output of the
 C-calculator mode {\tt print} command. The strings {\it stdout} and
 {\it stderr} are both valid as a filename. If the selected file
 already exists, it will be overwritten with no warning. The default
 value is {\it stdout}.

\Syntax
\bq set output {\it filename} \eq

\Seealso
\bq print \eq

\subsection{set pager}

 The {\tt set pager} command allows the user to select a pager. A pager
 is the program that is called when the structure to be displayed has
 more than 24 elements. The default pager is (1) the environment
 variable PAGER if it exists or (2) {\it /usr/?/more} (path depends on
 system) if not. If {\tt pager} is defined to a null string ({\tt ""}),
 then no pager will be used.

\Syntax
\bq set pager {\it string}\eq

\Example
\bq set pager "more -c"\eq

\Seealso
\bq show, show pager \eq

\subsection{set parameters}

 The command {\tt set parameters} will fix the parameter name and
 size. Since the set of parameters is a kind of vector, parameter name
 cannot contain lower case letters. Parameters are initialized to
 zero. A built-in scalar constant called {\tt param} contains the
 number of parameters at all time.

\Syntax
\bq set parameters {\it parameter-name} {\it size}\eq

\Example
\nopagebreak\begin{verbatim}
     # set the vector D of size 3 to be determined by the fit.
     set parameters D 3
\end{verbatim}

\Seealso
\bq show parameters, show setup\eq

\subsection{set plotting}

 The {\tt set plotting} command changes the default plotting program
 used by the plotting mode. The default is \gnuplot\ but this can be
 changed to any plotting program that can be driven from stdin. A
 maximum of 16 arguments can be passed when the program is first
 called. Changing the plotting program will send a KILL signal to the
 existing plotting program (if any). If the plotting program is set to
 a null string ({\tt ""}), \fudgit\ will ignore all the plotting
 commands and warning messages will be given. Setting the plotting
 program to a file that cannot be found or executed will result in an
 error at the first {\tt pmode} call.

\Syntax
\bq set plotting {\it command}\eq

\Examples
\nopagebreak\begin{verbatim}
     set plotting "/usr/local/bin/sgiplot -p"
     set plotting /usr/local/bin/gnuplot
\end{verbatim}

\Seealso
\bq show plotting \eq

\subsection{set prompts}

 All three \fudgit\ prompts can be changed by the {\tt set} command.
 The name of the prompts are:

 $\bullet$ {\tt prompt-cm} for the C-calculator mode prompt
          (default: "cmode$>$ ";

 $\bullet$ {\tt prompt-fm} for the fitting mode prompt
          (default: "fudgit$>$ ";

 $\bullet$ {\tt prompt-pm} for the plotting mode prompt
          (default: "pmode$>$ ".

 A null string {\tt ""} (i.e., two consecutive quotes) can be given to
 any of these.

\Syntax
\bq set prompt-cm {\it string}\\
set prompt-fm {\it string}\\
set prompt-pm {\it string}\eq

\Seealso
\bq show prompts \eq

\subsection{set samples}

 The command {\tt set samples} changes the current capacity of the
 fitting program. Typically, {\tt samples} is set at the beginning of a
 session since all the existing vectors and variables are erased on
 this call. The default setting is 4000 points.

\Syntax
\bq set samples {\it value}\eq

\Example
\bq set samples 6000\eq

\Seealso
\bq set data, cmode, let, lock \eq

\subsection{set vformat}

 The command {\tt set vformat} will set the sprintf format used for the
 expansion of scalar variables by the expansion operator `\$'. Use
 only if you are sure of what you are doing. It defaults to ``\%.3lg''.
 See {\tt man printf(3)} if in doubt.

\Syntax
\bq set vformat {\it string}\eq

\Examples
\nopagebreak\begin{verbatim}
     set vformat %6.2lf
     set vformat "%.4lg"
\end{verbatim}

\Seealso
\bq \$, cmode, C \eq

\section{shell}

 The {\tt shell} command starts a shell according to your SHELL
 environment variable. It is equivalent to {\tt system} command. Refer
 to the latter for details.

\section{show}

 The {\tt show} command is used to see the chosen options or to look at
 any defined vectors, parameters or variables.

\Seealso
\bq set, echo \eq

\subsection{show comment}

 The {\tt show comment} command echoes the current comment escape
 character.

\Syntax
\bq show comment \eq

\Seealso
\bq set comment, comments \eq

\subsection{show data}

 The {\tt show data} command displays the current value of {\tt data}
 constant. Left for compatibility.

\Syntax
\bq show data \eq

\Seealso
\bq set data, lock, unlock, set samples \eq

\subsection{show debug}

 The {\tt show debug} command displays the current value of the {\tt
 debug} variable. The value is displayed in octal since the
 {\tt set debug} $n$ command turns on the $n^{th}$ bit of this number.

\Syntax
\bq show debug \eq

\Seealso
\bq set debug \eq

\subsection{show error}

 The {\tt show error} command displays the current value of the {\tt
 error} computational check variable. The value is displayed in octal
 since the {\tt set error} $n$ command turns on the $n^{th}$ bit of
 this number.

\Syntax
\bq show error \eq

\Seealso
\bq set error \eq

\subsection{show input}

 The {\tt show input} command shows the filename selected for the
 input of the C-calculator mode {\tt Read} and {\tt vread} command.
 The default value is {\it stdin}

\Syntax
\bq show input \eq

\Seealso
\bq set input, Read, vread \eq

\subsection{show iteration}

 The {\tt show iteration} command displays the current value of
 {\tt iteration} variable.

\Syntax
\bq show iteration \eq

\Seealso
\bq set iteration, set method \eq

\subsection{show fit}

 The {\tt show fit} command displays the different quantities relevant
 to the current fitting method. Typical examples are $\chi^2$, the 
 covariance matrix, the curvature matrix, correlation factor, etc\ldots

\Syntax
\bq show fit\eq

\Seealso
\bq fit, set parameters, set function, set method \eq

\subsection{show format}

 The {\tt show format} command displays the current value of
 {\tt format} variable. The {\tt format} string is used when
 displaying any number on the screen. Refer to printf(3) of
 the \unix\ manual.

\Syntax
\bq show format \eq

\Seealso
\bq set format, show \eq

\subsection{show function}

 The command {\tt show function} displays the current function type. If
 the function type is {\tt user}, then the user-defined function will
 be displayed.

\Syntax
\bq show function\eq

\Seealso
\bq set function, show setup, fit, math \eq

\subsection{show macros}

 If called with an argument, the {\tt show macros} command will display
 the specified macro. Otherwise, all currently defined macros will be
 displayed. The selected {\tt pager} is called if the command is given
 in interactive mode (at the command line prompt).

\Syntax
\bq show macros {\it macroname}\optio\eq

\Seealso
\bq set pager, save macros, alias \eq

\subsection{show memory}

 The {\tt show memory} function will display the current state of
 memory consumption of the program. All sizes are given in bytes. It
 uses a direct call to mallinfo(3). The arena is the size of memory
 requested by the process to the kernel. It is then split in different
 blocks shared among the internal matrices and user's vectors, macros,
 functions, procedures, variables and history.

\Syntax
\bq show memory\eq

\Seealso
\bq free, show table \eq

\subsection{show method}

 The {\tt show method} command displays the current value of the
 fitting {\tt method}. It contains {\it none} by default.

\Syntax
\bq show method \eq

\Seealso
\bq set method, fit, set function \eq

\subsection{show output}

 The {\tt show output} command shows the filename selected
 for the output of the C-calculator mode {\tt print} command. 
 The default value is {\it stdout}

\Syntax
\bq show output \eq

\Seealso
\bq set output, print \eq

\subsection{show pager}

 The {\tt show pager} command displays the current value of the
 {\tt pager} program. 

\Syntax
\bq show pager \eq

\Seealso
\bq set pager, environment, show\eq

\subsection{show parameters}

 The command {\tt show parameters} will display the parameter values on
 the screen. If the number of parameters is larger than 24, then the
 selected {\tt pager} will be called if the command is given in
 interactive mode (at the command line prompt). As with {\tt append}
 and {\tt save parameters}, {\tt show parameter} can accept optional
 variable or constant (either string or scalar) list of names, in which
 case the value of the given variables will be displayed along with the
 parameter values.

\Syntax
\bq show parameters {\it variable-list\optio}\eq

\Seealso
\bq set pager, set parameters, save parameters, show fit \eq

\subsection{show plotting}

 The {\tt show plotting} command displays the current value of the
 {\tt plotting} program. 

\Syntax
\bq show plotting \eq

\Seealso
\bq set plotting, startup, pmode\eq

\subsection{show prompts}

 The {\tt show prompts} command displays the current values of the
 different mode {\tt prompts}. 

\Syntax
\bq show prompt-cm\\
show prompt-fm\\
show prompt-pm\eq

\Seealso
\bq set prompt, startup\eq

\subsection{show samples}

 The {\tt show samples} command displays the current value of the {\tt
 samples} variable. Recall that although {\tt data} is responsible for
 the visible part of all vectors, vectors all have a fixed allocated
 length of {\tt samples} long. Any change to {\tt samples} through {\tt
 set samples} frees all the existing vectors.

\Syntax
\bq show samples \eq

\Seealso
\bq set samples, set data, cmode\eq

\subsection{show setup}

 The command {\tt show setup} will show some values of the program,
 such as the last data filename read, the number of data points, 
 current capacity, current comment character, current iteration number,
 current plotting program, etc. Left for compatibility.

\Syntax
\bq show setup\eq

\Seealso
\bq set comments\eq

\subsection{show table}

 The command {\tt show table} displays the current lookup table of the
 C-calculator mode parser. It shows all current variables, numbers,
 vectors and functions included in the internal table. It also shows
 the state of the internal machine (C interpreter), stack and frame
 used in the C-calculator. This is used mainly for debugging or to
 prevent stack or machine code overflow.

\Syntax
\bq show table\eq

\Seealso
\bq free, show memory, cmode \eq

\subsection{show variables}

 Any constants or variables can be displayed on the screen. 
 The {\tt show variable} command differs from {\tt print} as follows:

 $\bullet$ {\tt show variables} only accepts integers for indexing
          vector elements;

 $\bullet$ {\tt show variables} requires a blank separated list;

 $\bullet$ {\tt show variables} cannot be part of a function or procedure.

 As it has been mentioned previously, this is due to the different
 types of parsing between the C-calculator and fitting modes. As with
 all other number displaying commands, the printing format is
 always the one selected by the {\tt set format} command.

\Syntax
\bq show variables {\it variable-list} \eq

\Example
\bq show variables x X[2] Y[2] DY[2] time\eq

\Seealso
\bq print, save variables, show table, show vectors, cmode \eq

\subsection{show vectors}

 Any vector or number of vectors can be seen on the screen. If the size
 of vectors is larger than 24, the selected {\tt pager} will be called
 if the command is given in interactive mode (at the command line
 prompt).

\Syntax
\bq show vectors {\it VECTOR-list} \eq

\Example
\bq show vectors X Y DY\eq

\Seealso
\bq set pager, append vectors, read, cmode, let \eq

\subsection{show vformat}

 The command {\tt show vformat} will display the printf format used
 for the expansion of scalar variables by the expansion operator `\$'.
 Refer to the printf(3) description in the \unix\ manual for more details.

\Syntax
\bq show vformat\eq

\Seealso
\bq \$, cmode, C, set vformat \eq

\section{smooth}

 The {\tt smooth} command uses a gaussian windowing function (low-pass
 filter) on a Fourier transform loop in order to smooth the given
 vector. The windowing function is $\exp(-(f/(\sigma \times f_{max}))^2)$
 where $f_{max}$ is equal to half of the smallest power of 2 larger
 than the number of data points {\tt data}. Variable $f$ is the
 frequency that ranges from 0 to $f_{max}$. More likely, the smoothing
 factor is a non null positive real number from the (0, 1] interval. A
 smoothing factor $\sigma >= 1$ leaves the vector unchanged.

 The number of data points {\tt data} needs not to be a power of 2.

 To be used with discernment!

\Syntax
\bq smooth {\it $\sigma$} {\it in-VECTOR} {\it out-VECTOR}\eq

\Seealso
\bq fft, invfft, cmode, C \eq

\section{special}

 The following special commands are left for debugging or macro purposes.
 They start with an underscore to avoid mistakes and remind of their
 special character.

 {\tt \_killplot} will kill the current plotting program.

\Syntax
\bq \_killplot \eq

 {\tt \_dumplot} will send the following vectors in the plotting
 program pipe. This is only useful if the current plotting program
 accept data from its stdin. {\tt \_dumplot} can accept up to 16
 arguments.

\Syntax
\bq \_dumplot {\it VECTOR-list}\eq

\Example
\bq \_dumplot X Y DY \eq

\Seealso
\bq macro, show macros, plot \eq

\section{spline}

 The {\tt spline} function initializes the internal table for the
 calculation of interpolated values using cubic spline method.
 Interpolated values are obtained from calls to the C-calculator math
 function {\tt interp()}. The value of the first derivative at the
 first and last data points can be specified by optional arguments. If
 not specified, or if one of the optional arguments is an asterisk {\tt *},
 then a {\it natural} cubic spline is assumed in which case the
 interpolated curve is such that the second derivative at the extreme
 points (or one of them) is null. The asterisk is more likely to be used
 in cases where the user would like to specify the first derivative at
 the last point only. The independent vector must be such that its
 value increases monotonically.

\Syntax
\bq spline {\it indep-VECTOR} {\it dep-VECTOR} {\it y1\optio} {\it yn\optio}\eq

\Example
\nopagebreak\begin{verbatim}
     # Read vectors having a functional relation Y = F(X) from file "datafile"
     read datafile X:1 Y:2
     # Initialize the spline (as being natural)
     spline X Y
     # Save extreme values
     let from = X[1]; to = X[data]
     # Say there were data=10 points and you want 100
     set data 100
     # Rebuild X vector
     # First build X ranging [0, 1]
     let x=0; X=x++; tmp=data-1; X/=tmp
     # Then from 'from' to 'to': from + (to - from)*X
     let tmp=(to-from); X = from + X*tmp
     # Rebuild Y vector possibly containing original values as a subset
     let Y = interp(X)
     # Note that any value can be asked for
     let interp(2.34*pi)
\end{verbatim}

\Seealso
\bq math interp\eq

\section{startup}

 If a file {\it .fudgitrc} exists in your home directory, it will be
 automatically loaded at startup time of the program. This is useful if
 one wants to include his own macros or have his own preferences loaded
 to \fudgit. This file is loaded for both interactive use ({\tt fudgit})
 and batch use ({\tt fudgit {\it script1} {\it script2}\ldots}).

\Examples
\nopagebreak\begin{verbatim}
     set plotting /usr/local/bin/sgiplot
     set prompt-pm ""
     set comment ?
     set samples 10000
\end{verbatim}

 A file called {\it .hist\_fudgit} is will be created in your home
 directory in order to keep history between calls of \fudgit. The
 number of events is determined at compilation time and defaults to 52.

\Seealso
\bq environment, alias, set plotting, set prompt \eq

\section{stop}

 The command {\tt stop} is used to terminate a macro or a fitting
 function defined by the user. However, it can also be used in a script
 file in order to stop execution at a certain point. In this case, an
 warning message will report that {\tt stop} is being used outside a
 macro or function and the file from which the command was found will
 be considered as at the end of file (EOF).

\Seealso
\bq macro, set function \eq

\section{string functions}

 \fudgit\ has a set of functions returning string objects. These are
 made available to deal with filename construction, or to read from
 standard input. To be consistent with string type, string functions
 are named with both lower case and upper case letters.

 Strings can be added or subtracted in the C-calculator mode. String
 addition {\it s1} + {\it s2} simply concatenates strings {\it s2} to
 string {\it s1}. String subtraction {\it s1} - {\it s2} removes {\it
 s2} from the end of {\it s1}. Note that the wild card `?' is supported
 in string subtractions.

\subsection{string function DirName}
 The string function {\tt DirName} returns the directory name as extracted
 from the filename given as an argument.

\Syntax
\bq Dirname({\it String})\eq

\Seealso
\bq string functions FileName, Scan, Read\eq

\subsection{string function FileName}

 The string function {\tt FileName} strips the leading directory names
 of the filename given as an argument. Note that the \unix\ command:
\bq basename {\it File} {\it Extension}\eq
 is equivalent to the \fudgit\ command:
\bq FileName({\it File}) - {\it Extension}\eq
 so that filename constructions can be made in {\tt foreach} loop
 for example.

\Syntax
\bq FileName({\it String})\eq

\Examples
\nopagebreak\begin{verbatim}
     foreach File in ls /usr/machin/data/*.32
         read $File X:1 Y:2{2:23}
         # Some commands
         .
         .
         # let File be the filename only, less the ".32" extension
         let File = FileName(File) - ".32"
         # And let Dir be the directory name
         let Dir = DirName(File)
     end
\end{verbatim}

\Seealso
\bq foreach, string functions, cmode, \$ \eq

\subsection{string function Read}

 The {\tt Read} function read a line from the file chosen by the {\tt
 set input} function, strips the newline character and returns the
 resulting string. If the input is {\tt stdin}, the user will be
 prompted by a {\it ?} and the program will stop until a non-null
 string is entered. This is most likely to be used in macros requiring
 some input during run time. The {\tt Read()} function can be used to
 read numbers with the help of {\tt scan()}. See the example below.

 {\tt Read} can also be used to build vectors by taking one every $n$
 points. This can be done by two imbedded {\tt for} loops.

 Note: The newline character is not passed to the string.

\Examples
\nopagebreak\begin{verbatim}
    # Read a string from stdin (the default)
    set input stdin
    let String = Read()
    # How to get a value out of a string: equivalent to vread()
    let value = scan(Read(), "\%lf") \eq
    # How to skip lines in a file
    # Read say file project/numbers.data
    set input project/numbers.data
    cmode
    for (i=1; i<=top; i++) {
        Line = Read()                            # Read one line
        X[i] = scan(Line, "%lf");                # get first column
        Y[i] = scan(Line, "%*lf %*lf %lf");        # get third column
        for (j=1; j<n; j++) {
            Line = Read()                        # Read n-1 lines
        }
    }
    fmode
    set input stdin
\end{verbatim}

\Seealso
\bq set input, math function scan, string functions, \$ \eq

\subsection{string function Scan}

 {\tt Scan({\it String, Format})} function returns a string as
 extracted from string {\it String} and according to string format {\it
 Format}. The format is built with the same rules {\tt sscanf} uses.
 See man pages on {\tt scanf(3)}. Note that the format must contain one
 active "\%s" or "\%[]" construction. An example might be of some help
 here, especially to show how to use {\tt Scan} in conjunction with
 C-calculator mode defined strings. {\tt Scan} is particularly helpful
 to extract parts of filenames. Recall that strings are defined by
 double quotes as in standard C.

 Knowing about the "\%[ ]" scanf(3) construction might be useful at
 this point. Consider the following few examples: {\tt "\%[a-zA-Z]"}
 means to read the longest string matched so that it is composed of any
 letter; {\tt "\%[\^{ }0-9]"} means to read the longest string matched
 so that it is NOT composed of any digit; {\tt "\%[\^{ }\_.]"} means to
 read the longest string matched so that it is not composed of
 characters `\_' or `.'.

\Examples
\nopagebreak\begin{verbatim}
     # define a string called Testname
     let Testname = "dummy25.dat"
     # Read until a point is encountered
     let Base = Scan(Testname, "%[^.]"))
\end{verbatim}

\Seealso
\bq \$, scan, string functions Read, DirName, FileName, C, cmode, quotes \eq

\section{system}

 When called with arguments, the {\tt system} command is equivalent to
 the `!' bang operator, so the remainder of the line will be given to a
 Bourne shell for execution. If {\tt system} has no argument, a shell
 (depending on environment variable SHELL) will be started.

\Syntax
\bq system {\it shell-commands\optio}\eq

\Seealso
\bq environment, !, shell \eq

\section{then}

 The {\tt then} keyword is required in the fitting mode {\tt if}
 constructions. Refer to the latter for details.

\section{unalias}

 The {\tt unalias} command unaliases any alias previously assigned
 by the {\tt alias} command.

\Syntax
\bq unalias {\it alias\_name} \eq

\Examples
\bq unalias date\\
unalias gnuplot \eq

\Seealso
\bq \&, alias, macro, unmacro, append, show \eq

\section{unlock}

 The {\tt unlock} command changes a constant into a variable and thus
 allows the user to change its value. This is particularly useful in
 functions and procedures needing to change the value of the {\tt data}
 constant. Unlocking {\tt data} gives the user complete freedom on the
 effective size of vectors. No check is done on {\tt data}
 assignments, and therefore assigning a value to {\tt data} that is
 superior to {\tt samples} will result in a program crash. For this
 reason, it is always safer to change {\tt data} using the {\tt set
 data} command. It is not an error to unlock a variable. A warning
 message will be given though. However, trying to unlock something else
 than a constant or variable will result in an error.

\Seealso
\bq lock, set data, set samples, cmode \eq

\section{unmacro}

 The {\tt unmacro} command is the counterpart of {\tt macro}. It is
 used to undefine macros. As does {\tt free}, {\tt unmacro} accepts the
 ``@all'' string in which case all the macros will be erased and freed
 from memory.

\Syntax
\bq unmacro {\it macro-list} \\
unmacro @all \eq

\Examples
\nopagebreak\begin{verbatim}
     unmacro myplot
     unmacro @all
\end{verbatim}

\Seealso
\bq alias, unalias, append, show \eq

\section{version}

 The {\tt version} command displays the version number and the
 welcoming message of \fudgit.

\section{vi}

 The command {\tt vi} calls the editor. It is equivalent to
 {\tt !vi filename}. Note that wild cards are also recognized and
 expanded.

\Syntax
\bq vi {\it argument-list} \eq

\Examples
\nopagebreak\begin{verbatim}
     vi file
     vi test.*
\end{verbatim}

\Seealso
\bq !, system, alias, shell\eq

\section{while}

 The {\tt while} command allows the user to construct controlled loops
 on a series of operations. However, \fudgit\ supports two kinds of
 {\tt while} constructions, one in the fitting mode and the other in
 the C-calculator mode.

\subsection{C-calculator while}

 The C-calculator mode while construction has a syntax similar to
 that of standard C. In interactive mode, any new input line will be
 prompted with a ``n\{\ldots n\verb+\t+'' where `n' stands for the nesting
 level and `\verb+\t+' for a tab. Recall that {\it cmode-line-statement}
 means a string of semicolon separated C-calculator mode commands.

\Syntax
\bq while ({\it conditions}) {\it cmode-line-statement}\eq
 or
\bq while ({\it conditions})\\
    {\it cmode-line-statement}\eq
 or
\subsection{Fitting mode while}

 The fitting mode {\tt while} is very similar to the C-shell
 {\tt while}. As for the {\tt if} construction, the difference remains
 in a broader range of operators available to the conditional
 statement and the fact that the variable expansion operator `\$' is
 not required.

 As for the {\tt foreach} construction, a {\tt end} keyword is
 required to indicate the end of the loop. Note that
 {\it fmode-statements} can also contain C-calculator mode commands
 (including cmode {\tt while} loops!). Recall that the conditional
 statement is a C-calculator mode expression.

\Syntax
\bq while({\it conditions})\\
     {\it fmode-statements}\\
end\eq

\Seealso
\bq foreach, if, cmode \eq



