home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / PrtBase.def < prev    next >
Encoding:
Text File  |  1994-09-28  |  6.1 KB  |  159 lines

  1. DEFINITION FOR C MODULE PrtBase ;
  2.  
  3. FROM SYSTEM    IMPORT ADDRESS, BADDRESS, STRING, SHORTSET ;
  4. FROM Exec    IMPORT Library, ExecBasePtr, MsgPort, Task ;
  5. FROM Serial    IMPORT IOExtSer ;
  6. FROM Parallel    IMPORT IOExtPar ;
  7. FROM Intuition    IMPORT Preferences ;
  8. FROM Timer    IMPORT TimeRequest ;
  9.  
  10. TYPE
  11.   DeviceDataPtr        = POINTER TO DeviceData ;
  12.   PrinterExtendedDataPtr= POINTER TO PrinterExtendedData ;
  13.   PrinterDataPtr    = POINTER TO PrinterData ;
  14.   PrinterSegmentPtr    = POINTER TO PrinterSegment ;
  15.  
  16.   DeviceData = RECORD
  17.     dd_Device      : Library  ;    (* standard library node          *)
  18.     dd_Segment      : BADDRESS ;      (* A0 when initialized          *)
  19.     dd_ExecBase      : ExecBasePtr ; (* A6 for exec              *)
  20.     dd_CmdVectors : ADDRESS  ;    (* command table for device commands      *)
  21.     dd_CmdBytes      : ADDRESS  ;      (* bytes describing which command queue *)
  22.     dd_NumCommands: CARDINAL ;    (* the number of commands supported      *)
  23.   END ;
  24.  
  25. CONST
  26.   P_OLDSTKSIZE    = 00800H ;    (* stack size for child task (OBSOLETE)     *)
  27.   P_STKSIZE    = 01000H ;    (* stack size for child task         *)
  28.   P_BUFSIZE    = 256 ;        (* size of internal buffers for text i/o *)
  29.   P_SAFESIZE    = 128 ;        (* safety margin for text output buffer     *)
  30.  
  31. TYPE
  32.   LIntProc = PROCEDURE( ) : LONGINT ;
  33.   PrinterData = RECORD
  34.     pd_Device : DeviceData ;
  35.     pd_Unit : MsgPort ;    (* the one and only unit *)
  36.     pd_PrinterSegment : BADDRESS ;    (* the printer specific segment *)
  37.     pd_PrinterType   : CARDINAL ;    (* the segment printer type    *)
  38.                     (* the segment data structure    *)
  39.     pd_SegmentData : PrinterSegmentPtr ;
  40.     pd_PrintBuf : ADDRESS ;        (* the raster print buffer    *)
  41.     pd_PWrite : LIntProc ;        (* the write function        *)
  42.     pd_PBothReady : LIntProc ;        (* write function's done    *)
  43.     CASE :BOOLEAN OF
  44.     |TRUE: pd_ior0 :
  45.       RECORD
  46.         CASE :BOOLEAN OF
  47.         |TRUE: pd_p0 : IOExtPar ;
  48.         |FALSE:pd_s0 : IOExtSer ;
  49.         END ;
  50.       END ;
  51.     |FALSE:
  52.        CASE :BOOLEAN OF
  53.        |TRUE  : pd_PIOR0 : IOExtPar ;
  54.        |FALSE : pd_SIOR0 : IOExtSer ;
  55.        END ;
  56.     END ;
  57.     CASE :BOOLEAN OF
  58.     |TRUE: pd_ior1 :
  59.       RECORD
  60.         CASE :BOOLEAN OF
  61.         |TRUE: pd_p1 : IOExtPar ;
  62.         |FALSE:pd_s1 : IOExtSer ;
  63.         END ;
  64.       END ;
  65.     |FALSE:
  66.       CASE :BOOLEAN OF
  67.       |TRUE  : pd_PIOR1 : IOExtPar ;
  68.       |FALSE : pd_SIOR1 : IOExtSer ;
  69.       END ;
  70.     END ;
  71.     pd_TIOR : TimeRequest ;    (* timer I/O request        *)
  72.     pd_IORPort : MsgPort ;    (* and message reply port    *)
  73.     pd_TC : Task ;        (* write task            *)
  74.     pd_OldStk : ARRAY [0..P_OLDSTKSIZE-1] OF SHORTCARD ;
  75.                     (* and stack space (OBSOLETE)    *)
  76.     pd_Flags : SHORTSET ;    (* device flags            *)
  77.     pd_pad : SHORTCARD ;    (* padding            *)
  78.     pd_Preferences : Preferences ;
  79.                     (* the latest preferences    *)
  80.     pd_PWaitEnabled : SHORTCARD ;
  81.                     (* wait function switch        *)
  82.     (* new fields for V2.0 *)
  83.     pd_Flags1 : SHORTSET ;
  84.     pd_Stk : ARRAY [0..P_STKSIZE-1] OF SHORTCARD ;
  85.                     (* stack space            *)
  86.   END ;
  87.  
  88. (* Printer Class *)
  89. CONST
  90.   PPCB_GFX    = 0;    (* graphics (bit position)    *)
  91.   PPCF_GFX    = {0};    (* graphics (and/or flag)    *)
  92.   PPCB_COLOR    = 1;    (* color (bit position)        *)
  93.   PPCF_COLOR    = {1};    (* color (and/or flag)        *)
  94.  
  95.   PPC_BWALPHA    = {};    (* black&white alphanumerics    *)
  96.   PPC_BWGFX    = {0};    (* black&white graphics        *)
  97.   PPC_COLORALPHA= {1};    (* color alphanumerics        *)
  98.   PPC_COLORGFX    = {0,1};(* color graphics        *)
  99.  
  100. (* Color Class *)
  101. CONST
  102.   PCC_BW    = 001H ; (* black&white only            *)
  103.   PCC_YMC    = 002H ; (* yellow/magenta/cyan only        *)
  104.   PCC_YMC_BW    = 003H ; (* yellow/magenta/cyan or black&white    *)
  105.   PCC_YMCB    = 004H ; (* yellow/magenta/cyan/black        *)
  106.   PCC_4COLOR    = 004H ; (* a flag for YMCB and BGRW        *)
  107.   PCC_ADDITIVE    = 008H ; (* not ymcb but blue/green/red/white    *)
  108.   PCC_WB    = 009H ; (* black&white only, 0 == BLACK    *)
  109.   PCC_BGR    = 00AH ; (* blue/green/red            *)
  110.   PCC_BGR_WB    = 00BH ; (* blue/green/red or black&white    *)
  111.   PCC_BGRW    = 00CH ; (* blue/green/red/white        *)
  112.  
  113. (* The picture must be scanned once for each color component, as the    *)
  114. (* printer can only define one color at a time.  ie. If 'PCC_YMC' then    *)
  115. (* first pass sends all 'Y' info to printer, second pass sends all 'M'    *)
  116. (* info, and third pass sends all C info to printer.  The CalComp    *)
  117. (* PlotMaster is an example of this type of printer.            *)
  118.  
  119.   PCC_MULTI_PASS= 010H ;  (* see explanation above *)
  120.  
  121. TYPE
  122.   PrinterExtendedData = RECORD
  123.     ped_PrinterName    : STRING ;    (* printer name, null terminated *)
  124.     ped_Init        : PROC ;    (* called after LoadSeg         *)
  125.     ped_Expunge        : PROC ;    (* called before UnLoadSeg     *)
  126.     ped_Open        : LIntProc ;    (* called at OpenDevice         *)
  127.     ped_Close        : PROC ;    (* called at CloseDevice     *)
  128.     ped_PrinterClass    : SHORTSET ;    (* printer class         *)
  129.     ped_ColorClass    : SHORTSET ;    (* color class             *)
  130.     ped_MaxColumns    : SHORTCARD ;    (* number of print columns available  *)
  131.     ped_NumCharSets    : SHORTCARD ;    (* number of character sets          *)
  132.     ped_NumRows        : CARDINAL ;    (* number of 'pins' in print head     *)
  133.     ped_MaxXDots    : LONGINT ;    (* number of dots max in a raster dump*)
  134.     ped_MaxYDots    : LONGINT ;    (* number of dots max in a raster dump*)
  135.     ped_XDotsInch    : CARDINAL ;    (* horizontal dot density          *)
  136.     ped_YDotsInch    : CARDINAL ;    (* vertical dot density              *)
  137.     ped_Commands    : ADDRESS ;     (* printer text command table          *)
  138.     ped_DoSpecial    : LIntProc ;    (* special command handler          *)
  139.     ped_Render        : LIntProc ;    (* raster render function          *)
  140.     ped_TimeoutSecs     : LONGINT ;     (* good write timeout              *)
  141.     (* the following only exists if the segment version is >= 33 *)
  142.     ped_8BitChars    : ADDRESS ;     (* conv. strings for the extended font*)
  143.     ped_PrintMode    : LONGINT ;    (* set if text printed, otherwise 0   *)
  144.     (* the following only exists if the segment version is >= 34 *)
  145.     (* ptr to conversion function for all chars *)
  146.     ped_ConvFunc    : LIntProc ;
  147.   END ;
  148.  
  149.   PrinterSegment = RECORD
  150.     ps_NextSegment : BADDRESS ;     (* (actually a BPTR)      *)
  151.     ps_runAlert       : LONGINT  ;     (* MOVEQ #0,D0 : RTS      *)
  152.     ps_Version       : CARDINAL ;     (* segment version      *)
  153.     ps_Revision       : CARDINAL ;     (* segment revision      *)
  154.     ps_PED       : PrinterExtendedData ;
  155.                      (* printer extended data *)
  156.   END ;
  157.  
  158. END PrtBase.
  159.