home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / amigae / e_v3.2a / pdsrc / oomodules / printer.e < prev    next >
Text File  |  1977-12-31  |  3KB  |  160 lines

  1. OPT MODULE
  2. OPT OSVERSION=37
  3. OPT EXPORT
  4.  
  5. MODULE  'devices/printer', 'exec/devices', 'exec/io', 'exec/nodes',
  6.         'exec/ports','exec/devices',
  7.         'oomodules/device'
  8.  
  9. OBJECT printer OF device
  10. ENDOBJECT
  11.  
  12. PROC rawwrite(zkette,laenge) OF printer
  13. /*
  14.  
  15. METHOD
  16.  
  17.   rawwrite(string,len)
  18.  
  19. INPUTS
  20.  
  21.   string - the characters to be printed, 0-terminated
  22.   len - number of characters
  23.  
  24. DESCRIPTION
  25.  
  26.   Sends the characters to the printer. Esc-sequences will not be substituted.
  27.   Opens the printer.device if necessary.
  28. */
  29.  
  30.   IF self.io=NIL
  31.     self.open('printer.device',0,0)
  32.   ENDIF
  33.  
  34.   IF self.io
  35.  
  36.     self.io::iostd.data := zkette
  37.     self.io::iostd.length := laenge
  38.     self.io::iostd.command := PRD_RAWWRITE
  39.  
  40.     self.doio()
  41.  
  42.     self.lasterror := self.io.error
  43.   ENDIF
  44. ENDPROC
  45.  
  46. PROC write(zkette,laenge) OF printer
  47. /*
  48.  
  49. METHOD
  50.  
  51.   rawwrite(string,len)
  52.  
  53. INPUTS
  54.  
  55.   string - the characters to be printed, 0-terminated
  56.   len - number of characters
  57.  
  58. DESCRIPTION
  59.  
  60.   Sends the characters to the printer. Esc-sequences will be substituted.
  61.   Opens the printer.device if necessary.
  62. */
  63.  
  64.   IF self.io=NIL
  65.     self.open('printer.device',0,0)
  66.   ENDIF
  67.  
  68.   IF self.io
  69.  
  70.     self.io::iostd.data := zkette
  71.     self.io::iostd.length := laenge
  72.  
  73.     self.io::iostd.command := CMD_WRITE
  74.  
  75.     self.doio()
  76.  
  77.     self.lasterror := self.io.error
  78.   ENDIF
  79. ENDPROC
  80.  
  81. PROC xcommand(kommando,p0=NIL,p1=NIL,p2=NIL,p3=NIL) OF printer
  82. /*
  83.  
  84. METHOD
  85.  
  86.   xcommand(command,param0,param1,param2,param3)
  87.  
  88. INPUTS
  89.  
  90.   command - the printer command to be executed (s. devices/printer)
  91.   param0-3 - command parameters
  92.  
  93. DESCRIPTION
  94.  
  95.   Executes a printer command with the given parameters such as setting
  96.   left and right border, justification etc.
  97.   Opens the printer.device if necessary.
  98.  
  99. */
  100.  
  101.   IF self.io=NIL
  102.     self.open('printer.device',0,0)
  103.   ENDIF
  104.  
  105.   self.io::ioprtcmdreq.prtcommand := kommando
  106.   self.io::ioprtcmdreq.parm0 := p0
  107.   self.io::ioprtcmdreq.parm1 := p1
  108.   self.io::ioprtcmdreq.parm2 := p2
  109.   self.io::ioprtcmdreq.parm3 := p3
  110.   self.io.command := PRD_PRTCOMMAND
  111.   self.doio()
  112.  
  113. ENDPROC
  114.  
  115. PROC graphicdump(rport,cmap,vmodes,srcx,srcy,srcwidth,srcheight,destcols,destrows,special) OF printer
  116. /*
  117.  
  118. METHOD
  119.  
  120.   graphicdump(params)
  121.  
  122. INPUTS
  123.  
  124.     rport       - the RastPort containing the image
  125.     cmap        - screen's ColorMap
  126.     vmodes      - ViewModes of the screen
  127.     srcx,srcy,
  128.     srcwidth,
  129.     srcheight   - dimensionen: start point & width & height
  130.     destcols,
  131.     destrows    - dimensions on the printer in points
  132.     Special     - special flags
  133.  
  134. DESCRIPTION
  135.  
  136.   Prints a part of the rastport.
  137.   Opens the printer.device if necessary.
  138.  
  139. */
  140.  
  141.   IF self.io=NIL
  142.     self.open('printer.device',0,0)
  143.   ENDIF
  144.  
  145.   self.io::iodrpreq.rastport    := rport
  146.   self.io::iodrpreq.colormap    := cmap
  147.   self.io::iodrpreq.modes   := vmodes
  148.   self.io::iodrpreq.srcx        := srcx
  149.   self.io::iodrpreq.srcy        := srcy
  150.   self.io::iodrpreq.srcwidth    := srcwidth
  151.   self.io::iodrpreq.srcheight   := srcheight
  152.   self.io::iodrpreq.destcols    := destcols
  153.   self.io::iodrpreq.destrows    := destrows
  154.   self.io::iodrpreq.special := special
  155.  
  156.   self.io.command := PRD_DUMPRPORT
  157.   self.doio()
  158.  
  159. ENDPROC
  160.