(*
**	Cyclone Modula-2 Interface module:
**	$VER: conunit.h 36.15 (20.11.90)
**	Includes Release 40.15
**
**	Console device unit definitions
**
**	(C) Copyright 1986-1993 Commodore-Amiga, Inc.
**	    All Rights Reserved
**
**      Interface module by Marcel Timmermans
**      (C) Copyright 1995-1996 Marcel Timmermans
**      All Rights Reserved
*)

DEFINITION MODULE ConUnit; 

(*$ Implementation- *)

FROM SYSTEM IMPORT LONGSET,SHORTSET,ADDRESS;
FROM Console IMPORT mLnm;

IMPORT ExecD,gd:GraphicsD,km:KeyMapD,id:IntuitionD;

CONST

(* ---- console unit numbers for OpenDevice() *)
  library   = -1;      (* no unit, just fill in IO_DEVICE field *)
  standard  = 0;       (* standard unmapped console *)

(* ---- New unit numbers for OpenDevice() - (V36) *)

  charMap   = 1;       (* bind character map to console *)
  snipMap   = 3;       (* bind character map w/ snip to console *)

(* ---- New flag defines for OpenDevice() - (V37) *)

  flagDefault         = LONGSET{};
  flagNoDrawOnNewSize = LONGSET{0};


  pmbAsm    = mLnm+1;         (* internal storage bit for AS flag *)
  pmbAwm    = pmbAsm+1;       (* internal storage bit for AW flag *)
  maxTabs   = 80;

TYPE
 ConUnitPtr = POINTER TO ConUnit;
 ConUnit = RECORD
  mp            : ExecD.MsgPort;
      (* ---- read only variables *)
  window        : id.WindowPtr; (* intuition window bound to this unit *)
  xCP           : INTEGER;      (* character position *)
  yCP           : INTEGER;
  xMax          : INTEGER;      (* max character position *)
  yMax          : INTEGER;
  xRSize        : INTEGER;      (* character raster size *)
  yRSize        : INTEGER;
  xROrigin      : INTEGER;      (* raster origin *)
  yROrigin      : INTEGER;
  xRExtant      : INTEGER;      (* raster maxima *)
  yRExtant      : INTEGER;
  xMinShrink    : INTEGER;      (* smallest area intact from resize process *)
  yMinShrink    : INTEGER;
  xcCP          : INTEGER;      (* cursor position *)                          
  ycCP          : INTEGER;

     (* ---- read/write variables (writes must must be protected) *)
     (* ---- storage for AskKeyMap and SetKeyMap *)
  keyMapStruct  : km.KeyMap;
      (* ---- tab stops *)
  tabStops      : ARRAY [0..maxTabs-1] OF CARDINAL; (* 0 at start, 0xffff at end of list *)

      (* ---- console rastport attributes *)
  mask          : SHORTCARD;
  fgPen         : SHORTCARD;
  bgPen         : SHORTCARD;
  aolPen        : SHORTCARD;
  drawMode      : gd.DrawModeSet;
  obsolete1     : SHORTCARD;    (* was cu_AreaPtSz -- not used in V36 *)
  obsolete2     : ADDRESS;      (* was cu_AreaPtrn -- not used in V36 *)
  minTerms      : ARRAY [0..7] OF SHORTCARD;
  font          : gd.TextFontPtr;
  algoStyle     : SHORTCARD;
  txFlags       : SHORTCARD;
  txHeight      : CARDINAL;
  txWidth       : CARDINAL;
  txBaseLine    : CARDINAL;
  txSpacing     : INTEGER;

    (* ---- console MODES and RAW EVENTS switches *)
  modes0        : SHORTSET; 
  modes8        : SHORTSET;
  modes16       : SHORTSET;
  rawEvents0    : SHORTSET;
  rawEvents8    : SHORTSET;
  rawEvents16   : SHORTSET;
 END;

END ConUnit.
