The rdfile and rdcmd utilities

rdfile is an extension of the unix cat utility. It reads an ASCII file, passes it through the Questaal file preprocessor, and prints the results to standard output. The preprocessor has capabilities for looping and conditional reading of lines. You can structure output and control flow with algebraic and character variables, which can be declared in the input file itself or on the command line using Questaal’s standard -v and -c command-line arguments.

Questaal programs that read input files such as ctrl.ext also pass the input through the Questaal preprocessor.

rdcmd reads an ASCII file and passed each postprocessed line to a shell, as a command. With rdcmd you can use the input file simultaneously as a script containing instructions, and as the input for the calculation you are doing. Many of the tests in the distribution contain their own instructions for the test.

rdfile examples

Example 1. Make a list of n+1 (x,y) pairs for parabola y=x2/2 in the interval [0,1].

Cut and paste the context of the box below into input.txt.

% repeat i=0:n
% var x=i/n
{x} 1/2*{x^2}
% end

Invoke rdfile -vn=5 input.txt and the output should be

0 1/2*0
.2 1/2*.04
.4 1/2*.16
.6 1/2*.36
.8 1/2*.64
1 1/2*1

Note: Invoking rdfile without the variable assignment -vn=# will result in an error. Alternatively you can include the assignment in the input file, viz

% const n=5

Example 2: Make a list of points on a line connecting vector M to vector R.