home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / THEPRN14.ZIP / THE_PRN.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-13  |  8KB  |  215 lines

  1.  
  2. (*
  3.   NAME   The_Prn.Pas  Copyright 1992-94, Rob W. Smetana All Rights Reserved.
  4.   ====   Pascal support file for The Printer (a printer code database).
  5.  
  6.   PURPOSE
  7.   =======
  8.  
  9.   An INCLUDE file providing the "field structure" of both Printer.Dat (large
  10.   database) and Printer.Cfg (small configuration file saved by Printer.Exe).
  11.  
  12.  
  13.   RECORD LAYOUT
  14.   =============
  15.  
  16.   "Records" (for each printer) are 1024 bytes in length.  In the main
  17.   database, there's 1 record for each printer (but see next paragraph).
  18.   The "Printer.Cfg" file saved by Printer.Exe or Edit.Exe contains TWO
  19.   1024 byte records.  The first contains labels, the 2nd contains
  20.   printer codes.
  21.  
  22.   In The Printer's database, a printer may have 2 or more records if it
  23.   can emulate 2 or more other printers.  In other words, each emulation
  24.   is treated as a separate printer. The field "EmMode" tells you which
  25.   printer is being emulated.
  26.  
  27.   ALL fields are STRINGS and all are 14 bytes long EXCEPT the first two:
  28.     - Reserved is 1 byte   (reserved for our development)
  29.     - Printer Manufacturer is 15 bytes
  30.  
  31.  
  32.   PLACEHOLDERS:  ASCII character 251 (√)
  33.   ============
  34.  
  35.   Some printer codes require "variables."  For example, to specify, say
  36.   3/48 inch line spacing (instead of the normal 6 lines per inch), you
  37.   send a code like Chr$(27);"L03" (for a Toshiba printer).  In this case
  38.   both "0" and "3" are variables.
  39.    - The database would store this code as:  L√√
  40.    - Escape is stored as ASCII character 27.
  41.    - ASCII 251 (√) is simply a "placeholder" which YOU must replace
  42.      with appropriate characters.
  43.  
  44.   You MUST replace the placeholder -- the printer code is meaningless
  45.   otherwise.
  46.  
  47.  
  48.   TWO TYPES
  49.   =========
  50.  
  51.   Below are 2 TYPES you may use to read printer records.
  52.  
  53.    * These TYPES can be used to read either the large database itself
  54.      (Printer.Dat) or the small config. file (Printer.Cfg) saved by
  55.      Printer.Exe when you select a printer.
  56.  
  57.    * The first TYPE (PrnHeader) reads the 1st 44 bytes of records.
  58.      Here you'll find the printer's Manufacturer, Model and Emulation mode.
  59.  
  60.    * The 2nd TYPE (ThePrn) will read/hold actual printer codes.
  61.  
  62.  
  63.   NOTE:  By separating these, if you don't care about the header, you're
  64.          not forced to keep it around.  Read it (with any 44-byte variable),
  65.          throw it away, then read just the printer codes.
  66. *)
  67.  
  68.  
  69. TYPE
  70.    PrnHeader = Record
  71.  
  72. { '=========== Start with a header (Printer manufacturer, model and emulation). }
  73.  
  74.            Reserved :Byte;             { Reserved (for development) }
  75.  
  76.        Manufacturer :Array[1..15] of Char; { eg., Epson, Panasonic, Star, etc. }
  77.  
  78.  
  79. { =========== All remaining fields are 14 bytes. }
  80.  
  81.               Model ,                  { Specific printer model (eg., LQ-510) }
  82.  
  83.              EmMode :Array[1..14] of Char; { If not blank, this describes the }
  84.                                            { printer being emulated. }
  85.  
  86.                                        { 44 bytes through here !!! }
  87. End;
  88.  
  89. TYPE
  90.    ThePrn = Record
  91. {========== 70, 14-byte printer codes follow.
  92.  
  93.             The last few are blank, "expansion" fields for our
  94.             use (if we add codes), or by you or your user.
  95.  
  96.             NOTE:  We may expand into these -- starting with the
  97.             first.  If you're concerned that later we might collide
  98.             with you, start your codes at the end, then move forward.
  99. }
  100.  
  101.          Initialize ,                 { Reset to power-on mode (many printers }
  102.                                       { have no reset -- a shame). }
  103.  
  104. { ...pitch/character sets/master attributes }
  105.  
  106.           Pitch10ON ,                 { Turn on 10 characters-per-inch (CPI; Pica) }
  107.           Pitch12ON ,                 { Turn on 12 CPI (eg., Elite) }
  108.         CondensedON ,                 { Turn on Condensed mode (15-17 CPI) }
  109.        CondensedOFF ,                 { Turn Condensed mode off }
  110. ProportionalSpacing ,                 { Turn on Proportional Spacing }
  111.        FixedSpacing ,                 { Turn on Fixed Spacing }
  112.  
  113.       SelectCharSet ,                 { Select Character Set (USA, French, etc.) }
  114.    SelectMasterFont ,                 { Select Master Font (Roman, Prestige, etc.) }
  115.    SelectPrintStyle ,                 { Select Elite, Condensed, etc. }
  116.           DraftMode ,                 { Turn Draft Mode on (high speed) }
  117.   NearLetterQuality ,                 { Turn on Near-Letter Quality mode }
  118.  
  119. { ... Line spacing }
  120.  
  121.       LinesPerInch6 ,                 { Turn on 6 lines-per-inch (LPI) }
  122.       LinesPerInch8 ,                 {   "  "  8    "   "   " }
  123.      LinesPerInch12 ,                 {   "  "  12   "   "   " }
  124.  
  125.   VariableLineSpace ,                 { Change line spacing (LPI) -- fine increments }
  126.     AltVariableLine ,                 { Alternate way to change line spacing }
  127.  
  128. { ... Attributes/Emphasis/SuperScript/Etc }
  129.  
  130.      DoubleStrikeON ,                 { Turn on Double-Strike mode }
  131.     DoubleStrikeOFF ,                 {   "  off  "       "     " }
  132.  
  133.        DoubleWideON ,                 { Turn Double-Wide on }
  134.       DoubleWideOFF ,                 {   "    "     "   off }
  135.  
  136.      DoubleHeightON ,                 { Turn Double-High on }
  137.     DoubleHeightOFF ,                 {   "    "     "   off }
  138.  
  139.        EmphasizedON ,                 { Turn Emphasized mode on }
  140.       EmphasizedOFF ,                 {   "       "      "   off }
  141.  
  142.              BoldOn ,                 { Turn Bold mode on }
  143.             BoldOff ,                 {   "   "     "   off }
  144.  
  145.         UnderlineON ,                 { Turn Underline mode on }
  146.        UnderlineOff ,                 {   "       "     "   off }
  147.  
  148.            ItalicON ,                 { Turn Italic mode on }
  149.           ItalicOff ,                 {   "     "     "   off }
  150.  
  151.       SuperScriptON ,                 { Superscript on }
  152.      SuperScriptOFF ,                 {     "       off }
  153.  
  154.         SubScriptON ,                 { Subscript on }
  155.        SubScriptOFF ,                 {     "     off }
  156.  
  157. { ... Other }
  158.  
  159.   SkipPerforationON ,                 { Skip perforation zone }
  160.  SkipPerforationOFF ,                 { Turn off Skip perf. }
  161.  
  162. UnidirectionalPrint ,                 { Unidirectional print on (for accuracy) }
  163.  BidirectionalPrint ,                 { Bidirectional print on (for speed) }
  164.  
  165.          PushCursor ,                 { (LaserJet) Push (save) cursor position }
  166.           PopCursor ,                 {      "     Pop (restore)  "       " }
  167.  
  168.    PageLengthInches ,                 { Set page length in INCHES }
  169.     PageLengthLines ,                 { Set page length in LINES }
  170.  
  171.         SetTabStops ,                 { Set Tab Stops }
  172.  
  173.        SetTopMargin ,                 { Set Top Margin }
  174.     SetBottomMargin ,                 {  "  Bottom " }
  175.       SetLeftMargin ,                 {  "  Left   " }
  176.      SetRightMargin ,                 {  "  Right  " }
  177.  
  178.  
  179. { ... The next 4 codes let you move to vertical or horizontal locations,   }
  180. {     either in absolute terms (ie., a specific row/column) or relative to }
  181. {     where you are (ie., move 5 dots down). }
  182.  
  183. AbsVerticalLocation ,                 { Move vertically to a specific Row (or dot) }
  184. RelVerticalLocation ,                 { Move "y" rows/dots from where we are now }
  185.  
  186.    AbsHorizLocation ,                 { Move horizontally to a column (or dot) }
  187.    RelHorizLocation ,                 { Move "x" columns/dots from where we are }
  188.  
  189.      InterCharSpace ,                 { Expand/shrink the spacing between }
  190.                                       { letters (some newer printers only) }
  191.  
  192.  
  193. { ... Expansion fields to give us, you or your users options to add codes. }
  194.  
  195.          User1 ,
  196.          User2 ,
  197.          User3 ,
  198.          User4 ,
  199.          User5 ,
  200.          User6 ,
  201.          User7 ,
  202.          User8 ,
  203.          User9 ,
  204.         User10 ,
  205.         User11 ,
  206.         User12 ,
  207.         User13 ,
  208.         User14 ,
  209.         User15 ,
  210.         User16 ,
  211.         User17 : Array[1..14] of Char; { This rounds out the     }
  212.                                        { structure to 1024 bytes.}
  213. End;
  214.  
  215.