| 1 |
< |
.\" RCSid "$Id" |
| 1 |
> |
.\" RCSid "$Id$" |
| 2 |
|
.TH RCALC 1 4/6/99 RADIANCE |
| 3 |
|
.SH NAME |
| 4 |
|
rcalc - record calculator |
| 9 |
|
][ |
| 10 |
|
.B \-l |
| 11 |
|
][ |
| 12 |
+ |
.B \-p |
| 13 |
+ |
][ |
| 14 |
|
.B \-n |
| 15 |
|
][ |
| 16 |
|
.B \-w |
| 23 |
|
][ |
| 24 |
|
.B "\-o format" |
| 25 |
|
][ |
| 26 |
+ |
.B "\-in M" |
| 27 |
+ |
][ |
| 28 |
+ |
.B "\-on M" |
| 29 |
+ |
][ |
| 30 |
|
.B "\-f source" |
| 31 |
|
][ |
| 32 |
|
.B "\-e expr" |
| 44 |
|
The |
| 45 |
|
.I \-tS |
| 46 |
|
option is used to specify an alternate tab character. |
| 47 |
+ |
.PP |
| 48 |
|
A |
| 49 |
|
.I \-i format |
| 50 |
|
option specifies a template for an alternate |
| 55 |
|
the format specification. |
| 56 |
|
In either case, if the format does not end with a newline, one will be added |
| 57 |
|
automatically. |
| 58 |
+ |
A special form of the |
| 59 |
+ |
.I \-i |
| 60 |
+ |
option may be followed immediately by a 'd' or an 'f' and an optional |
| 61 |
+ |
count, which defaults to 1, indicating the number of double or float |
| 62 |
+ |
binary values to read per record on the input file. |
| 63 |
+ |
If the input is byte-swapped, the |
| 64 |
+ |
.I \-iD |
| 65 |
+ |
or |
| 66 |
+ |
.I \-iF |
| 67 |
+ |
options may be substituted. |
| 68 |
+ |
If binary input is specified, no format string or file is needed. |
| 69 |
+ |
.PP |
| 70 |
|
A |
| 71 |
|
.I \-o format |
| 72 |
|
option specifies an alternate output record format. |
| 73 |
< |
It is interpreted the same as an input specification. |
| 73 |
> |
It is interpreted the same as an input specification, except that |
| 74 |
> |
the special |
| 75 |
> |
.I \-od |
| 76 |
> |
or |
| 77 |
> |
.I \-of |
| 78 |
> |
options do not require a count, as this will be determined by the |
| 79 |
> |
number of output channels in the given expressions. |
| 80 |
> |
If byte-swapped output is desired, the |
| 81 |
> |
.I \-oD |
| 82 |
> |
or |
| 83 |
> |
.I \-oF |
| 84 |
> |
options may be substituted. |
| 85 |
> |
.PP |
| 86 |
> |
The |
| 87 |
> |
.I \-p |
| 88 |
> |
option specifies "passive mode," where characters that do not |
| 89 |
> |
match the input format are passed unaltered to the output. |
| 90 |
> |
This option has no effect unless |
| 91 |
> |
.I \-i |
| 92 |
> |
is also specified, and does not make much sense unless |
| 93 |
> |
.I \-o |
| 94 |
> |
is also given. |
| 95 |
> |
With both input and output formats, the passive mode can |
| 96 |
> |
effectively substitute information in the middle of a file |
| 97 |
> |
or stream without affecting the rest of the data. |
| 98 |
> |
.PP |
| 99 |
> |
If a |
| 100 |
> |
.I \-in |
| 101 |
> |
option is given with a positive integer argument, |
| 102 |
> |
.I rcalc |
| 103 |
> |
will stop processing input once it has loaded this number of records. |
| 104 |
> |
Similarly, if a |
| 105 |
> |
.I \-on |
| 106 |
> |
option is present, |
| 107 |
> |
.I rcalc |
| 108 |
> |
will stop after producing this many records, which may be a smaller |
| 109 |
> |
number if the |
| 110 |
> |
.I cond |
| 111 |
> |
variable is used. |
| 112 |
> |
If multiple input files are given, these counts are continuous over |
| 113 |
> |
the input and do not reset on each file. |
| 114 |
> |
.PP |
| 115 |
|
The variable and function definitions in each |
| 116 |
|
.I \-f source |
| 117 |
< |
file are read and compiled. |
| 117 |
> |
file are read and compiled from the RADIANCE library where it is found. |
| 118 |
|
The |
| 119 |
|
.I \-e expr |
| 120 |
|
option can be used to define variables on the command line. |
| 125 |
|
option can be used to assign a string variable a string value. |
| 126 |
|
If this string variable appears in an input format, only records |
| 127 |
|
with the specified value will be processed. |
| 128 |
+ |
.PP |
| 129 |
|
The |
| 130 |
|
.I \-b |
| 131 |
|
option instructs the program to accept only exact matches. |
| 140 |
|
With the |
| 141 |
|
.I \-l |
| 142 |
|
option, the input format can match anywhere on a line. |
| 143 |
+ |
.PP |
| 144 |
|
The |
| 145 |
|
.I \-w |
| 146 |
|
option causes non-fatal error messages (such as division by zero) to |
| 222 |
|
.PP |
| 223 |
|
+ - * / ^ |
| 224 |
|
.PP |
| 225 |
< |
Operators are evaluated left to right. |
| 225 |
> |
Operators are evaluated left to right, except '^', |
| 226 |
> |
which is right associative. |
| 227 |
|
Powers have the highest precedence; multiplication and |
| 228 |
|
division are evaluated before addition and subtraction. |
| 229 |
|
Expressions can be grouped with parentheses. |
| 255 |
|
This provides a convenient method for avoiding inappropriate calculations. |
| 256 |
|
The following library of pre-defined functions and variables is provided: |
| 257 |
|
.TP 10n |
| 258 |
+ |
.BR $N |
| 259 |
+ |
Return the value for input column |
| 260 |
+ |
.I N. |
| 261 |
+ |
If an input format is given, using a channel number generates an error. |
| 262 |
+ |
.TP |
| 263 |
+ |
.BR "in(n)" |
| 264 |
+ |
Return the value for input column |
| 265 |
+ |
.I n, |
| 266 |
+ |
or the number of columns available in this record if |
| 267 |
+ |
.I n |
| 268 |
+ |
is 0. |
| 269 |
+ |
This is an alternate way to get a column value instead of using |
| 270 |
+ |
the $N notation, and is more flexible since it is programmable. |
| 271 |
+ |
This function is disabled if an input format is used. |
| 272 |
+ |
.TP |
| 273 |
|
.BR "if(cond, then, else)" |
| 274 |
|
if cond is greater than zero, |
| 275 |
|
then is evaluated, otherwise else is evaluated. |
| 319 |
|
inverse trigonometric functions. |
| 320 |
|
.TP |
| 321 |
|
.BR "atan2(y, x)" |
| 322 |
< |
inverse tangent of y/x (range -pi to pi). |
| 322 |
> |
inverse tangent of y/x (range \-pi to pi). |
| 323 |
|
.SH EXAMPLE |
| 324 |
|
To print the square root of column two in column one, |
| 325 |
|
and column one times column three in column two: |
| 326 |
|
.IP "" .2i |
| 327 |
< |
rcalc -e '$1=sqrt($2);$2=$1*$3' inputfile > outputfile |
| 327 |
> |
rcalc \-e '$1=sqrt($2);$2=$1*$3' inputfile > outputfile |
| 328 |
> |
.SH ENVIRONMENT |
| 329 |
> |
RAYPATH the directories to check for auxiliary files. |
| 330 |
|
.SH AUTHOR |
| 331 |
|
Greg Ward |
| 332 |
|
.SH BUGS |
| 336 |
|
.PP |
| 337 |
|
Tabs count as single spaces inside fields. |
| 338 |
|
.SH "SEE ALSO" |
| 339 |
< |
calc(1), cnt(1), ev(1), lam(1), tabfunc(1), total(1) |
| 339 |
> |
cnt(1), ev(1), getinfo(1), icalc(1), rcollate(1), rlam(1), tabfunc(1), total(1) |