
Here is a quick run-down of the dpic language, useful as a dpic
reference.  The differences between dpic and gpic, described at the
end, may be of particular interest.  This document is not intended to be an
introductory pic manual.  For elementary examples, sample pictures, and
details, consult a pic or gpic manual.

   There had better be a disclaimer: The temptation to change the pic
   language has been resisted most of the time, so that valid diagrams
   can be processed with minimal changes using the original Documenter's
   Workbench (DWB) pic, with gpic, or dpic.  There are exceptions, of
   course, principally word-processor commands, but also minor differences
   in the processing of valid pic input.  For details, see the last part
   of this file.  Dpic also contains a few extensions without changing its
   behaviour for normal input.  It is tempting to add more colour and other
   Postscript-like functions, but these can be handled with macros.

Usage to produce .tex output (for LaTeX, PStricks, mfpic processing):
   dpic [option] file.pic > file.tex
   or
   cat file.pic | dpic [option] > file.tex
Usage to produce MetaPost output:
   dpic -s file.pic > file.mp
Usage to produce Postscript output:
   dpic -r file.pic > file.eps

Dpic options:  The default produces basic LaTeX drawing commands.  LaTeX
   line slopes, for example, are very limited.  The -p option is the
   most powerful and flexible for many purposes.  Mfpic and MetaPost
   output is provided for compatibility.  The Postscript option
   produces Postscript .eps files, in which font changes or typesetting
   must be done manually.  The -f option writes Postscript strings in
   psfrag format for tex or latex typesetting.

   (none) Latex drawing commands
   -f Postscript output with psfrag strings
   -m mfpic output
   -p PStricks output
   -r raw Postscript output
   -s MetaPost output
   -t eepicemu output
   -x xfig 3.2 output

The file Examples.txt contains a minimal example of each of these options.
Consult the appropriate manual for processing mfpic, PStricks, MetaPost,
or psfrag output.

Basic syntax:  One or more diagrams can be alternated with other text
in dpic input.  Ordinary text is passed through unchanged.  The
character sequence .PS denotes the first input line of a dpic diagram;
the last line contains .PE, as shown:
.PS
   dpic commands
.PE
The .PS line can contain one or two terms:
   .PS x y
where x and y are terms that evaluate to constant numbers.   A term is
a product of factors, or a parenthesized sum or difference.  On
encountering the .PE line, the picture width w and height h are
calculated.  If x > 0 then the picture is scaled so that w = x.  If y > 0
and h > y then the picture is scaled to make h = y.  If x = 0 and y > 0
then the picture is scaled to make h = y.  Horizontal and vertical
scaling are not done independently.  The dimensions are inches, so
   .PS 100/25.4
sets the final picture width to 100 mm.  Printed string text may extend
beyond the rectangular boundaries defined by w and h unless the text
dimensions are entered explicitly.

The primitive drawing objects consist of the planar objects
   "box" "circle" "ellipse" "<string>"
and the linear objects
   "line" "arrow" "move" "spline" "arc"
where <string> is the symbol for a string enclosed in double quotes.

Coordinates:
   Drawing is done with respect to rectangular coordinates, the horizontal
dimension from left to right, the vertical dimension from bottom to top.

By default, coordinates are in inches, but there is a built-in scale factor
variable called scale, so the line
   scale = 25.4
allows all dimensions to be given in mm, for example.  This scaling is
overridden if the picture exceeds the size specified by the variables
maxpswid and maxpsht.  All this is overridden by the .PS x y line
as described previously.

Current position and direction:  Every primitive object has an entry
and exit position, and the current position is the exit of the last
object.  The current direction may be set as one of "up" "down" "left"
"right".  Thus
   up; box; line
draws a box, exiting at the top, and then a line upwards.

Errors and error messages:
   An input line containing errors is printed out, with error messages,
after the complete line has been scanned.  The error is at or prior to
the point indicated by the message.  An error may not be detected until
scanning has reached some distance beyond the offending input, which
therefore may be in the line or lines preceeding the one printed with
the error messages.  Putting a semicolon at the end of the line
containing the error usually forces the line to be printed with
the error message.

Grammar:
   An outline of the grammar follows, with some minor simplifications.

Punctuation symbols (within quotation characters):
  "<" ">" "cw" "ccw"
  "(" ")" "*" "+" "-" "/" "%" ";" = "<NL>"
  "^" "!" "&&" "||" "==" "!=" ">=" "<=" "<<" ">>"
  "," ":" "[" "]" "{" "}" "." "[]" "`" "'"
  "=" ":=" "+=" "-=" "*=" "/=" "%="
  "#" "$"

The string "<NL>" corresponds to the end-of-line character or characters in
the input stream.  Strings equated by the equals sign (";" = "<NL>") are
grammatically equivalent.

Comments are contained between the "#" character and the end of the line.
Lines may be continued if the last character on the line is a backslash
or if a backslash is immediately followed by the "#" character.

More keywords, to be explained later, are:
     "ht" = "height"
     "wid" = "width"
     "rad" = "radius"
     "diam" = "diameter"
     "thick" = "thickness"
     "from"
     "to"
     "at"
     "with"
     "by"
     "then"
     "continue"
     "chop"
     "same"
     "of"
     "the"
     "way"
     "between"
     "and"
     "Here"
     "st" = "rd" = "nd" = "th"
     "last"
     "fill" = "filled"
     ".x"
     ".y"
     ".ht"
     ".wid"
     ".rad"
     "print"
     "copy"
     "reset"
     "sh"
     "command"
     "define"
     "exec"
     "undef"
     "rand"
     "if"
     "else"
     "for"
     "do"
     "sprintf"

The following single-argument mathematical functions are recognized:
     "abs" "acos" "asin" "cos" "exp" "expe" "int" "log" "loge"
     "sign" "sin" "sqrt" "tan"
The two-argument functions are:
     "atan2" "max" "min" "pmod"
The function pmod(x,y) returns nonnegative value (x mod abs(y)) for both
positive and negative x. 

The log and exp functions are base 10.  Function arguments are enclosed
within parentheses and separated by commas, e.g.
     atan2(y,x).

Primitive drawing objects:
     "box" "circle" "ellipse" "arc" "line" "arrow" "move" "spline"

Where it makes logical sense, points on primitive objects can be referred
to by compass-coordinates or other labels:
     ".n" ".e" ".w" ".s" ".ne" ".se" ".nw" ".sw"
     ".t" = ".top" = "top"
     ".b" = ".bot" = ".bottom" = "bottom"
     ".start" = "start"
     ".end" = "end"
     ".right" = ".r"
     ".left" = ".l"
     ".center" = ".centre" = ".c"
Be warned that not all grammatically acceptable constructs make logical
sense, e.g. the .nw position of a multi-segmented line may not be defined.

   e.g. 1st box.ne
   e.g. last [].A  (assuming that position A has been labeled within
             the last block)
   e.g. last box   (the same as last box.c)
   e.g. 3rd last arrow.end

Directions:
     "up" "down" "right" "left"
   e.g. line up 2.5   (this draws a line up 2.5 units and leaves the current
                          direction set to up)

Line types:
    "solid" "dotted" "dashed" "invis" = "invisible"
   e.g. arrow up 1 dashed

Line and fill colours are set by the outline and shade parameters, e.g.
    box outline "red" shaded "blue"
  Both colours can be set to the same value using
    box colour "red"
  The strings specifying colours have to be compatible with the postprocessor,
  such as PStricks, that is used.

Text positions relative to default or specified positions:
     "centre" = "center" "ljust" "rjust" "above" "below"
   e.g. line invis right "Text" above
   e.g. "Fig. 1" at 3.5,4 ljust below

Arrowhead locations for lines, arcs and splines:
     "<-" "->" "<->"
   e.g. arrow <- up 2 (draws a downward-pointing arrow of length 2)

Environmental variables are in two groups, those that are changed when
the variable "scale" is changed, and those that are not.  The variables,
with their default values, are:

Scaled variables:
   "arcrad" = 0.25         default radius of arcs
   "arrowht" = 0.1         distance from arrowhead front to back 
   "arrowwid" = 0.05       arrowhead width
          The effect of changing arrowhead parameters depends on the
          drawing method, and may not be the same in all cases.
   "boxht" = 0.5           box height and width defaults
   "boxwid" = 0.75
   "circlerad" = 0.25      circle default radius
   "dashwid" = 0.1
   "ellipseht" = 0.5       ellipse height and width defaults
   "ellipsewid" = 0.75
   "lineht" = 0.5          default vertical line length
   "linewid" = 0.5         default horizontal line length
   "moveht" = 0.5          default vertial and horizontal move distances
   "movewid" = 0.5
   "textht" = 0            height and width of text box
   "textoffset" = 2.5/72.27   space between text and specified position
   "textwid" = 0

Unscaled variables:
   "arrowhead" = 2         arrowhead shape number
   "fillval" = 0.3         gray intensity for filled objects (0=black, 1=white)
   "linethick" = 0.8       default line thickness, in points
   "maxpsht" = 11          default maximum picture height and width, overridden
                           by the .PS line parameters
   "maxpswid" = 8.5
   "scale" = 1             drawing scale factor

Other types of permissible character sequences:
  "<float>" "<name>" "<Label>" "<troff>" "<string>"

A "<float>" is an integer or floating-point number with or without the 'e'
exponential representation, e.g. 5, .5, 5., 5.123, -123e2

A "<name>" is a sequence of upper-case or lower-case characters, the
integers 0 to 9, or the underscore _, beginning with a lower-case
letter, but a name may not be one of the keywords of the grammar.
Names are used as variables in expressions.  e.g.
    separation = 0.1 ; move right 3*separation
Names may be subscripted in dpic, e.g. separation[i] where the expression
i is evaluated and rounded to an integer.

A "<Label>" is like a "<name>" but begins with an upper-case letter,
and can be used as the symbolic name of a position or drawing object.
The predefined objname "Here" refers to the current drawing position, e.g.
    Pin27: line to Here + (1,2.5) ; line up 1 from Pin27.end
Labels may be subscripted in dpic, e.g. Pin[27] instead of Pin27.

Reasonable defaults are used when drawn objects are not completely specified.
For example,
  line to A
is by default equivalent to
  line from Here to A
whereas
  line from A
is a line of default length starting at A, drawn in the current direction, and
  line
is a line of default length starting at Here, drawn in the current direction.
Similarly,
  box
has default height of boxht and default width of boxwid, whereas
  box ht 1
has height 1 and default width.
If the result is undesirable, specify the drawn object completely.

The symbol "<troff>" is any line beginning with the "." or "\" character,
to be copied unchanged to the output ("." immediately followed
by an upper case letter is not copied through).  Thus arbitrary TeX, pstricks,
or other commands can be mixed with drawing commands, e.g.
   \rotateleft{
    box "Text"
   \relax}

An alternative for passing arbitrary characters to the output is the
   "command" string
construct.  Thus 
   command "\pscircle(0,0){0.5}"
passes the contents of the string to the output.

In the following, symbols between square brackets [ and ] are optional,
but note that in pic input, brackets [ and ] also define a logical block
containing the drawing elements within the brackets, as will be described.
The symbol `|' means `or'.  Unquoted parentheses are for grouping.

Strings are arbitrary character sequences between double quotes, with double
quotes in strings preceeded by the backslash character.
Equivalently a string is produced by the C-like sprintf function:
   "sprintf" "(" "<string>" ["," expression "," ... ] ")"
The pair %% in the format string prints the percent character.
Otherwise only the f,e,g formatting parameters are valid, since expressions
are stored as floating-point numbers, e.g.
   line sprintf("%g%g0", 2, 0 ) above
is equivalent to
   line "200" above
Similarly, 
   command sprintf("\pscircle(%g,%g){%g}",0,0,0.5)
places the formatted string into the output.  The numerical values
can be arbitrary expressions rather than the constants shown.
Except prior to the double quote, backslashes are passed to the
output, as for LaTeX macros in the example above.  The open and close
braces should be entered into strings as \{ and \} respectively to prevent
confusion with argument delimeters.

Strings can be associated with drawing objects as above.  Otherwise,
a string can be placed at an arbitrary position and assigned a
height and width as for a box as shown:
  "Arbitrary character sequence" ht 0.16 wid 1.85 at A
where the dimensions of the string have to be obtained by investigating
the final printed output.  Dpic cannot know typeset dimensions in advance.

Valid input is a sequence of 0 or more pictures.  A picture begins
with .PS and ends with .PE, and contains a list of 0 or more elements
separated by newlines or semicolons, e.g.
.PS
   box
   line; ellipse; arrow
.PE


The elements are:

element = ["<Label>" ":"] object             -- object with optional name
        | "<Label>" ":" [position]           -- named position
        | assignment ["," assignment ...]       -- assignment statements
        | "<direction>"                         -- up, down, left, right
        | "<troff>"                             -- lines starting with \ or .
        | command
        | "{" elementlist "}"
        | "if" expression "then" "{" elementlist "}"
          [ "else" "{" elementlist "}" ]
        |  "for" assignment ["," assignment ...] "to" expression
            ["by" ["*"] expression] "do" "{" elementlist "}"
        | "command" string
        | "exec" string

assignment = ("<name>" | "<envvar>") "=" expression

Examples of named objects:
   A: box
   Bounding_box: [ circle rad 3 "target" ]  -- the [] brackets define a block
   Bounding_box[5]: circle                  -- the [] brackets are a subscript

Example of named position:
   NW: last [].nw                           -- refers to last-defined block

Except in the `if' and `for' constructions, a sequence of elements
in "{" and "}" braces has the effect of saving the current drawing
position and direction at the first brace, and restoring these values
at the second brace.

Example `for':
for y = 0 to 1 by 0.05 do {
   t = 2*atan2(sqrt((1-y)/(1+y)),1)
   line right 2*t with .c at (0,y) }

The number of iterations of the loop must be precomputable, and the
loop variable (y above) must not be changed by statements in the loop.

command:
        "print" expression | position | string
        | "reset" [<envvar> ["," ...] ]
        | "sh" string
        | "copy" "<string>"

The print command sends the specified quantity to the standard error
output, which is useful for debugging pictures.  The reset command
resets all or only the designated environment variables of the current
block to the default values.  The sh command sends the string to the
operating system for execution.  The copy command inserts the file
specified in "<string>" into the input stream.  Copy commands may not
be nested.

object:
        primitive_object
        | linear_object expression
        | string
        | "[" elementlist "]"

The first of the above lines corresponds to any primitive object;
the second to lines of the form
  arrow 0.5
which is equivalent to 
  arrow right 0.5
for example, if the current direction is right.  The fourth
construction gives the language a block structure.  The scope of
environment variables, positions and defined variables is within a
block, except that if a variable is sought but not found within the
current block, the search will continue within enclosing blocks.  A
block may be given a name, and placed just as a box would be placed.
e.g.

A: [ elements, including object B ]
   [ elements, including object C ] with C.sw at A.B.n + (0,1.5)
   box with .s at last [].n

The second block is placed with the south-west corner of internal
object C at 1.5 units above the top of object B in block A.  Then a box
is placed above the previous block.

Objects may be followed by modifyers to specify dimensions, position,
or orientation, as follows:

          ("height"|"width"|"radius"|"diameter"|"scaled") expression
          | ("up"|"down"|"left"|"right") [expression]
          | "by" expression "," expression
          | "then"
          | <line type> [expression]
          | ("chop"|"fill") [expression]
          | <arrowhead type>
          | "cw" | "ccw"
          | "same"
          | "<string>"
          | <text position>
          | ("from"|"to"|"at") position
          | <colrspec> "<string>"

e.g.
Brick: [
   B1: box
      box ht 0.5*boxht wid 0.5*boxwid with .c at B1.c "C"
      ]
   ellipse ht 0.6 wid 3 with .w at Brick.B1.ne "$\theta$"
   arc from 0,0 to 1,1 with .c at 0,1

The word "then" is used to concatenate instances of an object, thus

   line up right then down then up left

draws a line northeast, then a line south, then a line northwest.

In loops, or if calculations have to be done, the "continue"
keyword is used to add to the most recent drawn object as if "then"
had been used in the original line, thus the following has the same
effect as the above:

   line up right
     calculations
   continue down
     more calculations
   continue up left

Changing "line" to "spline ->" in the above,

   spline -> up right then down then up left

draws a spline tangent to the first and last line segments, with the
interior corners as control points, and with an arrowhead at the end.

An object followed by one or more strings has the strings placed at its
center, unless they are modified by text position specifications.  Thus

   box "First line" "Second line" "Third line"

draws a box with the three text lines stacked and centered at the center
of the box.

Arcs are ambiguous in the pic language.  The object

   arc -> from 0.5,0 to 0,0.5

specifies an arc with an arrowhead at the end, by default drawn
counterclockwise, starting at position 0.5,0 and ending at position
0,0.5.   If the radius is not specified then the value `arcrad' is used
if it is large enough, otherwise the radius is half the chord.  However
there are still two possible arcs, with centres at 0,0 and 1,1.
Dpic chooses the one for which the initial tangent makes an acute angle
with the current direction: up, down, left, or right, e.g.:
   left;  arc -> from 0.5,0 to 0,0.5 rad 0.5
   right; arc -> from 0.5,0 to 0,0.5 rad 0.5 dashed

Default values for arc parameters will automatically be used, but
when in doubt, specify the start, end, rotation, and centre, e.g.
   arc ccw from <position> to <position> with .c at <position>

Objects may also be placed by following them by the "with" construction:
        ... "with" ("<corner>"|"start"|"end") "at" position
        ... "with" "." "<Label>" "at" position

A position is a comma-separated pair of expressions, or a location plus
or minus a shift, which is a location in parentheses, or a fraction
of the way between positions:

position = expression "," expression
   e.g. 0,0
         | location shift
   e.g. last box.ne + (1,0.5) - (linewid,0)
         | expression ["of" "the" "way"] "between" position "and" position
         | expression "<" position "," position ">" shift
   e.g. line from 0.1<A,B> to 0.9<A,B>

location = "(" position ["," position] ")"
         | place

The construction "(" position "," position ")" takes x-coordinate from
the first position, and y-coordinate from the second position.

Places are compound constructions specified in a variety of ways, as
follows:
place = placeobj ["<corner>"]
      | "<corner>" ["of"] placeobj
      | "Here"

placeobj = ("<Label>" | nth ("<primitiv>" | "[]") )
         | placeobj "." "<Label>"

nth = ncount "th" ["last"] | "last".

ncount = "<float>" | "`" expression "'" | "{" expression "}" .

e.g. for i = 1 to 10 do { line from {i}th box.ne to {i+1}th box.sw }
e.g. line from 2nd last arrow.end to last ellipse.nw

In the above, of course the place name, or the nth object or block
referred to must have been previously defined.

Expressions are composed of primary floating-point quantities combined
using operators, with the following precedence, from lowest to highest:
   "==" "!=" "<=" ">=" ">>" "<<"
   unary minus, unary "!" (negation), "+" "-" "||"
   "*" "/" "%" "&&"
   exponentiation using "^"

The primary quantities are:
          environment variable
        | value assigned to a name
        | floating-point constant
        | "(" expression ")"
        | location (".x"|".y")               -- the location x or y coordinate
        | placeobj (".ht"|".wid"|".rad"|".diam")
        | "rand" "(" ")"                     -- random number between 0 and 1
        | returned function value
        | "(" assignment ")"


Lexical error messages:
  Lexical error messages are generated automatically, and state what
lexical value was found, and what was expected.  Some nonobvious
lexical values are:

:             --designates the end of a for iteration
<<            --the "<" operator within logical tests
>>            --the ">" operator within logical tests
<END>         --.PE
<EOF>         --end of input
<ERROR>       --an error is considered valid input during error recovery
<NL>          --new line or ";"
<START>       --the .PS line
<corner>      --a compass corner or ".c", ".start", ".end" as appropriate
<envvar>      --environmental variable
<func1>       --numerical function with 1 argument
<func2>       --numerical function with 2 arguments
<param>       --".ht",".wid",".rad",".diam"
<primitiv>    --"box","circle","ellipse","arc","line","arrow","move","spline"

Differences between dpic and gpic:

Command-line options:  They are completely different, of course.

TeX mode:  Gpic puts \special commands into \box\graph.  Dpic does not
  generate tpic specials at all (although it could, some day, if there
  were reason to...) but produces LaTeX drawing (or other) commands.
  LaTeX drawing commands are very primitive, but are portable provided
  the usual fonts are available.

Dpic passes lines beginning with \ without inserting a % at the end.
  This character can be inserted as part of the input line if required.

for-loop and if bodies:  In gpic, a for loop has the form
    for variable = expr1 to expr2 [by [*]expr3] do X body X
  where X is any character not occurring in body, but { body }
  is also allowed.  In dpic only the latter is allowed.
  Similarly, in dpic, the required form of an if statement is
    if expr then { if-true } [else { if-false }]

line/spline/arrow/move at <position>:
  dpic treats the defaults for linear objects consistently with planar
  objects with respect to the 'at' modifier.  gpic treats them differently:

  in dpic, 'line at Here' means 'line with .center at Here'
    the location corresponding to 'last line' is last line.c

  in gpic, 'line at Here' means 'line from Here'
    the location corresponding to 'last line' is last line.start

  Be explicit in placing objects rather than relying on defaults. 

arc defaults:  gpic and dpic have different algorithms for picking
  a default radius.  The best practice is to specify arcs completely.
  Note the ambiguity in the pic language: 'arc cw rad x from A to B'
  does not uniquely define the arc.  Use 'arc cw from A to B with .c at C'
  instead.

print arg,...
  Dpic allows only one argument, which may be an expression, position,
  or string.  To print several quantities at once, use sprintf(...) to
  generate a string.

command arg,...
  As for print, send arbitrary commands to the output stream using sprintf(...)

sh { command } is the required form for a dpic shell (operating system) command.

copy:
  dpic supports the command
    copy "filename"
  but does not support the commands
    copy ["filename"] thru X body X [until "word"]
    copy ["filename"] thru macro [until "word"]

strings:
  dpic uses the backslash as an escape character within strings,
  so "\"" is a string containing the double quote, and "\$1" does
  not expand $1 as a macro argument.

  String dimensions are not scaled on final output in dpic, see
  arrowheads below.

plot
  Deprecated in gpic and not allowed in dpic.

rand(x)
  Deprecated in gpic and not allowed in dpic.

line thickness:
  A negative value is meaningless in dpic.

fill values:  in gpic, 0 is white, 1 is black.  Dpic uses 0 as black, 1 as
  white as does Postscript and the original pic.

scaling: Dpic has a "scaled" attribute, so that
  box scaled 1.2
  produces a box with dimensions scaled by 1.2, and
  [box; line scaled 3; circl] scaled 0.5
  scales all objects within the block by 0.5.

arrowheads:
  These depend on the output format, and consequently have limited variety.

  There is a subtle language problem with arrowheads.  Let us agree that the
  following examples should produce an arrow of length 1 inch and arrowhead
  width 1 millimetre:
    .PS
      arrow right 1 width 1/25.4
    .PE
    .PS
      scale = 25.4
      arrow right 25.4 width 1
    .PE
    .PS 1
      arrow right 1/4 width 1/25.4
    .PE

  The original (DWB) pic fails on the second example, insisting that
  arrowhead dimensions be given in inches.  Gpic fails on the third by
  scaling the arrowhead on final output.  Although it might be
  argued that this is a feature, it causes serious awkwardness
  when diagrams are to be scaled to exact final dimensions using the
  ".PS x" construction.  Dpic generates the same arrow in all three
  cases, treating arrowhead parameters like line thickness (unscaled)
  parameters on final output.

compass corners:
  dpic consistently requires a dot before compass corners, so the gpic line
    "x" at center of last box
  should be written for dpic as
    "x" at .center of last box

subscripted variables and locations:
  Dpic allows arrays of variables or positions, as an aid in geometric
  calculations such as fitting splines to a set of points.  Thus
  Pos[expression] is a valid name for a position.  The rounded integer
  value of the expression is used.  Similarly x[expression] is a valid
  variable name.  There are no array operations, but it is easy to write
  macros for them.

splines:
  Gpic extends the DWB pic grammar to make "line .5" legal and mean "a
  line of length .5 in the current direction." All linear objects are
  treated similarly.  Dpic does the same, except for splines.  In the
  statement "spline x from A to B then to C" the parameter x is a
  tension parameter between 0 and 1 to control the spline curvature.
  Furthermore if x is present, the curve is drawn starting from the
  first point of the first segment and to the last point of the last
  segment.  If x is not present as in the normal pic grammar, the curve
  begins with a straight line halfway along the first segment and ends
  with a straight line along the last half of the last segment.

vector arithmetic:
  The dpic grammar permits the following: X: Y + Z where Y and Z are
  defined positions.  Gpic requires X: Y + (Z.x,Z.y).  Dpic also allows
  scalar multiplication: X: Y*2, (but not X: 2*Y).

exec:
  In dpic the contents of a string can be executed using
   exec "string"
  or
   exec sprintf("string", args)
  as if the string were the next line of input.  This allows the programmed
  generation of labels, for example:
  for i=1 to 10 do { exec sprintf("A%g: %g,%g",i,i,i) }

A few additional mathematical functions are defined in dpic:
  "abs" "acos" "asin" "expe" "loge" "sign" "tan" "pmod"

color:
  From version 18, gpic allows coloured lines and filled objects as follows:
    <object> outlined "string"
    <object> shaded "string"
    <object> colored "string"
  where "string" is a colour included in quotes and where the third case
  is equivalent to
    <object> outline "string" shaded "string"
  Dpic supports these very basic options with PSTricks output, but more
  elabourate PSTricks options can also be invoked. For example, the sequence
    box shaded "lightgray,fillstyle=hlines*,linecolor=blue,
      hatchwidth=0.5pt,hatchsep=5pt,hatchcolor=red,hatchangle=45"
  produces a hatched multicoloured fill and is equivalent to
    command "\pscustom[fillcolor=lightgray,fillstyle=hlines*,linecolor=blue,"
    command "hatchwidth=0.5pt,hatchsep=5pt,hatchcolor=red,hatchangle=45]{%"
      box
    command "}%"
  The unaugmented pic language and its gpic extensions do not allow
  the filling of arbitrary closed curves other than boxes circles, and ellipses.
  Use the \pscustom function of PSTricks as shown for these.
