EXP(1.0) | EXP(1.0) |
exp - a multiple expession calculator.
exp [-vn0..4] [-o output-file] [input-file]
Input is an ascii format file including numeric expessions with variables. Input file can includes other input files thanks to an inclusion directive. exp reads the input files to write it as is in the output file, but the numeric expessions are replaced by their value.
Except the expessionsi and offline comments, the output file is identical to the flattened view of the input files whatever they are. The expession forms can be either [expessions] or {expessions}. The first form is for floating point expessions, the second one is for integer expessions. By default, the print format is respectively %7.3f and %4d (cf. sprintf(3)). Offline comments begins with // and ends at the beginning of the next line.
Examples
It is possible to have more that one expession separated by ; (semi-column). All the expessions of a list are computed, but only the last one is printed. If the last expession is empty, exp do not print anything (see Examples section).
Examples
It is possible to have comments in expessions. A comment begins with # (diese) and ends to the carriage return. Comment in expression is not copied to the output file.
Example
Expession is a multi-level numeric expession using numbers, variables, arithmetic operators and numeric functions.
Examples
The operators, in order of increasing priority, are
Expession values may be stored in simple variables. There are three forms of variable name. First, they can begin with a letter followed by any number of letters, digits and underscores; second, they can begin with " (double quote) followed by any number of any char and ended by a "; Third they can begin with ´ (quote) then a regular expression (see regex(7)) ended by ´. exp is case sensitive.
Examples
When a variable appears in the right member of an affectation, exp uses its value. If it has never been defined, this causes a fatal error. If it appears the left member, the first time it is automatically created and its value is set, or its value is changed.
float_fmt, integer_fmt and string_fmt special variables to redefine print format of floats, integers and strings. Defaults are %7.3f, %-8s and %4d. Those variables are the only variables with a non numerical value.
Examples
verbose is the variable passed in argument list, which can be modified by the program itself.
Examples get details of expression calculation
Few numeric functions are available. The form is fun(args). The arguments take the form of a list of expessions, separated with a , (comma). The number of arguments depends on functions. It is possible to make a list of arguments with a regular expession (see regex(7)). Then all matching variable names are part of the list.
Examples
Examples
# this is a test file [ # few variables
WITDH = 2;
LENGTH = 25 ; ] this message is unchanged but all expresions are computed
length_div_2 = [LENGTH/2]
length_mul_2 = {LENGTH*2}
result = [max ('leng.*')]
# this is a test file this message is unchanged but all expresions are computed
length_div_2 = 12.500
length_mul_2 = 50
result = 12.500
Written by Franck Wajsburt.
Alliance .rds file uses exp to be generated.
March 18, 2002 | UPMC/ASIM/LIP6 |