home *** CD-ROM | disk | FTP | other *** search
- ========================================================================
-
- PUSH, QUEUE, and DROPBUF
-
- ========================================================================
-
- ConMan provides special capabilities (in versions 1.0 and later) that
- allow an input stream to be used as a temporary "scratchpad" to store a
- series of data lines. These lines can be "stacked" (last in, first out)
- or "queued" (first in, first out) to be read at a later time. These
- special capabilities are available through the CLI command utilities
- PUSH, QUEUE, and DROPBUF. Here's what they do:
-
- PUSH takes its command line and "stacks" it in the input stream. Stacked
- lines always go the the head of the internal buffer, and are then available
- for the next program (or the CLI) that reads from the stream. For example,
- entering "push echo hi" would result in
-
- 1> push echo hi
- 1> hi
- 1>
-
- The command line can be surrounded by double-quotes to prevent the CLI
- from breaking it; the quotes are stripped off before the line is actually
- stacked. PUSH is useful within an "execute" script to allow a series of
- responses to be prepared for a program. For exam[le, suppose that the
- program "myprog" expects three lines of input. Then the following script
- could be used to launch the program:
-
- ; Launch "myprog" with prepared data
- push data line 3
- push data line 2
- push data line 1
- df1:c/myprog -t
-
- Note that the command lines are stacked in reverse order (well, in normal
- order if you're a Forth programmer.)
-
- The QUEUE command behaves just like the PUSH command, except that it
- places the data in "first in, first out" order. New data is placed behind
- all previously queued (or stacked) data. The choice of whether to use
- PUSH or QUEUE is usually just a matter of convenience, unless the data is
- available in a particular order that constrains the decision.
-
- Data lines entered by PUSH or QUEUE are never displayed on the console,
- and are always ahead of any data received through the input stream.
-
- Sometimes it may be necessary to delete or purge previously stacked data.
- For example, if a program aborted after reading only part of its prepared
- input stream, it would be confusing (or dangerous!) for the stacked data
- to be read from the command stream. The DROPBUF command is provided to
- "drop" (delete) all stacked or queued data, without perturbing any of the
- lines received through the input stream.
-
- Two brief demonstration scripts, "pushdemo" and "dropdemo", have been
- included as examples. Type them out and then try "execute pushdemo".
-