antoine-source/appleworksgs/Spell/Src/THES.C

1 line
37 KiB
C++
Raw Normal View History

2023-03-04 02:45:20 +00:00
/***********************************************************************\ Filename: thes.c \***********************************************************************/ #include <string.h> #include "proxio.h" #include "tlex.h" #include "tenviron.h" #include "scdef.h" #include "thesmisc.h" #include "thes.h" #include "spmemory.h" #include "th.h" static thsinit(); static thesfetch(); static savemean(); static savedir(); static skipmean(); static findcode(); static theshuff(); static long binloc(); static getmean(); static setqflags(); static nextlist(); static getshtab(); static END *getstage(); static isinf(); static getstrtab(); static delunf(); static badunf(); static goodpos(); #define INFALT " or " #define MAXSTR 256 #define HUFFCH 129 #define MEAN 0 #define INIT 1 #define DEFS 2 /* Thes structure provides access to all the thesaurus query informataion and the results of a lookup. */ short Thesprod; /* product type */ short Theswrev; /* word list type used */ short Thesnibin; /* size of ibin index table */ short Thesniadd; /* size of ioverflow add table */ short Thesnmbin; /* size of mbin index table */ short Thesnmadd; /* size of moverflow add table */ short Theslcode; /* length of longest huffman code */ short Thesnchars; /* number of entries in Thesxlate */ short Thesstrsiz; /* max. length of the lists */ short Thesmaxdef; /* length of longest definition */ short Thesmaxhash; /* max. number of words in the lists */ short Thesnumstr; /* no. of encoded words in the definitions */ short Thestotstr; /* */ short Thesdirfld; /* length of the direct hashes */ short Thesposfld; /* length of the POS field */ char *Theshuffstr; char **Theshuffind; /* thesaurus tables */ unsigned *Thesibin; /* thesaurus ibin index tables */ unsigned *Thesiadd; /* ioverflow add table */ unsigned *Thesmbin; /* thesaurus ibin index tables */ unsigned *Thesmadd; /* ioverflow add table */ unsigned *Thescnttab; /* counts for each huffman code */ char *Thesxlate; /* huffman translation table */ long Thesidata; /* offset to indirect table data */ long Thesmdata; /* offset to meaning data */ /* thesaurus information and control fields */ long Thqcontrol; /* thesaurus access control */ long Thqdesc; /* hash value for the query */ long Thqcuraddr; /* current address */ int Thqnstrarr; /* string array size */ int Thqtblind; /* index to the descriptor table */ int Thqendtab; /* */ short Thqstate; /* thesaurus access state */ char Thqcount; /* count of meanings in Thqmean */ char Thqspecial; /* if the query is a special */ char Thqphrase; /* if the query is a phrase */ char Thqquery[LONGWORD]; /* query word, after doflags */ char Thqunfquery[LONGWORD]; /* unflected word(s) */ char *Thqmultunf[MAXUNF]; /* pointer(s) to unflected word(s) */ short Thqunfindex[MAXUNF]; /* index of unflected meanings */ short Thqunfpos[MAXUNF]; /* part of speech from unflection */ short Thqnumdesc[MAXUNF]; /* */ long Thqworddesc[MAXUNF]; /* hash value for the unflections */ END *Thqstage[MAXUNF]; /* unflection stage entries */ int Thqindtab[MAXMEAN * 2]; /* indirect pointer table */ long Thqaddr[MAXMEAN]; /* address of the meanings */ /* memory to hold one meaning of a word looked up in thesaurus */ char Thmpos; /* part of speech number */ char Thmmeanno; /* meaning number in thesaurus */ char Thmcount[MAXLISTS]; /* count for each list */ char **Thmlist[MAXLISTS]; /* headers to NULL terminated lists */ char **Thmstrarr; /* pointers to the words in the lists */ char *Thmstrings; /* thesaurus strings */ char *Thmstrend; char *Thmsentinel; int Thmhstart[MAXLIST