/***********************************************************************\

    Filename: thes.h

\***********************************************************************/

#ifndef SC_THES
#define SC_THES

/* part of speech numbers */

#define ADJ             0
#define ADJSP           1
#define ADV             2
#define CONJ            3
#define INTERJ          4
#define NOUN            5
#define PLNOUN          6
#define SPNOUN          7
#define PREP            8
#define PRON            9
#define VERB            10
#define VERBSP          11
#define VERBAUX         12
#define NPOS            13

/* indices corresponding to various entry types */

#define TH_SYN  0
#define TH_CMP  1
#define TH_REL  2
#define TH_CON  3
#define TH_ANT  4

/* part of speech bit positions, used in control */

#define TH_ADJ          0x0001L
#define TH_ADJSP        0x0002L
#define TH_ADV          0x0004L
#define TH_CONJ         0x0008L
#define TH_INTERJ       0x0010L
#define TH_NOUN         0x0020L
#define TH_PLNOUN       0x0040L
#define TH_SPNOUN       0x0080L
#define TH_PREP         0x0100L
#define TH_PRON         0x0200L
#define TH_VERB         0x0400L
#define TH_VERBSP       0x0800L
#define TH_VERBAUX      0x1000L

/* list retrieval controls */

#define TH_RETSYN       0x2000L
#define TH_RETCMP       0x4000L
#define TH_RETREL       0x8000L
#define TH_RETCON       0x10000L
#define TH_RETANT       0x20000L

/* inflection usage control bit */

#define TH_INFPOS       0x40000L
#define TH_INFALL       0x80000L
#define TH_INFSYN       0x100000L
#define TH_UNFDEF       0x200000L

/* thesaurus control for retrieving complete information */

#define TH_ALLPOS       0x1FFF          /* get all part of speeches */
#define TH_ALLLIST      0x3E000         /* get all the five lists */
#define TH_ALLMEAN      0x7F            /* get all meanings for word */
#define TH_ALLENTRY     0x7F            /* get all entries in a list */

/* states that a thesaurus can be */

#define TH_INIT         0x1
#define TH_DONE         0x2
#define TH_MORE         0x4
#define TH_UNFL         0x7
#define TH_STBITS       0x7
#define TH_CRITICAL     0x8

#define MAXMEAN         40      /* max no. of meanings */
#define MAXLISTS        5       /* syn,cmp,rel,con and ant */
#define MAXDEF          150     /* length of longest definition string */
#define MAXEXP          180     /* length of longest expanded def. string */
#define MAXHASH         40
#define MAXBITS         32      /* max no. of levels in huff. tree */
#define MAXUNF 4

/* thesaurus structure information */

#define THESLEX 0x40
#define THESHEAD 15                     /* number of shorts in thes header */
#define THESPROD (1 << 9 | 0)           /* major rev 2.0 */
#define WORDPROD (1 << 9 | 0)           /* word list revision 2.0 */

/* define root->inflection relationships */
/* the inflection->root (reverse relation) is forward + 1 */
/* zero means don't care */

#define DN_CR   0              /* don't care */
#define PR_PX   1              /* present to past or past participle */
#define PR_PS   3              /* present to past tense */
#define PS_PR   4              /* past to present */
#define PR_PP   5              /* present to past participle */
#define SI_PL   7              /* singular to plural */
#define VB_AJ   9              /* verb to adjective */
#define RE_CM   11             /* regular to comparative (adjective) */
#define RE_SU   13             /* regular to superlative (adjective) */
#define VB_NN   15             /* verb to noun */
#define AJ_AV   17             /* adjective to adverb */
#define AJ_NN   19             /* adjective to noun */
#define TP_SI   21             /* 3rd person singular */
#define PR_PC   23             /* present to present continuous */
#define SV_PX   25             /* present to past/pp (sp. verbs) */
#define SP_PL   27             /* singular to plural (sp. nouns) */
#define TP_SP   29             /* third person to second person */
#define TP_FP   31             /* third person to first person */

/* macros to test controls */

#define isunf(meanno)  (meanno >= Thes.tq_unfindex[0])

/* Error codes for the thesaurus */

#define ERR_DATA        10      /* thesaurus data error */
#define ERR_STR         11      /* thesaurus string section error */
#define ERR_STATE       12      /* thesaurus --- wrong state error */

#endif
