184 lines
5.5 KiB
HTML
184 lines
5.5 KiB
HTML
<!-- Creator : groff version 1.24.1 -->
|
|
<!-- CreationDate: Mon Mar 16 21:28:01 2026 -->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="groff -Thtml, see www.gnu.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="Content-Style" content="text/css">
|
|
<style type="text/css">
|
|
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
|
h1 { text-align: center }
|
|
</style>
|
|
<title>pic-15.html</title>
|
|
|
|
</head>
|
|
<hr>
|
|
[ <a href="pic-14.html">prev</a> | <a href="pic-16.html">next</a> | <a href="pic.html">top</a> ]
|
|
<hr>
|
|
|
|
|
|
<h2>15. Import/Export Commands
|
|
<a name="15. Import/Export Commands"></a>
|
|
</h2>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">Commands
|
|
that import or export data between <b>pic</b> and its
|
|
environment are described here.</font></p>
|
|
|
|
<h3>15.1. File and Table Insertion
|
|
<a name="15.1. File and Table Insertion"></a>
|
|
</h3>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">The
|
|
statement</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
|
|
<i>filename</i></font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">inserts
|
|
the contents of <i>filename</i> in the <b>pic</b> input
|
|
stream. Any <b>.PS</b>/<b>.PE</b> pair in the file is
|
|
ignored. You can use this to include pre-generated
|
|
images.</font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">A variant
|
|
of this statement replicates the <b>copy thru</b> feature of
|
|
<i>grap</i>(1). The call</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
|
|
<i>filename</i> thru <i>macro</i></font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">calls
|
|
<i>macro</i> (which may be either a name or replacement
|
|
text) on the arguments obtained by breaking each line of the
|
|
file into blank-separated fields. The macro may have up to
|
|
9 arguments. The replacement text may be delimited by
|
|
braces or by a pair of instances of any character not
|
|
appearing in the rest of the text.</font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">If you
|
|
write</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">copy
|
|
thru <i>macro</i></font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">omitting
|
|
the filename, lines to be parsed are taken from the input
|
|
source up to the next <b>.PE</b>.</font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">In either
|
|
of the last two <b>copy</b> commands, GNU <b>gpic</b>
|
|
permits a trailing ‘<b>until</b> <i>word</i>’
|
|
clause to be added which terminates the copy when the first
|
|
word matches the argument (the default behavior is therefore
|
|
equivalent to <b>until .PE</b>).</font></p>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">Accordingly,
|
|
the command</font></p>
|
|
|
|
|
|
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">.PS
|
|
<br>
|
|
copy thru % circle at ($1,$2) % until "END" <br>
|
|
1 2 <br>
|
|
3 4 <br>
|
|
5 6 <br>
|
|
END <br>
|
|
box <br>
|
|
.PE</font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">is
|
|
equivalent to</font></p>
|
|
|
|
|
|
<p style="margin-left:37%; margin-top: 1em"><font color="#000000">.PS
|
|
<br>
|
|
circle at (1,2) <br>
|
|
circle at (3,4) <br>
|
|
circle at (5,6) <br>
|
|
box <br>
|
|
.PE</font></p>
|
|
|
|
<h3>15.2. Debug Messages
|
|
<a name="15.2. Debug Messages"></a>
|
|
</h3>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">The
|
|
command <b>print</b> accepts any number of arguments,
|
|
catenates their output forms, and writes the result to
|
|
standard error. Each argument must be an expression, a
|
|
position, or a text string.</font></p>
|
|
|
|
<h3>15.3. Escape to Post-Processor
|
|
<a name="15.3. Escape to Post-Processor"></a>
|
|
</h3>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">If you
|
|
write</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000"><b>command</b>
|
|
<i>arg</i>...</font></p>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000"><b>pic</b>
|
|
concatenates the arguments and pass them through as a line
|
|
to troff or TeX. Each <i>arg</i> must be an expression, a
|
|
position, or text. This has a similar effect to a line
|
|
beginning with <b>.</b> or <b>\</b>, but allows the values
|
|
of variables to be passed through.</font></p>
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">For
|
|
example,</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">.PS
|
|
<br>
|
|
x = 14 <br>
|
|
command ".ds string x is " x "." <br>
|
|
.PE <br>
|
|
\*[string]</font></p>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">prints</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">x
|
|
is 14.</font></p>
|
|
|
|
<h3>15.4. Executing Shell Commands
|
|
<a name="15.4. Executing Shell Commands"></a>
|
|
</h3>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">The
|
|
command</font></p>
|
|
|
|
|
|
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">sh
|
|
{ <i>anything...</i> }</font></p>
|
|
|
|
|
|
<p style="margin-top: 1em"><font color="#000000">macro-expands
|
|
the text in braces, then executes it as a shell command.
|
|
This could be used to generate images or data tables for
|
|
later inclusion. The delimiters shown as {} here may also be
|
|
two copies of any one character not present in the shell
|
|
command text. In either case, the body may contain balanced
|
|
{} pairs. Strings in the body may contain balanced or
|
|
unbalanced braces in any case.</font></p>
|
|
<hr>
|
|
[ <a href="pic-14.html">prev</a> | <a href="pic-16.html">next</a> | <a href="pic.html">top</a> ]
|
|
<hr>
|