Initial Windows agent repository
This commit is contained in:
commit
a0db0c2e5b
10589 changed files with 3844063 additions and 0 deletions
130
OGP64/usr/share/doc/groff-1.24.1/html/pic-13.html
Normal file
130
OGP64/usr/share/doc/groff-1.24.1/html/pic-13.html
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
<!-- 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-13.html</title>
|
||||
|
||||
</head>
|
||||
<hr>
|
||||
[ <a href="pic-12.html">prev</a> | <a href="pic-14.html">next</a> | <a href="pic.html">top</a> ]
|
||||
<hr>
|
||||
|
||||
|
||||
<h2>13. Expressions, Variables, and Assignment
|
||||
<a name="13. Expressions, Variables, and Assignment"></a>
|
||||
</h2>
|
||||
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">A number
|
||||
is a valid expression, of course (all numbers are stored
|
||||
internally as floating-point). Decimal-point notation is
|
||||
acceptable; in GNU <b>gpic</b>, scientific notation in
|
||||
C’s ‘e’ format (like 5e-2) is
|
||||
accepted.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">Anywhere a
|
||||
number is expected, the language also accepts a variable.
|
||||
Variables may be the built-in style variable described in
|
||||
the last section, or new variables created by
|
||||
assignment.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">DWB
|
||||
<b>pic</b> supports only the ordinary assignment via
|
||||
<b>=</b>, which defines the variable (on the left side of
|
||||
the equal sign) in the current block if it is not already
|
||||
defined there, and then changes the value (on the right
|
||||
side) in the current block. The variable is not visible
|
||||
outside of the block. This is similar to the
|
||||
C programming language where a variable within a block
|
||||
shadows a variable with the same name outside of the
|
||||
block.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">GNU
|
||||
<b>gpic</b> supports an alternate form of assignment using
|
||||
<b>:=</b>. The variable must already be defined, and the
|
||||
value is assigned to that variable without creating a
|
||||
variable local to the current block. For example,
|
||||
this</font></p>
|
||||
|
||||
|
||||
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">x=5
|
||||
<br>
|
||||
y=5 <br>
|
||||
[ <br>
|
||||
x:=3 <br>
|
||||
y=3 <br>
|
||||
] <br>
|
||||
print x " " y</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">prints
|
||||
<b>3 5</b>.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">You can
|
||||
use the height, width, radius, and x and y coordinates of
|
||||
any object or corner in expressions. If <b>A</b> is an
|
||||
object label or name, all the following are
|
||||
valid:</font></p>
|
||||
|
||||
|
||||
<p style="margin-left:28%; margin-top: 1em"><font color="#000000">A.x
|
||||
# x coordinate of the center of A <br>
|
||||
A.ne.y # y coordinate of the northeast corner of A <br>
|
||||
A.wid # the width of A <br>
|
||||
A.ht # and its height <br>
|
||||
2nd last circle.rad # the radius of the 2nd last
|
||||
circle</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">Note the
|
||||
second expression, showing how to extract a corner
|
||||
coordinate.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">Basic
|
||||
arithmetic resembling those of C operators are available;
|
||||
<b>+</b>, <b>*</b>, <b>-</b>, <b>/</b>, and <b>%</b>. So is
|
||||
<b>ˆ</b> for exponentiation. Grouping is permitted in the
|
||||
usual way using parentheses. GNU <b>gpic</b> allows logical
|
||||
operators to appear in expressions; <b>!</b> (logical
|
||||
negation, not factorial), <b>&&</b>, <b>||</b>,
|
||||
<b>==</b>, <b>!=</b>, <b>>=</b>, <b><=</b>,
|
||||
<b><</b>, <b>></b>.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">Various
|
||||
built-in functions are supported:
|
||||
<b>sin(</b><i>x</i><b>)</b>, <b>cos(</b><i>x</i><b>)</b>,
|
||||
<b>log(</b><i>x</i><b>)</b>, <b>exp(</b><i>x</i><b>)</b>,
|
||||
<b>sqrt(</b><i>x</i><b>)</b>,
|
||||
<b>max(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
|
||||
<b>atan2(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
|
||||
<b>min(</b><i>x</i><b>,</b><i>y</i><b>)</b>,
|
||||
<b>int(</b><i>x</i><b>)</b>, <b>rand()</b>, and
|
||||
<b>srand()</b>. Both <b>exp</b> and <b>log</b> are
|
||||
base 10; <b>int</b> does integer truncation;
|
||||
<b>rand()</b> returns a random number in [0-1), and
|
||||
<b>srand()</b> sets the seed for a new sequence of
|
||||
pseudo-random numbers to be returned by <b>rand()</b>
|
||||
(<b>srand()</b> is a GNU extension).</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">GNU
|
||||
<b>gpic</b> also documents a one-argument form or rand,
|
||||
<b>rand(</b><i>x</i><b>)</b>, which returns a random number
|
||||
between 1 and <i>x</i>, but this is deprecated and may be
|
||||
removed in a future version.</font></p>
|
||||
|
||||
<p style="margin-top: 1em"><font color="#000000">The
|
||||
function <b>sprintf()</b> behaves like a C <i>sprintf</i>(3)
|
||||
function that only takes %%, %e, %E, %f, %g, and %G
|
||||
conversion specifications.</font></p>
|
||||
<hr>
|
||||
[ <a href="pic-12.html">prev</a> | <a href="pic-14.html">next</a> | <a href="pic.html">top</a> ]
|
||||
<hr>
|
||||
Loading…
Add table
Add a link
Reference in a new issue