/*
 * $Header: /smsa/bsd:include/dev/vdu_seq.h:bsd  1.7  $
 * $Source: /smsa/bsd:include/dev/vdu_seq.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 */
/* vdu_seq.h
 *
 * Definitions for top-level of VDU driver.
 *
 */

#ifndef __dev_vdu_seq_h
#define __dev_vdu_seq_h

/* ASCII 8-bit code types - control/graphic groups */
#define Control_LO   0  /* codes 0..31 */
#define Graphic_LO   1  /* codes 32..126 */
#define Control_X7F  2  /* code 127 (DEL) */
#define Control_HI   3  /* codes 127..160 (some unassigned) */
#define Graphic_HI   4  /* codes 161..254 */
#define Control_XFF  5  /* code 255 (unassigned) */

typedef unsigned char CodeType;  /* use a byte to store this sort of thing in! */ 
  
extern const CodeType Code_Type[256];

/* prefix types for CSI sequences */
#define CSP_NONE  ('<'-1)         /* no character */
#define CSP_LT    '<'             /* '<' */
#define CSP_EQ    '='             /* '=' */
#define CSP_GT    '>'             /* '>' used by Acorn (e.g. Terminal) */
#define CSP_QM    '?'             /* '?' Used by DEC */

typedef struct
{
    unsigned int type:8, value:24;
} CSParam, CSParams[], *CSParamRef;


#define SEQ_MAX_SEQ_SIZE  256
typedef struct
{
    int state;
    int seq_size;
    unsigned char seq_buff[SEQ_MAX_SEQ_SIZE];
} SEQState, *SEQStateRef;

/*
 * Protocol Errors other than illegal syntax, which is indicated by the
 * illegal char being passed to the user protocol error handler
 */

#define  PE_BUFF_OVF (-1)     /* byte-seq state-machine buffer overflow */


#ifdef _KERNEL

extern void SEQ_init_state ();
extern void SEQ_get_state ();
extern void SEQ_set_state ();
extern void SEQ_flush_sequence ();
extern void SEQ_process_byte_sequence ();
extern void SEQ_init ();

#else

extern void SEQ_init_state (SEQStateRef s);
extern void SEQ_get_state (SEQStateRef s);
extern void SEQ_set_state (SEQStateRef s);
extern void SEQ_flush_sequence (void);
extern void SEQ_process_byte_sequence (unsigned char *buff, int count, unsigned int mask);
extern void SEQ_init (void);

#endif

#endif/*__dev_vdu_seq_h*/

/* EOF vdu_seq.h */
