/***********************************************************************\

    Filename: tlex.h

\***********************************************************************/

#ifndef SC_LEX
#define SC_LEX

#ifndef _PROXLIB
#include <proxlib.h>
#endif

#ifndef _PROXIO
#include <proxio.h>
#endif

#ifndef SC_SCDEF
#include "scdef.h"
#endif

#define LEX_REV         ((5 << 8) + 0)  /* Lexicon version level */
#define COPYRBYTES      256     /* size of the copyright area */
#define BLOCKSEGS       7       /* number of segments in a data block */
#define FLAGSIND        0xFF    /* Start of flags byte. */
#define NUMBACK         16      /* number of back space values */
#define SHORTLEX        0x02    /* short lexicon, in lx_prod. */

/* lexicon control structure, holding all relevant integer parameters, 
   string tables and substructures */ 

/* The first LEXHEADER ints of the LEX structure are read directly from the 
   lexicon file */

#define LEXHEADER       8

   /* header values written at start of each compressed lexicon */

extern short Tlexenvcode;     /* lexicon's environment code */
extern short Tlexscrev;       /* revision of sc compatible with lexicon */
extern short Tlexprod;        /* product code (shy, uh, etc.) */
extern short Tlexsegwords;    /* number of words in a segment */
extern short Tlexnbsd;        /* number of entries in BSD table */
extern short Tlexngram;       /* number of entries in di-gram table */
extern short Tlexnindex;      /* number of entries in the index table */
extern short Tlexnstrings;    /* size of the string area in bytes */

   /* locations of tables used by decompression routines */

extern UCHAR *Tlexstrings;    /* actual memory area used for the strings */
extern UCHAR *Tlexbs;         /* Backspaces for BSD's */
extern UCHAR **Tlexdelta;     /* Deltas for BSD's */
extern UCHAR (*Tlexgramtab)[2]; /* di-grams */
extern UCHAR **Tlexindextab;  /* block seed words */

   /* minimum indices into compressed data tables */

extern int   Tlexminbsd;      /* byte code for first BSD */
extern int   Tlexmingrm;      /* byte code for first multi-gram */

   /* miscellaneous */

extern HANDLE  Tlexfile;        /* file access handle */
extern char    Tlexadjptr;      /* pointers have been adjusted */
extern int     Tlexoffset;      /* block offset to first word of lexicon */
extern UCHAR   *Tlexblk;        /* location of decompression buffer start */
extern UCHAR   *Tlexblkptr;     /* current location in buffer */

#endif
