1 diff -Nur vim61.orig/src/Makefile vim61/src/Makefile
2 --- vim61.orig/src/Makefile Sun Mar 24 11:41:30 2002
3 +++ vim61/src/Makefile Wed Mar 27 15:08:07 2002
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) $(PROFILE_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 @@ -2403,3 +2427,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 vim61.orig/src/edit.c vim61/src/edit.c
100 --- vim61.orig/src/edit.c Sun Mar 24 12:09:53 2002
101 +++ vim61/src/edit.c Wed Mar 27 15:08:07 2002
103 if ((c == Ctrl_V || c == Ctrl_Q) && 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 @@ -1146,6 +1150,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 vim61.orig/src/ex_cmds.h vim61/src/ex_cmds.h
137 --- vim61.orig/src/ex_cmds.h Sat Dec 15 18:24:11 2001
138 +++ vim61/src/ex_cmds.h Wed Mar 27 15:08:07 2002
140 BANG|FILE1|TRLBAR|SBOXOK|CMDWIN),
141 EX(CMD_split, "split", ex_splitview,
142 BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
143 +EX(CMD_spell, "spell", ex_spell,
144 + EXTRA|NOTRLCOM|CMDWIN),
145 EX(CMD_sprevious, "sprevious", ex_previous,
146 EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR),
147 EX(CMD_srewind, "srewind", ex_rewind,
148 diff -Nur vim61.orig/src/ex_docmd.c vim61/src/ex_docmd.c
149 --- vim61.orig/src/ex_docmd.c Fri Mar 22 20:30:29 2002
150 +++ vim61/src/ex_docmd.c Wed Mar 27 15:08:08 2002
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 @@ -2722,6 +2725,12 @@
162 set_context_in_syntax_cmd(xp, arg);
165 +#ifdef FEAT_SPELL_HL
174 diff -Nur vim61.orig/src/feature.h vim61/src/feature.h
175 --- vim61.orig/src/feature.h Sat Mar 9 16:17:30 2002
176 +++ vim61/src/feature.h Wed Mar 27 15:08:08 2002
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 vim61.orig/src/globals.h vim61/src/globals.h
191 --- vim61.orig/src/globals.h Sun Mar 17 14:10:52 2002
192 +++ vim61/src/globals.h Wed Mar 27 15:08:08 2002
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 vim61.orig/src/main.c vim61/src/main.c
204 --- vim61.orig/src/main.c Sun Mar 24 12:05:17 2002
205 +++ vim61/src/main.c Wed Mar 27 15:08:08 2002
206 @@ -2068,6 +2068,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 vim61.orig/src/normal.c vim61/src/normal.c
217 --- vim61.orig/src/normal.c Sun Mar 24 12:36:35 2002
218 +++ vim61/src/normal.c Wed Mar 27 15:08:08 2002
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_right __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 @@ -7399,6 +7411,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 vim61.orig/src/option.c vim61/src/option.c
278 --- vim61.orig/src/option.c Sat Mar 9 16:17:30 2002
279 +++ vim61/src/option.c Wed Mar 27 15:08:08 2002
291 static char_u *p_syn;
293 +#ifdef FEAT_SPELL_HL
294 +static char_u *p_spelldirectory;
295 +static char_u *p_language;
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 @@ -1262,6 +1268,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 @@ -1837,6 +1850,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 @@ -4483,6 +4504,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 @@ -7258,6 +7299,10 @@
367 case PV_SYN: return (char_u *)&(curbuf->b_p_syn);
369 +#ifdef FEAT_SPELL_HL
370 + case PV_SPELL_DIR: return (char_u *)&(p_spell_dir);
371 + case PV_SPELL_LANG: return (char_u *)&(p_spell_lang);
373 case PV_SW: return (char_u *)&(curbuf->b_p_sw);
374 case PV_TS: return (char_u *)&(curbuf->b_p_ts);
375 case PV_TW: return (char_u *)&(curbuf->b_p_tw);
376 diff -Nur vim61.orig/src/option.h vim61/src/option.h
377 --- vim61.orig/src/option.h Wed Mar 6 22:16:36 2002
378 +++ vim61/src/option.h Wed Mar 27 15:08:08 2002
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 vim61.orig/src/proto/spell.pro vim61/src/proto/spell.pro
389 --- vim61.orig/src/proto/spell.pro Thu Jan 1 01:00:00 1970
390 +++ vim61/src/proto/spell.pro Wed Mar 27 15:08:08 2002
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 vim61.orig/src/proto.h vim61/src/proto.h
398 --- vim61.orig/src/proto.h Thu Aug 16 22:20:55 2001
399 +++ vim61/src/proto.h Wed Mar 27 15:08:08 2002
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 vim61.orig/src/screen.c vim61/src/screen.c
411 --- vim61.orig/src/screen.c Tue Mar 12 20:59:15 2002
412 +++ vim61/src/screen.c Wed Mar 27 15:08:08 2002
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 @@ -2362,6 +2365,9 @@
424 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 @@ -2435,8 +2441,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 /* Prepare for syntax highlighting in this line. When there is an
452 * error, stop syntax highlighting. */
453 @@ -3068,6 +3084,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 @@ -3320,6 +3340,17 @@
465 char_attr = syntax_attr;
468 +#ifdef FEAT_SPELL_HL
472 + spell_attr = get_spell_attr((colnr_T)v - 1, col,
473 + ml_get_buf(wp->w_buffer,
475 + if (area_attr == 0 && search_attr == 0 && spell_attr)
476 + char_attr = spell_attr;
479 #ifdef FEAT_LINEBREAK
481 * Found last space before word: check for line break
482 diff -Nur vim61.orig/src/spell/config.h vim61/src/spell/config.h
483 --- vim61.orig/src/spell/config.h Thu Jan 1 01:00:00 1970
484 +++ vim61/src/spell/config.h Wed Mar 27 15:08:08 2002
486 +#include "local.h" /* local definitions for options */
489 +** Major-differences selection. The default system is BSD; for USG
490 +** or non-UNIX systems you should add the appropriate #define to local.h.
493 +#undef USG /* Define this in local.h for System V machines */
497 +#include <sys/param.h>
498 +#include <sys/types.h>
501 +# ifndef FEAT_SPELL_HL
503 +# include <dirent.h>
505 +# define NAMLEN(dirent) strlen((dirent)->d_name)
508 +# define dirent direct
509 +# define NAMLEN(dirent) (dirent)->d_namlen
510 +# if HAVE_SYS_NDIR_H
511 +# include <sys/ndir.h>
514 +# include <sys/dir.h>
524 +** Things that normally go in a Makefile. Define these just like you
525 +** might in the Makefile, except you should use #define instead of
526 +** make's assignment syntax. Everything must be double-quoted, and
527 +** (unlike make) you can't use any sort of $-syntax to pick up the
528 +** values of other definitions.
534 +#define EMACS "emacs"
543 +#define LINTFLAGS ""
544 +#endif /* LINTFLAGS */
550 +** Libraries that may need to be added to the cc line to get ispell to
551 +** link. Normally, this should be null.
558 +** TERMLIB - where to get the termcap library. Should be -ltermcap or
559 +** -lcurses on most systems.
562 +#define TERMLIB "-lncurses"
566 +** REGLIB - where to get the regular-expression routines, if
567 +** REGEX_LOOKUP is defined. Should be -lPW on USG systems, null on
575 +** Where to install various components of ispell. BINDIR contains
576 +** binaries. LIBDIR contains hash tables and affix files. ELISPDIR
577 +** contains emacs lisp files (if any) and TEXINFODIR contains emacs
578 +** TeXinfo files. MAN1DIR and MAN4DIR will hold the chapter-1 and
579 +** chapter-4 manual pages, respectively.
581 +** If you intend to use multiple dictionary files, I would suggest
582 +** LIBDIR be a directory which will contain nothing else, so sensible
583 +** names can be constructed for the -d option without conflict.
586 +#define BINDIR "/usr/bin"
589 +#define LIBDIR "/usr/lib/ispell"
592 +#define ELISPDIR "/usr/lib/emacs/site-lisp"
595 +#define TEXINFODIR "/usr/share/info"
598 +#define MAN1DIR "/usr/share/man/man1"
601 +#define MAN4DIR "/usr/share/man/man4"
605 +** Extensions to put on manual pages. Usually these are ".1" or ".1l".
608 +#define MAN1EXT ".1"
611 +#define MAN4EXT ".4"
615 +** List of all hash files (languages) which will be supported by ispell.
617 +** This variable has a complex format so that many options can be
618 +** specified. The format is as follows:
620 +** <language>[,<make-options>...] [<language> [,<make-options> ...] ...]
624 +** language is the name of a subdirectory of the
625 +** "languages" directory
626 +** make-options are options that are to be passed to "make" in
627 +** the specified directory. The make-options
628 +** should not, in general, specify a target, as
629 +** this will be provided by the make process.
631 +** For example, if LANGUAGES is:
633 +** "{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/dict/words /usr/dict/web2} {deutsch,DICTALWAYS=deutsch.sml,DICTOPTIONS=}"
635 +** then the American-English and Deutsch (German) languages will be supported,
636 +** and the following variable settings will be passed to the two Makefiles:
640 +** MASTERDICTS='american.med+'
641 +** HASHFILES='americanmed+.hash'
642 +** EXTRADICT='/usr/dict/words /usr/dict/web2'
646 +** DICTALWAYS='deutsch.sml'
649 +** Notes on the syntax: The makefile is not very robust. If you have
650 +** make problems, or if make seems to fail in the language-subdirs
651 +** dependency, check your syntax. The makefile adds single quotes to
652 +** the individual variables in the LANGUAGES specification, so don't
653 +** use quotes of any kind.
655 +** In the future, the first language listed in this variable will
656 +** become the default, and the DEFHASH, DEFLANG, and DEFPAFF,
657 +** variables will all become obsolete. So be sure to put your default
658 +** language first, to make later conversion easier!
660 +** Notes on options for the various languages will be found in the
661 +** Makefiles for those languages. Some of those languages may require
662 +** you to also change various limits limits like MASKBITS or the
663 +** length parameters.
665 +** A special note on the English language: because the British and
666 +** American dialects use different spelling, you should usually select
667 +** one or the other of these. If you select both, the setting of
668 +** MASTERHASH will determine which becomes the language linked to
669 +** DEFHASH (which will usually be named english.hash).
671 +** On MSDOS systems you must use names which are consistent with the
672 +** 8+3 filename restrictions, or you will risk filename collision. See
673 +** the file pc/local.djgpp for details.
676 +#define LANGUAGES "{american,MASTERDICTS=american.med+,HASHFILES=americanmed+.hash,EXTRADICT=/usr/dict/words}"
677 +#endif /* LANGUAGES */
680 +** Master hash file for DEFHASH. This is the name of a hash file
681 +** built by a language Makefile. It should be the most-popular hash
682 +** file on your system, because it is the one that will be used by
683 +** default. It must be listed in LANGUAGES, above.
686 +#define MASTERHASH "polish+.hash"
690 +** Default native-language hash file. This is the name given to the
691 +** hash table that will be used if no language is specified to
692 +** ispell. It is a link to MASTERHASH, above.
695 +#define DEFHASH "polish.hash"
699 +** Language tables for the default language. This must be the name of
700 +** the affix file that was used to generate the MASTERHASH/DEFHASH,
704 +#define DEFLANG "polish.aff"
708 +** Language to use for error messages. If there are no messages in this
709 +** language, English will be used instead.
712 +#define MSGLANG "polish"
713 +#endif /* MSGLANG */
716 +** If your sort command accepts the -T switch to set temp file
717 +** locations (try it out; it exists but is undocumented on some
718 +** systems), make the following variable the null string. Otherwise
719 +** leave it as the sed script.
722 +#define SORTTMP "-e '/!!SORTTMP!!/s/=.*$/=/'"
726 +** If your sort command accepts the -T switch (see above), make the
727 +** following variable refer to a temporary directory with lots of
728 +** space. Otherwise make it the null string.
730 +#ifndef MAKE_SORTTMP
731 +#define MAKE_SORTTMP "-T ${TMPDIR-/usr/tmp}"
735 +** If your shell needs ": Use /bin/sh" at the first line of a shell
736 +** script, make the following variable the null string. Otherwise
737 +** leave it as this sed script which will put a "#!/bin/sh" there.
739 +#ifndef MAKE_POUND_BANG
740 +#define MAKE_POUND_BANG "-e 1s,^:.*Use.*/bin/sh,#!/bin/sh,"
745 +** INSTALL program. Could be a copy program like cp or something fancier
746 +** like /usr/ucb/install -c
749 +#define INSTALL "cp"
753 +** If your system has the rename(2) system call, define HAS_RENAME and
754 +** ispell will use that call to rename backup files. Otherwise, it
755 +** will use link/unlink. There is no harm in this except on MS-DOS,
756 +** which doesn't support link/unlink.
760 +#endif /* HAS_RENAME */
762 +/* type given to signal() by signal.h */
764 +#define SIGNAL_TYPE void
767 +/* environment variable for user's word list */
769 +#define PDICTVAR "WORDLIST"
772 +/* prefix part of default word list */
774 +#define DEFPDICT ".ispell_"
778 +** suffix part of default word list
781 +#define DEFPAFF "words"
784 +/* old place to look for default word list */
786 +#define OLDPDICT ".ispell_"
787 +#endif /* OLDPDICT */
789 +#define OLDPAFF "words"
790 +#endif /* OLDPAFF */
792 +/* environment variable for include file string */
794 +#define INCSTRVAR "INCLUDE_STRING"
797 +/* default include string */
799 +#define DEFINCSTR "&Include_File&"
802 +/* mktemp template for temporary file - MUST contain 6 consecutive X's */
804 +#define TEMPNAME "/tmp/ispellXXXXXX"
808 +** If REGEX_LOOKUP is undefined, the lookup command (L) will use the look(1)
809 +** command (if available) or the egrep command. If REGEX_LOOKUP is defined,
810 +** the lookup command will use the internal dictionary and the
811 +** regular-expression library (which you must supply separately. There is
812 +** a public-domain library available; libraries are also distributed with
813 +** both BSD and System V.
815 +** The advantage of no REGEX_LOOKUP is that it is often much faster, especially
816 +** if the look(1) command is available, that the words found are presented
817 +** in alphabetical order, and that the list of words searched is larger.
818 +** The advantage of REGEX_LOOKUP is that ispell doesn't need to spawn another
819 +** program, and the list of words searched is exactly the list of (root) words
820 +** that ispell will accept. (However, note that words formed with affixes will
821 +** not be found; this can produce some artifacts. For example, since
822 +** "brother" can be formed as "broth+er", a lookup command might fail to
825 +#ifndef REGEX_LOOKUP
827 +#endif /* REGEX_LOOKUP */
830 +** Choose the proper type of regular-expression routines here. BSD
831 +** and public-domain systems have routines called re_comp and re_exec;
832 +** System V uses regcmp and regex.
834 +** REGCTYPE is the type of a variable to hold the compiled regexp
835 +** REGCMP(re,str) is the function which compiles a regexp in `str' into
836 +** a compiled regexp `re' declared as REGCTYPE and
838 +** REGEX(re,str,dummy) is a function which matches `str' against a compiled
839 +** regexp in `re' and returns a non-NULL pointer if it
840 +** matches, NULL otherwise.
841 +** REGFREE(re) is anything that should be done when the compiled
842 +** regexp `re' is no longer needed. It can be also used
843 +** to allocate any structures required to compile a
844 +** regexp, since it is called *before* compiling a new
845 +** regexp (that's where we know that the old one will no
848 +** Here is one way of defining these if you have POSIX regexp functions:
850 +** #include <sys/types.h>
851 +** #include <regex.h>
852 +** #define REGCTYPE regex_t *
853 +** #define REGCMP(re,str) (regcomp (re, str, 0), re)
854 +** #define REGEX(re, str, dummy) \
855 +** (re != 0 && regexec (re, str, 0, 0, 0) == 0 ? (char *)1 : NULL)
856 +** #define REGFREE(re) \
859 +** re = (regex_t *)calloc (1, sizeof (regex_t)); \
868 +#define REGCTYPE char *
869 +#define REGCMP(re,str) regcmp (str, (char *) 0)
870 +#define REGEX(re, str, dummy) regex (re, str, dummy, dummy, dummy, dummy, \
871 + dummy, dummy, dummy, dummy, dummy, dummy)
872 +#define REGFREE(re) do {if (re != NULL) free (re); re = NULL;} \
875 +#define REGCTYPE char *
876 +#define REGFREE(re) (void)0
877 +#define REGCMP(re,str) re_comp (str)
878 +#define REGEX(re, str, dummy) re_exec (str)
881 +#endif /* REGEX_LOOKUP */
883 +/* look command (if look(1) MAY BE available - ignored if not) */
884 +#ifndef REGEX_LOOKUP
886 +#define LOOK "look -df"
888 +#endif /* REGEX_LOOKUP */
890 +/* path to egrep (use speeded up version if available) */
893 +#define EGREPCMD "/bin/egrep"
895 +#define EGREPCMD "/usr/bin/egrep -i"
899 +/* path to wordlist for Lookup command (typically /usr/dict/{words|web2}) */
900 +/* note that /usr/dict/web2 is usually a bad idea due to obscure words */
902 +#define WORDS "/usr/dict/words"
905 +/* buffer size to use for file names if not in sys/param.h */
907 +#define MAXPATHLEN 240
910 +/* max file name length (will truncate to fit BAKEXT) if not in sys/param.h */
912 +#define MAXNAMLEN 14
915 +/* define if you want .bak file names truncated to MAXNAMLEN characters */
918 +#endif /* TRUNCATEBAK */
920 +/* largest word accepted from a file by any input routine, plus one */
921 +#ifndef INPUTWORDLEN
922 +#define INPUTWORDLEN 100
925 +/* largest amount that a word might be extended by adding affixes */
927 +#define MAXAFFIXLEN 20
931 +** Define the following to suppress the 8-bit character feature.
932 +** Unfortunately, this doesn't work as well as it might, because ispell
933 +** only strips the 8th bit in some places. For example, it calls strcmp()
934 +** quite often without first stripping parity. However, I really wonder
935 +** about the utility of this option, so I haven't bothered to fix it. If
936 +** you think the stripping feature of NO8BIT is useful, you might let me
937 +** (Geoff Kuenning) know.
939 +** Nevertheless, NO8BIT is a useful option for other reasons. If NO8BIT
940 +** is defined, ispell will probably use 8-bit characters internally;
941 +** this improves time efficiency and saves a small amount of space
942 +** in the hash file. Thus, I recommend you specify NO8BIT unless you
943 +** actually expect to be spelling files which use a 256-character set.
950 +** Number of mask bits (affix flags) supported. Must be 32, 64, 128, or
951 +** 256. If MASKBITS is 32 or 64, there are really only 26 or 58 flags
952 +** available, respectively. If it is 32, the flags are named with the
953 +** 26 English uppercase letters; lowercase will be converted to uppercase.
954 +** If MASKBITS is 64, the 58 flags are named 'A' through 'z' in ASCII
955 +** order, including the 6 special characters from 'Z' to 'a': "[\]^_`".
956 +** If MASKBITS is 128 or 256, all the 7-bit or 8-bit characters,
957 +** respectively, are theoretically available, though a few (newline, slash,
958 +** null byte) are pretty hard to actually use successfully.
960 +** Note that a number of non-English affix files depend on having a
961 +** larger value for MASKBITS. See the affix files for more
969 +** C type to use for masks. This should be a type that the processor
970 +** accesses efficiently.
972 +** MASKTYPE_WIDTH must correctly reflect the number of bits in a
973 +** MASKTYPE. Unfortunately, it is also required to be a constant at
974 +** preprocessor time, which means you can't use the sizeof operator to
977 +** Note that MASKTYPE *must* match MASKTYPE_WIDTH or you may get
978 +** division-by-zero errors!
981 +#define MASKTYPE long
983 +#ifndef MASKTYPE_WIDTH
984 +#define MASKTYPE_WIDTH 32
986 +#if MASKBITS < MASKTYPE_WIDTH
988 +#define MASKBITS MASKTYPE_WIDTH
989 +#endif /* MASKBITS < MASKTYPE_WIDTH */
992 +/* maximum number of include files supported by xgets; set to 0 to disable */
993 +#ifndef MAXINCLUDEFILES
994 +#define MAXINCLUDEFILES 5
998 +** Maximum hash table fullness percentage. Larger numbers trade space
1002 +#define MAXPCT 70 /* Expand table when 70% full */
1006 +** Maximum number of "string" characters that can be defined in a
1007 +** language (affix) file. Don't forget that an upper/lower string
1008 +** character counts as two!
1010 +#ifndef MAXSTRINGCHARS
1011 +#define MAXSTRINGCHARS 100
1012 +#endif /* MAXSTRINGCHARS */
1015 +** Maximum length of a "string" character. The default is appropriate for
1016 +** nroff-style characters starting with a backslash.
1018 +#ifndef MAXSTRINGCHARLEN
1019 +#define MAXSTRINGCHARLEN 10
1020 +#endif /* MAXSTRINGCHARLEN */
1023 +** the S_NOPARITY mask is applied to user input characters from the terminal
1024 +** in order to mask out the parity bit.
1027 +#define S_NOPARITY 0x7f
1029 +#define S_NOPARITY 0xff
1034 +** the terminal mode for ispell, set to CBREAK or RAW
1038 +#define TERM_MODE CBREAK
1042 +** Define this if you want your columns of words to be of equal length.
1043 +** This will spread short word lists across the screen instead of down it.
1045 +#ifndef EQUAL_COLUMNS
1046 +#undef EQUAL_COLUMNS
1047 +#endif /* EQUAL_COLUMNS */
1050 +** This is the extension that will be added to backup files
1053 +#define BAKEXT ".bak"
1057 +** Define this if you want to suppress the capitalization-checking
1058 +** feature. This will reduce the size of the hashed dictionary on
1059 +** most 16-bit and some 32-bit machines. This option is not
1062 +#ifndef NO_CAPITALIZATION_SUPPORT
1063 +#undef NO_CAPITALIZATION_SUPPORT
1064 +#endif /* NO_CAPITALIZATION_SUPPORT */
1067 +** Define this if you want your personal dictionary sorted. This may take
1068 +** a long time for very large dictionaries. Dictionaries larger than
1069 +** SORTPERSONAL words will not be sorted. Define SORTPERSONAL as zero
1070 +** to disable this feature.
1072 +#ifndef SORTPERSONAL
1073 +#define SORTPERSONAL 1000
1077 +** Define this if you want to use the shell for interpretation of commands
1078 +** issued via the "L" command, "^Z" under System V, and "!". If this is
1079 +** not defined then a direct fork()/exec() will be used in place of the
1080 +** normal system(). This may speed up these operations greately on some
1088 +** Maximum language-table search size. Smaller numbers make ispell
1089 +** run faster, at the expense of more memory (the lowest reasonable value
1090 +** is 2). If a given character appears in a significant position in
1091 +** more than MAXSEARCH suffixes, it will be given its own index table.
1092 +** If you change this, define INDEXDUMP in lookup.c to be sure your
1093 +** index table looks reasonable.
1096 +#define MAXSEARCH 4
1100 +** Define this if you want to be able to type any command at a "type space
1101 +** to continue" prompt.
1103 +#ifndef COMMANDFORSPACE
1104 +#undef COMMANDFORSPACE
1105 +#endif /* COMMANDFORSPACE */
1108 +** Memory-allocation increment. Buildhash allocates memory in chunks
1109 +** of this size, and then subdivides it to get its storage. This saves
1110 +** much malloc execution time. A good number for this is the system
1111 +** page size less the malloc storage overhead.
1113 +** Define this to zero to revert to using malloc/realloc. This is normally
1114 +** useful only on systems with limited memory.
1116 +#ifndef MALLOC_INCREMENT
1117 +#define MALLOC_INCREMENT 0
1121 +** Maximum number of "hits" expected on a word. This is basically the
1122 +** number of different ways different affixes can produce the same word.
1123 +** For example, with "english.aff", "brothers" can be produced 3 ways:
1124 +** "brothers," "brother+s", or "broth+ers". If this is too low, no major
1125 +** harm will be done, but ispell may occasionally forget a capitalization.
1128 +#define MAX_HITS 10
1132 +** Maximum number of capitalization variations expected in any word.
1133 +** Besides the obvious all-lower, all-upper, and capitalized versions,
1134 +** this includes followcase variants. If this is too low, no real
1135 +** harm will be done, but ispell may occasionally fail to suggest a
1136 +** correct capitalization.
1139 +#define MAX_CAPS 10
1140 +#endif /* MAX_CAPS */
1142 +/* Define this to ignore spelling check of entire LaTeX bibliography listings */
1148 +** Default nroff and TeX special characters. Normally, you won't want to
1149 +** change this; instead you would override it in the language-definition
1153 +#define TEXSPECIAL "{}$*.%#&?,;:!@~-"
1157 +#define NRSPECIAL "().\\*"
1161 +** Defaults for certain command-line flags.
1163 +#ifndef DEFNOBACKUPFLAG
1164 +#define DEFNOBACKUPFLAG 0 /* Don't suppress backup file */
1167 +#define DEFTEXFLAG 0 /* Default to nroff mode */
1171 +** Define this if you want ispell to place a limitation on the maximum
1172 +** size of the screen. On windowed workstations with very large windows,
1173 +** the size of the window can be too much of a good thing, forcing the
1174 +** user to look back and forth between the bottom and top of the screen.
1175 +** If MAX_SCREEN_SIZE is nonzero, screens larger than this will be treated
1176 +** as if they have only MAX_SCREEN_SIZE lines. A good value for this
1177 +** variable is 24 or 30. Define it as zero to suppress the feature.
1179 +#ifndef MAX_SCREEN_SIZE
1180 +#define MAX_SCREEN_SIZE 0
1184 +** The next three variables are used to provide a variable-size context
1185 +** display at the bottom of the screen. Normally, the user will see
1186 +** a number of lines equal to CONTEXTPCT of his screen, rounded down
1187 +** (thus, with CONTEXTPCT == 10, a 24-line screen will produce two lines
1188 +** of context). The context will never be greater than MAXCONTEXT or
1189 +** less than MINCONTEXT. To disable this feature entirely, set MAXCONTEXT
1190 +** and MINCONTEXT to the same value. To round context percentages up,
1191 +** define CONTEXTROUNDUP.
1193 +** Warning: don't set MAXCONTEXT ridiculously large. There is a
1194 +** static buffer of size MAXCONTEXT*BUFSIZ; since BUFSIZ is frequently
1195 +** 1K or larger, this can create a remarkably large executable.
1198 +#define CONTEXTPCT 10 /* Use 10% of the screen for context */
1201 +#define MINCONTEXT 2 /* Always show at least 2 lines of context */
1204 +#define MAXCONTEXT 10 /* Never show more than 10 lines of context */
1206 +#ifndef CONTEXTROUNDUP
1207 +#undef CONTEXTROUNDUP /* Don't round context up */
1211 +** Define this if you want the context lines to be displayed at the
1212 +** bottom of the screen, the way they used to be, rather than at the top.
1214 +#ifndef BOTTOMCONTEXT
1215 +#undef BOTTOMCONTEXT
1216 +#endif /* BOTTOMCONTEXT */
1219 +** Define this if you want the "mini-menu," which gives the most important
1220 +** options at the bottom of the screen, to be the default (in any case, it
1221 +** can be controlled with the "-M" switch).
1228 +** You might want to change this to zero if your users want to check
1229 +** single-letter words against the dictionary. However, you should try
1230 +** some sample runs using the -W switch before you try it out; you'd
1231 +** be surprised how many single letters appear in documents. If you increase
1232 +** MINWORD beyond 1, don't say I didn't warn you that it was a bad idea.
1235 +#define MINWORD 1 /* Words this short and shorter are always ok */
1239 +** ANSI C compilers are supposed to provide an include file,
1240 +** "stdlib.h", which gives function prototypes for all library
1241 +** routines. Define NO_STDLIB_H if you have a compiler that claims to
1242 +** be ANSI, but doesn't provide this include file.
1244 +#ifndef NO_STDLIB_H
1246 +#define NO_STDLIB_H
1247 +#endif /* __STDC__ */
1248 +#endif /* NO_STDLIB_H */
1251 +** The following define is used by the ispell developer to help
1252 +** double-check the software. Leave it undefined on other systems
1253 +** unless you are especially fond of warning messages, or are pursuing
1254 +** an inexplicable bug that might be related to a type mismatch.
1256 +#ifndef GENERATE_LIBARARY_PROTOS
1257 +#undef GENERATE_LIBARARY_PROTOS
1258 +#endif /* GENERATE_LIBARARY_PROTOS */
1261 +** Symbols below this point are generally intended to cater to
1262 +** idiosyncracies of specific machines and operating systems.
1264 +** MS-DOS users should also define HAS_RENAME, above, if appropriate.
1266 +** Define PIECEMEAL_HASH_WRITES if your system can't handle huge write
1267 +** operations. This is known to be a problem on MS-DOS systems when
1268 +** a 16-bit compiler is used to compile Ispell.
1270 +#ifndef PIECEMEAL_HASH_WRITES
1271 +#undef PIECEMEAL_HASH_WRITES
1272 +#endif /* PIECEMEAL_HASH_WRITES */
1275 +** Redefine GETKEYSTROKE() to getkey() on some MS-DOS systems where
1276 +** getchar() doesn't operate properly in raw mode.
1278 +#ifndef GETKEYSTROKE
1279 +#define GETKEYSTROKE() getchar ()
1280 +#endif /* GETKEYSTROKE */
1283 +** Define MSDOS_BINARY_OPEN to 0x8000 on MS-DOS systems. This can be
1284 +** done by adding "#include fcntl.h" to your local.h file.
1286 +#ifndef MSDOS_BINARY_OPEN
1288 +#define MSDOS_BINARY_OPEN O_BINARY
1289 +#else /* O_BINARY */
1290 +#define MSDOS_BINARY_OPEN 0
1291 +#endif /* O_BINARY */
1292 +#endif /* MSDOS_BINARY_OPEN */
1295 +** Environment variable to use to locate the home directory. On DOS
1296 +** systems you might want to set this to ISPELL_HOME to avoid
1297 +** conflicts with other programs that look for a HOME environment
1298 +** variable; on all other systems it should be just HOME.
1301 +#define HOME "HOME"
1305 +** On MS-DOS systems, define PDICTHOME to be the name of a directory
1306 +** to be used to contain the personal dictionary (.ispell_english,
1307 +** etc.). On other systems, you can leave it undefined.
1311 +#endif /* PDICTHOME */
1314 +** On MS-DOS systems, you can rename the following variables so that
1315 +** ispell's files have 3-character suffixes. Note that, if you do
1316 +** this, you will have to redefine any variable above that incorporates
1317 +** one of the suffixes. (Most MS-DOS environments will silently truncate
1318 +** excess characters beyond the 8+3 limit, so you usually don't need to
1319 +** change the suffixes just because they are longer than 3 characters.)
1322 +#define HASHSUFFIX ".hash"
1323 +#endif /* HASHSUFFIX */
1325 +#define STATSUFFIX ".sta"
1326 +#endif /* STATSUFFIX */
1327 +#ifndef COUNTSUFFIX
1328 +#define COUNTSUFFIX ".cnt"
1329 +#endif /* COUNTSUFFIX */
1330 +#define SIGNAL_TYPE_STRING "void"
1331 +#define MASKTYPE_STRING "long"
1332 diff -Nur vim61.orig/src/spell/good.c vim61/src/spell/good.c
1333 --- vim61.orig/src/spell/good.c Thu Jan 1 01:00:00 1970
1334 +++ vim61/src/spell/good.c Wed Mar 27 15:08:08 2002
1337 +static char Rcs_Id[] =
1342 + * good.c - see if a word or its root word
1343 + * is in the dictionary.
1345 + * Pace Willisson, 1983
1347 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1348 + * All rights reserved.
1350 + * Redistribution and use in source and binary forms, with or without
1351 + * modification, are permitted provided that the following conditions
1354 + * 1. Redistributions of source code must retain the above copyright
1355 + * notice, this list of conditions and the following disclaimer.
1356 + * 2. Redistributions in binary form must reproduce the above copyright
1357 + * notice, this list of conditions and the following disclaimer in the
1358 + * documentation and/or other materials provided with the distribution.
1359 + * 3. All modifications to the source code must be clearly marked as
1360 + * such. Binary redistributions based on modified source code
1361 + * must be clearly marked as modified versions in the documentation
1362 + * and/or other materials provided with the distribution.
1363 + * 4. All advertising materials mentioning features or use of this software
1364 + * must display the following acknowledgment:
1365 + * This product includes software developed by Geoff Kuenning and
1366 + * other unpaid contributors.
1367 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1368 + * products derived from this software without specific prior
1369 + * written permission.
1371 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1372 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1373 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1374 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1375 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1376 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1377 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1378 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1379 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1380 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1386 + * Revision 1.43 1994/11/02 06:56:05 geoff
1387 + * Remove the anyword feature, which I've decided is a bad idea.
1389 + * Revision 1.42 1994/10/25 05:45:59 geoff
1390 + * Add support for an affix that will work with any word, even if there's
1391 + * no explicit flag.
1393 + * Revision 1.41 1994/05/24 06:23:06 geoff
1394 + * Let tgood decide capitalization questions, rather than doing it ourselves.
1396 + * Revision 1.40 1994/05/17 06:44:10 geoff
1397 + * Add support for controlled compound formation and the COMPOUNDONLY
1398 + * option to affix flags.
1400 + * Revision 1.39 1994/01/25 07:11:31 geoff
1401 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
1406 +#include "ispell.h"
1408 +#ifndef NO_CAPITALIZATION_SUPPORT
1409 +Public Logical cap_ok (ichar_t * word, struct success * hit, int len);
1410 +Local Logical entryhasaffixes (struct dent * dent, struct success * hit);
1411 +#endif /* NO_CAPITALIZATION_SUPPORT */
1412 +Public void flagpr (ichar_t * word, int preflag, int prestrip,
1413 + int preadd, int sufflag, int sufadd);
1414 +Local ichar_t * orig_word;
1417 +#ifndef NO_CAPITALIZATION_SUPPORT
1418 +good (ichar_t *w, int ignoreflagbits, int allhits, int pfxopts, int sfxopts)
1421 +good (ichar_t *w, int ignoreflagbits, int dummy, int pfxopts, int sfxopts)
1422 +#define allhits 0 /* Never actually need more than one hit */
1426 + ichar_t nword[INPUTWORDLEN + MAXAFFIXLEN];
1427 + register ichar_t *p;
1428 + register ichar_t *q;
1430 + register struct dent *dp;
1433 + ** Make an uppercase copy of the word we are checking.
1435 + for (p = w, q = nword; *p; )
1436 + *q++ = mytoupper (*p++);
1444 + (void) printf ("%s", ichartosstr (w, 0));
1447 + else if ((dp = lookup (nword, 1)) != NULL)
1449 + hits[0].dictent = dp;
1450 + hits[0].prefix = NULL;
1451 + hits[0].suffix = NULL;
1452 +#ifndef NO_CAPITALIZATION_SUPPORT
1453 + if (allhits || cap_ok (w, &hits[0], n))
1459 + * If we're looking for compounds, and this root doesn't
1460 + * participate in compound formation, undo the hit.
1462 + if (compoundflag == COMPOUND_CONTROLLED
1463 + && ((pfxopts | sfxopts) & FF_COMPOUNDONLY) != 0
1464 + && hashheader.compoundbit >= 0
1465 + && TSTMASKBIT (dp->mask, hashheader.compoundbit) == 0)
1468 + if (numhits && !allhits)
1471 + /* try stripping off affixes */
1474 + numchars = icharlen (nword);
1478 + (void) putchar ('\n');
1479 + return numhits || (numchars == 1);
1483 + chk_aff (w, nword, n, ignoreflagbits, allhits, pfxopts, sfxopts);
1486 + (void) putchar ('\n');
1491 +#ifndef NO_CAPITALIZATION_SUPPORT
1493 +cap_ok (register ichar_t *word, register struct success *hit, int len)
1495 + register ichar_t * dword;
1496 + register ichar_t * w;
1497 + register struct dent * dent;
1498 + ichar_t dentword[INPUTWORDLEN + MAXAFFIXLEN];
1506 + thiscap = whatcap (word);
1508 + ** All caps is always legal, regardless of affixes.
1510 + preadd = prestrip = sufadd = 0;
1511 + if (thiscap == ALLCAPS)
1513 + else if (thiscap == FOLLOWCASE)
1515 + /* Set up some constants for the while(1) loop below */
1518 + preadd = hit->prefix->affl;
1519 + prestrip = hit->prefix->stripl;
1522 + preadd = prestrip = 0;
1523 + sufadd = hit->suffix ? hit->suffix->affl : 0;
1526 + ** Search the variants for one that matches what we have. Note
1527 + ** that thiscap can't be ALLCAPS, since we already returned
1530 + dent = hit->dictent;
1533 + dentcap = captype (dent->flagfield);
1534 + if (dentcap != thiscap)
1536 + if (dentcap == ANYCASE && thiscap == CAPITALIZED
1537 + && entryhasaffixes (dent, hit))
1540 + else /* captypes match */
1542 + if (thiscap != FOLLOWCASE)
1544 + if (entryhasaffixes (dent, hit))
1550 + ** Make sure followcase matches exactly.
1551 + ** Life is made more difficult by the
1552 + ** possibility of affixes. Start with
1555 + (void) strtoichar (dentword, dent->word, INPUTWORDLEN, 1);
1557 + limit = word + preadd;
1558 + if (myupper (dword[prestrip]))
1560 + for (w = word; w < limit; w++)
1563 + goto doublecontinue;
1568 + for (w = word; w < limit; w++)
1571 + goto doublecontinue;
1574 + dword += prestrip;
1575 + /* Do root part of word */
1576 + limit = dword + len - preadd - sufadd;
1577 + while (dword < limit)
1579 + if (*dword++ != *w++)
1580 + goto doublecontinue;
1583 + dword = limit - 1;
1584 + if (myupper (*dword))
1589 + goto doublecontinue;
1597 + goto doublecontinue;
1601 + ** All failure paths go to "doublecontinue,"
1602 + ** so if we get here it must match.
1604 + if (entryhasaffixes (dent, hit))
1609 + if ((dent->flagfield & MOREVARIANTS) == 0)
1611 + dent = dent->next;
1614 + /* No matches found */
1619 +** See if this particular capitalization (dent) is legal with these
1620 +** particular affixes.
1623 +entryhasaffixes (register struct dent *dent, register struct success *hit)
1626 + if (hit->prefix && !TSTMASKBIT (dent->mask, hit->prefix->flagbit))
1628 + if (hit->suffix && !TSTMASKBIT (dent->mask, hit->suffix->flagbit))
1630 + return True; /* Yes, these affixes are legal */
1635 + * Print a word and its flag, making sure the case of the output matches
1636 + * the case of the original found in "orig_word".
1639 +flagpr (register ichar_t *word, /* (Modified) word to print */
1640 + int preflag, /* Prefix flag (if any) */
1641 + int prestrip, /* Lth of pfx stripped off orig_word */
1642 + int preadd, /* Length of prefix added to w */
1643 + int sufflag, /* Suffix flag (if any) */
1644 + int sufadd) /* Length of suffix added to w */
1646 + register ichar_t * origp; /* Pointer into orig_word */
1647 + int orig_len; /* Length of orig_word */
1649 + orig_len = icharlen (orig_word);
1651 + * We refuse to print if the cases outside the modification
1652 + * points don't match those just inside. This prevents things
1653 + * like "OEM's" from being turned into "OEM/S" which expands
1654 + * only to "OEM'S".
1658 + origp = orig_word + preadd;
1659 + if (myupper (*origp))
1661 + for (origp = orig_word; origp < orig_word + preadd; origp++)
1663 + if (mylower (*origp))
1669 + for (origp = orig_word; origp < orig_word + preadd; origp++)
1671 + if (myupper (*origp))
1678 + origp = orig_word + orig_len - sufadd;
1679 + if (myupper (origp[-1]))
1681 + for ( ; *origp != 0; origp++)
1683 + if (mylower (*origp))
1689 + origp = orig_word + orig_len - sufadd;
1690 + for ( ; *origp != 0; origp++)
1692 + if (myupper (*origp))
1698 + * The cases are ok. Put out the word, being careful that the
1699 + * prefix/suffix cases match those in the original, and that the
1700 + * unchanged characters from the original actually match it.
1702 + (void) putchar (' ');
1703 + origp = orig_word + preadd;
1704 + if (myupper (*origp))
1706 + while (--prestrip >= 0)
1707 + (void) fputs (printichar ((int) *word++), stdout);
1711 + while (--prestrip >= 0)
1712 + (void) fputs (printichar ((int) mytolower (*word++)), stdout);
1714 + for (prestrip = orig_len - preadd - sufadd; --prestrip >= 0; word++)
1715 + (void) fputs (printichar ((int) *origp++), stdout);
1716 + if (origp > orig_word)
1718 + if (myupper (*origp))
1719 + (void) fputs (ichartosstr (word, 0), stdout);
1724 + (void) fputs (printichar ((int) mytolower (*word++)), stdout);
1728 + * Now put out the flags
1730 + (void) putchar (hashheader.flagmarker);
1732 + (void) putchar (preflag);
1734 + (void) putchar (sufflag);
1736 diff -Nur vim61.orig/src/spell/hash.c vim61/src/spell/hash.c
1737 --- vim61.orig/src/spell/hash.c Thu Jan 1 01:00:00 1970
1738 +++ vim61/src/spell/hash.c Wed Mar 27 15:08:08 2002
1741 + * hash.c - a simple hash function for ispell
1743 + * Pace Willisson, 1983
1745 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1746 + * All rights reserved.
1748 + * Redistribution and use in source and binary forms, with or without
1749 + * modification, are permitted provided that the following conditions
1752 + * 1. Redistributions of source code must retain the above copyright
1753 + * notice, this list of conditions and the following disclaimer.
1754 + * 2. Redistributions in binary form must reproduce the above copyright
1755 + * notice, this list of conditions and the following disclaimer in the
1756 + * documentation and/or other materials provided with the distribution.
1757 + * 3. All modifications to the source code must be clearly marked as
1758 + * such. Binary redistributions based on modified source code
1759 + * must be clearly marked as modified versions in the documentation
1760 + * and/or other materials provided with the distribution.
1761 + * 4. All advertising materials mentioning features or use of this software
1762 + * must display the following acknowledgment:
1763 + * This product includes software developed by Geoff Kuenning and
1764 + * other unpaid contributors.
1765 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1766 + * products derived from this software without specific prior
1767 + * written permission.
1769 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1770 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1771 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1772 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1773 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1774 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1775 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1776 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1777 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1778 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1784 + * Revision 1.20 1994/01/25 07:11:34 geoff
1785 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
1789 +#include "ispell.h"
1792 + * The following hash algorithm is due to Ian Dall, with slight modifications
1793 + * by Geoff Kuenning to reflect the results of testing with the English
1794 + * dictionaries actually distributed with ispell.
1796 +#define HASHSHIFT 5
1798 +#ifdef NO_CAPITALIZATION_SUPPORT
1799 +#define HASHUPPER(c) c
1800 +#else /* NO_CAPITALIZATION_SUPPORT */
1801 +#define HASHUPPER(c) mytoupper(c)
1802 +#endif /* NO_CAPITALIZATION_SUPPORT */
1806 + register ichar_t * s,
1807 + register int hashtblsize)
1809 + register long h = 0;
1812 +#ifdef ICHAR_IS_CHAR
1813 + for (i = 4; i-- && *s != 0; )
1814 + h = (h << 8) | HASHUPPER (*s++);
1815 +#else /* ICHAR_IS_CHAR */
1816 + for (i = 2; i-- && *s != 0; )
1817 + h = (h << 16) | HASHUPPER (*s++);
1818 +#endif /* ICHAR_IS_CHAR */
1822 + * We have to do circular shifts the hard way, since C doesn't
1823 + * have them even though the hardware probably does. Oh, well.
1825 + h = (h << HASHSHIFT) |
1826 + ((h >> (32 - HASHSHIFT)) & ((1 << HASHSHIFT) - 1));
1827 + h ^= HASHUPPER (*s++);
1829 + return (unsigned long) h % hashtblsize;
1831 diff -Nur vim61.orig/src/spell/i_proto.h vim61/src/spell/i_proto.h
1832 --- vim61.orig/src/spell/i_proto.h Thu Jan 1 01:00:00 1970
1833 +++ vim61/src/spell/i_proto.h Wed Mar 27 15:08:08 2002
1835 +Global int addvheader (struct dent * ent);
1836 +Global void askmode (void);
1837 +Global void backup (void);
1838 +#ifndef NO_CAPITALIZATION_SUPPORT
1839 +Global Logical cap_ok (ichar_t * word, struct success * hit, int len);
1840 +#endif /* NO_CAPITALIZATION_SUPPORT */
1841 +Global void chupcase (char * s);
1842 +Global void checkfile (void);
1843 +Global void checkline (FILE * ofile);
1844 +Global void chk_aff (ichar_t * word, ichar_t * ucword, int len,
1845 + int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
1846 +Global int combinecaps (struct dent * hdr, struct dent * newent);
1847 +Global int compoundgood (ichar_t * word, int pfxopts);
1848 +Global void copyout (char ** cc, int cnt);
1849 +Global void correct (char * ctok, int ctokl, ichar_t * itok, int itokl,
1851 +Global char * do_regex_lookup (char * expr, int whence);
1852 +Global SIGNAL_TYPE done (int);
1853 +Global void dumpmode (void);
1854 +Global void erase (void);
1855 +Global int expand_pre (char * croot, ichar_t * rootword,
1856 + MASKTYPE mask[], int option, char *extra);
1857 +Global int expand_suf (char * croot, ichar_t * rootword,
1858 + MASKTYPE mask[], int crossonly, int option, char * extra);
1859 +Global int findfiletype (char * name, int searchnames,
1860 + int * deformatter);
1861 +Global void flagpr (ichar_t * word, int preflag, int prestrip,
1862 + int preadd, int sufflag, int sufadd);
1863 +Global void givehelp (int interactive);
1864 +Global int good (ichar_t * word, int ignoreflagbits, int allhits,
1865 + int pfxopts, int sfxopts);
1866 +Global int hash (ichar_t * word, int hashtablesize);
1867 +#ifndef ICHAR_IS_CHAR
1868 +Global int icharcmp (ichar_t * s1, ichar_t * s2);
1869 +Global ichar_t * icharcpy (ichar_t * out, ichar_t * in);
1870 +Global int icharlen (ichar_t * str);
1871 +Global int icharncmp (ichar_t * s1, ichar_t * s2, int n);
1872 +#endif /* ICHAR_IS_CHAR */
1873 +Global int ichartostr (char * out, ichar_t * in, int outlen,
1875 +Global char * ichartosstr (ichar_t * in, int canonical);
1876 +Global void inverse (void);
1877 +Global struct dent * lookup (ichar_t * word, int dotree);
1878 +Global void lowcase (ichar_t * string);
1879 +Global int makedent (char * lbuf, int lbuflen, struct dent * d);
1880 +Global void makepossibilities (ichar_t * word);
1881 +Global void move (int row, int col);
1882 +Global void normal (void);
1883 +Global char * printichar (int in);
1885 +Global int shellescape (char * buf);
1886 +Global void shescape (char * buf);
1888 +#ifndef REGEX_LOOKUP
1889 +Global int shellescape (char * buf);
1890 +#endif /* REGEX_LOOKUP */
1892 +Global char * skipoverword (char * bufp);
1893 +Global void stop (void);
1894 +Global int stringcharlen (char * bufp, int canonical);
1895 +Global int strtoichar (ichar_t * out, char * in, int outlen,
1897 +Global ichar_t * strtosichar (char * in, int canonical);
1898 +Global void terminit (void);
1899 +Global void toutent (FILE * outfile, struct dent * hent, int onlykeep);
1900 +Global void treeinit (char * persdict, char * LibDict);
1901 +Global void treeinsert (char * word, int wordlen, int keep);
1902 +Global struct dent * treelookup (ichar_t * word);
1903 +Global void treeoutput (void);
1904 +Global void upcase (ichar_t * string);
1905 +#ifndef NO_CAPITALIZATION_SUPPORT
1906 +Global long whatcap (ichar_t * word);
1908 +Global char * xgets (char * string, int size, FILE * stream);
1909 +Global void yyinit (void);
1910 +Global Logical yyopen (char * file);
1911 +Global int yyparse (void);
1913 +#include <string.h>
1915 +#ifdef REGEX_LOOKUP
1917 +Global char * regcmp (const char * expr, const char * terminator, ...);
1918 +Global char * regex (const char * pat, const char * subject, ...);
1920 +Global char * re_comp (const char * expr);
1921 +Global int * re_exec (const char * pat);
1925 +Global int tgetent (char * buf, const char * termname);
1926 +Global int tgetnum (const char * id);
1927 +Global char * tgetstr (const char * id, char ** area);
1928 +Global char * tgoto (const char * cm, int col, int row);
1929 +Global char * tputs (const char * str, int pad, int (*func) (int ch);
1932 +Global char * mypath_rindex(char const *str, char c);
1933 +Global void save_root_cap (ichar_t * word, ichar_t * pattern,
1934 + int prestrip, int preadd, int sufstrip, int sufadd,
1935 + struct dent * firstdent, struct flagent * pfxent,
1936 + struct flagent * sufent,
1937 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
1939 +Global int casecmp (char * a, char * b, int canonical);
1940 +Global int ins_root_cap (ichar_t * word, ichar_t * pattern,
1941 + int prestrip, int preadd, int sufstrip, int sufadd,
1942 + struct dent * firstdent, struct flagent * pfxent,
1943 + struct flagent * sufent);
1944 +Global int insert(register ichar_t * word);
1945 +Global char * linit (char *);
1946 +Global char * last_slash (char *file);
1947 diff -Nur vim61.orig/src/spell/ispell.h vim61/src/spell/ispell.h
1948 --- vim61.orig/src/spell/ispell.h Thu Jan 1 01:00:00 1970
1949 +++ vim61/src/spell/ispell.h Wed Mar 27 15:08:08 2002
1956 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
1957 + * All rights reserved.
1959 + * Redistribution and use in source and binary forms, with or without
1960 + * modification, are permitted provided that the following conditions
1963 + * 1. Redistributions of source code must retain the above copyright
1964 + * notice, this list of conditions and the following disclaimer.
1965 + * 2. Redistributions in binary form must reproduce the above copyright
1966 + * notice, this list of conditions and the following disclaimer in the
1967 + * documentation and/or other materials provided with the distribution.
1968 + * 3. All modifications to the source code must be clearly marked as
1969 + * such. Binary redistributions based on modified source code
1970 + * must be clearly marked as modified versions in the documentation
1971 + * and/or other materials provided with the distribution.
1972 + * 4. All advertising materials mentioning features or use of this software
1973 + * must display the following acknowledgment:
1974 + * This product includes software developed by Geoff Kuenning and
1975 + * other unpaid contributors.
1976 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
1977 + * products derived from this software without specific prior
1978 + * written permission.
1980 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
1981 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1982 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1983 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
1984 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1985 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1986 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1987 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1988 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1989 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1995 + * Revision 1.68 1995/03/06 02:42:41 geoff
1996 + * Be vastly more paranoid about parenthesizing macro arguments. This
1997 + * fixes a bug in defmt.c where a complex argument was passed to
2000 + * Revision 1.67 1995/01/03 19:24:12 geoff
2001 + * Get rid of a non-global declaration.
2003 + * Revision 1.66 1994/12/27 23:08:49 geoff
2004 + * Fix a lot of subtly bad assumptions about the widths of ints and longs
2005 + * which only show up on 64-bit machines like the Cray and the DEC Alpha.
2007 + * Revision 1.65 1994/11/02 06:56:10 geoff
2008 + * Remove the anyword feature, which I've decided is a bad idea.
2010 + * Revision 1.64 1994/10/25 05:46:18 geoff
2011 + * Add the FF_ANYWORD flag for defining an affix that will apply to any
2012 + * word, even if not explicitly specified. (Good for French.)
2014 + * Revision 1.63 1994/09/16 04:48:28 geoff
2015 + * Make stringdups and laststringch unsigned ints, and dupnos a plain
2016 + * int, so that we can handle more than 128 stringchars and stringchar
2019 + * Revision 1.62 1994/09/01 06:06:39 geoff
2020 + * Change erasechar/killchar to uerasechar/ukillchar to avoid
2021 + * shared-library problems on HP systems.
2023 + * Revision 1.61 1994/08/31 05:58:35 geoff
2024 + * Add contextoffset, used in -a mode to handle extremely long lines.
2026 + * Revision 1.60 1994/05/17 06:44:15 geoff
2027 + * Add support for controlled compound formation and the COMPOUNDONLY
2028 + * option to affix flags.
2030 + * Revision 1.59 1994/03/15 06:25:16 geoff
2031 + * Change deftflag's initialization so we can tell if -t/-n appeared.
2033 + * Revision 1.58 1994/02/07 05:53:28 geoff
2034 + * Add typecasts to the the 7-bit versions of ichar* routines
2036 + * Revision 1.57 1994/01/25 07:11:48 geoff
2037 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
2042 +#include "config.h"
2045 +#define SET_SIZE 128
2047 +#define SET_SIZE 256
2050 +#define MASKSIZE (MASKBITS / MASKTYPE_WIDTH)
2052 +/* The following is really testing for MASKSIZE <= 1, but cpp can't do that */
2053 +#if MASKBITS <= MASKTYPE_WIDTH
2054 +#define SETMASKBIT(mask, bit) ((mask)[0] |= (MASKTYPE) 1 << (bit))
2055 +#define CLRMASKBIT(mask, bit) ((mask)[0] &= (MASKTYPE) ~(1 << (bit)))
2056 +#define TSTMASKBIT(mask, bit) ((mask)[0] & ((MASKTYPE) 1 << (bit)))
2058 +#define SETMASKBIT(mask, bit) \
2059 + ((mask)[(bit) / MASKTYPE_WIDTH] |= \
2060 + (MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1)))
2061 +#define CLRMASKBIT(mask, bit) \
2062 + ((mask)[(bit) / MASKTYPE_WIDTH] &= \
2063 + ~((MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1))))
2064 +#define TSTMASKBIT(mask, bit) \
2065 + ((mask)[(bit) / MASKTYPE_WIDTH] & \
2066 + ((MASKTYPE) 1 << ((bit) & (MASKTYPE_WIDTH - 1))))
2070 +#define FULLMASKSET
2075 +#define BITTOCHAR(bit) ((bit) + 'A')
2076 +#define CHARTOBIT(ch) ((ch) - 'A')
2078 +#define LARGESTFLAG 26 /* 5 are needed for flagfield below */
2079 +#define FLAGBASE ((MASKTYPE_WIDTH) - 6)
2081 +# if MASKBITS <= 64
2083 +#define BITTOCHAR(bit) ((bit) + 'A')
2084 +#define CHARTOBIT(ch) ((ch) - 'A')
2086 +#define LARGESTFLAG (64 - 6) /* 5 are needed for flagfield below */
2087 +#define FLAGBASE ((MASKTYPE_WIDTH) - 6)
2090 +#define BITTOCHAR(bit) (bit)
2091 +#define CHARTOBIT(ch) (ch)
2093 +#define LARGESTFLAG MASKBITS /* flagfield is a separate field */
2099 +** Data type for internal word storage. If necessary, we use shorts rather
2100 +** than chars so that string characters can be encoded as a single unit.
2102 +#if (SET_SIZE + MAXSTRINGCHARS) <= 256
2104 +#define ICHAR_IS_CHAR
2108 +#ifdef ICHAR_IS_CHAR
2109 +typedef unsigned char ichar_t; /* Internal character */
2110 +#define icharlen(s) strlen ((char *) (s))
2111 +#define icharcpy(a, b) strcpy ((char *) (a), (char *) (b))
2112 +#define icharcmp(a, b) strcmp ((char *) (a), (char *) (b))
2113 +#define icharncmp(a, b, n) strncmp ((char *) (a), (char *) (b), (n))
2114 +#define chartoichar(x) ((ichar_t) (x))
2116 +typedef unsigned short ichar_t; /* Internal character */
2117 +#define chartoichar(x) ((ichar_t) (unsigned char) (x))
2122 + struct dent * next;
2124 + MASKTYPE mask[MASKSIZE];
2131 +** Flags in the directory entry. If FULLMASKSET is undefined, these are
2132 +** stored in the highest bits of the last longword of the mask field. If
2133 +** FULLMASKSET is defined, they are stored in the extra "flags" field.
2134 +#ifndef NO_CAPITALIZATION_SUPPORT
2136 +** If a word has only one capitalization form, and that form is not
2137 +** FOLLOWCASE, it will have exactly one entry in the dictionary. The
2138 +** legal capitalizations will be indicated by the 2-bit capitalization
2139 +** field, as follows:
2141 +** ALLCAPS The word must appear in all capitals.
2142 +** CAPITALIZED The word must be capitalized (e.g., London).
2143 +** It will also be accepted in all capitals.
2144 +** ANYCASE The word may appear in lowercase, capitalized,
2145 +** or all-capitals.
2147 +** Regardless of the capitalization flags, the "word" field of the entry
2148 +** will point to an all-uppercase copy of the word. This is to simplify
2149 +** the large portion of the code that doesn't care about capitalization.
2150 +** Ispell will generate the correct version when needed.
2152 +** If a word has more than one capitalization, there will be multiple
2153 +** entries for it, linked together by the "next" field. The initial
2154 +** entry for such words will be a dummy entry, primarily for use by code
2155 +** that ignores capitalization. The "word" field of this entry will
2156 +** again point to an all-uppercase copy of the word. The "mask" field
2157 +** will contain the logical OR of the mask fields of all variants.
2158 +** A header entry is indicated by a capitalization type of ALLCAPS,
2159 +** with the MOREVARIANTS bit set.
2161 +** The following entries will define the individual variants. Each
2162 +** entry except the last has the MOREVARIANTS flag set, and each
2163 +** contains one of the following capitalization options:
2165 +** ALLCAPS The word must appear in all capitals.
2166 +** CAPITALIZED The word must be capitalized (e.g., London).
2167 +** It will also be accepted in all capitals.
2168 +** FOLLOWCASE The word must be capitalized exactly like the
2169 +** sample in the entry. Prefix (suffix) characters
2170 +** must be rendered in the case of the first (last)
2171 +** "alphabetic" character. It will also be accepted
2172 +** in all capitals. ("Alphabetic" means "mentioned
2173 +** in a 'casechars' statement".)
2174 +** ANYCASE The word may appear in lowercase, capitalized,
2175 +** or all-capitals.
2177 +** The "mask" field for the entry contains only the affix flag bits that
2178 +** are legal for that capitalization. The "word" field will be null
2179 +** except for FOLLOWCASE entries, where it will point to the
2180 +** correctly-capitalized spelling of the root word.
2182 +** It is worth discussing why the ALLCAPS option is used in
2183 +** the header entry. The header entry accepts an all-capitals
2184 +** version of the root plus every affix (this is always legal, since
2185 +** words get capitalized in headers and so forth). Further, all of
2186 +** the following variant entries will reject any all-capitals form
2187 +** that is illegal due to an affix.
2189 +** Finally, note that variations in the KEEP flag can cause a multiple-variant
2190 +** entry as well. For example, if the personal dictionary contains "ALPHA",
2191 +** (KEEP flag set) and the user adds "alpha" with the KEEP flag clear, a
2192 +** multiple-variant entry will be created so that "alpha" will be accepted
2193 +** but only "ALPHA" will actually be kept.
2197 +#define flagfield flags
2199 +#define flagfield mask[MASKSIZE - 1]
2201 +#define USED ((MASKTYPE) 1 << (FLAGBASE + 0))
2202 +#define KEEP ((MASKTYPE) 1 << (FLAGBASE + 1))
2203 +#ifdef NO_CAPITALIZATION_SUPPORT
2204 +#define ALLFLAGS (USED | KEEP)
2205 +#else /* NO_CAPITALIZATION_SUPPORT */
2206 +#define ANYCASE ((MASKTYPE) 0 << (FLAGBASE + 2))
2207 +#define ALLCAPS ((MASKTYPE) 1 << (FLAGBASE + 2))
2208 +#define CAPITALIZED ((MASKTYPE) 2 << (FLAGBASE + 2))
2209 +#define FOLLOWCASE ((MASKTYPE) 3 << (FLAGBASE + 2))
2210 +#define CAPTYPEMASK ((MASKTYPE) 3 << (FLAGBASE + 2))
2211 +#define MOREVARIANTS ((MASKTYPE) 1 << (FLAGBASE + 4))
2212 +#define ALLFLAGS (USED | KEEP | CAPTYPEMASK | MOREVARIANTS)
2213 +#define captype(x) ((x) & CAPTYPEMASK)
2214 +#endif /* NO_CAPITALIZATION_SUPPORT */
2217 + * Language tables used to encode prefix and suffix information.
2221 + ichar_t * strip; /* String to strip off */
2222 + ichar_t * affix; /* Affix to append */
2223 + short flagbit; /* Flag bit this ent matches */
2224 + short stripl; /* Length of strip */
2225 + short affl; /* Length of affix */
2226 + short numconds; /* Number of char conditions */
2227 + short flagflags; /* Modifiers on this flag */
2228 + char conds[SET_SIZE + MAXSTRINGCHARS]; /* Adj. char conds */
2232 + * Bits in flagflags
2234 +#define FF_CROSSPRODUCT (1 << 0) /* Affix does cross-products */
2235 +#define FF_COMPOUNDONLY (1 << 1) /* Afx works in compounds */
2237 +union ptr_union /* Aid for building flg ptrs */
2239 + struct flagptr * fp; /* Pointer to more indexing */
2240 + struct flagent * ent; /* First of a list of ents */
2245 + union ptr_union pu; /* Ent list or more indexes */
2246 + int numents; /* If zero, pu.fp is valid */
2250 + * Description of a single string character type.
2254 + char * name; /* Name of the type */
2255 + char * deformatter; /* Deformatter to use */
2256 + char * suffixes; /* File suffixes, null seps */
2260 + * Header placed at the beginning of the hash file.
2264 + unsigned short magic; /* Magic number for ID */
2265 + unsigned short compileoptions; /* How we were compiled */
2266 + short maxstringchars; /* Max # strchrs we support */
2267 + short maxstringcharlen; /* Max strchr len supported */
2268 + short compoundmin; /* Min lth of compound parts */
2269 + short compoundbit; /* Flag 4 compounding roots */
2270 + unsigned int stringsize; /* Size of string table */
2271 + int lstringsize; /* Size of lang. str tbl */
2272 + unsigned int tblsize; /* No. entries in hash tbl */
2273 + int stblsize; /* No. entries in sfx tbl */
2274 + int ptblsize; /* No. entries in pfx tbl */
2275 + int sortval; /* Largest sort ID assigned */
2276 + int nstrchars; /* No. strchars defined */
2277 + int nstrchartype; /* No. strchar types */
2278 + int strtypestart; /* Start of strtype table */
2279 + char nrchars[5]; /* Nroff special characters */
2280 + char texchars[13]; /* TeX special characters */
2281 +#define TeXleftparen texchars[0]
2282 +#define TeXrightparen texchars[1]
2283 +#define TeXleftsquare texchars[2]
2284 +#define TeXrightsquare texchars[3]
2285 +#define TeXleftcurly texchars[4]
2286 +#define TeXrightcurly texchars[5]
2287 +#define TeXlefttangle texchars[6]
2288 +#define TeXrighttangle texchars[7]
2289 +#define TeXbackslash texchars[8]
2290 +#define TeXdollar texchars[9]
2291 +#define TeXstar texchars[10]
2292 +#define TeXdot texchars[11]
2293 +#define TeXpercent texchars[12]
2294 + char compoundflag; /* Compund-word handling */
2295 + char defhardflag; /* Default tryveryhard flag */
2296 + char flagmarker; /* "Start-of-flags" char */
2297 + unsigned short sortorder[SET_SIZE + MAXSTRINGCHARS]; /* Sort ordering */
2298 + ichar_t lowerconv[SET_SIZE + MAXSTRINGCHARS]; /* Lower-conversion table */
2299 + ichar_t upperconv[SET_SIZE + MAXSTRINGCHARS]; /* Upper-conversion table */
2300 + char wordchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for chars found in wrds */
2301 + char upperchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for uppercase chars */
2302 + char lowerchars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for lowercase chars */
2303 + char boundarychars[SET_SIZE + MAXSTRINGCHARS]; /* NZ for boundary chars */
2304 + char stringstarts[SET_SIZE]; /* NZ if char can start str */
2305 + char stringchars[MAXSTRINGCHARS][MAXSTRINGCHARLEN + 1]; /* String chars */
2306 + unsigned int stringdups[MAXSTRINGCHARS]; /* No. of "base" char */
2307 + int dupnos[MAXSTRINGCHARS]; /* Dup char ID # */
2308 + unsigned short magic2; /* Second magic for dbl chk */
2311 +/* hash table magic number */
2312 +#define SPELL_MAGIC 0x9602
2314 +/* compile options, put in the hash header for consistency checking */
2316 +# define MAGIC8BIT 0x01
2318 +# define MAGIC8BIT 0x00
2320 +#ifdef NO_CAPITALIZATION_SUPPORT
2321 +# define MAGICCAPITALIZATION 0x00
2323 +# define MAGICCAPITALIZATION 0x02
2326 +# define MAGICMASKSET 0x00
2328 +# if MASKBITS <= 64
2329 +# define MAGICMASKSET 0x04
2331 +# if MASKBITS <= 128
2332 +# define MAGICMASKSET 0x08
2334 +# define MAGICMASKSET 0x0C
2339 +#define COMPILEOPTIONS (MAGIC8BIT | MAGICCAPITALIZATION | MAGICMASKSET)
2342 + * Structure used to record data about successful lookups; these values
2343 + * are used in the ins_root_cap routine to produce correct capitalizations.
2347 + struct dent * dictent; /* Header of dict entry chain for wd */
2348 + struct flagent * prefix; /* Prefix flag used, or NULL */
2349 + struct flagent * suffix; /* Suffix flag used, or NULL */
2353 +** Offsets into the nroff special-character array
2355 +#define NRLEFTPAREN hashheader.nrchars[0]
2356 +#define NRRIGHTPAREN hashheader.nrchars[1]
2357 +#define NRDOT hashheader.nrchars[2]
2358 +#define NRBACKSLASH hashheader.nrchars[3]
2359 +#define NRSTAR hashheader.nrchars[4]
2362 +** Values for compoundflag
2364 +#define COMPOUND_NEVER 0 /* Compound words are never good */
2365 +#define COMPOUND_ANYTIME 1 /* Accept run-together words */
2366 +#define COMPOUND_CONTROLLED 2 /* Compounds controlled by afx flags */
2369 +** The isXXXX macros normally only check ASCII range, and don't support
2370 +** the character sets of other languages. These private versions handle
2371 +** whatever character sets have been defined in the affix files.
2373 +#define myupper(X) (hashheader.upperchars[(X)])
2374 +#define mylower(X) (hashheader.lowerchars[(X)])
2375 +#define myspace(X) (((X) > 0) && ((X) < 0x80) \
2376 + && isspace((unsigned char) (X)))
2377 +#define iswordch(X) (hashheader.wordchars[(X)])
2378 +#define isboundarych(X) (hashheader.boundarychars[(X)])
2379 +#define isstringstart(X) (hashheader.stringstarts[(unsigned char) (X)])
2380 +#define mytolower(X) (hashheader.lowerconv[(X)])
2381 +#define mytoupper(X) (hashheader.upperconv[(X)])
2384 +** These macros are similar to the ones above, but they take into account
2385 +** the possibility of string characters. Note well that they take a POINTER,
2386 +** not a character.
2388 +** The "l_" versions set "len" to the length of the string character as a
2389 +** handy side effect. (Note that the global "laststringch" is also set,
2390 +** and sometimes used, by these macros.)
2392 +** The "l1_" versions go one step further and guarantee that the "len"
2393 +** field is valid for *all* characters, being set to 1 even if the macro
2394 +** returns false. This macro is a great example of how NOT to write
2397 +#define isstringch(ptr, canon) (isstringstart (*(ptr)) \
2398 + && stringcharlen ((ptr), (canon)) > 0)
2399 +#define l_isstringch(ptr, len, canon) \
2400 + (isstringstart (*(ptr)) \
2401 + && (len = stringcharlen ((ptr), (canon))) \
2403 +#define l1_isstringch(ptr, len, canon) \
2405 + isstringstart (*(ptr)) \
2407 + stringcharlen ((ptr), (canon))) \
2409 + ? 1 : (len = 1, 0)))
2412 + * Sizes of buffers returned by ichartosstr/strtosichar.
2414 +#define ICHARTOSSTR_SIZE (INPUTWORDLEN + 4 * MAXAFFIXLEN + 4)
2415 +#define STRTOSICHAR_SIZE ((INPUTWORDLEN + 4 * MAXAFFIXLEN + 4) \
2416 + * sizeof (ichar_t))
2419 + * termcap variables
2422 +# define S_EXTERN /* nothing */
2425 +#define Global extern
2426 +# define S_EXTERN extern
2432 +S_EXTERN char * BC; /* backspace if not ^H */
2433 +S_EXTERN char * cd; /* clear to end of display */
2434 +S_EXTERN char * cl; /* clear display */
2435 +S_EXTERN char * cm; /* cursor movement */
2436 +S_EXTERN char * ho; /* home */
2437 +S_EXTERN char * nd; /* non-destructive space */
2438 +S_EXTERN char * so; /* standout */
2439 +S_EXTERN char * se; /* standout end */
2440 +S_EXTERN int sg; /* space taken by so/se */
2441 +S_EXTERN char * ti; /* terminal initialization sequence */
2442 +S_EXTERN char * te; /* terminal termination sequence */
2443 +S_EXTERN int li; /* lines */
2444 +S_EXTERN int co; /* columns */
2446 +S_EXTERN int contextsize; /* number of lines of context to show */
2447 +S_EXTERN char contextbufs[MAXCONTEXT][BUFSIZ]; /* Context of current line */
2448 +S_EXTERN int contextoffset; /* Offset of line start in contextbufs[0] */
2449 +S_EXTERN char * currentchar; /* Location in contextbufs */
2450 +S_EXTERN char ctoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Current token as char */
2451 +S_EXTERN ichar_t itoken[INPUTWORDLEN + MAXAFFIXLEN]; /* Ctoken as ichar_t str */
2453 +S_EXTERN char termcap[2048]; /* termcap entry */
2454 +S_EXTERN char termstr[2048]; /* for string values */
2455 +S_EXTERN char * termptr; /* pointer into termcap, used by tgetstr */
2457 +S_EXTERN int numhits; /* number of hits in dictionary lookups */
2458 +S_EXTERN struct success
2459 + hits[MAX_HITS]; /* table of hits gotten in lookup */
2461 +S_EXTERN char * hashstrings; /* Strings in hash table */
2462 +S_EXTERN struct hashheader
2463 + hashheader; /* Header of hash table */
2464 +S_EXTERN struct dent *
2465 + hashtbl; /* Main hash table, for dictionary */
2466 +S_EXTERN int hashsize; /* Size of main hash table */
2469 +S_EXTERN int aflag; /* NZ if -a or -A option specified */
2470 +S_EXTERN int cflag; /* NZ if -c (crunch) option */
2471 +S_EXTERN int lflag; /* NZ if -l (list) option */
2472 +S_EXTERN int incfileflag; /* whether xgets() acts exactly like gets() */
2473 +Global Logical nodictflag; /* NZ if dictionary not needed */
2475 +S_EXTERN int uerasechar; /* User's erase character, from stty */
2476 +S_EXTERN int ukillchar; /* User's kill character */
2478 +S_EXTERN unsigned int laststringch; /* Number of last string character */
2479 +S_EXTERN int defdupchar; /* Default duplicate string type */
2481 +S_EXTERN unsigned int numpflags; /* Number of prefix flags in table */
2482 +S_EXTERN unsigned int numsflags; /* Number of suffix flags in table */
2483 +S_EXTERN struct flagptr *pflagindex;
2484 + /* Fast index to pflaglist */
2485 +S_EXTERN struct flagent *pflaglist; /* Prefix flag control list */
2486 +S_EXTERN struct flagptr *sflagindex;
2487 + /* Fast index to sflaglist */
2488 +S_EXTERN struct flagent *sflaglist; /* Suffix flag control list */
2490 +S_EXTERN struct strchartype * /* String character type collection */
2493 +S_EXTERN FILE * infile; /* File being corrected */
2494 +S_EXTERN FILE * outfile; /* Corrected copy of infile */
2496 +S_EXTERN char * askfilename; /* File specified in -f option */
2498 +S_EXTERN int changes; /* NZ if changes made to cur. file */
2499 +S_EXTERN int readonly; /* NZ if current file is readonly */
2500 +S_EXTERN int quit; /* NZ if we're done with this file */
2502 +#define MAXPOSSIBLE 100 /* Max no. of possibilities to generate */
2504 +S_EXTERN char possibilities[MAXPOSSIBLE][INPUTWORDLEN + MAXAFFIXLEN];
2505 + /* Table of possible corrections */
2506 +S_EXTERN int pcount; /* Count of possibilities generated */
2507 +S_EXTERN int maxposslen; /* Length of longest possibility */
2508 +S_EXTERN int easypossibilities; /* Number of "easy" corrections found */
2509 + /* ..(defined as those using legal affixes) */
2511 +Global Logical inited;
2513 + * The following array contains a list of characters that should be tried
2514 + * in "missingletter." Note that lowercase characters are omitted.
2516 +S_EXTERN int Trynum; /* Size of "Try" array */
2517 +S_EXTERN ichar_t Try[SET_SIZE + MAXSTRINGCHARS];
2520 + * Initialized variables. These are generated using macros so that they
2521 + * may be consistently declared in all programs. Numerous examples of
2522 + * usage are given below.
2525 +#define S_INIT(decl, init) decl = init
2527 +#define S_INIT(decl, init) extern decl
2531 +S_INIT (int minimenusize, 2); /* MUST be either 2 or zero */
2532 +#else /* MINIMENU */
2533 +S_INIT (int minimenusize, 0); /* MUST be either 2 or zero */
2534 +#endif /* MINIMENU */
2536 +S_INIT (int eflag, 0); /* NZ for expand mode */
2537 +S_INIT (int dumpflag, 0); /* NZ to do dump mode */
2538 +S_INIT (int fflag, 0); /* NZ if -f specified */
2540 +S_INIT (int sflag, 0); /* NZ to stop self after EOF */
2542 +S_INIT (int vflag, 0); /* NZ to display characters as M-xxx */
2543 +S_INIT (int xflag, DEFNOBACKUPFLAG); /* NZ to suppress backups */
2544 +S_INIT (int deftflag, -1); /* NZ for TeX mode by default */
2545 +S_INIT (int tflag, DEFTEXFLAG); /* NZ for TeX mode in current file */
2546 +S_INIT (int prefstringchar, -1); /* Preferred string character type */
2548 +S_INIT (int terse, 0); /* NZ for "terse" mode */
2550 +S_INIT (char tempfile[MAXPATHLEN], ""); /* Name of file we're spelling into */
2552 +S_INIT (int minword, MINWORD); /* Longest always-legal word */
2553 +S_INIT (int sortit, 1); /* Sort suggestions alphabetically */
2554 +S_INIT (int compoundflag, -1); /* How to treat compounds: see above */
2555 +S_INIT (int tryhardflag, -1); /* Always call tryveryhard */
2557 +S_INIT (char * currentfile, NULL); /* Name of current input file */
2559 +/* Odd numbers for math mode in LaTeX; even for LR or paragraph mode */
2560 +S_INIT (int math_mode, 0);
2561 +/* P -- paragraph or LR mode
2562 + * b -- parsing a \begin statement
2563 + * e -- parsing an \end statement
2564 + * r -- parsing a \ref type of argument.
2565 + * m -- looking for a \begin{minipage} argument.
2567 +S_INIT (char LaTeX_Mode, 'P');
2569 +#include "i_proto.h"
2570 diff -Nur vim61.orig/src/spell/local.h vim61/src/spell/local.h
2571 --- vim61.orig/src/spell/local.h Thu Jan 1 01:00:00 1970
2572 +++ vim61/src/spell/local.h Wed Mar 27 15:08:08 2002
2575 + * Written by Eli Zaretskii <eliz@is.elta.co.il>
2577 + * This is local.h file suitable for compiling Ispell on MS-DOS systems
2578 + * with version 2.x of DJGPP port of GNU C/C++ compiler.
2586 + * WARNING WARNING WARNING
2588 + * This file is *NOT* a normal C header file! Although it uses C
2589 + * syntax and is included in C programs, it is also processed by shell
2590 + * scripts that are very stupid about format.
2592 + * Do not try to use #if constructs to configure this file for more
2593 + * than one configuration. Do not place whitespace after the "#" in
2594 + * "#define". Do not attempt to disable lines by commenting them out.
2595 + * Do not use backslashes to reduce the length of long lines.
2596 + * None of these things will work the way you expect them to.
2598 + * WARNING WARNING WARNING
2602 +** Things that normally go in a Makefile. Define these just like you
2603 +** might in the Makefile, except you should use #define instead of
2604 +** make's assignment syntax. Everything must be double-quoted, and
2605 +** (unlike make) you can't use any sort of $-syntax to pick up the
2606 +** values of other definitions.
2610 +#define CFLAGS "-O2 -g"
2611 +#define YACC "bison -y"
2614 +** TERMLIB - DJGPP doesn't have one, it uses direct screen writes.
2619 +** Where to install various components of ispell. BINDIR contains
2620 +** binaries. LIBDIR contains hash tables and affix files. ELISPDIR
2621 +** contains emacs lisp files (if any) and TEXINFODIR contains emacs
2622 +** TeXinfo files. MAN1DIR and MAN1EXT will hold the chapter-1 and
2623 +** chapter-4 manual pages, respectively.
2625 +** If you intend to use multiple dictionary files, I would suggest
2626 +** LIBDIR be a directory which will contain nothing else, so sensible
2627 +** names can be constructed for the -d option without conflict.
2629 +#define BINDIR "/usr/bin"
2630 +#define LIBDIR "/usr/lib/ispell"
2631 +#define ELISPDIR "/usr/lib/emacs/site-lisp"
2632 +#define TEXINFODIR "/usr/share/info"
2633 +#define MAN1DIR "/usr/share/man/man1"
2634 +#define MAN4DIR "/usr/share/man/man4"
2637 +** List of all hash files (languages) which will be supported by ispell.
2639 +** This variable has a complex format so that many options can be
2640 +** specified. The format is as follows:
2642 +** <language>[,<make-options>...] [<language> [,<make-options> ...] ...]
2646 +** language is the name of a subdirectory of the
2647 +** "languages" directory
2648 +** make-options are options that are to be passed to "make" in
2649 +** the specified directory. The make-options
2650 +** should not, in general, specify a target, as
2651 +** this will be provided by the make process.
2653 +** For example, if LANGUAGES is:
2655 +** "{american,EXTRADICT=/usr/dict/words /usr/dict/web2} {deutsch}",
2657 +** then the American-English and Deutsch (German) languages will be supported,
2658 +** and when the English dictionary is built, the variable
2659 +** 'EXTRADICT=/usr/dict/words /usr/dict/web2' will be passed to the makefile.
2661 +** Notes on the syntax: The makefile is not very robust. If you have
2662 +** make problems, or if make seems to in the language-subdirs
2663 +** dependency, check your syntax. The makefile adds single quotes to
2664 +** the individual variables in the LANGUAGES specification, so don't
2665 +** use quotes of any kind.
2667 +** In the future, the first language listed in this variable will
2668 +** become the default, and the DEFHASH, DEFLANG, and DEFPAFF,
2669 +** variables will all become obsolete. So be sure to put your default
2670 +** language first, to make later conversion easier!
2672 +** Notes on options for the various languages will be found in the
2673 +** Makefiles for those languages. Some of those languages may require
2674 +** you to also change various limits limits like MASKBITS or the
2675 +** length parameters.
2677 +** A special note on the English language: because the British and
2678 +** American dialects use different spelling, you should usually select
2679 +** one or the other of these. If you select both, the setting of
2680 +** MASTERHASH will determine which becomes the language linked to
2681 +** DEFHASH (which will usually be named english.hash).
2683 +** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2684 +** !!! Note the pathname for the `words' file: it might be different !!!
2685 +** !!! If you don't have this file, make EXTRADICT empty !!!
2686 +** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2688 +#define LANGUAGES "{american,MASTERDICTS=americax.med,HASHFILES=amermedx.hash,EXTRADICT=/usr/lib/ispell/words}"
2691 +** Master hash file for DEFHASH. This is the name of a hash file
2692 +** built by a language Makefile. It should be the most-popular hash
2693 +** file on your system, because it is the one that will be used by
2694 +** default. It must be listed in LANGUAGES, above.
2696 +#define MASTERHASH "polish.hash"
2699 +** Default native-language hash file. This is the name given to the
2700 +** hash table that will be used if no language is specified to
2701 +** ispell. It is a link to MASTERHASH, above.
2703 +#define DEFHASH "polish.hash"
2706 +** If your sort command accepts the -T switch to set temp file
2707 +** locations (try it out; on some systems it exists but is
2708 +** undocumented), make the following variable the null string.
2709 +** Otherwise leave it as the sed script.
2711 +** With DJGPP, you will probably use GNU Sort which accepts -T, so:
2716 +** If your system has the rename(2) system call, define HAS_RENAME and
2717 +** ispell will use that call to rename backup files. Otherwise, it
2718 +** will use link/unlink. There is no harm in this except on MS-DOS,
2719 +** which might not support link/unlink (DJGPP does, but also has rename).
2721 +#define HAS_RENAME 1
2723 +/* environment variable for user's word list */
2725 +#define PDICTVAR "WORDLIST"
2729 +** Prefix part of default private dictionary. Under MS-DOS 8.3
2730 +** filename limitation, we are in trouble...
2732 +#define DEFPDICT ".ispell_"
2734 +/* old place to look for default word list */
2735 +#define OLDPDICT ".isp."
2738 +** mktemp template for temporary file - MUST contain 6 consecutive X's.
2739 +** On MSDOS the directory part of TEMPNAME is only used if neither $TMP
2740 +** nor $TEMP nor $TMPDIR (in that order) are defined. If any of these
2741 +** variables is defined, the filename part of TEMPNAME is appended to
2744 +#define TEMPNAME "/tmp/isXXXXXX"
2747 +** If REGEX_LOOKUP is NOT defined, the lookup command (L) will use the look(1)
2748 +** command (if available) or the egrep command. If REGEX_LOOKUP is defined,
2749 +** the lookup command will use the internal dictionary and the
2750 +** regular-expression library (which you must supply separately.
2751 +** DJGPP v2 has POSIX regexp functions.
2753 +#ifndef FEAT_SPELL_HL
2754 +#define REGEX_LOOKUP 1
2758 +** Choose the proper type of regular-expression routines here. BSD
2759 +** and public-domain systems have routines called re_comp and re_exec;
2760 +** System V uses regcmp and regex.
2762 +#include <sys/types.h>
2764 +#define REGCTYPE regex_t *
2765 +#define REGCMP(re,str) (regcomp (re, str, 0), re)
2766 +#define REGEX(re, str, dummy) \
2767 + (re != 0 && regexec (re, str, 0, 0, 0) == 0 ? (char *)1 : NULL)
2768 +#define REGFREE(re) \
2771 + re = (regex_t *)calloc (1, sizeof (regex_t)); \
2778 +** The 2 following definitions are only meaningfull if you don't use
2779 +** any regex library.
2781 +/* path to egrep (use speeded up version if available);
2782 + defined without explicit path, since there are no
2783 + standard places for programs on MS-DOS. */
2784 +#define EGREPCMD "egrep -i"
2786 +/* path to wordlist for Lookup command (typically /usr/dict/{words|web2}) */
2787 +/* note that /usr/dict/web2 is usually a bad idea due to obscure words */
2791 +** FIXME: The filename truncation below is not flexible enough for DJGPP
2792 +** which can support long filenames on some platforms, since we
2793 +** will only know if the support is available at runtime.
2796 +/* max file name length (will truncate to fit BAKEXT) if not in sys/param.h */
2798 +#define MAXNAMLEN NAME_MAX
2800 +#define MAXNAMLEN 12
2803 +#define MAXEXTLEN 4 /* max. extension length including '.' */
2804 +#define MAXBASENAMELEN 8 /* max. base filename length without ext */
2806 +/* define if you want .bak file names truncated to MAXNAMLEN characters */
2807 +/* On MS-DOS, we really have no choice... */
2808 +#define TRUNCATEBAK 1
2811 +** This is the extension that will be added to backup files.
2812 +** On MS-DOS, it makes sense to use the shortest possible extension.
2817 +** Define the following to suppress the 8-bit character feature.
2818 +** FIXME: does this defeat support of foreign languages?
2820 +/*#define NO8BIT 1 */
2826 +** Define this if you want to use the shell for interpretation of commands
2827 +** issued via the "L" command, "^Z" under System V, and "!". If this is
2828 +** not defined then a direct spawnvp() will be used in place of the
2829 +** normal system(). This may speed up these operations if the SHELL
2830 +** environment variable points to a Unix-like shell (such as `sh' or `bash').
2832 +** However, if you undefine USESH, commands which use pipes, redirection
2833 +** and shell wildcards won't work, and you will need support for the SIGTSTP
2834 +** signal, for the above commands to work at all.
2840 +** Define this if you want to be able to type any command at a "type space
2841 +** to continue" prompt.
2843 +#define COMMANDFORSPACE 1
2846 +** The next three variables are used to provide a variable-size context
2847 +** display at the bottom of the screen. Normally, the user will see
2848 +** a number of lines equal to CONTEXTPCT of his screen, rounded down
2849 +** (thus, with CONTEXTPCT == 10, a 24-line screen will produce two lines
2850 +** of context). The context will never be greater than MAXCONTEXT or
2851 +** less than MINCONTEXT. To disable this feature entirely, set MAXCONTEXT
2852 +** and MINCONTEXT to the same value. To round context percentages up,
2853 +** define CONTEXTROUNDUP.
2855 +** Warning: don't set MAXCONTEXT ridiculously large. There is a
2856 +** static buffer of size MAXCONTEXT*BUFSIZ; since BUFSIZ is frequently
2857 +** 1K or larger, this can create a remarkably large executable.
2859 +#define CONTEXTPCT 20 /* Use 20% of the screen for context */
2860 +#define MINCONTEXT 2 /* Always show at least 2 lines of context */
2861 +#define MAXCONTEXT 10 /* Never show more than 10 lines of context */
2862 +#define CONTEXTROUNDUP 1 /* Round context up */
2865 +** Define this if you want the "mini-menu," which gives the most important
2866 +** options at the bottom of the screen, to be the default (in any case, it
2867 +** can be controlled with the "-M" switch).
2872 +** Redefine GETKEYSTROKE() to whatever appropriate on some MS-DOS systems
2873 +** where getchar() doesn't operate properly in raw mode.
2878 +#define GETKEYSTROKE() getxkey()
2880 +#define GETKEYSTROKE() getchar()
2884 +** We include <fcntl.h> to have the definition of O_BINARY. The
2885 +** configuration script will notice this and define MSDOS_BINARY_OPEN.
2890 +** Environment variable to use to locate the home directory. On DOS
2891 +** systems we set this to ISPELL_HOME to avoid conflicts with
2892 +** other programs that look for a HOME environment variable. We're not on DOS.
2894 +#define HOME "HOME"
2895 +#define PDICTHOME "."
2896 +#define OPTIONVAR "ISPELL_OPTIONS"
2897 +#define LIBRARYVAR "ISPELL_DICTDIR"
2900 +** On MS-DOS systems, we define the following variables so that
2901 +** ispell's files have legal suffixes. Note that these suffixes
2902 +** must agree with the way you've defined dictionary files which
2903 +** incorporate these suffixes.
2905 +** Actually, it is not recommended at all to change the suffixes,
2906 +** since they are hardwired in the Makefile's under languages/
2907 +** subdirectory, and MS-DOS will silently truncate excess letters anyway.
2909 +#define HASHSUFFIX ".hash"
2910 +#define STATSUFFIX ".sta"
2911 +#define COUNTSUFFIX ".cnt"
2912 diff -Nur vim61.orig/src/spell/lookup.c vim61/src/spell/lookup.c
2913 --- vim61.orig/src/spell/lookup.c Thu Jan 1 01:00:00 1970
2914 +++ vim61/src/spell/lookup.c Wed Mar 27 15:08:08 2002
2917 +static char Rcs_Id[] =
2922 + * lookup.c - see if a word appears in the dictionary
2924 + * Pace Willisson, 1983
2926 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
2927 + * All rights reserved.
2929 + * Redistribution and use in source and binary forms, with or without
2930 + * modification, are permitted provided that the following conditions
2933 + * 1. Redistributions of source code must retain the above copyright
2934 + * notice, this list of conditions and the following disclaimer.
2935 + * 2. Redistributions in binary form must reproduce the above copyright
2936 + * notice, this list of conditions and the following disclaimer in the
2937 + * documentation and/or other materials provided with the distribution.
2938 + * 3. All modifications to the source code must be clearly marked as
2939 + * such. Binary redistributions based on modified source code
2940 + * must be clearly marked as modified versions in the documentation
2941 + * and/or other materials provided with the distribution.
2942 + * 4. All advertising materials mentioning features or use of this software
2943 + * must display the following acknowledgment:
2944 + * This product includes software developed by Geoff Kuenning and
2945 + * other unpaid contributors.
2946 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
2947 + * products derived from this software without specific prior
2948 + * written permission.
2950 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
2951 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2952 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2953 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
2954 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2955 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2956 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2957 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2958 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2959 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2965 + * Revision 1.42 1995/01/08 23:23:42 geoff
2966 + * Support MSDOS_BINARY_OPEN when opening the hash file to read it in.
2968 + * Revision 1.41 1994/01/25 07:11:51 geoff
2969 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
2973 +#include "ispell.h"
2975 +#include <stdlib.h>
2982 +Local void dumpindex (struct flagptr * indexp, int depth);
2983 +#endif /* INDEXDUMP */
2985 +Public Logical inited = False;
2990 +linit (char * hashname)
2994 + register struct dent * dp;
2995 + struct flagent * entry;
2996 + struct flagptr * ind;
2999 + register ichar_t * cp;
3004 + if(hashtbl != NULL)
3008 + if(pflagindex != NULL)
3010 + pflagindex = NULL;
3011 + if(sflagindex != NULL)
3013 + sflagindex = NULL;
3014 + if((pflagindex = (struct flagptr *)calloc(SET_SIZE + MAXSTRINGCHARS,
3015 + sizeof(struct flagptr))) == NULL)
3017 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3020 + if((sflagindex = (struct flagptr *)calloc(SET_SIZE + MAXSTRINGCHARS,
3021 + sizeof(struct flagptr))) == NULL)
3023 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3027 + if ((hashfd = open (hashname, 0 | MSDOS_BINARY_OPEN)) < 0)
3029 + (void) sprintf(err_buf, CANT_OPEN, hashname);
3033 + hashsize = read (hashfd, (char *) &hashheader, sizeof hashheader);
3034 + if (hashsize < sizeof hashheader)
3037 + (void) sprintf(err_buf, LOOKUP_C_CANT_READ, hashname);
3038 + else if (hashsize == 0)
3039 + (void) sprintf(err_buf, LOOKUP_C_NULL_HASH, hashname);
3041 + (void) sprintf(err_buf, LOOKUP_C_SHORT_HASH (hashname, hashsize,
3042 + (int) sizeof hashheader));
3043 + (void) close (hashfd);
3046 + else if (hashheader.magic != SPELL_MAGIC)
3048 + (void) sprintf(err_buf,
3049 + LOOKUP_C_BAD_MAGIC (hashname, (unsigned int) SPELL_MAGIC,
3050 + (unsigned int) hashheader.magic));
3051 + (void) close (hashfd);
3054 + else if (hashheader.magic2 != SPELL_MAGIC)
3056 + (void) sprintf(err_buf,
3057 + LOOKUP_C_BAD_MAGIC2 (hashname, (unsigned int) SPELL_MAGIC,
3058 + (unsigned int) hashheader.magic2));
3059 + (void) close (hashfd);
3062 + else if (hashheader.compileoptions != COMPILEOPTIONS
3063 + || hashheader.maxstringchars != MAXSTRINGCHARS
3064 + || hashheader.maxstringcharlen != MAXSTRINGCHARLEN)
3066 + (void) sprintf(err_buf,
3067 + LOOKUP_C_BAD_OPTIONS ((unsigned int) hashheader.compileoptions,
3068 + hashheader.maxstringchars, hashheader.maxstringcharlen,
3069 + (unsigned int) COMPILEOPTIONS, MAXSTRINGCHARS, MAXSTRINGCHARLEN));
3070 + (void) close (hashfd);
3076 + * Dictionary is not needed - create an empty dummy table. We
3077 + * actually have to have one entry since the hash
3078 + * algorithm involves a divide by the table size
3079 + * (actually modulo, but zero is still unacceptable).
3080 + * So we create an empty entry.
3082 + hashsize = 1; /* This prevents divides by zero */
3083 + hashtbl = (struct dent *) calloc (1, sizeof (struct dent));
3084 + if (hashtbl == NULL)
3086 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3087 + (void) close (hashfd);
3090 + hashtbl[0].word = NULL;
3091 + hashtbl[0].next = NULL;
3092 + hashtbl[0].flagfield &= ~(USED | KEEP);
3093 + /* The flag bits don't matter, but calloc cleared them. */
3094 + if(hashstrings != NULL)
3095 + free(hashstrings);
3096 + if((hashstrings = (char *) calloc (1, (unsigned) hashheader.lstringsize))
3099 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3100 + (void) close (hashfd);
3106 + if(hashtbl != NULL)
3108 + if((hashtbl = (struct dent *)
3109 + malloc ((unsigned) hashheader.tblsize * sizeof (struct dent))) == NULL)
3111 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3112 + (void) close (hashfd);
3115 + hashsize = hashheader.tblsize;
3116 + if(hashstrings != NULL)
3117 + free(hashstrings);
3118 + if((hashstrings = (char *) malloc ((unsigned) hashheader.stringsize)) == NULL)
3120 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3121 + (void) close (hashfd);
3125 + numsflags = hashheader.stblsize;
3126 + numpflags = hashheader.ptblsize;
3127 + if(sflaglist != NULL)
3129 + if((sflaglist = (struct flagent *)
3130 + malloc ((numsflags + numpflags) * sizeof (struct flagent))) == NULL)
3132 + (void) sprintf(err_buf, LOOKUP_C_NO_HASH_SPACE);
3133 + (void) close (hashfd);
3136 + pflaglist = sflaglist + numsflags;
3141 + * Read just the strings for the language table, and
3142 + * skip over the rest of the strings and all of the
3145 + if (read (hashfd, hashstrings, (unsigned) hashheader.lstringsize)
3146 + != hashheader.lstringsize)
3148 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3149 + (void) close (hashfd);
3152 + (void) lseek (hashfd,
3153 + (long) hashheader.stringsize - (long) hashheader.lstringsize
3154 + + (long) hashheader.tblsize * (long) sizeof (struct dent), 1);
3158 + if ((unsigned int)read (hashfd, hashstrings,
3159 + (unsigned int) hashheader.stringsize) != hashheader.stringsize
3160 + || (unsigned int)read (hashfd, (char *) hashtbl, (unsigned)
3161 + hashheader.tblsize * sizeof (struct dent))
3162 + != (unsigned int) hashheader.tblsize * sizeof (struct dent))
3164 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3165 + (void) close (hashfd);
3169 + if ((unsigned int)read (hashfd, (char *) sflaglist,
3170 + (unsigned int) (numsflags + numpflags) * sizeof (struct flagent))
3171 + != (unsigned int)(numsflags + numpflags) * sizeof (struct flagent))
3173 + (void) sprintf(err_buf, LOOKUP_C_BAD_FORMAT);
3174 + (void) close (hashfd);
3177 + (void) close (hashfd);
3181 + for (i = hashsize, dp = hashtbl; --i >= 0; dp++)
3183 + if (dp->word == (char *) -1)
3186 + dp->word = &hashstrings [ (int)(dp->word) ];
3187 + if (dp->next == (struct dent *) -1)
3190 + dp->next = &hashtbl [ (int)(dp->next) ];
3194 + for (i = numsflags + numpflags, entry = sflaglist; --i >= 0; entry++)
3196 + if (entry->stripl)
3197 + entry->strip = (ichar_t *) &hashstrings[(int) entry->strip];
3199 + entry->strip = NULL;
3201 + entry->affix = (ichar_t *) &hashstrings[(int) entry->affix];
3203 + entry->affix = NULL;
3206 + ** Warning - 'entry' and 'i' are reset in the body of the loop
3207 + ** below. Don't try to optimize it by (e.g.) moving the decrement
3208 + ** of i into the loop condition.
3210 + for (i = numsflags, entry = sflaglist; i > 0; i--, entry++)
3212 + if (entry->affl == 0)
3215 + ind = &sflagindex[0];
3220 + cp = entry->affix + entry->affl - 1;
3221 + ind = &sflagindex[*cp];
3223 + while (ind->numents == 0 && ind->pu.fp != NULL)
3225 + if (cp == entry->affix)
3227 + ind = &ind->pu.fp[0];
3232 + ind = &ind->pu.fp[*--cp];
3237 + if (ind->numents == 0)
3238 + ind->pu.ent = entry;
3241 + ** If this index entry has more than MAXSEARCH flags in
3242 + ** it, we will split it into subentries to reduce the
3243 + ** searching. However, the split doesn't make sense in
3244 + ** two cases: (a) if we are already at the end of the
3245 + ** current affix, or (b) if all the entries in the list
3246 + ** have identical affixes. Since the list is sorted, (b)
3247 + ** is true if the first and last affixes in the list
3250 + if (!viazero && ind->numents >= MAXSEARCH &&
3251 + icharcmp (entry->affix, ind->pu.ent->affix) != 0)
3253 + /* Sneaky trick: back up and reprocess */
3254 + entry = ind->pu.ent - 1; /* -1 is for entry++ in loop */
3255 + i = numsflags - (entry - sflaglist);
3256 + if((ind->pu.fp = (struct flagptr *)
3257 + calloc ((unsigned) (SET_SIZE + hashheader.nstrchars),
3258 + sizeof (struct flagptr))) == NULL)
3260 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3267 + ** Warning - 'entry' and 'i' are reset in the body of the loop
3268 + ** below. Don't try to optimize it by (e.g.) moving the decrement
3269 + ** of i into the loop condition.
3271 + for (i = numpflags, entry = pflaglist; i > 0; i--, entry++)
3273 + if (entry->affl == 0)
3276 + ind = &pflagindex[0];
3281 + cp = entry->affix;
3282 + ind = &pflagindex[*cp++];
3284 + while (ind->numents == 0 && ind->pu.fp != NULL)
3288 + ind = &ind->pu.fp[0];
3293 + ind = &ind->pu.fp[*cp++];
3298 + if (ind->numents == 0)
3299 + ind->pu.ent = entry;
3302 + ** If this index entry has more than MAXSEARCH flags in
3303 + ** it, we will split it into subentries to reduce the
3304 + ** searching. However, the split doesn't make sense in
3305 + ** two cases: (a) if we are already at the end of the
3306 + ** current affix, or (b) if all the entries in the list
3307 + ** have identical affixes. Since the list is sorted, (b)
3308 + ** is true if the first and last affixes in the list
3311 + if (!viazero && ind->numents >= MAXSEARCH
3312 + && icharcmp (entry->affix, ind->pu.ent->affix) != 0)
3314 + /* Sneaky trick: back up and reprocess */
3315 + entry = ind->pu.ent - 1; /* -1 is for entry++ in loop */
3316 + i = numpflags - (entry - pflaglist);
3318 + (struct flagptr *) calloc (SET_SIZE + hashheader.nstrchars,
3319 + sizeof (struct flagptr));
3320 + if (ind->pu.fp == NULL)
3322 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3329 + (void) sprintf(err_buf, "Prefix index table:");
3330 + dumpindex (pflagindex, 0);
3331 + (void) sprintf(err_buf, "Suffix index table:");
3332 + dumpindex (sflagindex, 0);
3334 + if (hashheader.nstrchartype == 0)
3338 + chartypes = (struct strchartype *)
3339 + calloc (1, hashheader.nstrchartype * sizeof (struct strchartype));
3340 + if (chartypes == NULL)
3342 + (void) sprintf(err_buf, LOOKUP_C_NO_LANG_SPACE);
3345 + for (i = 0, nextchar = hashheader.strtypestart;
3346 + i < hashheader.nstrchartype; i++)
3348 + chartypes[i].name = &hashstrings[nextchar];
3349 + nextchar += strlen (chartypes[i].name) + 1;
3350 + chartypes[i].deformatter = &hashstrings[nextchar];
3351 + nextchar += strlen (chartypes[i].deformatter) + 1;
3352 + chartypes[i].suffixes = &hashstrings[nextchar];
3353 + while (hashstrings[nextchar] != '\0')
3354 + nextchar += strlen (&hashstrings[nextchar]) + 1;
3365 + register struct flagptr * indexp,
3366 + register int depth)
3371 + char stripbuf[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
3373 + for (i = 0; i < SET_SIZE + hashheader.nstrchars; i++, indexp++)
3375 + if (indexp->numents == 0 && indexp->pu.fp != NULL)
3377 + for (j = depth; --j >= 0; )
3378 + (void) putc (' ', stderr);
3379 + if (i >= ' ' && i <= '~')
3380 + (void) putc (i, stderr);
3382 + (void) fprintf (stderr, "0x%x", i);
3383 + (void) putc ('\n', stderr);
3384 + dumpindex (indexp->pu.fp, depth + 1);
3386 + else if (indexp->numents)
3388 + for (j = depth; --j >= 0; )
3389 + (void) putc (' ', stderr);
3390 + if (i >= ' ' && i <= '~')
3391 + (void) putc (i, stderr);
3393 + (void) fprintf (stderr, "0x%x", i);
3394 + (void) fprintf (stderr, " -> %d entries\n", indexp->numents);
3395 + for (k = 0; k < indexp->numents; k++)
3397 + for (j = depth; --j >= 0; )
3398 + (void) putc (' ', stderr);
3399 + if (indexp->pu.ent[k].stripl)
3401 + (void) ichartostr (stripbuf, indexp->pu.ent[k].strip,
3402 + sizeof stripbuf, 1);
3403 + (void) fprintf (stderr, " entry %d (-%s,%s)\n",
3404 + &indexp->pu.ent[k] - sflaglist,
3406 + indexp->pu.ent[k].affl
3407 + ? ichartosstr (indexp->pu.ent[k].affix, 1) : "-");
3410 + (void) fprintf (stderr, " entry %d (%s)\n",
3411 + &indexp->pu.ent[k] - sflaglist,
3412 + ichartosstr (indexp->pu.ent[k].affix, 1));
3419 +/* n is length of s */
3420 +Public struct dent *
3421 +lookup (register ichar_t *s, int dotree)
3424 + register struct dent * dp;
3425 + register char * s1;
3426 + char schar[INPUTWORDLEN + MAXAFFIXLEN];
3428 + dp = &hashtbl[hash (s, hashsize)];
3429 + if (ichartostr (schar, s, sizeof schar, 1))
3430 + (void) fprintf (stderr, WORD_TOO_LONG (schar));
3431 + for ( ; dp != NULL; dp = dp->next)
3433 + /* quick strcmp, but only for equality */
3435 + if (s1 && s1[0] == schar[0] && strcmp (s1 + 1, schar + 1) == 0)
3437 +#ifndef NO_CAPITALIZATION_SUPPORT
3438 + while (dp->flagfield & MOREVARIANTS) /* Skip variations */
3444 + dp = treelookup (s);
3450 diff -Nur vim61.orig/src/spell/makedent.c vim61/src/spell/makedent.c
3451 --- vim61.orig/src/spell/makedent.c Thu Jan 1 01:00:00 1970
3452 +++ vim61/src/spell/makedent.c Wed Mar 27 15:08:08 2002
3455 + * Copyright 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
3456 + * All rights reserved.
3458 + * Redistribution and use in source and binary forms, with or without
3459 + * modification, are permitted provided that the following conditions
3462 + * 1. Redistributions of source code must retain the above copyright
3463 + * notice, this list of conditions and the following disclaimer.
3464 + * 2. Redistributions in binary form must reproduce the above copyright
3465 + * notice, this list of conditions and the following disclaimer in the
3466 + * documentation and/or other materials provided with the distribution.
3467 + * 3. All modifications to the source code must be clearly marked as
3468 + * such. Binary redistributions based on modified source code
3469 + * must be clearly marked as modified versions in the documentation
3470 + * and/or other materials provided with the distribution.
3471 + * 4. All advertising materials mentioning features or use of this software
3472 + * must display the following acknowledgment:
3473 + * This product includes software developed by Geoff Kuenning and
3474 + * other unpaid contributors.
3475 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
3476 + * products derived from this software without specific prior
3477 + * written permission.
3479 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
3480 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3481 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3482 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
3483 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3484 + * DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3485 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3486 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3487 + * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3488 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3494 + * Revision 1.45 1994/12/27 23:08:52 geoff
3495 + * Add code to makedent to reject words that contain non-word characters.
3496 + * This helps protect people who use ISO 8-bit characters when ispell
3497 + * isn't configured for that option.
3499 + * Revision 1.44 1994/10/25 05:46:20 geoff
3500 + * Fix some incorrect declarations in the lint versions of some routines.
3502 + * Revision 1.43 1994/09/16 03:32:34 geoff
3503 + * Issue an error message for bad affix flags
3505 + * Revision 1.42 1994/02/07 04:23:43 geoff
3506 + * Correctly identify the deformatter when changing file types
3508 + * Revision 1.41 1994/01/25 07:11:55 geoff
3509 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
3513 +#include "ispell.h"
3514 +#include <stdlib.h>
3517 +Global int makedent(char * lbuf, int lbuflen, struct dent * ent);
3518 +#ifndef NO_CAPITALIZATION_SUPPORT
3519 +Global long whatcap(ichar_t * word);
3521 +Global int addvheader(struct dent * ent);
3522 +Global int combinecaps(struct dent * hdr, struct dent * newent);
3523 +#ifndef NO_CAPITALIZATION_SUPPORT
3524 +Local void forcevheader(struct dent * hdrp, struct dent * oldp,
3525 + struct dent * newp);
3526 +#endif /* NO_CAPITALIZATION_SUPPORT */
3527 +Local int combine_two_entries(struct dent * hdrp,
3528 + struct dent * oldp, struct dent * newp);
3529 +Local int acoversb(struct dent * enta, struct dent * entb);
3530 +Global void upcase(ichar_t * string);
3531 +Global void lowcase(ichar_t * string);
3532 +Global void chupcase(char * s);
3533 +Local int issubset(struct dent * ent1, struct dent * ent2);
3534 +Local void combineaffixes(struct dent * ent1, struct dent * ent2);
3535 +Global void toutent(FILE * outfile, struct dent * hent, int onlykeep);
3536 +Local void toutword(FILE * outfile, char * word, struct dent * cent);
3537 +Local void flagout(FILE * outfile, int flag);
3538 +Global int stringcharlen(char * bufp, int canonical);
3539 +Global int strtoichar(ichar_t * out, char * in, int outlen,
3541 +Global int ichartostr(char * out, ichar_t * in, int outlen,
3543 +Global ichar_t * strtosichar(char * in, int canonical);
3544 +Global char * ichartosstr(ichar_t * in, int canonical);
3545 +Global char * printichar(int in);
3546 +#ifndef ICHAR_IS_CHAR
3547 +Global ichar_t * icharcpy(ichar_t * out, ichar_t * in);
3548 +Global int icharlen(ichar_t * str);
3549 +Global int icharcmp(ichar_t * s1, ichar_t * s2);
3550 +Global int icharncmp(ichar_t * s1, ichar_t * s2, int n);
3551 +#endif /* ICHAR_IS_CHAR */
3552 +Global int findfiletype(char * name, int searchnames,
3553 + int * deformatter);
3555 +Local Logical has_marker;
3558 + * Fill in a directory entry, including setting the capitalization flags, and
3559 + * allocate and initialize memory for the d->word field. Returns -1
3560 + * if there was trouble. The input word must be in canonical form.
3569 + ichar_t ibuf[INPUTWORDLEN + MAXAFFIXLEN];
3575 + /* Strip off any trailing newline */
3576 + len = strlen(lbuf) - 1;
3577 + if(lbuf[len] == '\n')
3581 + /* WARNING: flagfield might be the same as mask! See ispell.h. */
3583 + (void) bzero ((char *) d->mask, sizeof (d->mask));
3584 + d->flagfield |= USED;
3585 + d->flagfield &= ~KEEP;
3587 + p = index(lbuf, hashheader.flagmarker);
3592 + ** Convert the word to an ichar_t and back; this makes sure that
3593 + ** it is in canonical form and thus that the length is correct.
3595 + if(strtoichar(ibuf, lbuf, INPUTWORDLEN * sizeof (ichar_t), 1)
3596 + || ichartostr(lbuf, ibuf, lbuflen, 1))
3598 + (void) fprintf(stderr, WORD_TOO_LONG (lbuf));
3602 + ** Make sure the word is well-formed(contains only legal characters).
3604 + for(ip = ibuf; *ip != 0; ip++)
3606 + if(!iswordch(*ip))
3608 + /* Boundary characters are legal as long as they're not at edges */
3609 + if(!isboundarych(*ip) || ip == ibuf || ip[1] == 0)
3611 + (void) fprintf(stderr, MAKEDENT_C_BAD_WORD_CHAR, lbuf);
3616 + len = strlen(lbuf);
3617 +#ifndef NO_CAPITALIZATION_SUPPORT
3619 + ** Figure out the capitalization rules from the capitalization of
3620 + ** the sample entry.
3622 + d->flagfield |= whatcap(ibuf);
3625 + if(len > INPUTWORDLEN - 1)
3627 + (void) fprintf(stderr, WORD_TOO_LONG (lbuf));
3631 + d->word = malloc((unsigned) len + 1);
3632 + if(d->word == NULL)
3634 + (void) fprintf(stderr, MAKEDENT_C_NO_WORD_SPACE, lbuf);
3638 + (void) strcpy (d->word, lbuf);
3639 +#ifdef NO_CAPITALIZATION_SUPPORT
3640 + chupcase(d->word);
3641 +#else /* NO_CAPITALIZATION_SUPPORT */
3642 + if(captype(d->flagfield) != FOLLOWCASE)
3643 + chupcase(d->word);
3644 +#endif /* NO_CAPITALIZATION_SUPPORT */
3649 + while(*p != '\0' && *p != '\n')
3651 + bit = CHARTOBIT((unsigned char) *p);
3652 + if(bit >= 0 && bit <= LARGESTFLAG)
3653 + SETMASKBIT(d->mask, bit);
3655 + (void) fprintf (stderr, BAD_FLAG, (unsigned char) *p);
3657 + if(*p == hashheader.flagmarker)
3658 + p++; /* Handle old-format dictionaries too */
3663 +#ifndef NO_CAPITALIZATION_SUPPORT
3665 +** Classify the capitalization of a sample entry. Returns one of the
3666 +** four capitalization codes ANYCASE, ALLCAPS, CAPITALIZED, or FOLLOWCASE.
3670 +whatcap(register ichar_t * word)
3672 + register ichar_t * p;
3674 + for(p = word; *p; p++)
3689 + ** No uppercase letters follow the lowercase ones.
3690 + ** If there is more than one uppercase letter, it's
3691 + ** "followcase". If only the first one is capitalized,
3692 + ** it's "capitalize". If there are no capitals
3693 + ** at all, it's ANYCASE.
3695 + if(myupper(word[0]))
3697 + for(p = word + 1; *p != '\0'; p++)
3699 + return FOLLOWCASE;
3700 + return CAPITALIZED;
3706 + return FOLLOWCASE; /* .../lower/upper */
3711 +** Add a variant-capitalization header to a word. This routine may be
3712 +** called even for a followcase word that doesn't yet have a header.
3714 +** Returns 0 if all was ok, -1 if allocation error.
3717 +addvheader(register struct dent *dp) /* Entry to update */
3719 + register struct dent * tdent; /* Copy of entry */
3722 + ** Add a second entry with the correct capitalization, and then make
3723 + ** dp into a special dummy entry.
3725 + tdent = (struct dent *) malloc (sizeof (struct dent));
3728 + (void) fprintf(stderr, MAKEDENT_C_NO_WORD_SPACE, dp->word);
3732 + if(captype(tdent->flagfield) != FOLLOWCASE)
3733 + tdent->word = NULL;
3736 + /* Followcase words need a copy of the capitalization */
3737 + tdent->word = malloc((unsigned int) strlen (tdent->word) + 1);
3738 + if(tdent->word == NULL)
3740 + (void) fprintf (stderr, MAKEDENT_C_NO_WORD_SPACE, dp->word);
3741 + free((char *) tdent);
3744 + (void) strcpy(tdent->word, dp->word);
3746 + chupcase(dp->word);
3748 + dp->flagfield &= ~CAPTYPEMASK;
3749 + dp->flagfield |= (ALLCAPS | MOREVARIANTS);
3752 +#endif /* NO_CAPITALIZATION_SUPPORT */
3755 +** Combine and resolve the entries describing two capitalizations of the same
3756 +** word. This may require allocating yet more entries.
3758 +** Hdrp is a pointer into a hash table. If the word covered by hdrp has
3759 +** variations, hdrp must point to the header. Newp is a pointer to temporary
3760 +** storage, and space is malloc'ed if newp is to be kept. The newp->word
3761 +** field must have been allocated with mymalloc, so that this routine may free
3762 +** the space if it keeps newp but not the word.
3764 +** Return value: 0 if the word was added, 1 if the word was combined
3765 +** with an existing entry, and -1 if trouble occurred(e.g., malloc).
3766 +** If 1 is returned, newp->word may have been be freed using myfree.
3768 +** Life is made much more difficult by the KEEP flag's possibilities. We
3769 +** must ensure that a !KEEP word doesn't find its way into the personal
3770 +** dictionary as a result of this routine's actions. However, a !KEEP
3771 +** word that has affixes must have come from the main dictionary, so it
3772 +** is acceptable to combine entries in that case(got that?).
3774 +** The net result of all this is a set of rules that is a bloody pain
3775 +** to figure out. Basically, we want to choose one of the following actions:
3777 +** (1) Add newp's affixes and KEEP flag to oldp, and discard newp.
3778 +** (2) Add oldp's affixes and KEEP flag to newp, replace oldp with
3779 +** newp, and discard newp.
3780 +#ifndef NO_CAPITALIZATION_SUPPORT
3781 +** (3) Insert newp as a new entry in the variants list. If there is
3782 +** currently no variant header, this requires adding one. Adding a
3783 +** header splits into two sub-cases:
3785 +** (3a) If oldp is ALLCAPS and the KEEP flags match, just turn it
3786 +** into the header.
3787 +** (3b) Otherwise, add a new entry to serve as the header.
3788 +** To ease list linking, this is done by copying oldp into
3789 +** the new entry, and then performing(3a).
3791 +** After newp has been added as a variant, its affixes and KEEP
3792 +** flag are OR-ed into the variant header.
3795 +** So how to choose which? The default is always case(3), which adds newp
3796 +** as a new entry in the variants list. Cases(1) and (2) are symmetrical
3797 +** except for which entry is discarded. We can use case(1) or (2) whenever
3798 +** one entry "covers" the other. "Covering" is defined as follows:
3800 +** (4) For entries with matching capitalization types, A covers B
3803 +** (4a) B's affix flags are a subset of A's, or the KEEP flags
3805 +** (4b) either the KEEP flags match, or A's KEEP flag is set.
3806 +** (Since A has more suffixes, combining B with it won't
3807 +** cause any extra suffixes to be added to the dictionary.)
3808 +** (4c) If the words are FOLLOWCASE, the capitalizations match
3811 +#ifndef NO_CAPITALIZATION_SUPPORT
3812 +** (5) For entries with mismatched capitalization types, A covers B
3813 +** if(4a) and(4b) are true, and:
3815 +** (5a) B is ALLCAPS, or
3816 +** (5b) A is ANYCASE, and B is CAPITALIZED.
3819 +** For any "hdrp" without variants, oldp is the same as hdrp. Otherwise,
3820 +** the above tests are applied using each variant in turn for oldp.
3824 + struct dent * hdrp, /* Header of entry currently in dictionary */
3825 + register struct dent * newp) /* Entry to add */
3827 + register struct dent *
3828 + oldp; /* Current "oldp" entry */
3829 +#ifndef NO_CAPITALIZATION_SUPPORT
3830 + register struct dent *
3831 + tdent; /* Entry we'll add to the dictionary */
3832 +#endif /* NO_CAPITALIZATION_SUPPORT */
3833 + register int retval = 0; /* Return value from combine_two_entries */
3836 + ** First, see if we can combine the two entries(cases 1 and 2). If
3837 + ** combine_two_entries does so, it will return 1. If it has trouble,
3838 + ** it will return zero.
3841 +#ifdef NO_CAPITALIZATION_SUPPORT
3842 + retval = combine_two_entries(hdrp, oldp, newp);
3843 +#else /* NO_CAPITALIZATION_SUPPORT */
3844 + if((oldp->flagfield &(CAPTYPEMASK | MOREVARIANTS))
3845 + == (ALLCAPS | MOREVARIANTS))
3847 + while(oldp->flagfield & MOREVARIANTS)
3849 + oldp = oldp->next;
3850 + retval = combine_two_entries(hdrp, oldp, newp);
3851 + if(retval != 0) /* Did we combine them? */
3856 + retval = combine_two_entries(hdrp, oldp, newp);
3860 + ** Couldn't combine the two entries. Add a new variant. For
3861 + ** ease, we'll stick it right behind the header, rather than
3862 + ** at the end of the list.
3864 + forcevheader(hdrp, oldp, newp);
3865 + tdent = (struct dent *) malloc (sizeof (struct dent));
3868 + (void) fprintf (stderr, MAKEDENT_C_NO_WORD_SPACE, newp->word);
3872 + tdent->next = hdrp->next;
3873 + hdrp->next = tdent;
3874 + tdent->flagfield |= (hdrp->flagfield & MOREVARIANTS);
3875 + hdrp->flagfield |= MOREVARIANTS;
3876 + combineaffixes(hdrp, newp);
3877 + hdrp->flagfield |= (newp->flagfield & KEEP);
3878 + if(captype(newp->flagfield) == FOLLOWCASE)
3879 + tdent->word = newp->word;
3882 + tdent->word = NULL;
3883 + free(newp->word); /* newp->word isn't needed */
3886 +#endif /* NO_CAPITALIZATION_SUPPORT */
3890 +#ifndef NO_CAPITALIZATION_SUPPORT
3892 +** The following routine implements steps 3a and 3b in the commentary
3893 +** for "combinecaps".
3897 + register struct dent * hdrp,
3898 + struct dent * oldp,
3899 + struct dent * newp)
3902 + if((hdrp->flagfield &(CAPTYPEMASK | MOREVARIANTS)) == ALLCAPS
3903 + && ((oldp->flagfield ^ newp->flagfield) & KEEP) == 0)
3904 + return; /* Caller will set MOREVARIANTS */
3905 + else if((hdrp->flagfield &(CAPTYPEMASK | MOREVARIANTS))
3906 + != (ALLCAPS | MOREVARIANTS))
3907 + (void) addvheader(hdrp);
3909 +#endif /* NO_CAPITALIZATION_SUPPORT */
3912 +** This routine implements steps 4 and 5 of the commentary for "combinecaps".
3914 +** Returns 1 if newp can be discarded, 0 if nothing done.
3917 +combine_two_entries(
3918 + struct dent *hdrp, /*(Possible) header of variant chain */
3919 + register struct dent *oldp, /* Pre-existing dictionary entry */
3920 + register struct dent *newp) /* Entry to possibly combine */
3923 + if(acoversb(oldp, newp))
3925 + /* newp is superfluous. Drop it, preserving affixes and keep flag */
3926 + combineaffixes(oldp, newp);
3927 + oldp->flagfield |= (newp->flagfield & KEEP);
3928 + hdrp->flagfield |= (newp->flagfield & KEEP);
3932 + else if(acoversb(newp, oldp))
3935 + ** oldp is superfluous. Replace it with newp, preserving affixes and
3938 + combineaffixes(newp, oldp);
3939 +#ifdef NO_CAPITALIZATION_SUPPORT
3940 + newp->flagfield |= (oldp->flagfield & KEEP);
3941 +#else /* NO_CAPITALIZATION_SUPPORT */
3942 + newp->flagfield |= (oldp->flagfield & (KEEP | MOREVARIANTS));
3943 +#endif /* NO_CAPITALIZATION_SUPPORT */
3944 + hdrp->flagfield |= (newp->flagfield & KEEP);
3945 + newp->next = oldp->next;
3947 + ** We really want to free oldp->word, but that might be part of
3948 + ** "hashstrings". So we'll futz around to arrange things so we can
3949 + ** free newp->word instead. This depends very much on the fact
3950 + ** that both words are the same length.
3952 + if(oldp->word != NULL)
3953 + (void) strcpy (oldp->word, newp->word);
3954 + free(newp->word); /* No longer needed */
3955 + newp->word = oldp->word;
3957 +#ifndef NO_CAPITALIZATION_SUPPORT
3958 + /* We may need to add a header if newp is followcase */
3959 + if(captype(newp->flagfield) == FOLLOWCASE
3960 + && (hdrp->flagfield & (CAPTYPEMASK | MOREVARIANTS))
3961 + != (ALLCAPS | MOREVARIANTS))
3962 + (void) addvheader (hdrp);
3963 +#endif /* NO_CAPITALIZATION_SUPPORT */
3971 +** Determine if enta covers entb, according to the rules in steps 4 and 5
3972 +** of the commentary for "combinecaps".
3976 + register struct dent * enta, /* "A" in the rules */
3977 + register struct dent * entb) /* "B" in the rules */
3979 + int subset; /* NZ if entb is a subset of enta */
3981 + if((subset = issubset(entb, enta)) != 0)
3983 + /* entb is a subset of enta; thus enta might cover entb */
3984 + if(((enta->flagfield ^ entb->flagfield) & KEEP) != 0
3985 + && (enta->flagfield & KEEP) == 0) /* Inverse of condition (4b) */
3990 + /* not a subset; KEEP flags must match exactly(both (4a) and (4b)) */
3991 + if(((enta->flagfield ^ entb->flagfield) & KEEP) != 0)
3995 + /* Rules(4a) and (4b) are satisfied; check for capitalization match */
3996 +#ifdef NO_CAPITALIZATION_SUPPORT
3998 + return subset; /* Just so it gets used */
4000 + return 1; /* All words match */
4002 +#else /* NO_CAPITALIZATION_SUPPORT */
4003 + if(((enta->flagfield ^ entb->flagfield) & CAPTYPEMASK) == 0)
4005 + if(captype(enta->flagfield) != FOLLOWCASE /* Condition (4c) */
4006 + || strcmp(enta->word, entb->word) == 0)
4007 + return 1; /* Perfect match */
4011 + else if(subset == 0) /* No flag subset, refuse */
4012 + return 0; /* ..near matches */
4013 + else if(captype(entb->flagfield) == ALLCAPS)
4015 + else if(captype(enta->flagfield) == ANYCASE
4016 + && captype(entb->flagfield) == CAPITALIZED)
4020 +#endif /* NO_CAPITALIZATION_SUPPORT */
4024 +upcase(register ichar_t * s)
4029 + *s = mytoupper(*s);
4035 +lowcase(register ichar_t * s)
4040 + *s = mytolower(*s);
4046 + * Upcase variant that works on normal strings. Note that it is a lot
4047 + * slower than the normal upcase. The input must be in canonical form.
4054 + is = strtosichar(s, 1);
4056 + (void) ichartostr (s, is, strlen (s) + 1, 1);
4060 +** See if one affix field is a subset of another. Returns NZ if ent1
4061 +** is a subset of ent2. The KEEP flag is not taken into consideration.
4065 + register struct dent * ent1,
4066 + register struct dent * ent2)
4068 +/* The following is really testing for MASKSIZE > 1, but cpp can't do that */
4070 + register int flagword;
4073 +#define MASKMAX MASKSIZE
4075 +#define MASKMAX MASKSIZE - 1
4076 +#endif /* FULLMASKSET */
4077 + for(flagword = MASKMAX; --flagword >= 0; )
4079 + if((ent1->mask[flagword] & ent2->mask[flagword])
4080 + != ent1->mask[flagword])
4083 +#endif /* MASKBITS > 32 */
4085 + return((ent1->mask[MASKSIZE - 1] & ent2->mask[MASKSIZE - 1])
4086 + == ent1->mask[MASKSIZE - 1]);
4088 + if(((ent1->mask[MASKSIZE - 1] & ent2->mask[MASKSIZE - 1])
4089 + ^ ent1->mask[MASKSIZE - 1]) & ~ALLFLAGS)
4093 +#endif /* FULLMASKSET */
4097 +** Add ent2's affix flags to ent1.
4101 + register struct dent * ent1,
4102 + register struct dent * ent2)
4104 +/* The following is really testing for MASKSIZE > 1, but cpp can't do that */
4106 + register int flagword;
4110 + /* MASKMAX is defined in issubset, just above */
4111 + for(flagword = MASKMAX; --flagword >= 0; )
4112 + ent1->mask[flagword] |= ent2->mask[flagword];
4113 +#endif /* MASKBITS > 32 */
4114 +#ifndef FULLMASKSET
4115 + ent1->mask[MASKSIZE - 1] |= ent2->mask[MASKSIZE - 1] & ~ALLFLAGS;
4120 +** Write out a dictionary entry, including capitalization variants.
4121 +** If onlykeep is true, only those variants with KEEP set will be
4126 + register FILE * toutfile,
4127 + struct dent * hent,
4128 + register int onlykeep)
4130 +#ifdef NO_CAPITALIZATION_SUPPORT
4131 + if(!onlykeep || (hent->flagfield & KEEP))
4132 + toutword(toutfile, hent->word, hent);
4134 + register struct dent * cent;
4135 + ichar_t wbuf[INPUTWORDLEN + MAXAFFIXLEN];
4138 + if(strtoichar(wbuf, cent->word, INPUTWORDLEN, 1))
4139 + (void) fprintf(stderr, WORD_TOO_LONG (cent->word));
4142 + if(!onlykeep || (cent->flagfield & KEEP))
4144 + switch(captype (cent->flagfield))
4148 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4151 + if((cent->flagfield & MOREVARIANTS) == 0 || cent != hent)
4154 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4159 + wbuf[0] = mytoupper(wbuf[0]);
4160 + toutword(toutfile, ichartosstr (wbuf, 1), cent);
4163 + toutword(toutfile, cent->word, cent);
4167 + if(cent->flagfield & MOREVARIANTS)
4168 + cent = cent->next;
4177 + register FILE * toutfile,
4179 + register struct dent * cent)
4183 + has_marker = False;
4184 + (void) fprintf (toutfile, "%s", word);
4185 + for(bit = 0; bit < LARGESTFLAG; bit++)
4187 + if(TSTMASKBIT(cent->mask, bit))
4188 + flagout(toutfile, BITTOCHAR (bit));
4190 + (void) fprintf (toutfile, "\n");
4195 + register FILE * toutfile,
4199 + (void) putc(hashheader.flagmarker, toutfile);
4200 + has_marker = True;
4201 + (void) putc (flag, toutfile);
4205 + * If the string under the given pointer begins with a string character,
4206 + * return the length of that "character". If not, return 0.
4207 + * May be called any time, but it's best if "isstrstart" is first
4208 + * used to filter out unnecessary calls.
4210 + * As a side effect, "laststringch" is set to the number of the string
4211 + * found, or to -1 if none was found. This can be useful for such things
4212 + * as case conversion.
4217 + int canonical) /* NZ if input is in canonical form */
4219 +#ifdef SLOWMULTIPLY
4220 + static char * sp[MAXSTRINGCHARS];
4221 + static int m_inited = 0;
4222 +#endif /* SLOWMULTIPLY */
4223 + register char * bufcur;
4224 + register char * stringcur;
4225 + register int stringno;
4226 + register int lowstringno;
4227 + register int highstringno;
4230 +#ifdef SLOWMULTIPLY
4234 + for(stringno = 0; stringno < MAXSTRINGCHARS; stringno++)
4235 + sp[stringno] = &hashheader.stringchars[stringno][0];
4237 +#endif /* SLOWMULTIPLY */
4239 + highstringno = hashheader.nstrchars - 1;
4240 + dupwanted = canonical ? 0 : defdupchar;
4241 + while(lowstringno <= highstringno)
4243 + stringno = (lowstringno + highstringno) >> 1;
4244 +#ifdef SLOWMULTIPLY
4245 + stringcur = sp[stringno];
4246 +#else /* SLOWMULTIPLY */
4247 + stringcur = &hashheader.stringchars[stringno][0];
4248 +#endif /* SLOWMULTIPLY */
4253 + if(((*bufcur++ ^ *stringcur) & 0x7F) != 0)
4255 + if(*bufcur++ != *stringcur)
4256 +#endif /* NO8BIT */
4259 + ** We can't use autoincrement above because of the
4264 + if(*stringcur == '\0')
4266 + if(hashheader.dupnos[stringno] == dupwanted)
4268 + /* We have a match */
4269 + laststringch = hashheader.stringdups[stringno];
4270 +#ifdef SLOWMULTIPLY
4271 + return stringcur - sp[stringno];
4272 +#else /* SLOWMULTIPLY */
4273 + return stringcur - &hashheader.stringchars[stringno][0];
4274 +#endif /* SLOWMULTIPLY */
4279 + /* No match - choose which side to search on */
4281 + if((*--bufcur & 0x7F) <(*stringcur & 0x7F))
4282 + highstringno = stringno - 1;
4283 + else if((*bufcur & 0x7F) >(*stringcur & 0x7F))
4284 + lowstringno = stringno + 1;
4286 + if(*--bufcur < *stringcur)
4287 + highstringno = stringno - 1;
4288 + else if(*bufcur > *stringcur)
4289 + lowstringno = stringno + 1;
4290 +#endif /* NO8BIT */
4291 + else if(dupwanted < hashheader.dupnos[stringno])
4292 + highstringno = stringno - 1;
4294 + lowstringno = stringno + 1;
4296 + laststringch = -1;
4297 + return 0; /* Not a string character */
4301 + * Convert an external string to an ichar_t string. If necessary, the parity
4302 + * bit is stripped off as part of the process.
4304 + * Returns NZ if the output string overflowed.
4308 + register ichar_t * out, /* Where to put result */
4309 + register char * in, /* String to convert */
4310 + int outlen, /* Size of output buffer, *BYTES* */
4311 + int canonical) /* NZ if input is in canonical form */
4313 + register int len; /* Length of next character */
4315 + outlen /= sizeof(ichar_t); /* Convert to an ichar_t count */
4316 + for( ; --outlen > 0 && *in != '\0'; in += len)
4318 + if(l1_isstringch(in, len, canonical))
4319 + *out++ = SET_SIZE + laststringch;
4321 + *out++ = *in & S_NOPARITY;
4324 + return outlen <= 0;
4328 + * Convert an ichar_t string to an external string.
4330 + * WARNING: the resulting string may wind up being longer than the
4331 + * original. In fact, even the sequence strtoichar->ichartostr may
4332 + * produce a result longer than the original, because the output form
4333 + * may use a different string type set than the original input form.
4335 + * Returns NZ if the output string overflowed.
4339 + register char * out, /* Where to put result */
4340 + register ichar_t * in, /* String to convert */
4341 + int outlen, /* Size of output buffer, bytes */
4342 + int canonical) /* NZ for canonical form */
4344 + register unsigned int ch; /* Next character to store */
4345 + register unsigned int i; /* Index into duplicates list */
4346 + register char * scharp; /* Pointer into a string char */
4348 + while(--outlen > 0 && (ch = *in++) != 0)
4351 + *out++ = (char) ch;
4357 + for(i = hashheader.nstrchars; --i >= 0; )
4359 + if(hashheader.dupnos[i] == defdupchar
4360 + && hashheader.stringdups[i] == ch)
4367 + scharp = hashheader.stringchars[(unsigned) ch];
4368 + while((*out++ = *scharp++) != '\0')
4374 + return outlen <= 0;
4378 + * Convert a string to an ichar_t, storing the result in a static area.
4382 + char * in, /* String to convert */
4383 + int canonical) /* NZ if input is in canonical form */
4385 + static ichar_t out[STRTOSICHAR_SIZE / sizeof(ichar_t)];
4387 + if(strtoichar(out, in, sizeof out, canonical))
4388 + (void) fprintf(stderr, WORD_TOO_LONG (in));
4393 + * Convert an ichar_t to a string, storing the result in a static area.
4397 + ichar_t * in, /* Internal string to convert */
4398 + int canonical) /* NZ for canonical conversion */
4400 + static char out[ICHARTOSSTR_SIZE];
4402 + if(ichartostr(out, in, sizeof out, canonical))
4403 + (void) fprintf(stderr, WORD_TOO_LONG (out));
4408 + * Convert a single ichar to a printable string, storing the result in
4414 + static char out[MAXSTRINGCHARLEN + 1];
4418 + out[0] = (char) in;
4422 + (void) strcpy(out, hashheader.stringchars[(unsigned) in - SET_SIZE]);
4426 +#ifndef ICHAR_IS_CHAR
4428 + * Copy an ichar_t.
4432 + register ichar_t * out, /* Destination */
4433 + register ichar_t * in) /* Source */
4435 + ichar_t * origout; /* Copy of destination for return */
4438 + while((*out++ = *in++) != 0)
4444 + * Return the length of an ichar_t.
4447 +icharlen(register ichar_t * in) /* String to count */
4449 + register int len; /* Length so far */
4451 + for(len = 0; *in++ != 0; len++)
4457 + * Compare two ichar_t's.
4461 + register ichar_t * s1,
4462 + register ichar_t * s2)
4467 + if(*s1++ != *s2++)
4468 + return *--s1 - *--s2;
4474 + * Strncmp for two ichar_t's.
4478 + register ichar_t * s1,
4479 + register ichar_t * s2,
4483 + while(--n >= 0 && *s1 != 0)
4485 + if(*s1++ != *s2++)
4486 + return *--s1 - *--s2;
4494 +#endif /* ICHAR_IS_CHAR */
4498 + char * name, /* Name to look up in suffix table */
4499 + int searchnames, /* NZ to search name field of table */
4500 + int * deformatter) /* Where to set deformatter type */
4502 + char * cp; /* Pointer into suffix list */
4503 + int cplen; /* Length of current suffix */
4504 + register int i; /* Index into type table */
4505 + int len; /* Length of the name */
4508 + * Note: for now, the deformatter is set to 1 for tex, 0 for nroff.
4509 + * Further, we assume that it's one or the other, so that a test
4510 + * for tex is sufficient. This needs to be generalized.
4512 + len = strlen(name);
4515 + for(i = 0; i < hashheader.nstrchartype; i++)
4517 + if(strcmp(name, chartypes[i].name) == 0)
4519 + if(deformatter != NULL)
4521 + (strcmp (chartypes[i].deformatter, "tex") == 0);
4526 + for(i = 0; i < hashheader.nstrchartype; i++)
4528 + for(cp = chartypes[i].suffixes; *cp != '\0'; cp += cplen + 1)
4530 + cplen = strlen(cp);
4531 + if(len >= cplen && strcmp(&name[len - cplen], cp) == 0)
4533 + if(deformatter != NULL)
4535 + (strcmp (chartypes[i].deformatter, "tex") == 0);
4544 +mypath_rindex(char const *str, char c)
4548 + x = (char *)str + strlen(str);
4552 + if(*x == '\\' || *x == '/' || *x == ':')
4561 diff -Nur vim61.orig/src/spell/msgs.h vim61/src/spell/msgs.h
4562 --- vim61.orig/src/spell/msgs.h Thu Jan 1 01:00:00 1970
4563 +++ vim61/src/spell/msgs.h Wed Mar 27 15:08:08 2002
4568 + * Copyright 1992, 1993, Geoff Kuenning, Granada Hills, CA
4569 + * All rights reserved.
4571 + * Redistribution and use in source and binary forms, with or without
4572 + * modification, are permitted provided that the following conditions
4575 + * 1. Redistributions of source code must retain the above copyright
4576 + * notice, this list of conditions and the following disclaimer.
4577 + * 2. Redistributions in binary form must reproduce the above copyright
4578 + * notice, this list of conditions and the following disclaimer in the
4579 + * documentation and/or other materials provided with the distribution.
4580 + * 3. All modifications to the source code must be clearly marked as
4581 + * such. Binary redistributions based on modified source code
4582 + * must be clearly marked as modified versions in the documentation
4583 + * and/or other materials provided with the distribution.
4584 + * 4. All advertising materials mentioning features or use of this software
4585 + * must display the following acknowledgment:
4586 + * This product includes software developed by Geoff Kuenning and
4587 + * other unpaid contributors.
4588 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
4589 + * products derived from this software without specific prior
4590 + * written permission.
4592 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
4593 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4594 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4595 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
4596 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4597 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4598 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4599 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4600 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4601 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4607 + * Messages header file.
4609 + * This file contains all text strings that are written by any of the
4610 + * C programs in the ispell package. The strings are collected here so that
4611 + * you can have the option of translating them into your local language for
4612 + * the benefit of your users.
4614 + * Anyone who goes to the effort of making a translation may wish to return
4615 + * the translated strings to me, geoff@ITcorp.com, so that I can include
4616 + * them in a later distribution under #ifdef control.
4618 + * Besides the strings in this header file, you may also want to translate
4619 + * the strings in version.h, which give the version and copyright information.
4620 + * However, any translation of these strings MUST accurately preserve the
4621 + * legal rights under international law; you may wish to consult a lawyer
4622 + * about this since you will be responsible for the results of any
4623 + * incorrect translation.
4625 + * Most of the strings below are simple printf format strings. If the printf
4626 + * takes more than one parameter, the string is given as a parameterized
4627 + * macro in case your local language needs a different word order.
4632 + * Revision 1.31 1994/12/27 23:08:57 geoff
4633 + * Add a message to be issued if a word contains illegal characters.
4635 + * Revision 1.30 1994/10/25 05:46:40 geoff
4636 + * Improve a couple of error messages relating to affix flags.
4638 + * Revision 1.29 1994/10/04 03:46:23 geoff
4639 + * Add a missing carriage return in the help message
4641 + * Revision 1.28 1994/09/16 05:07:00 geoff
4642 + * Add the BAD_FLAG message, and start a sentence in another message with
4643 + * an uppercase letter.
4645 + * Revision 1.27 1994/07/28 05:11:38 geoff
4646 + * Log message for previous revision: add BHASH_C_ZERO_COUNT.
4648 + * Revision 1.26 1994/07/28 04:53:49 geoff
4650 + * Revision 1.25 1994/05/24 04:54:36 geoff
4651 + * Add error messages for affix-flag checking.
4653 + * Revision 1.24 1994/01/25 07:12:42 geoff
4654 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
4659 + * The following strings are used in numerous places:
4661 +#define BAD_FLAG "\nIllegal affix flag character '%c'\n"
4662 +#define CANT_OPEN "Can't open %s"
4663 +#define CANT_CREATE "Can't create %s\n"
4664 +#define WORD_TOO_LONG(w) "\nWord '%s' too long at line %d of %s, truncated\n", \
4665 + w, __LINE__, __FILE__
4668 + * The following strings are used in buildhash.c:
4670 +#define BHASH_C_NO_DICT "No dictionary (%s)\n"
4671 +#define BHASH_C_NO_COUNT "No count file\n"
4672 +#define BHASH_C_BAD_COUNT "Bad count file\n"
4673 +#define BHASH_C_ZERO_COUNT "No words in dictionary\n"
4674 + /* I think this message looks better when it's nearly 80 characters wide,
4675 + * thus the ugly formatting in the next two defines. GK 9-87 */
4676 +#define BHASH_C_BAFF_1(max, excess) \
4677 + " 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", \
4679 +#define BHASH_C_BAFF_2 \
4680 + "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"
4681 +#define BHASH_C_OVERFLOW "Hash table overflowed by %d words\n"
4682 +#define BHASH_C_CANT_OPEN_DICT "Can't open dictionary\n"
4683 +#define BHASH_C_NO_SPACE "Couldn't allocate hash table\n"
4684 +#define BHASH_C_COLLISION_SPACE "\ncouldn't allocate space for collision\n"
4685 +#define BHASH_C_COUNTING "Counting words in dictionary ...\n"
4686 +#define BHASH_C_WORD_COUNT "\n%d words\n"
4687 +#define BHASH_C_USAGE "Usage: buildhash [-s] dict-file aff-file hash-file\n\tbuildhash -c count aff-file\n"
4690 + * The following strings are used in correct.c:
4692 +#define CORR_C_HELP_1 "Whenever a word is found that is not in the dictionary,\n"
4693 +#define CORR_C_HELP_2 "it is printed on the first line of the screen. If the dictionary\n"
4694 +#define CORR_C_HELP_3 "contains any similar words, they are listed with a number\n"
4695 +#define CORR_C_HELP_4 "next to each one. You have the option of replacing the word\n"
4696 +#define CORR_C_HELP_5 "completely, or choosing one of the suggested words.\n"
4697 + /* You may add HELP_6 through HELP_9 if your language needs more lines */
4698 +#define CORR_C_HELP_6 ""
4699 +#define CORR_C_HELP_7 ""
4700 +#define CORR_C_HELP_8 ""
4701 +#define CORR_C_HELP_9 ""
4702 +#define CORR_C_HELP_COMMANDS "\nCommands are:\n\n"
4703 +#define CORR_C_HELP_R_CMD "R Replace the misspelled word completely.\n"
4704 +#define CORR_C_HELP_BLANK "Space Accept the word this time only.\n"
4705 +#define CORR_C_HELP_A_CMD "A Accept the word for the rest of this session.\n"
4706 +#define CORR_C_HELP_I_CMD "I Accept the word, and put it in your private dictionary.\n"
4707 +#define CORR_C_HELP_U_CMD "U Accept and add lowercase version to private dictionary.\n"
4708 +#define CORR_C_HELP_0_CMD "0-n Replace with one of the suggested words.\n"
4709 +#define CORR_C_HELP_L_CMD "L Look up words in system dictionary.\n"
4710 +#define CORR_C_HELP_X_CMD "X Write the rest of this file, ignoring misspellings,\n and start next file.\n"
4711 +#define CORR_C_HELP_Q_CMD "Q Quit immediately. Asks for confirmation.\n Leaves file unchanged.\n"
4712 +#define CORR_C_HELP_BANG "! Shell escape.\n"
4713 +#define CORR_C_HELP_REDRAW "^L Redraw screen.\n"
4714 +#define CORR_C_HELP_SUSPEND "^Z Suspend program.\n"
4715 +#define CORR_C_HELP_HELP "? Show this help screen.\n"
4716 +#define CORR_C_HELP_TYPE_SPACE "-- Type space to continue --"
4718 +#define CORR_C_FILE_LABEL " File: %s"
4719 +#define CORR_C_READONLY "[READONLY]"
4720 +#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"
4721 +#define CORR_C_CONFIRM_QUIT "Are you sure you want to throw away your changes? "
4722 +#define CORR_C_REPLACE_WITH "Replace with: "
4723 +#define CORR_C_LOOKUP_PROMPT "Lookup string ('*' is wildcard): "
4724 +#define CORR_C_MORE_PROMPT "-- more --"
4725 +#define CORR_C_BLANK_MORE " "
4726 +#define CORR_C_END_LOOK "--end--"
4729 + * The following strings are used in defmt.c:
4731 +#define DEFMT_C_TEX_MATH_ERROR "****ERROR in parsing TeX math mode!\n"
4732 +#define DEFMT_C_LR_MATH_ERROR "***ERROR in LR to math-mode switch.\n"
4735 + * The following strings are used in icombine.c:
4737 +#define ICOMBINE_C_BAD_TYPE "icombine: unrecognized formatter type '%s'\n"
4738 +#define ICOMBINE_C_USAGE "Usage: icombine [-T suffix] [aff-file] < wordlist\n"
4741 + * The following strings are used in ispell.c:
4743 +#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"
4744 +#define ISPELL_C_USAGE2 " %s [-dfile | -pfile | -wchars | -Wn | -t | -n | -Ttype] -l\n"
4746 +#define ISPELL_C_USAGE3 " %s [-dfile | -pfile | -ffile | -Wn | -t | -n | -s | -B | -C | -P | -m | -Ttype] {-a | -A}\n"
4748 +#define ISPELL_C_USAGE3 " %s [-dfile | -pfile | -ffile | -Wn | -t | -n | -B | -C | -P | -m | -Ttype] {-a | -A}\n"
4750 +#define ISPELL_C_USAGE4 " %s [-dfile] [-wchars | -Wn] -c\n"
4751 +#define ISPELL_C_USAGE5 " %s [-dfile] [-wchars] -e[1-4]\n"
4752 +#define ISPELL_C_USAGE6 " %s [-dfile] [-wchars] -D\n"
4753 +#define ISPELL_C_USAGE7 " %s -v\n"
4754 +#define ISPELL_C_TEMP_DISAPPEARED "temporary file disappeared (%s)\n"
4755 +#define ISPELL_C_BAD_TYPE "ispell: unrecognized formatter type '%s'\n"
4756 +#define ISPELL_C_NO_FILE "ispell: specified file does not exist\n"
4757 +#define ISPELL_C_NO_FILES "ispell: specified files do not exist\n"
4758 +#define ISPELL_C_CANT_WRITE "Warning: Can't write to %s\n"
4759 +#define ISPELL_C_OPTIONS_ARE "Compiled-in options:\n"
4761 +#define ISPELL_C_NO_OPTIONS_SPACE "ispell: no memory to read default options\n"
4765 + * The following strings are used in lookup.c:
4767 +#define LOOKUP_C_CANT_READ "Trouble reading hash table %s"
4768 +#define LOOKUP_C_NULL_HASH "Null hash table %s"
4769 +#define LOOKUP_C_SHORT_HASH(name, gotten, wanted) \
4770 + "Truncated hash table %s: got %d bytes, expected %d", \
4771 + name, gotten, wanted
4772 +#define LOOKUP_C_BAD_MAGIC(name, wanted, gotten) \
4773 + "Illegal format hash table %s - expected magic 0x%x, got 0x%x", \
4774 + name, wanted, gotten
4775 +#define LOOKUP_C_BAD_MAGIC2(name, wanted, gotten) \
4776 + "Illegal format hash table %s - \nexpected magic2 0x%x, got 0x%x", \
4777 + name, wanted, gotten
4778 +#define LOOKUP_C_BAD_OPTIONS(gotopts, gotchars, gotlen, wantedopts, wantedchars, wantedlen) \
4779 + "Hash table options don't agree with buildhash - 0x%x/%d/%d vs. 0x%x/%d/%d", \
4780 + gotopts, gotchars, gotlen, \
4781 + wantedopts, wantedchars, wantedlen
4782 +#define LOOKUP_C_NO_HASH_SPACE "Couldn't allocate space for hash table"
4783 +#define LOOKUP_C_BAD_FORMAT "Illegal format hash table"
4784 +#define LOOKUP_C_NO_LANG_SPACE "Couldn't allocate space for language tables"
4787 + * The following strings are used in makedent.c:
4789 +#define MAKEDENT_C_NO_WORD_SPACE "\nCouldn't allocate space for word '%s'\n"
4790 +#define MAKEDENT_C_BAD_WORD_CHAR "\nWord '%s' contains illegal characters\n"
4793 + * The following strings are used in parse.y:
4795 +#define PARSE_Y_8_BIT "Eighth bit ignored (recompile ispell without NO8BIT)"
4796 +#define PARSE_Y_NO_WORD_STRINGS "wordchars statement may not specify string characters"
4797 +#define PARSE_Y_UNMATCHED "Unmatched charset lengths"
4798 +#define PARSE_Y_NO_BOUNDARY_STRINGS "boundarychars statement may not specify string characters"
4799 +#define PARSE_Y_LONG_STRING "String character is too long"
4800 +#define PARSE_Y_NULL_STRING "String character must have nonzero length"
4801 +#define PARSE_Y_MANY_STRINGS "Too many string characters"
4802 +#define PARSE_Y_NO_SUCH_STRING "No such string character"
4803 +#define PARSE_Y_MULTIPLE_STRINGS "Alternate string character was already defined"
4804 +#define PARSE_Y_LENGTH_MISMATCH "Upper and lower versions of string character must be same length"
4805 +#define PARSE_Y_WRONG_NROFF "Incorrect character count in nroffchars statement"
4806 +#define PARSE_Y_WRONG_TEX "Incorrect character count in TeXchars statement"
4807 +#define PARSE_Y_DOUBLE_COMPOUND "Compoundwords option may only appear once"
4808 +#define PARSE_Y_LONG_FLAG "Flag must be single character"
4809 +#define PARSE_Y_BAD_FLAG "Flag must be alphabetic"
4810 +#define PARSE_Y_DUP_FLAG "Duplicate flag"
4811 +#define PARSE_Y_NO_SPACE "Out of memory"
4812 +#define PARSE_Y_NEED_BLANK "Single characters must be separated by a blank"
4813 +#define PARSE_Y_MANY_CONDS "Too many conditions; 8 maximum"
4814 +#define PARSE_Y_EOF "Unexpected EOF in quoted string"
4815 +#define PARSE_Y_LONG_QUOTE "Quoted string too long, max 256 characters"
4816 +#define PARSE_Y_ERROR_FORMAT(file, lineno, error) \
4817 + "%s line %d: %s\n", file, lineno, error
4818 +#define PARSE_Y_MALLOC_TROUBLE "yyopen: trouble allocating memory\n"
4819 +#define PARSE_Y_UNGRAB_PROBLEM "Internal error: ungrab buffer overflow"
4820 +#define PARSE_Y_BAD_DEFORMATTER "Deformatter must be either 'nroff' or 'tex'"
4821 +#define PARSE_Y_BAD_NUMBER "Illegal digit in number"
4824 + * The following strings are used in term.c:
4826 +#define TERM_C_SMALL_SCREEN "Screen too small: need at least %d lines\n"
4827 +#define TERM_C_NO_BATCH "Can't deal with non-interactive use yet.\n"
4828 +#define TERM_C_CANT_FORK "Couldn't fork, try later.\n"
4829 +#define TERM_C_TYPE_SPACE "\n-- Type space to continue --"
4832 + * The following strings are used in tree.c:
4834 +#define TREE_C_CANT_UPDATE "Warning: Cannot update personal dictionary (%s)\n"
4835 +#define TREE_C_NO_SPACE "Ran out of space for personal dictionary\n"
4836 +#define TREE_C_TRY_ANYWAY "Continuing anyway (with reduced performance).\n"
4839 + * The following strings are used in unsq.c:
4841 +#define UNSQ_C_BAD_COUNT "Illegal count character 0x%x\n"
4842 +#define UNSQ_C_SURPRISE_EOF "Unexpected EOF\n"
4843 diff -Nur vim61.orig/src/spell/tgood.c vim61/src/spell/tgood.c
4844 --- vim61.orig/src/spell/tgood.c Thu Jan 1 01:00:00 1970
4845 +++ vim61/src/spell/tgood.c Wed Mar 27 15:08:08 2002
4848 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
4849 + * All rights reserved.
4851 + * Redistribution and use in source and binary forms, with or without
4852 + * modification, are permitted provided that the following conditions
4855 + * 1. Redistributions of source code must retain the above copyright
4856 + * notice, this list of conditions and the following disclaimer.
4857 + * 2. Redistributions in binary form must reproduce the above copyright
4858 + * notice, this list of conditions and the following disclaimer in the
4859 + * documentation and/or other materials provided with the distribution.
4860 + * 3. All modifications to the source code must be clearly marked as
4861 + * such. Binary redistributions based on modified source code
4862 + * must be clearly marked as modified versions in the documentation
4863 + * and/or other materials provided with the distribution.
4864 + * 4. All advertising materials mentioning features or use of this software
4865 + * must display the following acknowledgment:
4866 + * This product includes software developed by Geoff Kuenning and
4867 + * other unpaid contributors.
4868 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
4869 + * products derived from this software without specific prior
4870 + * written permission.
4872 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
4873 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4874 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4875 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
4876 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4877 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4878 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4879 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4880 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4881 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4886 + * Table-driven version of good.c.
4888 + * Geoff Kuenning, July 1987
4893 + * Revision 1.32 1994/11/02 06:56:16 geoff
4894 + * Remove the anyword feature, which I've decided is a bad idea.
4896 + * Revision 1.31 1994/10/25 05:46:25 geoff
4897 + * Add support for the FF_ANYWORD (affix applies to all words, even if
4898 + * flag bit isn't set) flag option.
4900 + * Revision 1.30 1994/05/24 06:23:08 geoff
4901 + * Don't create a hit if "allhits" is clear and capitalization
4902 + * mismatches. This cures a bug where a word could be in the dictionary
4903 + * and yet not found.
4905 + * Revision 1.29 1994/05/17 06:44:21 geoff
4906 + * Add support for controlled compound formation and the COMPOUNDONLY
4907 + * option to affix flags.
4909 + * Revision 1.28 1994/01/25 07:12:13 geoff
4910 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
4915 +#include "ispell.h"
4917 +Global void chk_aff (ichar_t * word, ichar_t * ucword, int len,
4918 + int ignoreflagbits, int allhits, int pfxopts, int sfxopts);
4919 +Local void pfx_list_chk (ichar_t * word, ichar_t * ucword,
4920 + int len, int optflags, int sfxopts, struct flagptr * ind,
4921 + int ignoreflagbits, int allhits);
4922 +Local void chk_suf (ichar_t * word, ichar_t * ucword, int len,
4923 + int optflags, struct flagent * pfxent, int ignoreflagbits,
4925 +Local void suf_list_chk (ichar_t * word, ichar_t * ucword, int len,
4926 + struct flagptr * ind, int optflags, struct flagent * pfxent,
4927 + int ignoreflagbits, int allhits);
4928 +Global int expand_pre (char * croot, ichar_t * rootword,
4929 + MASKTYPE mask[], int option, char * extra);
4930 +Local int pr_pre_expansion (char * croot, ichar_t * rootword,
4931 + struct flagent * flent, MASKTYPE mask[], int option,
4933 +Global int expand_suf (char * croot, ichar_t * rootword,
4934 + MASKTYPE mask[], int optflags, int option, char * extra);
4935 +Local int pr_suf_expansion (char * croot, ichar_t * rootword,
4936 + struct flagent * flent, int option, char * extra);
4937 +Local void forcelc (ichar_t * dst, int len);
4939 +/* Check possible affixes */
4942 + ichar_t * word, /* Word to be checked */
4943 + ichar_t * ucword, /* Upper-case-only copy of word */
4944 + int len, /* The length of word/ucword */
4945 + int ignoreflagbits, /* Ignore whether affix is legal */
4946 + int allhits, /* Keep going after first hit */
4947 + int pfxopts, /* Options to apply to prefixes */
4948 + int sfxopts) /* Options to apply to suffixes */
4950 + register ichar_t * cp; /* Pointer to char to index on */
4951 + struct flagptr * ind; /* Flag index table to test */
4953 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, &pflagindex[0],
4954 + ignoreflagbits, allhits);
4956 + ind = &pflagindex[*cp++];
4957 + while (ind->numents == 0 && ind->pu.fp != NULL)
4961 + if (ind->pu.fp[0].numents)
4963 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, &ind->pu.fp[0],
4964 + ignoreflagbits, allhits);
4965 + if (numhits && !allhits && !cflag && !ignoreflagbits)
4968 + ind = &ind->pu.fp[*cp++];
4970 + pfx_list_chk (word, ucword, len, pfxopts, sfxopts, ind, ignoreflagbits,
4972 + if (numhits && !allhits && !cflag && !ignoreflagbits)
4974 + chk_suf (word, ucword, len, sfxopts, (struct flagent *) NULL,
4975 + ignoreflagbits, allhits);
4978 +/* Check some prefix flags */
4981 + ichar_t * word, /* Word to be checked */
4982 + ichar_t * ucword, /* Upper-case-only word */
4983 + int len, /* The length of ucword */
4984 + int optflags, /* Options to apply */
4985 + int sfxopts, /* Options to apply to suffixes */
4986 + struct flagptr * ind, /* Flag index table */
4987 + int ignoreflagbits, /* Ignore whether affix is legal */
4988 + int allhits) /* Keep going after first hit */
4990 + int cond; /* Condition number */
4991 + register ichar_t * cp; /* Pointer into end of ucword */
4992 + struct dent * dent; /* Dictionary entry we found */
4993 + int entcount; /* Number of entries to process */
4994 + register struct flagent *
4995 + flent; /* Current table entry */
4996 + int preadd; /* Length added to tword2 as prefix */
4997 + register int tlen; /* Length of tword */
4998 + ichar_t tword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4]; /* Tmp cpy */
4999 + ichar_t tword2[sizeof tword]; /* 2nd copy for ins_root_cap */
5001 + for (flent = ind->pu.ent, entcount = ind->numents;
5002 + entcount > 0; flent++, entcount--)
5005 + * If this is a compound-only affix, ignore it unless we're
5006 + * looking for that specific thing.
5008 + if ((flent->flagflags & FF_COMPOUNDONLY) != 0
5009 + && (optflags & FF_COMPOUNDONLY) == 0)
5012 + * In COMPOUND_CONTROLLED mode, the FF_COMPOUNDONLY bit must
5015 + if (compoundflag == COMPOUND_CONTROLLED
5016 + && ((flent->flagflags ^ optflags) & FF_COMPOUNDONLY) != 0)
5019 + * See if the prefix matches.
5021 + tlen = len - flent->affl;
5022 + if (tlen > 0 && (flent->affl == 0 ||
5023 + icharncmp (flent->affix, ucword, flent->affl) == 0) &&
5024 + tlen + flent->stripl >= flent->numconds)
5027 + * The prefix matches. Remove it, replace it by the "strip"
5028 + * string (if any), and check the original conditions.
5030 + if (flent->stripl)
5031 + (void) icharcpy (tword, flent->strip);
5032 + (void) icharcpy (tword + flent->stripl, ucword + flent->affl);
5034 + for (cond = 0; cond < flent->numconds; cond++)
5036 + if ((flent->conds[*cp++] & (1 << cond)) == 0)
5039 + if (cond >= flent->numconds)
5042 + * The conditions match. See if the word is in the
5045 + tlen += flent->stripl;
5047 + flagpr (tword, BITTOCHAR (flent->flagbit), flent->stripl,
5048 + flent->affl, -1, 0);
5049 + else if (ignoreflagbits)
5051 + if ((dent = lookup (tword, 1)) != NULL)
5056 + (void) icharcpy (cp, flent->affix);
5057 + cp += flent->affl;
5060 + preadd = cp - tword2;
5061 + (void) icharcpy (cp, tword);
5063 + if (flent->stripl)
5066 + (void) icharcpy (cp, flent->strip);
5068 + (void) ins_root_cap (tword2, word,
5069 + flent->stripl, preadd,
5070 + 0, (cp - tword2) - tlen - preadd,
5071 + dent, flent, (struct flagent *) NULL);
5074 + else if ((dent = lookup (tword, 1)) != NULL
5075 + && TSTMASKBIT (dent->mask, flent->flagbit))
5077 + if (numhits < MAX_HITS)
5079 + hits[numhits].dictent = dent;
5080 + hits[numhits].prefix = flent;
5081 + hits[numhits].suffix = NULL;
5086 +#ifndef NO_CAPITALIZATION_SUPPORT
5087 + if (cap_ok (word, &hits[0], len))
5090 +#else /* NO_CAPITALIZATION_SUPPORT */
5092 +#endif /* NO_CAPITALIZATION_SUPPORT */
5096 + * Handle cross-products.
5098 + if (flent->flagflags & FF_CROSSPRODUCT)
5099 + chk_suf (word, tword, tlen, sfxopts | FF_CROSSPRODUCT,
5100 + flent, ignoreflagbits, allhits);
5106 +/* Check possible suffixes */
5109 + ichar_t * word, /* Word to be checked */
5110 + ichar_t * ucword, /* Upper-case-only word */
5111 + int len, /* The length of ucword */
5112 + int optflags, /* Affix option flags */
5113 + struct flagent * pfxent, /* Prefix flag entry if cross-prod */
5114 + int ignoreflagbits, /* Ignore whether affix is legal */
5115 + int allhits) /* Keep going after first hit */
5117 + register ichar_t * cp; /* Pointer to char to index on */
5118 + struct flagptr * ind; /* Flag index table to test */
5120 + suf_list_chk (word, ucword, len, &sflagindex[0], optflags, pfxent,
5121 + ignoreflagbits, allhits);
5122 + cp = ucword + len - 1;
5123 + ind = &sflagindex[*cp];
5124 + while (ind->numents == 0 && ind->pu.fp != NULL)
5128 + if (ind->pu.fp[0].numents)
5130 + suf_list_chk (word, ucword, len, &ind->pu.fp[0],
5131 + optflags, pfxent, ignoreflagbits, allhits);
5132 + if (numhits != 0 && !allhits && !cflag && !ignoreflagbits)
5135 + ind = &ind->pu.fp[*--cp];
5137 + suf_list_chk (word, ucword, len, ind, optflags, pfxent,
5138 + ignoreflagbits, allhits);
5143 + ichar_t * word, /* Word to be checked */
5144 + ichar_t * ucword, /* Upper-case-only word */
5145 + int len, /* The length of ucword */
5146 + struct flagptr * ind, /* Flag index table */
5147 + int optflags, /* Affix option flags */
5148 + struct flagent * pfxent, /* Prefix flag entry if crossonly */
5149 + int ignoreflagbits, /* Ignore whether affix is legal */
5150 + int allhits) /* Keep going after first hit */
5152 + register ichar_t * cp; /* Pointer into end of ucword */
5153 + int cond; /* Condition number */
5154 + struct dent * dent; /* Dictionary entry we found */
5155 + int entcount; /* Number of entries to process */
5156 + register struct flagent *
5157 + flent; /* Current table entry */
5158 + int preadd; /* Length added to tword2 as prefix */
5159 + register int tlen; /* Length of tword */
5160 + ichar_t tword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4]; /* Tmp cpy */
5161 + ichar_t tword2[sizeof tword]; /* 2nd copy for ins_root_cap */
5163 + (void) icharcpy (tword, ucword);
5164 + for (flent = ind->pu.ent, entcount = ind->numents;
5166 + flent++, entcount--)
5168 + if ((optflags & FF_CROSSPRODUCT) != 0
5169 + && (flent->flagflags & FF_CROSSPRODUCT) == 0)
5172 + * If this is a compound-only affix, ignore it unless we're
5173 + * looking for that specific thing.
5175 + if ((flent->flagflags & FF_COMPOUNDONLY) != 0
5176 + && (optflags & FF_COMPOUNDONLY) == 0)
5179 + * In COMPOUND_CONTROLLED mode, the FF_COMPOUNDONLY bit must
5182 + if (compoundflag == COMPOUND_CONTROLLED
5183 + && ((flent->flagflags ^ optflags) & FF_COMPOUNDONLY) != 0)
5186 + * See if the suffix matches.
5188 + tlen = len - flent->affl;
5190 + && (flent->affl == 0
5191 + || icharcmp (flent->affix, ucword + tlen) == 0)
5192 + && tlen + flent->stripl >= flent->numconds)
5195 + * The suffix matches. Remove it, replace it by the "strip"
5196 + * string (if any), and check the original conditions.
5198 + (void) icharcpy (tword, ucword);
5199 + cp = tword + tlen;
5200 + if (flent->stripl)
5202 + (void) icharcpy (cp, flent->strip);
5203 + tlen += flent->stripl;
5204 + cp = tword + tlen;
5208 + for (cond = flent->numconds; --cond >= 0; )
5210 + if ((flent->conds[*--cp] & (1 << cond)) == 0)
5216 + * The conditions match. See if the word is in the
5221 + if (optflags & FF_CROSSPRODUCT)
5222 + flagpr (tword, BITTOCHAR (pfxent->flagbit),
5223 + pfxent->stripl, pfxent->affl,
5224 + BITTOCHAR (flent->flagbit), flent->affl);
5226 + flagpr (tword, -1, 0, 0,
5227 + BITTOCHAR (flent->flagbit), flent->affl);
5229 + else if (ignoreflagbits)
5231 + if ((dent = lookup (tword, 1)) != NULL)
5234 + if ((optflags & FF_CROSSPRODUCT)
5235 + && pfxent->affl != 0)
5237 + (void) icharcpy (cp, pfxent->affix);
5238 + cp += pfxent->affl;
5241 + preadd = cp - tword2;
5242 + (void) icharcpy (cp, tword);
5244 + if ((optflags & FF_CROSSPRODUCT)
5245 + && pfxent->stripl != 0)
5248 + (void) icharcpy (cp, pfxent->strip);
5249 + cp += pfxent->stripl;
5251 + if (flent->stripl)
5254 + (void) icharcpy (cp, flent->strip);
5255 + cp += flent->stripl;
5260 + (void) icharcpy (cp, flent->affix);
5261 + cp += flent->affl;
5263 + (void) ins_root_cap (tword2, word,
5264 + (optflags & FF_CROSSPRODUCT) ? pfxent->stripl : 0,
5266 + flent->stripl, (cp - tword2) - tlen - preadd,
5267 + dent, pfxent, flent);
5270 + else if ((dent = lookup (tword, 1)) != NULL
5271 + && TSTMASKBIT (dent->mask, flent->flagbit)
5272 + && ((optflags & FF_CROSSPRODUCT) == 0
5273 + || TSTMASKBIT (dent->mask, pfxent->flagbit)))
5275 + if (numhits < MAX_HITS)
5277 + hits[numhits].dictent = dent;
5278 + hits[numhits].prefix = pfxent;
5279 + hits[numhits].suffix = flent;
5284 +#ifndef NO_CAPITALIZATION_SUPPORT
5285 + if (cap_ok (word, &hits[0], len))
5288 +#else /* NO_CAPITALIZATION_SUPPORT */
5290 +#endif /* NO_CAPITALIZATION_SUPPORT */
5299 + * Expand a dictionary prefix entry
5303 + char * croot, /* Char version of rootword */
5304 + ichar_t * rootword, /* Root word to expand */
5305 + register MASKTYPE mask[], /* Mask bits to expand on */
5306 + int option, /* Option, see expandmode */
5307 + char * extra) /* Extra info to add to line */
5309 + int entcount; /* No. of entries to process */
5310 + int explength; /* Length of expansions */
5311 + register struct flagent *
5312 + flent; /* Current table entry */
5314 + for (flent = pflaglist, entcount = numpflags, explength = 0;
5315 + entcount > 0; flent++, entcount--)
5317 + if (TSTMASKBIT (mask, flent->flagbit))
5319 + pr_pre_expansion (croot, rootword, flent, mask, option, extra);
5324 +/* Print a prefix expansion */
5327 + char * croot, /* Char version of rootword */
5328 + register ichar_t * rootword, /* Root word to expand */
5329 + register struct flagent * flent, /* Current table entry */
5330 + MASKTYPE mask[], /* Mask bits to expand on */
5331 + int option, /* Option, see expandmode */
5332 + char * extra) /* Extra info to add to line */
5334 + int cond; /* Current condition number */
5335 + register ichar_t * nextc; /* Next case choice */
5336 + int tlen; /* Length of tword */
5337 + ichar_t tword[INPUTWORDLEN + MAXAFFIXLEN]; /* Temp */
5339 + tlen = icharlen (rootword);
5340 + if (flent->numconds > tlen)
5342 + tlen -= flent->stripl;
5345 + tlen += flent->affl;
5346 + for (cond = 0, nextc = rootword; cond < flent->numconds; cond++)
5348 + if ((flent->conds[mytoupper (*nextc++)] & (1 << cond)) == 0)
5352 + * The conditions are satisfied. Copy the word, add the prefix,
5353 + * and make it the proper case. This code is carefully written
5354 + * to match that ins_cap and cap_ok. Note that the affix, as
5355 + * inserted, is uppercase.
5357 + * There is a tricky bit here: if the root is capitalized, we
5358 + * want a capitalized result. If the root is followcase, however,
5359 + * we want to duplicate the case of the first remaining letter
5360 + * of the root. In other words, "Loved/U" should generate "Unloved",
5361 + * but "LOved/U" should generate "UNLOved" and "lOved/U" should
5362 + * produce "unlOved".
5366 + (void) icharcpy (tword, flent->affix);
5367 + nextc = tword + flent->affl;
5369 + (void) icharcpy (nextc, rootword + flent->stripl);
5370 + if (myupper (rootword[0]))
5372 + /* We must distinguish followcase from capitalized and all-upper */
5373 + for (nextc = rootword + 1; *nextc; nextc++)
5375 + if (!myupper (*nextc))
5380 + /* It's a followcase or capitalized word. Figure out which. */
5381 + for ( ; *nextc; nextc++)
5383 + if (myupper (*nextc))
5388 + /* It's followcase. */
5389 + if (!myupper (tword[flent->affl]))
5390 + forcelc (tword, flent->affl);
5394 + /* It's capitalized */
5395 + forcelc (tword + 1, tlen - 1);
5401 + /* Followcase or all-lower, we don't care which */
5402 + if (!myupper (*nextc))
5403 + forcelc (tword, flent->affl);
5406 + (void) printf ("\n%s", croot);
5408 + (void) printf (" %s%s", ichartosstr (tword, 1), extra);
5409 + if (flent->flagflags & FF_CROSSPRODUCT)
5411 + + expand_suf (croot, tword, mask, FF_CROSSPRODUCT, option, extra);
5417 + * Expand a dictionary suffix entry
5419 +int expand_suf (croot, rootword, mask, optflags, option, extra)
5420 + char * croot; /* Char version of rootword */
5421 + ichar_t * rootword; /* Root word to expand */
5422 + register MASKTYPE mask[]; /* Mask bits to expand on */
5423 + int optflags; /* Affix option flags */
5424 + int option; /* Option, see expandmode */
5425 + char * extra; /* Extra info to add to line */
5427 + int entcount; /* No. of entries to process */
5428 + int explength; /* Length of expansions */
5429 + register struct flagent *
5430 + flent; /* Current table entry */
5432 + for (flent = sflaglist, entcount = numsflags, explength = 0;
5434 + flent++, entcount--)
5436 + if (TSTMASKBIT (mask, flent->flagbit))
5438 + if ((optflags & FF_CROSSPRODUCT) == 0
5439 + || (flent->flagflags & FF_CROSSPRODUCT))
5441 + pr_suf_expansion (croot, rootword, flent, option, extra);
5447 +/* Print a suffix expansion */
5448 +static int pr_suf_expansion (croot, rootword, flent, option, extra)
5449 + char * croot; /* Char version of rootword */
5450 + register ichar_t * rootword; /* Root word to expand */
5451 + register struct flagent * flent; /* Current table entry */
5452 + int option; /* Option, see expandmode */
5453 + char * extra; /* Extra info to add to line */
5455 + int cond; /* Current condition number */
5456 + register ichar_t * nextc; /* Next case choice */
5457 + int tlen; /* Length of tword */
5458 + ichar_t tword[INPUTWORDLEN + MAXAFFIXLEN]; /* Temp */
5460 + tlen = icharlen (rootword);
5461 + cond = flent->numconds;
5464 + if (tlen - flent->stripl <= 0)
5466 + for (nextc = rootword + tlen; --cond >= 0; )
5468 + if ((flent->conds[mytoupper (*--nextc)] & (1 << cond)) == 0)
5472 + * The conditions are satisfied. Copy the word, add the suffix,
5473 + * and make it match the case of the last remaining character of the
5474 + * root. Again, this code carefully matches ins_cap and cap_ok.
5476 + (void) icharcpy (tword, rootword);
5477 + nextc = tword + tlen - flent->stripl;
5480 + (void) icharcpy (nextc, flent->affix);
5481 + if (!myupper (nextc[-1]))
5482 + forcelc (nextc, flent->affl);
5487 + (void) printf ("\n%s", croot);
5489 + (void) printf (" %s%s", ichartosstr (tword, 1), extra);
5490 + return tlen + flent->affl - flent->stripl;
5493 +static void forcelc (dst, len) /* Force to lowercase */
5494 + register ichar_t * dst; /* Destination to modify */
5495 + register int len; /* Length to copy */
5498 + for ( ; --len >= 0; dst++)
5499 + *dst = mytolower (*dst);
5501 diff -Nur vim61.orig/src/spell/tree.c vim61/src/spell/tree.c
5502 --- vim61.orig/src/spell/tree.c Thu Jan 1 01:00:00 1970
5503 +++ vim61/src/spell/tree.c Wed Mar 27 15:08:08 2002
5506 + * tree.c - a hash style dictionary for user's personal words
5508 + * Pace Willisson, 1983
5509 + * Hash support added by Geoff Kuenning, 1987
5511 + * Copyright 1987, 1988, 1989, 1992, 1993, Geoff Kuenning, Granada Hills, CA
5512 + * All rights reserved.
5514 + * Redistribution and use in source and binary forms, with or without
5515 + * modification, are permitted provided that the following conditions
5518 + * 1. Redistributions of source code must retain the above copyright
5519 + * notice, this list of conditions and the following disclaimer.
5520 + * 2. Redistributions in binary form must reproduce the above copyright
5521 + * notice, this list of conditions and the following disclaimer in the
5522 + * documentation and/or other materials provided with the distribution.
5523 + * 3. All modifications to the source code must be clearly marked as
5524 + * such. Binary redistributions based on modified source code
5525 + * must be clearly marked as modified versions in the documentation
5526 + * and/or other materials provided with the distribution.
5527 + * 4. All advertising materials mentioning features or use of this software
5528 + * must display the following acknowledgment:
5529 + * This product includes software developed by Geoff Kuenning and
5530 + * other unpaid contributors.
5531 + * 5. The name of Geoff Kuenning may not be used to endorse or promote
5532 + * products derived from this software without specific prior
5533 + * written permission.
5535 + * THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
5536 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5537 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5538 + * ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
5539 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5540 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5541 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5542 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5543 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5544 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5550 + * Revision 1.56 1995/01/08 23:23:49 geoff
5551 + * Support PDICTHOME for DOS purposes.
5553 + * Revision 1.55 1994/10/25 05:46:27 geoff
5554 + * Fix a comment that looked to some compilers like it might be nested.
5556 + * Revision 1.54 1994/01/25 07:12:15 geoff
5557 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
5562 +#include <stdlib.h>
5564 +#include "ispell.h"
5567 +Local FILE * trydict (char * dictname, char * home,
5568 + char * prefix, char * suffix);
5569 +Local void treeload (FILE * dictf);
5570 +Local struct dent * tinsert (struct dent * proto);
5571 +#if SORTPERSONAL != 0
5572 +Local int pdictcmp (struct dent ** enta, struct dent **entb);
5573 +#endif /* SORTPERSONAL != 0 */
5574 +#ifdef REGEX_LOOKUP
5575 +#endif /* REGEX_LOOKUP */
5577 +Local int cantexpand = 0; /* NZ if an expansion fails */
5578 +Local struct dent * pershtab; /* Aux hash table for personal dict */
5579 +Local int pershsize = 0; /* Space available in aux hash table */
5580 +Local int hcount = 0; /* Number of items in hash table */
5583 + * Hash table sizes. Prime is probably a good idea, though in truth I
5584 + * whipped the algorithm up on the spot rather than looking it up, so
5585 + * who knows what's really best? If we overflow the table, we just
5586 + * use a double-and-add-1 algorithm.
5588 +static int goodsizes[] =
5590 + 53, 223, 907, 3631
5593 +Local char personaldict[MAXPATHLEN];
5594 +Local FILE * dictf;
5595 +Local newwords = 0;
5599 + char * p, /* Value specified in -p switch */
5600 + char * LibDict) /* Root of default dict name */
5602 + int abspath; /* NZ if p is abs path name */
5603 + char * h; /* Home directory name */
5604 + char seconddict[MAXPATHLEN]; /* Name of secondary dict */
5605 + FILE * secondf; /* Access to second dict file */
5608 + ** If -p was not specified, try to get a default name from the
5609 + ** environment. After this point, if p is null, the the value in
5610 + ** personaldict is the only possible name for the personal dictionary.
5611 + ** If p is non-null, then there is a possibility that we should
5612 + ** prepend HOME to get the correct dictionary name.
5615 + p = getenv (PDICTVAR);
5617 + ** if p exists and begins with '/' we don't really need HOME,
5618 + ** but it's not very likely that HOME isn't set anyway (on non-DOS
5625 + for(i = 0; i < pershsize; i++)
5628 + if(x->word != NULL)
5630 + for(x = x->next; x != NULL;)
5634 + if(x->word != NULL)
5641 + if(pershtab != NULL)
5647 + if ((h = getenv (HOME)) == NULL)
5651 +#else /* PDICTHOME */
5653 +#endif /* PDICTHOME */
5659 + * No -p and no PDICTVAR. We will use LibDict and DEFPAFF to
5660 + * figure out the name of the personal dictionary and where it
5661 + * is. The rules are as follows:
5663 + * (1) If there is a local dictionary and a HOME dictionary,
5664 + * both are loaded, but changes are saved in the local one.
5665 + * The dictionary to save changes in is named "personaldict".
5666 + * (2) Dictionaries named after the affix file take precedence
5667 + * over dictionaries with the default suffix (DEFPAFF).
5668 + * (3) Dictionaries named with the new default names
5669 + * (DEFPDICT/DEFPAFF) take precedence over the old ones
5670 + * (OLDPDICT/OLDPAFF).
5671 + * (4) Dictionaries aren't combined unless they follow the same
5673 + * (5) If no dictionary can be found, a new one is created in
5674 + * the home directory, named after DEFPDICT and the affix
5677 + dictf = trydict (personaldict, (char *) NULL, DEFPDICT, LibDict);
5678 + secondf = trydict (seconddict, h, DEFPDICT, LibDict);
5679 + if (dictf == NULL && secondf == NULL)
5681 + dictf = trydict (personaldict, (char *) NULL, DEFPDICT, DEFPAFF);
5682 + secondf = trydict (seconddict, h, DEFPDICT, DEFPAFF);
5684 + if (dictf == NULL && secondf == NULL)
5686 + dictf = trydict (personaldict, (char *) NULL, OLDPDICT, LibDict);
5687 + secondf = trydict (seconddict, h, OLDPDICT, LibDict);
5689 + if (dictf == NULL && secondf == NULL)
5691 + dictf = trydict (personaldict, (char *) NULL, OLDPDICT, OLDPAFF);
5692 + secondf = trydict (seconddict, h, OLDPDICT, OLDPAFF);
5694 + if (personaldict[0] == '\0')
5696 + if (seconddict[0] != '\0')
5697 + (void) strcpy (personaldict, seconddict);
5699 + (void) sprintf (personaldict, "%s/%s%s", h, DEFPDICT, LibDict);
5701 + if (dictf != NULL)
5704 + (void) fclose (dictf);
5706 + if (secondf != NULL)
5708 + treeload (secondf);
5709 + (void) fclose (secondf);
5715 + ** Figure out if p is an absolute path name. Note that beginning
5716 + ** with "./" and "../" is considered an absolute path, since this
5717 + ** still means we can't prepend HOME.
5719 + abspath = (*p == '/' || strncmp (p, "./", 2) == 0
5720 + || strncmp (p, "../", 3) == 0);
5723 + abspath = (*p == '\\' || strncmp (p, ".\\", 2) == 0
5724 + || strncmp (p, "..\\", 3) == 0
5725 + || (p[0] && p[1] == ':'));
5729 + (void) strcpy (personaldict, p);
5730 + if ((dictf = fopen (personaldict, "r")) != NULL)
5733 + (void) fclose (dictf);
5739 + ** The user gave us a relative pathname. We will try it
5740 + ** locally, and if that doesn't work, we'll try the home
5741 + ** directory. If neither exists, it will be created in
5742 + ** the home directory if words are added.
5744 + (void) strcpy (personaldict, p);
5745 + if ((dictf = fopen (personaldict, "r")) != NULL)
5748 + (void) fclose (dictf);
5750 + else if (!abspath)
5752 + /* Try the home */
5753 + (void) sprintf (personaldict, "%s/%s", h, p);
5754 + if ((dictf = fopen (personaldict, "r")) != NULL)
5757 + (void) fclose (dictf);
5761 + * If dictf is null, we couldn't open the dictionary
5762 + * specified in the -p switch. Complain.
5764 + if (dictf == NULL)
5766 + (void) fprintf (stderr, CANT_OPEN, p);
5773 +#ifndef FEAT_SPELL_HL
5774 + if (!lflag && !aflag
5775 + && access (personaldict, 2) < 0 && errno != ENOENT)
5777 + (void) fprintf (stderr, TREE_C_CANT_UPDATE, personaldict);
5778 + (void) sleep ((unsigned) 2);
5784 + * Try to open a dictionary. As a side effect, leaves the dictionary
5785 + * name in "filename" if one is found, and leaves a null string there
5790 + char * filename, /* Where to store the file name */
5791 + char * home, /* Home directory */
5792 + char * prefix, /* Prefix for dictionary */
5793 + char * suffix) /* Suffix for dictionary */
5795 + FILE * dictf; /* Access to dictionary file */
5798 + (void) sprintf (filename, "%s%s", prefix, suffix);
5800 + (void) sprintf (filename, "%s/%s%s", home, prefix, suffix);
5801 + dictf = fopen (filename, "r");
5802 + if (dictf == NULL)
5803 + filename[0] = '\0';
5809 + register FILE * loadfile) /* File to load words from */
5811 + char buf[BUFSIZ]; /* Buffer for reading pers dict */
5813 + while (fgets (buf, sizeof buf, loadfile) != NULL)
5814 + treeinsert (buf, sizeof(buf), 1);
5820 + char * word, /* Word to insert - must be canonical */
5821 + int wordlen, /* Length of the word buffer */
5824 + register int i, len;
5825 + struct dent wordent;
5826 + register struct dent * dp;
5827 + struct dent * olddp;
5828 +#ifndef NO_CAPITALIZATION_SUPPORT
5829 + struct dent * newdp;
5831 + struct dent * oldhtab;
5833 + ichar_t nword[INPUTWORDLEN + MAXAFFIXLEN];
5834 +#ifndef NO_CAPITALIZATION_SUPPORT
5838 + len = strlen(word);
5839 + if((word[len - 1] == '\n') || (word[len - 1] == '\r'))
5840 + word[len - 1] = '\0', len--;
5841 + if((word[len - 1] == '\n') || (word[len - 1] == '\r'))
5842 + word[len - 1] = '\0';
5844 + * Expand hash table when it is MAXPCT % full.
5846 + if (!cantexpand && (hcount * 100) / MAXPCT >= pershsize)
5848 + oldhsize = pershsize;
5849 + oldhtab = pershtab;
5850 + for (i = 0; i < sizeof goodsizes / sizeof (goodsizes[0]); i++)
5851 + if (goodsizes[i] > pershsize)
5853 + if (i >= sizeof goodsizes / sizeof goodsizes[0])
5854 + pershsize += pershsize + 1;
5856 + pershsize = goodsizes[i];
5858 + (struct dent *) calloc ((unsigned) pershsize, sizeof (struct dent));
5859 + if (pershtab == NULL)
5861 + (void) fprintf (stderr, TREE_C_NO_SPACE);
5863 + * Try to continue anyway, since our overflow
5864 + * algorithm can handle an overfull (100%+) table,
5865 + * and the malloc very likely failed because we
5866 + * already have such a huge table, so small mallocs
5867 + * for overflow entries will still work.
5869 + if (oldhtab == NULL)
5870 + exit (1); /* No old table, can't go on */
5871 + (void) fprintf (stderr, TREE_C_TRY_ANYWAY);
5872 + cantexpand = 1; /* Suppress further messages */
5873 + pershsize = oldhsize; /* Put things back */
5874 + pershtab = oldhtab; /* ... */
5875 + newwords = 1; /* And pretend it worked */
5880 + * Re-insert old entries into new table
5882 + for (i = 0; i < oldhsize; i++)
5885 + if (dp->flagfield & USED)
5887 +#ifdef NO_CAPITALIZATION_SUPPORT
5888 + (void) tinsert (dp);
5890 + newdp = tinsert (dp);
5891 + isvariant = (dp->flagfield & MOREVARIANTS);
5894 +#ifdef NO_CAPITALIZATION_SUPPORT
5895 + while (dp != NULL)
5897 + (void) tinsert (dp);
5900 + free ((char *) olddp);
5903 + while (dp != NULL)
5907 + isvariant = dp->flagfield & MOREVARIANTS;
5908 + olddp = newdp->next;
5912 + newdp->next = olddp;
5916 + isvariant = dp->flagfield & MOREVARIANTS;
5917 + newdp = tinsert (dp);
5920 + free ((char *) olddp);
5926 + if (oldhtab != NULL)
5927 + free ((char *) oldhtab);
5932 + ** We're ready to do the insertion. Start by creating a sample
5933 + ** entry for the word.
5935 + if (makedent (word, wordlen, &wordent) < 0)
5936 + return; /* Word must be too big or something */
5938 + wordent.flagfield |= KEEP;
5940 + ** Now see if word or a variant is already in the table. We use the
5941 + ** capitalized version so we'll find the header, if any.
5943 + (void) strtoichar (nword, word, sizeof nword, 1);
5945 + if ((dp = lookup (nword, 1)) != NULL)
5947 + /* It exists. Combine caps and set the keep flag. */
5948 + if (combinecaps (dp, &wordent) < 0)
5950 + free (wordent.word);
5956 + /* It's new. Insert the word. */
5957 + dp = tinsert (&wordent);
5958 +#ifndef NO_CAPITALIZATION_SUPPORT
5959 + if (captype (dp->flagfield) == FOLLOWCASE)
5960 + (void) addvheader (dp);
5967 +Local struct dent *
5969 + struct dent * proto) /* Prototype entry to copy */
5971 + ichar_t iword[INPUTWORDLEN + MAXAFFIXLEN];
5972 + register int hcode;
5973 + register struct dent * hp; /* Next trial entry in hash table */
5974 + register struct dent * php; /* Prev. value of hp, for chaining */
5976 + if (strtoichar (iword, proto->word, sizeof iword, 1))
5977 + (void) fprintf (stderr, WORD_TOO_LONG (proto->word));
5978 +#ifdef NO_CAPITALIZATION_SUPPORT
5981 + hcode = hash (iword, pershsize);
5983 + hp = &pershtab[hcode];
5984 + if (hp->flagfield & USED)
5986 + while (hp != NULL)
5991 + hp = (struct dent *) calloc (1, sizeof (struct dent));
5994 + (void) fprintf (stderr, TREE_C_NO_SPACE);
6005 +Public struct dent *
6006 +treelookup (register ichar_t * word)
6009 + register int hcode;
6010 + register struct dent * hp;
6011 + char chword[INPUTWORDLEN + MAXAFFIXLEN];
6013 + if (pershsize <= 0)
6015 + (void) ichartostr (chword, word, sizeof chword, 1);
6016 + hcode = hash (word, pershsize);
6017 + hp = &pershtab[hcode];
6018 + while (hp != NULL && (hp->flagfield & USED))
6020 + if (strcmp (chword, hp->word) == 0)
6022 +#ifndef NO_CAPITALIZATION_SUPPORT
6023 + while (hp->flagfield & MOREVARIANTS)
6028 + if (hp != NULL && (hp->flagfield & USED))
6034 +#if SORTPERSONAL != 0
6035 +/* Comparison routine for sorting the personal dictionary with qsort */
6038 + struct dent ** enta,
6039 + struct dent ** entb)
6042 + /* The parentheses around *enta and *entb below are NECESSARY!
6043 + ** Otherwise the compiler reads it as *(enta->word), or
6044 + ** enta->word[0], which is illegal (but pcc takes it and
6045 + ** produces wrong code).
6047 + return casecmp ((*enta)->word, (*entb)->word, 1);
6055 + register struct dent * cent; /* Current entry */
6056 + register struct dent * lent; /* Linked entry */
6057 +#if SORTPERSONAL != 0
6058 + int pdictsize; /* Number of entries to write */
6059 + struct dent ** sortlist; /* List of entries to be sorted */
6060 + register struct dent ** sortptr; /* Handy pointer into sortlist */
6062 + register struct dent * ehtab; /* End of pershtab, for fast looping */
6064 + if (newwords == 0)
6067 + if ((dictf = fopen (personaldict, "w")) == NULL)
6069 + (void) fprintf (stderr, CANT_CREATE, personaldict);
6073 +#if SORTPERSONAL != 0
6075 + ** If we are going to sort the personal dictionary, we must know
6076 + ** how many items are going to be sorted.
6079 + if (hcount >= SORTPERSONAL)
6083 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab;
6086 + for (lent = cent; lent != NULL; lent = lent->next)
6088 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6090 +#ifndef NO_CAPITALIZATION_SUPPORT
6091 + while (lent->flagfield & MOREVARIANTS)
6092 + lent = lent->next;
6096 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6098 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6101 + ** We only want to count variant headers
6102 + ** and standalone entries. These happen
6103 + ** to share the characteristics in the
6104 + ** test below. This test will appear
6105 + ** several more times in this routine.
6107 +#ifndef NO_CAPITALIZATION_SUPPORT
6108 + if (captype (cent->flagfield) != FOLLOWCASE
6109 + && cent->word != NULL)
6114 + sortlist = (struct dent **) malloc (pdictsize * sizeof (struct dent));
6116 + if (sortlist == NULL)
6119 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab;
6122 + for (lent = cent; lent != NULL; lent = lent->next)
6124 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6126 + toutent (dictf, lent, 1);
6127 +#ifndef NO_CAPITALIZATION_SUPPORT
6128 + while (lent->flagfield & MOREVARIANTS)
6129 + lent = lent->next;
6134 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6136 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6138 +#ifndef NO_CAPITALIZATION_SUPPORT
6139 + if (captype (cent->flagfield) != FOLLOWCASE
6140 + && cent->word != NULL)
6142 + toutent (dictf, cent, 1);
6145 +#if SORTPERSONAL != 0
6149 + ** Produce dictionary in sorted order. We used to do this
6150 + ** destructively, but that turns out to fail because in some modes
6151 + ** the dictionary is written more than once. So we build an
6152 + ** auxiliary pointer table (in sortlist) and sort that. This
6153 + ** is faster anyway, though it uses more memory.
6155 + sortptr = sortlist;
6156 + for (cent = pershtab, ehtab = pershtab + pershsize; cent < ehtab; cent++)
6158 + for (lent = cent; lent != NULL; lent = lent->next)
6160 + if ((lent->flagfield & (USED | KEEP)) == (USED | KEEP))
6162 + *sortptr++ = lent;
6163 +#ifndef NO_CAPITALIZATION_SUPPORT
6164 + while (lent->flagfield & MOREVARIANTS)
6165 + lent = lent->next;
6170 + for (cent = hashtbl, ehtab = hashtbl + hashsize; cent < ehtab; cent++)
6172 + if ((cent->flagfield & (USED | KEEP)) == (USED | KEEP))
6174 +#ifndef NO_CAPITALIZATION_SUPPORT
6175 + if (captype (cent->flagfield) != FOLLOWCASE
6176 + && cent->word != NULL)
6178 + *sortptr++ = cent;
6181 + /* Sort the list */
6182 + qsort ((char *) sortlist, (unsigned) pdictsize,
6183 + sizeof (sortlist[0]),
6184 + (int (*) (const void *, const void *)) pdictcmp);
6185 + /* Write it out */
6186 + for (sortptr = sortlist; --pdictsize >= 0; )
6187 + toutent (dictf, *sortptr++, 1);
6188 + free ((char *) sortlist);
6193 + (void) fclose (dictf);
6196 +#ifdef REGEX_LOOKUP
6198 +/* check the hashed dictionary for words matching the regex. return the */
6199 +/* a matching string if found else return NULL */
6202 + char * expr, /* regular expression to use in the match */
6203 + int whence) /* 0 = start at the beg with new regx, else */
6204 + /* continue from cur point w/ old regex */
6206 + static struct dent * curent;
6207 + static int curindex;
6208 + static struct dent * curpersent;
6209 + static int curpersindex;
6210 + static REGCTYPE cmp_expr = (REGCTYPE)0;
6211 + char dummy[INPUTWORDLEN + MAXAFFIXLEN];
6216 + is = strtosichar (expr, 0);
6218 + expr = ichartosstr (is, 1);
6219 + REGFREE (cmp_expr); /* free previous compiled pattern, if any */
6220 + cmp_expr = REGCMP (cmp_expr, expr);
6223 + curpersent = pershtab;
6227 + /* search the dictionary until the word is found or the words run out */
6228 + for ( ; curindex < hashsize; curent++, curindex++)
6230 + if (curent->word != NULL
6231 + && REGEX (cmp_expr, curent->word, dummy) != NULL)
6234 + /* Everybody's gotta write a wierd expression once in a while! */
6235 + return curent++->word;
6238 + /* Try the personal dictionary too */
6239 + for ( ; curpersindex < pershsize; curpersent++, curpersindex++)
6241 + if ((curpersent->flagfield & USED) != 0
6242 + && curpersent->word != NULL
6243 + && REGEX (cmp_expr, curpersent->word, dummy) != NULL)
6246 + /* Everybody's gotta write a wierd expression once in a while! */
6247 + return curpersent++->word;
6252 +#endif /* REGEX_LOOKUP */
6253 diff -Nur vim61.orig/src/spell/util.c vim61/src/spell/util.c
6254 --- vim61.orig/src/spell/util.c Thu Jan 1 01:00:00 1970
6255 +++ vim61/src/spell/util.c Wed Mar 27 15:08:08 2002
6258 +#include "ispell.h"
6260 +Local char *myrindex(char *s, char c);
6266 + int canonical) /* NZ for canonical string chars */
6268 + register ichar_t * ap;
6269 + register ichar_t * bp;
6270 + ichar_t inta[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6271 + ichar_t intb[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6273 + (void) strtoichar (inta, a, sizeof inta, canonical);
6274 + (void) strtoichar (intb, b, sizeof intb, canonical);
6275 + for (ap = inta, bp = intb; *ap != 0; ap++, bp++)
6280 + return hashheader.sortorder[*ap];
6281 + else if (mylower (*ap))
6283 + if (mylower (*bp) || mytoupper (*ap) != *bp)
6284 + return (int) hashheader.sortorder[*ap] -
6285 + (int) hashheader.sortorder[*bp];
6289 + if (myupper (*bp) || mytolower (*ap) != *bp)
6290 + return (int) hashheader.sortorder[*ap] -
6291 + (int) hashheader.sortorder[*bp];
6296 + return -(int) hashheader.sortorder[*bp];
6297 + for (ap = inta, bp = intb; *ap; ap++, bp++)
6301 + return (int) hashheader.sortorder[*ap] -
6302 + (int) hashheader.sortorder[*bp];
6310 + register ichar_t * word,
6311 + register ichar_t * pattern,
6316 + struct dent * firstdent,
6317 + struct flagent * pfxent,
6318 + struct flagent * sufent)
6320 + int i; /* Index into savearea */
6321 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN];
6322 + int nsaved; /* Number of words saved */
6325 + save_root_cap (word, pattern, prestrip, preadd, sufstrip, sufadd,
6326 + firstdent, pfxent, sufent, savearea, &nsaved);
6327 + for (i = 0; i < nsaved; i++)
6329 + if (insert (savearea[i]) < 0)
6337 + register ichar_t * word, /* Word to be saved */
6338 + register ichar_t * pattern, /* Capitalization pattern */
6339 + int prestrip, /* No. chars stripped from front */
6340 + int preadd, /* No. chars added to front of root */
6341 + int sufstrip, /* No. chars stripped from back */
6342 + int sufadd, /* No. chars added to back of root */
6343 + struct dent * firstdent, /* First dent for root */
6344 + struct flagent * pfxent, /* Pfx-flag entry for word */
6345 + struct flagent * sufent, /* Sfx-flag entry for word */
6346 + ichar_t savearea[MAX_CAPS][INPUTWORDLEN + MAXAFFIXLEN],
6347 + /* Room to save words */
6348 + int * nsaved) /* Number saved so far (updated) */
6350 +#ifndef NO_CAPITALIZATION_SUPPORT
6351 + register struct dent * dent;
6352 +#endif /* NO_CAPITALIZATION_SUPPORT */
6354 + ichar_t newword[INPUTWORDLEN + 4 * MAXAFFIXLEN + 4];
6355 +#ifndef NO_CAPITALIZATION_SUPPORT
6356 + register ichar_t * p;
6360 +#endif /* NO_CAPITALIZATION_SUPPORT */
6362 + if (*nsaved >= MAX_CAPS)
6364 + (void) icharcpy (newword, word);
6365 + firstisupper = myupper (pattern[0]);
6366 +#ifdef NO_CAPITALIZATION_SUPPORT
6368 + ** Apply the old, simple-minded capitalization rules.
6372 + if (myupper (pattern[1]))
6376 + lowcase (newword);
6377 + newword[0] = mytoupper (newword[0]);
6381 + lowcase (newword);
6382 + (void) icharcpy (savearea[*nsaved], newword);
6385 +#else /* NO_CAPITALIZATION_SUPPORT */
6386 +#define flagsareok(dent) \
6387 + ((pfxent == NULL \
6388 + || TSTMASKBIT (dent->mask, pfxent->flagbit)) \
6389 + && (sufent == NULL \
6390 + || TSTMASKBIT (dent->mask, sufent->flagbit)))
6393 + if ((dent->flagfield & (CAPTYPEMASK | MOREVARIANTS)) == ALLCAPS)
6395 + upcase (newword); /* Uppercase required */
6396 + (void) icharcpy (savearea[*nsaved], newword);
6400 + for (p = pattern; *p; p++)
6407 + upcase (newword); /* Pattern was all caps */
6408 + (void) icharcpy (savearea[*nsaved], newword);
6412 + for (p = pattern + 1; *p; p++)
6420 + ** The pattern was all-lower or capitalized. If that's
6421 + ** legal, insert only that version.
6425 + if (captype (dent->flagfield) == CAPITALIZED
6426 + || captype (dent->flagfield) == ANYCASE)
6428 + lowcase (newword);
6429 + newword[0] = mytoupper (newword[0]);
6430 + (void) icharcpy (savearea[*nsaved], newword);
6437 + if (captype (dent->flagfield) == ANYCASE)
6439 + lowcase (newword);
6440 + (void) icharcpy (savearea[*nsaved], newword);
6445 + while (dent->flagfield & MOREVARIANTS)
6447 + dent = dent->next;
6448 + if (captype (dent->flagfield) == FOLLOWCASE
6449 + || !flagsareok (dent))
6453 + if (captype (dent->flagfield) == CAPITALIZED)
6455 + lowcase (newword);
6456 + newword[0] = mytoupper (newword[0]);
6457 + (void) icharcpy (savearea[*nsaved], newword);
6464 + if (captype (dent->flagfield) == ANYCASE)
6466 + lowcase (newword);
6467 + (void) icharcpy (savearea[*nsaved], newword);
6475 + ** Either the sample had complex capitalization, or the simple
6476 + ** capitalizations (all-lower or capitalized) are illegal.
6477 + ** Insert all legal capitalizations, including those that are
6478 + ** all-lower or capitalized. If the prototype is capitalized,
6479 + ** capitalized all-lower samples. Watch out for affixes.
6482 + p = strtosichar (dent->word, 1);
6483 + len = icharlen (p);
6484 + if (dent->flagfield & MOREVARIANTS)
6485 + dent = dent->next; /* Skip place-holder entry */
6488 + if (flagsareok (dent))
6490 + if (captype (dent->flagfield) != FOLLOWCASE)
6492 + lowcase (newword);
6493 + if (firstisupper || captype (dent->flagfield) == CAPITALIZED)
6494 + newword[0] = mytoupper (newword[0]);
6495 + (void) icharcpy (savearea[*nsaved], newword);
6497 + if (*nsaved >= MAX_CAPS)
6502 + /* Followcase is the tough one. */
6503 + p = strtosichar (dent->word, 1);
6504 + (void) bcopy ((char *) (p + prestrip),
6505 + (char *) (newword + preadd),
6506 + (len - prestrip - sufstrip) * sizeof (ichar_t));
6507 + if (myupper (p[prestrip]))
6509 + for (i = 0; i < preadd; i++)
6510 + newword[i] = mytoupper (newword[i]);
6514 + for (i = 0; i < preadd; i++)
6515 + newword[i] = mytolower (newword[i]);
6517 + limit = len + preadd + sufadd - prestrip - sufstrip;
6518 + i = len + preadd - prestrip - sufstrip;
6519 + p += len - sufstrip - 1;
6522 + for (p = newword + i; i < limit; i++, p++)
6523 + *p = mytoupper (*p);
6527 + for (p = newword + i; i < limit; i++, p++)
6528 + *p = mytolower (*p);
6530 + (void) icharcpy (savearea[*nsaved], newword);
6532 + if (*nsaved >= MAX_CAPS)
6536 + if ((dent->flagfield & MOREVARIANTS) == 0)
6537 + break; /* End of the line */
6538 + dent = dent->next;
6541 +#endif /* NO_CAPITALIZATION_SUPPORT */
6544 +insert(register ichar_t * word)
6547 + register char * realword;
6549 + realword = ichartosstr (word, 0);
6550 + for (i = 0; i < pcount; i++)
6551 + if (strcmp (possibilities[i], realword) == 0)
6554 + (void) strcpy (possibilities[pcount++], realword);
6555 + i = strlen (realword);
6556 + if (i > maxposslen)
6558 + if (pcount >= MAXPOSSIBLE)
6564 +** A trivial wrapper for rindex (file '/') on Unix, but
6565 +** saves a lot of ifdef-ing on MS-DOS.
6569 +last_slash (char *file)
6572 + char *slash = myrindex (file, '/');
6575 + ** Can have a backslash or a colon; both mean the basename
6576 + ** begins right after them.
6578 + char *bs = myrindex (file, '\\');
6581 + ** We can have both forward- and backslashes; return the
6582 + ** place of rightmost one of either gender.
6584 + if (slash == NULL || (bs != NULL && bs > slash))
6586 + if (slash == NULL && file[0] != '\0' && file[1] == ':')
6593 +myrindex(char *s, register char c)
6598 + x = s + strlen(s) - 1;
6608 diff -Nur vim61.orig/src/spell/version.h vim61/src/spell/version.h
6609 --- vim61.orig/src/spell/version.h Thu Jan 1 01:00:00 1970
6610 +++ vim61/src/spell/version.h Wed Mar 27 15:08:08 2002
6613 + * Since the strings in this file are printed out when the "-v" switch is
6614 + * given to ispell, you may want to translate them into your native language.
6615 + * However, any translation of these strings MUST accurately preserve the
6616 + * legal rights under international law; you may wish to consult a lawyer
6617 + * about this since you will be responsible for the results of any
6618 + * incorrect translation.
6621 +Local char *Version_ID[] = {
6622 + "@(#) International Ispell Version 3.1.20 10/10/95",
6623 + "@(#) Copyright (c), 1983, by Pace Willisson",
6624 + "@(#) International version Copyright (c) 1987, 1988, 1990-1995,",
6625 + "@(#) by Geoff Kuenning, Granada Hills, CA. All rights reserved.",
6627 + "@(#) Redistribution and use in source and binary forms, with or without",
6628 + "@(#) modification, are permitted provided that the following conditions",
6631 + "@(#) 1. Redistributions of source code must retain the above copyright",
6632 + "@(#) notice, this list of conditions and the following disclaimer.",
6633 + "@(#) 2. Redistributions in binary form must reproduce the above",
6634 + "@(#) copyright notice, this list of conditions and the following",
6635 + "@(#) disclaimer in the documentation and/or other materials provided",
6636 + "@(#) with the distribution.",
6637 + "@(#) 3. All modifications to the source code must be clearly marked as",
6638 + "@(#) such. Binary redistributions based on modified source code",
6639 + "@(#) must be clearly marked as modified versions in the documentation",
6640 + "@(#) and/or other materials provided with the distribution.",
6641 + "@(#) 4. All advertising materials mentioning features or use of this",
6642 + "@(#) software must display the following acknowledgment:",
6643 + "@(#) This product includes software developed by Geoff Kuenning and",
6644 + "@(#) other unpaid contributors.",
6645 + "@(#) 5. The name of Geoff Kuenning may not be used to endorse or promote",
6646 + "@(#) products derived from this software without specific prior",
6647 + "@(#) written permission.",
6649 + "@(#) THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS",
6650 + "@(#) IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT",
6651 + "@(#) LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS",
6652 + "@(#) FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEOFF",
6653 + "@(#) KUENNING OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,",
6654 + "@(#) INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES",
6655 + "@(#) (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR",
6656 + "@(#) SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)",
6657 + "@(#) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,",
6658 + "@(#) STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)",
6659 + "@(#) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED",
6660 + "@(#) OF THE POSSIBILITY OF SUCH DAMAGE.",
6664 +static char RCS_Version_ID[] =
6669 + * Revision 1.44 1995/10/11 05:03:28 geoff
6670 + * Upgrade to patch level 20
6672 + * Revision 1.43 1995/10/11 04:58:26 geoff
6673 + * Upgrade to patch 19
6675 + * Revision 1.42 1995/01/15 01:23:26 geoff
6676 + * Upgrade to patch level 18
6678 + * Revision 1.41 1995/01/15 01:14:30 geoff
6679 + * Upgrade to patch level 17
6681 + * Revision 1.40 1995/01/15 01:03:55 geoff
6682 + * Upgrade to patch level 16
6684 + * Revision 1.39 1995/01/15 01:01:01 geoff
6685 + * Upgrade to patch level 15
6687 + * Revision 1.38 1995/01/15 00:54:19 geoff
6688 + * Upgrade to patch level 14
6690 + * Revision 1.37 1994/11/21 07:03:01 geoff
6691 + * Update to patch level 13.
6693 + * Revision 1.36 1994/11/01 06:28:31 geoff
6694 + * Update to patch level 12
6696 + * Revision 1.35 1994/11/01 06:12:42 geoff
6697 + * Update to patch level 11
6699 + * Revision 1.34 1994/11/01 06:01:15 geoff
6700 + * Update to patch level 10
6702 + * Revision 1.33 1994/11/01 05:36:43 geoff
6703 + * Update to patch level 9
6705 + * Revision 1.32 1994/05/25 04:38:59 geoff
6706 + * Update to patch level 8
6708 + * Revision 1.31 1994/05/18 03:07:26 geoff
6709 + * Update to patch level 7
6711 + * Revision 1.30 1994/05/17 06:21:05 geoff
6712 + * Version update for ispell.el release
6714 + * Revision 1.29 1994/04/27 04:14:18 geoff
6715 + * Update to patch level 5
6717 + * Revision 1.28 1994/03/21 02:00:50 geoff
6718 + * Update to patch level 4
6720 + * Revision 1.27 1994/02/23 04:52:31 geoff
6721 + * Update to latest version.
6723 + * Revision 1.26 1994/02/08 05:59:20 geoff
6726 + * Revision 1.25 1994/02/07 08:58:28 geoff
6727 + * Get rid of a comma that confuses patch
6729 + * Revision 1.24 1994/02/07 08:24:23 geoff
6730 + * Upate patch level
6732 + * Revision 1.23 1994/01/25 07:12:21 geoff
6733 + * Get rid of all old RCS log lines in preparation for the 3.1 release.
6736 diff -Nur vim61.orig/src/spell/wm.h vim61/src/spell/wm.h
6737 --- vim61.orig/src/spell/wm.h Thu Jan 1 01:00:00 1970
6738 +++ vim61/src/spell/wm.h Wed Mar 27 15:08:08 2002
6741 +enum _logical {False,True};
6742 +typedef enum _logical Logical;
6746 +typedef unsigned int Word;
6747 +typedef unsigned char Byte;
6750 +#define Local static
6752 diff -Nur vim61.orig/src/spell.c vim61/src/spell.c
6753 --- vim61.orig/src/spell.c Thu Jan 1 01:00:00 1970
6754 +++ vim61/src/spell.c Wed Mar 27 15:08:08 2002
6756 +#include "spell/wm.h"
6759 +#include "ispell.h"
6760 +#define MAXWORDLEN 80
6762 +#ifdef FEAT_SPELL_HL
6764 +int spell_flag = 0;
6767 +ex_spell(exarg_T *eap)
6770 + if(strcmp(eap->arg, "on") == 0)
6775 + if(!reload_dict())
6779 + else if(STRCMP(eap->arg, "off") == 0)
6782 + EMSG2("Invalid :spell %s", eap->arg);
6783 + redraw_all_later(NOT_VALID);
6791 + if(spell_flag == 0)
6793 + spell_save_private_dict();
6795 + if(STRCMP(p_spell_lang, "") == 0)
6797 + EMSG("dictionary not defined");
6798 + do_cmdline((char_u *)"spell off", NULL, NULL, DOCMD_VERBOSE);
6802 + if ((err = linit(hashname)) != NULL)
6805 + do_cmdline((char_u *)"spell off", NULL, NULL, DOCMD_VERBOSE);
6809 + treeinit (NULL, p_spell_lang);
6813 +static colnr_T last_col;
6814 +static ichar_t curr_word[MAXWORDLEN + 1]; /* assume max. keyword len is 80 */
6815 +static char word_to_spell[MAXWORDLEN + 1];
6817 +static Logical in_word;
6819 +int my_is_char(char_u ccc);
6822 +get_spell_attr(spell_col, col, line)
6823 + colnr_T spell_col;
6831 + if(spell_col == 0)
6832 + last_col = 0, in_word = False, last_attr = 0;
6834 + if((spell_col < last_col) && in_word)
6835 + return(last_attr);
6836 + else if(spell_col >= last_col)
6840 + line_ptr = &line[spell_col];
6841 + curr_col = spell_col;
6842 + if(iswordch((ichar_t)(*line_ptr)) && *line_ptr)
6844 + while((spell_col > 0) && my_is_char(*(line_ptr - 1)))
6845 + spell_col--, line_ptr--;
6846 + while(isboundarych((ichar_t)(*(line_ptr))))
6847 + spell_col++, line_ptr++;
6849 + line_ptr = &line[spell_col];
6850 + curr_col = spell_col;
6851 + while(my_is_char(*line_ptr) && *line_ptr &&
6852 + ((curr_col - spell_col) < MAXWORDLEN))
6853 + curr_col++, line_ptr++;
6854 + while(isboundarych((ichar_t)(*(line_ptr - 1))))
6855 + curr_col--, line_ptr--;
6857 + if(curr_col - spell_col > 1)
6859 + /*for(i = 0; i < curr_col - spell_col; i++)
6860 + curr_word[i] = line[spell_col + i];
6861 + curr_word[curr_col - spell_col] = NUL;*/
6862 + strtoichar(curr_word,line+spell_col,(curr_col-spell_col+1)*sizeof(ichar_t),0);
6865 +/* for(i = 0; curr_word[i]; i++)
6866 + fprintf(stderr, "%c", curr_word[i]);
6867 + fprintf(stderr, "-%d\n", good((ichar_t *)curr_word, 0, 0, 0, 0)); wm */
6868 + if(good((ichar_t *)curr_word, 0, 0, 0, 0) == 0)
6869 + last_attr = hl_attr(HLF_SPELL);
6870 + last_col = curr_col;
6873 + return(last_attr);
6880 + if(iswordch((ichar_t)ccc) || isboundarych((ichar_t)ccc))
6887 +static ichar_t *itok;
6890 +set_to_private_dict(char *line, int cursor_col, int convert_to_lower)
6897 + b = line + cursor_col;
6901 + if(iswordch((ichar_t)(*b)) || isboundarych((ichar_t)(*b)))
6903 + while((iswordch((ichar_t)(*(b - 1))) ||
6904 + isboundarych((ichar_t)(*(b - 1)))) &&
6906 + b--, cursor_col--;
6907 + while(isboundarych((ichar_t)(*b)))
6909 + while((iswordch((ichar_t)(*(e))) || isboundarych((ichar_t)(*(e)))) &&
6912 + while(isboundarych((ichar_t)(*(e - 1))))
6914 + for(i = 0; b < e;)
6915 + word_to_spell[i++] = *b++;
6916 + word_to_spell[i] = '\0';
6917 + if(!convert_to_lower)
6918 + treeinsert (ichartosstr (strtosichar (word_to_spell, 0), 1),
6919 + ICHARTOSSTR_SIZE, 1);
6922 + itok = strtosichar (word_to_spell, 0);
6924 + treeinsert (ichartosstr (itok, 1), ICHARTOSSTR_SIZE, 1);
6926 + redraw_all_later(NOT_VALID);
6932 +spell_save_private_dict(void)
6939 diff -Nur vim61.orig/src/syntax.c vim61/src/syntax.c
6940 --- vim61.orig/src/syntax.c Thu Feb 21 21:11:38 2002
6941 +++ vim61/src/syntax.c Wed Mar 27 15:08:08 2002
6942 @@ -5859,6 +5859,9 @@
6943 "VertSplit term=reverse cterm=reverse gui=reverse",
6944 "Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg",
6945 "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold",
6946 +#ifdef FEAT_SPELL_HL
6947 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6949 "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red",
6952 @@ -5878,6 +5881,9 @@
6953 "Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue",
6954 "FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue",
6955 "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue",
6956 +#ifdef FEAT_SPELL_HL
6957 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6959 "DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta",
6960 "DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan",
6962 @@ -5898,6 +5904,9 @@
6963 "Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan",
6964 "FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan",
6965 "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue",
6966 +#ifdef FEAT_SPELL_HL
6967 + "Spell term=reverse ctermbg=NONE ctermfg=White guibg=NONE guifg=Red",
6969 "DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta",
6970 "DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan",
6972 diff -Nur vim61.orig/src/version.c vim61/src/version.c
6973 --- vim61.orig/src/version.c Fri Mar 22 21:20:55 2002
6974 +++ vim61/src/version.c Wed Mar 27 15:08:08 2002
6975 @@ -455,6 +455,11 @@
6979 +#ifdef FEAT_SPELL_HL
6984 /* only interesting on Unix systems */
6985 #if defined(USE_SYSTEM) && (defined(UNIX) || defined(__EMX__))
6987 @@ -1048,7 +1053,7 @@
6996 diff -Nur vim61.orig/src/version.h vim61/src/version.h
6997 --- vim61.orig/src/version.h Fri Mar 22 21:07:59 2002
6998 +++ vim61/src/version.h Wed Mar 27 15:09:43 2002
7001 #define VIM_VERSION_NODOT "vim61"
7002 #define VIM_VERSION_SHORT "6.1"
7003 +#ifdef FEAT_SPELL_HL
7004 +#define VIM_VERSION_MEDIUM "6.1 + ispell 3.1.20 WM-3"
7006 #define VIM_VERSION_MEDIUM "6.1"
7008 #define VIM_VERSION_LONG "VIM - Vi IMproved 6.1 (2002 Mar 24)"
7009 #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 6.1 (2002 Mar 24, compiled "
7010 diff -Nur vim61.orig/src/vim.h vim61/src/vim.h
7011 --- vim61.orig/src/vim.h Tue Mar 12 21:23:45 2002
7012 +++ vim61/src/vim.h Wed Mar 27 15:08:08 2002
7013 @@ -1048,13 +1048,14 @@
7014 , HLF_CHD /* Changed diff line */
7015 , HLF_DED /* Deleted diff line */
7016 , HLF_TXD /* Text Changed in diff line */
7017 + , HLF_SPELL /* spell - string not in dictionary WM */
7018 , HLF_COUNT /* MUST be the last one */
7021 /* the HL_FLAGS must be in the same order as the HLF_ enums! */
7022 #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
7023 'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
7024 - 'f', 'F', 'A', 'C', 'D', 'T'}
7025 + 'f', 'F', 'A', 'C', 'D', 'T', 'Z'}