Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/groff-base/html/ drwxr-xr-x |
Viewing file: Select action/file-type: [ prev | next | top ] 21. PIC ReferenceThis is an annotated grammar of pic. 21.1. Lexical ItemsIn general, pic is a free-format, token-oriented language that ignores whitespace outside strings. But certain lines and contructs are specially interpreted at the lexical level: A comment begins with # and continues to \n (comments may also follow text in a line). A line beginning with a period or backslash may be interpreted as text to be passed through to the post-processor, depending on command-line options. An end-of-line backslash is interpreted as a request to continue the line; the backslash and following newline are ignored. Here are the grammar terminals:
NUMBER
sprintf ( TEXT [, <expr> ...] ) except after the ‘until’ and ‘last’ keywords, and after all ordinal keywords (‘th’ and friends).
A string starting with a character from the set [a-z], optionally followed by one or more characters of the set [a-zA-Z0-9_]. (Values of variables are preserved across pictures.)
COMMAND-LINE
BALANCED-TEXT
BALANCED-BODY
FILENAME
MACRONAME
21.2. Semi-Formal GrammarTokens not enclosed in 〈 〉 are literals, except:
If one of these special tokens has to be referred to literally, it is surrounded with single quotes. The top-level pic object is a picture. <picture>
::= The arguments, if present, represent the width and height of the picture, causing pic to attempt to scale it to the given dimensions in inches. In no case, however, the X and Y dimensions of the picture exceed the values of the style variables maxpswid and maxpsheight (which default to the normal 8.5i by 11i page size). If the ending ‘.PE’ is replaced by ‘.PF’, the page vertical position is restored to its value at the time ‘.PS’ was encountered. Another alternate form of invocation is ‘.PS < FILENAME ’, which replaces the ‘.PS’ line with a file to be interpreted by pic (but this feature is deprecated). The ‘.PS’, ‘.PE’, and ‘.PF’ macros to perform centering and scaling are normally supplied by the post-processor. In the following, either ‘|’ or a new line starts an alternative. <statement>
::= <command>
::= <print-arg>
::= The current position and direction are saved on entry to a ‘{ ... }’ construction and restored on exit from it. Note that in ‘if’ constructions, newlines can only occur in BALANCED-BODY . This means that if
fails. You have to use the braces on the same line as the keywords: if
{ This restriction doesn’t hold for the body after the ‘do’ in a ‘for’ construction. At the beginning of each picture, ‘figname’ is reset to the vbox name ‘graph’; this command has only a meaning in TeX mode. While the grammar rules allow digits and the underscore in the value of ‘figname’, TeX normally accepts uppercase and lowercase letters only as box names (you have to use ‘\csname’ if you really need to circumvent this limitation). <any-expr>
::= <logical-op>
::= <text-expr>
::= Logical operators are handled specially by pic since they can deal with text strings also. pic uses strcmp(3) to test for equality of strings; an empty string is considered as ‘false’ for ‘&&’ and ‘||’. <primitive>
::= Drawn objects within ‘[ ... ]’ are treated as a single composite object with a rectangular shape (that of the bounding box of all the elements). Variable and label assignments within a block are local to the block. Current direction of motion is restored to the value at start of block upon exit. Position is not restored (unlike ‘{ }’); instead, the current position becomes the exit position for the current direction on the block’s bounding box. <attribute>
::= Missing attributes are supplied from defaults; inappropriate ones are silently ignored. For lines, splines, and arcs, height and width refer to arrowhead size. The ‘at’ primitive sets the center of the current object. The ‘with’ attribute fixes the specified feature of the given object to a specified location. (Note that ‘with’ is incorrectly described in the Kernighan paper.) The ‘by’ primitive is not documented in the tutorial portion of the Kernighan paper, and should probably be considered unreliable. The primitive ‘arrow’ is a synonym for ‘line ->’. Text is normally an attribute of some object, in which case successive strings are vertically stacked and centered on the object’s center by default. Standalone text is treated as though placed in an invisible box. A text item consists of a string or sprintf-expression, optionally followed by positioning information. Text (or strings specified with ‘sprintf’) may contain font changes, size changes, and local motions, provided those changes are undone before the end of the current item. Text may also contain \-escapes denoting special characters. The base font and specific set of escapes supported is implementation dependent, but supported escapes always include the following:
Set Roman style (the default)
Set Italic style
Set Bold style
Revert to previous style; only works one level deep, does not stack. Color names are dependent on the pic implementation, but in all modern versions color names recognized by the X window system are supported. A position is an (x,y) coordinate pair. There are lots of different ways to specify positions: <position>
::= <position-not-place>
::= <expr-pair>
::= <place>
::= <label>
::= <corner>
::= <xxx-of>
::= <nth-primitive>
::= <ordinal>
::= <object-type>
::= As Kernighan notes, “since barbarisms like 1th and 3th are barbaric, synonyms like 1st and 3rd are accepted as well.” Objects of a given type are numbered from 1 upwards in order of declaration; the last modifier counts backwards. The “’th” form (which allows you to select a previous object with an expression, as opposed to a numeric literal) is not documented in DWB’s pic(1). The 〈 xxx-of〉 rule is special: The lexical parser checks whether xxx is followed by the token ‘of’ without eliminating it so that the grammar parser can still see ‘of’. Valid examples of specifying a place with corner and label are thus A
.n while north
A both cause a syntax error. (DWB pic also allows the weird form ‘A north of’.) Here the special rules for the ‘with’ keyword using a path: <path>
::= <relative-path>
::= The following style variables control output: Any of these can be set by assignment, or reset using the reset statement. Style variables assigned within ‘[ ]’ blocks are restored to their beginning-of-block value on exit; top-level assignments persist across pictures. Dimensions are divided by scale on output. All pic expressions are evaluated in floating point; units are always inches (a trailing ‘i’ or ‘I’ is ignored). Expressions have the following simple grammar, with semantics very similar to C expressions: <expr>
::= <place-attribute>
<op>
::= <func1>
::= <func2>
::= Both exp and log are base 10; int does integer truncation; and rand() returns a random number in [0-1). There are define and undef statements which are not part of the grammar (they behave as pre-processor macros to the language). These may be used to define pseudo-functions. define name { replacement-text } This defines name as a macro to be replaced by the replacement text (not including the braces). The macro may be called as name(arg1, arg2, ..., argn) The arguments (if any) are substituted for tokens $1, $2 ... $n appearing in the replacement text. To undefine a macro, say undef name, specifying the name to be undefined. [ prev | next | top ] |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0043 ]-- |