home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gs22.zip / LANGUAGE.DOC < prev    next >
Text File  |  1991-05-05  |  14KB  |  308 lines

  1.    Copyright (C) 1989, 1990, 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, language.doc, describes the Ghostscript language.
  23.  
  24. For an overview of Ghostscript and a list of the documentation files, see
  25. README.
  26.  
  27. The Ghostscript language bears a very strong resemblance to the PostScript
  28. (TM) language.  In fact, the current release of Ghostscript, unless
  29. otherwise noted, is intended to execute properly any source program that
  30. conforms to the definition of the Level 1 PostScript Language as presented
  31. in the December 1990 printing of the PostScript Language Reference Manual
  32. (Second Edition) published by Addison-Wesley, plus a subset of the Display
  33. PostScript and Level 2 PostScript operators (indicated below).
  34.  
  35. Some of the operators of the Ghostscript language are actually implemented
  36. as procedures.  For this reason, `bind' will not necessarily bind every
  37. `operator' of the language.
  38.  
  39. Extended PostScript Facilities
  40. ------------------------------
  41.  
  42. Aladdin Enterprises intends to extend Ghostscript over time to implement
  43. many of the facilities of Display PostScript and of Level 2 PostScript.
  44. The following operators provided in the current release are not part of
  45. the original Level 1 PostScript specification, and are intended to have
  46. the same meanings in Ghostscript as in Display PostScript or Level 2
  47. PostScript, unless otherwise noted.  Operators or categories marked with *
  48. have only a partial or dummy implementation.
  49.  
  50. Language features:
  51.     // syntax for immediately evaluated names
  52.     CR, LF, or CRLF as end-of-line
  53.  
  54. Character and font operators:
  55.     ISOLatin1Encoding, selectfont
  56.  
  57. Dictionary operators:
  58.     undef
  59.  
  60. File operators:
  61.     deletefile, eexec, filenameforall (MS-DOS and VMS only),
  62.     fileposition, renamefile, setfileposition
  63.  
  64. * Graphics state operators:
  65.     currentblackgeneration, currentcmykcolor, currentcolorscreen,
  66.     currentcolortransfer, currenthalftonephase, currentundercolorremoval,
  67.     setblackgeneration, setcmykcolor, setcolorscreen,
  68.     setcolortransfer, sethalftonephase, setundercolorremoval
  69.  
  70. Interpreter parameter operators:
  71.     currentcacheparams, setcacheparams
  72.  
  73. Packed array operators:
  74.     currentpacking, packedarray, setpacking 
  75.  
  76. Painting operators:
  77.     colorimage
  78.  
  79. Path construction operators:
  80.     arct
  81.  
  82. Ghostscript-specific additions
  83. ==============================
  84.  
  85. Miscellaneous
  86. -------------
  87.  
  88. ^Z is counted as whitespace.
  89.  
  90. readhexstring can take either a file or a string as the source of
  91. characters.  In the latter case, it leaves the remainder of the string on
  92. the stack, just as for the token operator.
  93.  
  94. run can take either a string or a file as its argument.  In the former
  95. case, it uses findlibfile to open the file (searching directories as
  96. needed).  In the latter case, it just runs the file, closing it at the
  97. end, and trapping errors just as for the string case.
  98.  
  99. Mathematical operators
  100. ----------------------
  101.     <number> arccos <number>
  102.         Computes the arc cosine of a number between -1 and 1.
  103.     <number> arcsin <number>
  104.         Computes the arc sine of a number between -1 and 1.
  105.  
  106. Dictionary operators
  107. --------------------
  108.     <dict> <integer> setmaxlength -
  109.         Changes the capacity of a dictionary, preserving its
  110.           contents.  Causes a dictfull error if the requested
  111.           capacity is less than the current number of occupied
  112.           entries.
  113.  
  114. String operators
  115. ----------------
  116.     <string|name|other> <patternString> stringmatch <boolean>
  117.         Determines whether the string or name matches the given
  118.           pattern.  In the pattern, `*' matches any substring of
  119.           the string, `?' matches any single character, and `\'
  120.           quotes the next character.  If the first argument is not
  121.           a string or name, stringmatch returns true if
  122.           patternString is a single *, and false otherwise.
  123.     <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
  124.         Encrypts fromString according to the algorithm for Adobe
  125.           Type 1 fonts, writing the result into toString.
  126.           toString must be at least as long as fromString or a
  127.           rangecheck error occurs.  state is the initial state of
  128.           the encryption algorithm (a 16-bit non-negative
  129.           integer); newState is the new state of the algorithm.
  130.     <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
  131.         Decrypts fromString according to the algorithm for Adobe
  132.           Type 1 fonts, writing the result into toString.  Other
  133.           specifications are as for type1encrypt.
  134.  
  135. Relational operators
  136. --------------------
  137.     <number|string> <number|string> max <number|string>
  138.         Returns the larger of two numbers or strings.
  139.     <number|string> <number|string> min <number|string>
  140.         Returns the smaller of two numbers or strings.
  141.  
  142. File operators
  143. --------------
  144.     <state> <file> type1decryptfile <newFile>
  145.         Creates a pseudo-file for decrypting a file that contains
  146.           hex characters (as for readhexstring) that represent an
  147.           encrypted string.  The pseudo-file is only available for
  148.           reading.
  149.     <string> findlibfile <file> true or <string> false
  150.         Opens the file of the given name for reading.  If the file
  151.           cannot be opened using the supplied name, searches
  152.           through directories as described in use.doc.  If the
  153.           search fails, findlibfile simply pushes false on the
  154.           stack and returns, rather than causing an error.
  155.     <file> <integer> unread -
  156.          Pushes back the given character onto the front of the
  157.           file.  If the file is only open for writing, or if the
  158.           C library call (ungetc) fails, causes an ioerror error.
  159.           If the integer is not in the range [0..255], causes
  160.           a rangecheck error.
  161.     <file> <device> writeppmfile -
  162.         Writes the contents of the device, which must be an image
  163.           device, onto the file, in Portable PixMap (ppm) format.
  164.           Does not close the file.
  165.  
  166. Miscellaneous operators
  167. -----------------------
  168.     - currenttime <number>
  169.         Returns the current value of a continuously-running timer,
  170.           in minutes.  The initial value of this timer is undefined.
  171.     <string> getenv   <string> true  or  false
  172.         Looks up a name in the shell environment.  If the name is
  173.           found, returns the corresponding value and true; if the
  174.           name is not found, returns false.
  175.     <name> <array> makeoperator <operator>
  176.         Constructs and returns a new operator that is actually the
  177.           given procedure in disguise.  The name is only used for
  178.           printing.  The operator has the executable attribute.
  179.     <string> <boolean> setdebug -
  180.         If the Ghostscript interpreter was built with the DEBUG
  181.           flag set, sets or resets any subset of the debugging
  182.           flags normally controlled by -Z in the command line.
  183.           Has no effect otherwise.
  184.  
  185. Graphics state operators
  186. ------------------------
  187.     - currentgscolor <color>
  188.         Returns a color object (a new kind of object) representing
  189.           the current color/gray from the graphics state.
  190.     <color> setgscolor -
  191.         Sets the current color in the graphics state according to
  192.           a color object.
  193.  
  194. Device operators
  195. ----------------
  196.     <index> getdevice <device>
  197.         Returns a device from the set of devices known to the
  198.           system.  The first device, which is default, is numbered
  199.           0.  If the index is out of range, causes a rangecheck
  200.           error.
  201.     <device> devicename <string>
  202.         Gets the name of a device.  The devices currently
  203.           supported are listed in gdevs.mak.
  204.     <matrix> <width> <height> <palette> makeimagedevice <device>
  205.         Makes a new device that accumulates an image in memory.
  206.           palette is an array of color objects that specify how
  207.           the pixel values will be interpreted, e.g., if you want
  208.           a monochrome image for which 0=white and 1=black, the
  209.           palette should be the result of executing
  210.             [ 1 setgray currentgscolor 0 setgray currentgscolor ]
  211.           The palette must contain exactly 2, 4, 16, or 256
  212.           entries, and must contain an entry for black and an
  213.           entry for white; aside from this, its contents are
  214.           arbitrary.  Each pixel occupies log2(colormap size)
  215.           bits.
  216.         Alternatively, palette can be null.  This is interpreted
  217.           as 32-bit-per-pixel color, where the four bytes of each
  218.           pixel are respectively unused, R, G, and B.
  219.         Note that one can also make an image device (with the same
  220.           colormap as an existing image device) using makedevice.
  221.         ****** NOTE: the current implementation of makeimagedevice
  222.           only supports 1-, 8-, and 32-bit-per-pixel devices. ******
  223.     <device> <index> <string> copyscanlines <substring>
  224.         Copies one or more scan lines from an image device into a
  225.           string, starting at a given scan line in the image.
  226.           The data is in the same format as for the image
  227.           operator.  Error if the device is not an image device or
  228.           if the string is too small to hold at least one complete
  229.           scan line.  Always copies an integral number of scan
  230.           lines.
  231.     <device> <matrix> <width> <height> makedevice <device>
  232.         Makes a new device just like an existing one, but with a
  233.           specified width, height, and initial transformation.
  234.           Note that the width is in pixels, not in bytes as in
  235.           framedevice.
  236.     <device> setdevice -
  237.         Sets the current device to the specified device.  Also
  238.           resets the transformation and clipping path to the
  239.           initial values for the device.
  240.     - currentdevice <device>
  241.         Gets the current device from the graphics state.
  242.     <device> <matrix> deviceparams <<mark>> <matrix> <width> <height>
  243.         Gets the parameters of a device.  Some devices may have
  244.           additional parameters betwen the mark and the matrix:
  245.           one should use cleartomark to remove the output of
  246.           deviceparams from the stack.
  247.     - flushpage -
  248.         On displays, flushes any buffered output, so that it
  249.           is guaranteed to show up on the screen; on printers,
  250.           has no effect.
  251.  
  252. Character operators
  253. -------------------
  254.     <string> type1addpath -
  255.         Adds the description of a character to the current path,
  256.           and then optionally renders the character.  The string
  257.           argument is a scalable description encoded in Adobe Type
  258.           1 format.  This operator is only valid in the context of
  259.           a show operator, like setcharwidth and setcachedevice.
  260.           It uses information from the current font, in addition
  261.           to the argument.
  262.     <image> <width> <height> <wx> <wy> <ox> <oy> <string>
  263.       type1imagepath <substring>
  264.         Converts an image (bitmap) description of a character into
  265.           a scalable description in Adobe Type 1 format.  The
  266.           current transformation matrix should be the same as the
  267.           FontMatrix of the font in which this character will be
  268.           used: this establishes the scaling relationship between
  269.           image pixels (the image is assumed to be 1 unit high in
  270.           user space) and the character coordinate system used in
  271.           the scalable description.  wx and wy are the character
  272.           width, and ox and oy are the character origin relative
  273.           to the lower left corner of the bitmap, in *pixels*.
  274.         All coordinates in the scalable description are rounded to
  275.           integers, so the coefficients in the FontMatrix should
  276.           be on the order of 1/N for some value of N that is
  277.           either a multiple of the height/width or is large
  278.           compared to the width and height.  (There is a
  279.           convention, which some P*stScr*pt programs rely on, that
  280.           N=1000.)
  281.         Note that the encoded description has *not* been subjected
  282.           to CharString encryption, which is necessary before the
  283.           description can be given to type1addpath: to do this,
  284.           follow the type1imagepath with
  285.             4330 exch dup type1encrypt exch pop
  286.         If the description is too complex to fit into the supplied
  287.           string, a limitcheck error results.  A good rule of
  288.           thumb is that the size of the string should be about 6
  289.           times the number of 1-bits in the image that are not
  290.           completely surrounded by other 1-bits.
  291.     <font> <char> Type1BuildChar -
  292.         This is not a new operator: rather, it is a name known
  293.           specially to the interpreter.  Whenever the interpreter
  294.           needs to render a character (during a ...show,
  295.           stringwidth, or charpath), it looks up the name
  296.           BuildChar in the font dictionary to find a procedure to
  297.           run.  If it does not find this name, and if the FontType
  298.           is 1, the interpreter instead uses the value (looked up
  299.           on the dictionary stack in the usual way) of the name
  300.           Type1BuildChar.
  301.         The standard definition of Type1BuildChar is in gs_fonts.ps.
  302.           Users should not need to redefine Type1BuildChar, except
  303.           perhaps for tracing or debugging.
  304.  
  305. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  306.  
  307. PostScript is a trademark of Adobe Systems, Incorporated.
  308.