#include #include #include #include #define MAXLINE 1500 /*Maximum characters per line*/ #define MAXWORD 25 /*Maximum characters per word*/ #define MAXRECORD 4000 /*Max characters per record*/ #define TAB 9 #define MAC //Structures and unions typedef union Item { /*A pair of bytes or a long word address*/ short pair; unsigned char each[2]; }Item; typedef struct Bsect{ /*Index sector buffer*/ Item ltr[256]; } Bsect; short cursec; //Current sector being examined short enhance; // Controls whether colour enhancements are permitted short level; //Current search level in the tree. short next; short nextsec; /*Next sector*/ short prev; short root; /*root of b-tree*/ short rsect; unsigned long faddr; //Position in file unsigned long naddr; long lastpos; unsigned char inbuf[MAXLINE]; /*file buffers*/ unsigned char outbuf[MAXRECORD]; /*file buffers*/ char wordbuf[MAXWORD]; Bsect rootbuf,nodebuf; //Prototypes extern void canWord(char *str); void doback(void); //Get previous dictionary word void donext(void); //Get next dictionary word void doprint(unsigned char *ptr, short i); //Print a record void lcase(char *c); //Put word in lower case. short newsearch(short nextsec); //Rebegin search in a new sector. short search(char *word, Bsect *node); //Routine to find if a word is present unsigned long look(char *ptr, Bsect *node, short no); //Routine to find a position in file FILE *inp; /*Working file pointers to dict and index*/ FILE *ind; FILE *lind; FILE *linp; FILE *eind; FILE *einp;