home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * DISCLAIMER:
- *
- * This program is provided as a service to the programmer
- * community to demonstrate one or more features of the Amiga
- * personal computer. These code samples may be freely used
- * for commercial or noncommercial purposes.
- *
- * Commodore Electronics, Ltd ("Commodore") makes no
- * warranties, either expressed or implied, with respect
- * to the program described herein, its quality, performance,
- * merchantability, or fitness for any particular purpose.
- * This program is provided "as is" and the entire risk
- * as to its quality and performance is with the user.
- * Should the program prove defective following its
- * purchase, the user (and not the creator of the program,
- * Commodore, their distributors or their retailers)
- * assumes the entire cost of all necessary damages. In
- * no event will Commodore be liable for direct, indirect,
- * incidental or consequential damages resulting from any
- * defect in the program even if it has been advised of the
- * possibility of such damages. Some laws do not allow
- * the exclusion or limitation of implied warranties or
- * liabilities for incidental or consequential damages,
- * so the above limitation or exclusion may not apply.
- *
- */
-
- #include "exec/types.h"
- #include "exec/nodes.h"
- #include "exec/lists.h"
- #include "exec/ports.h"
- #include "exec/tasks.h"
- #include "exec/io.h"
- #include "devices/printer.h"
- #include "local.h"
-
- /* OPEN THE PRINTER */
- int
- OpenPrinter(request)
- union printerIO *request;
- {
- return(OpenDevice("printer.device",0,request,0));
- }
-
- /* CLOSE THE PRINTER */
- int
- ClosePrinter(request)
- union printerIO *request;
- {
- CloseDevice(request);
- return(0);
- }
-
-
- /* Send a NULL terminated string to the printer */
- /* Assumes printer device is open and printerMsg
- * is correctly initialized. Watches for embedded
- * "escape-sequences" and handles them as defined.
- */
-
- int
- PrintString(request,string)
- char *string;
- union printerIO *request;
- {
- request->ios.io_Command = CMD_WRITE;
- request->ios.io_Data = string;
- request->ios.io_Length = -1;
- /* if -1, the printer assumes it has been given
- * a null terminated string.
- */
- return(DoIO(request));
- }
-
- /* Send RAW character stream to the printer directly,
- * avoid "escape-sequence" parsing by the device.
- */
-
- int
- PrintRaw(request,buffer,count)
- char *buffer; /* where is the output stream of characters */
- union printerIO *request; /* a properly initialized request block */
- int count; /* how many characters to output */
- {
- /* queue a printer raw write */
- request->ios.io_Command = PRD_RAWWRITE;
- request->ios.io_Data = buffer;
- request->ios.io_Length = count;
- return(DoIO(request));
- }
- int
- PrintCommand(request,command, p0, p1, p2, p3)
- union printerIO *request;
- int command, p0, p1, p2, p3; /* command and its parameters */
- {
- /* queue a printer command */
- request->iopc.io_Command = PRD_PRTCOMMAND;
- request->iopc.io_PrtCommand = command;
- request->iopc.io_Parm0 = p0;
- request->iopc.io_Parm1 = p1;
- request->iopc.io_Parm2 = p2;
- request->iopc.io_Parm3 = p3;
- return(DoIO(request));
- }
- int
- DumpRPort(request,rastPort, colorMap, modes, sx,sy, sw,sh, dc,dr, s)
- union printerIO *request;
- struct RastPort *rastPort;
- struct ColorMap *colorMap;
- ULONG modes;
- UWORD sx, sy, sw, sh;
- LONG dc, dr;
- UWORD s;
- {
- request->iodrp.io_Command = PRD_DUMPRPORT;
- request->iodrp.io_RastPort = rastPort;
- request->iodrp.io_ColorMap = colorMap;
- request->iodrp.io_Modes = modes;
- request->iodrp.io_SrcX = sx;
- request->iodrp.io_SrcY = sy;
- request->iodrp.io_SrcWidth = sw;
- request->iodrp.io_SrcHeight = sh;
- request->iodrp.io_DestCols = dc;
- request->iodrp.io_DestRows = dr;
- request->iodrp.io_Special = s;
- return(DoIO(request));
- }
-
-
-