/***********************************************************************\ Filename: sclib.c \***********************************************************************/ #include #include #include #include "environ.h" #include "query.h" #include "string.h" /* This table defines the default en_acctab. Iswacctab is indexed by finding the flag in Flagtab (of isword()). For example, if the query is IW_PROPER and the word from the wordlist is IW_COMMON their indexes into Flagtab are 1 and 0 respectively. Bit 0 of Iswacctab[1] is set therefore the query has a valid flag. */ /* Bit Table */ int Iswacctab[] = { /* fedcba9876543210 */ 1, /* 0000000000000001 */ 1 | 1<<1, /* 0000000000000011 */ 1 | 1<<1 | 1<<2 | 1<<8, /* 0000000100000111 */ 1 | 1<<3, /* 0000000000001001 */ 1 | 1<<1 | 1<<3 | 1<<4, /* 0000000000011011 */ 1 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<8, /* 0000000100111111 */ 1<<6, /* 0000000001000000 */ 1<<6 | 1<<7, /* 0000000011000000 */ 1<<6 | 1<<7 | 1<<8, /* 0000000111000000 */ 1<<9, /* 0000001000000000 */ 1<<9 | 1<<10, /* 0000011000000000 */ 0, /* 0000000000000000 */ }; /* These globals are used throughout SC. */ QUERY Query; /* The current query information. */ int Sciswctl; /* The word lists to be used by isword() */ int Scflags; /* The flags being checked */ int Sclen; /* The length being checked */ int Scindex; /* The position being checked */ char Sclookup[LONGWORD+2]; /* The lookup form being checked */ char *Sccurlist; /* The current word list */ int Sccurblk; /* The current block number */ char Scdecomp[3*MAXWORD]; /* The decompression buffer */ char Scfdecomp[MAXFLAGS]; /* The flag decompression buffer */ int Sctag; /* The tag for the current word */ char *Scendptr; /* End of the decompressed data */ int Scerror; /* Spelling Components error return value */ /* Initialize the QUERY structure with information about the current query. */ int setquery(word) char *word; /* The query word */ { strecpy(Quword, word); /* Get the flags for the query and store them. */ if ((Scflags = Quflags = doflags(word, Qulookup, MAXWORD)) == ERROR) { Scerror = ERR_WLEN; Quflags = IW_NOTFOUND; return (FALSE); } Sclen = Qulen = strecpy(Sclookup, Qulookup) - Sclookup; /* Clear the word information. */ proxzero(Quinfo, MAXWORD); return (TRUE); } /* ¥¥¥ÊDEADCODE /* Like setquery, but sets up the current stuff only. This allows construction of a word in this buffer. * int setcquery(word) char *word; /* The query word * { if ((Scflags = doflags(word, Sclookup, MAXWORD)) == ERROR) { Scerror = ERR_WLEN; Scflags = IW_NOTFOUND; return (FALSE); } Sclen = strlen((char *)Sclookup); return (TRUE); } ¥¥¥ */