(***************************************************************************

     $RCSfile: Console.mod $
  Description: Interface to console.device

   Created by: fjc (Frank Copeland)
    $Revision: 3.2 $
      $Author: fjc $
        $Date: 1994/08/08 01:09:48 $

  Includes Release 40.15

  (C) Copyright 1985-1993 Commodore-Amiga, Inc.
      All Rights Reserved

  Oberon-A interface Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Interface.
  See Oberon-A.doc for conditions of use and distribution.

***************************************************************************)

MODULE Console;

(*
** $C- CaseChk       $I- IndexChk  $L+ LongAdr   $N- NilChk
** $P- PortableCode  $R- RangeChk  $S- StackChk  $T- TypeChk
** $V- OvflChk       $Z- ZeroVars
*)

IMPORT
  E := Exec, IE := InputEvent, KM := KeyMap, G := Graphics, SYS := SYSTEM;


(*
**      $VER: console.h 36.11 (7.11.90)
**
**      Console device command definitions
*)

CONST

(****** Console commands ******)
  askKeyMap            * = E.cmdNonstd+0;
  setKeyMap            * = E.cmdNonstd+1;
  askDefaultKeyMap     * = E.cmdNonstd+2;
  setDefaultKeyMap     * = E.cmdNonstd+3;

(****** SGR parameters ******)

  sgrPrimary     * = 0;
  sgrBold        * = 1;
  sgrItalic      * = 3;
  sgrUnderscore  * = 4;
  sgrNegative    * = 7;

  sgrNormal      * = 22;      (* default foreground color, not bold *)
  sgrNotItalic   * = 23;
  sgrNotUnderscore * = 24;
  sgrPositive    * = 27;

(* these names refer to the ANSI standard, not the implementation *)
  sgrBlack       * = 30;
  sgrRed         * = 31;
  sgrGreen       * = 32;
  sgrYellow      * = 33;
  sgrBlue        * = 34;
  sgrMagenta     * = 35;
  sgrCyan        * = 36;
  sgrWhite       * = 37;
  sgrDefault     * = 39;

  sgrBlackBg     * = 40;
  sgrRedBg       * = 41;
  sgrGreenBg     * = 42;
  sgrYellowBg    * = 43;
  sgrBlueBg      * = 44;
  sgrMagentaBg   * = 45;
  sgrCyanBg      * = 46;
  sgrWhiteBg     * = 47;
  sgrDefaultBg   * = 49;

(* these names refer to the implementation, they are the preferred *)
(* names for use with the Amiga console device. *)
  sgrClr0        * = 30;
  sgrClr1        * = 31;
  sgrClr2        * = 32;
  sgrClr3        * = 33;
  sgrClr4        * = 34;
  sgrClr5        * = 35;
  sgrClr6        * = 36;
  sgrClr7        * = 37;

  sgrClr0Bg      * = 40;
  sgrClr1Bg      * = 41;
  sgrClr2Bg      * = 42;
  sgrClr3Bg      * = 43;
  sgrClr4Bg      * = 44;
  sgrClr5Bg      * = 45;
  sgrClr6Bg      * = 46;
  sgrClr7Bg      * = 47;


(****** DSR parameters ******)

  dsrCpr         * = 6;

(****** CTC parameters ******)
  ctcHSetTab     * = 0;
  ctcHClrTab     * = 2;
  ctcHClrTabsAll * = 5;

(****** TBC parameters ******)
  tbcHClrTab     * = 0;
  tbcHClrTabsAll * = 3;

(****** SM and RM parameters ******)
  mLNM   * = 20;      (* linefeed newline mode *)
  mASM   * = ">1";    (* auto scroll mode *)
  mAWM   * = "?7";    (* auto wrap mode *)


(**-- Device base variable----------------------------------------------*)


CONST

  name * = "console.device";

TYPE

  ConsoleBasePtr * = CPOINTER TO ConsoleBase;
  ConsoleBase * = RECORD (E.Device) END;


(**-- Device functions -------------------------------------------------*)

(*
**      $VER: console_protos.h 36.6 (7.11.90)
*)

LIBCALL (base : ConsoleBasePtr) CDInputHandler*
  ( events        [8] : IE.InputEventBasePtr;
    consoleDevice [9] : ConsoleBasePtr )
  : IE.InputEventBasePtr;
  -42;
LIBCALL (base : ConsoleBasePtr) RawKeyConvert*
  ( events     [8] : IE.InputEventBasePtr;
    VAR buffer [9] : ARRAY OF SYS.BYTE;
    length     [1] : LONGINT;
    keyMap    [10] : KM.KeyMapPtr )
  : LONGINT;
  -48;

END Console.
