Pic
Original authorsBrian Kernighan
(AT&T Bell Laboratories)
DeveloperVarious
Release1988; 38 years ago (1988)
Written inC (programming language), Yacc[1]
Operating systemUnix, Unix-like, Plan 9
PlatformCross-platform
TypeCommand, Graphics

In computing, Pic is a domain-specific programming language by Brian Kernighan for specifying line diagrams. The language contains predefined basic linear objects: line, move, arrow, and spline, the planar objects box, circle, ellipse, arc, and definable composite elements. Objects are placed with respect to other objects or absolute coordinates. A liberal interpretation of the input invokes default parameters when objects are incompletely specified. An interpreter translates this description into concrete drawing commands in a variety of possible output formats. Pic is a procedural programming language, with variable assignment, macros, conditionals, and looping. The language is an example of a little language originally intended for the comfort of non-programmers in the Unix environment (Bentley 1988).

History

edit

Pic was implemented using Yacc compiler-compiler.[1]

Implementations

edit

Pic was first implemented as a preprocessor in the troff document processing system but is now often used with LaTeX. The pic preprocessor filters a source document, replacing diagram descriptions by drawing commands in a specified format, and passing the rest of the document through without change. Alternatively, diagram source is passed through the preprocessor to produce a file for insertion into the document source.

A version of pic is included in groff, the GNU version of troff. GNU pic can also act as a preprocessor for TeX documents, emitting its own tpic DVI specials, which aren't as widely supported as those of other TeX graphic facilities.[2] Arbitrary diagram text can be included for formatting by the word processor to which the pic output is directed, and arbitrary graphic processor commands can also be included.

DPIC

edit

Dwight Aplevich's implementation, DPIC, can also generate pdf, postscript, svg, and other images by itself, as well as act as a preprocessor producing several LaTeX-compatible output formats. The three principal sources of pic processors are GNU pic, found on many Linux systems, and dpic, both of which are free, and the original AT&T pic.

Pikchr

edit

Pikchr (pronounced "picture") is a modern replacement for Pic in some contexts, designed to be embedded in Markdown, instead of troff or LaTeX. It should run most of the example scripts contained in the original technical report on Pic with little to no change.[3] Created by D. Richard Hipp, in August 2020,[4] it is used in Fossil, SQLite, and Subplot.

Alternatives

edit

Pic has some similarity with MetaPost and the DOT language.

See also

edit

References

edit
  1. ^ a b "UNIX Special: Profs Kernighan & Brailsford". Computerphile. September 30, 2015. Archived from the original on 2021-12-13.
  2. ^ Michel Goossens, Frank Mittelbach, Sebastian Rahtz, Denis Roegel, Herbert Voß (2008). The LaTeX Graphics Companion (2nd ed.). Addison-Wesley. pp. 17–20. ISBN 978-0-321-50892-8.{{cite book}}: CS1 maint: multiple names: authors list (link)
  3. ^ Hipp, Richard. "Differences Between Pikchr And Legacy-PIC". Pikchr. Retrieved 16 August 2021.
  4. ^ Hipp, Richard. "Check-in [d06dd0ebe7]". Pikchr. Retrieved 13 September 2020.
Notes
  • Kernighan, Brian W. (1982). "PIC - A Language for Typesetting Graphics". Software: Practice and Experience. 12 (12): 1–20. doi:10.1002/spe.4380120102. S2CID 59543886.
  • J. Bentley. More Programming Pearls, Addison-Wesley (1988).
edit
  • Making Pictures With GNU PIC
  • Troff resources (see the "pic" section)
  • DPIC, an implementation of the PIC language by Dwight Aplevich. This implementation has a few nice extensions and outputs many different image formats.
  • figr, web based pic renderer.
  • Brian W. Kernighan (1991). PIC — A Graphics Language for Typesetting. User Manual. CSTR #116 (Technical report) (Revised ed.). Bell Laboratories.
  • GNU pic2plot "takes one or more files in the pic language, and either displays the figures that they contain on an X Window System display, or produces an output file containing the figures. Many graphics file formats are supported."
  • The Circuit_macros distribution includes numerous examples of electric circuits and other objects of a sophistication well beyond the basic box-and-arrow diagrams in the original pic manuals. The examples employ dpic principally together with macros written in the pic and m4 macro languages.
  • Pikchr

📚 Artikel Terkait di Wikipedia

Troff

troff (/ˈtiːrɒf/), short for "typesetter roff", is the major component of a document processing system developed by Bell Labs for the Unix operating system

Groff (software)

pic and soelim. There are also several macro packages included that duplicate, expand on the capabilities of, or outright replace the standard troff macro

Brian Kernighan

Programming Language 1985: The AMPL programming language 1988: The pic typesetting language for troff The Elements of Programming Style (1974, 1978) with P. J.

List of Plan 9 applications

convert between troff's ms macros and html page – view FAX, image, graphic PostScript PDF, and typesetter output files pic, tpic – troff and tex preprocessors

The Unix Programming Environment

language parser with yacc and how to use troff with ms and mm to format documents, the preprocessors tbl, eqn, and pic, and making man pages with the man macro

Unix

systems, and included many related programs such as nroff, troff, tbl, eqn, refer, and pic. Some modern Unix systems also include packages such as TeX

Calgary corpus

commonly used 18 file version which include 4 additional text files in UNIX "troff" format, PAPER3 through PAPER6. The maintainers of the Canterbury corpus

Singer Corporation

set up a national sales force for CAT phototypesetting machines (of UNIX troff fame) made by another Massachusetts company, Graphic Systems Inc. This division