(*$M-*)
DEFINITION MODULE PrtBase;

FROM SYSTEM IMPORT
 ADDRESS,BYTE;
FROM Exec IMPORT
 Library,MsgPort,Task,UByte;
FROM Intuition IMPORT
 Preferences;
FROM Parallel IMPORT
 IOParallel;
FROM Serial IMPORT
 IOSerial;
FROM Timer IMPORT
 IOTimer;
 
TYPE
 DeviceData=RECORD
  device:Library;
  segment:ADDRESS;
  execBase:ADDRESS;
  cmdVectors:ADDRESS;
  cmdBytes:ADDRESS;
  numCommands:CARDINAL;
 END;
 DeviceDataPtr=POINTER TO DeviceData;

CONST
 stkSize=0800H;

TYPE
 PrinterSegmentPtr=POINTER TO PrinterSegment;
 PrinterData=RECORD
  device:DeviceData;
  unit:MsgPort;
  printerSegment:ADDRESS;
  printerType:CARDINAL;
  segmentData:PrinterSegmentPtr;
  printBuf:ADDRESS;
  pWrite:PROCEDURE():INTEGER;
  pBothReady:PROCEDURE():INTEGER;
  CASE :INTEGER OF
  | 1: p0:IOParallel;
       p1:IOParallel;
  | 2: s0:IOSerial;
       s1:IOSerial;
  END;
  tior:IOTimer;
  iorPort:MsgPort;
  tc:Task;
  stk:ARRAY [0..stkSize-1] OF BYTE;
  flags:UByte;
  pad:BYTE;
  preferences:Preferences;
  pWaitEnabled:UByte;
 END;
 PrinterDataPtr=POINTER TO PrinterData;
 PrinterClass=(gfx,color);
 PrinterClassSet=SET OF PrinterClass;

CONST
 bwAlpha=0;
 bwGfx=1;
 colorGfx=3;
 bw=1;
 ymc=2;
 ymcBw=3;
 ymcb=4;
 fourColor=04H;
 additive=8;
 wb=9;
 bgr=10;
 bgrWb=11;
 bgrw=12;

TYPE
 PrinterExtendedData=RECORD
  printerName:ADDRESS;
  init:PROC;
  expunge:PROC;
  open:PROCEDURE():INTEGER;
  close:PROC;
  printerClass:BYTE; (* little bit strange *)
  colorClass:UByte;
  maxColumns:UByte;
  numCharSets:UByte;
  numRows:CARDINAL;
  maxXDots:LONGCARD;
  maxYDots:LONGCARD;
  xDotsInch:CARDINAL;
  yDotsInch:CARDINAL;
  commands:ADDRESS;
  doSpecial:PROCEDURE():INTEGER;
  render:PROCEDURE():INTEGER;
  timeoutSecs:LONGINT;
  EightBitChars:ADDRESS;
 END;
 PrinterExtendedDataPtr=POINTER TO PrinterExtendedData;
 PrinterSegment=RECORD
  nextSegment:ADDRESS;
  runAlert:LONGCARD;
  version:CARDINAL;
  revision:CARDINAL;
  ped:PrinterExtendedData;
 END;

END PrtBase.
