home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD1.3 / Includes / devices / prtbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-12  |  5.5 KB  |  162 lines

  1. #ifndef DEVICES_PRTBASE_H
  2. #define DEVICES_PRTBASE_H
  3. /*
  4. **    $Filename: devices/prtbase.h $
  5. **    $Release: 1.3 $
  6. **
  7. **    printer device data definition 
  8. **
  9. **    (C) Copyright 1986,1987,1988 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef     EXEC_NODES_H
  14. #include "exec/nodes.h"
  15. #endif
  16. #ifndef     EXEC_LISTS_H
  17. #include "exec/lists.h"
  18. #endif
  19. #ifndef     EXEC_PORTS_H
  20. #include "exec/ports.h"
  21. #endif
  22. #ifndef     EXEC_LIBRARIES_H
  23. #include "exec/libraries.h"
  24. #endif
  25. #ifndef     EXEC_TASKS_H
  26. #include "exec/tasks.h"
  27. #endif
  28.  
  29. #ifndef     DEVICES_PARALLEL_H
  30. #include "devices/parallel.h"
  31. #endif
  32. #ifndef     DEVICES_SERIAL_H
  33. #include "devices/serial.h"
  34. #endif
  35. #ifndef     DEVICES_TIMER_H
  36. #include "devices/timer.h"
  37. #endif
  38. #ifndef     LIBRARIES_DOSEXTENS_I
  39. #include "libraries/dosextens.h"
  40. #endif
  41. #ifndef     INTUITION_INTUITION_H
  42. #include "intuition/intuition.h"
  43. #endif
  44.  
  45.  
  46. struct DeviceData {
  47.     struct Library dd_Device; /* standard library node */
  48.     APTR dd_Segment;          /* A0 when initialized */
  49.     APTR dd_ExecBase;          /* A6 for exec */
  50.     APTR dd_CmdVectors;          /* command table for device commands */
  51.     APTR dd_CmdBytes;          /* bytes describing which command queue */
  52.     UWORD   dd_NumCommands;   /* the number of commands supported */
  53. };
  54.  
  55. #define P_STKSIZE    0x0800    /* stack size for child task */
  56. #define P_BUFSIZE    256    /* size of internal buffers for text i/o */
  57. #define P_SAFESIZE    128    /* safety margin for text output buffer */
  58.  
  59. struct     PrinterData {
  60.     struct DeviceData pd_Device;
  61.     struct MsgPort pd_Unit; /* the one and only unit */
  62.     BPTR pd_PrinterSegment; /* the printer specific segment */
  63.     UWORD pd_PrinterType;    /* the segment printer type */
  64.                 /* the segment data structure */
  65.     struct PrinterSegment *pd_SegmentData;
  66.     UBYTE *pd_PrintBuf;    /* the raster print buffer */
  67.     int (*pd_PWrite)();    /* the write function */
  68.     int (*pd_PBothReady)(); /* write function's done */
  69.     union {            /* port I/O request 0 */
  70.         struct IOExtPar pd_p0;
  71.         struct IOExtSer pd_s0;
  72.     } pd_ior0;
  73.  
  74. #define     pd_PIOR0 pd_ior0.pd_p0
  75. #define     pd_SIOR0 pd_ior0.pd_s0
  76.  
  77.     union {            /*   and 1 for double buffering */
  78.         struct IOExtPar pd_p1;
  79.         struct IOExtSer pd_s1;
  80.     } pd_ior1;
  81.  
  82. #define     pd_PIOR1 pd_ior1.pd_p1
  83. #define     pd_SIOR1 pd_ior1.pd_s1
  84.  
  85.     struct timerequest pd_TIOR;    /* timer I/O request */
  86.     struct MsgPort pd_IORPort;    /*   and message reply port */
  87.     struct Task pd_TC;        /* write task */
  88.     UBYTE pd_Stk[P_STKSIZE];    /*   and stack space */
  89.     UBYTE pd_Flags;            /* device flags */
  90.     UBYTE pd_pad;
  91.     struct Preferences pd_Preferences;    /* the latest preferences */
  92.     UBYTE    pd_PWaitEnabled;    /* wait function switch */
  93. };
  94.  
  95. /* Printer Class */
  96. #define PPCB_GFX    0    /* graphics (bit position) */
  97. #define PPCF_GFX    0x1    /* graphics (and/or flag) */
  98. #define PPCB_COLOR    1    /* color (bit position) */
  99. #define PPCF_COLOR    0x2    /* color (and/or flag) */
  100.  
  101. #define PPC_BWALPHA    0x00    /* black&white alphanumerics */
  102. #define PPC_BWGFX    0x01    /* black&white graphics */
  103. #define PPC_COLORALPHA    0x02    /* color alphanumerics */
  104. #define PPC_COLORGFX    0x03    /* color graphics */
  105.  
  106. /* Color Class */
  107. #define PCC_BW        0x01    /* black&white only */
  108. #define PCC_YMC        0x02    /* yellow/magenta/cyan only */
  109. #define PCC_YMC_BW    0x03    /* yellow/magenta/cyan or black&white */
  110. #define PCC_YMCB    0x04    /* yellow/magenta/cyan/black */
  111. #define PCC_4COLOR    0x04    /* a flag for YMCB and BGRW */
  112. #define PCC_ADDITIVE    0x08    /* not ymcb but blue/green/red/white */
  113. #define PCC_WB        0x09    /* black&white only, 0 == BLACK */
  114. #define PCC_BGR        0x0A    /* blue/green/red */
  115. #define PCC_BGR_WB    0x0B    /* blue/green/red or black&white */
  116. #define PCC_BGRW    0x0C    /* blue/green/red/white */
  117. /*
  118.     The picture must be scanned once for each color component, as the
  119.     printer can only define one color at a time.  ie. If 'PCC_YMC' then
  120.     first pass sends all 'Y' info to printer, second pass sends all 'M'
  121.     info, and third pass sends all C info to printer.  The CalComp
  122.     PlotMaster is an example of this type of printer.
  123. */
  124. #define PCC_MULTI_PASS    0x10    /* see explanation above */
  125.  
  126. struct PrinterExtendedData {
  127.     char    *ped_PrinterName;    /* printer name, null terminated */
  128.     VOID    (*ped_Init)();         /* called after LoadSeg */
  129.     VOID    (*ped_Expunge)();    /* called before UnLoadSeg */
  130.     int    (*ped_Open)();         /* called at OpenDevice */
  131.     VOID    (*ped_Close)();         /* called at CloseDevice */
  132.     UBYTE    ped_PrinterClass;    /* printer class */
  133.     UBYTE    ped_ColorClass;         /* color class */
  134.     UBYTE    ped_MaxColumns;         /* number of print columns available */
  135.     UBYTE    ped_NumCharSets;     /* number of character sets */
  136.     UWORD    ped_NumRows;         /* number of 'pins' in print head */
  137.     ULONG    ped_MaxXDots;         /* number of dots max in a raster dump */
  138.     ULONG    ped_MaxYDots;         /* number of dots max in a raster dump */
  139.     UWORD    ped_XDotsInch;         /* horizontal dot density */
  140.     UWORD    ped_YDotsInch;         /* vertical dot density */
  141.     char    ***ped_Commands;     /* printer text command table */
  142.     int    (*ped_DoSpecial)();  /* special command handler */
  143.     int    (*ped_Render)();     /* raster render function */
  144.     LONG    ped_TimeoutSecs;     /* good write timeout */
  145.     /* the following only exists if the segment version is >= 33 */
  146.     char    **ped_8BitChars;     /* conv. strings for the extended font */
  147.     LONG    ped_PrintMode;         /* set if text printed, otherwise 0 */
  148.     /* the following only exists if the segment version is >= 34 */
  149.     /* ptr to conversion function for all chars */
  150.     int    (*ped_ConvFunc)();
  151. };
  152.  
  153. struct PrinterSegment {
  154.     ULONG   ps_NextSegment;     /* (actually a BPTR) */
  155.     ULONG   ps_runAlert;     /* MOVEQ #0,D0 : RTS */
  156.     UWORD   ps_Version;         /* segment version */
  157.     UWORD   ps_Revision;     /* segment revision */
  158.     struct  PrinterExtendedData ps_PED;      /* printer extended data */
  159. };
  160.  
  161. #endif    /* DEVICES_PRTBASE_H */
  162.