|##########|
|#MAGIC   #|CLABLLGF
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx-x-x--x---x-x-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x-xx-x----------
|##########|
DEFINITION MODULE PrtBase;
(* $A- *)
FROM Exec      IMPORT Library,MsgPort,Task,Device,ExecBasePtr;
FROM Intuition IMPORT Preferences;
FROM Parallel  IMPORT IOParallel;
FROM Serial    IMPORT IOSerial;
FROM Timer     IMPORT IOTimer;
FROM System    IMPORT SysStringPtr,PROC,BPTR;

TYPE
  DeviceData    = RECORD OF Library;
                    segment     : ANYPTR;
                    execBase    : ExecBasePtr;
                    cmdVectors  : ANYPTR;
                    cmdBytes    : ANYPTR;
                    numCommands : CARDINAL;
                  END;
  DeviceDataPtr = POINTER TO DeviceData;

CONST
  oldStkSize = $800;
  stkSize    = $1000;
  bufSize    = 256;
  safeSize   = 128;


TYPE
  NormTask             = RECORD OF Task END;
  PrinterSegmentPtr    = POINTER TO PrinterSegment;

  PrinterData          = RECORD OF DeviceData;
                           unit            : MsgPort;
                           printerSegment  : BPTR;
                           printerType     : CARDINAL;
                           segmentData     : PrinterSegmentPtr;
                           printBuf        : ANYPTR;
                           pWrite          : PROCEDURE():INTEGER;
                           pBothReady      : PROCEDURE():INTEGER;
                           IF KEY : INTEGER
                             OF 1 THEN p0  : IOParallel;
                                       p1  : IOParallel
                             OF 2 THEN s0  : IOSerial;
                                       s1  : IOSerial
                           END;
                           tior            : IOTimer;
                           ioRPort         : MsgPort;
                           tc              : NormTask;
                           oldStk          : ARRAY [oldStkSize] OF SHORTCARD;
                           flags           : SHORTCARD;
                           pad             : SHORTCARD;
                           preferences     : Preferences;
                           pWaitEnabled    : SHORTCARD;
                           flags1          : SHORTCARD;
                           stk             : ARRAY [stkSize] OF SHORTCARD;
                         END;
  PrinterDataPtr       = POINTER TO PrinterData;
  PrinterClass         = (gfx,color);
  PrinterClassSet      = SET OF PrinterClass;

CONST
  bwAlpha    = PrinterClassSet:{};
  bwGfx      = PrinterClassSet:{gfx};
  colorAlpha = PrinterClassSet:{color};
  colorGfx   = PrinterClassSet:{gfx,color};

TYPE
  ColorClass    = (blackAndWhite,colors,fourColor,additive,multipass);
  ColorClassSet = SET OF ColorClass;

CONST
  bw         = ColorClassSet:{blackAndWhite};
  ymc        = ColorClassSet:{colors};
  ymcBw      = ColorClassSet:{blackAndWhite,colors};
  ymbc       = ColorClassSet:{fourColor};
  wb         = ColorClassSet:{blackAndWhite,additive};
  bgr        = ColorClassSet:{colors,additive};
  bgrWb      = ColorClassSet:{blackAndWhite,colors,additive};
  bgrw       = ColorClassSet:{fourColor,additive};

TYPE
  DoSpecial              = PROCEDURE(Command      : CARDINAL;
                                     OutPutBuffer : SysStringPtr;
                                     Line,
                                     LineSpace,
                                     CRLF,
                                     Params        : SHORTINT):INTEGER;

  Render                 = PROCEDURE(ct     : SHORTCARD;
                                     x,
                                     y      : CARDINAL;
                                     status : SHORTCARD):INTEGER;

  ConvFunc               = PROCEDURE():LONGINT;


  PrinterExtendedData    = RECORD
                             printerName  : SysStringPtr;
                             init         : PROC;
                             expunge      : PROC;
                             open         : PROCEDURE():INTEGER;
                             close        : PROC;
                             printerClass : PrinterClassSet;
                             colorClass   : ColorClassSet;
                             maxColumns   : SHORTCARD;
                             numCharSets  : SHORTCARD;
                             numRows      : CARDINAL;
                             maxXDots     : LONGCARD;
                             maxYDots     : LONGCARD;
                             xDotsInch    : CARDINAL;
                             yDotsInch    : CARDINAL;
                             commands     : ANYPTR;
                             doSpecial    : DoSpecial;
                             render       : Render;
                             timeOutSecs  : LONGINT;
                             eightBitChars: ANYPTR;
                             printMode    : LONGINT;
                             convFunc     : ConvFunc;
                           END;
  PrinterExtendetDataPtr = POINTER TO PrinterExtendedData;

  PrinterSegment         = RECORD
                             nextSegment  : BPTR;
                             runAlert     : LONGCARD;
                             version      : CARDINAL;
                             revision     : CARDINAL;
                             ped          : PrinterExtendedData
                           END

GROUP
  All   = DeviceData,DeviceDataPtr,bufSize,safeSize,stkSize,oldStkSize,
          NormTask,PrinterSegmentPtr,PrinterData,PrinterDataPtr,
          PrinterClass,PrinterClassSet,bwAlpha,bwGfx,colorAlpha,
          colorGfx,ColorClass,ColorClassSet,bw,ymc,ymcBw,ymbc,wb,bgr,
          bgrWb,bgrw,DoSpecial,Render,ConvFunc,PrinterExtendedData,
          PrinterExtendetDataPtr,PrinterSegment;



END PrtBase.
