STANDARD INPUT
Name:
Type:
Purpose:
Specify the name of a file that will be equivalenced to
standard input.
Description:
By default, Dataplot reads commands from standard input (in Fortran,
this is typically unit 5). The SET STANDARD INPUT is used to specify
the name of a file to read from when input is expected from standard
input.
In it's simplest usage, this is essentially equivalent to using a
CALL command (this is demonstrated in the Program 1 and Program 2
sections below).
However, the SET STANDARD INPUT is typically used in a different
context than the CALL command. Specifcally, it is motivated by
the idea of having an external program control the input to
Dataplot in a dynamic fashion.
For example, suppose you have a Python script and you would like that
script to use Dataplot to perform a certain analysis. Suppose
further that the user of the Python script has interactive control
over what analysis he would like Dataplot to perform and when
he would like that analysis performed. A typical sequence would
then be
- The Python script initiates Dataplot and has Dataplot
execute the commands
SET MAXIMUM COUNTER STANDARD INPUT 0
SET DELAY STANDARD INPUT 2
SET STANDARD INPUT POLL file.dp
When the POLL CLOSE option is used, Dataplot does the
following
- Check for the existence of the file. If the file
exists, then execute the commands in "file.dp" (the
file name does not have to be "file.dp").
- If the file does not exist, wait for a specified
time and then check for the existence of the file
again. Repeat until the file is found.
The wait time is specified by the SET DELAY STANDARD
INPUT command. The value is specified in seconds.
If this command is not given, the default value is 2.
The SET MAXIMUM COUNTER STANDARD INPUT command can
be used to specify a maximum number of iterations.
If this command is omitted or a value of 0 is given,
then Dataplot will keep repeating until the file is
found.
If the POLL option is omitted, then Dataplot will check
for the existence of the file only once. If the file
is not found, nothing is done and standard input is restored
to unit 5.
- The last line of the "file.dp" file will typically contain one
of the following lines
SET STANDARD INPUT
SET STANDARD INPUT CLOSE
SET STANDARD INPUT CLOSE POLL
where
- The SET STANDARD INPUT command closes "file.dp" and
reverts standard input back to the terminal. The
"file.dp" file is not deleted.
- The SET STANDARD INPUT CLOSE command close and deletes
the "file.dp" file. Standard input reverts back to the
terminal.
This option is useful when the external program will not
subsequently send additional commands to Dataplot.
- The SET STANDARD INPUT CLOSE POLL command close and
deletes the "file.dp" file. However, it resumes polling
mode. That is, it effectively enters the command
SET STANDARD INPUT POLL file.dp
This option is used when the external program expects to
subsequently send additonal commands to Dataplot.
The external program is not limited to Python. A similar sequence
can be used within Perl, Tcl/TK, or any number of other programs.
Syntax 1:
Syntax 2:
SET STANDARD INPUT
This syntax closes the file equated to standard input and reverts
standard input back to the terminal.
Syntax 3:
SET STANDARD INPUT POLL <fname>
where <fname> is a file name.
This syntax equates standard input to <fname>. It will
continually search for the existence of <fname> (based on the
SET MAXIMUM COUNTER STANDARD INPUT and SET DELAY STANDARD INPUT
commands).
Syntax 4:
Syntax 5:
Examples:
SET STANDARD INPUT commands.dp
SET STANDARD INPUT POLL commands.dp
Note:
SET RESUME POLL is a synonym for SET STANDARD INPUT POLL. However,
no file name is entered. The previously defined file name (from
the most recent SET STANDARD INPUT POLL command) will be used.
Default:
Synonyms:
SET SUSPEND POLL is a synonym for SET STANDARD INPUT.
SET POLL SUSPEND is a synonym for SET STANDARD INPUT.
SET POLL RESUME is a synonym for SET RESUME POLL.
Related Commands:
CALL
|
=
|
Execute the commands from an external file.
|
Applications:
Implementation Date:
Program 1:
. Put these lines in the external file
.
. stdin.dp
.
. These commands will be executed by the Program 2 example.
.
print "in file stdin.dp"
let a = 3
let b = 4
set standard input
Program 2:
. Execute the commands in file stdin.dp
.
set standard input stdin.dp
Privacy
Policy/Security Notice
Disclaimer |
FOIA
NIST is an agency of the U.S.
Commerce Department.
Date created: 05/09/2016
Last updated: 05/09/2016
Please email comments on this WWW page to
[email protected].
|