/usr/share/doc/groff-base/html/pic-9.html is in groff 1.22.2-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <!-- Creator : groff version 1.22.2 -->
<!-- CreationDate: Thu Sep 4 17:17:41 2014 -->
<!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=US-ASCII">
<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-9.html</title>
</head>
<hr>
[ <a href="pic-8.html">prev</a> | <a href="pic-10.html">next</a> | <a href="pic.html">top</a> ]
<hr>
<h2>9. Naming Objects
<a name="9. Naming Objects"></a>
</h2>
<p style="margin-top: 1em"><font color="#000000">The most
natural way to name locations in <b>pic</b> is relative to
objects. In order to do this, you have to be able you have
to be able to name objects. The <b>pic</b> language has rich
facilities for this that try to emulate the syntax of
English.</font></p>
<h3>9.1. Naming Objects By Order Of Drawing
<a name="9.1. Naming Objects By Order Of Drawing"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">The
simplest (and generally the most useful) way to name an
object is with a <b>last</b> clause. It needs to be followed
by an object type name; <b>box</b>, <b>circle</b>,
<b>ellipse</b>, <b>line</b>, <b>arrow</b>, <b>spline</b>,
<b>""</b>, or <b>[]</b> (the last type refers to a
<i>composite object</i> which we’ll discuss later).
So, for example, the <b>last circle</b> clause in the
program attached to Figure 9.1.3 refers to the last circle
drawn.</font></p>
<p style="margin-top: 1em"><font color="#000000">More
generally, objects of a given type are implicitly numbered
(starting from 1). You can refer to (say) the third
ellipse in the current picture with <b>3rd ellipse</b>, or
to the first box as <b>1st box</b>, or to the fifth text
string (which isn’t an attribute to another object) as
<b>5th ""</b>.</font></p>
<p style="margin-top: 1em"><font color="#000000">Objects
are also numbered backwards by type from the last one. You
can say <b>2nd last box</b> to get the second-to-last box,
or <b>3rd last ellipse</b> to get the third-to-last
ellipse.</font></p>
<p style="margin-top: 1em"><font color="#000000">In places
where <i>n</i><b>th</b> is allowed,
<b>‘</b><i>expr</i><b>’th</b> is also allowed.
Note that <b>’th</b> is a single token: no space is
allowed between the <b>’</b> and the <b>th</b>. For
example,</font></p>
<pre style="margin-left:20%; margin-top: 1em">for i = 1 to 4 do {
line from ‘i’th box.nw to ‘i+1’th box.se
}</pre>
<h3>9.2. Naming Objects With Labels
<a name="9.2. Naming Objects With Labels"></a>
</h3>
<p style="margin-top: 1em"><font color="#000000">You can
also specify an object by referring to a label. A label is a
word (which must begin with a capital letter) followed by a
colon; you declare it by placing it immediately before the
object drawing command. For example, the program</font></p>
<pre style="margin-left:10%; margin-top: 1em">.PS
A: box "first" "object"
move;
B: ellipse "second" "object"
move;
arrow right at A .r;
.PE</pre>
<p style="margin-top: 1em"><font color="#000000">declares
labels <b>A</b> and <b>B</b> for its first and second
objects. Here’s what that looks like:</font></p>
<p align="center" style="margin-top: 1em"><font color="#000000"><img src="img/pic30.png" alt="Image img/pic30.png"></font></p>
<p align="center" style="margin-top: 1em"><font color="#000000">Figure
9-1: Example of label use</font></p>
<p style="margin-top: 1em"><font color="#000000">The
<b>at</b> statement in the fourth line uses the label
<b>A</b> (the behavior of <b>at</b> is explained in the next
section). We’ll see later on that labels are most
useful for referring to block composite objects.</font></p>
<p style="margin-top: 1em"><font color="#000000">Labels are
not constants but variables (you can view colon as a sort of
assignment). You can say something like <b>A: A + (1,0);</b>
and the effect is to reassign the label <b>A</b> to
designate a position one inch to the right of its old
value.</font></p>
<hr>
[ <a href="pic-8.html">prev</a> | <a href="pic-10.html">next</a> | <a href="pic.html">top</a> ]
<hr>
|