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

  1. /*
  2.   NAME   The_Prn.C  Copyright 1992-94, Rob W. Smetana All Rights Reserved.
  3.   ====
  4.           C INCLUDE 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.      1, Reserved, is 1 byte   (reserved for our development)
  29.      2, 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. typedef struct {
  70.  
  71. /* '=========== Start with a header (Printer manufacturer, model and emulation). */
  72.  
  73.   char reserved [1];                /* Reserved (for development) */
  74.  
  75.   char manufacturer [8];            /* eg., Epson, Panasonic, Star, etc. */
  76.  
  77.  
  78. /* =========== All remaining fields are 14 bytes. */
  79.  
  80.    char model [14];                 /* Specific printer model (eg., LQ-510) */
  81.  
  82.    char emmode [14];                /* If not blank, this describes the */
  83.                                     /* printer being emulated. */
  84.  
  85.                                     /* 44 bytes through here !!! */
  86. }   PrnHeader;
  87.  
  88.  
  89. typedef struct {
  90.  
  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. char Initialize [14];             /* Reset to power-on mode (many printers */
  102.                                   /* have no reset -- a shame). */
  103.  
  104. /* ...pitch/character sets/master attributes */
  105.  
  106. char pitch10ON [14];              /* Turn ON 10 characters-per-inch (CPI; Pica) */
  107. char pitch12ON [14];              /* Turn ON 12 CPI (eg., Elite) */
  108. char condensedON [14];            /* Turn ON Condensed mode (15-17 CPI) */
  109. char condensedOFF [14];           /* Turn Condensed mode OFF */
  110. char proportionalSpacing [14];    /* Turn ON Proportional Spacing */
  111. char fixedspacing [14];           /* Turn ON Fixed Spacing */
  112.  
  113. char selectcharset [14];          /* Select Character Set (USA, French, etc.) */
  114. char selectmasterfont [14];       /* Select Master Font (Roman, Prestige, etc.) */
  115. char selectprintstyle [14];       /* Select Elite, Condensed, etc.    */
  116. char draftmode [14];              /* Turn Draft Mode on (high speed)  */
  117. char nearletterquality [14];      /* Turn on Near-Letter Quality mode */
  118.  
  119. /* ... Line spacing */
  120.  
  121. char linesperinch6 [14];          /* Turn on 6 lines-per-inch (LPI) */
  122. char linesperinch8 [14];          /*   "  "  8    "   "   " */
  123. char linesPerinch12 [14];         /*   "  "  12   "   "   " */
  124.  
  125. char variablelinespace [14];      /* Change line spacing (LPI) -- fine increments */
  126. char altvariableline [14];        /* Alternate way to change line spacing */
  127.  
  128. /* ... Attributes/Emphasis/SuperScript/Etc */
  129.  
  130. char doublestrikeON [14];         /* Turn ON Double-Strike mode */
  131. char doublestrikeOFF [14];        /*   "  OFF  "       "     "  */
  132.  
  133. char doublewideON [14];           /* Turn Double-Wide ON  */
  134. char doublewideOFF [14];          /*   "    "     "   OFF */
  135.  
  136. char doubleheightON [14];         /* Turn Double-High ON  */
  137. char doubleheightOFF [14];        /*   "    "     "   OFF */
  138.  
  139. char emphasizedON [14];           /* Turn Emphasized mode ON  */
  140. char emphasizedOFF [14];          /*   "       "      "   OFF */
  141.  
  142. char boldON [14];                 /* Turn Bold mode ON  */
  143. char boldOFF [14];                /*   "   "     "  OFF */
  144.  
  145. char underlineON [14];            /* Turn Underline mode ON  */
  146. char underlineOFF [14];           /*   "       "     "   OFF */
  147.  
  148. char italicON [14];               /* Turn Italic mode ON  */
  149. char italicOFF [14];              /*   "     "     "   OFF */
  150.  
  151. char superscriptON [14];          /* Superscript ON  */
  152. char superscriptOFF [14];         /*     "       OFF */
  153.  
  154. char subscriptON [14];            /* Subscript ON  */
  155. char subscriptOFF [14];           /*     "     OFF */
  156.  
  157. /* ... Other */
  158.  
  159. char skipperforationON [14];      /* Skip perforation zone */
  160. char skipperforationOFF [14];     /* Turn OFF Skip perf.   */
  161.  
  162. char unidirectional [14];         /* Unidirectional print (for accuracy) */
  163. char bidirectional [14];          /* Bidirectional print (for speed)     */
  164.  
  165. char pushcursor [14];             /* (LaserJet) Push (save) cursor position */
  166. char popcursor [14];              /*      "     Pop  (restore) "       "    */
  167.  
  168. char pagelengthinches [14];       /* Set page length in INCHES */
  169. char pagelengthlines [14];        /* Set page length in LINES  */
  170.  
  171. char settabstops [14];            /* Set Tab Stops */
  172.  
  173. char settopmargin [14];           /* Set Top Margin */
  174. char setbottommargin [14];        /*  "  Bottom "   */
  175. char setleftmargin [14];          /*  "  Left   "   */
  176. char setrightmargin [14];         /*  "  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. char absvertical [14];            /* Move vertically to a specific Row (or dot) */
  184. char relvertical [14];            /* Move "y" rows/dots from where we are now */
  185.  
  186. char abshoriz [14];              /* Move horizontally to a column (or dot) */
  187. char relhoriz [14];              /* Move "x" columns/dots from where we are */
  188.  
  189. char intercharspace [14];         /* 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.     char user1 [14];
  196.     char user2 [14];
  197.     char user3 [14];
  198.     char user4 [14];
  199.     char user5 [14];
  200.     char user6 [14];
  201.     char user7 [14];
  202.     char user8 [14];
  203.     char user9 [14];
  204.    char user10 [14];
  205.    char user11 [14];
  206.    char user12 [14];
  207.    char user13 [14];
  208.    char user14 [14];
  209.    char user15 [14];
  210.    char user16 [14];
  211.    char user17 [14];
  212.                                        /* structure to 1024 bytes.*/
  213. } ThePrn;
  214.  
  215.