home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / Printer.def < prev    next >
Encoding:
Text File  |  1993-11-03  |  8.8 KB  |  212 lines

  1. DEFINITION FOR C MODULE Printer ;
  2.  
  3. FROM SYSTEM    IMPORT LONGSET, SHORTSET, ADDRESS ;
  4. FROM Exec    IMPORT CMD_NONSTD, DevicePtr, Message, UnitPtr ;
  5. FROM Graphics    IMPORT RastPortPtr, ColorMapPtr ;
  6.  
  7. CONST
  8.   PRD_RAWWRITE     = CMD_NONSTD+0 ;
  9.   PRD_PRTCOMMAND = CMD_NONSTD+1 ;
  10.   PRD_DUMPRPORT     = CMD_NONSTD+2 ;
  11.   PRD_QUERY     = CMD_NONSTD+3 ;
  12.  
  13. (* printer command definitions *)
  14.  
  15.   aRIS    = 0;    (* ESCc  reset            ISO *)
  16.   aRIN    = 1;    (* ESC#1 initialize        +++ *)
  17.   aIND    = 2;    (* ESCD  lf            ISO *)
  18.   aNEL    = 3;    (* ESCE  return,lf        ISO *)
  19.   aRI    = 4;    (* ESCM  reverse lf        ISO *)
  20.  
  21.   aSGR0    = 5;    (* ESC[0m normal char set    ISO *)
  22.   aSGR3    = 6;    (* ESC[3m italics on        ISO *)
  23.   aSGR23= 7;    (* ESC[23m italics off        ISO *)
  24.   aSGR4    = 8;    (* ESC[4m underline on        ISO *)
  25.   aSGR24= 9;    (* ESC[24m underline off    ISO *)
  26.   aSGR1    = 10;    (* ESC[1m boldface on        ISO *)
  27.   aSGR22= 11;    (* ESC[22m boldface off        ISO *)
  28.   aSFC    = 12;    (* SGR30-39 set foreground colorISO *)
  29.   aSBC    = 13;    (* SGR40-49 set background colorISO *)
  30.  
  31.   aSHORP0 = 14;    (* ESC[0w normal pitch        DEC *)
  32.   aSHORP2 = 15;    (* ESC[2w elite on        DEC *)
  33.   aSHORP1 = 16;    (* ESC[1w elite off        DEC *)
  34.   aSHORP4 = 17;    (* ESC[4w condensed fine on    DEC *)
  35.   aSHORP3 = 18;    (* ESC[3w condensed off        DEC *)
  36.   aSHORP6 = 19;    (* ESC[6w enlarged on        DEC *)
  37.   aSHORP5 = 20;    (* ESC[5w enlarged off        DEC *)
  38.  
  39.   aDEN6    = 21;    (* ESC[6"z shadow print on    DEC (sort of) *)
  40.   aDEN5    = 22;    (* ESC[5"z shadow print off    DEC *)
  41.   aDEN4    = 23;    (* ESC[4"z doublestrike on    DEC *)
  42.   aDEN3    = 24;    (* ESC[3"z doublestrike off    DEC *)
  43.   aDEN2    = 25;    (* ESC[2"z NLQ on        DEC *)
  44.   aDEN1    = 26;    (* ESC[1"z NLQ off        DEC *)
  45.  
  46.   aSUS2    = 27;    (* ESC[2v superscript on    +++ *)
  47.   aSUS1    = 28;    (* ESC[1v superscript off    +++ *)
  48.   aSUS4    = 29;    (* ESC[4v subscript on        +++ *)
  49.   aSUS3    = 30;    (* ESC[3v subscript off        +++ *)
  50.   aSUS0    = 31;    (* ESC[0v normalize the line    +++ *)
  51.   aPLU    = 32;    (* ESCL  partial line up    ISO *)
  52.   aPLD    = 33;    (* ESCK  partial line down    ISO *)
  53.  
  54.   aFNT0    = 34;    (* ESC(B US char set or Typeface  0 (default)    *)
  55.   aFNT1    = 35;    (* ESC(R French char set    or Typeface  1    *)
  56.   aFNT2    = 36;    (* ESC(K German char set    or Typeface  2    *)
  57.   aFNT3    = 37;    (* ESC(A UK char set or Typeface  3        *)
  58.   aFNT4    = 38;    (* ESC(E Danish I char set or Typeface  4    *)
  59.   aFNT5    = 39;    (* ESC(H Sweden char set or Typeface  5        *)
  60.   aFNT6    = 40;    (* ESC(Y Italian char set or Typeface  6    *)
  61.   aFNT7    = 41;    (* ESC(Z Spanish char set or Typeface  7    *)
  62.   aFNT8    = 42;    (* ESC(J Japanese char set or Typeface  8    *)
  63.   aFNT9    = 43;    (* ESC(6 Norweign char set or Typeface  9    *)
  64.   aFNT10= 44;    (* ESC(C Danish II char set or Typeface 10    *)
  65.  
  66.  
  67. (*  Suggested typefaces are:    *)
  68. (*                *)
  69. (*  0 - default typeface.    *)
  70. (*  1 - Line Printer or equiv.    *)
  71. (*  2 - Pica or equiv.        *)
  72. (*  3 - Elite or equiv.        *)
  73. (*  4 - Helvetica or equiv.    *)
  74. (*  5 - Times Roman or equiv.    *)
  75. (*  6 - Gothic or equiv.    *)
  76. (*  7 - Script or equiv.    *)
  77. (*  8 - Prestige or equiv.    *)
  78. (*  9 - Caslon or equiv.    *)
  79. (* 10 - Orator or equiv.    *)
  80.  
  81.   aPROP2 = 45 ;    (* ESC[2p  proportional on    +++ *)
  82.   aPROP1 = 46 ;    (* ESC[1p  proportional off    +++ *)
  83.   aPROP0 = 47 ;    (* ESC[0p  proportional clear    +++ *)
  84.   aTSS     = 48 ;    (* ESC[n E set proportional offset ISO *)
  85.   aJFY5     = 49 ;    (* ESC[5 F auto left justify    ISO *)
  86.   aJFY7     = 50 ;    (* ESC[7 F auto right justify    ISO *)
  87.   aJFY6     = 51 ;    (* ESC[6 F auto full justify    ISO *)
  88.   aJFY0     = 52 ;    (* ESC[0 F auto justify off    ISO *)
  89.   aJFY3     = 53 ;    (* ESC[3 F letter space (justify) ISO (special) *)
  90.   aJFY1     = 54 ;    (* ESC[1 F word fill(auto center) ISO (special) *)
  91.  
  92.   aVERP0 = 55 ;    (* ESC[0z  1/8" line spacing    +++ *)
  93.   aVERP1 = 56 ;    (* ESC[1z  1/6" line spacing    +++ *)
  94.   aSLPP     = 57 ;    (* ESC[nt  set form length n    DEC *)
  95.   aPERF     = 58 ;    (* ESC[nq  perf skip n (n>0)    +++ *)
  96.   aPERF0 = 59 ;    (* ESC[0q  perf skip off    +++ *)
  97.  
  98.   aLMS    = 60 ;    (* ESC#9   Left margin set    +++ *)
  99.   aRMS    = 61 ;    (* ESC#0   Right margin set    +++ *)
  100.   aTMS    = 62 ;    (* ESC#8   Top margin set    +++ *)
  101.   aBMS    = 63 ;    (* ESC#2   Bottom marg set    +++ *)
  102.   aSTBM    = 64 ;    (* ESC[Pn1;Pn2r  T&B margins    DEC *)
  103.   aSLRM    = 65 ;    (* ESC[Pn1;Pn2s  L&R margin    DEC *)
  104.   aCAM    = 66 ;    (* ESC#3   Clear margins    +++ *)
  105.  
  106.   aHTS      = 67 ;(* ESCH    Set horiz tab    ISO *)
  107.   aVTS      = 68 ;(* ESCJ    Set vertical tabs    ISO *)
  108.   aTBC0      = 69 ;(* ESC[0g  Clr horiz tab    ISO *)
  109.   aTBC3      = 70 ;(* ESC[3g  Clear all h tab    ISO *)
  110.   aTBC1      = 71 ;(* ESC[1g  Clr vertical tabs    ISO *)
  111.   aTBC4      = 72 ;(* ESC[4g  Clr all v tabs    ISO *)
  112.   aTBCALL = 73 ;(* ESC#4   Clr all h & v tabs    +++ *)
  113.   aTBSALL = 74 ;(* ESC#5   Set default tabs    +++ *)
  114.   aEXTEND = 75 ;(* ESC[Pn"x extended commands    +++ *)
  115.  
  116.   aRAW      = 76 ;(* ESC[Pn"r Next 'Pn' chars are raw +++ *)
  117.  
  118. TYPE
  119.     IOPrtCmdReqPtr = POINTER TO IOPrtCmdReq    ;
  120.     IODRPReqPtr       = POINTER TO IODRPReq    ;
  121.  
  122.     IOPrtCmdReq = RECORD
  123.     io_Message    : Message   ;
  124.     io_Device    : DevicePtr ;    (* (DevicePtr) device node pointer  *)
  125.     io_Unit        : UnitPtr   ;    (* (UnitPtr) unit (driver private)  *)
  126.     io_Command    : CARDINAL  ;    (* device command            *)
  127.     io_Flags    : SHORTSET  ;
  128.     io_Error    : SHORTINT  ;    (* error or warning num            *)
  129.     io_PrtCommand    : CARDINAL  ;    (* printer command            *)
  130.     io_Parm0    : SHORTCARD ;    (* first command parameter        *)
  131.     io_Parm1    : SHORTCARD ;    (* second command parameter        *)
  132.     io_Parm2    : SHORTCARD ;    (* third command parameter        *)
  133.     io_Parm3    : SHORTCARD ;    (* fourth command parameter        *)
  134.     END ;
  135.  
  136.     IODRPReq = RECORD
  137.     io_Message    : Message     ;
  138.     io_Device    : DevicePtr   ;    (* (DevicePtr) device node pointer  *)
  139.     io_Unit        : UnitPtr     ;    (* (UnitPtr) unit (driver private)  *)
  140.     io_Command    : CARDINAL    ;    (* device command            *)
  141.     io_Flags    : SHORTSET    ;
  142.     io_Error    : SHORTINT    ;    (* error or warning num            *)
  143.     io_RastPort    : RastPortPtr ;    (* raster port                *)
  144.     io_ColorMap    : ColorMapPtr ;    (* color map                *)
  145.     io_Modes    : LONGSET     ;    (* graphics viewport modes        *)
  146.     io_SrcX        : CARDINAL    ;    (* source x origin            *)
  147.     io_SrcY        : CARDINAL    ;    (* source y origin            *)
  148.     io_SrcWidth    : CARDINAL    ;    (* source x width            *)
  149.     io_SrcHeight    : CARDINAL    ;    (* source x height            *)
  150.     io_DestCols    : LONGINT     ;    (* destination x width            *)
  151.     io_DestRows    : LONGINT     ;    (* destination y height            *)
  152.     io_Special    : BITSET      ;    (* option flags                *)
  153.     END ;
  154.  
  155. CONST
  156.   SPECIAL_MILCOLS    = {0} ;        (* DestCols specified in 1/1000"      *)
  157.   SPECIAL_MILROWS    = {1} ;        (* DestRows specified in 1/1000"      *)
  158.   SPECIAL_FULLCOLS    = {2} ;     (* make DestCols maximum possible     *)
  159.   SPECIAL_FULLROWS    = {3} ;        (* make DestRows maximum possible     *)
  160.   SPECIAL_FRACCOLS    = {4} ;        (* DestCols is fraction of FULLCOLS   *)
  161.   SPECIAL_FRACROWS    = {5} ;        (* DestRows is fraction of FULLROWS   *)
  162.   SPECIAL_CENTER    = {6} ;        (* center image on paper          *)
  163.   SPECIAL_ASPECT    = {7} ;        (* ensure correct aspect ratio          *)
  164.   SPECIAL_DENSITY1    = {8} ;        (* lowest resolution (dpi)          *)
  165.   SPECIAL_DENSITY2    = {9} ;        (* next res                  *)
  166.   SPECIAL_DENSITY3    = {8,9} ;    (* next res                  *)
  167.   SPECIAL_DENSITY4    = {10} ;    (* next res                  *)
  168.   SPECIAL_DENSITY5    = {8,10} ;    (* next res                  *)
  169.   SPECIAL_DENSITY6    = {9,10} ;    (* next res                  *)
  170.   SPECIAL_DENSITY7    = {8..10} ;    (* highest res                  *)
  171.   SPECIAL_NOFORMFEED    = {11} ;    (* don't eject paper on gfx prints    *)
  172.   SPECIAL_TRUSTME    = {12} ;      (* don't reset on gfx prints          *)
  173.  
  174.  
  175. (*  Compute print size, set 'io_DestCols' and 'io_DestRows' in the calling    *)
  176. (*  program's 'IODRPReq' structure and exit, DON'T PRINT.  This allows the    *)
  177. (*  calling program to see what the final print size would be in printer      *)
  178. (*  pixels.Note that it modifies the 'io_DestCols' and 'io_DestRows'          *)
  179. (*  fields of your 'IODRPReq' structure.  Also, set the print density and     *)
  180. (*  update the 'MaxXDots', 'MaxYDots', 'XDotsInch', and 'YDotsInch' fields    *)
  181. (*  of the 'PrinterExtendedData' structure.                      *)
  182.  
  183.  
  184.   SPECIAL_NOPRINT    = {13};    (* see above *)
  185.  
  186.   PDERR_NOERR        = 0 ; (* clean exit, no errors            *)
  187.   PDERR_CANCEL        = 1 ; (* user cancelled print            *)
  188.   PDERR_NOTGRAPHICS    = 2 ; (* printer cannot output graphics        *)
  189.   PDERR_INVERTHAM    = 3 ; (* OBSOLETE                *)
  190.   PDERR_BADDIMENSION    = 4 ; (* print dimensions illegal        *)
  191.   PDERR_DIMENSIONOVFLOW = 5 ; (* OBSOLETE                *)
  192.   PDERR_INTERNALMEMORY  = 6 ; (* no memory for internal variables    *)
  193.   PDERR_BUFFERMEMORY    = 7 ; (* no memory for print buffer        *)
  194.  
  195. (*  Note : this is an internal error that can be returned from the render *)
  196. (*  function to the printer device.It is NEVER returned to the user.      *)
  197. (*  If the printer device sees this error it converts it 'PDERR_NOERR'      *)
  198. (*  and exits gracefully.  Refer to the document on              *)
  199. (*  'How to Write a Graphics Printer Driver' for more info.          *)
  200.  
  201.   PDERR_TOOKCONTROL    = 8 ;    (* Took control in case 0 of render *)
  202.  
  203. (* internal use *)
  204.  
  205.   SPECIAL_DENSITYMASK     = {8..10} ;    (* masks out density values *)
  206.  
  207.   SPECIAL_DIMENSIONSMASK = SPECIAL_MILCOLS + SPECIAL_MILROWS + SPECIAL_FULLCOLS
  208.                  + SPECIAL_FULLROWS + SPECIAL_FRACCOLS +
  209.                  SPECIAL_FRACROWS + SPECIAL_ASPECT ;
  210.  
  211. END Printer.
  212.