--
--      Shared screen definitions
--      Copyright (C) 1997  P.H. Welch
--      Modified 2005 Jonathan Whiting, Fred Barnes
--
--	This library is free software; you can redistribute it and/or
--	modify it under the terms of the GNU Lesser General Public
--	License as published by the Free Software Foundation; either
--	version 2 of the License, or (at your option) any later version.
--
--	This library is distributed in the hope that it will be useful,
--	but WITHOUT ANY WARRANTY; without even the implied warranty of
--	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--	Lesser General Public License for more details.
--
--	You should have received a copy of the GNU Lesser General Public
--	License along with this library; if not, write to the Free Software
--	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
--

--{{{  DATA TYPE COLOUR
DATA TYPE COLOUR IS BYTE:
--{{{  colour constants
VAL COLOUR default IS 255:
VAL COLOUR black IS 0:
VAL COLOUR red IS 1:
VAL COLOUR green IS 2:
VAL COLOUR yellow IS 3:
VAL COLOUR blue IS 4:
VAL COLOUR magenta IS 5:
VAL COLOUR cyan IS 6:
VAL COLOUR white IS 7:
VAL COLOUR bold.black IS 8:
VAL COLOUR bold.red IS 9:
VAL COLOUR bold.green IS 10:
VAL COLOUR bold.yellow IS 11:
VAL COLOUR bold.blue IS 12:
VAL COLOUR bold.magenta IS 13:
VAL COLOUR bold.cyan IS 14:
VAL COLOUR bold.white IS 15:
--}}}
--}}}
--{{{  DATA TYPE COORDINATES
DATA TYPE COORDINATES
  RECORD
    BYTE X, Y:
:
--}}}
--{{{  DATA TYPE COORDINATES.COLOUR
DATA TYPE COORDINATES.COLOUR
  RECORD
    BYTE X, Y:
    COLOUR col:
:
--}}}
--{{{  DATA TYPE SCREEN.NODE
--{{{  COMMENT This is really a UNION type!
--}}}

--{{{  tags
VAL BYTE coordinates.tag IS 0:
VAL BYTE colour.tag IS 1:
VAL BYTE byte.tag IS 2:
VAL BYTE character.tag IS 3:
VAL BYTE left.tag IS 4:
VAL BYTE right.tag IS 5:
VAL BYTE up.tag IS 6:
VAL BYTE down.tag IS 7:
VAL BYTE draw.left.tag IS 8:
VAL BYTE draw.right.tag IS 9:
VAL BYTE draw.up.tag IS 10:
VAL BYTE draw.down.tag IS 11:
VAL BYTE erase.eol.tag IS 12:
VAL BYTE erase.bol.tag IS 13:
VAL BYTE erase.line.tag IS 14:
VAL BYTE erase.eos.tag IS 15:
VAL BYTE erase.bos.tag IS 16:
VAL BYTE erase.screen.tag IS 17:
VAL BYTE cursor.visible.tag IS 18:
VAL BYTE cursor.invisible.tag IS 19:
VAL BYTE flush.tag IS 20:
--}}}

DATA TYPE SCREEN.NODE
  RECORD
    BYTE tag, a, b:
:
--}}}

--{{{  PROTOCOL SCREEN.CONTROL
PROTOCOL SCREEN.CONTROL
  CASE
    --{{{  atomic
    coordinates; COORDINATES
    colour; COLOUR
    string; BYTE::[]BYTE
    integer; INT
    byte; BYTE
    character; BYTE
    left; BYTE
    right; BYTE
    up; BYTE
    down; BYTE
    draw.left; BYTE; BYTE
    draw.right; BYTE; BYTE
    draw.up; BYTE; BYTE
    draw.down; BYTE; BYTE
    erase.eol
    erase.bol
    erase.line
    erase.eos
    erase.bos
    flush
    --}}}
    --{{{  structured
    pcs; COORDINATES.COLOUR; BYTE::[]BYTE
    pci; COORDINATES.COLOUR; INT
    pcb; COORDINATES.COLOUR; BYTE
    pcsi; COORDINATES.COLOUR; BYTE::[]BYTE; INT
    pcis; COORDINATES.COLOUR; INT; BYTE::[]BYTE
    pcsb; COORDINATES.COLOUR; BYTE::[]BYTE; BYTE
    pcbs; COORDINATES.COLOUR; BYTE; BYTE::[]BYTE
    pc.draw.left; COORDINATES.COLOUR; BYTE; BYTE
    pc.draw.right; COORDINATES.COLOUR; BYTE; BYTE
    pc.draw.up; COORDINATES.COLOUR; BYTE; BYTE
    pc.draw.down; COORDINATES.COLOUR; BYTE; BYTE
    c.erase.eol; COORDINATES
    c.erase.bol; COORDINATES
    c.erase.line; COORDINATES
    c.erase.eos; COORDINATES
    c.erase.bos; COORDINATES
    erase.screen
    cursor.visible
    cursor.invisible
    interpret; BYTE::[]SCREEN.NODE
    poison
    --}}}
:
--}}}

