home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / Printer.def < prev    next >
Text File  |  1996-09-07  |  9KB  |  231 lines

  1. (*$ Implementation- *)
  2. DEFINITION MODULE Printer;
  3. (* 4-Sep-96/Stefan Tiemann for Cyclone *)
  4. (* Converted from C-include: printer.h 1.7 (26.7.90), Includes Release 40.15 *)
  5.  
  6. IMPORT ED: ExecD;
  7. IMPORT GD: GraphicsD;
  8.  
  9. CONST
  10.   rawWrite= ED.nonstd+0;
  11.   prtCommand= ED.nonstd+1;
  12.   dumpRPort= ED.nonstd+2;
  13.   query= ED.nonstd+3;
  14.  
  15.   printerName= "printer.device";
  16.  
  17. (* printer command definitions *)
  18.  
  19.  ris=     0;  (* ESCc  reset              ISO *)
  20.  rin=     1;  (* ESC#1 initialize          +++ *)
  21.  ind=     2;  (* ESCD  lf              ISO *)
  22.  nel=     3;  (* ESCE  return,lf              ISO *)
  23.  ri=     4;  (* ESCM  reverse lf          ISO *)
  24.  asgr0=     5;  (* ESC[0m normal char set          ISO *)
  25.  sgr3=     6;  (* ESC[3m italics on          ISO *)
  26.  sgr23=     7;  (* ESC[23m italics off          ISO *)
  27.  sgr4=     8;  (* ESC[4m underline on          ISO *)
  28.  sgr24=     9;  (* ESC[24m underline off          ISO *)
  29.  sgr1=    10;  (* ESC[1m boldface on          ISO *)
  30.  sgr22=    11;  (* ESC[22m boldface off          ISO *)
  31.  sfc=    12;  (* SGR30-39  set foreground color ISO *)
  32.  sbc=    13;  (* SGR40-49  set background color ISO *)
  33.  
  34.  shorp0= 14;  (* ESC[0w normal pitch          DEC *)
  35.  shorp2= 15;  (* ESC[2w elite on              DEC *)
  36.  shorp1= 16;  (* ESC[1w elite off          DEC *)
  37.  shorp4= 17;  (* ESC[4w condensed fine on       DEC *)
  38.  shorp3= 18;  (* ESC[3w condensed off          DEC *)
  39.  shorp6= 19;  (* ESC[6w enlarged on          DEC *)
  40.  shorp5= 20;  (* ESC[5w enlarged off          DEC *)
  41.  
  42.  den6=    21;  (* ESC[6"z shadow print on          DEC (sort of) *)
  43.  den5=    22;  (* ESC[5"z shadow print off       DEC *)
  44.  den4=    23;  (* ESC[4"z doublestrike on          DEC *)
  45.  den3=    24;  (* ESC[3"z doublestrike off       DEC *)
  46.  den2=    25;  (* ESC[2"z    NLQ on              DEC *)
  47.  den1=    26;  (* ESC[1"z    NLQ off          DEC *)
  48.  
  49.  sus2=    27;  (* ESC[2v superscript on          +++ *)
  50.  sus1=    28;  (* ESC[1v superscript off          +++ *)
  51.  sus4=    29;  (* ESC[4v subscript on          +++ *)
  52.  sus3=    30;  (* ESC[3v subscript off          +++ *)
  53.  sus0=    31;  (* ESC[0v normalize the line      +++ *)
  54.  plu=    32;  (* ESCL  partial line up          ISO *)
  55.  pld=    33;  (* ESCK  partial line down          ISO *)
  56.  
  57.  fnt0=    34;  (* ESC(B US char set    or Typeface  0 (default) *)
  58.  fnt1=    35;  (* ESC(R French char set    or Typeface  1 *)
  59.  fnt2=    36;  (* ESC(K German char set    or Typeface  2 *)
  60.  fnt3=    37;  (* ESC(A UK char set    or Typeface  3 *)
  61.  fnt4=    38;  (* ESC(E Danish I char set    or Typeface  4 *)
  62.  fnt5=    39;  (* ESC(H Sweden char set    or Typeface  5 *)
  63.  fnt6=    40;  (* ESC(Y Italian char set    or Typeface  6 *)
  64.  fnt7=    41;  (* ESC(Z Spanish char set    or Typeface  7 *)
  65.  fnt8=    42;  (* ESC(J Japanese char set    or Typeface  8 *)
  66.  fnt9=    43;  (* ESC(6 Norweign char set    or Typeface  9 *)
  67.  fnt10=    44;  (* ESC(C Danish II char set or Typeface 10 *)
  68.  
  69. (*
  70.     Suggested typefaces are:
  71.  
  72.      0 - default typeface.
  73.      1 - Line Printer or equiv.
  74.      2 - Pica or equiv.
  75.      3 - Elite or equiv.
  76.      4 - Helvetica or equiv.
  77.      5 - Times Roman or equiv.
  78.      6 - Gothic or equiv.
  79.      7 - Script or equiv.
  80.      8 - Prestige or equiv.
  81.      9 - Caslon or equiv.
  82.     10 - Orator or equiv.
  83. *)
  84.  
  85.  prop2=    45;  (* ESC[2p  proportional on          +++ *)
  86.  prop1=    46;  (* ESC[1p  proportional off       +++ *)
  87.  prop0=    47;  (* ESC[0p  proportional clear     +++ *)
  88.  tss=    48;  (* ESC[n E set proportional offset ISO *)
  89.  jfy5=    49;  (* ESC[5 F auto left justify      ISO *)
  90.  jfy7=    50;  (* ESC[7 F auto right justify     ISO *)
  91.  jfy6=    51;  (* ESC[6 F auto full justify      ISO *)
  92.  jfy0=    52;  (* ESC[0 F auto justify off       ISO *)
  93.  jfy3=    53;  (* ESC[3 F letter space (justify) ISO (special) *)
  94.  jfy1=    54;  (* ESC[1 F word fill(auto center) ISO (special) *)
  95.  
  96.  verp0=    55;  (* ESC[0z  1/8" line spacing      +++ *)
  97.  verp1=    56;  (* ESC[1z  1/6" line spacing      +++ *)
  98.  slpp=    57;  (* ESC[nt  set form length n      DEC *)
  99.  perf=    58;  (* ESC[nq  perf skip n (n>0)      +++ *)
  100.  perf0=    59;  (* ESC[0q  perf skip off          +++ *)
  101.  
  102.  lms=    60;  (* ESC#9   Left margin set          +++ *)
  103.  rms=    61;  (* ESC#0   Right margin set       +++ *)
  104.  tms=    62;  (* ESC#8   Top margin set          +++ *)
  105.  bms=    63;  (* ESC#2   Bottom marg set          +++ *)
  106.  stbm=    64;  (* ESC[Pn1;Pn2r  T&B margins      DEC *)
  107.  slrm=    65;  (* ESC[Pn1;Pn2s  L&R margin       DEC *)
  108.  cam=    66;  (* ESC#3   Clear margins          +++ *)
  109.  
  110.  hts=    67;  (* ESCH    Set horiz tab          ISO *)
  111.  vts=    68;  (* ESCJ    Set vertical tabs      ISO *)
  112.  tbc0=    69;  (* ESC[0g  Clr horiz tab          ISO *)
  113.  tbc3=    70;  (* ESC[3g  Clear all h tab          ISO *)
  114.  tbc1=    71;  (* ESC[1g  Clr vertical tabs      ISO *)
  115.  tbc4=    72;  (* ESC[4g  Clr all v tabs          ISO *)
  116.  tbcall= 73;  (* ESC#4   Clr all h & v tabs     +++ *)
  117.  tbsall= 74;  (* ESC#5   Set default tabs       +++ *)
  118.  extend= 75;  (* ESC[Pn"x extended commands     +++ *)
  119.  
  120.  raw=    76;    (* ESC[Pn"r    Next 'Pn' chars are raw +++ *)
  121.  
  122. TYPE
  123.  Error= (noErr,            (* clean exit, no errors *)
  124.          cancel,            (* user cancelled print *)
  125.          notGraphics,        (* printer cannot output graphics *)
  126.          invertHam,            (* OBSOLETE *)
  127.          badDimension,        (* print dimensions illegal *)
  128.          dimensionOvflow,    (* OBSOLETE *)
  129.          internalMemory,        (* no memory for internal variables *)
  130.          bufferMemory,        (* no memory for print buffer *)
  131. (*
  132.     Note : this is an internal error that can be returned from the render
  133.     function to the printer device.  It is NEVER returned to the user.
  134.     If the printer device sees this error it converts it 'PDERR_NOERR'
  135.     and exits gracefully.  Refer to the document on
  136.     'How to Write a Graphics Printer Driver' for more info.
  137. *)
  138.          tookControl    (* Took control in case 0 of render *)
  139.         );
  140. TYPE
  141.  IOPrtCmdReq= RECORD
  142.     message: ED.Message;
  143.     device : ED.DevicePtr;     (* device node pointer  *)
  144.     unit: ED.UnitPtr;        (* unit (driver private)*)
  145.     command: CARDINAL;        (* device command *)
  146.     flags: ED.IOFlagSet;
  147.     error: Error;            (* error or warning num *)
  148.     prtCommand: CARDINAL;        (* printer command *)
  149.     parm0: SHORTCARD;            (* first command parameter *)
  150.     parm1: SHORTCARD;            (* second command parameter *)
  151.     parm2: SHORTCARD;            (* third command parameter *)
  152.     parm3: SHORTCARD;            (* fourth command parameter *)
  153.  END;
  154.  IOPrtCmdReqPtr= POINTER TO IOPrtCmdReq;
  155.  
  156.  
  157.  Special= (milCols,    (* DestCols specified in 1/1000" *)
  158.            milRows,    (* DestRows specified in 1/1000" *)
  159.            fullCols,    (* make DestCols maximum possible *)
  160.            fullRows,    (* make DestRows maximum possible *)
  161.            fracCols, (* DestCols is fraction of FULLCOLS *)
  162.            fracRows,    (* DestRows is fraction of FULLROWS *)
  163.            center,    (* center image on paper *)
  164.            aspect,    (* ensure correct aspect ratio *)
  165.            density1,    (* lowest resolution (dpi) *)
  166.            density2,    (* next res *)
  167.            density4,    (* next res *)
  168.            noFormFeed,    (* don't eject paper on gfx prints *)
  169.            trustMe,    (* don't reset on gfx prints *)
  170. (*
  171.     Compute print size, set 'io_DestCols' and 'io_DestRows' in the calling
  172.     program's 'IODRPReq' structure and exit, DON'T PRINT.  This allows the
  173.     calling program to see what the final print size would be in printer
  174.     pixels.  Note that it modifies the 'io_DestCols' and 'io_DestRows'
  175.     fields of your 'IODRPReq' structure.  Also, set the print density and
  176.     update the 'MaxXDots', 'MaxYDots', 'XDotsInch', and 'YDotsInch' fields
  177.     of the 'PrinterExtendedData' structure.
  178. *)
  179.            noPrint,    (* see above *)
  180.            s14,s15
  181.           );
  182.  SpecialSet= SET OF Special;
  183. (* internal use *)
  184. CONST
  185.  density3= SpecialSet{density1,density2};
  186.  density5= SpecialSet{density1,density4};
  187.  density6= SpecialSet{density2,density4};
  188.  density7= SpecialSet{density1..density4};
  189.  densityMask= SpecialSet{density1..density4};    (* masks out density values *)
  190.  dimensionMask= SpecialSet{milCols..fracRows,aspect};
  191.  
  192. TYPE
  193.  IODRPReq= RECORD
  194.     message: ED.Message;
  195.     device: ED.DevicePtr;     (* device node pointer  *)
  196.     unit: ED.UnitPtr;        (* unit (driver private)*)
  197.     command: CARDINAL;        (* device command *)
  198.     flags: ED.IOFlagSet;
  199.     error: Error;            (* error or warning num *)
  200.     rastPort: GD.RastPortPtr;  (* raster port *)
  201.     colorMap: GD.ColorMapPtr;  (* color map *)
  202.     modesHi: CARDINAL;            (* graphics viewport modes *) // must be set to 0!!!
  203.     modes: GD.ViewModeSet;
  204.     srcX: CARDINAL;            (* source x origin *)
  205.     srcY: CARDINAL;            (* source y origin *)
  206.     srcWidth: CARDINAL;        (* source x width *)
  207.     srcHeight: CARDINAL;        (* source x height *)
  208.     destCols: LONGINT;        (* destination x width *)
  209.     destRows: LONGINT;        (* destination y height *)
  210.     special: SpecialSet;        (* option flags *)
  211.  END;
  212.  IODRPReqPtr= POINTER TO IODRPReq;
  213.  
  214.  
  215.  // M2Amiga compatibility
  216.  PrinterIO = RECORD
  217.   CASE :INTEGER OF
  218.   | 0: ios: ED.IOStdReq;
  219.   | 1: iodrp: IODRPReq;
  220.   | 2: iopc: IOPrtCmdReq;
  221.   END;
  222.  END;
  223.  PrinterIOPtr= POINTER TO PrinterIO;
  224.  
  225.  IOPrinter= IOPrtCmdReq;
  226.  IOPrinterPtr= IOPrtCmdReqPtr;
  227.  
  228.  
  229. END Printer.
  230.  
  231.