struct dent {
	struct dent *next;
	char *word;

	unsigned int used : 1;

/* bit fields for all of the flags */
	unsigned int v_flag : 1;
		/*
			"V" flag:
		        ...E --> ...IVE  as in CREATE --> CREATIVE
		        if # .ne. E, ...# --> ...#IVE  as in PREVENT --> PREVENTIVE
		*/
	unsigned int n_flag : 1;
		/*
			"N" flag:
			        ...E --> ...ION  as in CREATE --> CREATION
			        ...Y --> ...ICATION  as in MULTIPLY --> MULTIPLICATION
			        if # .ne. E or Y, ...# --> ...#EN  as in FALL --> FALLEN
		*/
	unsigned int x_flag : 1;
		/*
			"X" flag:
			        ...E --> ...IONS  as in CREATE --> CREATIONS
			        ...Y --> ...ICATIONS  as in MULTIPLY --> MULTIPLICATIONS
			        if # .ne. E or Y, ...# --> ...#ENS  as in WEAK --> WEAKENS
		*/
	unsigned int h_flag : 1;
		/*
			"H" flag:
			        ...Y --> ...IETH  as in TWENTY --> TWENTIETH
			        if # .ne. Y, ...# --> ...#TH  as in HUNDRED --> HUNDREDTH
		*/
	unsigned int y_flag : 1;
		/*
			"Y" FLAG:
			        ... --> ...LY  as in QUICK --> QUICKLY
		*/
	unsigned int g_flag : 1;
		/*
			"G" FLAG:
			        ...E --> ...ING  as in FILE --> FILING
			        if # .ne. E, ...# --> ...#ING  as in CROSS --> CROSSING
		*/
	unsigned int j_flag : 1;
		/*
			"J" FLAG"
			        ...E --> ...INGS  as in FILE --> FILINGS
			        if # .ne. E, ...# --> ...#INGS  as in CROSS --> CROSSINGS
		*/
	unsigned int d_flag : 1;
		/*
			"D" FLAG:
			        ...E --> ...ED  as in CREATE --> CREATED
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@IED  as in IMPLY --> IMPLIED
			        if # .ne. E or Y, or (# = Y and @ = A, E, I, O, or U)
			                ...@# --> ...@#ED  as in CROSS --> CROSSED
			                                or CONVEY --> CONVEYED
		*/
	unsigned int t_flag : 1;
		/*
			"T" FLAG:
			        ...E --> ...EST  as in LATE --> LATEST
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@IEST  as in DIRTY --> DIRTIEST
			        if # .ne. E or Y, or (# = Y and @ = A, E, I, O, or U)
			                ...@# --> ...@#EST  as in SMALL --> SMALLEST
			                                or GRAY --> GRAYEST
		*/
	unsigned int r_flag : 1;
		/*
			"R" FLAG:
			        ...E --> ...ER  as in SKATE --> SKATER
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@IER  as in MULTIPLY --> MULTIPLIER
			        if # .ne. E or Y, or (# = Y and @ = A, E, I, O, or U)
			                ...@# --> ...@#ER  as in BUILD --> BUILDER
			                                or CONVEY --> CONVEYER
		*/
	unsigned int z_flag : 1;
		/*
			"Z FLAG:
			        ...E --> ...ERS  as in SKATE --> SKATERS
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@IERS  as in MULTIPLY --> MULTIPLIERS
			        if # .ne. E or Y, or (# = Y and @ = A, E, I, O, or U)
			                ...@# --> ...@#ERS  as in BUILD --> BUILDERS
			                                or SLAY --> SLAYERS
		*/
	unsigned int s_flag : 1;
		/*
			"S" FLAG:
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@IES  as in IMPLY --> IMPLIES
			        if # .eq. S, X, Z, or H,
			                ...# --> ...#ES  as in FIX --> FIXES
			        if # .ne. S,X,Z,H, or Y, or (# = Y and @ = A, E, I, O, or U)
			                ...# --> ...#S  as in BAT --> BATS
			                                or CONVEY --> CONVEYS
		*/
	unsigned int p_flag : 1;
		/*
			"P" FLAG:
			        if @ .ne. A, E, I, O, or U,
			                ...@Y --> ...@INESS  as in CLOUDY --> CLOUDINESS
			        if # .ne. Y, or @ = A, E, I, O, or U,
			                ...@# --> ...@#NESS  as in LATE --> LATENESS
			                                or GRAY --> GRAYNESS
		*/
	unsigned int m_flag : 1;
		/*
			"M" FLAG:
			        ... --> ...'S  as in DOG --> DOG'S
		*/

	unsigned int keep : 1;

#ifdef CAPITALIZE
	/*
	** if followcase is set, the actual word entry (dent->word)
	** is followed by one or more further strings giving exact
	** capitalizations.   The first byte after the uppercase word
	** gives the number of capitalizations.  Each capitalization
	** is preceded by the character "+" if it is to be kept, or
	** "-" if it is to be discarded from the personal dictionary.
	** For example, the entry "ITCORP\0\3+ITcorp\0+ITCorp\0+ItCorp\0"
	** gives various ways of writing my e-mail address.  If all-lowercase
	** is acceptable, an all-lower entry must appear.  Simple
	** capitalization, on the other hand, is signified by the "capitalize"
	** flag.
	**
	** Suffixes always match the case of the final character of a word.
	**
	** If "allcaps" is set, the other two flags must be clear.
	*/
	unsigned int allcaps : 1;	/* Word must be all capitals */
	unsigned int capitalize : 1;	/* Capitalize the word */
	unsigned int followcase : 1;	/* Follow capitalization exactly */
	/*
	** The following entries denote the flag values that are actually
	** to be kept for this dictionary entry.  They may differ if the
	** "a" command is used for a word that differs only in capitalization.
	*/
	unsigned int k_allcaps : 1;
	unsigned int k_capitalize : 1;
	unsigned int k_followcase : 1;
#endif

};

#define WORDLEN 30

struct hashheader {
	int magic;
	int stringsize;
	int tblsize;
};

/* hash table magic number */
#define MAGIC 2


extern int aflag;
extern int lflag;

extern int li, co;	/* lines, columns */

extern char rootword[BUFSIZ];
extern struct dent *lastdent;

extern char *hashstrings;
extern struct hashheader hashheader;

extern char tempfile[200];

/* In ispell.c */
void servermode (void);
void disp (struct RexxMsg *msg, struct rexxCommandList *dat, char *p);
void rexxadd (struct RexxMsg *msg, char *p);
void rexxquickadd (struct RexxMsg *msg, char *p);
void rexxcheck (struct RexxMsg *msg, char *p);
void rexxquickcheck (struct RexxMsg *msg, char *p);
void rexxlookup (struct RexxMsg *msg, char *p);
void rexxfilecheck (struct RexxMsg *msg, char *p);
void rexxversion (struct RexxMsg *msg, char *p);
void rexxexit (struct RexxMsg *msg, char *p);

void givehelp (void);
void usage (void);
void initckch (void);
void main (int argc, char **argv);
void dofile (char *filename);
void checkfile (void);
void correct (char *token, char **currentchar);
void show_line (char *line, char *invstart, int invlen);
int show_char (int ch, int linew);
int line_size (char *buf, char *bufend);
void inserttoken (char *buf, char *start, char *token, char **currentchar);
int casecmp (char *a, char *b);
void makepossibilities (char *word);
int insert (char *word);
int wrongcapital (char *word);
void wrongletter (char *word);
void extraletter (char *word);
void missingletter (char *word);
void transposedletter (char *word);
int ins_cap (char *word, char *pattern);
char *getline (char *s);
void askmode (void);
void copyout (char **cc, int cnt);
void lookharder (char *string);
void regex_dict_lookup (char *cmd, char *grepstr);

/* In amiga.c */
void setcolors (char *style, char *fg, char *bg);
void printcon (char *fmt,...);
void putccon (char ch);
int getccon (void);
long rawmode (int flag);
LONG sendpkt (struct MsgPort *pid, LONG action, LONG args[], LONG nargs);
void terminit (void);
void done (void);
void erase (void);
void move (int row, int col);
void inverse (void);
void normal (void);
void backup (void);
void onstop (int signo);
void stop (void);
void sleep (int n);

/* In good.c */
int good (char *w);
int cap_ok (char *word, struct dent * dent);
void flagpr (char *w, int flag, char *modpoint);
void g_ending (char *w, int n);
void d_ending (char *w, int n);
void t_ending (char *w, int n);
void r_ending (char *w, int n);
void h_ending (char *w, int n);
void s_ending (char *w, int n);
void n_ending (char *w, int n);
void e_ending (char *w, int n);
void y_ending (char *w, int n);
int vowel (int c);

/* In hash.c */
unsigned int hash (char *s, int n, int hashsize);

/* In local.c */
void lldump (void);
void llinsert (char *s);

/* In lookup.c */
int linit (void);
struct dent *lookup (char *s, int n, int dotree);
char *do_regex_lookup (char *regex, int whence);

/* In minrexx.c */
long upRexxPort (char *s, struct rexxCommandList *rcl, char *exten, void(*uf)(struct RexxMsg *, struct rexxCommandList *, char *));
void closeRexxLib (void);
void dnRexxPort (void);
void dispRexxPort (void);
int cmdcmp (char *c, char *m);
int openRexxLib (void);
struct RexxMsg *sendRexxCmd (char *s, void (*f)(struct RexxMsg *msg), STRPTR p1, STRPTR p2, STRPTR p3);
struct RexxMsg *asyncRexxCmd (char *s);
void replytoit (struct RexxMsg *msg);
struct RexxMsg *syncRexxCmd (char *s, struct RexxMsg *msg);
void replyRexxCmd (struct RexxMsg *msg, long primary, long secondary, char *string);

/* In regex.c */
void re_fail (char *s, char c);
void chset (char c);
char *re_comp (char *pat);
char *pmatch (char *lp, char *ap);
int re_exec (char *lp);
void re_modw (char *s);
int re_subs (char *src, char *dst);
int dfadump (char *ap);

/* In tree.c */
void treeinit (char *p);
struct dent *treeinsert (char *word, int keep);
struct dent *tinsert (char *word, struct dent *proto, int keep);
struct dent *treelookup (char *word);
int pdictcmp (struct dent **enta, struct dent **entb);
void treeoutput (void);
void toutent (struct dent *cent);
void toutword (char *word, struct dent *cent);
void flagout (int flag);
char *upcase (char *s);
char *lowcase (char *s);

/* In xgets.c */
char *xgets (char *str);

/* In buildhash.c */
void output (void);
void filltable (void);
void readdict (void);
int makedent (char *lbuf, struct dent *d);
void newcount (void);
