/*
 * tos2gem.h dated 21.06.1995
 *
 * Author:
 * Thomas Binder
 *
 * Purpose:
 * Contains the stucture of the TOS2GEM Cookie.
 *
 * History:
 * 30.08.1994: Creation
 * 02.09.1994: Textbuffer- and screen-offset are 
 *             now handled as part of the Cookie-
 *             structure.
 * 03.09.1994: New element 'x_vis'.
 *             New element 'switch_cursor'.
 * 04.09.1994: New element 'reserve'.
 *             'switch_cursor' now called 
 *             'switch_output'.
 * 05.09.1994: 'switch_output' is no longer 
 *             passed parameters, but will 
 *             'switch' correctly.
 * 11.10.1994: The first reserved field is now 
 *             used and is called 'cursor_handle'.
 *             If this is larger than zero (which 
 *             ensures compatibility with programs 
 *             that don't know about it), then 
 *             this VDI-handle is used for 
 *             drawing the cursor, which speeds 
 *             up output appreciably.
 *             Cookie-structure appearance is 
 *             now clearer.
 * 05.11.1994: Offset values added.
 * 02.01.1995: Constant RESERVED_SIZE added and 
 *             the Cookie-structure adapted 
 *             accordingly.
 * 29.01.1995: New element 'buffer_output'.
 * 31.01.1995: Commennting of ther new element.
 * 05.04.1995: New element 'color'. In addition 
 *             the structure has been changed so 
 *             that no problems should arise with 
 *             C-compilers that arrange comma-
 *             delimited elements in reverse order.
 *             Furthermore the header file can 
 *             now be included several times 
 *             without problems arising.
 * 21.06.1995: New element 'stats'.
 */

#ifndef _TOS2GEM_H
#define _TOS2GEM_H

/* Number of fields in reserved-field */
#define RESERVED_SIZE   2

/* The Cookie-structure */
typedef struct
{
/* Version date (GEMDOS format) */
   WORD  date;                    /* 0x00 */

/* Reservation function */
   WORD  (*reserve)(void);        /* 0x02 */

/* Initialisation function */
   WORD  (*init)(void);           /* 0x06 */

/* Switching function */
   WORD  (*deinit)(void);         /* 0x0a */

/* Output redirection switching function */
   WORD  (*switch_output)(void);  /* 0x0e */

/* Pointer to text buffer */
   char  *text_buffer;            /* 0x12 */

/* Maximum number of buffer lines */
   WORD  max_lines;               /* 0x16 */

/* Size opf the 'Text' screen */
   WORD  x_size;                  /* 0x18 */
   WORD  y_size;                  /* 0x1a */

/* How many columns are visible? */
   WORD  x_vis;                   /* 0x1c */

/* How many lines are visible? */
   WORD  y_vis;                   /* 0x1e */

/* Upper left corner of screen (in pixels!) */
   WORD  x_off;                   /* 0x20 */
   WORD  y_off;                   /* 0x22 */

/* Maximum dimensions of a character (in pixels!) */
   WORD  char_w;                  /* 0x24 */
   WORD  char_h;                  /* 0x26 */

/* VDI-Workstation  to be used */
   WORD  vdi_handle;              /* 0x28 */

/* Offset of the visible portion */
   WORD  y_offset;                /* 0x2a */

/* Offset within the Text buffer */
   WORD  text_offset;             /* 0x2c */

/*
 * When > 0: VDI handle for drawing the cursor
 * (must != vdi_handle!)
 */
   WORD  cursor_handle;           /* 0x2e */

/*
 * When > 0: The number of characters that should first 
 * of all be buffered and only output when required
 */
   WORD  buffer_output;           /* 0x30 */

/*
 * When 1: TOS2GEM works with 'compatible'
 * VT52 colour support.  When > 1: TOS2GEM
 * uses VDI colour index compatible colours
 */
   WORD  color;                   /* 0x32 */

/*
 * Internal status variables, whose significance 
 * is not explained further. They are set when 
 * switching off redirection, and read out on 
 * re-activation via 'switch_output'.
 * The point of this: It makes possible for 
 * applications to release TOS2GEM for the time 
 * being and later continue using it in exactly 
 * the same state (see docs).
 */
   WORD  stats[5];                /* 0x34 */

/* Reserved at present, set to 0  */
   WORD  reserved[RESERVED_SIZE]; /* 0x3e */
} TOS2GEM_COOKIE;

#endif

/* EOF */
