antoine-source/appleworksgs/Spell/Inc/THESMISC.H
2023-03-04 03:45:20 +01:00

1 line
6.6 KiB
C
Executable File

/***********************************************************************\
Filename: thesmisc.h
\***********************************************************************/
#ifndef SC_THESMISC
#define SC_THESMISC
#ifndef _PROXLIB
#include "proxlib.h"
#endif
#ifndef SC_SCDEF
#include "scdef.h"
#endif
#ifndef SC_THES
#include "thes.h"
#endif
/* flags set in control nibble of a meaning */
/* if corresponding lists are present */
/* HAS_SYN is not defined because it is always true */
#define HAS_CMP 0x10
#define HAS_REL 0x20
#define HAS_CON 0x40
#define HAS_ANT 0x80
/* general parameters and flags */
#define MAXINDEX 2048 /* max length of thes bin index */
#define LASTLIST 0x800000L /* set for last meaning of a word */
#define LASTMEAN 0x780000L /* set for last entry of a meaning */
#define LEXBITS 0x07FFFFL /* mask for lexicon address bits */
#define OVERFLOW 0x10000L /* 64K */
#define CODEFLD 8
#define CODEBITS 0x000FFL
#define BINBITS 0x1FF00L
#define IBINHDR 32 /* size of the i-bin headers */
#define INDFLD 14
#define INDFLAG 0x2000
#define INDBITS 0x1FFF
#define MEANFLD 4
#define MEANBITS 0x000F
#define MBINBITS 0x1FF0
#define DIRBITS 0x1FFFFL
#define BLKBITS 0xFE00L
#define WORDFLD 9
#define WORDBITS 0x001FFL
#define POSBITS 0xF
#define LISTFLD 4
#define LISTBITS 0xF0
#define LISTMAX 0xF
#define HS_VERB 0x08000000L
#define HS_NOUN 0x10000000L
#define HS_INF 0x20000000L
#define HS_SEEN 0x40000000L
#define HS_SKIP 0x80000000L
#define INFCODE 1
#define UNFCODE 0
#define UNFSEP '/'
#define INFSEP '\016'
#define binnum(whash) (((whash) & BINBITS) >> CODEFLD)
#define codeval(whash) ((whash) & CODEBITS)
#define indval(indhash) ((indhash) & INDBITS)
#define meannum(mhash) ((mhash) & MEANBITS)
#define meanbin(mhash) (((mhash) & MBINBITS) >> MEANFLD)
#define eofind(mhash) (((mhash) & INDFLAG) == INDFLAG)
#define wordno(dirhash) ((dirhash) & WORDBITS)
#define blkno(dirhash) (((dirhash) & BLKBITS) >> WORDFLD)
#define isset(hval,bval) (((hval) & (bval)) == (bval))
/* this defines the mode in which only the exceptions that go from */
/* inflection to root is found */
#define UNF_IR 0xFF
/* function declarations */
long thesbit();
#define MAXREF 6
/* macros to test controls */
#define thunftst() (Thqcontrol & TH_INFPOS)
#define thinftst(mi,ui) ((mi)>=(ui))
#define thpostst(pos) (Thqcontrol & (1 << pos))
/* structure to hold information about an unflectable ending */
typedef struct {
char *en_end; /* the ending */
short en_len; /* length of ending */
short en_class; /* which class the ending falls into */
short en_pos; /* part of speech of unflected form */
short en_rel; /* how the root and inflection are related */
} END;
extern short Thesprod; /* product type */
extern short Theswrev; /* word list type used */
extern short Thesnibin; /* size of ibin index table */
extern short Thesniadd; /* size of ioverflow add table */
extern short Thesnmbin; /* size of mbin index table */
extern short Thesnmadd; /* size of moverflow add table */
extern short Theslcode; /* length of longest huffman code */
extern short Thesnchars; /* number of entries in Thesxlate */
extern short Thesstrsiz; /* max. length of the lists */
extern short Thesmaxdef; /* length of longest definition */
extern short Thesmaxhash; /* max. number of words in the lists */
extern short Thesnumstr; /* no. of encoded words in the definitions */
extern short Thestotstr; /* */
extern short Thesdirfld; /* length of the direct hashes */
extern short Thesposfld; /* length of the POS field */
extern char *Theshuffstr;
extern char **Theshuffind;
/* thesaurus tables */
extern unsigned *Thesibin; /* thesaurus ibin index tables */
extern unsigned *Thesiadd; /* ioverflow add table */
extern unsigned *Thesmbin; /* thesaurus ibin index tables */
extern unsigned *Thesmadd; /* ioverflow add table */
extern unsigned *Thescnttab; /* counts for each huffman code */
extern char *Thesxlate; /* huffman translation table */
extern long Thesidata; /* offset to indirect table data */
extern long Thesmdata; /* offset to meaning data */
/* thesaurus information and control fields */
extern long Thqcontrol; /* thesaurus access control */
extern long Thqdesc; /* hash value for the query */
extern long Thqcuraddr; /* current address */
extern int Thqnstrarr; /* string array size */
extern int Thqtblind; /* index to the descriptor table */
extern int Thqendtab; /* */
extern short Thqstate; /* thesaurus access state */
extern char Thqcount; /* count of meanings in Thqmean */
extern char Thqspecial; /* if the query is a special */
extern char Thqphrase; /* if the query is a phrase */
extern char Thqquery[LONGWORD]; /* query word, after doflags */
extern char Thqunfquery[LONGWORD]; /* unflected word(s) */
extern char *Thqmultunf[MAXUNF]; /* pointer(s) to unflected word(s) */
extern short Thqunfindex[MAXUNF]; /* index of unflected meanings */
extern short Thqunfpos[MAXUNF]; /* part of speech from unflection */
extern short Thqnumdesc[MAXUNF]; /* */
extern long Thqworddesc[MAXUNF]; /* hash value for the unflections */
extern END *Thqstage[MAXUNF]; /* unflection stage entries */
extern int Thqindtab[MAXMEAN * 2]; /* indirect pointer table */
extern long Thqaddr[MAXMEAN]; /* address of the meanings */
/* memory to hold one meaning of a word looked up in thesaurus */
extern char Thmpos; /* part of speech number */
extern char Thmmeanno; /* meaning number in thesaurus */
extern char Thmcount[MAXLISTS]; /* count for each list */
extern char **Thmlist[MAXLISTS]; /* headers to NULL terminated lists */
extern char **Thmstrarr; /* pointers to the words in the lists */
extern char *Thmstrings; /* thesaurus strings */
extern char *Thmstrend;
extern char *Thmsentinel;
extern int Thmhstart[MAXLISTS];
extern long *Thmhashes; /* pointer to hashes */
#endif