home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / tex / pastex / source / driver / util / amiga / amprhelp.c next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  17.7 KB  |  677 lines

  1. /*
  2. **    This file generated by localize 2.9 (AmigaDOS 2.1) from amprhelp.c
  3. */
  4. /*************************************************************************/
  5. /*                                                                       */
  6. /*      amprhelp.c              Druckeransteuerung ueber Device.         */
  7. /*                                                                       */
  8. /*      InitPrinterDevice()     oeffnet das Printerdevice usw.           */
  9. /*      ClosePrinterDevice()    schliesst das Printerdevice usw.         */
  10. /*                                                                       */
  11. /*      Georg Hessmann          06.07.88 / 16.06.89 / 11.04.91           */
  12. /*                                                                       */
  13. /*************************************************************************/
  14.  
  15. #include "defines.h"
  16.  
  17. #include <stdio.h>
  18. #include <string.h>
  19. #define min(a,b) __builtin_min(a,b)
  20.  
  21.  
  22. #include <exec/types.h>
  23. #include <exec/exec.h>
  24. #include <graphics/view.h>
  25. #include <exec/ports.h>
  26. #include <devices/printer.h>
  27.  
  28. #ifdef ANSI
  29. #  include <stdlib.h>
  30. #endif
  31.  
  32. #ifdef AZTEC_C
  33. #  include <functions.h>
  34.    struct IORequest *CreateExtIO();
  35. #endif
  36.  
  37.  
  38. #include "globals.h"
  39. #include "bitmap.h"
  40. #include "amprint.h"
  41. #include "prhelp.h"
  42.  
  43.  
  44. #include "globals.i"
  45. #include "amprint.i"
  46. #include "amprhelp.i"
  47. #include "prhelp.i"
  48.  
  49. extern struct ExecBase * SysBase;
  50.  
  51. #include <clib/graphics_protos.h>
  52. #include <clib/alib_protos.h>
  53. #include <clib/dos_protos.h>
  54. #include <clib/exec_protos.h>
  55. #include <pragmas/graphics_pragmas.h>
  56. #include <pragmas/exec_pragmas.h>
  57. #include <pragmas/dos_pragmas.h>
  58.  
  59.  
  60. #ifndef DISPLAY
  61. #  include <graphics/gfxbase.h>
  62. #  include "iff.h"
  63.    struct Library *IFFBase = NULL;
  64. #  include <exec/types.h>
  65. #  include <devices/printer.h>
  66. #  include <devices/prtbase.h>
  67. #  include <devices/prtgfx.h>
  68.    static UBYTE  old_density = 0;    /* 0 == not used !!! */
  69.    static USHORT old_PrintShade;
  70.    static USHORT old_PrintImage;
  71.  
  72.    static struct BitMap   system_bm;
  73.    static struct RastPort system_rp;
  74.  
  75.    struct GfxBase  *GfxBase = NULL;
  76. #endif
  77.  
  78. static UWORD           bw_ctable[2] = { 0x0FFF, 0x0000 };
  79. static struct ColorMap system_colormap = { 0, COLORMAP_TYPE_V1_2, 2, &(bw_ctable[0]) };
  80.  
  81.  
  82.  
  83.  
  84. /*
  85.  * Fuer die locale-Library:
  86.  *
  87.  * Hier duerfen *nur* die MSG_#? Nummern eingebunden werden!
  88.  * Achtung:
  89.  * Es muss/sollte 'multiple-include' erlaubt sein!
  90.  */
  91. #include "local.i"
  92.  
  93. #undef  CATCOMP_ARRAY
  94. #undef  CATCOMP_BLOCK
  95. #undef  CATCOMP_STRINGS
  96. #define CATCOMP_NUMBERS
  97. #include "localstr.h"
  98.  
  99.  
  100.  
  101. #ifdef AZTEC_C
  102. #define PDERR_NOERR        0L
  103. #endif
  104.  
  105.  
  106. /* Globale Variablen */
  107. union printerIO *request = NULL;
  108. struct MsgPort *printerPort = NULL;
  109. /*static BYTE error;*/
  110. int  is_printer_started = 0;    /* 0: nein, 1: init ok, 2: print gestartet   */
  111. int  is_printing_aborted = 0;    /* 0: nein, 1: ja, also kein prnzero!         */
  112.  
  113. /* (Externe) globale Variablen */
  114. #ifndef DISPLAY
  115.   extern long bufferz;
  116.   extern long bufflen;
  117.   extern char *bufferA, *bufferB;
  118.   extern int  bufferZu_A, bufferZu_B;
  119.   extern char *buffer;
  120.   extern int  aktBufNr;
  121.  
  122.   extern struct GfxBase    *GfxBase;
  123. #endif
  124.  
  125. /* lokale Variablen */
  126.  
  127. static char *getErrorString    Args((BYTE err));
  128. static void AbortPrinter    Args((void));
  129. #ifndef DISPLAY
  130. static void restore_printer_preferences Args((void));
  131. #endif
  132.  
  133.  
  134. #ifdef AZTEC_C
  135. #pragma regcall( /* d0 = */ OpenPrinter(a0))
  136. #pragma regcall( ClosePrinter(a0))
  137. /* #pragma regcall( a0 = getErrorString(d0)) */
  138. #endif
  139.  
  140.  
  141.  
  142.  
  143. /*****  InitPrinterDevice               ***************/
  144. int InitPrinterDevice(void)
  145. {
  146.   struct MsgPort *testPort;
  147.   int s_en_ab;
  148.   int ret = 0;
  149.  
  150. #ifndef DISPLAY
  151.   if (ToDo & DO_PBUFFERS) {
  152.     if (bufflen == 0)  bufflen = Printer->pp_buffer_size
  153.             ? Printer->pp_buffer_size : BUFFLEN;
  154.     /** if (bufflen == 0)  bufflen    = BUFFLEN; **/
  155.     if (bufflen < 512) bufflen    = 512;
  156.     bufferA    = xmalloc((unsigned)bufflen*sizeof(char));
  157.     bufferB    = xmalloc((unsigned)bufflen*sizeof(char));
  158.     aktBufNr   = BUF_A;
  159.     buffer     = bufferA;
  160.     bufferz    = 0L;
  161.     bufferZu_A = BUF_LEER;
  162.     bufferZu_B = BUF_LEER;
  163.   }
  164.  
  165.   /* und nun der Teil fuer das wirkliche drucken ... */
  166.  
  167.   /* oeffnet das parallel.device im FAST mode, hoffe das geht... */
  168.   if (turbo_mode) {
  169.     struct MsgPort  *par_port;
  170.  
  171.     if ((par_port = CreatePort("dviprint-parallel",0L)) != NULL) {
  172.       struct IOExtPar *par_requ;
  173.  
  174.       if ((par_requ = (struct IOExtPar *)CreateExtIO(par_port, sizeof(struct IOExtPar))) != NULL) {
  175.         /* hier die Hauptsache! ... */
  176.         par_requ->io_ParFlags |= PARF_FASTMODE;
  177.  
  178.         if (!OpenDevice("parallel.device", 0L, (struct IORequest *)par_requ, PARF_FASTMODE)) {
  179.           /* so, nun ist das parallel.device im FAST-MODE geoeffnet... */
  180.           CloseDevice((struct IORequest *)par_requ);
  181.       /*
  182.        * Jetzt koennte man ein Fatal() Meldung bringen, falls Device.Version
  183.        * < 36, d.h. kein WB 1.3.3 oder 2.0 Device, welches FASTMODE verstehen
  184.        * wuerde. Nach kurzem Blick ins RKM bin ich zu dem Schluss gekommen,
  185.        * dass aeltere Versionen diesen Wert ignorieren.
  186.        */
  187.         }
  188.         DeleteExtIO((struct IORequest *)par_requ);
  189.       }
  190.       DeletePort(par_port);
  191.     }
  192.   }
  193.  
  194.   if ((GfxBase = (struct GfxBase *)OpenLibrary(GRAPHICSNAME,0)) == NULL) {
  195.     Fatal(10,MSG_CANT_OPEN,GRAPHICSNAME);
  196.   }
  197.  
  198. #endif /* DISPLAY */
  199.  
  200.   if (ToDo & DO_PDEVICE) {
  201.  
  202.     char *portname = "dviprint";
  203.     char *devname;
  204.     
  205.     s_en_ab = Enable_Abort;
  206.     Enable_Abort = 0;        /* no CTRL-C */
  207.  
  208.     if (NULL != (testPort = FindPort(portname))) {
  209. #  ifdef DISPLAY
  210.       Warning(MSG_PORT_ALREADY_EXISTS,portname);
  211.       ret = 255;
  212. #  else
  213.       Fatal(5,MSG_PORT_ALREADY_EXISTS,portname);
  214. #  endif
  215.     }
  216.     else {
  217.       if (NULL == (printerPort = (struct MsgPort *) CreatePort(portname,1L))) {
  218. #  ifdef DISPLAY
  219.         Warning(MSG_CANT_OPEN_PRINTER_PORT,portname);
  220.         ret = 255;
  221. #  else
  222.         Fatal(5,MSG_CANT_OPEN_PRINTER_PORT,portname);
  223. #  endif
  224.       }
  225.       else {
  226.         if (NULL == (request = (union printerIO *)
  227.         CreateExtIO(printerPort, sizeof(union printerIO)))) {
  228.       DeletePort(printerPort);
  229. #  ifdef DISPLAY
  230.       Warning(MSG_CREATEEXTIO_FAILED);
  231.       ret = 255;
  232. #  else
  233.       Fatal(5,MSG_CREATEEXTIO_FAILED);
  234. #  endif
  235.     }
  236.     else {
  237. #ifndef DISPLAY
  238.       devname = (turbo_mode && !os_2) ? "puffer.device" : "printer.device";
  239. #else
  240.       devname = "printer.device";
  241. #endif
  242.       if (OpenDevice(devname, 0L, (struct IORequest *)request, 0L)) {
  243.         DeleteExtIO((struct IORequest *)request);
  244.         DeletePort(printerPort);
  245.         request = NULL;
  246. #  ifdef DISPLAY
  247.         Warning(MSG_CANT_OPEN,devname);
  248.         ret = 255;
  249. #  else
  250.         Fatal(5,MSG_CANT_OPEN,devname);
  251. #  endif
  252.       }
  253.       else {
  254.         /* is_printer_started = 1; */
  255.         ret = ((int)printerPort->mp_SigBit);
  256.       }
  257.     }
  258.       }
  259.     }
  260.     Enable_Abort = s_en_ab;    /* CTRL-C on */
  261.   }
  262.  
  263.   return ret;
  264. }
  265.  
  266.  
  267. #ifndef DISPLAY
  268.  
  269.   /* Funktionen, die die Drucker-Preference auslesen und die Aufloesung    */
  270.   /* in Abhaengigkeit der DENSITY bestimmen.                */
  271.  
  272. void setup_printer_preferences(UBYTE set_density)
  273. {
  274.   struct PrinterData *PD;
  275.   
  276.   PD = (struct PrinterData *)request->iostd.io_Device;
  277.   
  278.   /* set_density == 0 : verwende default density */
  279.  
  280.   if (set_density > 0 && set_density < 8) {
  281.     old_density = PD->pd_Preferences.PrintDensity;
  282.     PD->pd_Preferences.PrintDensity = set_density;
  283.   }
  284.   old_PrintShade = PD->pd_Preferences.PrintShade;
  285.   old_PrintImage = PD->pd_Preferences.PrintImage;
  286.   PD->pd_Preferences.PrintShade = SHADE_BW;
  287.   PD->pd_Preferences.PrintImage = IMAGE_POSITIVE;
  288.  
  289. }
  290.  
  291. static void restore_printer_preferences(void)
  292. {
  293.   struct PrinterData *PD;
  294.   
  295.   if (request != NULL) {
  296.     PD = (struct PrinterData *)request->iostd.io_Device;
  297.     if (old_density != 0) {
  298.       /* nur bei != 0 hat sich an der density auch etwas geaendert */
  299.       PD->pd_Preferences.PrintDensity = old_density;
  300.     }
  301.     PD->pd_Preferences.PrintShade = old_PrintShade;
  302.     PD->pd_Preferences.PrintImage = old_PrintImage;
  303.   }
  304. }
  305.  
  306. void get_printer_resolution(long *hres, long *vres, short *pwidth)
  307. {
  308. /*(JCH) Thank Darren@cbmvax who helped me make the generic driver work fine.*/
  309.  
  310.   long dummy;
  311.   struct PrinterData *PD;
  312.   struct PrinterExtendedData *PED;
  313.   static BYTE error;
  314.  
  315.   InitBitMap(&system_bm, 1, 8, 1);
  316.   system_bm.Planes[0] = (UBYTE *)&dummy;
  317.   InitRastPort(&system_rp);
  318.   system_rp.BitMap = &system_bm;
  319.  
  320.   request->iodrp.io_Command   = PRD_DUMPRPORT;
  321.   request->iodrp.io_RastPort  = &system_rp;
  322.   request->iodrp.io_ColorMap  = &system_colormap;
  323.   request->iodrp.io_Modes     = 0;
  324.   request->iodrp.io_SrcX      = 0;
  325.   request->iodrp.io_SrcY      = 0;
  326.   request->iodrp.io_SrcWidth  = 1;
  327.   request->iodrp.io_SrcHeight = 1;
  328.   request->iodrp.io_DestCols  = 1000;
  329.   request->iodrp.io_DestRows  = 1000;
  330.   request->iodrp.io_Special   = SPECIAL_MILCOLS | SPECIAL_MILROWS | SPECIAL_NOPRINT | SPECIAL_DENSITY1;
  331.  
  332.   error = DoIO((struct IORequest *)request);
  333.   (void) SetSignal(0L, (ULONG)(1L<<printerPort->mp_SigBit)); /* we know the request has completed */
  334.   if (error != 0) PrinterError(error);
  335.  
  336.  
  337.   PD = (struct PrinterData *)request->iostd.io_Device;
  338.   PED = &PD->pd_SegmentData->ps_PED;
  339.  
  340.   *hres = PED->ped_XDotsInch;
  341.   *vres = PED->ped_YDotsInch;
  342.   *pwidth = PED->ped_NumRows;
  343.   pp_max_dots_line = PED->ped_MaxXDots;
  344.   if (pp_max_dots_line == 0) pp_max_dots_line = 0xFFFF;    // irgendwein grosser Wert halt
  345.  
  346.   if (Stats) {
  347.     Warning(MSG_YOU_PRINT_GENERIC);
  348.     Logging(MSG_GENERIC_PRINT_NAME,
  349.         PED->ped_PrinterName,
  350.     (int)PD->pd_SegmentData->ps_Version,
  351.         (int)PD->pd_SegmentData->ps_Revision);
  352.     Warning(MSG_GENERIC_PRINT_RESO,
  353.         (int)PED->ped_XDotsInch,
  354.     (int)PED->ped_YDotsInch,
  355.     (int)PD->pd_Preferences.PrintDensity);
  356.     Logging(MSG_GENERIC_PRINT_MAXD,
  357.            (int)PED->ped_MaxXDots, (int)PED->ped_MaxYDots);
  358.     /*hes: auch auf Bildschirm ?    */
  359.  
  360. #if defined(HARDDEB)
  361.     /***** only for debugging */
  362.     Warning("  PrinterClass = %u, ColorClass = %u.",
  363.         (unsigned)PED->ped_PrinterClass, (unsigned)PED->ped_ColorClass);
  364.     Warning("  MaxColumns = %lu, NumCharSets = %lu, NumRows = %hu.",
  365.         PED->ped_MaxColumns, PED->ped_NumCharSets,
  366.     (unsigned short)PED->ped_NumRows);
  367. #endif
  368.   }
  369.  
  370.   /* nun muesst eigentlich RastPort freigegeben werden (??????) */
  371. }
  372.  
  373.  
  374. #endif    /* Ende der Preference-Funktionen */
  375.  
  376.  
  377. /*****  getErrorString                  ***************/
  378. static char *getErrorString(BYTE err)
  379. {
  380.   char *ret;
  381.  
  382.   switch (err)
  383.     {
  384.     case PDERR_NOERR        : ret = GetTeXString(MSG_PRT_ERROR_NO_ERROR);
  385.                       break;
  386.         case PDERR_CANCEL           : is_printing_aborted = 1;
  387.                       ret = GetTeXString(MSG_PRT_ERROR_ABORT);
  388.                       break;
  389.         case PDERR_NOTGRAPHICS      : ret = GetTeXString(MSG_PRT_ERROR_NO_GFX);
  390.                       break;
  391.         case PDERR_BADDIMENSION     : ret = GetTeXString(MSG_PRT_ERROR_ILLDIM);
  392.                       break;
  393.         case PDERR_INTERNALMEMORY       : ret = GetTeXString(MSG_PRT_ERROR_NO_MEM_VARS);
  394.                       break;
  395.         case PDERR_BUFFERMEMORY     : ret = GetTeXString(MSG_PRT_ERROR_NO_MEM_BUFF);
  396.                       break;
  397.         default                : ret = GetTeXString(MSG_PRT_ERROR_UNKNOWN_ERR);
  398.                       break;
  399.     }
  400.  
  401.   return ret;
  402. }
  403.  
  404. /*****  PrinterError                    ***************/
  405. void PrinterError(BYTE err)
  406. {
  407.   Fatal(5,MSG_PRT_ERR,getErrorString(err));
  408. }
  409.  
  410. /*****  ClosePrinterDevice              ***************/
  411. void ClosePrinterDevice(void)
  412. {
  413. #ifndef DISPLAY
  414.   if (IFFBase != NULL) {
  415.     CloseLibrary(IFFBase);
  416.     IFFBase = NULL;
  417.   }
  418.   if (output_file_ptr) {
  419.     fclose(output_file_ptr);
  420.     output_file_ptr = NULL;
  421.   }
  422. #endif
  423.  
  424.   if (request!=NULL) {
  425. #if defined(HARDDEB)
  426.     puts(">ClosePReq");
  427. #endif
  428.     if (ToDo & DO_REALPRINT) AbortPrinter();
  429. #ifndef DISPLAY
  430.      if (ToDo & DO_PPREFS)
  431.     restore_printer_preferences();
  432.     /*EndHardcopies();*/
  433. #endif
  434.     CloseDevice((struct IORequest *)request);
  435.     DeleteExtIO((struct IORequest *)request);
  436.     if (printerPort != NULL) {
  437.        DeletePort(printerPort);
  438.        printerPort = NULL;
  439.     }
  440.     request = NULL;
  441.   }
  442.  
  443. #ifndef DISPLAY
  444.   if (GfxBase != NULL) {
  445.     CloseLibrary((struct Library *)GfxBase);
  446.     GfxBase = NULL;
  447.   }
  448. #if 0 /* in prhelp.c */
  449.   if (PrnBuffer != NULL) {
  450.     xfree(PrnBuffer);
  451.   }
  452. #endif
  453. #endif
  454. }
  455.  
  456.  
  457.  
  458. /*******    AbortPrinter        *********/
  459. /* wird in ClosePrinterDevice() aufgerufen.    */
  460. static void AbortPrinter()
  461. {
  462. #if defined(HARDDEB)
  463.   printf(">AbortP(%d)\n",is_printer_started);
  464. #endif
  465.   /* Test ob der Drucker ansprechbar ist: */
  466.   if (request == NULL || printerPort == NULL
  467.     /*|| is_printing_aborted*/
  468.     || is_printer_started < 2    /* noch kein request unterwegs */
  469.     ) return;
  470.  
  471.   if (is_printer_started > 1) {
  472.     /*    Auch den Prefs Drucker muss man stoppen koennen            */
  473.     if (CheckIO((struct IORequest *)request) == 0L) {    /* nicht fertig */
  474. #if defined(HARDDEB)
  475.       printf("AbortIO\n");
  476. #endif
  477.       AbortIO((struct IORequest *)request);  /* soll ich's wagen ???? 23-feb-91 */
  478. #if defined(HARDDEB)
  479.       printf("WaitIO\n");
  480. #endif
  481.       WaitIO((struct IORequest *)request);
  482.       is_printer_started = 1;
  483. #if defined(HARDDEB)
  484.       {
  485.     BYTE error = request->iostd.io_Error;
  486.         if (error != 0) 
  487.           printf("Error nach AbortIO (error = %d = %s)!\n",error,getErrorString(error));
  488.       /* kein PrinterError, sonst Endlosschleife! */
  489.       }
  490. #endif
  491.     }
  492.   }
  493. #if defined(HARDDEB)
  494.   puts("<AbortP");
  495. #endif
  496. }
  497.  
  498.  
  499. /*****  prnzero                        ***************/
  500. /* wird in globals.c/CXBRK aufgerufen, soll bei einem Prog.abbruch den
  501.    Drucker in initialisierten Zustand zuruecklassen. */
  502. void prnzero(void)
  503. {
  504. #ifdef DISPLAY
  505.   char *bufferA;
  506. #endif
  507.   long blen;
  508.   int noetig = is_printer_started > 1;
  509.  
  510. #if 0 && !defined(DISPLAY)
  511.   if (!(ToDo & DO_REALPRINT))    return;
  512. #endif
  513.  
  514.   AbortPrinter();
  515.  
  516.   /* Test ob der Drucker ansprechbar ist: */
  517.   if (ToDo & DO_NOZERO
  518.     || request == NULL || printerPort == NULL
  519.     || is_printing_aborted
  520.     || !noetig
  521.     ) return;
  522.  
  523. #ifndef DISPLAY
  524.   if (Printer->pp_grouping)
  525.     blen = Printer->pp_grouping * pp_max_dots_line;
  526.   else blen = 8640;        /* worst case (360dpi*8inch*3group) */
  527.   if (bufflen < blen) blen = bufflen;
  528. #else
  529.   blen = 8640;
  530. #endif
  531.  
  532. #ifdef DISPLAY
  533.   bufferA=malloc((unsigned)blen*sizeof(char));
  534. #endif
  535.   if (bufferA==NULL) return; /* Prefs Drucker hat auch keinen Puffer */
  536.  
  537.   Message(MSG_TRY_CLEAR_PRT);
  538.  
  539.   memset(&(bufferA[0]),0,sizeof(bufferA[0])*blen);
  540.  
  541.   request->iostd.io_Command = PRD_RAWWRITE;
  542.   request->iostd.io_Length  = blen;
  543.   request->iostd.io_Data = (APTR) &(bufferA[0]);
  544.   DoIO((struct IORequest *)request);
  545.   /* kein PrinterError, sonst Endlosschleife! */
  546.   if (request->iostd.io_Error)
  547.     Message(MSG_CLEAR_FAILED);
  548. #ifdef DISPLAY
  549.   xfree(bufferA);
  550. #endif
  551. }
  552.  
  553.  
  554. #ifndef DISPLAY
  555.  
  556. #if 0
  557. void FormFeedGeneric(void)
  558. {
  559.   char ff = FF;
  560.   puts(">FFGEN");
  561.  
  562.   /* HardcopyGeneric() macht nun schon selber ein FF beim letzten Pass */
  563.   if (is_printer_started > 1) WaitForPrinterOK();
  564.   request->iostd.io_Command    = CMD_WRITE;
  565.   request->iostd.io_Length    = 1L;
  566.   request->iostd.io_Data    = (APTR) &ff;
  567.   SendIO((struct IORequest *)request);
  568.   is_printer_started = 3;
  569.   puts("<FFGEN");
  570. }
  571. #endif
  572.  
  573.  
  574. void HardcopyGeneric(struct bitmap *bmap, long lineno, int draft, int last_pass)
  575. {
  576.   long width, height;
  577.  
  578.   width = bmap->width;            /* in bits */
  579.   height = min(bmap->height,lineno);    /* in bits */
  580.  
  581.   if (is_printer_started > 1) WaitForPrinterOK();
  582.  
  583.   InitBitMap(&system_bm, 1, width, height);
  584.   system_bm.Planes[0] = (UBYTE *)bmap->pixptr;
  585.   InitRastPort(&system_rp);
  586.   system_rp.BitMap = &system_bm;
  587.  
  588.   request->iodrp.io_Command   = PRD_DUMPRPORT;
  589.   request->iodrp.io_RastPort  = &system_rp;
  590.   request->iodrp.io_ColorMap  = &system_colormap;
  591.   request->iodrp.io_Modes     = 0;
  592.   request->iodrp.io_SrcX      = 0;
  593.   request->iodrp.io_SrcY      = 0;
  594.   request->iodrp.io_SrcWidth  = request->iodrp.io_DestCols = 
  595.             (width > pp_max_dots_line) ? pp_max_dots_line : width;
  596.   request->iodrp.io_SrcHeight = request->iodrp.io_DestRows = height;
  597.   
  598.   request->iodrp.io_Special   = SPECIAL_TRUSTME;
  599.   if (!last_pass) {
  600.     request->iodrp.io_Special |= SPECIAL_NOFORMFEED;
  601.   }
  602.   
  603.   request->iodrp.io_Special |= SPECIAL_NOPRINT;
  604.   DoIO((struct IORequest *)request);
  605.  
  606.   request->iodrp.io_Special  &= ~SPECIAL_NOPRINT;
  607.   
  608.   /*
  609.    *   Um keinerlei Verzerrungen zu bekommen, uebernehmen wir die 
  610.    *   Angaben vom System, auch wenn dadurch etwas abgeschnitten wird.
  611.    */
  612.   if (request->iodrp.io_DestCols < request->iodrp.io_SrcWidth) {
  613.     request->iodrp.io_SrcWidth  = request->iodrp.io_DestCols;
  614.   }
  615.   if (request->iodrp.io_DestRows < request->iodrp.io_SrcHeight) {
  616.     request->iodrp.io_SrcHeight = request->iodrp.io_DestRows;
  617.   }
  618.  
  619.   SendIO((struct IORequest *)request);
  620.  
  621.   is_printer_started = 3;    /* printer laeuft, es gibt auch Buffer! */
  622. }
  623.  
  624.  
  625. #else
  626.  
  627.  
  628. /*****  PrintRastPort              ***************/
  629. void PrintRastPort(struct RastPort *rp,
  630.            unsigned long modes,
  631.            unsigned short sizex, unsigned short sizey,
  632.            unsigned short in_x,  unsigned short in_y)
  633. {
  634.   request->iodrp.io_Command   = PRD_DUMPRPORT;
  635.   request->iodrp.io_RastPort  = rp;
  636.   request->iodrp.io_ColorMap  = &system_colormap;
  637.   request->iodrp.io_Modes     = modes;
  638.   request->iodrp.io_SrcX      = 0;
  639.   request->iodrp.io_SrcY      = 0;
  640.   request->iodrp.io_SrcWidth  = sizex;
  641.   request->iodrp.io_SrcHeight = sizey;
  642.   request->iodrp.io_DestCols  = in_x;
  643.   request->iodrp.io_DestRows  = in_y;
  644.   request->iodrp.io_Special   = SPECIAL_MILROWS | SPECIAL_MILCOLS;
  645.  
  646. /**
  647.   printf("PrintRastPort: modes: %ld, SrcX: %d, SrcY: %d,\n\tSrcW: %d, SrcH: %d, DesC: %d, DesR: %d\n",
  648.     request->iodrp.io_Modes    ,
  649.     request->iodrp.io_SrcX     ,
  650.     request->iodrp.io_SrcY     ,
  651.     request->iodrp.io_SrcWidth ,
  652.     request->iodrp.io_SrcHeight,
  653.     request->iodrp.io_DestCols ,
  654.     request->iodrp.io_DestRows );
  655. **/
  656.  
  657.   SendIO((struct IORequest *)request);
  658.  
  659.   is_printer_started = 3;    /* printer laeuft, es gibt aber KEINE Buffer! */
  660. }
  661.  
  662. void EndPrintRastPort(void)
  663. {
  664.   BYTE error;
  665.   if (!CheckIO((struct IORequest *)request)) {
  666.     WaitIO((struct IORequest *)request);
  667.   }
  668.   error = request->iostd.io_Error; /*hes: erst Fehler# laden! */
  669.   if (error != 0) {
  670.     if (error==PDERR_CANCEL) {
  671.       is_printing_aborted = 1;
  672.     }
  673.     Warning(MSG_PRT_ERR,getErrorString(error));
  674.   }
  675. }
  676. #endif
  677.