1 diff -Nur vim60am.old/src/Makefile vim60am/src/Makefile
2 --- vim60am.old/src/Makefile Wed Jul 4 20:42:09 2001
3 +++ vim60am/src/Makefile Tue Jul 3 18:55:58 2001
5 # Use this for cproto 3 patchlevel 7 or above (use "cproto -V" to check):
6 PROTO_FLAGS = -m -M__ARGS -d -E"$(CPP)" $(NO_ATTR)
16 +SPELL_OBJ = objects/spell.o \
20 + objects/makedent.o \
25 ################################################
26 ## no changes required below this line ##
29 .SUFFIXES: .cc .c .o .pro
31 -PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
32 +PRE_DEFS = -Iproto -Ispell $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
33 POST_DEFS = $(X_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(TCL_CFLAGS) $(RUBY_CFLAGS) $(EXTRA_DEFS)
35 ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(POST_DEFS)
53 objects/undo.o: undo.c
56 +objects/spell.o: spell.c spell/local.h
57 + $(CCC) -o $@ spell.c
59 objects/window.o: window.c
63 objects/search.o: search.c vim.h auto/config.h feature.h os_unix.h \
64 auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
65 gui.h option.h ex_cmds.h proto.h globals.h farsi.h
66 +objects/spell.o: spell.c vim.h spell/config.h feature.h os_unix.h auto/osdef.h ascii.h \
67 + keymap.h term.h macros.h regexp.h structs.h gui.h globals.h farsi.h \
68 + option.h ex_cmds.h proto.h spell/local.h spell/wm.h spell/ispell.h
69 objects/syntax.o: syntax.c vim.h auto/config.h feature.h os_unix.h \
70 auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
71 gui.h option.h ex_cmds.h proto.h globals.h farsi.h
72 @@ -2334,3 +2358,26 @@
73 objects/integration.o: integration.c vim.h auto/config.h feature.h os_unix.h \
74 auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \
75 gui.h option.h ex_cmds.h proto.h globals.h farsi.h integration.h
77 +SPELL_CFLAGS=$(CFLAGS) -pedantic -DUSG=1
79 +objects/good.o: spell/good.c spell/config.h spell/ispell.h spell/i_proto.h spell/msgs.h spell/local.h
80 + $(CC) -c $(SPELL_CFLAGS) spell/good.c -o objects/good.o
82 +objects/lookup.o: spell/lookup.c spell/config.h spell/ispell.h spell/i_proto.h spell/msgs.h spell/local.h
83 + $(CC) -c $(SPELL_CFLAGS) spell/lookup.c -o objects/lookup.o
85 +objects/hash.o: spell/hash.c spell/config.h spell/ispell.h spell/i_proto.h spell/local.h
86 + $(CC) -c $(SPELL_CFLAGS) spell/hash.c -o objects/hash.o
88 +objects/makedent.o: spell/makedent.c spell/config.h spell/ispell.h spell/i_proto.h spell/msgs.h spell/local.h
89 + $(CC) -c $(SPELL_CFLAGS) spell/makedent.c -o objects/makedent.o
91 +objects/tree.o: spell/tree.c spell/config.h spell/ispell.h spell/i_proto.h spell/msgs.h spell/local.h
92 + $(CC) -c $(SPELL_CFLAGS) spell/tree.c -o objects/tree.o
94 +objects/tgood.o: spell/tgood.c spell/config.h spell/ispell.h spell/i_proto.h spell/local.h
95 + $(CC) -c $(SPELL_CFLAGS) spell/tgood.c -o objects/tgood.o
97 +objects/util.o: spell/util.c spell/config.h spell/ispell.h spell/i_proto.h spell/local.h
98 + $(CC) -c $(SPELL_CFLAGS) spell/util.c -o objects/util.o
99 diff -Nur vim60am.old/src/edit.c vim60am/src/edit.c
100 --- vim60am.old/src/edit.c Wed Jul 4 20:42:09 2001
101 +++ vim60am/src/edit.c Tue Jul 3 18:50:12 2001
103 if (c == Ctrl_V && ctrl_x_mode == CTRL_X_CMDLINE)
106 - if (c == Ctrl_V || c == Ctrl_Q)
108 +#ifndef FEAT_SPELL_HL /* WM */
114 c = Ctrl_V; /* pretend CTRL-V is last typed character */
115 @@ -1133,6 +1137,20 @@
118 #endif /* FEAT_INS_EXPAND */
119 +#ifdef FEAT_SPELL_HL /* WM */
121 + if(set_to_private_dict(
122 + ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE),
123 + curwin->w_cursor.col, FALSE))
127 + if(set_to_private_dict(
128 + ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE),
129 + curwin->w_cursor.col, TRUE))
134 case Ctrl_Y: /* copy from previous line or scroll down */
135 case Ctrl_E: /* copy from next line or scroll up */
136 diff -Nur vim60am.old/src/ex_cmds.h vim60am/src/ex_cmds.h
137 --- vim60am.old/src/ex_cmds.h Wed Jul 4 20:42:09 2001
138 +++ vim60am/src/ex_cmds.h Tue Jul 3 18:49:12 2001
140 RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
141 EX(CMD_source, "source", ex_source,
142 BANG|FILE1|TRLBAR|SBOXOK|CMDWIN),
143 +EX(CMD_spell, "spell", ex_spell,
144 + EXTRA|NOTRLCOM|CMDWIN),
145 EX(CMD_split, "split", ex_splitview,
146 BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
147 EX(CMD_sprevious, "sprevious", ex_previous,
148 diff -Nur vim60am.old/src/ex_docmd.c vim60am/src/ex_docmd.c
149 --- vim60am.old/src/ex_docmd.c Wed Jul 4 20:42:09 2001
150 +++ vim60am/src/ex_docmd.c Tue Jul 3 18:47:38 2001
153 # define ex_syntax ex_ni
155 +#ifndef FEAT_SPELL_HL
156 +# define ex_spell ex_ni
159 # define ex_perl ex_ni
160 # define ex_perldo ex_ni
161 @@ -2546,6 +2549,12 @@
162 set_context_in_syntax_cmd(xp, arg);
165 +#ifdef FEAT_SPELL_HL
174 diff -Nur vim60am.old/src/feature.h vim60am/src/feature.h
175 --- vim60am.old/src/feature.h Wed Jul 4 20:42:09 2001
176 +++ vim60am/src/feature.h Tue Jul 3 18:46:14 2001
182 +#undef FEAT_RIGHTLEFT
184 +#define FEAT_SPELL_HL /*WM*/
186 +/* # define FEAT_PRINTER */
189 * +emacs_tags When FEAT_EMACS_TAGS defined: Include support for
190 diff -Nur vim60am.old/src/globals.h vim60am/src/globals.h
191 --- vim60am.old/src/globals.h Wed Jul 4 20:42:09 2001
192 +++ vim60am/src/globals.h Tue Jul 3 18:45:54 2001
194 #ifdef USE_TERM_CONSOLE
195 EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */
197 +#ifdef FEAT_SPELL_HL
198 +EXTERN char_u hashname[MAXPATHL]; /* name of the dictionary */
200 EXTERN int termcap_active INIT(= FALSE); /* set by starttermcap() */
201 EXTERN int cur_tmode INIT(= TMODE_COOK); /* input terminal mode */
202 EXTERN int bangredo INIT(= FALSE); /* set to TRUE whith ! command */
203 diff -Nur vim60am.old/src/main.c vim60am/src/main.c
204 --- vim60am.old/src/main.c Wed Jul 4 20:42:09 2001
205 +++ vim60am/src/main.c Tue Jul 3 18:45:08 2001
206 @@ -1901,6 +1901,9 @@
209 #endif /* FEAT_VIMINFO */
210 +#ifdef FEAT_SPELL_HL
211 + spell_save_private_dict();
215 apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
216 diff -Nur vim60am.old/src/normal.c vim60am/src/normal.c
217 --- vim60am.old/src/normal.c Wed Jul 4 20:42:09 2001
218 +++ vim60am/src/normal.c Tue Jul 3 18:44:28 2001
221 static int get_visual_text __ARGS((cmdarg_T *cap, char_u **pp, int *lenp));
223 +#ifdef FEAT_SPELL_HL
224 +static void nv_settodict_q __ARGS((cmdarg_T *cap));
225 +static void nv_settodict_s __ARGS((cmdarg_T *cap));
227 static void nv_tagpop __ARGS((cmdarg_T *cap));
228 static void nv_scroll __ARGS((cmdarg_T *cap));
229 static void nv_kright __ARGS((cmdarg_T *cap));
231 {Ctrl_N, nv_down, NV_STS, FALSE},
232 {Ctrl_O, nv_ctrlo, 0, 0},
233 {Ctrl_P, nv_up, NV_STS, FALSE},
234 +#ifdef FEAT_SPELL_HL
235 + {Ctrl_Q, nv_settodict_q, 0, 0},
237 {Ctrl_Q, nv_ignore, 0, 0},
239 {Ctrl_R, nv_redo, 0, 0},
240 +#ifdef FEAT_SPELL_HL
241 + {Ctrl_S, nv_settodict_s, 0, 0},
243 {Ctrl_S, nv_ignore, 0, 0},
245 {Ctrl_T, nv_tagpop, NV_NCW, 0},
246 {Ctrl_U, nv_halfpage, 0, 0},
248 @@ -7316,6 +7328,28 @@
252 +#ifdef FEAT_SPELL_HL
257 + if(set_to_private_dict(
258 + ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE),
259 + curwin->w_cursor.col, FALSE))
260 + clearopbeep(cap->oap);
267 + if(set_to_private_dict(
268 + ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE),
269 + curwin->w_cursor.col, TRUE))
270 + clearopbeep(cap->oap);
276 * In exclusive Visual mode, may include the last character.
277 diff -Nur vim60am.old/src/option.c vim60am/src/option.c
278 --- vim60am.old/src/option.c Wed Jul 4 20:42:09 2001
279 +++ vim60am/src/option.c Tue Jul 3 18:42:14 2001
291 static char_u *p_syn;
293 +#ifdef FEAT_SPELL_HL
294 +static char_u *p_spelldirectory;
295 +static char_u *p_language;
300 @@ -1001,7 +1007,7 @@
301 {(char_u *)FALSE, (char_u *)0L}},
302 {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP,
303 (char_u *)&p_hl, PV_NONE,
304 - {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText",
305 + {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,Z:Spell",
307 {"history", "hi", P_NUM|P_VIM,
308 (char_u *)&p_hi, PV_NONE,
309 @@ -1247,6 +1253,13 @@
310 (char_u *)NULL, PV_NONE,
312 {(char_u *)"", (char_u *)0L}},
313 + {"language", "lang", P_STRING|P_ALLOCED|P_VI_DEF,
314 +#ifdef FEAT_SPELL_HL
315 + (char_u *)&p_language, PV_SPELL_LANG,
317 + (char_u *)NULL, PV_NONE,
319 + {(char_u *)"", (char_u *)0L}},
320 {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL,
322 (char_u *)&p_ls, PV_NONE,
323 @@ -1815,6 +1828,14 @@
324 {"sourceany", NULL, P_BOOL|P_VI_DEF,
325 (char_u *)NULL, PV_NONE,
326 {(char_u *)FALSE, (char_u *)0L}},
327 + {"spelldirectory", "spelldir", P_STRING|P_ALLOCED|P_VI_DEF|P_EXPAND,
328 +#ifdef FEAT_SPELL_HL
329 + (char_u *)&p_spelldirectory, PV_SPELL_DIR,
330 + {(char_u *)"/usr/lib/ispell", (char_u *)0L}},
332 + (char_u *)NULL, PV_NONE,
333 + {(char_u *)"", (char_u *)0L}},
335 {"splitbelow", "sb", P_BOOL|P_VI_DEF,
337 (char_u *)&p_sb, PV_NONE,
338 @@ -4337,6 +4357,26 @@
342 +#ifdef FEAT_SPELL_HL
343 + else if (varp == &p_spell_dir)
345 + STRCPY(hashname, p_spell_dir);
346 + STRCAT(hashname, "/");
347 + STRCAT(hashname, p_spell_lang);
348 + STRCAT(hashname, ".hash");
350 + redraw_all_later(NOT_VALID);
352 + else if (varp == &p_spell_lang)
354 + STRCPY(hashname, p_spell_dir);
355 + STRCAT(hashname, "/");
356 + STRCAT(hashname, p_spell_lang);
357 + STRCAT(hashname, ".hash");
359 + redraw_all_later(NOT_VALID);
364 /* 'encoding' and 'fileencoding' */
365 @@ -6998,6 +7038,10 @@
366 case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
368 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
370 +#ifdef FEAT_SPELL_HL
371 + case PV_SPELL_DIR: return (char_u *)&(p_spell_dir);
372 + case PV_SPELL_LANG: return (char_u *)&(p_spell_lang);
374 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
375 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
376 diff -Nur vim60am.old/src/option.h vim60am/src/option.h
377 --- vim60am.old/src/option.h Wed Jul 4 20:42:09 2001
378 +++ vim60am/src/option.h Tue Jul 3 18:40:28 2001
380 EXTERN char_u *p_dex; /* 'diffexpr' */
383 +EXTERN char_u *p_spell_dir; /* directory with spell hash*/
384 +EXTERN char_u *p_spell_lang; /* name of language (spell hash file)*/
385 #ifdef FEAT_INS_EXPAND
386 EXTERN char_u *p_dict; /* 'dictionary' */
388 diff -Nur vim60am.old/src/proto/spell.pro vim60am/src/proto/spell.pro
389 --- vim60am.old/src/proto/spell.pro Thu Jan 1 01:00:00 1970
390 +++ vim60am/src/proto/spell.pro Wed Jun 27 19:19:35 2001
392 +int reload_dict(void);
\r
393 +void ex_spell(exarg_T *eap);
\r
394 +int get_spell_attr(colnr_T spell_col, colnr_T col, char_u *line);
\r
395 +int set_to_private_dict(char *line, int cursor_col, int convert_to_lower);
\r
396 +void spell_save_private_dict(void);
\r
397 diff -Nur vim60am.old/src/proto.h vim60am/src/proto.h
398 --- vim60am.old/src/proto.h Wed Jul 4 20:42:09 2001
399 +++ vim60am/src/proto.h Tue Jul 3 18:38:16 2001
401 # include "os_qnx.pro"
404 +#ifdef FEAT_SPELL_HL
405 +# include "spell.pro"
407 # include "buffer.pro"
408 # include "charset.pro"
410 diff -Nur vim60am.old/src/screen.c vim60am/src/screen.c
411 --- vim60am.old/src/screen.c Wed Jul 4 20:42:09 2001
412 +++ vim60am/src/screen.c Tue Jul 3 18:37:48 2001
414 static match_T match_hl; /* used for ":match" highlight matching */
417 +#ifdef FEAT_SPELL_HL
418 +extern int spell_flag;
421 static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */
423 @@ -2333,6 +2336,9 @@
424 int syntax_attr = 0; /* attributes desired by syntax */
425 int has_syntax = FALSE; /* this buffer has syntax highl. */
427 +#ifdef FEAT_SPELL_HL
428 + int spell_attr = 0;
430 int extra_check; /* has syntax or linebreak */
432 int multi_attr = 0; /* attributes desired by multibyte */
433 @@ -2406,8 +2412,18 @@
437 +#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL_HL)
440 - if (syntax_present(wp->w_buffer))
441 + syntax_present(wp->w_buffer)
445 +#ifdef FEAT_SPELL_HL
451 syntax_start(wp, lnum);
453 @@ -3004,6 +3020,10 @@
454 else if (search_attr == 0 && has_syntax)
455 char_attr = syntax_attr;
457 +#ifdef FEAT_SPELL_HL
458 + else if (spell_flag)
459 + char_attr = spell_attr;
462 char_attr = search_attr;
464 @@ -3238,6 +3258,15 @@
466 if (area_attr == 0 && search_attr == 0)
467 char_attr = syntax_attr;
470 +#ifdef FEAT_SPELL_HL
474 + spell_attr = get_spell_attr((colnr_T)v - 1, col, ml_get_buf(wp->w_buffer, lnum, FALSE));
475 + if (!area_attr && !char_attr)
476 + char_attr = spell_attr;
479 #ifdef FEAT_LINEBREAK
480 diff -Nur vim60am.old/src/spell/config.h vim60am/src/spell/config.h
481 --- vim60am.old/src/spell/config.h Thu Jan 1 01:00:00 1970
482 +++ vim60am/src/spell/config.h Wed Jun 27 19:16:50 2001
484 +#include "local.h" /* local definitions for options */
487 +** Major-differences selection. The default system is BSD; for USG
488 +** or non-UNIX systems you should add the appropriate #define to local.h.
491 +#undef USG /* Define this in local.h for System V machines */
495 +#include <sys/param.h>
496 +#include <sys/types.h>
499 +# ifndef FEAT_SPELL_HL
501 +# include <dirent.h>
503 +# define NAMLEN(dirent) strlen((dirent)->d_name)
506 +# define dirent direct
507 +# define NAMLEN(dirent) (dirent)->d_namlen
508 +# if HAVE_SYS_NDIR_H
509 +# include <sys/ndir.h>
512 +# include <sys/dir.h>
522 +** Things that normally go in a Makefile. Define these just like you
523 +** might in the Makefile, except you should use #define instead of
524 +** make's assignment syntax. Everything must be double-quoted, and
525 +** (unlike make) you can't use any sort of $-syntax to pick up the
526 +** values of other definitions.
532 +#define EMACS "emacs"
541 +#define LINTFLAGS ""
542 +#endif /* LINTFLAGS */
548 +** Libraries that may need to be added to the cc line to get ispell to
549 +** link. Normally, this should be null.
556 +** TERMLIB - where to get the termcap library. Should be -ltermcap or
557 +** -lcurses on most systems.
560 +#define TERMLIB "-lncurses"
564 +** REGLIB - where to get the regular-expression routines, if
565 +** REGEX_LOOKUP is defined. Should be -lPW on USG systems, null on
573 +** Where to install various components of ispell. BINDIR contains
574 +** binaries. LIBDIR contains hash tables and affix files. ELISPDIR
575 +** contains emacs lisp files (if any) and TEXINFODIR contains emacs
576 +** TeXinfo files. MAN1DIR and MAN4DIR will hold the chapter-1 and
577 +** chapter-4 manual pages, respectively.
579 +** If you intend to use multiple dictionary files, I would suggest
580 +** LIBDIR be a directory which will contain nothing else, so sensible
581 +** names can be constructed for the -d option without conflict.
584 +#define BINDIR "/usr/bin"
587 +#define LIBDIR "/usr/lib/ispell"
590 +#define ELISPDIR "/usr/lib/emacs/site-lisp"
593 +#define TEXINFODIR "/usr/share/info"
596 +#define MAN1DIR "/usr/share/man/man1"
599 +#define MAN4DIR "/usr/share/man/man4"
603 +** Extensions to put on manual pages. Usually these are ".1" or ".1l".
606 +#define MAN1EXT ".1"
609 +#define MAN4EXT ".4"
613 +** List of all hash files (languages) which will be supported by ispell.
615 +** This variable has a complex format so that many options can be
616 +** specified. The format is as follows:
618 +** <language>[,<make-options>...] [<language> [,<make-options> ...] ...]
622 +** language is the name of a subdirectory of the
623 +** "languages" directory
624 +** make-options are options that are to be passed to "make" in
625 +** the specified directory. The make-options
626 +** should not, in general, specify a target, as
627 +** this will be provided by the make process.
629 +** For example, if LANGUAGES is:
631 +** "{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/dict/words /usr/dict/web2} {deutsch,DICTALWAYS=deutsch.sml,DICTOPTIONS=}"
633 +** then the American-English and Deutsch (German) languages will be supported,
634 +** and the following variable settings will be passed to the two Makefiles:
638 +** MASTERDICTS='american.med+'
639 +** HASHFILES='americanmed+.hash'
640 +** EXTRADICT='/usr/dict/words /usr/dict/web2'
644 +** DICTALWAYS='deutsch.sml'
647 +** Notes on the syntax: The makefile is not very robust. If you have
648 +** make problems, or if make seems to fail in the language-subdirs
649 +** dependency, check your syntax. The makefile adds single quotes to
650 +** the individual variables in the LANGUAGES specification, so don't
651 +** use quotes of any kind.
653 +** In the future, the first language listed in this variable will
654 +** become the default, and the DEFHASH, DEFLANG, and DEFPAFF,
655 +** variables will all become obsolete. So be sure to put your default
656 +** language first, to make later conversion easier!
658 +** Notes on options for the various languages will be found in the
659 +** Makefiles for those languages. Some of those languages may require
660 +** you to also change various limits limits like MASKBITS or the
661 +** length parameters.
663 +** A special note on the English language: because the British and
664 +** American dialects use different spelling, you should usually select
665 +** one or the other of these. If you select both, the setting of
666 +** MASTERHASH will determine which becomes the language linked to
667 +** DEFHASH (which will usually be named english.hash).
669 +** On MSDOS systems you must use names which are consistent with the
670 +** 8+3 filename restrictions, or you will risk filename collision. See
671 +** the file pc/local.djgpp for details.
674 +#define LANGUAGES "{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/dict/words}"
675 +#endif /* LANGUAGES */
678 +** Master hash file for DEFHASH. This is the name of a hash file
679 +** built by a language Makefile. It should be the most-popular hash
680 +** file on your system, because it is the one that will be used by
681 +** default. It must be listed in LANGUAGES, above.
684 +#define MASTERHASH "polish+.hash"
688 +** Default native-language hash file. This is the name given to the
689 +** hash table that will be used if no language is specified to
690 +** ispell. It is a link to MASTERHASH, above.
693 +#define DEFHASH "polish.hash"
697 +** Language tables for the default language. This must be the name of
698 +** the affix file that was used to generate the MASTERHASH/DEFHASH,
702 +#define DEFLANG "polish.aff"
706 +** Language to use for error messages. If there are no messages in this
707 +** language, English will be used instead.
710 +#define MSGLANG "polish"
711 +#endif /* MSGLANG */
714 +** If your sort command accepts the -T switch to set temp file
715 +** locations (try it out; it exists but is undocumented on some
716 +** systems), make the following variable the null string. Otherwise
717 +** leave it as the sed script.
720 +#define SORTTMP "-e '/!!SORTTMP!!/s/=.*$/=/'"
724 +** If your sort command accepts the -T switch (see above), make the
725 +** following variable refer to a temporary directory with lots of
726 +** space. Otherwise make it the null string.
728 +#ifndef MAKE_SORTTMP
729 +#define MAKE_SORTTMP "-T ${TMPDIR-/usr/tmp}"
733 +** If your shell needs ": Use /bin/sh" at the first line of a shell
734 +** script, make the following variable the null string. Otherwise
735 +** leave it as this sed script which will put a "#!/bin/sh" there.
737 +#ifndef MAKE_POUND_BANG
738 +#define MAKE_POUND_BANG "-e 1s,^:.*Use.*/bin/sh,#!/bin/sh,"
743 +** INSTALL program. Could be a copy program like cp or something fancier
744 +** like /usr/ucb/install -c
747 +#define INSTALL "cp"
751 +** If your system has the rename(2) system call, define HAS_RENAME and
752 +** ispell will use that call to rename backup files. Otherwise, it
753 +** will use link/unlink. There is no harm in this except on MS-DOS,
754 +** which doesn't support link/unlink.
758 +#endif /* HAS_RENAME */
760 +/* type given to signal() by signal.h */
762 +#define SIGNAL_TYPE void
765 +/* environment variable for user's word list */
767 +#define PDICTVAR "WORDLIST"
770 +/* prefix part of default word list */
772 +#define DEFPDICT ".ispell_"
776 +** suffix part of default word list
779 +#define DEFPAFF "words"
782 +/* old place to look for default word list */
784 +#define OLDPDICT ".ispell_"
785 +#endif /* OLDPDICT */
787 +#define OLDPAFF "words"
788 +#endif /* OLDPAFF */
790 +/* environment variable for include file string */
792 +#define INCSTRVAR "INCLUDE_STRING"
795 +/* default include string */
797 +#define DEFINCSTR "&Include_File&"
800 +/* mktemp template for temporary file - MUST contain 6 consecutive X's */
802 +#define TEMPNAME "/tmp/ispellXXXXXX"
806 +** If REGEX_LOOKUP is undefined, the lookup command (L) will use the look(1)
807 +** command (if available) or the egrep command. If REGEX_LOOKUP is defined,
808 +** the lookup command will use the internal dictionary and the
809 +** regular-expression library (which you must supply separately. There is
810 +** a public-domain library available; libraries are also distributed with
811 +** both BSD and System V.
813 +** The advantage of no REGEX_LOOKUP is that it is often much faster, especially
814 +** if the look(1) command is available, that the words found are presented
815 +** in alphabetical order, and that the list of words searched is larger.
816 +** The advantage of REGEX_LOOKUP is that ispell doesn't need to spawn another
817 +** program, and the list of words searched is exactly the list of (root) words
818 +** that ispell will accept. (However, note that words formed with affixes will
819 +** not be found; this can produce some artifacts. For example, since
820 +** "brother" can be formed as "broth+er", a lookup command might fail to
823 +#ifndef REGEX_LOOKUP
825 +#endif /* REGEX_LOOKUP */
828 +** Choose the proper type of regular-expression routines here. BSD
829 +** and public-domain systems have routines called re_comp and re_exec;
830 +** System V uses regcmp and regex.
832 +** REGCTYPE is the type of a variable to hold the compiled regexp
833 +** REGCMP(re,str) is the function which compiles a regexp in `str' into
834 +** a compiled regexp `re' declared as REGCTYPE and
836 +** REGEX(re,str,dummy) is a function which matches `str' against a compiled
837 +** regexp in `re' and returns a non-NULL pointer if it
838 +** matches, NULL otherwise.
839 +** REGFREE(re) is anything that should be done when the compiled
840 +** regexp `re' is no longer needed. It can be also used
841 +** to allocate any structures required to compile a
842 +** regexp, since it is called *before* compiling a new
843 +** regexp (that's where we know that the old one will no
846 +** Here is one way of defining these if you have POSIX regexp functions:
848 +** #include <sys/types.h>
849 +** #include <regex.h>
850 +** #define REGCTYPE regex_t *
851 +** #define REGCMP(re,str) (regcomp (re, str, 0), re)
852 +** #define REGEX(re, str, dummy) \
853 +** (re != 0 && regexec (re, str, 0, 0, 0) == 0 ? (char *)1 : NULL)
854 +** #define REGFREE(re) \
857 +** re = (regex_t *)calloc (1, sizeof (regex_t)); \
866 +#define REGCTYPE char *
867 +#define REGCMP(re,str) regcmp (str, (char *) 0)
868 +#define REGEX(re, str, dummy) regex (re, str, dummy, dummy, dummy, dummy, \
869 + dummy, dummy, dummy, dummy, dummy, dummy)
870 +#define REGFREE(re) do {if (re != NULL) free (re); re = NULL;} \
873 +#define REGCTYPE char *
874 +#define REGFREE(re) (void)0
875 +#define REGCMP(re,str) re_comp (str)
876 +#define REGEX(re, str, dummy) re_exec (str)
879 +#endif /* REGEX_LOOKUP */
881 +/* look command (if look(1) MAY BE available - ignored if not) */
882 +#ifndef REGEX_LOOKUP
884 +#define LOOK "look -df"
886 +#endif /* REGEX_LOOKUP */
888 +/* path to egrep (use speeded up version if available) */
891 +#define EGREPCMD "/bin/egrep"
893 +#define EGREPCMD "/usr/bin/egrep -i"
897 +/* path to wordlist for Lookup command (typically /usr/dict/{words|web2}) */
898 +/* note that /usr/dict/web2 is usually a bad idea due to obscure words */
900 +#define WORDS "/usr/dict/words"
903 +/* buffer size to use for file names if not in sys/param.h */
905 +#define MAXPATHLEN 240
908 +/* max file name length (will truncate to fit BAKEXT) if not in sys/param.h */
910 +#define MAXNAMLEN 14
913 +/* define if you want .bak file names truncated to MAXNAMLEN characters */
916 +#endif /* TRUNCATEBAK */
918 +/* largest word accepted from a file by any input routine, plus one */
919 +#ifndef INPUTWORDLEN
920 +#define INPUTWORDLEN 100
923 +/* largest amount that a word might be extended by adding affixes */
925 +#define MAXAFFIXLEN 20
929 +** Define the following to suppress the 8-bit character feature.
930 +** Unfortunately, this doesn't work as well as it might, because ispell
931 +** only strips the 8th bit in some places. For example, it calls strcmp()
932 +** quite often without first stripping parity. However, I really wonder
933 +** about the utility of this option, so I haven't bothered to fix it. If
934 +** you think the stripping feature of NO8BIT is useful, you might let me
935 +** (Geoff Kuenning) know.
937 +** Nevertheless, NO8BIT is a useful option for other reasons. If NO8BIT
938 +** is defined, ispell will probably use 8-bit characters internally;
939 +** this improves time efficiency and saves a small amount of space
940 +** in the hash file. Thus, I recommend you specify NO8BIT unless you
941 +** actually expect to be spelling files which use a 256-character set.
948 +** Number of mask bits (affix flags) supported. Must be 32, 64, 128, or
949 +** 256. If MASKBITS is 32 or 64, there are really only 26 or 58 flags
950 +** available, respectively. If it is 32, the flags are named with the
951 +** 26 English uppercase letters; lowercase will be converted to uppercase.
952 +** If MASKBITS is 64, the 58 flags are named 'A' through 'z' in ASCII
953 +** order, including the 6 special characters from 'Z' to 'a': "[\]^_`".
954 +** If MASKBITS is 128 or 256, all the 7-bit or 8-bit characters,
955 +** respectively, are theoretically available, though a few (newline, slash,
956 +** null byte) are pretty hard to actually use successfully.
958 +** Note that a number of non-English affix files depend on having a
959 +** larger value for MASKBITS. See the affix files for more
967 +** C type to use for masks. This should be a type that the processor
968 +** accesses efficiently.
970 +** MASKTYPE_WIDTH must correctly reflect the number of bits in a
971 +** MASKTYPE. Unfortunately, it is also required to be a constant at
972 +** preprocessor time, which means you can't use the sizeof operator to
975 +** Note that MASKTYPE *must* match MASKTYPE_WIDTH or you may get
976 +** division-by-zero errors!
979 +#define MASKTYPE long
981 +#ifndef MASKTYPE_WIDTH
982 +#define MASKTYPE_WIDTH 32
984 +#if MASKBITS < MASKTYPE_WIDTH
986 +#define MASKBITS MASKTYPE_WIDTH
987 +#endif /* MASKBITS < MASKTYPE_WIDTH */
990 +/* maximum number of include files supported by xgets; set to 0 to disable */
991 +#ifndef MAXINCLUDEFILES
992 +#define MAXINCLUDEFILES 5
996 +** Maximum hash table fullness percentage. Larger numbers trade space
1000 +#define MAXPCT 70 /* Expand table when 70% full */
1004 +** Maximum number of "string" characters that can be defined in a
1005 +** language (affix) file. Don't forget that an upper/lower string
1006 +** character counts as two!
1008 +#ifndef MAXSTRINGCHARS
1009 +#define MAXSTRINGCHARS 100
1010 +#endif /* MAXSTRINGCHARS */
1013 +** Maximum length of a "string" character. The default is appropriate for
1014 +** nroff-style characters starting with a backslash.
1016 +#ifndef MAXSTRINGCHARLEN
1017 +#define MAXSTRINGCHARLEN 10
1018 +#endif /* MAXSTRINGCHARLEN */
1021 +** the S_NOPARITY mask is applied to user input characters from the terminal
1022 +** in order to mask out the parity bit.
1025 +#define S_NOPARITY 0x7f
1027 +#define S_NOPARITY 0xff
1032 +** the terminal mode for ispell, set to CBREAK or RAW
1036 +#define TERM_MODE CBREAK
1040 +** Define this if you want your columns of words to be of equal length.
1041 +** This will spread short word lists across the screen instead of down it.
1043 +#ifndef EQUAL_COLUMNS
1044 +#undef EQUAL_COLUMNS
1045 +#endif /* EQUAL_COLUMNS */
1048 +** This is the extension that will be added to backup files
1051 +#define BAKEXT ".bak"
1055 +** Define this if you want to suppress the capitalization-checking
1056 +** feature. This will reduce the size of the hashed dictionary on
1057 +** most 16-bit and some 32-bit machines. This option is not
1060 +#ifndef NO_CAPITALIZATION_SUPPORT
1061 +#undef NO_CAPITALIZATION_SUPPORT
1062 +#endif /* NO_CAPITALIZATION_SUPPORT */
1065 +** Define this if you want your personal dictionary sorted. This may take
1066 +** a long time for very large dictionaries. Dictionaries larger than
1067 +** SORTPERSONAL words will not be sorted. Define SORTPERSONAL as zero
1068 +** to disable this feature.
1070 +#ifndef SORTPERSONAL
1071 +#define SORTPERSONAL 1000
1075 +** Define this if you want to use the shell for interpretation of commands
1076 +** issued via the "L" command, "^Z" under System V, and "!". If this is
1077 +** not defined then a direct fork()/exec() will be used in place of the
1078 +** normal system(). This may speed up these operations greately on some
1086 +** Maximum language-table search size. Smaller numbers make ispell
1087 +** run faster, at the expense of more memory (the lowest reasonable value
1088 +** is 2). If a given character appears in a significant position in
1089 +** more than MAXSEARCH suffixes, it will be given its own index table.
1090 +** If you change this, define INDEXDUMP in lookup.c to be sure your
1091 +** index table looks reasonable.
1094 +#define MAXSEARCH 4
1098 +** Define this if you want to be able to type any command at a "type space
1099 +** to continue" prompt.
1101 +#ifndef COMMANDFORSPACE
1102 +#undef COMMANDFORSPACE
1103 +#endif /* COMMANDFORSPACE */
1106 +** Memory-allocation increment. Buildhash allocates memory in chunks
1107 +** of this size, and then subdivides it to get its storage. This saves
1108 +** much malloc execution time. A good number for this is the system
1109 +** page size less the malloc storage overhead.
1111 +** Define this to zero to revert to using malloc/realloc. This is normally
1112 +** useful only on systems with limited memory.
1114 +#ifndef MALLOC_INCREMENT
1115 +#define MALLOC_INCREMENT 0
1119 +** Maximum number of "hits" expected on a word. This is basically the
1120 +** number of different ways different affixes can produce the same word.
1121 +** For example, with "english.aff", "brothers" can be produced 3 ways:
1122 +** "brothers," "brother+s", or "broth+ers". If this is too low, no major
1123 +** harm will be done, but ispell may occasionally forget a capitalization.
1126 +#define MAX_HITS 10
1130 +** Maximum number of capitalization variations expected in any word.
1131 +** Besides the obvious all-lower, all-upper, and capitalized versions,
1132 +** this includes followcase variants. If this is too low, no real
1133 +** harm will be done, but ispell may occasionally fail to suggest a
1134 +** correct capitalization.
1137 +#define MAX_CAPS 10
1138 +#endif /* MAX_CAPS */
1140 +/* Define this to ignore spelling check of entire LaTeX bibliography listings */
1146 +** Default nroff and TeX special characters. Normally, you won't want to
1147 +** change this; instead you would override it in the language-definition
1151 +#define TEXSPECIAL "{}$*.%#&?,;:!@~-"
1155 +#define NRSPECIAL "().\\*"
1159 +** Defaults for certain command-line flags.
1161 +#ifndef DEFNOBACKUPFLAG
1162 +#define DEFNOBACKUPFLAG 0 /* Don't suppress backup file */
1165 +#define DEFTEXFLAG 0 /* Default to nroff mode */
1169 +** Define this if you want ispell to place a limitation on the maximum
1170 +** size of the screen. On windowed workstations with very large windows,
1171 +** the size of the window can be too much of a good thing, forcing the
1172 +** user to look back and forth between the bottom and top of the screen.
1173 +** If MAX_SCREEN_SIZE is nonzero, screens larger than this will be treated
1174 +** as if they have only MAX_SCREEN_SIZE lines. A good value for this
1175 +** variable is 24 or 30. Define it as zero to suppress the feature.
1177 +#ifndef MAX_SCREEN_SIZE
1178 +#define MAX_SCREEN_SIZE 0
1182 +** The next three variables are used to provide a variable-size context
1183 +** display at the bottom of the screen. Normally, the user will see
1184 +** a number of lines equal to CONTEXTPCT of his screen, rounded down
1185 +** (thus, with CONTEXTPCT == 10, a 24-line screen will produce two lines
1186 +** of context). The context will never be greater than MAXCONTEXT or
1187 +** less than MINCONTEXT. To disable this feature entirely, set MAXCONTEXT
1188 +** and MINCONTEXT to the same value. To round context percentages up,
1189 +** define CONTEXTROUNDUP.
1191 +** Warning: don't set MAXCONTEXT ridiculously large. There is a
1192 +** static buffer of size MAXCONTEXT*BUFSIZ; since BUFSIZ is frequently
1193 +** 1K or larger, this can create a remarkably large executable.
1196 +#define CONTEXTPCT 10 /* Use 10% of the screen for context */
1199 +#define MINCONTEXT 2 /* Always show at least 2 lines of context */
1202 +#define MAXCONTEXT 10 /* Never show more than 10 lines of context */
1204 +#ifndef CONTEXTROUNDUP
1205 +#undef CONTEXTROUNDUP /* Don't round context up */
1209 +** Define this if you want the context lines to be displayed at the
1210 +** bottom of the screen, the way they used to be, rather than at the top.
1212 +#ifndef BOTTOMCONTEXT
1213 +#undef BOTTOMCONTEXT
1214 +#endif /* BOTTOMCONTEXT */
1217 +** Define this if you want the "mini-menu," which gives the most important
1218 +** options at the bottom of the screen, to be the default (in any case, it
1219 +** can be controlled with the "-M" switch).
1226 +** You might want to change this to zero if your users want to check
1227 +** single-letter words against the dictionary. However, you should try
1228 +** some sample runs using the -W switch before you try it out; you'd
1229 +** be surprised how many single letters appear in documents. If you increase
1230 +** MINWORD beyond 1, don't say I didn't warn you that it was a bad idea.
1233 +#define MINWORD 1 /* Words this short and shorter are always ok */
1237 +** ANSI C compilers are supposed to provide an include file,
1238 +** "stdlib.h", which gives function prototypes for all library
1239 +** routines. Define NO_STDLIB_H if you have a compiler that claims to
1240 +** be ANSI, but doesn't provide this include file.
1242 +#ifndef NO_STDLIB_H
1244 +#define NO_STDLIB_H
1245 +#endif /* __STDC__ */
1246 +#endif /* NO_STDLIB_H */
1249 +** The following define is used by the ispell developer to help
1250 +** double-check the software. Leave it undefined on other systems
1251 +** unless you are especially fond of warning messages, or are pursuing
1252 +** an inexplicable bug that might be related to a type mismatch.
1254 +#ifndef GENERATE_LIBARARY_PROTOS
1255 +#undef GENERATE_LIBARARY_PROTOS
1256 +#endif /* GENERATE_LIBARARY_PROTOS */
1259 +** Symbols below this point are generally intended to cater to
1260 +** idiosyncracies of specific machines and operating systems.
1262 +** MS-DOS users should also define HAS_RENAME, above, if appropriate.
1264 +** Define PIECEMEAL_HASH_WRITES if your system can't handle huge write
1265 +** operations. This is known to be a problem on MS-DOS systems when
1266 +** a 16-bit compiler is used to compile Ispell.
1268 +#ifndef PIECEMEAL_HASH_WRITES
1269 +#undef PIECEMEAL_HASH_WRITES
1270 +#endif /* PIECEMEAL_HASH_WRITES */
1273 +** Redefine GETKEYSTROKE() to getkey() on some MS-DOS systems where
1274 +** getchar() doesn't operate properly in raw mode.
1276 +#ifndef GETKEYSTROKE
1277 +#define GETKEYSTROKE() getchar ()
1278 +#endif /* GETKEYSTROKE */
1281 +** Define MSDOS_BINARY_OPEN to 0x8000 on MS-DOS systems. This can be
1282 +** done by adding "#include fcntl.h" to your local.h file.
1284 +#ifndef MSDOS_BINARY_OPEN
1286 +#define MSDOS_BINARY_OPEN O_BINARY
1287 +#else /* O_BINARY */
1288 +#define MSDOS_BINARY_OPEN 0
1289 +#endif /* O_BINARY */
1290 +#endif /* MSDOS_BINARY_OPEN */
1293 +** Environment variable to use to locate the home directory. On DOS
1294 +** systems you might want to set this to ISPELL_HOME to avoid
1295 +** conflicts with other programs that look for a HOME environment
1296 +** variable; on all other systems it should be just HOME.
1299 +#define HOME "HOME"
1303 +** On MS-DOS systems, define PDICTHOME to be the name of a directory
1304 +** to be used to contain the personal dictionary (.ispell_english,
1305 +** etc.). On other systems, you can leave it undefined.
1309 +#endif /* PDICTHOME */
1312 +** On MS-DOS systems, you can rename the following variables so that
1313 +** ispell's files have 3-character suffixes. Note that, if you do
1314 +** this, you will have to redefine any variable above that incorporates
1315 +** one of the suffixes. (Most MS-DOS environments will silently truncate
1316 +** excess characters beyond the 8+3 limit, so you usually don't need to
1317 +** change the suffixes just because they are longer than 3 characters.)
1320 +#define HASHSUFFIX ".hash"
1321 +#endif /* HASHSUFFIX */
1323 +#define STATSUFFIX ".sta"
1324 +#endif /* STATSUFFIX */
1325 +#ifndef COUNTSUFFIX
1326 +#define COUNTSUFFIX ".cnt"
1327 +#endif /* COUNTSUFFIX */
1328 +#define SIGNAL_TYPE_STRING "void"
1329 +#define MASKTYPE_STRING "long"
1330 diff -Nur vim60am.old/src/spell/good.c vim60am/src/spell/good.c
1331 --- vim60am.old/src/spell/good.c Thu Jan 1 01:00:00 1970
1332 +++ vim60am/src/spell/good.c Wed Jun 27 19:16:51 2001
1335 +static char Rcs_Id[] =
1340 + * good.c - see if a word or its root word
1341 + * is in the dictionary.
1343 + * Pace Willisson, 1983
1345 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1346 + * All rights reserved.
1348 + * Redistribution and use in source and binary forms, with or without
1349 + * modification, are permitted provided that the following conditions
1352 + * 1. Redistributions of source code must retain the above copyright
1353 + * notice, this list of conditions and the following disclaimer.
1354 + * 2. Redistributions in binary form must reproduce the above copyright
1355 + * notice, this list of conditions and the following disclaimer in the
1356 + * documentation and/or other materials provided with the distribution.
1357 + * 3. All modifications to the source code must be clearly marked as
1358 + * such. Binary redistributions based on modified source code
1359 + * must be clearly marked as modified versions in the documentation
1360 + * and/or other materials provided with the distribution.
1361 + * 4. All advertising materials mentioning features or use of this software
1362 + * must display the following acknowledgment:
1363 + * This product includes software developed by Geoff Kuenning and
1364 + * other unpaid contributors.
1365 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1366 + * products derived from this software without specific prior
1367 + * written permission.
1369 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1370 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1371 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1372 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1373 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1374 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1375 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1376 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1377 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1378 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1384 + * Revision 1.43 1994/11/02 06:56:05 geoff
1385 + * Remove the anyword feature, which I've decided is a bad idea.
1387 + * Revision 1.42 1994/10/25 05:45:59 geoff
1388 + * Add support for an affix that will work with any word, even if there's
1389 + * no explicit flag.
1391 + * Revision 1.41 1994/05/24 06:23:06 geoff
1392 + * Let tgood decide capitalization questions, rather than doing it ourselves.
1394 + * Revision 1.40 1994/05/17 06:44:10 geoff
1395 + * Add support for controlled compound formation and the COMPOUNDONLY
1396 + * option to affix flags.
1398 + * Revision 1.39 1994/01/25 07:11:31 geoff
1399 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
1404 +#include "ispell.h"
1406 +#ifndef NO_CAPITALIZATION_SUPPORT
1407 +Public Logical cap_ok (ichar_t * word, struct success * hit, int len);
1408 +Local Logical entryhasaffixes (struct dent * dent, struct success * hit);
1409 +#endif /* NO_CAPITALIZATION_SUPPORT */
1410 +Public void flagpr (ichar_t * word, int preflag, int prestrip,
1411 + int preadd, int sufflag, int sufadd);
1412 +Local ichar_t * orig_word;
1415 +#ifndef NO_CAPITALIZATION_SUPPORT
1416 +good (ichar_t *w, int ignoreflagbits, int allhits, int pfxopts, int sfxopts)
1419 +good (ichar_t *w, int ignoreflagbits, int dummy, int pfxopts, int sfxopts)
1420 +#define allhits 0 /* Never actually need more than one hit */
1424 + ichar_t nword[INPUTWORDLEN + MAXAFFIXLEN];
1425 + register ichar_t *p;
1426 + register ichar_t *q;
1428 + register struct dent *dp;
1431 + ** Make an uppercase copy of the word we are checking.
1433 + for (p = w, q = nword; *p; )
1434 + *q++ = mytoupper (*p++);
1442 + (void) printf ("%s", ichartosstr (w, 0));
1445 + else if ((dp = lookup (nword, 1)) != NULL)
1447 + hits[0].dictent = dp;
1448 + hits[0].prefix = NULL;
1449 + hits[0].suffix = NULL;
1450 +#ifndef NO_CAPITALIZATION_SUPPORT
1451 + if (allhits || cap_ok (w, &hits[0], n))
1457 + * If we're looking for compounds, and this root doesn't
1458 + * participate in compound formation, undo the hit.
1460 + if (compoundflag == COMPOUND_CONTROLLED
1461 + && ((pfxopts | sfxopts) & FF_COMPOUNDONLY) != 0
1462 + && hashheader.compoundbit >= 0
1463 + && TSTMASKBIT (dp->mask, hashheader.compoundbit) == 0)
1466 + if (numhits && !allhits)
1469 + /* try stripping off affixes */
1472 + numchars = icharlen (nword);
1476 + (void) putchar ('\n');
1477 + return numhits || (numchars == 1);
1481 + chk_aff (w, nword, n, ignoreflagbits, allhits, pfxopts, sfxopts);
1484 + (void) putchar ('\n');
1489 +#ifndef NO_CAPITALIZATION_SUPPORT
1491 +cap_ok (register ichar_t *word, register struct success *hit, int len)
1493 + register ichar_t * dword;
1494 + register ichar_t * w;
1495 + register struct dent * dent;
1496 + ichar_t dentword[INPUTWORDLEN + MAXAFFIXLEN];
1504 + thiscap = whatcap (word);
1506 + ** All caps is always legal, regardless of affixes.
1508 + preadd = prestrip = sufadd = 0;
1509 + if (thiscap == ALLCAPS)
1511 + else if (thiscap == FOLLOWCASE)
1513 + /* Set up some constants for the while(1) loop below */
1516 + preadd = hit->prefix->affl;
1517 + prestrip = hit->prefix->stripl;
1520 + preadd = prestrip = 0;
1521 + sufadd = hit->suffix ? hit->suffix->affl : 0;
1524 + ** Search the variants for one that matches what we have. Note
1525 + ** that thiscap can't be ALLCAPS, since we already returned
1528 + dent = hit->dictent;
1531 + dentcap = captype (dent->flagfield);
1532 + if (dentcap != thiscap)
1534 + if (dentcap == ANYCASE && thiscap == CAPITALIZED
1535 + && entryhasaffixes (dent, hit))
1538 + else /* captypes match */
1540 + if (thiscap != FOLLOWCASE)
1542 + if (entryhasaffixes (dent, hit))
1548 + ** Make sure followcase matches exactly.
1549 + ** Life is made more difficult by the
1550 + ** possibility of affixes. Start with
1553 + (void) strtoichar (dentword, dent->word, INPUTWORDLEN, 1);
1555 + limit = word + preadd;
1556 + if (myupper (dword[prestrip]))
1558 + for (w = word; w < limit; w++)
1561 + goto doublecontinue;
1566 + for (w = word; w < limit; w++)
1569 + goto doublecontinue;
1572 + dword += prestrip;
1573 + /* Do root part of word */
1574 + limit = dword + len - preadd - sufadd;
1575 + while (dword < limit)
1577 + if (*dword++ != *w++)
1578 + goto doublecontinue;
1581 + dword = limit - 1;
1582 + if (myupper (*dword))
1587 + goto doublecontinue;
1595 + goto doublecontinue;
1599 + ** All failure paths go to "doublecontinue,"
1600 + ** so if we get here it must match.
1602 + if (entryhasaffixes (dent, hit))
1607 + if ((dent->flagfield & MOREVARIANTS) == 0)
1609 + dent = dent->next;
1612 + /* No matches found */
1617 +** See if this particular capitalization (dent) is legal with these
1618 +** particular affixes.
1621 +entryhasaffixes (register struct dent *dent, register struct success *hit)
1624 + if (hit->prefix && !TSTMASKBIT (dent->mask, hit->prefix->flagbit))
1626 + if (hit->suffix && !TSTMASKBIT (dent->mask, hit->suffix->flagbit))
1628 + return True; /* Yes, these affixes are legal */
1633 + * Print a word and its flag, making sure the case of the output matches
1634 + * the case of the original found in "orig_word".
1637 +flagpr (register ichar_t *word, /* (Modified) word to print */
1638 + int preflag, /* Prefix flag (if any) */
1639 + int prestrip, /* Lth of pfx stripped off orig_word */
1640 + int preadd, /* Length of prefix added to w */
1641 + int sufflag, /* Suffix flag (if any) */
1642 + int sufadd) /* Length of suffix added to w */
1644 + register ichar_t * origp; /* Pointer into orig_word */
1645 + int orig_len; /* Length of orig_word */
1647 + orig_len = icharlen (orig_word);
1649 + * We refuse to print if the cases outside the modification
1650 + * points don't match those just inside. This prevents things
1651 + * like "OEM's" from being turned into "OEM/S" which expands
1652 + * only to "OEM'S".
1656 + origp = orig_word + preadd;
1657 + if (myupper (*origp))
1659 + for (origp = orig_word; origp < orig_word + preadd; origp++)
1661 + if (mylower (*origp))
1667 + for (origp = orig_word; origp < orig_word + preadd; origp++)
1669 + if (myupper (*origp))
1676 + origp = orig_word + orig_len - sufadd;
1677 + if (myupper (origp[-1]))
1679 + for ( ; *origp != 0; origp++)
1681 + if (mylower (*origp))
1687 + origp = orig_word + orig_len - sufadd;
1688 + for ( ; *origp != 0; origp++)
1690 + if (myupper (*origp))
1696 + * The cases are ok. Put out the word, being careful that the
1697 + * prefix/suffix cases match those in the original, and that the
1698 + * unchanged characters from the original actually match it.
1700 + (void) putchar (' ');
1701 + origp = orig_word + preadd;
1702 + if (myupper (*origp))
1704 + while (--prestrip >= 0)
1705 + (void) fputs (printichar ((int) *word++), stdout);
1709 + while (--prestrip >= 0)
1710 + (void) fputs (printichar ((int) mytolower (*word++)), stdout);
1712 + for (prestrip = orig_len - preadd - sufadd; --prestrip >= 0; word++)
1713 + (void) fputs (printichar ((int) *origp++), stdout);
1714 + if (origp > orig_word)
1716 + if (myupper (*origp))
1717 + (void) fputs (ichartosstr (word, 0), stdout);
1722 + (void) fputs (printichar ((int) mytolower (*word++)), stdout);
1726 + * Now put out the flags
1728 + (void) putchar (hashheader.flagmarker);
1730 + (void) putchar (preflag);
1732 + (void) putchar (sufflag);
1734 diff -Nur vim60am.old/src/spell/hash.c vim60am/src/spell/hash.c
1735 --- vim60am.old/src/spell/hash.c Thu Jan 1 01:00:00 1970
1736 +++ vim60am/src/spell/hash.c Wed Jun 27 19:16:51 2001
1739 + * hash.c - a simple hash function for ispell
1741 + * Pace Willisson, 1983
1743 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1744 + * All rights reserved.
1746 + * Redistribution and use in source and binary forms, with or without
1747 + * modification, are permitted provided that the following conditions
1750 + * 1. Redistributions of source code must retain the above copyright
1751 + * notice, this list of conditions and the following disclaimer.
1752 + * 2. Redistributions in binary form must reproduce the above copyright
1753 + * notice, this list of conditions and the following disclaimer in the
1754 + * documentation and/or other materials provided with the distribution.
1755 + * 3. All modifications to the source code must be clearly marked as
1756 + * such. Binary redistributions based on modified source code
1757 + * must be clearly marked as modified versions in the documentation
1758 + * and/or other materials provided with the distribution.
1759 + * 4. All advertising materials mentioning features or use of this software
1760 + * must display the following acknowledgment:
1761 + * This product includes software developed by Geoff Kuenning and
1762 + * other unpaid contributors.
1763 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1764 + * products derived from this software without specific prior
1765 + * written permission.
1767 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1768 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1769 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1770 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1771 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1772 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1773 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1774 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1775 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1776 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1782 + * Revision 1.20 1994/01/25 07:11:34 geoff
1783 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
1787 +#include "ispell.h"
1790 + * The following hash algorithm is due to Ian Dall, with slight modifications
1791 + * by Geoff Kuenning to reflect the results of testing with the English
1792 + * dictionaries actually distributed with ispell.
1794 +#define HASHSHIFT 5
1796 +#ifdef NO_CAPITALIZATION_SUPPORT
1797 +#define HASHUPPER(c) c
1798 +#else /* NO_CAPITALIZATION_SUPPORT */
1799 +#define HASHUPPER(c) mytoupper(c)
1800 +#endif /* NO_CAPITALIZATION_SUPPORT */
1804 + register ichar_t * s,
1805 + register int hashtblsize)
1807 + register long h = 0;
1810 +#ifdef ICHAR_IS_CHAR
1811 + for (i = 4; i-- && *s != 0; )
1812 + h = (h << 8) | HASHUPPER (*s++);
1813 +#else /* ICHAR_IS_CHAR */
1814 + for (i = 2; i-- && *s != 0; )
1815 + h = (h << 16) | HASHUPPER (*s++);
1816 +#endif /* ICHAR_IS_CHAR */
1820 + * We have to do circular shifts the hard way, since C doesn't
1821 + * have them even though the hardware probably does. Oh, well.
1823 + h = (h << HASHSHIFT) |
1824 + ((h >> (32 - HASHSHIFT)) & ((1 << HASHSHIFT) - 1));
1825 + h ^= HASHUPPER (*s++);
1827 + return (unsigned long) h % hashtblsize;
1829 diff -Nur vim60am.old/src/spell/i_proto.h vim60am/src/spell/i_proto.h
1830 --- vim60am.old/src/spell/i_proto.h Thu Jan 1 01:00:00 1970
1831 +++ vim60am/src/spell/i_proto.h Wed Jun 27 19:16:51 2001
1833 +Global int addvheader (struct dent * ent);
1834 +Global void askmode (void);
1835 +Global void backup (void);
1836 +#ifndef NO_CAPITALIZATION_SUPPORT
1837 +Global Logical cap_ok (ichar_t * word, struct success * hit, int len);
1838 +#endif /* NO_CAPITALIZATION_SUPPORT */
1839 +Global void chupcase (char * s);
1840 +Global void checkfile (void);
1841 +Global void checkline (FILE * ofile);
1842 +Global void chk_aff (ichar_t * word, ichar_t * ucword, int len,
1843 + int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
1844 +Global int combinecaps (struct dent * hdr, struct dent * newent);
1845 +Global int compoundgood (ichar_t * word, int pfxopts);
1846 +Global void copyout (char ** cc, int cnt);
1847 +Global void correct (char * ctok, int ctokl, ichar_t * itok, int itokl,
1849 +Global char * do_regex_lookup (char * expr, int whence);
1850 +Global SIGNAL_TYPE done (int);
1851 +Global void dumpmode (void);
1852 +Global void erase (void);
1853 +Global int expand_pre (char * croot, ichar_t * rootword,
1854 + MASKTYPE mask[], int option, char *extra);
1855 +Global int expand_suf (char * croot, ichar_t * rootword,
1856 + MASKTYPE mask[], int crossonly, int option, char * extra);
1857 +Global int findfiletype (char * name, int searchnames,
1858 + int * deformatter);
1859 +Global void flagpr (ichar_t * word, int preflag, int prestrip,
1860 + int preadd, int sufflag, int sufadd);
1861 +Global void givehelp (int interactive);
1862 +Global int good (ichar_t * word, int ignoreflagbits, int allhits,
1863 + int pfxopts, int sfxopts);
1864 +Global int hash (ichar_t * word, int hashtablesize);
1865 +#ifndef ICHAR_IS_CHAR
1866 +Global int icharcmp (ichar_t * s1, ichar_t * s2);
1867 +Global ichar_t * icharcpy (ichar_t * out, ichar_t * in);
1868 +Global int icharlen (ichar_t * str);
1869 +Global int icharncmp (ichar_t * s1, ichar_t * s2, int n);
1870 +#endif /* ICHAR_IS_CHAR */
1871 +Global int ichartostr (char * out, ichar_t * in, int outlen,
1873 +Global char * ichartosstr (ichar_t * in, int canonical);
1874 +Global void inverse (void);
1875 +Global struct dent * lookup (ichar_t * word, int dotree);
1876 +Global void lowcase (ichar_t * string);
1877 +Global int makedent (char * lbuf, int lbuflen, struct dent * d);
1878 +Global void makepossibilities (ichar_t * word);
1879 +Global void move (int row, int col);
1880 +Global void normal (void);
1881 +Global char * printichar (int in);
1883 +Global int shellescape (char * buf);
1884 +Global void shescape (char * buf);
1886 +#ifndef REGEX_LOOKUP
1887 +Global int shellescape (char * buf);
1888 +#endif /* REGEX_LOOKUP */
1890 +Global char * skipoverword (char * bufp);
1891 +Global void stop (void);
1892 +Global int stringcharlen (char * bufp, int canonical);
1893 +Global int strtoichar (ichar_t * out, char * in, int outlen,
1895 +Global ichar_t * strtosichar (char * in, int canonical);
1896 +Global void terminit (void);
1897 +Global void toutent (FILE * outfile, struct dent * hent, int onlykeep);
1898 +Global void treeinit (char * persdict, char * LibDict);
1899 +Global void treeinsert (char * word, int wordlen, int keep);
1900 +Global struct dent * treelookup (ichar_t * word);
1901 +Global void treeoutput (void);
1902 +Global void upcase (ichar_t * string);
1903 +#ifndef NO_CAPITALIZATION_SUPPORT
1904 +Global long whatcap (ichar_t * word);
1906 +Global char * xgets (char * string, int size, FILE * stream);
1907 +Global void yyinit (void);
1908 +Global Logical yyopen (char * file);
1909 +Global int yyparse (void);
1911 +#include <string.h>
1913 +#ifdef REGEX_LOOKUP
1915 +Global char * regcmp (const char * expr, const char * terminator, ...);
1916 +Global char * regex (const char * pat, const char * subject, ...);
1918 +Global char * re_comp (const char * expr);
1919 +Global int * re_exec (const char * pat);
1923 +Global int tgetent (char * buf, const char * termname);
1924 +Global int tgetnum (const char * id);
1925 +Global char * tgetstr (const char * id, char ** area);
1926 +Global char * tgoto (const char * cm, int col, int row);
1927 +Global char * tputs (const char * str, int pad, int (*func) (int ch);
1930 +Global char * mypath_rindex(char const *str, char c);
1931 +Global void save_root_cap (ichar_t * word, ichar_t * pattern,
1932 + int prestrip, int preadd, int sufstrip, int sufadd,
1933 + struct dent * firstdent, struct flagent * pfxent,
1934 + struct flagent * sufent,
1935 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
1937 +Global int casecmp (char * a, char * b, int canonical);
1938 +Global int ins_root_cap (ichar_t * word, ichar_t * pattern,
1939 + int prestrip, int preadd, int sufstrip, int sufadd,
1940 + struct dent * firstdent, struct flagent * pfxent,
1941 + struct flagent * sufent);
1942 +Global int insert(register ichar_t * word);
1943 +Global char * linit (char *);
1944 +Global char * last_slash (char *file);
1945 diff -Nur vim60am.old/src/spell/ispell.h vim60am/src/spell/ispell.h
1946 --- vim60am.old/src/spell/ispell.h Thu Jan 1 01:00:00 1970
1947 +++ vim60am/src/spell/ispell.h Wed Jun 27 19:16:51 2001
1954 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1955 + * All rights reserved.
1957 + * Redistribution and use in source and binary forms, with or without
1958 + * modification, are permitted provided that the following conditions
1961 + * 1. Redistributions of source code must retain the above copyright
1962 + * notice, this list of conditions and the following disclaimer.
1963 + * 2. Redistributions in binary form must reproduce the above copyright
1964 + * notice, this list of conditions and the following disclaimer in the
1965 + * documentation and/or other materials provided with the distribution.
1966 + * 3. All modifications to the source code must be clearly marked as
1967 + * such. Binary redistributions based on modified source code
1968 + * must be clearly marked as modified versions in the documentation
1969 + * and/or other materials provided with the distribution.
1970 + * 4. All advertising materials mentioning features or use of this software
1971 + * must display the following acknowledgment:
1972 + * This product includes software developed by Geoff Kuenning and
1973 + * other unpaid contributors.
1974 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1975 + * products derived from this software without specific prior
1976 + * written permission.
1978 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1979 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1980 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1981 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1982 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1983 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1984 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1985 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1986 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1987 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1993 + * Revision 1.68 1995/03/06 02:42:41 geoff
1994 + * Be vastly more paranoid about parenthesizing macro arguments. This
1995 + * fixes a bug in defmt.c where a complex argument was passed to
1998 + * Revision 1.67 1995/01/03 19:24:12 geoff
1999 + * Get rid of a non-global declaration.
2001 + * Revision 1.66 1994/12/27 23:08:49 geoff
2002 + * Fix a lot of subtly bad assumptions about the widths of ints and longs
2003 + * which only show up on 64-bit machines like the Cray and the DEC Alpha.
2005 + * Revision 1.65 1994/11/02 06:56:10 geoff
2006 + * Remove the anyword feature, which I've decided is a bad idea.
2008 + * Revision 1.64 1994/10/25 05:46:18 geoff
2009 + * Add the FF_ANYWORD flag for defining an affix that will apply to any
2010 + * word, even if not explicitly specified. (Good for French.)
2012 + * Revision 1.63 1994/09/16 04:48:28 geoff
2013 + * Make stringdups and laststringch unsigned ints, and dupnos a plain
2014 + * int, so that we can handle more than 128 stringchars and stringchar
2017 + * Revision 1.62 1994/09/01 06:06:39 geoff
2018 + * Change erasechar/killchar to uerasechar/ukillchar to avoid
2019 + * shared-library problems on HP systems.
2021 + * Revision 1.61 1994/08/31 05:58:35 geoff
2022 + * Add contextoffset, used in -a mode to handle extremely long lines.
2024 + * Revision 1.60 1994/05/17 06:44:15 geoff
2025 + * Add support for controlled compound formation and the COMPOUNDONLY
2026 + * option to affix flags.
2028 + * Revision 1.59 1994/03/15 06:25:16 geoff
2029 + * Change deftflag's initialization so we can tell if -t/-n appeared.
2031 + * Revision 1.58 1994/02/07 05:53:28 geoff
2032 + * Add typecasts to the the 7-bit versions of ichar* routines
2034 + * Revision 1.57 1994/01/25 07:11:48 geoff
2035 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
2040 +#include "config.h"
2043 +#define SET_SIZE 128
2045 +#define SET_SIZE 256
2048 +#define MASKSIZE (MASKBITS / MASKTYPE_WIDTH)
2050 +/* The following is really testing for MASKSIZE <= 1, but cpp can't do that */
2051 +#if MASKBITS <= MASKTYPE_WIDTH
2052 +#define SETMASKBIT(mask, bit) ((mask)[0] |= (MASKTYPE) 1 << (bit))
2053 +#define CLRMASKBIT(mask, bit) ((mask)[0] &= (MASKTYPE) ~(1 << (bit)))
2054 +#define TSTMASKBIT(mask, bit) ((mask)[0] & ((MASKTYPE) 1 << (bit)))
2056 +#define SETMASKBIT(mask, bit) \
2057 + ((mask)[(bit) / MASKTYPE_WIDTH] |= \
2058 + (MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1)))
2059 +#define CLRMASKBIT(mask, bit) \
2060 + ((mask)[(bit) / MASKTYPE_WIDTH] &= \
2061 + ~((MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1))))
2062 +#define TSTMASKBIT(mask, bit) \
2063 + ((mask)[(bit) / MASKTYPE_WIDTH] & \
2064 + ((MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1))))
2068 +#define FULLMASKSET
2073 +#define BITTOCHAR(bit) ((bit) + 'A')
2074 +#define CHARTOBIT(ch) ((ch) - 'A')
2076 +#define LARGESTFLAG 26 /* 5 are needed for flagfield below */
2077 +#define FLAGBASE ((MASKTYPE_WIDTH) - 6)
2079 +# if MASKBITS <= 64
2081 +#define BITTOCHAR(bit) ((bit) + 'A')
2082 +#define CHARTOBIT(ch) ((ch) - 'A')
2084 +#define LARGESTFLAG (64 - 6) /* 5 are needed for flagfield below */
2085 +#define FLAGBASE ((MASKTYPE_WIDTH) - 6)
2088 +#define BITTOCHAR(bit) (bit)
2089 +#define CHARTOBIT(ch) (ch)
2091 +#define LARGESTFLAG MASKBITS /* flagfield is a separate field */
2097 +** Data type for internal word storage. If necessary, we use shorts rather
2098 +** than chars so that string characters can be encoded as a single unit.
2100 +#if (SET_SIZE + MAXSTRINGCHARS) <= 256
2102 +#define ICHAR_IS_CHAR
2106 +#ifdef ICHAR_IS_CHAR
2107 +typedef unsigned char ichar_t; /* Internal character */
2108 +#define icharlen(s) strlen ((char *) (s))
2109 +#define icharcpy(a, b) strcpy ((char *) (a), (char *) (b))
2110 +#define icharcmp(a, b) strcmp ((char *) (a), (char *) (b))
2111 +#define icharncmp(a, b, n) strncmp ((char *) (a), (char *) (b), (n))
2112 +#define chartoichar(x) ((ichar_t) (x))
2114 +typedef unsigned short ichar_t; /* Internal character */
2115 +#define chartoichar(x) ((ichar_t) (unsigned char) (x))
2120 + struct dent * next;
2122 + MASKTYPE mask[MASKSIZE];
2129 +** Flags in the directory entry. If FULLMASKSET is undefined, these are
2130 +** stored in the highest bits of the last longword of the mask field. If
2131 +** FULLMASKSET is defined, they are stored in the extra "flags" field.
2132 +#ifndef NO_CAPITALIZATION_SUPPORT
2134 +** If a word has only one capitalization form, and that form is not
2135 +** FOLLOWCASE, it will have exactly one entry in the dictionary. The
2136 +** legal capitalizations will be indicated by the 2-bit capitalization
2137 +** field, as follows:
2139 +** ALLCAPS The word must appear in all capitals.
2140 +** CAPITALIZED The word must be capitalized (e.g., London).
2141 +** It will also be accepted in all capitals.
2142 +** ANYCASE The word may appear in lowercase, capitalized,
2143 +** or all-capitals.
2145 +** Regardless of the capitalization flags, the "word" field of the entry
2146 +** will point to an all-uppercase copy of the word. This is to simplify
2147 +** the large portion of the code that doesn't care about capitalization.
2148 +** Ispell will generate the correct version when needed.
2150 +** If a word has more than one capitalization, there will be multiple
2151 +** entries for it, linked together by the "next" field. The initial
2152 +** entry for such words will be a dummy entry, primarily for use by code
2153 +** that ignores capitalization. The "word" field of this entry will
2154 +** again point to an all-uppercase copy of the word. The "mask" field
2155 +** will contain the logical OR of the mask fields of all variants.
2156 +** A header entry is indicated by a capitalization type of ALLCAPS,
2157 +** with the MOREVARIANTS bit set.
2159 +** The following entries will define the individual variants. Each
2160 +** entry except the last has the MOREVARIANTS flag set, and each
2161 +** contains one of the following capitalization options:
2163 +** ALLCAPS The word must appear in all capitals.
2164 +** CAPITALIZED The word must be capitalized (e.g., London).
2165 +** It will also be accepted in all capitals.
2166 +** FOLLOWCASE The word must be capitalized exactly like the
2167 +** sample in the entry. Prefix (suffix) characters
2168 +** must be rendered in the case of the first (last)
2169 +** "alphabetic" character. It will also be accepted
2170 +** in all capitals. ("Alphabetic" means "mentioned
2171 +** in a 'casechars' statement".)
2172 +** ANYCASE The word may appear in lowercase, capitalized,
2173 +** or all-capitals.
2175 +** The "mask" field for the entry contains only the affix flag bits that
2176 +** are legal for that capitalization. The "word" field will be null
2177 +** except for FOLLOWCASE entries, where it will point to the
2178 +** correctly-capitalized spelling of the root word.
2180 +** It is worth discussing why the ALLCAPS option is used in
2181 +** the header entry. The header entry accepts an all-capitals
2182 +** version of the root plus every affix (this is always legal, since
2183 +** words get capitalized in headers and so forth). Further, all of
2184 +** the following variant entries will reject any all-capitals form
2185 +** that is illegal due to an affix.
2187 +** Finally, note that variations in the KEEP flag can cause a multiple-variant
2188 +** entry as well. For example, if the personal dictionary contains "ALPHA",
2189 +** (KEEP flag set) and the user adds "alpha" with the KEEP flag clear, a
2190 +** multiple-variant entry will be created so that "alpha" will be accepted
2191 +** but only "ALPHA" will actually be kept.
2195 +#define flagfield flags
2197 +#define flagfield mask[MASKSIZE - 1]
2199 +#define USED ((MASKTYPE) 1 << (FLAGBASE + 0))
2200 +#define KEEP ((MASKTYPE) 1 << (FLAGBASE + 1))
2201 +#ifdef NO_CAPITALIZATION_SUPPORT
2202 +#define ALLFLAGS (USED | KEEP)
2203 +#else /* NO_CAPITALIZATION_SUPPORT */
2204 +#define ANYCASE ((MASKTYPE) 0 << (FLAGBASE + 2))
2205 +#define ALLCAPS ((MASKTYPE) 1 << (FLAGBASE + 2))
2206 +#define CAPITALIZED ((MASKTYPE) 2 << (FLAGBASE + 2))
2207 +#define FOLLOWCASE ((MASKTYPE) 3 << (FLAGBASE + 2))
2208 +#define CAPTYPEMASK ((MASKTYPE) 3 << (FLAGBASE + 2))
2209 +#define MOREVARIANTS ((MASKTYPE) 1 << (FLAGBASE + 4))
2210 +#define ALLFLAGS (USED | KEEP | CAPTYPEMASK | MOREVARIANTS)
2211 +#define captype(x) ((x) & CAPTYPEMASK)
2212 +#endif /* NO_CAPITALIZATION_SUPPORT */
2215 + * Language tables used to encode prefix and suffix information.
2219 + ichar_t * strip; /* String to strip off */
2220 + ichar_t * affix; /* Affix to append */
2221 + short flagbit; /* Flag bit this ent matches */
2222 + short stripl; /* Length of strip */
2223 + short affl; /* Length of affix */
2224 + short numconds; /* Number of char conditions */
2225 + short flagflags; /* Modifiers on this flag */
2226 + char conds[SET_SIZE + MAXSTRINGCHARS]; /* Adj. char conds */
2230 + * Bits in flagflags
2232 +#define FF_CROSSPRODUCT (1 << 0) /* Affix does cross-products */
2233 +#define FF_COMPOUNDONLY (1 << 1) /* Afx works in compounds */
2235 +union ptr_union /* Aid for building flg ptrs */
2237 + struct flagptr * fp; /* Pointer to more indexing */
2238 + struct flagent * ent; /* First of a list of ents */
2243 + union ptr_union pu; /* Ent list or more indexes */
2244 + int numents; /* If zero, pu.fp is valid */
2248 + * Description of a single string character type.
2252 + char * name; /* Name of the type */
2253 + char * deformatter; /* Deformatter to use */
2254 + char * suffixes; /* File suffixes, null seps */
2258 + * Header placed at the beginning of the hash file.
2262 + unsigned short magic; /* Magic number for ID */
2263 + unsigned short compileoptions; /* How we were compiled */
2264 + short maxstringchars; /* Max # strchrs we support */
2265 + short maxstringcharlen; /* Max strchr len supported */
2266 + short compoundmin; /* Min lth of compound parts */
2267 + short compoundbit; /* Flag 4 compounding roots */
2268 + unsigned int stringsize; /* Size of string table */
2269 + int lstringsize; /* Size of lang. str tbl */
2270 + unsigned int tblsize; /* No. entries in hash tbl */
2271 + int stblsize; /* No. entries in sfx tbl */
2272 + int ptblsize; /* No. entries in pfx tbl */
2273 + int sortval; /* Largest sort ID assigned */
2274 + int nstrchars; /* No. strchars defined */
2275 + int nstrchartype; /* No. strchar types */
2276 + int strtypestart; /* Start of strtype table */
2277 + char nrchars[5]; /* Nroff special characters */
2278 + char texchars[13]; /* TeX special characters */
2279 +#define TeXleftparen texchars[0]
2280 +#define TeXrightparen texchars[1]
2281 +#define TeXleftsquare texchars[2]
2282 +#define TeXrightsquare texchars[3]
2283 +#define TeXleftcurly texchars[4]
2284 +#define TeXrightcurly texchars[5]
2285 +#define TeXlefttangle texchars[6]
2286 +#define TeXrighttangle texchars[7]
2287 +#define TeXbackslash texchars[8]
2288 +#define TeXdollar texchars[9]
2289 +#define TeXstar texchars[10]
2290 +#define TeXdot texchars[11]
2291 +#define TeXpercent texchars[12]
2292 + char compoundflag; /* Compund-word handling */
2293 + char defhardflag; /* Default tryveryhard flag */
2294 + char flagmarker; /* "Start-of-flags" char */
2295 + unsigned short sortorder[SET_SIZE + MAXSTRINGCHARS]; /* Sort ordering */
2296 + ichar_t lowerconv[SET_SIZE + MAXSTRINGCHARS]; /* Lower-conversion table */
2297 + ichar_t upperconv[SET_SIZE + MAXSTRINGCHARS]; /* Upper-conversion table */
2298 + char wordchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for chars found in wrds */
2299 + char upperchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for uppercase chars */
2300 + char lowerchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for lowercase chars */
2301 + char boundarychars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for boundary chars */
2302 + char stringstarts[SET_SIZE]; /* NZ if char can start str */
2303 + char stringchars[MAXSTRINGCHARS][MAXSTRINGCHARLEN + 1]; /* String chars */
2304 + unsigned int stringdups[MAXSTRINGCHARS]; /* No. of "base" char */
2305 + int dupnos[MAXSTRINGCHARS]; /* Dup char ID # */
2306 + unsigned short magic2; /* Second magic for dbl chk */
2309 +/* hash table magic number */
2310 +#define SPELL_MAGIC 0x9602
2312 +/* compile options, put in the hash header for consistency checking */
2314 +# define MAGIC8BIT 0x01
2316 +# define MAGIC8BIT 0x00
2318 +#ifdef NO_CAPITALIZATION_SUPPORT
2319 +# define MAGICCAPITALIZATION 0x00
2321 +# define MAGICCAPITALIZATION 0x02
2324 +# define MAGICMASKSET 0x00
2326 +# if MASKBITS <= 64
2327 +# define MAGICMASKSET 0x04
2329 +# if MASKBITS <= 128
2330 +# define MAGICMASKSET 0x08
2332 +# define MAGICMASKSET 0x0C
2337 +#define COMPILEOPTIONS (MAGIC8BIT | MAGICCAPITALIZATION | MAGICMASKSET)
2340 + * Structure used to record data about successful lookups; these values
2341 + * are used in the ins_root_cap routine to produce correct capitalizations.
2345 + struct dent * dictent; /* Header of dict entry chain for wd */
2346 + struct flagent * prefix; /* Prefix flag used, or NULL */
2347 + struct flagent * suffix; /* Suffix flag used, or NULL */
2351 +** Offsets into the nroff special-character array
2353 +#define NRLEFTPAREN hashheader.nrchars[0]
2354 +#define NRRIGHTPAREN hashheader.nrchars[1]
2355 +#define NRDOT hashheader.nrchars[2]
2356 +#define NRBACKSLASH hashheader.nrchars[3]
2357 +#define NRSTAR hashheader.nrchars[4]
2360 +** Values for compoundflag
2362 +#define COMPOUND_NEVER 0 /* Compound words are never good */
2363 +#define COMPOUND_ANYTIME 1 /* Accept run-together words */
2364 +#define COMPOUND_CONTROLLED 2 /* Compounds controlled by afx flags */
2367 +** The isXXXX macros normally only check ASCII range, and don't support
2368 +** the character sets of other languages. These private versions handle
2369 +** whatever character sets have been defined in the affix files.
2371 +#define myupper(X) (hashheader.upperchars[(X)])
2372 +#define mylower(X) (hashheader.lowerchars[(X)])
2373 +#define myspace(X) (((X) > 0) && ((X) < 0x80) \
2374 + && isspace((unsigned char) (X)))
2375 +#define iswordch(X) (hashheader.wordchars[(X)])
2376 +#define isboundarych(X) (hashheader.boundarychars[(X)])
2377 +#define isstringstart(X) (hashheader.stringstarts[(unsigned char) (X)])
2378 +#define mytolower(X) (hashheader.lowerconv[(X)])
2379 +#define mytoupper(X) (hashheader.upperconv[(X)])
2382 +** These macros are similar to the ones above, but they take into account
2383 +** the possibility of string characters. Note well that they take a POINTER,
2384 +** not a character.
2386 +** The "l_" versions set "len" to the length of the string character as a
2387 +** handy side effect. (Note that the global "laststringch" is also set,
2388 +** and sometimes used, by these macros.)
2390 +** The "l1_" versions go one step further and guarantee that the "len"
2391 +** field is valid for *all* characters, being set to 1 even if the macro
2392 +** returns false. This macro is a great example of how NOT to write
2395 +#define isstringch(ptr, canon) (isstringstart (*(ptr)) \
2396 + && stringcharlen ((ptr), (canon)) > 0)
2397 +#define l_isstringch(ptr, len, canon) \
2398 + (isstringstart (*(ptr)) \
2399 + && (len = stringcharlen ((ptr), (canon))) \
2401 +#define l1_isstringch(ptr, len, canon) \
2403 + isstringstart (*(ptr)) \
2405 + stringcharlen ((ptr), (canon))) \
2407 + ? 1 : (len = 1, 0)))
2410 + * Sizes of buffers returned by ichartosstr/strtosichar.
2412 +#define ICHARTOSSTR_SIZE (INPUTWORDLEN + 4 * MAXAFFIXLEN + 4)
2413 +#define STRTOSICHAR_SIZE ((INPUTWORDLEN + 4 * MAXAFFIXLEN + 4) \
2414 + * sizeof (ichar_t))
2417 + * termcap variables
2420 +# define S_EXTERN /* nothing */
2423 +#define Global extern
2424 +# define S_EXTERN extern
2430 +S_EXTERN char * BC; /* backspace if not ^H */
2431 +S_EXTERN char * cd; /* clear to end of display */
2432 +S_EXTERN char * cl; /* clear display */
2433 +S_EXTERN char * cm; /* cursor movement */
2434 +S_EXTERN char * ho; /* home */
2435 +S_EXTERN char * nd; /* non-destructive space */
2436 +S_EXTERN char * so; /* standout */
2437 +S_EXTERN char * se; /* standout end */
2438 +S_EXTERN int sg; /* space taken by so/se */
2439 +S_EXTERN char * ti; /* terminal initialization sequence */
2440 +S_EXTERN char * te; /* terminal termination sequence */
2441 +S_EXTERN int li; /* lines */
2442 +S_EXTERN int co; /* columns */
2444 +S_EXTERN int contextsize; /* number of lines of context to show */
2445 +S_EXTERN char contextbufs[MAXCONTEXT][BUFSIZ]; /* Context of current line */
2446 +S_EXTERN int contextoffset; /* Offset of line start in contextbufs[0] */
2447 +S_EXTERN char * currentchar; /* Location in contextbufs */
2448 +S_EXTERN char ctoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Current token as char */
2449 +S_EXTERN ichar_t itoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Ctoken as ichar_t str */
2451 +S_EXTERN char termcap[2048]; /* termcap entry */
2452 +S_EXTERN char termstr[2048]; /* for string values */
2453 +S_EXTERN char * termptr; /* pointer into termcap, used by tgetstr */
2455 +S_EXTERN int numhits; /* number of hits in dictionary lookups */
2456 +S_EXTERN struct success
2457 + hits[MAX_HITS]; /* table of hits gotten in lookup */
2459 +S_EXTERN char * hashstrings; /* Strings in hash table */
2460 +S_EXTERN struct hashheader
2461 + hashheader; /* Header of hash table */
2462 +S_EXTERN struct dent *
2463 + hashtbl; /* Main hash table, for dictionary */
2464 +S_EXTERN int hashsize; /* Size of main hash table */
2467 +S_EXTERN int aflag; /* NZ if -a or -A option specified */
2468 +S_EXTERN int cflag; /* NZ if -c (crunch) option */
2469 +S_EXTERN int lflag; /* NZ if -l (list) option */
2470 +S_EXTERN int incfileflag; /* whether xgets() acts exactly like gets() */
2471 +Global Logical nodictflag; /* NZ if dictionary not needed */
2473 +S_EXTERN int uerasechar; /* User's erase character, from stty */
2474 +S_EXTERN int ukillchar; /* User's kill character */
2476 +S_EXTERN unsigned int laststringch; /* Number of last string character */
2477 +S_EXTERN int defdupchar; /* Default duplicate string type */
2479 +S_EXTERN unsigned int numpflags; /* Number of prefix flags in table */
2480 +S_EXTERN unsigned int numsflags; /* Number of suffix flags in table */
2481 +S_EXTERN struct flagptr *pflagindex;
2482 + /* Fast index to pflaglist */
2483 +S_EXTERN struct flagent *pflaglist; /* Prefix flag control list */
2484 +S_EXTERN struct flagptr *sflagindex;
2485 + /* Fast index to sflaglist */
2486 +S_EXTERN struct flagent *sflaglist; /* Suffix flag control list */
2488 +S_EXTERN struct strchartype * /* String character type collection */
2491 +S_EXTERN FILE * infile; /* File being corrected */
2492 +S_EXTERN FILE * outfile; /* Corrected copy of infile */
2494 +S_EXTERN char * askfilename; /* File specified in -f option */
2496 +S_EXTERN int changes; /* NZ if changes made to cur. file */
2497 +S_EXTERN int readonly; /* NZ if current file is readonly */
2498 +S_EXTERN int quit; /* NZ if we're done with this file */
2500 +#define MAXPOSSIBLE 100 /* Max no. of possibilities to generate */
2502 +S_EXTERN char possibilities[MAXPOSSIBLE][INPUTWORDLEN + MAXAFFIXLEN];
2503 + /* Table of possible corrections */
2504 +S_EXTERN int pcount; /* Count of possibilities generated */
2505 +S_EXTERN int maxposslen; /* Length of longest possibility */
2506 +S_EXTERN int easypossibilities; /* Number of "easy" corrections found */
2507 + /* ..(defined as those using legal affixes) */
2509 +Global Logical inited;
2511 + * The following array contains a list of characters that should be tried
2512 + * in "missingletter." Note that lowercase characters are omitted.
2514 +S_EXTERN int Trynum; /* Size of "Try" array */
2515 +S_EXTERN ichar_t Try[SET_SIZE + MAXSTRINGCHARS];
2518 + * Initialized variables. These are generated using macros so that they
2519 + * may be consistently declared in all programs. Numerous examples of
2520 + * usage are given below.
2523 +#define S_INIT(decl, init) decl = init
2525 +#define S_INIT(decl, init) extern decl
2529 +S_INIT (int minimenusize, 2); /* MUST be either 2 or zero */
2530 +#else /* MINIMENU */
2531 +S_INIT (int minimenusize, 0); /* MUST be either 2 or zero */
2532 +#endif /* MINIMENU */
2534 +S_INIT (int eflag, 0); /* NZ for expand mode */
2535 +S_INIT (int dumpflag, 0); /* NZ to do dump mode */
2536 +S_INIT (int fflag, 0); /* NZ if -f specified */
2538 +S_INIT (int sflag, 0); /* NZ to stop self after EOF */
2540 +S_INIT (int vflag, 0); /* NZ to display characters as M-xxx */
2541 +S_INIT (int xflag, DEFNOBACKUPFLAG); /* NZ to suppress backups */
2542 +S_INIT (int deftflag, -1); /* NZ for TeX mode by default */
2543 +S_INIT (int tflag, DEFTEXFLAG); /* NZ for TeX mode in current file */
2544 +S_INIT (int prefstringchar, -1); /* Preferred string character type */
2546 +S_INIT (int terse, 0); /* NZ for "terse" mode */
2548 +S_INIT (char tempfile[MAXPATHLEN], ""); /* Name of file we're spelling into */
2550 +S_INIT (int minword, MINWORD); /* Longest always-legal word */
2551 +S_INIT (int sortit, 1); /* Sort suggestions alphabetically */
2552 +S_INIT (int compoundflag, -1); /* How to treat compounds: see above */
2553 +S_INIT (int tryhardflag, -1); /* Always call tryveryhard */
2555 +S_INIT (char * currentfile, NULL); /* Name of current input file */
2557 +/* Odd numbers for math mode in LaTeX; even for LR or paragraph mode */
2558 +S_INIT (int math_mode, 0);
2559 +/* P -- paragraph or LR mode
2560 + * b -- parsing a \begin statement
2561 + * e -- parsing an \end statement
2562 + * r -- parsing a \ref type of argument.
2563 + * m -- looking for a \begin{minipage} argument.
2565 +S_INIT (char LaTeX_Mode, 'P');
2567 +#include "i_proto.h"
2568 diff -Nur vim60am.old/src/spell/local.h vim60am/src/spell/local.h
2569 --- vim60am.old/src/spell/local.h Thu Jan 1 01:00:00 1970
2570 +++ vim60am/src/spell/local.h Wed Jun 27 19:16:51 2001
2573 + * Written by Eli Zaretskii <eliz@is.elta.co.il>
2575 + * This is local.h file suitable for compiling Ispell on MS-DOS systems
2576 + * with version 2.x of DJGPP port of GNU C/C++ compiler.
2584 + * WARNING WARNING WARNING
2586 + * This file is *NOT* a normal C header file! Although it uses C
2587 + * syntax and is included in C programs, it is also processed by shell
2588 + * scripts that are very stupid about format.
2590 + * Do not try to use #if constructs to configure this file for more
2591 + * than one configuration. Do not place whitespace after the "#" in
2592 + * "#define". Do not attempt to disable lines by commenting them out.
2593 + * Do not use backslashes to reduce the length of long lines.
2594 + * None of these things will work the way you expect them to.
2596 + * WARNING WARNING WARNING
2600 +** Things that normally go in a Makefile. Define these just like you
2601 +** might in the Makefile, except you should use #define instead of
2602 +** make's assignment syntax. Everything must be double-quoted, and
2603 +** (unlike make) you can't use any sort of $-syntax to pick up the
2604 +** values of other definitions.
2608 +#define CFLAGS "-O2 -g"
2609 +#define YACC "bison -y"
2612 +** TERMLIB - DJGPP doesn't have one, it uses direct screen writes.
2617 +** Where to install various components of ispell. BINDIR contains
2618 +** binaries. LIBDIR contains hash tables and affix files. ELISPDIR
2619 +** contains emacs lisp files (if any) and TEXINFODIR contains emacs
2620 +** TeXinfo files. MAN1DIR and MAN1EXT will hold the chapter-1 and
2621 +** chapter-4 manual pages, respectively.
2623 +** If you intend to use multiple dictionary files, I would suggest
2624 +** LIBDIR be a directory which will contain nothing else, so sensible
2625 +** names can be constructed for the -d option without conflict.
2627 +#define BINDIR "/usr/bin"
2628 +#define LIBDIR "/usr/lib/ispell"
2629 +#define ELISPDIR "/usr/lib/emacs/site-lisp"
2630 +#define TEXINFODIR "/usr/share/info"
2631 +#define MAN1DIR "/usr/share/man/man1"
2632 +#define MAN4DIR "/usr/share/man/man4"
2635 +** List of all hash files (languages) which will be supported by ispell.
2637 +** This variable has a complex format so that many options can be
2638 +** specified. The format is as follows:
2640 +** <language>[,<make-options>...] [<language> [,<make-options> ...] ...]
2644 +** language is the name of a subdirectory of the
2645 +** "languages" directory
2646 +** make-options are options that are to be passed to "make" in
2647 +** the specified directory. The make-options
2648 +** should not, in general, specify a target, as
2649 +** this will be provided by the make process.
2651 +** For example, if LANGUAGES is:
2653 +** "{american,EXTRADICT=/usr/dict/words /usr/dict/web2} {deutsch}",
2655 +** then the American-English and Deutsch (German) languages will be supported,
2656 +** and when the English dictionary is built, the variable
2657 +** 'EXTRADICT=/usr/dict/words /usr/dict/web2' will be passed to the makefile.
2659 +** Notes on the syntax: The makefile is not very robust. If you have
2660 +** make problems, or if make seems to in the language-subdirs
2661 +** dependency, check your syntax. The makefile adds single quotes to
2662 +** the individual variables in the LANGUAGES specification, so don't
2663 +** use quotes of any kind.
2665 +** In the future, the first language listed in this variable will
2666 +** become the default, and the DEFHASH, DEFLANG, and DEFPAFF,
2667 +** variables will all become obsolete. So be sure to put your default
2668 +** language first, to make later conversion easier!
2670 +** Notes on options for the various languages will be found in the
2671 +** Makefiles for those languages. Some of those languages may require
2672 +** you to also change various limits limits like MASKBITS or the
2673 +** length parameters.
2675 +** A special note on the English language: because the British and
2676 +** American dialects use different spelling, you should usually select
2677 +** one or the other of these. If you select both, the setting of
2678 +** MASTERHASH will determine which becomes the language linked to
2679 +** DEFHASH (which will usually be named english.hash).
2681 +** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2682 +** !!! Note the pathname for the `words' file: it might be different !!!
2683 +** !!! If you don't have this file, make EXTRADICT empty !!!
2684 +** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2686 +#define LANGUAGES "{american,MASTERDICTS=americax.med,HASHFILES=amermedx.hash,EXTRADICT=/usr/lib/ispell/words}"
2689 +** Master hash file for DEFHASH. This is the name of a hash file
2690 +** built by a language Makefile. It should be the most-popular hash
2691 +** file on your system, because it is the one that will be used by
2692 +** default. It must be listed in LANGUAGES, above.
2694 +#define MASTERHASH "polish.hash"
2697 +** Default native-language hash file. This is the name given to the
2698 +** hash table that will be used if no language is specified to
2699 +** ispell. It is a link to MASTERHASH, above.
2701 +#define DEFHASH "polish.hash"
2704 +** If your sort command accepts the -T switch to set temp file
2705 +** locations (try it out; on some systems it exists but is
2706 +** undocumented), make the following variable the null string.
2707 +** Otherwise leave it as the sed script.
2709 +** With DJGPP, you will probably use GNU Sort which accepts -T, so:
2714 +** If your system has the rename(2) system call, define HAS_RENAME and
2715 +** ispell will use that call to rename backup files. Otherwise, it
2716 +** will use link/unlink. There is no harm in this except on MS-DOS,
2717 +** which might not support link/unlink (DJGPP does, but also has rename).
2719 +#define HAS_RENAME 1
2721 +/* environment variable for user's word list */
2723 +#define PDICTVAR "WORDLIST"
2727 +** Prefix part of default private dictionary. Under MS-DOS 8.3
2728 +** filename limitation, we are in trouble...
2730 +#define DEFPDICT ".isp."
2732 +/* old place to look for default word list */
2733 +#define OLDPDICT ".isp."
2736 +** mktemp template for temporary file - MUST contain 6 consecutive X's.
2737 +** On MSDOS the directory part of TEMPNAME is only used if neither $TMP
2738 +** nor $TEMP nor $TMPDIR (in that order) are defined. If any of these
2739 +** variables is defined, the filename part of TEMPNAME is appended to
2742 +#define TEMPNAME "/tmp/isXXXXXX"
2745 +** If REGEX_LOOKUP is NOT defined, the lookup command (L) will use the look(1)
2746 +** command (if available) or the egrep command. If REGEX_LOOKUP is defined,
2747 +** the lookup command will use the internal dictionary and the
2748 +** regular-expression library (which you must supply separately.
2749 +** DJGPP v2 has POSIX regexp functions.
2751 +#ifndef FEAT_SPELL_HL
2752 +#define REGEX_LOOKUP 1
2756 +** Choose the proper type of regular-expression routines here. BSD
2757 +** and public-domain systems have routines called re_comp and re_exec;
2758 +** System V uses regcmp and regex.
2760 +#include <sys/types.h>
2762 +#define REGCTYPE regex_t *
2763 +#define REGCMP(re,str) (regcomp (re, str, 0), re)
2764 +#define REGEX(re, str, dummy) \
2765 + (re != 0 && regexec (re, str, 0, 0, 0) == 0 ? (char *)1 : NULL)
2766 +#define REGFREE(re) \
2769 + re = (regex_t *)calloc (1, sizeof (regex_t)); \
2776 +** The 2 following definitions are only meaningfull if you don't use
2777 +** any regex library.
2779 +/* path to egrep (use speeded up version if available);
2780 + defined without explicit path, since there are no
2781 + standard places for programs on MS-DOS. */
2782 +#define EGREPCMD "egrep -i"
2784 +/* path to wordlist for Lookup command (typically /usr/dict/{words|web2}) */
2785 +/* note that /usr/dict/web2 is usually a bad idea due to obscure words */
2789 +** FIXME: The filename truncation below is not flexible enough for DJGPP
2790 +** which can support long filenames on some platforms, since we
2791 +** will only know if the support is available at runtime.
2794 +/* max file name length (will truncate to fit BAKEXT) if not in sys/param.h */
2796 +#define MAXNAMLEN NAME_MAX
2798 +#define MAXNAMLEN 12
2801 +#define MAXEXTLEN 4 /* max. extension length including '.' */
2802 +#define MAXBASENAMELEN 8 /* max. base filename length without ext */
2804 +/* define if you want .bak file names truncated to MAXNAMLEN characters */
2805 +/* On MS-DOS, we really have no choice... */
2806 +#define TRUNCATEBAK 1
2809 +** This is the extension that will be added to backup files.
2810 +** On MS-DOS, it makes sense to use the shortest possible extension.
2815 +** Define the following to suppress the 8-bit character feature.
2816 +** FIXME: does this defeat support of foreign languages?
2818 +/*#define NO8BIT 1 */
2824 +** Define this if you want to use the shell for interpretation of commands
2825 +** issued via the "L" command, "^Z" under System V, and "!". If this is
2826 +** not defined then a direct spawnvp() will be used in place of the
2827 +** normal system(). This may speed up these operations if the SHELL
2828 +** environment variable points to a Unix-like shell (such as `sh' or `bash').
2830 +** However, if you undefine USESH, commands which use pipes, redirection
2831 +** and shell wildcards won't work, and you will need support for the SIGTSTP
2832 +** signal, for the above commands to work at all.
2838 +** Define this if you want to be able to type any command at a "type space
2839 +** to continue" prompt.
2841 +#define COMMANDFORSPACE 1
2844 +** The next three variables are used to provide a variable-size context
2845 +** display at the bottom of the screen. Normally, the user will see
2846 +** a number of lines equal to CONTEXTPCT of his screen, rounded down
2847 +** (thus, with CONTEXTPCT == 10, a 24-line screen will produce two lines
2848 +** of context). The context will never be greater than MAXCONTEXT or
2849 +** less than MINCONTEXT. To disable this feature entirely, set MAXCONTEXT
2850 +** and MINCONTEXT to the same value. To round context percentages up,
2851 +** define CONTEXTROUNDUP.
2853 +** Warning: don't set MAXCONTEXT ridiculously large. There is a
2854 +** static buffer of size MAXCONTEXT*BUFSIZ; since BUFSIZ is frequently
2855 +** 1K or larger, this can create a remarkably large executable.
2857 +#define CONTEXTPCT 20 /* Use 20% of the screen for context */
2858 +#define MINCONTEXT 2 /* Always show at least 2 lines of context */
2859 +#define MAXCONTEXT 10 /* Never show more than 10 lines of context */
2860 +#define CONTEXTROUNDUP 1 /* Round context up */
2863 +** Define this if you want the "mini-menu," which gives the most important
2864 +** options at the bottom of the screen, to be the default (in any case, it
2865 +** can be controlled with the "-M" switch).
2870 +** Redefine GETKEYSTROKE() to whatever appropriate on some MS-DOS systems
2871 +** where getchar() doesn't operate properly in raw mode.
2876 +#define GETKEYSTROKE() getxkey()
2878 +#define GETKEYSTROKE() getchar()
2882 +** We include <fcntl.h> to have the definition of O_BINARY. The
2883 +** configuration script will notice this and define MSDOS_BINARY_OPEN.
2888 +** Environment variable to use to locate the home directory. On DOS
2889 +** systems we set this to ISPELL_HOME to avoid conflicts with
2890 +** other programs that look for a HOME environment variable.
2892 +#define HOME "ISPELL_HOME"
2893 +#define PDICTHOME "."
2894 +#define OPTIONVAR "ISPELL_OPTIONS"
2895 +#define LIBRARYVAR "ISPELL_DICTDIR"
2898 +** On MS-DOS systems, we define the following variables so that
2899 +** ispell's files have legal suffixes. Note that these suffixes
2900 +** must agree with the way you've defined dictionary files which
2901 +** incorporate these suffixes.
2903 +** Actually, it is not recommended at all to change the suffixes,
2904 +** since they are hardwired in the Makefile's under languages/
2905 +** subdirectory, and MS-DOS will silently truncate excess letters anyway.
2907 +#define HASHSUFFIX ".hash"
2908 +#define STATSUFFIX ".sta"
2909 +#define COUNTSUFFIX ".cnt"
2910 diff -Nur vim60am.old/src/spell/lookup.c vim60am/src/spell/lookup.c
2911 --- vim60am.old/src/spell/lookup.c Thu Jan 1 01:00:00 1970
2912 +++ vim60am/src/spell/lookup.c Wed Jun 27 19:16:52 2001
2915 +static char Rcs_Id[] =
2920 + * lookup.c - see if a word appears in the dictionary
2922 + * Pace Willisson, 1983
2924 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
2925 + * All rights reserved.
2927 + * Redistribution and use in source and binary forms, with or without
2928 + * modification, are permitted provided that the following conditions
2931 + * 1. Redistributions of source code must retain the above copyright
2932 + * notice, this list of conditions and the following disclaimer.
2933 + * 2. Redistributions in binary form must reproduce the above copyright
2934 + * notice, this list of conditions and the following disclaimer in the
2935 + * documentation and/or other materials provided with the distribution.
2936 + * 3. All modifications to the source code must be clearly marked as
2937 + * such. Binary redistributions based on modified source code
2938 + * must be clearly marked as modified versions in the documentation
2939 + * and/or other materials provided with the distribution.
2940 + * 4. All advertising materials mentioning features or use of this software
2941 + * must display the following acknowledgment:
2942 + * This product includes software developed by Geoff Kuenning and
2943 + * other unpaid contributors.
2944 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
2945 + * products derived from this software without specific prior
2946 + * written permission.
2948 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
2949 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2950 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2951 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
2952 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2953 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2954 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2955 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2956 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2957 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2963 + * Revision 1.42 1995/01/08 23:23:42 geoff
2964 + * Support MSDOS_BINARY_OPEN when opening the hash file to read it in.
2966 + * Revision 1.41 1994/01/25 07:11:51 geoff
2967 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
2971 +#include "ispell.h"
2973 +#include <stdlib.h>
2980 +Local void dumpindex (struct flagptr * indexp, int depth);
2981 +#endif /* INDEXDUMP */
2983 +Public Logical inited = False;
2988 +linit (char * hashname)
2992 + register struct dent * dp;
2993 + struct flagent * entry;
2994 + struct flagptr * ind;
2997 + register ichar_t * cp;
3002 + if(hashtbl != NULL)
3006 + if(pflagindex != NULL)
3008 + pflagindex = NULL;
3009 + if(sflagindex != NULL)
3011 + sflagindex = NULL;
3012 + if((pflagindex = (struct flagptr *)calloc(SET_SIZE + MAXSTRINGCHARS,
3013 + sizeof(struct flagptr))) == NULL)
3015 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3018 + if((sflagindex = (struct flagptr *)calloc(SET_SIZE + MAXSTRINGCHARS,
3019 + sizeof(struct flagptr))) == NULL)
3021 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3025 + if ((hashfd = open (hashname, 0 | MSDOS_BINARY_OPEN)) < 0)
3027 + (void) sprintf(err_buf, CANT_OPEN, hashname);
3031 + hashsize = read (hashfd, (char *) &hashheader, sizeof hashheader);
3032 + if (hashsize < sizeof hashheader)
3035 + (void) sprintf(err_buf, LOOKUP_C_CANT_READ, hashname);
3036 + else if (hashsize == 0)
3037 + (void) sprintf(err_buf, LOOKUP_C_NULL_HASH, hashname);
3039 + (void) sprintf(err_buf, LOOKUP_C_SHORT_HASH (hashname, hashsize,
3040 + (int) sizeof hashheader));
3041 + (void) close (hashfd);
3044 + else if (hashheader.magic != SPELL_MAGIC)
3046 + (void) sprintf(err_buf,
3047 + LOOKUP_C_BAD_MAGIC (hashname, (unsigned int) SPELL_MAGIC,
3048 + (unsigned int) hashheader.magic));
3049 + (void) close (hashfd);
3052 + else if (hashheader.magic2 != SPELL_MAGIC)
3054 + (void) sprintf(err_buf,
3055 + LOOKUP_C_BAD_MAGIC2 (hashname, (unsigned int) SPELL_MAGIC,
3056 + (unsigned int) hashheader.magic2));
3057 + (void) close (hashfd);
3060 + else if (hashheader.compileoptions != COMPILEOPTIONS
3061 + || hashheader.maxstringchars != MAXSTRINGCHARS
3062 + || hashheader.maxstringcharlen != MAXSTRINGCHARLEN)
3064 + (void) sprintf(err_buf,
3065 + LOOKUP_C_BAD_OPTIONS ((unsigned int) hashheader.compileoptions,
3066 + hashheader.maxstringchars, hashheader.maxstringcharlen,
3067 + (unsigned int) COMPILEOPTIONS, MAXSTRINGCHARS, MAXSTRINGCHARLEN));
3068 + (void) close (hashfd);
3074 + * Dictionary is not needed - create an empty dummy table. We
3075 + * actually have to have one entry since the hash
3076 + * algorithm involves a divide by the table size
3077 + * (actually modulo, but zero is still unacceptable).
3078 + * So we create an empty entry.
3080 + hashsize = 1; /* This prevents divides by zero */
3081 + hashtbl = (struct dent *) calloc (1, sizeof (struct dent));
3082 + if (hashtbl == NULL)
3084 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3085 + (void) close (hashfd);
3088 + hashtbl[0].word = NULL;
3089 + hashtbl[0].next = NULL;
3090 + hashtbl[0].flagfield &= ~(USED | KEEP);
3091 + /* The flag bits don't matter, but calloc cleared them. */
3092 + if(hashstrings != NULL)
3093 + free(hashstrings);
3094 + if((hashstrings = (char *) calloc (1, (unsigned) hashheader.lstringsize))
3097 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3098 + (void) close (hashfd);
3104 + if(hashtbl != NULL)
3106 + if((hashtbl = (struct dent *)
3107 + malloc ((unsigned) hashheader.tblsize * sizeof (struct dent))) == NULL)
3109 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3110 + (void) close (hashfd);
3113 + hashsize = hashheader.tblsize;
3114 + if(hashstrings != NULL)
3115 + free(hashstrings);
3116 + if((hashstrings = (char *) malloc ((unsigned) hashheader.stringsize)) == NULL)
3118 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3119 + (void) close (hashfd);
3123 + numsflags = hashheader.stblsize;
3124 + numpflags = hashheader.ptblsize;
3125 + if(sflaglist != NULL)
3127 + if((sflaglist = (struct flagent *)
3128 + malloc ((numsflags + numpflags) * sizeof (struct flagent))) == NULL)
3130 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3131 + (void) close (hashfd);
3134 + pflaglist = sflaglist + numsflags;
3139 + * Read just the strings for the language table, and
3140 + * skip over the rest of the strings and all of the
3143 + if (read (hashfd, hashstrings, (unsigned) hashheader.lstringsize)
3144 + != hashheader.lstringsize)
3146 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3147 + (void) close (hashfd);
3150 + (void) lseek (hashfd,
3151 + (long) hashheader.stringsize - (long) hashheader.lstringsize
3152 + + (long) hashheader.tblsize * (long) sizeof (struct dent), 1);
3156 + if ((unsigned int)read (hashfd, hashstrings,
3157 + (unsigned int) hashheader.stringsize) != hashheader.stringsize
3158 + || (unsigned int)read (hashfd, (char *) hashtbl, (unsigned)
3159 + hashheader.tblsize * sizeof (struct dent))
3160 + != (unsigned int) hashheader.tblsize * sizeof (struct dent))
3162 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3163 + (void) close (hashfd);
3167 + if ((unsigned int)read (hashfd, (char *) sflaglist,
3168 + (unsigned int) (numsflags + numpflags) * sizeof (struct flagent))
3169 + != (unsigned int)(numsflags + numpflags) * sizeof (struct flagent))
3171 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3172 + (void) close (hashfd);
3175 + (void) close (hashfd);
3179 + for (i = hashsize, dp = hashtbl; --i >= 0; dp++)
3181 + if (dp->word == (char *) -1)
3184 + dp->word = &hashstrings [ (int)(dp->word) ];
3185 + if (dp->next == (struct dent *) -1)
3188 + dp->next = &hashtbl [ (int)(dp->next) ];
3192 + for (i = numsflags + numpflags, entry = sflaglist; --i >= 0; entry++)
3194 + if (entry->stripl)
3195 + entry->strip = (ichar_t *) &hashstrings[(int) entry->strip];
3197 + entry->strip = NULL;
3199 + entry->affix = (ichar_t *) &hashstrings[(int) entry->affix];
3201 + entry->affix = NULL;
3204 + ** Warning - 'entry' and 'i' are reset in the body of the loop
3205 + ** below. Don't try to optimize it by (e.g.) moving the decrement
3206 + ** of i into the loop condition.
3208 + for (i = numsflags, entry = sflaglist; i > 0; i--, entry++)
3210 + if (entry->affl == 0)
3213 + ind = &sflagindex[0];
3218 + cp = entry->affix + entry->affl - 1;
3219 + ind = &sflagindex[*cp];
3221 + while (ind->numents == 0 && ind->pu.fp != NULL)
3223 + if (cp == entry->affix)
3225 + ind = &ind->pu.fp[0];
3230 + ind = &ind->pu.fp[*--cp];
3235 + if (ind->numents == 0)
3236 + ind->pu.ent = entry;
3239 + ** If this index entry has more than MAXSEARCH flags in
3240 + ** it, we will split it into subentries to reduce the
3241 + ** searching. However, the split doesn't make sense in
3242 + ** two cases: (a) if we are already at the end of the
3243 + ** current affix, or (b) if all the entries in the list
3244 + ** have identical affixes. Since the list is sorted, (b)
3245 + ** is true if the first and last affixes in the list
3248 + if (!viazero && ind->numents >= MAXSEARCH &&
3249 + icharcmp (entry->affix, ind->pu.ent->affix) != 0)
3251 + /* Sneaky trick: back up and reprocess */
3252 + entry = ind->pu.ent - 1; /* -1 is for entry++ in loop */
3253 + i = numsflags - (entry - sflaglist);
3254 + if((ind->pu.fp = (struct flagptr *)
3255 + calloc ((unsigned) (SET_SIZE + hashheader.nstrchars),
3256 + sizeof (struct flagptr))) == NULL)
3258 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3265 + ** Warning - 'entry' and 'i' are reset in the body of the loop
3266 + ** below. Don't try to optimize it by (e.g.) moving the decrement
3267 + ** of i into the loop condition.
3269 + for (i = numpflags, entry = pflaglist; i > 0; i--, entry++)
3271 + if (entry->affl == 0)
3274 + ind = &pflagindex[0];
3279 + cp = entry->affix;
3280 + ind = &pflagindex[*cp++];
3282 + while (ind->numents == 0 && ind->pu.fp != NULL)
3286 + ind = &ind->pu.fp[0];
3291 + ind = &ind->pu.fp[*cp++];
3296 + if (ind->numents == 0)
3297 + ind->pu.ent = entry;
3300 + ** If this index entry has more than MAXSEARCH flags in
3301 + ** it, we will split it into subentries to reduce the
3302 + ** searching. However, the split doesn't make sense in
3303 + ** two cases: (a) if we are already at the end of the
3304 + ** current affix, or (b) if all the entries in the list
3305 + ** have identical affixes. Since the list is sorted, (b)
3306 + ** is true if the first and last affixes in the list
3309 + if (!viazero && ind->numents >= MAXSEARCH
3310 + && icharcmp (entry->affix, ind->pu.ent->affix) != 0)
3312 + /* Sneaky trick: back up and reprocess */
3313 + entry = ind->pu.ent - 1; /* -1 is for entry++ in loop */
3314 + i = numpflags - (entry - pflaglist);
3316 + (struct flagptr *) calloc (SET_SIZE + hashheader.nstrchars,
3317 + sizeof (struct flagptr));
3318 + if (ind->pu.fp == NULL)
3320 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3327 + (void) sprintf(err_buf, "Prefix index table:");
3328 + dumpindex (pflagindex, 0);
3329 + (void) sprintf(err_buf, "Suffix index table:");
3330 + dumpindex (sflagindex, 0);
3332 + if (hashheader.nstrchartype == 0)
3336 + chartypes = (struct strchartype *)
3337 + calloc (1, hashheader.nstrchartype * sizeof (struct strchartype));
3338 + if (chartypes == NULL)
3340 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3343 + for (i = 0, nextchar = hashheader.strtypestart;
3344 + i < hashheader.nstrchartype; i++)
3346 + chartypes[i].name = &hashstrings[nextchar];
3347 + nextchar += strlen (chartypes[i].name) + 1;
3348 + chartypes[i].deformatter = &hashstrings[nextchar];
3349 + nextchar += strlen (chartypes[i].deformatter) + 1;
3350 + chartypes[i].suffixes = &hashstrings[nextchar];
3351 + while (hashstrings[nextchar] != '\0')
3352 + nextchar += strlen (&hashstrings[nextchar]) + 1;
3363 + register struct flagptr * indexp,
3364 + register int depth)
3369 + char stripbuf[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
3371 + for (i = 0; i < SET_SIZE + hashheader.nstrchars; i++, indexp++)
3373 + if (indexp->numents == 0 && indexp->pu.fp != NULL)
3375 + for (j = depth; --j >= 0; )
3376 + (void) putc (' ', stderr);
3377 + if (i >= ' ' && i <= '~')
3378 + (void) putc (i, stderr);
3380 + (void) fprintf (stderr, "0x%x", i);
3381 + (void) putc ('\n', stderr);
3382 + dumpindex (indexp->pu.fp, depth + 1);
3384 + else if (indexp->numents)
3386 + for (j = depth; --j >= 0; )
3387 + (void) putc (' ', stderr);
3388 + if (i >= ' ' && i <= '~')
3389 + (void) putc (i, stderr);
3391 + (void) fprintf (stderr, "0x%x", i);
3392 + (void) fprintf (stderr, " -> %d entries\n", indexp->numents);
3393 + for (k = 0; k < indexp->numents; k++)
3395 + for (j = depth; --j >= 0; )
3396 + (void) putc (' ', stderr);
3397 + if (indexp->pu.ent[k].stripl)
3399 + (void) ichartostr (stripbuf, indexp->pu.ent[k].strip,
3400 + sizeof stripbuf, 1);
3401 + (void) fprintf (stderr, " entry %d (-%s,%s)\n",
3402 + &indexp->pu.ent[k] - sflaglist,
3404 + indexp->pu.ent[k].affl
3405 + ? ichartosstr (indexp->pu.ent[k].affix, 1) : "-");
3408 + (void) fprintf (stderr, " entry %d (%s)\n",
3409 + &indexp->pu.ent[k] - sflaglist,
3410 + ichartosstr (indexp->pu.ent[k].affix, 1));
3417 +/* n is length of s */
3418 +Public struct dent *
3419 +lookup (register ichar_t *s, int dotree)
3422 + register struct dent * dp;
3423 + register char * s1;
3424 + char schar[INPUTWORDLEN + MAXAFFIXLEN];
3426 + dp = &hashtbl[hash (s, hashsize)];
3427 + if (ichartostr (schar, s, sizeof schar, 1))
3428 + (void) fprintf (stderr, WORD_TOO_LONG (schar));
3429 + for ( ; dp != NULL; dp = dp->next)
3431 + /* quick strcmp, but only for equality */
3433 + if (s1 && s1[0] == schar[0] && strcmp (s1 + 1, schar + 1) == 0)
3435 +#ifndef NO_CAPITALIZATION_SUPPORT
3436 + while (dp->flagfield & MOREVARIANTS) /* Skip variations */
3442 + dp = treelookup (s);
3448 diff -Nur vim60am.old/src/spell/makedent.c vim60am/src/spell/makedent.c
3449 --- vim60am.old/src/spell/makedent.c Thu Jan 1 01:00:00 1970
3450 +++ vim60am/src/spell/makedent.c Wed Jun 27 19:16:52 2001
3453 + * Copyright 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
3454 + * All rights reserved.
3456 + * Redistribution and use in source and binary forms, with or without
3457 + * modification, are permitted provided that the following conditions
3460 + * 1. Redistributions of source code must retain the above copyright
3461 + * notice, this list of conditions and the following disclaimer.
3462 + * 2. Redistributions in binary form must reproduce the above copyright
3463 + * notice, this list of conditions and the following disclaimer in the
3464 + * documentation and/or other materials provided with the distribution.
3465 + * 3. All modifications to the source code must be clearly marked as
3466 + * such. Binary redistributions based on modified source code
3467 + * must be clearly marked as modified versions in the documentation
3468 + * and/or other materials provided with the distribution.
3469 + * 4. All advertising materials mentioning features or use of this software
3470 + * must display the following acknowledgment:
3471 + * This product includes software developed by Geoff Kuenning and
3472 + * other unpaid contributors.
3473 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
3474 + * products derived from this software without specific prior
3475 + * written permission.
3477 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
3478 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3479 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3480 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
3481 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3482 + * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3483 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3484 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3485 + * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3486 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3492 + * Revision 1.45 1994/12/27 23:08:52 geoff
3493 + * Add code to makedent to reject words that contain non-word characters.
3494 + * This helps protect people who use ISO 8-bit characters when ispell
3495 + * isn't configured for that option.
3497 + * Revision 1.44 1994/10/25 05:46:20 geoff
3498 + * Fix some incorrect declarations in the lint versions of some routines.
3500 + * Revision 1.43 1994/09/16 03:32:34 geoff
3501 + * Issue an error message for bad affix flags
3503 + * Revision 1.42 1994/02/07 04:23:43 geoff
3504 + * Correctly identify the deformatter when changing file types
3506 + * Revision 1.41 1994/01/25 07:11:55 geoff
3507 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
3511 +#include "ispell.h"
3512 +#include <stdlib.h>
3515 +Global int makedent(char * lbuf, int lbuflen, struct dent * ent);
3516 +#ifndef NO_CAPITALIZATION_SUPPORT
3517 +Global long whatcap(ichar_t * word);
3519 +Global int addvheader(struct dent * ent);
3520 +Global int combinecaps(struct dent * hdr, struct dent * newent);
3521 +#ifndef NO_CAPITALIZATION_SUPPORT
3522 +Local void forcevheader(struct dent * hdrp, struct dent * oldp,
3523 + struct dent * newp);
3524 +#endif /* NO_CAPITALIZATION_SUPPORT */
3525 +Local int combine_two_entries(struct dent * hdrp,
3526 + struct dent * oldp, struct dent * newp);
3527 +Local int acoversb(struct dent * enta, struct dent * entb);
3528 +Global void upcase(ichar_t * string);
3529 +Global void lowcase(ichar_t * string);
3530 +Global void chupcase(char * s);
3531 +Local int issubset(struct dent * ent1, struct dent * ent2);
3532 +Local void combineaffixes(struct dent * ent1, struct dent * ent2);
3533 +Global void toutent(FILE * outfile, struct dent * hent, int onlykeep);
3534 +Local void toutword(FILE * outfile, char * word, struct dent * cent);
3535 +Local void flagout(FILE * outfile, int flag);
3536 +Global int stringcharlen(char * bufp, int canonical);
3537 +Global int strtoichar(ichar_t * out, char * in, int outlen,
3539 +Global int ichartostr(char * out, ichar_t * in, int outlen,
3541 +Global ichar_t * strtosichar(char * in, int canonical);
3542 +Global char * ichartosstr(ichar_t * in, int canonical);
3543 +Global char * printichar(int in);
3544 +#ifndef ICHAR_IS_CHAR
3545 +Global ichar_t * icharcpy(ichar_t * out, ichar_t * in);
3546 +Global int icharlen(ichar_t * str);
3547 +Global int icharcmp(ichar_t * s1, ichar_t * s2);
3548 +Global int icharncmp(ichar_t * s1, ichar_t * s2, int n);
3549 +#endif /* ICHAR_IS_CHAR */
3550 +Global int findfiletype(char * name, int searchnames,
3551 + int * deformatter);
3553 +Local Logical has_marker;
3556 + * Fill in a directory entry, including setting the capitalization flags, and
3557 + * allocate and initialize memory for the d->word field. Returns -1
3558 + * if there was trouble. The input word must be in canonical form.
3567 + ichar_t ibuf[INPUTWORDLEN + MAXAFFIXLEN];
3573 + /* Strip off any trailing newline */
3574 + len = strlen(lbuf) - 1;
3575 + if(lbuf[len] == '\n')
3579 + /* WARNING: flagfield might be the same as mask! See ispell.h. */
3581 + (void) bzero ((char *) d->mask, sizeof (d->mask));
3582 + d->flagfield |= USED;
3583 + d->flagfield &= ~KEEP;
3585 + p = index(lbuf, hashheader.flagmarker);
3590 + ** Convert the word to an ichar_t and back; this makes sure that
3591 + ** it is in canonical form and thus that the length is correct.
3593 + if(strtoichar(ibuf, lbuf, INPUTWORDLEN * sizeof (ichar_t), 1)
3594 + || ichartostr(lbuf, ibuf, lbuflen, 1))
3596 + (void) fprintf(stderr, WORD_TOO_LONG (lbuf));
3600 + ** Make sure the word is well-formed(contains only legal characters).
3602 + for(ip = ibuf; *ip != 0; ip++)
3604 + if(!iswordch(*ip))
3606 + /* Boundary characters are legal as long as they're not at edges */
3607 + if(!isboundarych(*ip) || ip == ibuf || ip[1] == 0)
3609 + (void) fprintf(stderr, MAKEDENT_C_BAD_WORD_CHAR, lbuf);
3614 + len = strlen(lbuf);
3615 +#ifndef NO_CAPITALIZATION_SUPPORT
3617 + ** Figure out the capitalization rules from the capitalization of
3618 + ** the sample entry.
3620 + d->flagfield |= whatcap(ibuf);
3623 + if(len > INPUTWORDLEN - 1)
3625 + (void) fprintf(stderr, WORD_TOO_LONG (lbuf));
3629 + d->word = malloc((unsigned) len + 1);
3630 + if(d->word == NULL)
3632 + (void) fprintf(stderr, MAKEDENT_C_NO_WORD_SPACE, lbuf);
3636 + (void) strcpy (d->word, lbuf);
3637 +#ifdef NO_CAPITALIZATION_SUPPORT
3638 + chupcase(d->word);
3639 +#else /* NO_CAPITALIZATION_SUPPORT */
3640 + if(captype(d->flagfield) != FOLLOWCASE)
3641 + chupcase(d->word);
3642 +#endif /* NO_CAPITALIZATION_SUPPORT */
3647 + while(*p != '\0' && *p != '\n')
3649 + bit = CHARTOBIT((unsigned char) *p);
3650 + if(bit >= 0 && bit <= LARGESTFLAG)
3651 + SETMASKBIT(d->mask, bit);
3653 + (void) fprintf (stderr, BAD_FLAG, (unsigned char) *p);
3655 + if(*p == hashheader.flagmarker)
3656 + p++; /* Handle old-format dictionaries too */
3661 +#ifndef NO_CAPITALIZATION_SUPPORT
3663 +** Classify the capitalization of a sample entry. Returns one of the
3664 +** four capitalization codes ANYCASE, ALLCAPS, CAPITALIZED, or FOLLOWCASE.
3668 +whatcap(register ichar_t * word)
3670 + register ichar_t * p;
3672 + for(p = word; *p; p++)
3687 + ** No uppercase letters follow the lowercase ones.
3688 + ** If there is more than one uppercase letter, it's
3689 + ** "followcase". If only the first one is capitalized,
3690 + ** it's "capitalize". If there are no capitals
3691 + ** at all, it's ANYCASE.
3693 + if(myupper(word[0]))
3695 + for(p = word + 1; *p != '\0'; p++)
3697 + return FOLLOWCASE;
3698 + return CAPITALIZED;
3704 + return FOLLOWCASE; /* .../lower/upper */
3709 +** Add a variant-capitalization header to a word. This routine may be
3710 +** called even for a followcase word that doesn't yet have a header.
3712 +** Returns 0 if all was ok, -1 if allocation error.
3715 +addvheader(register struct dent *dp) /* Entry to update */
3717 + register struct dent * tdent; /* Copy of entry */
3720 + ** Add a second entry with the correct capitalization, and then make
3721 + ** dp into a special dummy entry.
3723 + tdent = (struct dent *) malloc (sizeof (struct dent));
3726 + (void) fprintf(stderr, MAKEDENT_C_NO_WORD_SPACE, dp->word);
3730 + if(captype(tdent->flagfield) != FOLLOWCASE)
3731 + tdent->word = NULL;
3734 + /* Followcase words need a copy of the capitalization */
3735 + tdent->word = malloc((unsigned int) strlen (tdent->word) + 1);
3736 + if(tdent->word == NULL)
3738 + (void) fprintf (stderr, MAKEDENT_C_NO_WORD_SPACE, dp->word);
3739 + free((char *) tdent);
3742 + (void) strcpy(tdent->word, dp->word);
3744 + chupcase(dp->word);
3746 + dp->flagfield &= ~CAPTYPEMASK;
3747 + dp->flagfield |= (ALLCAPS | MOREVARIANTS);
3750 +#endif /* NO_CAPITALIZATION_SUPPORT */
3753 +** Combine and resolve the entries describing two capitalizations of the same
3754 +** word. This may require allocating yet more entries.
3756 +** Hdrp is a pointer into a hash table. If the word covered by hdrp has
3757 +** variations, hdrp must point to the header. Newp is a pointer to temporary
3758 +** storage, and space is malloc'ed if newp is to be kept. The newp->word
3759 +** field must have been allocated with mymalloc, so that this routine may free
3760 +** the space if it keeps newp but not the word.
3762 +** Return value: 0 if the word was added, 1 if the word was combined
3763 +** with an existing entry, and -1 if trouble occurred(e.g., malloc).
3764 +** If 1 is returned, newp->word may have been be freed using myfree.
3766 +** Life is made much more difficult by the KEEP flag's possibilities. We
3767 +** must ensure that a !KEEP word doesn't find its way into the personal
3768 +** dictionary as a result of this routine's actions. However, a !KEEP
3769 +** word that has affixes must have come from the main dictionary, so it
3770 +** is acceptable to combine entries in that case(got that?).
3772 +** The net result of all this is a set of rules that is a bloody pain
3773 +** to figure out. Basically, we want to choose one of the following actions:
3775 +** (1) Add newp's affixes and KEEP flag to oldp, and discard newp.
3776 +** (2) Add oldp's affixes and KEEP flag to newp, replace oldp with
3777 +** newp, and discard newp.
3778 +#ifndef NO_CAPITALIZATION_SUPPORT
3779 +** (3) Insert newp as a new entry in the variants list. If there is
3780 +** currently no variant header, this requires adding one. Adding a
3781 +** header splits into two sub-cases:
3783 +** (3a) If oldp is ALLCAPS and the KEEP flags match, just turn it
3784 +** into the header.
3785 +** (3b) Otherwise, add a new entry to serve as the header.
3786 +** To ease list linking, this is done by copying oldp into
3787 +** the new entry, and then performing(3a).
3789 +** After newp has been added as a variant, its affixes and KEEP
3790 +** flag are OR-ed into the variant header.
3793 +** So how to choose which? The default is always case(3), which adds newp
3794 +** as a new entry in the variants list. Cases(1) and (2) are symmetrical
3795 +** except for which entry is discarded. We can use case(1) or (2) whenever
3796 +** one entry "covers" the other. "Covering" is defined as follows:
3798 +** (4) For entries with matching capitalization types, A covers B
3801 +** (4a) B's affix flags are a subset of A's, or the KEEP flags
3803 +** (4b) either the KEEP flags match, or A's KEEP flag is set.
3804 +** (Since A has more suffixes, combining B with it won't
3805 +** cause any extra suffixes to be added to the dictionary.)
3806 +** (4c) If the words are FOLLOWCASE, the capitalizations match
3809 +#ifndef NO_CAPITALIZATION_SUPPORT
3810 +** (5) For entries with mismatched capitalization types, A covers B
3811 +** if(4a) and(4b) are true, and:
3813 +** (5a) B is ALLCAPS, or
3814 +** (5b) A is ANYCASE, and B is CAPITALIZED.
3817 +** For any "hdrp" without variants, oldp is the same as hdrp. Otherwise,
3818 +** the above tests are applied using each variant in turn for oldp.
3822 + struct dent * hdrp, /* Header of entry currently in dictionary */
3823 + register struct dent * newp) /* Entry to add */
3825 + register struct dent *
3826 + oldp; /* Current "oldp" entry */
3827 +#ifndef NO_CAPITALIZATION_SUPPORT
3828 + register struct dent *
3829 + tdent; /* Entry we'll add to the dictionary */
3830 +#endif /* NO_CAPITALIZATION_SUPPORT */
3831 + register int retval = 0; /* Return value from combine_two_entries */
3834 + ** First, see if we can combine the two entries(cases 1 and 2). If
3835 + ** combine_two_entries does so, it will return 1. If it has trouble,
3836 + ** it will return zero.
3839 +#ifdef NO_CAPITALIZATION_SUPPORT
3840 + retval = combine_two_entries(hdrp, oldp, newp);
3841 +#else /* NO_CAPITALIZATION_SUPPORT */
3842 + if((oldp->flagfield &(CAPTYPEMASK | MOREVARIANTS))
3843 + == (ALLCAPS | MOREVARIANTS))
3845 + while(oldp->flagfield & MOREVARIANTS)
3847 + oldp = oldp->next;
3848 + retval = combine_two_entries(hdrp, oldp, newp);
3849 + if(retval != 0) /* Did we combine them? */
3854 + retval = combine_two_entries(hdrp, oldp, newp);
3858 + ** Couldn't combine the two entries. Add a new variant. For
3859 + ** ease, we'll stick it right behind the header, rather than
3860 + ** at the end of the list.
3862 + forcevheader(hdrp, oldp, newp);
3863 + tdent = (struct dent *) malloc (sizeof (struct dent));
3866 + (void) fprintf (stderr, MAKEDENT_C_NO_WORD_SPACE, newp->word);
3870 + tdent->next = hdrp->next;
3871 + hdrp->next = tdent;
3872 + tdent->flagfield |= (hdrp->flagfield & MOREVARIANTS);
3873 + hdrp->flagfield |= MOREVARIANTS;
3874 + combineaffixes(hdrp, newp);
3875 + hdrp->flagfield |= (newp->flagfield & KEEP);
3876 + if(captype(newp->flagfield) == FOLLOWCASE)
3877 + tdent->word = newp->word;
3880 + tdent->word = NULL;
3881 + free(newp->word); /* newp->word isn't needed */
3884 +#endif /* NO_CAPITALIZATION_SUPPORT */
3888 +#ifndef NO_CAPITALIZATION_SUPPORT
3890 +** The following routine implements steps 3a and 3b in the commentary
3891 +** for "combinecaps".
3895 + register struct dent * hdrp,
3896 + struct dent * oldp,
3897 + struct dent * newp)
3900 + if((hdrp->flagfield &(CAPTYPEMASK | MOREVARIANTS)) == ALLCAPS
3901 + && ((oldp->flagfield ^ newp->flagfield) & KEEP) == 0)
3902 + return; /* Caller will set MOREVARIANTS */
3903 + else if((hdrp->flagfield &(CAPTYPEMASK | MOREVARIANTS))
3904 + != (ALLCAPS | MOREVARIANTS))
3905 + (void) addvheader(hdrp);
3907 +#endif /* NO_CAPITALIZATION_SUPPORT */
3910 +** This routine implements steps 4 and 5 of the commentary for "combinecaps".
3912 +** Returns 1 if newp can be discarded, 0 if nothing done.
3915 +combine_two_entries(
3916 + struct dent *hdrp, /*(Possible) header of variant chain */
3917 + register struct dent *oldp, /* Pre-existing dictionary entry */
3918 + register struct dent *newp) /* Entry to possibly combine */
3921 + if(acoversb(oldp, newp))
3923 + /* newp is superfluous. Drop it, preserving affixes and keep flag */
3924 + combineaffixes(oldp, newp);
3925 + oldp->flagfield |= (newp->flagfield & KEEP);
3926 + hdrp->flagfield |= (newp->flagfield & KEEP);
3930 + else if(acoversb(newp, oldp))
3933 + ** oldp is superfluous. Replace it with newp, preserving affixes and
3936 + combineaffixes(newp, oldp);
3937 +#ifdef NO_CAPITALIZATION_SUPPORT
3938 + newp->flagfield |= (oldp->flagfield & KEEP);
3939 +#else /* NO_CAPITALIZATION_SUPPORT */
3940 + newp->flagfield |= (oldp->flagfield & (KEEP | MOREVARIANTS));
3941 +#endif /* NO_CAPITALIZATION_SUPPORT */
3942 + hdrp->flagfield |= (newp->flagfield & KEEP);
3943 + newp->next = oldp->next;
3945 + ** We really want to free oldp->word, but that might be part of
3946 + ** "hashstrings". So we'll futz around to arrange things so we can
3947 + ** free newp->word instead. This depends very much on the fact
3948 + ** that both words are the same length.
3950 + if(oldp->word != NULL)
3951 + (void) strcpy (oldp->word, newp->word);
3952 + free(newp->word); /* No longer needed */
3953 + newp->word = oldp->word;
3955 +#ifndef NO_CAPITALIZATION_SUPPORT
3956 + /* We may need to add a header if newp is followcase */
3957 + if(captype(newp->flagfield) == FOLLOWCASE
3958 + && (hdrp->flagfield & (CAPTYPEMASK | MOREVARIANTS))
3959 + != (ALLCAPS | MOREVARIANTS))
3960 + (void) addvheader (hdrp);
3961 +#endif /* NO_CAPITALIZATION_SUPPORT */
3969 +** Determine if enta covers entb, according to the rules in steps 4 and 5
3970 +** of the commentary for "combinecaps".
3974 + register struct dent * enta, /* "A" in the rules */
3975 + register struct dent * entb) /* "B" in the rules */
3977 + int subset; /* NZ if entb is a subset of enta */
3979 + if((subset = issubset(entb, enta)) != 0)
3981 + /* entb is a subset of enta; thus enta might cover entb */
3982 + if(((enta->flagfield ^ entb->flagfield) & KEEP) != 0
3983 + && (enta->flagfield & KEEP) == 0) /* Inverse of condition (4b) */
3988 + /* not a subset; KEEP flags must match exactly(both (4a) and (4b)) */
3989 + if(((enta->flagfield ^ entb->flagfield) & KEEP) != 0)
3993 + /* Rules(4a) and (4b) are satisfied; check for capitalization match */
3994 +#ifdef NO_CAPITALIZATION_SUPPORT
3996 + return subset; /* Just so it gets used */
3998 + return 1; /* All words match */
4000 +#else /* NO_CAPITALIZATION_SUPPORT */
4001 + if(((enta->flagfield ^ entb->flagfield) & CAPTYPEMASK) == 0)
4003 + if(captype(enta->flagfield) != FOLLOWCASE /* Condition (4c) */
4004 + || strcmp(enta->word, entb->word) == 0)
4005 + return 1; /* Perfect match */
4009 + else if(subset == 0) /* No flag subset, refuse */
4010 + return 0; /* ..near matches */
4011 + else if(captype(entb->flagfield) == ALLCAPS)
4013 + else if(captype(enta->flagfield) == ANYCASE
4014 + && captype(entb->flagfield) == CAPITALIZED)
4018 +#endif /* NO_CAPITALIZATION_SUPPORT */
4022 +upcase(register ichar_t * s)
4027 + *s = mytoupper(*s);
4033 +lowcase(register ichar_t * s)
4038 + *s = mytolower(*s);
4044 + * Upcase variant that works on normal strings. Note that it is a lot
4045 + * slower than the normal upcase. The input must be in canonical form.
4052 + is = strtosichar(s, 1);
4054 + (void) ichartostr (s, is, strlen (s) + 1, 1);
4058 +** See if one affix field is a subset of another. Returns NZ if ent1
4059 +** is a subset of ent2. The KEEP flag is not taken into consideration.
4063 + register struct dent * ent1,
4064 + register struct dent * ent2)
4066 +/* The following is really testing for MASKSIZE > 1, but cpp can't do that */
4068 + register int flagword;
4071 +#define MASKMAX MASKSIZE
4073 +#define MASKMAX MASKSIZE - 1
4074 +#endif /* FULLMASKSET */
4075 + for(flagword = MASKMAX; --flagword >= 0; )
4077 + if((ent1->mask[flagword] & ent2->mask[flagword])
4078 + != ent1->mask[flagword])
4081 +#endif /* MASKBITS > 32 */
4083 + return((ent1->mask[MASKSIZE - 1] & ent2->mask[MASKSIZE - 1])
4084 + == ent1->mask[MASKSIZE - 1]);
4086 + if(((ent1->mask[MASKSIZE - 1] & ent2->mask[MASKSIZE - 1])
4087 + ^ ent1->mask[MASKSIZE - 1]) & ~ALLFLAGS)
4091 +#endif /* FULLMASKSET */
4095 +** Add ent2's affix flags to ent1.
4099 + register struct dent * ent1,
4100 + register struct dent * ent2)
4102 +/* The following is really testing for MASKSIZE > 1, but cpp can't do that */
4104 + register int flagword;
4108 + /* MASKMAX is defined in issubset, just above */
4109 + for(flagword = MASKMAX; --flagword >= 0; )
4110 + ent1->mask[flagword] |= ent2->mask[flagword];
4111 +#endif /* MASKBITS > 32 */
4112 +#ifndef FULLMASKSET
4113 + ent1->mask[MASKSIZE - 1] |= ent2->mask[MASKSIZE - 1] & ~ALLFLAGS;
4118 +** Write out a dictionary entry, including capitalization variants.
4119 +** If onlykeep is true, only those variants with KEEP set will be
4124 + register FILE * toutfile,
4125 + struct dent * hent,
4126 + register int onlykeep)
4128 +#ifdef NO_CAPITALIZATION_SUPPORT
4129 + if(!onlykeep || (hent->flagfield & KEEP))
4130 + toutword(toutfile, hent->word, hent);
4132 + register struct dent * cent;
4133 + ichar_t wbuf[INPUTWORDLEN + MAXAFFIXLEN];
4136 + if(strtoichar(wbuf, cent->word, INPUTWORDLEN, 1))
4137 + (void) fprintf(stderr, WORD_TOO_LONG (cent->word));
4140 + if(!onlykeep || (cent->flagfield & KEEP))
4142 + switch(captype (cent->flagfield))
4146 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4149 + if((cent->flagfield & MOREVARIANTS) == 0 || cent != hent)
4152 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4157 + wbuf[0] = mytoupper(wbuf[0]);
4158 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4161 + toutword(toutfile, cent->word, cent);
4165 + if(cent->flagfield & MOREVARIANTS)
4166 + cent = cent->next;
4175 + register FILE * toutfile,
4177 + register struct dent * cent)
4181 + has_marker = False;
4182 + (void) fprintf (toutfile, "%s", word);
4183 + for(bit = 0; bit < LARGESTFLAG; bit++)
4185 + if(TSTMASKBIT(cent->mask, bit))
4186 + flagout(toutfile, BITTOCHAR (bit));
4188 + (void) fprintf (toutfile, "\n");
4193 + register FILE * toutfile,
4197 + (void) putc(hashheader.flagmarker, toutfile);
4198 + has_marker = True;
4199 + (void) putc (flag, toutfile);
4203 + * If the string under the given pointer begins with a string character,
4204 + * return the length of that "character". If not, return 0.
4205 + * May be called any time, but it's best if "isstrstart" is first
4206 + * used to filter out unnecessary calls.
4208 + * As a side effect, "laststringch" is set to the number of the string
4209 + * found, or to -1 if none was found. This can be useful for such things
4210 + * as case conversion.
4215 + int canonical) /* NZ if input is in canonical form */
4217 +#ifdef SLOWMULTIPLY
4218 + static char * sp[MAXSTRINGCHARS];
4219 + static int m_inited = 0;
4220 +#endif /* SLOWMULTIPLY */
4221 + register char * bufcur;
4222 + register char * stringcur;
4223 + register int stringno;
4224 + register int lowstringno;
4225 + register int highstringno;
4228 +#ifdef SLOWMULTIPLY
4232 + for(stringno = 0; stringno < MAXSTRINGCHARS; stringno++)
4233 + sp[stringno] = &hashheader.stringchars[stringno][0];
4235 +#endif /* SLOWMULTIPLY */
4237 + highstringno = hashheader.nstrchars - 1;
4238 + dupwanted = canonical ? 0 : defdupchar;
4239 + while(lowstringno <= highstringno)
4241 + stringno = (lowstringno + highstringno) >> 1;
4242 +#ifdef SLOWMULTIPLY
4243 + stringcur = sp[stringno];
4244 +#else /* SLOWMULTIPLY */
4245 + stringcur = &hashheader.stringchars[stringno][0];
4246 +#endif /* SLOWMULTIPLY */
4251 + if(((*bufcur++ ^ *stringcur) & 0x7F) != 0)
4253 + if(*bufcur++ != *stringcur)
4254 +#endif /* NO8BIT */
4257 + ** We can't use autoincrement above because of the
4262 + if(*stringcur == '\0')
4264 + if(hashheader.dupnos[stringno] == dupwanted)
4266 + /* We have a match */
4267 + laststringch = hashheader.stringdups[stringno];
4268 +#ifdef SLOWMULTIPLY
4269 + return stringcur - sp[stringno];
4270 +#else /* SLOWMULTIPLY */
4271 + return stringcur - &hashheader.stringchars[stringno][0];
4272 +#endif /* SLOWMULTIPLY */
4277 + /* No match - choose which side to search on */
4279 + if((*--bufcur & 0x7F) <(*stringcur & 0x7F))
4280 + highstringno = stringno - 1;
4281 + else if((*bufcur & 0x7F) >(*stringcur & 0x7F))
4282 + lowstringno = stringno + 1;
4284 + if(*--bufcur < *stringcur)
4285 + highstringno = stringno - 1;
4286 + else if(*bufcur > *stringcur)
4287 + lowstringno = stringno + 1;
4288 +#endif /* NO8BIT */
4289 + else if(dupwanted < hashheader.dupnos[stringno])
4290 + highstringno = stringno - 1;
4292 + lowstringno = stringno + 1;
4294 + laststringch = -1;
4295 + return 0; /* Not a string character */
4299 + * Convert an external string to an ichar_t string. If necessary, the parity
4300 + * bit is stripped off as part of the process.
4302 + * Returns NZ if the output string overflowed.
4306 + register ichar_t * out, /* Where to put result */
4307 + register char * in, /* String to convert */
4308 + int outlen, /* Size of output buffer, *BYTES* */
4309 + int canonical) /* NZ if input is in canonical form */
4311 + register int len; /* Length of next character */
4313 + outlen /= sizeof(ichar_t); /* Convert to an ichar_t count */
4314 + for( ; --outlen > 0 && *in != '\0'; in += len)
4316 + if(l1_isstringch(in, len, canonical))
4317 + *out++ = SET_SIZE + laststringch;
4319 + *out++ = *in & S_NOPARITY;
4322 + return outlen <= 0;
4326 + * Convert an ichar_t string to an external string.
4328 + * WARNING: the resulting string may wind up being longer than the
4329 + * original. In fact, even the sequence strtoichar->ichartostr may
4330 + * produce a result longer than the original, because the output form
4331 + * may use a different string type set than the original input form.
4333 + * Returns NZ if the output string overflowed.
4337 + register char * out, /* Where to put result */
4338 + register ichar_t * in, /* String to convert */
4339 + int outlen, /* Size of output buffer, bytes */
4340 + int canonical) /* NZ for canonical form */
4342 + register unsigned int ch; /* Next character to store */
4343 + register unsigned int i; /* Index into duplicates list */
4344 + register char * scharp; /* Pointer into a string char */
4346 + while(--outlen > 0 && (ch = *in++) != 0)
4349 + *out++ = (char) ch;
4355 + for(i = hashheader.nstrchars; --i >= 0; )
4357 + if(hashheader.dupnos[i] == defdupchar
4358 + && hashheader.stringdups[i] == ch)
4365 + scharp = hashheader.stringchars[(unsigned) ch];
4366 + while((*out++ = *scharp++) != '\0')
4372 + return outlen <= 0;
4376 + * Convert a string to an ichar_t, storing the result in a static area.
4380 + char * in, /* String to convert */
4381 + int canonical) /* NZ if input is in canonical form */
4383 + static ichar_t out[STRTOSICHAR_SIZE / sizeof(ichar_t)];
4385 + if(strtoichar(out, in, sizeof out, canonical))
4386 + (void) fprintf(stderr, WORD_TOO_LONG (in));
4391 + * Convert an ichar_t to a string, storing the result in a static area.
4395 + ichar_t * in, /* Internal string to convert */
4396 + int canonical) /* NZ for canonical conversion */
4398 + static char out[ICHARTOSSTR_SIZE];
4400 + if(ichartostr(out, in, sizeof out, canonical))
4401 + (void) fprintf(stderr, WORD_TOO_LONG (out));
4406 + * Convert a single ichar to a printable string, storing the result in
4412 + static char out[MAXSTRINGCHARLEN + 1];
4416 + out[0] = (char) in;
4420 + (void) strcpy(out, hashheader.stringchars[(unsigned) in - SET_SIZE]);
4424 +#ifndef ICHAR_IS_CHAR
4426 + * Copy an ichar_t.
4430 + register ichar_t * out, /* Destination */
4431 + register ichar_t * in) /* Source */
4433 + ichar_t * origout; /* Copy of destination for return */
4436 + while((*out++ = *in++) != 0)
4442 + * Return the length of an ichar_t.
4445 +icharlen(register ichar_t * in) /* String to count */
4447 + register int len; /* Length so far */
4449 + for(len = 0; *in++ != 0; len++)
4455 + * Compare two ichar_t's.
4459 + register ichar_t * s1,
4460 + register ichar_t * s2)
4465 + if(*s1++ != *s2++)
4466 + return *--s1 - *--s2;
4472 + * Strncmp for two ichar_t's.
4476 + register ichar_t * s1,
4477 + register ichar_t * s2,
4481 + while(--n >= 0 && *s1 != 0)
4483 + if(*s1++ != *s2++)
4484 + return *--s1 - *--s2;
4492 +#endif /* ICHAR_IS_CHAR */
4496 + char * name, /* Name to look up in suffix table */
4497 + int searchnames, /* NZ to search name field of table */
4498 + int * deformatter) /* Where to set deformatter type */
4500 + char * cp; /* Pointer into suffix list */
4501 + int cplen; /* Length of current suffix */
4502 + register int i; /* Index into type table */
4503 + int len; /* Length of the name */
4506 + * Note: for now, the deformatter is set to 1 for tex, 0 for nroff.
4507 + * Further, we assume that it's one or the other, so that a test
4508 + * for tex is sufficient. This needs to be generalized.
4510 + len = strlen(name);
4513 + for(i = 0; i < hashheader.nstrchartype; i++)
4515 + if(strcmp(name, chartypes[i].name) == 0)
4517 + if(deformatter != NULL)
4519 + (strcmp (chartypes[i].deformatter, "tex") == 0);
4524 + for(i = 0; i < hashheader.nstrchartype; i++)
4526 + for(cp = chartypes[i].suffixes; *cp != '\0'; cp += cplen + 1)
4528 + cplen = strlen(cp);
4529 + if(len >= cplen && strcmp(&name[len - cplen], cp) == 0)
4531 + if(deformatter != NULL)
4533 + (strcmp (chartypes[i].deformatter, "tex") == 0);
4542 +mypath_rindex(char const *str, char c)
4546 + x = (char *)str + strlen(str);
4550 + if(*x == '\\' || *x == '/' || *x == ':')
4559 diff -Nur vim60am.old/src/spell/msgs.h vim60am/src/spell/msgs.h
4560 --- vim60am.old/src/spell/msgs.h Thu Jan 1 01:00:00 1970
4561 +++ vim60am/src/spell/msgs.h Wed Jun 27 19:16:52 2001
4566 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
4567 + * All rights reserved.
4569 + * Redistribution and use in source and binary forms, with or without
4570 + * modification, are permitted provided that the following conditions
4573 + * 1. Redistributions of source code must retain the above copyright
4574 + * notice, this list of conditions and the following disclaimer.
4575 + * 2. Redistributions in binary form must reproduce the above copyright
4576 + * notice, this list of conditions and the following disclaimer in the
4577 + * documentation and/or other materials provided with the distribution.
4578 + * 3. All modifications to the source code must be clearly marked as
4579 + * such. Binary redistributions based on modified source code
4580 + * must be clearly marked as modified versions in the documentation
4581 + * and/or other materials provided with the distribution.
4582 + * 4. All advertising materials mentioning features or use of this software
4583 + * must display the following acknowledgment:
4584 + * This product includes software developed by Geoff Kuenning and
4585 + * other unpaid contributors.
4586 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
4587 + * products derived from this software without specific prior
4588 + * written permission.
4590 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
4591 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4592 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4593 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
4594 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4595 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4596 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4597 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4598 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4599 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4605 + * Messages header file.
4607 + * This file contains all text strings that are written by any of the
4608 + * C programs in the ispell package. The strings are collected here so that
4609 + * you can have the option of translating them into your local language for
4610 + * the benefit of your users.
4612 + * Anyone who goes to the effort of making a translation may wish to return
4613 + * the translated strings to me, geoff@ITcorp.com, so that I can include
4614 + * them in a later distribution under #ifdef control.
4616 + * Besides the strings in this header file, you may also want to translate
4617 + * the strings in version.h, which give the version and copyright information.
4618 + * However, any translation of these strings MUST accurately preserve the
4619 + * legal rights under international law; you may wish to consult a lawyer
4620 + * about this since you will be responsible for the results of any
4621 + * incorrect translation.
4623 + * Most of the strings below are simple printf format strings. If the printf
4624 + * takes more than one parameter, the string is given as a parameterized
4625 + * macro in case your local language needs a different word order.
4630 + * Revision 1.31 1994/12/27 23:08:57 geoff
4631 + * Add a message to be issued if a word contains illegal characters.
4633 + * Revision 1.30 1994/10/25 05:46:40 geoff
4634 + * Improve a couple of error messages relating to affix flags.
4636 + * Revision 1.29 1994/10/04 03:46:23 geoff
4637 + * Add a missing carriage return in the help message
4639 + * Revision 1.28 1994/09/16 05:07:00 geoff
4640 + * Add the BAD_FLAG message, and start a sentence in another message with
4641 + * an uppercase letter.
4643 + * Revision 1.27 1994/07/28 05:11:38 geoff
4644 + * Log message for previous revision: add BHASH_C_ZERO_COUNT.
4646 + * Revision 1.26 1994/07/28 04:53:49 geoff
4648 + * Revision 1.25 1994/05/24 04:54:36 geoff
4649 + * Add error messages for affix-flag checking.
4651 + * Revision 1.24 1994/01/25 07:12:42 geoff
4652 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
4657 + * The following strings are used in numerous places:
4659 +#define BAD_FLAG "\nIllegal affix flag character '%c'\n"
4660 +#define CANT_OPEN "Can't open %s"
4661 +#define CANT_CREATE "Can't create %s\n"
4662 +#define WORD_TOO_LONG(w) "\nWord '%s' too long at line %d of %s, truncated\n", \
4663 + w, __LINE__, __FILE__
4666 + * The following strings are used in buildhash.c:
4668 +#define BHASH_C_NO_DICT "No dictionary (%s)\n"
4669 +#define BHASH_C_NO_COUNT "No count file\n"
4670 +#define BHASH_C_BAD_COUNT "Bad count file\n"
4671 +#define BHASH_C_ZERO_COUNT "No words in dictionary\n"
4672 + /* I think this message looks better when it's nearly 80 characters wide,
4673 + * thus the ugly formatting in the next two defines. GK 9-87 */
4674 +#define BHASH_C_BAFF_1(max, excess) \
4675 + " Warning: this language table may exceed the maximum total affix length\nof %d by up to %d bytes. You should either increase MAXAFFIXLEN in config.X\nor shorten your largest affix/strip string difference. (This is the\n", \
4677 +#define BHASH_C_BAFF_2 \
4678 + "difference between the affix length and the strip length in a given\nreplacement rule, or the affix length if there is no strip string\nin that rule.)\n"
4679 +#define BHASH_C_OVERFLOW "Hash table overflowed by %d words\n"
4680 +#define BHASH_C_CANT_OPEN_DICT "Can't open dictionary\n"
4681 +#define BHASH_C_NO_SPACE "Couldn't allocate hash table\n"
4682 +#define BHASH_C_COLLISION_SPACE "\ncouldn't allocate space for collision\n"
4683 +#define BHASH_C_COUNTING "Counting words in dictionary ...\n"
4684 +#define BHASH_C_WORD_COUNT "\n%d words\n"
4685 +#define BHASH_C_USAGE "Usage: buildhash [-s] dict-file aff-file hash-file\n\tbuildhash -c count aff-file\n"
4688 + * The following strings are used in correct.c:
4690 +#define CORR_C_HELP_1 "Whenever a word is found that is not in the dictionary,\n"
4691 +#define CORR_C_HELP_2 "it is printed on the first line of the screen. If the dictionary\n"
4692 +#define CORR_C_HELP_3 "contains any similar words, they are listed with a number\n"
4693 +#define CORR_C_HELP_4 "next to each one. You have the option of replacing the word\n"
4694 +#define CORR_C_HELP_5 "completely, or choosing one of the suggested words.\n"
4695 + /* You may add HELP_6 through HELP_9 if your language needs more lines */
4696 +#define CORR_C_HELP_6 ""
4697 +#define CORR_C_HELP_7 ""
4698 +#define CORR_C_HELP_8 ""
4699 +#define CORR_C_HELP_9 ""
4700 +#define CORR_C_HELP_COMMANDS "\nCommands are:\n\n"
4701 +#define CORR_C_HELP_R_CMD "R Replace the misspelled word completely.\n"
4702 +#define CORR_C_HELP_BLANK "Space Accept the word this time only.\n"
4703 +#define CORR_C_HELP_A_CMD "A Accept the word for the rest of this session.\n"
4704 +#define CORR_C_HELP_I_CMD "I Accept the word, and put it in your private dictionary.\n"
4705 +#define CORR_C_HELP_U_CMD "U Accept and add lowercase version to private dictionary.\n"
4706 +#define CORR_C_HELP_0_CMD "0-n Replace with one of the suggested words.\n"
4707 +#define CORR_C_HELP_L_CMD "L Look up words in system dictionary.\n"
4708 +#define CORR_C_HELP_X_CMD "X Write the rest of this file, ignoring misspellings,\n and start next file.\n"
4709 +#define CORR_C_HELP_Q_CMD "Q Quit immediately. Asks for confirmation.\n Leaves file unchanged.\n"
4710 +#define CORR_C_HELP_BANG "! Shell escape.\n"
4711 +#define CORR_C_HELP_REDRAW "^L Redraw screen.\n"
4712 +#define CORR_C_HELP_SUSPEND "^Z Suspend program.\n"
4713 +#define CORR_C_HELP_HELP "? Show this help screen.\n"
4714 +#define CORR_C_HELP_TYPE_SPACE "-- Type space to continue --"
4716 +#define CORR_C_FILE_LABEL " File: %s"
4717 +#define CORR_C_READONLY "[READONLY]"
4718 +#define CORR_C_MINI_MENU "[SP] <number> R)epl A)ccept I)nsert L)ookup U)ncap Q)uit e(X)it or ? for help\n"
4719 +#define CORR_C_CONFIRM_QUIT "Are you sure you want to throw away your changes? "
4720 +#define CORR_C_REPLACE_WITH "Replace with: "
4721 +#define CORR_C_LOOKUP_PROMPT "Lookup string ('*' is wildcard): "
4722 +#define CORR_C_MORE_PROMPT "-- more --"
4723 +#define CORR_C_BLANK_MORE " "
4724 +#define CORR_C_END_LOOK "--end--"
4727 + * The following strings are used in defmt.c:
4729 +#define DEFMT_C_TEX_MATH_ERROR "****ERROR in parsing TeX math mode!\n"
4730 +#define DEFMT_C_LR_MATH_ERROR "***ERROR in LR to math-mode switch.\n"
4733 + * The following strings are used in icombine.c:
4735 +#define ICOMBINE_C_BAD_TYPE "icombine: unrecognized formatter type '%s'\n"
4736 +#define ICOMBINE_C_USAGE "Usage: icombine [-T suffix] [aff-file] < wordlist\n"
4739 + * The following strings are used in ispell.c:
4741 +#define ISPELL_C_USAGE1 "Usage: %s [-dfile | -pfile | -wchars | -Wn | -t | -n | -x | -b | -S | -B | -C | -P | -m | -Lcontext | -M | -N | -Ttype | -V] file .....\n"
4742 +#define ISPELL_C_USAGE2 " %s [-dfile | -pfile | -wchars | -Wn | -t | -n | -Ttype] -l\n"
4744 +#define ISPELL_C_USAGE3 " %s [-dfile | -pfile | -ffile | -Wn | -t | -n | -s | -B | -C | -P | -m | -Ttype] {-a | -A}\n"
4746 +#define ISPELL_C_USAGE3 " %s [-dfile | -pfile | -ffile | -Wn | -t | -n | -B | -C | -P | -m | -Ttype] {-a | -A}\n"
4748 +#define ISPELL_C_USAGE4 " %s [-dfile] [-wchars | -Wn] -c\n"
4749 +#define ISPELL_C_USAGE5 " %s [-dfile] [-wchars] -e[1-4]\n"
4750 +#define ISPELL_C_USAGE6 " %s [-dfile] [-wchars] -D\n"
4751 +#define ISPELL_C_USAGE7 " %s -v\n"
4752 +#define ISPELL_C_TEMP_DISAPPEARED "temporary file disappeared (%s)\n"
4753 +#define ISPELL_C_BAD_TYPE "ispell: unrecognized formatter type '%s'\n"
4754 +#define ISPELL_C_NO_FILE "ispell: specified file does not exist\n"
4755 +#define ISPELL_C_NO_FILES "ispell: specified files do not exist\n"
4756 +#define ISPELL_C_CANT_WRITE "Warning: Can't write to %s\n"
4757 +#define ISPELL_C_OPTIONS_ARE "Compiled-in options:\n"
4759 +#define ISPELL_C_NO_OPTIONS_SPACE "ispell: no memory to read default options\n"
4763 + * The following strings are used in lookup.c:
4765 +#define LOOKUP_C_CANT_READ "Trouble reading hash table %s"
4766 +#define LOOKUP_C_NULL_HASH "Null hash table %s"
4767 +#define LOOKUP_C_SHORT_HASH(name, gotten, wanted) \
4768 + "Truncated hash table %s: got %d bytes, expected %d", \
4769 + name, gotten, wanted
4770 +#define LOOKUP_C_BAD_MAGIC(name, wanted, gotten) \
4771 + "Illegal format hash table %s - expected magic 0x%x, got 0x%x", \
4772 + name, wanted, gotten
4773 +#define LOOKUP_C_BAD_MAGIC2(name, wanted, gotten) \
4774 + "Illegal format hash table %s - \nexpected magic2 0x%x, got 0x%x", \
4775 + name, wanted, gotten
4776 +#define LOOKUP_C_BAD_OPTIONS(gotopts, gotchars, gotlen, wantedopts, wantedchars, wantedlen) \
4777 + "Hash table options don't agree with buildhash - 0x%x/%d/%d vs. 0x%x/%d/%d", \
4778 + gotopts, gotchars, gotlen, \
4779 + wantedopts, wantedchars, wantedlen
4780 +#define LOOKUP_C_NO_HASH_SPACE "Couldn't allocate space for hash table"
4781 +#define LOOKUP_C_BAD_FORMAT "Illegal format hash table"
4782 +#define LOOKUP_C_NO_LANG_SPACE "Couldn't allocate space for language tables"
4785 + * The following strings are used in makedent.c:
4787 +#define MAKEDENT_C_NO_WORD_SPACE "\nCouldn't allocate space for word '%s'\n"
4788 +#define MAKEDENT_C_BAD_WORD_CHAR "\nWord '%s' contains illegal characters\n"
4791 + * The following strings are used in parse.y:
4793 +#define PARSE_Y_8_BIT "Eighth bit ignored (recompile ispell without NO8BIT)"
4794 +#define PARSE_Y_NO_WORD_STRINGS "wordchars statement may not specify string characters"
4795 +#define PARSE_Y_UNMATCHED "Unmatched charset lengths"
4796 +#define PARSE_Y_NO_BOUNDARY_STRINGS "boundarychars statement may not specify string characters"
4797 +#define PARSE_Y_LONG_STRING "String character is too long"
4798 +#define PARSE_Y_NULL_STRING "String character must have nonzero length"
4799 +#define PARSE_Y_MANY_STRINGS "Too many string characters"
4800 +#define PARSE_Y_NO_SUCH_STRING "No such string character"
4801 +#define PARSE_Y_MULTIPLE_STRINGS "Alternate string character was already defined"
4802 +#define PARSE_Y_LENGTH_MISMATCH "Upper and lower versions of string character must be same length"
4803 +#define PARSE_Y_WRONG_NROFF "Incorrect character count in nroffchars statement"
4804 +#define PARSE_Y_WRONG_TEX "Incorrect character count in TeXchars statement"
4805 +#define PARSE_Y_DOUBLE_COMPOUND "Compoundwords option may only appear once"
4806 +#define PARSE_Y_LONG_FLAG "Flag must be single character"
4807 +#define PARSE_Y_BAD_FLAG "Flag must be alphabetic"
4808 +#define PARSE_Y_DUP_FLAG "Duplicate flag"
4809 +#define PARSE_Y_NO_SPACE "Out of memory"
4810 +#define PARSE_Y_NEED_BLANK "Single characters must be separated by a blank"
4811 +#define PARSE_Y_MANY_CONDS "Too many conditions; 8 maximum"
4812 +#define PARSE_Y_EOF "Unexpected EOF in quoted string"
4813 +#define PARSE_Y_LONG_QUOTE "Quoted string too long, max 256 characters"
4814 +#define PARSE_Y_ERROR_FORMAT(file, lineno, error) \
4815 + "%s line %d: %s\n", file, lineno, error
4816 +#define PARSE_Y_MALLOC_TROUBLE "yyopen: trouble allocating memory\n"
4817 +#define PARSE_Y_UNGRAB_PROBLEM "Internal error: ungrab buffer overflow"
4818 +#define PARSE_Y_BAD_DEFORMATTER "Deformatter must be either 'nroff' or 'tex'"
4819 +#define PARSE_Y_BAD_NUMBER "Illegal digit in number"
4822 + * The following strings are used in term.c:
4824 +#define TERM_C_SMALL_SCREEN "Screen too small: need at least %d lines\n"
4825 +#define TERM_C_NO_BATCH "Can't deal with non-interactive use yet.\n"
4826 +#define TERM_C_CANT_FORK "Couldn't fork, try later.\n"
4827 +#define TERM_C_TYPE_SPACE "\n-- Type space to continue --"
4830 + * The following strings are used in tree.c:
4832 +#define TREE_C_CANT_UPDATE "Warning: Cannot update personal dictionary (%s)\n"
4833 +#define TREE_C_NO_SPACE "Ran out of space for personal dictionary\n"
4834 +#define TREE_C_TRY_ANYWAY "Continuing anyway (with reduced performance).\n"
4837 + * The following strings are used in unsq.c:
4839 +#define UNSQ_C_BAD_COUNT "Illegal count character 0x%x\n"
4840 +#define UNSQ_C_SURPRISE_EOF "Unexpected EOF\n"
4841 diff -Nur vim60am.old/src/spell/tgood.c vim60am/src/spell/tgood.c
4842 --- vim60am.old/src/spell/tgood.c Thu Jan 1 01:00:00 1970
4843 +++ vim60am/src/spell/tgood.c Wed Jun 27 19:16:55 2001
4846 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
4847 + * All rights reserved.
4849 + * Redistribution and use in source and binary forms, with or without
4850 + * modification, are permitted provided that the following conditions
4853 + * 1. Redistributions of source code must retain the above copyright
4854 + * notice, this list of conditions and the following disclaimer.
4855 + * 2. Redistributions in binary form must reproduce the above copyright
4856 + * notice, this list of conditions and the following disclaimer in the
4857 + * documentation and/or other materials provided with the distribution.
4858 + * 3. All modifications to the source code must be clearly marked as
4859 + * such. Binary redistributions based on modified source code
4860 + * must be clearly marked as modified versions in the documentation
4861 + * and/or other materials provided with the distribution.
4862 + * 4. All advertising materials mentioning features or use of this software
4863 + * must display the following acknowledgment:
4864 + * This product includes software developed by Geoff Kuenning and
4865 + * other unpaid contributors.
4866 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
4867 + * products derived from this software without specific prior
4868 + * written permission.
4870 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
4871 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4872 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4873 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
4874 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4875 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4876 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4877 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4878 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4879 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4884 + * Table-driven version of good.c.
4886 + * Geoff Kuenning, July 1987
4891 + * Revision 1.32 1994/11/02 06:56:16 geoff
4892 + * Remove the anyword feature, which I've decided is a bad idea.
4894 + * Revision 1.31 1994/10/25 05:46:25 geoff
4895 + * Add support for the FF_ANYWORD (affix applies to all words, even if
4896 + * flag bit isn't set) flag option.
4898 + * Revision 1.30 1994/05/24 06:23:08 geoff
4899 + * Don't create a hit if "allhits" is clear and capitalization
4900 + * mismatches. This cures a bug where a word could be in the dictionary
4901 + * and yet not found.
4903 + * Revision 1.29 1994/05/17 06:44:21 geoff
4904 + * Add support for controlled compound formation and the COMPOUNDONLY
4905 + * option to affix flags.
4907 + * Revision 1.28 1994/01/25 07:12:13 geoff
4908 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
4913 +#include "ispell.h"
4915 +Global void chk_aff (ichar_t * word, ichar_t * ucword, int len,
4916 + int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
4917 +Local void pfx_list_chk (ichar_t * word, ichar_t * ucword,
4918 + int len, int optflags, int sfxopts, struct flagptr * ind,
4919 + int ignoreflagbits, int allhits);
4920 +Local void chk_suf (ichar_t * word, ichar_t * ucword, int len,
4921 + int optflags, struct flagent * pfxent, int ignoreflagbits,
4923 +Local void suf_list_chk (ichar_t * word, ichar_t * ucword, int len,
4924 + struct flagptr * ind, int optflags, struct flagent * pfxent,
4925 + int ignoreflagbits, int allhits);
4926 +Global int expand_pre (char * croot, ichar_t * rootword,
4927 + MASKTYPE mask[], int option, char * extra);
4928 +Local int pr_pre_expansion (char * croot, ichar_t * rootword,
4929 + struct flagent * flent, MASKTYPE mask[], int option,
4931 +Global int expand_suf (char * croot, ichar_t * rootword,
4932 + MASKTYPE mask[], int optflags, int option, char * extra);
4933 +Local int pr_suf_expansion (char * croot, ichar_t * rootword,
4934 + struct flagent * flent, int option, char * extra);
4935 +Local void forcelc (ichar_t * dst, int len);
4937 +/* Check possible affixes */
4940 + ichar_t * word, /* Word to be checked */
4941 + ichar_t * ucword, /* Upper-case-only copy of word */
4942 + int len, /* The length of word/ucword */
4943 + int ignoreflagbits, /* Ignore whether affix is legal */
4944 + int allhits, /* Keep going after first hit */
4945 + int pfxopts, /* Options to apply to prefixes */
4946 + int sfxopts) /* Options to apply to suffixes */
4948 + register ichar_t * cp; /* Pointer to char to index on */
4949 + struct flagptr * ind; /* Flag index table to test */
4951 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, &pflagindex[0],
4952 + ignoreflagbits, allhits);
4954 + ind = &pflagindex[*cp++];
4955 + while (ind->numents == 0 && ind->pu.fp != NULL)
4959 + if (ind->pu.fp[0].numents)
4961 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, &ind->pu.fp[0],
4962 + ignoreflagbits, allhits);
4963 + if (numhits && !allhits && !cflag && !ignoreflagbits)
4966 + ind = &ind->pu.fp[*cp++];
4968 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, ind, ignoreflagbits,
4970 + if (numhits && !allhits && !cflag && !ignoreflagbits)
4972 + chk_suf (word, ucword, len, sfxopts, (struct flagent *) NULL,
4973 + ignoreflagbits, allhits);
4976 +/* Check some prefix flags */
4979 + ichar_t * word, /* Word to be checked */
4980 + ichar_t * ucword, /* Upper-case-only word */
4981 + int len, /* The length of ucword */
4982 + int optflags, /* Options to apply */
4983 + int sfxopts, /* Options to apply to suffixes */
4984 + struct flagptr * ind, /* Flag index table */
4985 + int ignoreflagbits, /* Ignore whether affix is legal */
4986 + int allhits) /* Keep going after first hit */
4988 + int cond; /* Condition number */
4989 + register ichar_t * cp; /* Pointer into end of ucword */
4990 + struct dent * dent; /* Dictionary entry we found */
4991 + int entcount; /* Number of entries to process */
4992 + register struct flagent *
4993 + flent; /* Current table entry */
4994 + int preadd; /* Length added to tword2 as prefix */
4995 + register int tlen; /* Length of tword */
4996 + ichar_t tword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4]; /* Tmp cpy */
4997 + ichar_t tword2[sizeof tword]; /* 2nd copy for ins_root_cap */
4999 + for (flent = ind->pu.ent, entcount = ind->numents;
5000 + entcount > 0; flent++, entcount--)
5003 + * If this is a compound-only affix, ignore it unless we're
5004 + * looking for that specific thing.
5006 + if ((flent->flagflags & FF_COMPOUNDONLY) != 0
5007 + && (optflags & FF_COMPOUNDONLY) == 0)
5010 + * In COMPOUND_CONTROLLED mode, the FF_COMPOUNDONLY bit must
5013 + if (compoundflag == COMPOUND_CONTROLLED
5014 + && ((flent->flagflags ^ optflags) & FF_COMPOUNDONLY) != 0)
5017 + * See if the prefix matches.
5019 + tlen = len - flent->affl;
5020 + if (tlen > 0 && (flent->affl == 0 ||
5021 + icharncmp (flent->affix, ucword, flent->affl) == 0) &&
5022 + tlen + flent->stripl >= flent->numconds)
5025 + * The prefix matches. Remove it, replace it by the "strip"
5026 + * string (if any), and check the original conditions.
5028 + if (flent->stripl)
5029 + (void) icharcpy (tword, flent->strip);
5030 + (void) icharcpy (tword + flent->stripl, ucword + flent->affl);
5032 + for (cond = 0; cond < flent->numconds; cond++)
5034 + if ((flent->conds[*cp++] & (1 << cond)) == 0)
5037 + if (cond >= flent->numconds)
5040 + * The conditions match. See if the word is in the
5043 + tlen += flent->stripl;
5045 + flagpr (tword, BITTOCHAR (flent->flagbit), flent->stripl,
5046 + flent->affl, -1, 0);
5047 + else if (ignoreflagbits)
5049 + if ((dent = lookup (tword, 1)) != NULL)
5054 + (void) icharcpy (cp, flent->affix);
5055 + cp += flent->affl;
5058 + preadd = cp - tword2;
5059 + (void) icharcpy (cp, tword);
5061 + if (flent->stripl)
5064 + (void) icharcpy (cp, flent->strip);
5066 + (void) ins_root_cap (tword2, word,
5067 + flent->stripl, preadd,
5068 + 0, (cp - tword2) - tlen - preadd,
5069 + dent, flent, (struct flagent *) NULL);
5072 + else if ((dent = lookup (tword, 1)) != NULL
5073 + && TSTMASKBIT (dent->mask, flent->flagbit))
5075 + if (numhits < MAX_HITS)
5077 + hits[numhits].dictent = dent;
5078 + hits[numhits].prefix = flent;
5079 + hits[numhits].suffix = NULL;
5084 +#ifndef NO_CAPITALIZATION_SUPPORT
5085 + if (cap_ok (word, &hits[0], len))
5088 +#else /* NO_CAPITALIZATION_SUPPORT */
5090 +#endif /* NO_CAPITALIZATION_SUPPORT */
5094 + * Handle cross-products.
5096 + if (flent->flagflags & FF_CROSSPRODUCT)
5097 + chk_suf (word, tword, tlen, sfxopts | FF_CROSSPRODUCT,
5098 + flent, ignoreflagbits, allhits);
5104 +/* Check possible suffixes */
5107 + ichar_t * word, /* Word to be checked */
5108 + ichar_t * ucword, /* Upper-case-only word */
5109 + int len, /* The length of ucword */
5110 + int optflags, /* Affix option flags */
5111 + struct flagent * pfxent, /* Prefix flag entry if cross-prod */
5112 + int ignoreflagbits, /* Ignore whether affix is legal */
5113 + int allhits) /* Keep going after first hit */
5115 + register ichar_t * cp; /* Pointer to char to index on */
5116 + struct flagptr * ind; /* Flag index table to test */
5118 + suf_list_chk (word, ucword, len, &sflagindex[0], optflags, pfxent,
5119 + ignoreflagbits, allhits);
5120 + cp = ucword + len - 1;
5121 + ind = &sflagindex[*cp];
5122 + while (ind->numents == 0 && ind->pu.fp != NULL)
5126 + if (ind->pu.fp[0].numents)
5128 + suf_list_chk (word, ucword, len, &ind->pu.fp[0],
5129 + optflags, pfxent, ignoreflagbits, allhits);
5130 + if (numhits != 0 && !allhits && !cflag && !ignoreflagbits)
5133 + ind = &ind->pu.fp[*--cp];
5135 + suf_list_chk (word, ucword, len, ind, optflags, pfxent,
5136 + ignoreflagbits, allhits);
5141 + ichar_t * word, /* Word to be checked */
5142 + ichar_t * ucword, /* Upper-case-only word */
5143 + int len, /* The length of ucword */
5144 + struct flagptr * ind, /* Flag index table */
5145 + int optflags, /* Affix option flags */
5146 + struct flagent * pfxent, /* Prefix flag entry if crossonly */
5147 + int ignoreflagbits, /* Ignore whether affix is legal */
5148 + int allhits) /* Keep going after first hit */
5150 + register ichar_t * cp; /* Pointer into end of ucword */
5151 + int cond; /* Condition number */
5152 + struct dent * dent; /* Dictionary entry we found */
5153 + int entcount; /* Number of entries to process */
5154 + register struct flagent *
5155 + flent; /* Current table entry */
5156 + int preadd; /* Length added to tword2 as prefix */
5157 + register int tlen; /* Length of tword */
5158 + ichar_t tword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4]; /* Tmp cpy */
5159 + ichar_t tword2[sizeof tword]; /* 2nd copy for ins_root_cap */
5161 + (void) icharcpy (tword, ucword);
5162 + for (flent = ind->pu.ent, entcount = ind->numents;
5164 + flent++, entcount--)
5166 + if ((optflags & FF_CROSSPRODUCT) != 0
5167 + && (flent->flagflags & FF_CROSSPRODUCT) == 0)
5170 + * If this is a compound-only affix, ignore it unless we're
5171 + * looking for that specific thing.
5173 + if ((flent->flagflags & FF_COMPOUNDONLY) != 0
5174 + && (optflags & FF_COMPOUNDONLY) == 0)
5177 + * In COMPOUND_CONTROLLED mode, the FF_COMPOUNDONLY bit must
5180 + if (compoundflag == COMPOUND_CONTROLLED
5181 + && ((flent->flagflags ^ optflags) & FF_COMPOUNDONLY) != 0)
5184 + * See if the suffix matches.
5186 + tlen = len - flent->affl;
5188 + && (flent->affl == 0
5189 + || icharcmp (flent->affix, ucword + tlen) == 0)
5190 + && tlen + flent->stripl >= flent->numconds)
5193 + * The suffix matches. Remove it, replace it by the "strip"
5194 + * string (if any), and check the original conditions.
5196 + (void) icharcpy (tword, ucword);
5197 + cp = tword + tlen;
5198 + if (flent->stripl)
5200 + (void) icharcpy (cp, flent->strip);
5201 + tlen += flent->stripl;
5202 + cp = tword + tlen;
5206 + for (cond = flent->numconds; --cond >= 0; )
5208 + if ((flent->conds[*--cp] & (1 << cond)) == 0)
5214 + * The conditions match. See if the word is in the
5219 + if (optflags & FF_CROSSPRODUCT)
5220 + flagpr (tword, BITTOCHAR (pfxent->flagbit),
5221 + pfxent->stripl, pfxent->affl,
5222 + BITTOCHAR (flent->flagbit), flent->affl);
5224 + flagpr (tword, -1, 0, 0,
5225 + BITTOCHAR (flent->flagbit), flent->affl);
5227 + else if (ignoreflagbits)
5229 + if ((dent = lookup (tword, 1)) != NULL)
5232 + if ((optflags & FF_CROSSPRODUCT)
5233 + && pfxent->affl != 0)
5235 + (void) icharcpy (cp, pfxent->affix);
5236 + cp += pfxent->affl;
5239 + preadd = cp - tword2;
5240 + (void) icharcpy (cp, tword);
5242 + if ((optflags & FF_CROSSPRODUCT)
5243 + && pfxent->stripl != 0)
5246 + (void) icharcpy (cp, pfxent->strip);
5247 + cp += pfxent->stripl;
5249 + if (flent->stripl)
5252 + (void) icharcpy (cp, flent->strip);
5253 + cp += flent->stripl;
5258 + (void) icharcpy (cp, flent->affix);
5259 + cp += flent->affl;
5261 + (void) ins_root_cap (tword2, word,
5262 + (optflags & FF_CROSSPRODUCT) ? pfxent->stripl : 0,
5264 + flent->stripl, (cp - tword2) - tlen - preadd,
5265 + dent, pfxent, flent);
5268 + else if ((dent = lookup (tword, 1)) != NULL
5269 + && TSTMASKBIT (dent->mask, flent->flagbit)
5270 + && ((optflags & FF_CROSSPRODUCT) == 0
5271 + || TSTMASKBIT (dent->mask, pfxent->flagbit)))
5273 + if (numhits < MAX_HITS)
5275 + hits[numhits].dictent = dent;
5276 + hits[numhits].prefix = pfxent;
5277 + hits[numhits].suffix = flent;
5282 +#ifndef NO_CAPITALIZATION_SUPPORT
5283 + if (cap_ok (word, &hits[0], len))
5286 +#else /* NO_CAPITALIZATION_SUPPORT */
5288 +#endif /* NO_CAPITALIZATION_SUPPORT */
5297 + * Expand a dictionary prefix entry
5301 + char * croot, /* Char version of rootword */
5302 + ichar_t * rootword, /* Root word to expand */
5303 + register MASKTYPE mask[], /* Mask bits to expand on */
5304 + int option, /* Option, see expandmode */
5305 + char * extra) /* Extra info to add to line */
5307 + int entcount; /* No. of entries to process */
5308 + int explength; /* Length of expansions */
5309 + register struct flagent *
5310 + flent; /* Current table entry */
5312 + for (flent = pflaglist, entcount = numpflags, explength = 0;
5313 + entcount > 0; flent++, entcount--)
5315 + if (TSTMASKBIT (mask, flent->flagbit))
5317 + pr_pre_expansion (croot, rootword, flent, mask, option, extra);
5322 +/* Print a prefix expansion */
5325 + char * croot, /* Char version of rootword */
5326 + register ichar_t * rootword, /* Root word to expand */
5327 + register struct flagent * flent, /* Current table entry */
5328 + MASKTYPE mask[], /* Mask bits to expand on */
5329 + int option, /* Option, see expandmode */
5330 + char * extra) /* Extra info to add to line */
5332 + int cond; /* Current condition number */
5333 + register ichar_t * nextc; /* Next case choice */
5334 + int tlen; /* Length of tword */
5335 + ichar_t tword[INPUTWORDLEN + MAXAFFIXLEN]; /* Temp */
5337 + tlen = icharlen (rootword);
5338 + if (flent->numconds > tlen)
5340 + tlen -= flent->stripl;
5343 + tlen += flent->affl;
5344 + for (cond = 0, nextc = rootword; cond < flent->numconds; cond++)
5346 + if ((flent->conds[mytoupper (*nextc++)] & (1 << cond)) == 0)
5350 + * The conditions are satisfied. Copy the word, add the prefix,
5351 + * and make it the proper case. This code is carefully written
5352 + * to match that ins_cap and cap_ok. Note that the affix, as
5353 + * inserted, is uppercase.
5355 + * There is a tricky bit here: if the root is capitalized, we
5356 + * want a capitalized result. If the root is followcase, however,
5357 + * we want to duplicate the case of the first remaining letter
5358 + * of the root. In other words, "Loved/U" should generate "Unloved",
5359 + * but "LOved/U" should generate "UNLOved" and "lOved/U" should
5360 + * produce "unlOved".
5364 + (void) icharcpy (tword, flent->affix);
5365 + nextc = tword + flent->affl;
5367 + (void) icharcpy (nextc, rootword + flent->stripl);
5368 + if (myupper (rootword[0]))
5370 + /* We must distinguish followcase from capitalized and all-upper */
5371 + for (nextc = rootword + 1; *nextc; nextc++)
5373 + if (!myupper (*nextc))
5378 + /* It's a followcase or capitalized word. Figure out which. */
5379 + for ( ; *nextc; nextc++)
5381 + if (myupper (*nextc))
5386 + /* It's followcase. */
5387 + if (!myupper (tword[flent->affl]))
5388 + forcelc (tword, flent->affl);
5392 + /* It's capitalized */
5393 + forcelc (tword + 1, tlen - 1);
5399 + /* Followcase or all-lower, we don't care which */
5400 + if (!myupper (*nextc))
5401 + forcelc (tword, flent->affl);
5404 + (void) printf ("\n%s", croot);
5406 + (void) printf (" %s%s", ichartosstr (tword, 1), extra);
5407 + if (flent->flagflags & FF_CROSSPRODUCT)
5409 + + expand_suf (croot, tword, mask, FF_CROSSPRODUCT, option, extra);
5415 + * Expand a dictionary suffix entry
5417 +int expand_suf (croot, rootword, mask, optflags, option, extra)
5418 + char * croot; /* Char version of rootword */
5419 + ichar_t * rootword; /* Root word to expand */
5420 + register MASKTYPE mask[]; /* Mask bits to expand on */
5421 + int optflags; /* Affix option flags */
5422 + int option; /* Option, see expandmode */
5423 + char * extra; /* Extra info to add to line */
5425 + int entcount; /* No. of entries to process */
5426 + int explength; /* Length of expansions */
5427 + register struct flagent *
5428 + flent; /* Current table entry */
5430 + for (flent = sflaglist, entcount = numsflags, explength = 0;
5432 + flent++, entcount--)
5434 + if (TSTMASKBIT (mask, flent->flagbit))
5436 + if ((optflags & FF_CROSSPRODUCT) == 0
5437 + || (flent->flagflags & FF_CROSSPRODUCT))
5439 + pr_suf_expansion (croot, rootword, flent, option, extra);
5445 +/* Print a suffix expansion */
5446 +static int pr_suf_expansion (croot, rootword, flent, option, extra)
5447 + char * croot; /* Char version of rootword */
5448 + register ichar_t * rootword; /* Root word to expand */
5449 + register struct flagent * flent; /* Current table entry */
5450 + int option; /* Option, see expandmode */
5451 + char * extra; /* Extra info to add to line */
5453 + int cond; /* Current condition number */
5454 + register ichar_t * nextc; /* Next case choice */
5455 + int tlen; /* Length of tword */
5456 + ichar_t tword[INPUTWORDLEN + MAXAFFIXLEN]; /* Temp */
5458 + tlen = icharlen (rootword);
5459 + cond = flent->numconds;
5462 + if (tlen - flent->stripl <= 0)
5464 + for (nextc = rootword + tlen; --cond >= 0; )
5466 + if ((flent->conds[mytoupper (*--nextc)] & (1 << cond)) == 0)
5470 + * The conditions are satisfied. Copy the word, add the suffix,
5471 + * and make it match the case of the last remaining character of the
5472 + * root. Again, this code carefully matches ins_cap and cap_ok.
5474 + (void) icharcpy (tword, rootword);
5475 + nextc = tword + tlen - flent->stripl;
5478 + (void) icharcpy (nextc, flent->affix);
5479 + if (!myupper (nextc[-1]))
5480 + forcelc (nextc, flent->affl);
5485 + (void) printf ("\n%s", croot);
5487 + (void) printf (" %s%s", ichartosstr (tword, 1), extra);
5488 + return tlen + flent->affl - flent->stripl;
5491 +static void forcelc (dst, len) /* Force to lowercase */
5492 + register ichar_t * dst; /* Destination to modify */
5493 + register int len; /* Length to copy */
5496 + for ( ; --len >= 0; dst++)
5497 + *dst = mytolower (*dst);
5499 diff -Nur vim60am.old/src/spell/tree.c vim60am/src/spell/tree.c
5500 --- vim60am.old/src/spell/tree.c Thu Jan 1 01:00:00 1970
5501 +++ vim60am/src/spell/tree.c Wed Jun 27 19:16:55 2001
5504 + * tree.c - a hash style dictionary for user's personal words
5506 + * Pace Willisson, 1983
5507 + * Hash support added by Geoff Kuenning, 1987
5509 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
5510 + * All rights reserved.
5512 + * Redistribution and use in source and binary forms, with or without
5513 + * modification, are permitted provided that the following conditions
5516 + * 1. Redistributions of source code must retain the above copyright
5517 + * notice, this list of conditions and the following disclaimer.
5518 + * 2. Redistributions in binary form must reproduce the above copyright
5519 + * notice, this list of conditions and the following disclaimer in the
5520 + * documentation and/or other materials provided with the distribution.
5521 + * 3. All modifications to the source code must be clearly marked as
5522 + * such. Binary redistributions based on modified source code
5523 + * must be clearly marked as modified versions in the documentation
5524 + * and/or other materials provided with the distribution.
5525 + * 4. All advertising materials mentioning features or use of this software
5526 + * must display the following acknowledgment:
5527 + * This product includes software developed by Geoff Kuenning and
5528 + * other unpaid contributors.
5529 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
5530 + * products derived from this software without specific prior
5531 + * written permission.
5533 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
5534 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5535 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5536 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
5537 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5538 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5539 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5540 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5541 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5542 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5548 + * Revision 1.56 1995/01/08 23:23:49 geoff
5549 + * Support PDICTHOME for DOS purposes.
5551 + * Revision 1.55 1994/10/25 05:46:27 geoff
5552 + * Fix a comment that looked to some compilers like it might be nested.
5554 + * Revision 1.54 1994/01/25 07:12:15 geoff
5555 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
5560 +#include <stdlib.h>
5562 +#include "ispell.h"
5565 +Local FILE * trydict (char * dictname, char * home,
5566 + char * prefix, char * suffix);
5567 +Local void treeload (FILE * dictf);
5568 +Local struct dent * tinsert (struct dent * proto);
5569 +#if SORTPERSONAL != 0
5570 +Local int pdictcmp (struct dent ** enta, struct dent **entb);
5571 +#endif /* SORTPERSONAL != 0 */
5572 +#ifdef REGEX_LOOKUP
5573 +#endif /* REGEX_LOOKUP */
5575 +Local int cantexpand = 0; /* NZ if an expansion fails */
5576 +Local struct dent * pershtab; /* Aux hash table for personal dict */
5577 +Local int pershsize = 0; /* Space available in aux hash table */
5578 +Local int hcount = 0; /* Number of items in hash table */
5581 + * Hash table sizes. Prime is probably a good idea, though in truth I
5582 + * whipped the algorithm up on the spot rather than looking it up, so
5583 + * who knows what's really best? If we overflow the table, we just
5584 + * use a double-and-add-1 algorithm.
5586 +static int goodsizes[] =
5588 + 53, 223, 907, 3631
5591 +Local char personaldict[MAXPATHLEN];
5592 +Local FILE * dictf;
5593 +Local newwords = 0;
5597 + char * p, /* Value specified in -p switch */
5598 + char * LibDict) /* Root of default dict name */
5600 + int abspath; /* NZ if p is abs path name */
5601 + char * h; /* Home directory name */
5602 + char seconddict[MAXPATHLEN]; /* Name of secondary dict */
5603 + FILE * secondf; /* Access to second dict file */
5606 + ** If -p was not specified, try to get a default name from the
5607 + ** environment. After this point, if p is null, the the value in
5608 + ** personaldict is the only possible name for the personal dictionary.
5609 + ** If p is non-null, then there is a possibility that we should
5610 + ** prepend HOME to get the correct dictionary name.
5613 + p = getenv (PDICTVAR);
5615 + ** if p exists and begins with '/' we don't really need HOME,
5616 + ** but it's not very likely that HOME isn't set anyway (on non-DOS
5623 + for(i = 0; i < pershsize; i++)
5626 + if(x->word != NULL)
5628 + for(x = x->next; x != NULL;)
5632 + if(x->word != NULL)
5639 + if(pershtab != NULL)
5645 + if ((h = getenv (HOME)) == NULL)
5649 +#else /* PDICTHOME */
5651 +#endif /* PDICTHOME */
5657 + * No -p and no PDICTVAR. We will use LibDict and DEFPAFF to
5658 + * figure out the name of the personal dictionary and where it
5659 + * is. The rules are as follows:
5661 + * (1) If there is a local dictionary and a HOME dictionary,
5662 + * both are loaded, but changes are saved in the local one.
5663 + * The dictionary to save changes in is named "personaldict".
5664 + * (2) Dictionaries named after the affix file take precedence
5665 + * over dictionaries with the default suffix (DEFPAFF).
5666 + * (3) Dictionaries named with the new default names
5667 + * (DEFPDICT/DEFPAFF) take precedence over the old ones
5668 + * (OLDPDICT/OLDPAFF).
5669 + * (4) Dictionaries aren't combined unless they follow the same
5671 + * (5) If no dictionary can be found, a new one is created in
5672 + * the home directory, named after DEFPDICT and the affix
5675 + dictf = trydict (personaldict, (char *) NULL, DEFPDICT, LibDict);
5676 + secondf = trydict (seconddict, h, DEFPDICT, LibDict);
5677 + if (dictf == NULL && secondf == NULL)
5679 + dictf = trydict (personaldict, (char *) NULL, DEFPDICT, DEFPAFF);
5680 + secondf = trydict (seconddict, h, DEFPDICT, DEFPAFF);
5682 + if (dictf == NULL && secondf == NULL)
5684 + dictf = trydict (personaldict, (char *) NULL, OLDPDICT, LibDict);
5685 + secondf = trydict (seconddict, h, OLDPDICT, LibDict);
5687 + if (dictf == NULL && secondf == NULL)
5689 + dictf = trydict (personaldict, (char *) NULL, OLDPDICT, OLDPAFF);
5690 + secondf = trydict (seconddict, h, OLDPDICT, OLDPAFF);
5692 + if (personaldict[0] == '\0')
5694 + if (seconddict[0] != '\0')
5695 + (void) strcpy (personaldict, seconddict);
5697 + (void) sprintf (personaldict, "%s/%s%s", h, DEFPDICT, LibDict);
5699 + if (dictf != NULL)
5702 + (void) fclose (dictf);
5704 + if (secondf != NULL)
5706 + treeload (secondf);
5707 + (void) fclose (secondf);
5713 + ** Figure out if p is an absolute path name. Note that beginning
5714 + ** with "./" and "../" is considered an absolute path, since this
5715 + ** still means we can't prepend HOME.
5717 + abspath = (*p == '/' || strncmp (p, "./", 2) == 0
5718 + || strncmp (p, "../", 3) == 0);
5721 + abspath = (*p == '\\' || strncmp (p, ".\\", 2) == 0
5722 + || strncmp (p, "..\\", 3) == 0
5723 + || (p[0] && p[1] == ':'));
5727 + (void) strcpy (personaldict, p);
5728 + if ((dictf = fopen (personaldict, "r")) != NULL)
5731 + (void) fclose (dictf);
5737 + ** The user gave us a relative pathname. We will try it
5738 + ** locally, and if that doesn't work, we'll try the home
5739 + ** directory. If neither exists, it will be created in
5740 + ** the home directory if words are added.
5742 + (void) strcpy (personaldict, p);
5743 + if ((dictf = fopen (personaldict, "r")) != NULL)
5746 + (void) fclose (dictf);
5748 + else if (!abspath)
5750 + /* Try the home */
5751 + (void) sprintf (personaldict, "%s/%s", h, p);
5752 + if ((dictf = fopen (personaldict, "r")) != NULL)
5755 + (void) fclose (dictf);
5759 + * If dictf is null, we couldn't open the dictionary
5760 + * specified in the -p switch. Complain.
5762 + if (dictf == NULL)
5764 + (void) fprintf (stderr, CANT_OPEN, p);
5771 +#ifndef FEAT_SPELL_HL
5772 + if (!lflag && !aflag
5773 + && access (personaldict, 2) < 0 && errno != ENOENT)
5775 + (void) fprintf (stderr, TREE_C_CANT_UPDATE, personaldict);
5776 + (void) sleep ((unsigned) 2);
5782 + * Try to open a dictionary. As a side effect, leaves the dictionary
5783 + * name in "filename" if one is found, and leaves a null string there
5788 + char * filename, /* Where to store the file name */
5789 + char * home, /* Home directory */
5790 + char * prefix, /* Prefix for dictionary */
5791 + char * suffix) /* Suffix for dictionary */
5793 + FILE * dictf; /* Access to dictionary file */
5796 + (void) sprintf (filename, "%s%s", prefix, suffix);
5798 + (void) sprintf (filename, "%s/%s%s", home, prefix, suffix);
5799 + dictf = fopen (filename, "r");
5800 + if (dictf == NULL)
5801 + filename[0] = '\0';
5807 + register FILE * loadfile) /* File to load words from */
5809 + char buf[BUFSIZ]; /* Buffer for reading pers dict */
5811 + while (fgets (buf, sizeof buf, loadfile) != NULL)
5812 + treeinsert (buf, sizeof(buf), 1);
5818 + char * word, /* Word to insert - must be canonical */
5819 + int wordlen, /* Length of the word buffer */
5822 + register int i, len;
5823 + struct dent wordent;
5824 + register struct dent * dp;
5825 + struct dent * olddp;
5826 +#ifndef NO_CAPITALIZATION_SUPPORT
5827 + struct dent * newdp;
5829 + struct dent * oldhtab;
5831 + ichar_t nword[INPUTWORDLEN + MAXAFFIXLEN];
5832 +#ifndef NO_CAPITALIZATION_SUPPORT
5836 + len = strlen(word);
5837 + if((word[len - 1] == '\n') || (word[len - 1] == '\r'))
5838 + word[len - 1] = '\0', len--;
5839 + if((word[len - 1] == '\n') || (word[len - 1] == '\r'))
5840 + word[len - 1] = '\0';
5842 + * Expand hash table when it is MAXPCT % full.
5844 + if (!cantexpand && (hcount * 100) / MAXPCT >= pershsize)
5846 + oldhsize = pershsize;
5847 + oldhtab = pershtab;
5848 + for (i = 0; i < sizeof goodsizes / sizeof (goodsizes[0]); i++)
5849 + if (goodsizes[i] > pershsize)
5851 + if (i >= sizeof goodsizes / sizeof goodsizes[0])
5852 + pershsize += pershsize + 1;
5854 + pershsize = goodsizes[i];
5856 + (struct dent *) calloc ((unsigned) pershsize, sizeof (struct dent));
5857 + if (pershtab == NULL)
5859 + (void) fprintf (stderr, TREE_C_NO_SPACE);
5861 + * Try to continue anyway, since our overflow
5862 + * algorithm can handle an overfull (100%+) table,
5863 + * and the malloc very likely failed because we
5864 + * already have such a huge table, so small mallocs
5865 + * for overflow entries will still work.
5867 + if (oldhtab == NULL)
5868 + exit (1); /* No old table, can't go on */
5869 + (void) fprintf (stderr, TREE_C_TRY_ANYWAY);
5870 + cantexpand = 1; /* Suppress further messages */
5871 + pershsize = oldhsize; /* Put things back */
5872 + pershtab = oldhtab; /* ... */
5873 + newwords = 1; /* And pretend it worked */
5878 + * Re-insert old entries into new table
5880 + for (i = 0; i < oldhsize; i++)
5883 + if (dp->flagfield & USED)
5885 +#ifdef NO_CAPITALIZATION_SUPPORT
5886 + (void) tinsert (dp);
5888 + newdp = tinsert (dp);
5889 + isvariant = (dp->flagfield & MOREVARIANTS);
5892 +#ifdef NO_CAPITALIZATION_SUPPORT
5893 + while (dp != NULL)
5895 + (void) tinsert (dp);
5898 + free ((char *) olddp);
5901 + while (dp != NULL)
5905 + isvariant = dp->flagfield & MOREVARIANTS;
5906 + olddp = newdp->next;
5910 + newdp->next = olddp;
5914 + isvariant = dp->flagfield & MOREVARIANTS;
5915 + newdp = tinsert (dp);
5918 + free ((char *) olddp);
5924 + if (oldhtab != NULL)
5925 + free ((char *) oldhtab);
5930 + ** We're ready to do the insertion. Start by creating a sample
5931 + ** entry for the word.
5933 + if (makedent (word, wordlen, &wordent) < 0)
5934 + return; /* Word must be too big or something */
5936 + wordent.flagfield |= KEEP;
5938 + ** Now see if word or a variant is already in the table. We use the
5939 + ** capitalized version so we'll find the header, if any.
5941 + (void) strtoichar (nword, word, sizeof nword, 1);
5943 + if ((dp = lookup (nword, 1)) != NULL)
5945 + /* It exists. Combine caps and set the keep flag. */
5946 + if (combinecaps (dp, &wordent) < 0)
5948 + free (wordent.word);
5954 + /* It's new. Insert the word. */
5955 + dp = tinsert (&wordent);
5956 +#ifndef NO_CAPITALIZATION_SUPPORT
5957 + if (captype (dp->flagfield) == FOLLOWCASE)
5958 + (void) addvheader (dp);
5965 +Local struct dent *
5967 + struct dent * proto) /* Prototype entry to copy */
5969 + ichar_t iword[INPUTWORDLEN + MAXAFFIXLEN];
5970 + register int hcode;
5971 + register struct dent * hp; /* Next trial entry in hash table */
5972 + register struct dent * php; /* Prev. value of hp, for chaining */
5974 + if (strtoichar (iword, proto->word, sizeof iword, 1))
5975 + (void) fprintf (stderr, WORD_TOO_LONG (proto->word));
5976 +#ifdef NO_CAPITALIZATION_SUPPORT
5979 + hcode = hash (iword, pershsize);
5981 + hp = &pershtab[hcode];
5982 + if (hp->flagfield & USED)
5984 + while (hp != NULL)
5989 + hp = (struct dent *) calloc (1, sizeof (struct dent));
5992 + (void) fprintf (stderr, TREE_C_NO_SPACE);
6003 +Public struct dent *
6004 +treelookup (register ichar_t * word)
6007 + register int hcode;
6008 + register struct dent * hp;
6009 + char chword[INPUTWORDLEN + MAXAFFIXLEN];
6011 + if (pershsize <= 0)
6013 + (void) ichartostr (chword, word, sizeof chword, 1);
6014 + hcode = hash (word, pershsize);
6015 + hp = &pershtab[hcode];
6016 + while (hp != NULL && (hp->flagfield & USED))
6018 + if (strcmp (chword, hp->word) == 0)
6020 +#ifndef NO_CAPITALIZATION_SUPPORT
6021 + while (hp->flagfield & MOREVARIANTS)
6026 + if (hp != NULL && (hp->flagfield & USED))
6032 +#if SORTPERSONAL != 0
6033 +/* Comparison routine for sorting the personal dictionary with qsort */
6036 + struct dent ** enta,
6037 + struct dent ** entb)
6040 + /* The parentheses around *enta and *entb below are NECESSARY!
6041 + ** Otherwise the compiler reads it as *(enta->word), or
6042 + ** enta->word[0], which is illegal (but pcc takes it and
6043 + ** produces wrong code).
6045 + return casecmp ((*enta)->word, (*entb)->word, 1);
6053 + register struct dent * cent; /* Current entry */
6054 + register struct dent * lent; /* Linked entry */
6055 +#if SORTPERSONAL != 0
6056 + int pdictsize; /* Number of entries to write */
6057 + struct dent ** sortlist; /* List of entries to be sorted */
6058 + register struct dent ** sortptr; /* Handy pointer into sortlist */
6060 + register struct dent * ehtab; /* End of pershtab, for fast looping */
6062 + if (newwords == 0)
6065 + if ((dictf = fopen (personaldict, "w")) == NULL)
6067 + (void) fprintf (stderr, CANT_CREATE, personaldict);
6071 +#if SORTPERSONAL != 0
6073 + ** If we are going to sort the personal dictionary, we must know
6074 + ** how many items are going to be sorted.
6077 + if (hcount >= SORTPERSONAL)
6081 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab;
6084 + for (lent = cent; lent != NULL; lent = lent->next)
6086 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6088 +#ifndef NO_CAPITALIZATION_SUPPORT
6089 + while (lent->flagfield & MOREVARIANTS)
6090 + lent = lent->next;
6094 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6096 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6099 + ** We only want to count variant headers
6100 + ** and standalone entries. These happen
6101 + ** to share the characteristics in the
6102 + ** test below. This test will appear
6103 + ** several more times in this routine.
6105 +#ifndef NO_CAPITALIZATION_SUPPORT
6106 + if (captype (cent->flagfield) != FOLLOWCASE
6107 + && cent->word != NULL)
6112 + sortlist = (struct dent **) malloc (pdictsize * sizeof (struct dent));
6114 + if (sortlist == NULL)
6117 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab;
6120 + for (lent = cent; lent != NULL; lent = lent->next)
6122 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6124 + toutent (dictf, lent, 1);
6125 +#ifndef NO_CAPITALIZATION_SUPPORT
6126 + while (lent->flagfield & MOREVARIANTS)
6127 + lent = lent->next;
6132 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6134 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6136 +#ifndef NO_CAPITALIZATION_SUPPORT
6137 + if (captype (cent->flagfield) != FOLLOWCASE
6138 + && cent->word != NULL)
6140 + toutent (dictf, cent, 1);
6143 +#if SORTPERSONAL != 0
6147 + ** Produce dictionary in sorted order. We used to do this
6148 + ** destructively, but that turns out to fail because in some modes
6149 + ** the dictionary is written more than once. So we build an
6150 + ** auxiliary pointer table (in sortlist) and sort that. This
6151 + ** is faster anyway, though it uses more memory.
6153 + sortptr = sortlist;
6154 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab; cent++)
6156 + for (lent = cent; lent != NULL; lent = lent->next)
6158 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6160 + *sortptr++ = lent;
6161 +#ifndef NO_CAPITALIZATION_SUPPORT
6162 + while (lent->flagfield & MOREVARIANTS)
6163 + lent = lent->next;
6168 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6170 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6172 +#ifndef NO_CAPITALIZATION_SUPPORT
6173 + if (captype (cent->flagfield) != FOLLOWCASE
6174 + && cent->word != NULL)
6176 + *sortptr++ = cent;
6179 + /* Sort the list */
6180 + qsort ((char *) sortlist, (unsigned) pdictsize,
6181 + sizeof (sortlist[0]),
6182 + (int (*) (const void *, const void *)) pdictcmp);
6183 + /* Write it out */
6184 + for (sortptr = sortlist; --pdictsize >= 0; )
6185 + toutent (dictf, *sortptr++, 1);
6186 + free ((char *) sortlist);
6191 + (void) fclose (dictf);
6194 +#ifdef REGEX_LOOKUP
6196 +/* check the hashed dictionary for words matching the regex. return the */
6197 +/* a matching string if found else return NULL */
6200 + char * expr, /* regular expression to use in the match */
6201 + int whence) /* 0 = start at the beg with new regx, else */
6202 + /* continue from cur point w/ old regex */
6204 + static struct dent * curent;
6205 + static int curindex;
6206 + static struct dent * curpersent;
6207 + static int curpersindex;
6208 + static REGCTYPE cmp_expr = (REGCTYPE)0;
6209 + char dummy[INPUTWORDLEN + MAXAFFIXLEN];
6214 + is = strtosichar (expr, 0);
6216 + expr = ichartosstr (is, 1);
6217 + REGFREE (cmp_expr); /* free previous compiled pattern, if any */
6218 + cmp_expr = REGCMP (cmp_expr, expr);
6221 + curpersent = pershtab;
6225 + /* search the dictionary until the word is found or the words run out */
6226 + for ( ; curindex < hashsize; curent++, curindex++)
6228 + if (curent->word != NULL
6229 + && REGEX (cmp_expr, curent->word, dummy) != NULL)
6232 + /* Everybody's gotta write a wierd expression once in a while! */
6233 + return curent++->word;
6236 + /* Try the personal dictionary too */
6237 + for ( ; curpersindex < pershsize; curpersent++, curpersindex++)
6239 + if ((curpersent->flagfield & USED) != 0
6240 + && curpersent->word != NULL
6241 + && REGEX (cmp_expr, curpersent->word, dummy) != NULL)
6244 + /* Everybody's gotta write a wierd expression once in a while! */
6245 + return curpersent++->word;
6250 +#endif /* REGEX_LOOKUP */
6251 diff -Nur vim60am.old/src/spell/util.c vim60am/src/spell/util.c
6252 --- vim60am.old/src/spell/util.c Thu Jan 1 01:00:00 1970
6253 +++ vim60am/src/spell/util.c Wed Jun 27 19:16:55 2001
6256 +#include "ispell.h"
6258 +Local char *myrindex(char *s, char c);
6264 + int canonical) /* NZ for canonical string chars */
6266 + register ichar_t * ap;
6267 + register ichar_t * bp;
6268 + ichar_t inta[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6269 + ichar_t intb[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6271 + (void) strtoichar (inta, a, sizeof inta, canonical);
6272 + (void) strtoichar (intb, b, sizeof intb, canonical);
6273 + for (ap = inta, bp = intb; *ap != 0; ap++, bp++)
6278 + return hashheader.sortorder[*ap];
6279 + else if (mylower (*ap))
6281 + if (mylower (*bp) || mytoupper (*ap) != *bp)
6282 + return (int) hashheader.sortorder[*ap] -
6283 + (int) hashheader.sortorder[*bp];
6287 + if (myupper (*bp) || mytolower (*ap) != *bp)
6288 + return (int) hashheader.sortorder[*ap] -
6289 + (int) hashheader.sortorder[*bp];
6294 + return -(int) hashheader.sortorder[*bp];
6295 + for (ap = inta, bp = intb; *ap; ap++, bp++)
6299 + return (int) hashheader.sortorder[*ap] -
6300 + (int) hashheader.sortorder[*bp];
6308 + register ichar_t * word,
6309 + register ichar_t * pattern,
6314 + struct dent * firstdent,
6315 + struct flagent * pfxent,
6316 + struct flagent * sufent)
6318 + int i; /* Index into savearea */
6319 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN];
6320 + int nsaved; /* Number of words saved */
6323 + save_root_cap (word, pattern, prestrip, preadd, sufstrip, sufadd,
6324 + firstdent, pfxent, sufent, savearea, &nsaved);
6325 + for (i = 0; i < nsaved; i++)
6327 + if (insert (savearea[i]) < 0)
6335 + register ichar_t * word, /* Word to be saved */
6336 + register ichar_t * pattern, /* Capitalization pattern */
6337 + int prestrip, /* No. chars stripped from front */
6338 + int preadd, /* No. chars added to front of root */
6339 + int sufstrip, /* No. chars stripped from back */
6340 + int sufadd, /* No. chars added to back of root */
6341 + struct dent * firstdent, /* First dent for root */
6342 + struct flagent * pfxent, /* Pfx-flag entry for word */
6343 + struct flagent * sufent, /* Sfx-flag entry for word */
6344 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
6345 + /* Room to save words */
6346 + int * nsaved) /* Number saved so far (updated) */
6348 +#ifndef NO_CAPITALIZATION_SUPPORT
6349 + register struct dent * dent;
6350 +#endif /* NO_CAPITALIZATION_SUPPORT */
6352 + ichar_t newword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6353 +#ifndef NO_CAPITALIZATION_SUPPORT
6354 + register ichar_t * p;
6358 +#endif /* NO_CAPITALIZATION_SUPPORT */
6360 + if (*nsaved >= MAX_CAPS)
6362 + (void) icharcpy (newword, word);
6363 + firstisupper = myupper (pattern[0]);
6364 +#ifdef NO_CAPITALIZATION_SUPPORT
6366 + ** Apply the old, simple-minded capitalization rules.
6370 + if (myupper (pattern[1]))
6374 + lowcase (newword);
6375 + newword[0] = mytoupper (newword[0]);
6379 + lowcase (newword);
6380 + (void) icharcpy (savearea[*nsaved], newword);
6383 +#else /* NO_CAPITALIZATION_SUPPORT */
6384 +#define flagsareok(dent) \
6385 + ((pfxent == NULL \
6386 + || TSTMASKBIT (dent->mask, pfxent->flagbit)) \
6387 + && (sufent == NULL \
6388 + || TSTMASKBIT (dent->mask, sufent->flagbit)))
6391 + if ((dent->flagfield & (CAPTYPEMASK | MOREVARIANTS)) == ALLCAPS)
6393 + upcase (newword); /* Uppercase required */
6394 + (void) icharcpy (savearea[*nsaved], newword);
6398 + for (p = pattern; *p; p++)
6405 + upcase (newword); /* Pattern was all caps */
6406 + (void) icharcpy (savearea[*nsaved], newword);
6410 + for (p = pattern + 1; *p; p++)
6418 + ** The pattern was all-lower or capitalized. If that's
6419 + ** legal, insert only that version.
6423 + if (captype (dent->flagfield) == CAPITALIZED
6424 + || captype (dent->flagfield) == ANYCASE)
6426 + lowcase (newword);
6427 + newword[0] = mytoupper (newword[0]);
6428 + (void) icharcpy (savearea[*nsaved], newword);
6435 + if (captype (dent->flagfield) == ANYCASE)
6437 + lowcase (newword);
6438 + (void) icharcpy (savearea[*nsaved], newword);
6443 + while (dent->flagfield & MOREVARIANTS)
6445 + dent = dent->next;
6446 + if (captype (dent->flagfield) == FOLLOWCASE
6447 + || !flagsareok (dent))
6451 + if (captype (dent->flagfield) == CAPITALIZED)
6453 + lowcase (newword);
6454 + newword[0] = mytoupper (newword[0]);
6455 + (void) icharcpy (savearea[*nsaved], newword);
6462 + if (captype (dent->flagfield) == ANYCASE)
6464 + lowcase (newword);
6465 + (void) icharcpy (savearea[*nsaved], newword);
6473 + ** Either the sample had complex capitalization, or the simple
6474 + ** capitalizations (all-lower or capitalized) are illegal.
6475 + ** Insert all legal capitalizations, including those that are
6476 + ** all-lower or capitalized. If the prototype is capitalized,
6477 + ** capitalized all-lower samples. Watch out for affixes.
6480 + p = strtosichar (dent->word, 1);
6481 + len = icharlen (p);
6482 + if (dent->flagfield & MOREVARIANTS)
6483 + dent = dent->next; /* Skip place-holder entry */
6486 + if (flagsareok (dent))
6488 + if (captype (dent->flagfield) != FOLLOWCASE)
6490 + lowcase (newword);
6491 + if (firstisupper || captype (dent->flagfield) == CAPITALIZED)
6492 + newword[0] = mytoupper (newword[0]);
6493 + (void) icharcpy (savearea[*nsaved], newword);
6495 + if (*nsaved >= MAX_CAPS)
6500 + /* Followcase is the tough one. */
6501 + p = strtosichar (dent->word, 1);
6502 + (void) bcopy ((char *) (p + prestrip),
6503 + (char *) (newword + preadd),
6504 + (len - prestrip - sufstrip) * sizeof (ichar_t));
6505 + if (myupper (p[prestrip]))
6507 + for (i = 0; i < preadd; i++)
6508 + newword[i] = mytoupper (newword[i]);
6512 + for (i = 0; i < preadd; i++)
6513 + newword[i] = mytolower (newword[i]);
6515 + limit = len + preadd + sufadd - prestrip - sufstrip;
6516 + i = len + preadd - prestrip - sufstrip;
6517 + p += len - sufstrip - 1;
6520 + for (p = newword + i; i < limit; i++, p++)
6521 + *p = mytoupper (*p);
6525 + for (p = newword + i; i < limit; i++, p++)
6526 + *p = mytolower (*p);
6528 + (void) icharcpy (savearea[*nsaved], newword);
6530 + if (*nsaved >= MAX_CAPS)
6534 + if ((dent->flagfield & MOREVARIANTS) == 0)
6535 + break; /* End of the line */
6536 + dent = dent->next;
6539 +#endif /* NO_CAPITALIZATION_SUPPORT */
6542 +insert(register ichar_t * word)
6545 + register char * realword;
6547 + realword = ichartosstr (word, 0);
6548 + for (i = 0; i < pcount; i++)
6549 + if (strcmp (possibilities[i], realword) == 0)
6552 + (void) strcpy (possibilities[pcount++], realword);
6553 + i = strlen (realword);
6554 + if (i > maxposslen)
6556 + if (pcount >= MAXPOSSIBLE)
6562 +** A trivial wrapper for rindex (file '/') on Unix, but
6563 +** saves a lot of ifdef-ing on MS-DOS.
6567 +last_slash (char *file)
6570 + char *slash = myrindex (file, '/');
6573 + ** Can have a backslash or a colon; both mean the basename
6574 + ** begins right after them.
6576 + char *bs = myrindex (file, '\\');
6579 + ** We can have both forward- and backslashes; return the
6580 + ** place of rightmost one of either gender.
6582 + if (slash == NULL || (bs != NULL && bs > slash))
6584 + if (slash == NULL && file[0] != '\0' && file[1] == ':')
6591 +myrindex(char *s, register char c)
6596 + x = s + strlen(s) - 1;
6606 diff -Nur vim60am.old/src/spell/version.h vim60am/src/spell/version.h
6607 --- vim60am.old/src/spell/version.h Thu Jan 1 01:00:00 1970
6608 +++ vim60am/src/spell/version.h Wed Jun 27 19:16:55 2001
6611 + * Since the strings in this file are printed out when the "-v" switch is
6612 + * given to ispell, you may want to translate them into your native language.
6613 + * However, any translation of these strings MUST accurately preserve the
6614 + * legal rights under international law; you may wish to consult a lawyer
6615 + * about this since you will be responsible for the results of any
6616 + * incorrect translation.
6619 +Local char *Version_ID[] = {
6620 + "@(#) International Ispell Version 3.1.20 10/10/95",
6621 + "@(#) Copyright (c), 1983, by Pace Willisson",
6622 + "@(#) International version Copyright (c) 1987, 1988, 1990-1995,",
6623 + "@(#) by Geoff Kuenning, Granada Hills, CA. All rights reserved.",
6625 + "@(#) Redistribution and use in source and binary forms, with or without",
6626 + "@(#) modification, are permitted provided that the following conditions",
6629 + "@(#) 1. Redistributions of source code must retain the above copyright",
6630 + "@(#) notice, this list of conditions and the following disclaimer.",
6631 + "@(#) 2. Redistributions in binary form must reproduce the above",
6632 + "@(#) copyright notice, this list of conditions and the following",
6633 + "@(#) disclaimer in the documentation and/or other materials provided",
6634 + "@(#) with the distribution.",
6635 + "@(#) 3. All modifications to the source code must be clearly marked as",
6636 + "@(#) such. Binary redistributions based on modified source code",
6637 + "@(#) must be clearly marked as modified versions in the documentation",
6638 + "@(#) and/or other materials provided with the distribution.",
6639 + "@(#) 4. All advertising materials mentioning features or use of this",
6640 + "@(#) software must display the following acknowledgment:",
6641 + "@(#) This product includes software developed by Geoff Kuenning and",
6642 + "@(#) other unpaid contributors.",
6643 + "@(#) 5. The name of Geoff Kuenning may not be used to endorse or promote",
6644 + "@(#) products derived from this software without specific prior",
6645 + "@(#) written permission.",
6647 + "@(#) THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS",
6648 + "@(#) IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT",
6649 + "@(#) LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS",
6650 + "@(#) FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEOFF",
6651 + "@(#) KUENNING OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,",
6652 + "@(#) INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES",
6653 + "@(#) (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR",
6654 + "@(#) SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)",
6655 + "@(#) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,",
6656 + "@(#) STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)",
6657 + "@(#) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED",
6658 + "@(#) OF THE POSSIBILITY OF SUCH DAMAGE.",
6662 +static char RCS_Version_ID[] =
6667 + * Revision 1.44 1995/10/11 05:03:28 geoff
6668 + * Upgrade to patch level 20
6670 + * Revision 1.43 1995/10/11 04:58:26 geoff
6671 + * Upgrade to patch 19
6673 + * Revision 1.42 1995/01/15 01:23:26 geoff
6674 + * Upgrade to patch level 18
6676 + * Revision 1.41 1995/01/15 01:14:30 geoff
6677 + * Upgrade to patch level 17
6679 + * Revision 1.40 1995/01/15 01:03:55 geoff
6680 + * Upgrade to patch level 16
6682 + * Revision 1.39 1995/01/15 01:01:01 geoff
6683 + * Upgrade to patch level 15
6685 + * Revision 1.38 1995/01/15 00:54:19 geoff
6686 + * Upgrade to patch level 14
6688 + * Revision 1.37 1994/11/21 07:03:01 geoff
6689 + * Update to patch level 13.
6691 + * Revision 1.36 1994/11/01 06:28:31 geoff
6692 + * Update to patch level 12
6694 + * Revision 1.35 1994/11/01 06:12:42 geoff
6695 + * Update to patch level 11
6697 + * Revision 1.34 1994/11/01 06:01:15 geoff
6698 + * Update to patch level 10
6700 + * Revision 1.33 1994/11/01 05:36:43 geoff
6701 + * Update to patch level 9
6703 + * Revision 1.32 1994/05/25 04:38:59 geoff
6704 + * Update to patch level 8
6706 + * Revision 1.31 1994/05/18 03:07:26 geoff
6707 + * Update to patch level 7
6709 + * Revision 1.30 1994/05/17 06:21:05 geoff
6710 + * Version update for ispell.el release
6712 + * Revision 1.29 1994/04/27 04:14:18 geoff
6713 + * Update to patch level 5
6715 + * Revision 1.28 1994/03/21 02:00:50 geoff
6716 + * Update to patch level 4
6718 + * Revision 1.27 1994/02/23 04:52:31 geoff
6719 + * Update to latest version.
6721 + * Revision 1.26 1994/02/08 05:59:20 geoff
6724 + * Revision 1.25 1994/02/07 08:58:28 geoff
6725 + * Get rid of a comma that confuses patch
6727 + * Revision 1.24 1994/02/07 08:24:23 geoff
6728 + * Upate patch level
6730 + * Revision 1.23 1994/01/25 07:12:21 geoff
6731 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
6734 diff -Nur vim60am.old/src/spell/wm.h vim60am/src/spell/wm.h
6735 --- vim60am.old/src/spell/wm.h Thu Jan 1 01:00:00 1970
6736 +++ vim60am/src/spell/wm.h Wed Jun 27 19:16:55 2001
6739 +enum _logical {False,True};
6740 +typedef enum _logical Logical;
6744 +typedef unsigned int Word;
6745 +typedef unsigned char Byte;
6748 +#define Local static
6750 diff -Nur vim60am.old/src/spell.c vim60am/src/spell.c
6751 --- vim60am.old/src/spell.c Thu Jan 1 01:00:00 1970
6752 +++ vim60am/src/spell.c Tue Jul 3 13:44:50 2001
6754 +#include "spell/wm.h"
6757 +#include "ispell.h"
6758 +#define MAXWORDLEN 80
6760 +#ifdef FEAT_SPELL_HL
6762 +int spell_flag = 0;
6765 +ex_spell(exarg_T *eap)
6768 + if(strcmp(eap->arg, "on") == 0)
6773 + if(!reload_dict())
6777 + else if(STRCMP(eap->arg, "off") == 0)
6780 + EMSG2("Invalid :spell %s", eap->arg);
6781 + redraw_all_later(NOT_VALID);
6789 + if(spell_flag == 0)
6791 + spell_save_private_dict();
6793 + if(STRCMP(p_spell_lang, "") == 0)
6795 + EMSG("dictionary not defined");
6796 + do_cmdline((char_u *)"spell off", NULL, NULL, DOCMD_VERBOSE);
6800 + if ((err = linit(hashname)) != NULL)
6803 + do_cmdline((char_u *)"spell off", NULL, NULL, DOCMD_VERBOSE);
6807 + treeinit (NULL, p_spell_lang);
6811 +static colnr_T last_col;
6812 +static ichar_t curr_word[MAXWORDLEN + 1]; /* assume max. keyword len is 80 */
6813 +static char word_to_spell[MAXWORDLEN + 1];
6815 +static Logical in_word;
6817 +int my_is_char(char_u ccc);
6820 +get_spell_attr(spell_col, col, line)
6821 + colnr_T spell_col;
6829 + if(spell_col == 0)
6830 + last_col = 0, in_word = False, last_attr = 0;
6832 + if((spell_col < last_col) && in_word)
6833 + return(last_attr);
6834 + else if(spell_col >= last_col)
6838 + line_ptr = &line[spell_col];
6839 + curr_col = spell_col;
6840 + if(iswordch((ichar_t)(*line_ptr)) && *line_ptr)
6842 + while((spell_col > 0) && my_is_char(*(line_ptr - 1)))
6843 + spell_col--, line_ptr--;
6844 + while(isboundarych((ichar_t)(*(line_ptr))))
6845 + spell_col++, line_ptr++;
6847 + line_ptr = &line[spell_col];
6848 + curr_col = spell_col;
6849 + while(my_is_char(*line_ptr) && *line_ptr &&
6850 + ((curr_col - spell_col) < MAXWORDLEN))
6851 + curr_col++, line_ptr++;
6852 + while(isboundarych((ichar_t)(*(line_ptr - 1))))
6853 + curr_col--, line_ptr--;
6855 + if(curr_col - spell_col > 1)
6857 + /*for(i = 0; i < curr_col - spell_col; i++)
6858 + curr_word[i] = line[spell_col + i];
6859 + curr_word[curr_col - spell_col] = NUL;*/
6860 + strtoichar(curr_word,line+spell_col,(curr_col-spell_col+1)*sizeof(ichar_t),0);
6863 +/* for(i = 0; curr_word[i]; i++)
6864 + fprintf(stderr, "%c", curr_word[i]);
6865 + fprintf(stderr, "-%d\n", good((ichar_t *)curr_word, 0, 0, 0, 0)); wm */
6866 + if(good((ichar_t *)curr_word, 0, 0, 0, 0) == 0)
6867 + last_attr = hl_attr(HLF_SPELL);
6868 + last_col = curr_col;
6871 + return(last_attr);
6878 + if(iswordch((ichar_t)ccc) || isboundarych((ichar_t)ccc))
6885 +static ichar_t *itok;
6888 +set_to_private_dict(char *line, int cursor_col, int convert_to_lower)
6895 + b = line + cursor_col;
6899 + if(iswordch((ichar_t)(*b)) || isboundarych((ichar_t)(*b)))
6901 + while((iswordch((ichar_t)(*(b - 1))) ||
6902 + isboundarych((ichar_t)(*(b - 1)))) &&
6904 + b--, cursor_col--;
6905 + while(isboundarych((ichar_t)(*b)))
6907 + while((iswordch((ichar_t)(*(e))) || isboundarych((ichar_t)(*(e)))) &&
6910 + while(isboundarych((ichar_t)(*(e - 1))))
6912 + for(i = 0; b < e;)
6913 + word_to_spell[i++] = *b++;
6914 + word_to_spell[i] = '\0';
6915 + if(!convert_to_lower)
6916 + treeinsert (ichartosstr (strtosichar (word_to_spell, 0), 1),
6917 + ICHARTOSSTR_SIZE, 1);
6920 + itok = strtosichar (word_to_spell, 0);
6922 + treeinsert (ichartosstr (itok, 1), ICHARTOSSTR_SIZE, 1);
6924 + redraw_all_later(NOT_VALID);
6930 +spell_save_private_dict(void)
6937 diff -Nur vim60am.old/src/syntax.c vim60am/src/syntax.c
6938 --- vim60am.old/src/syntax.c Wed Jul 4 20:42:09 2001
6939 +++ vim60am/src/syntax.c Tue Jul 3 18:34:18 2001
6940 @@ -5771,6 +5771,9 @@
6941 "VertSplit term=reverse cterm=reverse gui=reverse",
6942 "Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg",
6943 "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold",
6944 +#ifdef FEAT_SPELL_HL
6945 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6947 "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red",
6950 @@ -5790,6 +5793,9 @@
6951 "Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue",
6952 "FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue",
6953 "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue",
6954 +#ifdef FEAT_SPELL_HL
6955 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6957 "DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta",
6958 "DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan",
6960 @@ -5810,6 +5816,9 @@
6961 "Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan",
6962 "FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan",
6963 "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue",
6964 +#ifdef FEAT_SPELL_HL
6965 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6967 "DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta",
6968 "DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan",
6970 diff -Nur vim60am.old/src/version.c vim60am/src/version.c
6971 --- vim60am.old/src/version.c Wed Jul 4 20:42:09 2001
6972 +++ vim60am/src/version.c Tue Jul 3 18:33:34 2001
6973 @@ -416,6 +416,11 @@
6977 +#ifdef FEAT_SPELL_HL
6982 /* only interesting on Unix systems */
6983 #if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
6994 diff -Nur vim60am.old/src/version.h vim60am/src/version.h
6995 --- vim60am.old/src/version.h Wed Jul 4 20:42:09 2001
6996 +++ vim60am/src/version.h Tue Jul 3 19:04:36 2001
6999 #define VIM_VERSION_NODOT "vim60"
7000 #define VIM_VERSION_SHORT "6.0"
7001 +#ifdef FEAT_SPELL_HL
7002 +#define VIM_VERSION_MEDIUM "6.0 + ispell 3.1.20 WM-3"
7004 #define VIM_VERSION_MEDIUM "6.0"
7006 #define VIM_VERSION_LONG "VIM - Vi IMproved 6.0 (2001 Sep 26)"
7007 #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 6.0 (2001 Sep 26, compiled "
7008 diff -Nur vim60am.old/src/vim.h vim60am/src/vim.h
7009 --- vim60am.old/src/vim.h Wed Jul 4 20:42:09 2001
7010 +++ vim60am/src/vim.h Tue Jul 3 18:21:26 2001
7011 @@ -980,13 +980,14 @@
7012 , HLF_CHD /* Changed diff line */
7013 , HLF_DED /* Deleted diff line */
7014 , HLF_TXD /* Text Changed in diff line */
7015 + , HLF_SPELL /* spell - string not in dictionary WM */
7016 , HLF_COUNT /* MUST be the last one */
7019 /* the HL_FLAGS must be in the same order as the HLF_ enums! */
7020 #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
7021 'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
7022 - 'f', 'F', 'A', 'C', 'D', 'T'}
7023 + 'f', 'F', 'A', 'C', 'D', 'T', 'Z'}