/*->h.dc     */

#define STRLEN 32
#define STRMAX 31
#define KEYLEN 7
#define MINTOK 31

typedef struct
{
 char name[24];
 char  mark[8];
 char copy[64];
 char stuff[160];
} dheader;


typedef struct dict
{
 int             nowords;
 int             noindex;
 struct buffer * index;
 struct buffer * words;
} dict;


typedef struct word
{
 char string[STRLEN];    /* the word                */
 int  woffset;           /* offset of start of word */
 int  indexn;            /* number of index         */
 int  wordn;             /* word number             */
 int  len;               /* bytes in word woffset+len==next word */
} word;


typedef struct index
{
 unsigned short int woffset;  /* offset of first word indexed */
 unsigned short int wordn;    /* number of first word indexed */
 char  key[7];                /* string of characters         */
 char  extra;                 /* extra bits                   */
} index;



#define SETWOFF(indexp,woff) \
        ( ((indexp)->woffset=(woff)), \
          ((indexp)->extra=((((indexp)->extra) & 0xF0) | \
                           (((woff) & 0xF0000)>>16))))

#define WOFF(indexp)   (((indexp)->woffset) | ((((indexp)->extra) & 0xF)<<16))


#define SETWORDN(indexp,wordnv) \
        ( ((indexp)->wordn=(wordnv)), \
          ((indexp)->extra=((((indexp)->extra) & 0xF) | \
                           (((wordnv) & 0xF0000)>>12))))

#define WORDN(indexp)   (((indexp)->wordn) | ((((indexp)->extra) & 0xF0)<<12))


extern int    addword(char * word,dict * dp);
extern int    savedc(char * name,dict * dp);
extern int    loaddc(char * name,dict * dp);
extern void   trashdc(dict * dp);
extern int    deleteword(char * word,dict * dp);
extern int    nowords(dict * dp);
extern char * wordn(int n,dict * dp);
extern int    locword(int seekn,dict * dp,word * words);
extern int    nextword(dict * dp,word * words);
extern void   createdc(dict * dp);
extern int    findword(char * string,dict * dp,word * words,int * flags);
extern int    formword(dict * dp,word * words);


extern char * mfx[256];


extern int xstrncmp(char * s1,char * s2,int max,int * flags);

/* compares at most max chars of two strings  */
/* flags output 0x1    - mismatched case      */
/* flags input  0x1000 - ignore hyphens       */



extern int xscanword(char * string,int * flags,char * subs,char * dcspc);

extern void xgetscanstring(char * string);



