home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / THEPRN14.ZIP / THE_PRN.BAS < prev    next >
BASIC Source File  |  1994-01-15  |  8KB  |  219 lines

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