Mercurial > vim
comparison src/spell.c @ 714:0f9f4761ad9c v7.0216
updated for version 7.0216
author | vimboss |
---|---|
date | Mon, 06 Mar 2006 23:29:24 +0000 |
parents | 8165a037200b |
children | b526e10493b1 |
comparison
equal
deleted
inserted
replaced
713:0c381fb7846c | 714:0f9f4761ad9c |
---|---|
114 * | 114 * |
115 * <sectionlen> 4 bytes length of section contents, MSB first | 115 * <sectionlen> 4 bytes length of section contents, MSB first |
116 * | 116 * |
117 * <sectionend> 1 byte SN_END | 117 * <sectionend> 1 byte SN_END |
118 * | 118 * |
119 * | |
120 * sectionID == SN_INFO: <infotext> | |
121 * <infotext> N bytes free format text with spell file info (version, | |
122 * website, etc) | |
119 * | 123 * |
120 * sectionID == SN_REGION: <regionname> ... | 124 * sectionID == SN_REGION: <regionname> ... |
121 * <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case. | 125 * <regionname> 2 bytes Up to 8 region names: ca, au, etc. Lower case. |
122 * First <regionname> is region 1. | 126 * First <regionname> is region 1. |
123 * | 127 * |
183 * | 187 * |
184 * sectionID == SN_COMPOUND: <compmax> <compminlen> <compsylmax> <compflags> | 188 * sectionID == SN_COMPOUND: <compmax> <compminlen> <compsylmax> <compflags> |
185 * <compmax> 1 byte Maximum nr of words in compound word. | 189 * <compmax> 1 byte Maximum nr of words in compound word. |
186 * <compminlen> 1 byte Minimal word length for compounding. | 190 * <compminlen> 1 byte Minimal word length for compounding. |
187 * <compsylmax> 1 byte Maximum nr of syllables in compound word. | 191 * <compsylmax> 1 byte Maximum nr of syllables in compound word. |
188 * <compflags> N bytes Flags from COMPOUNDFLAGS items, separated by | 192 * <compflags> N bytes Flags from COMPOUNDRULE items, separated by |
189 * slashes. | 193 * slashes. |
190 * | 194 * |
191 * sectionID == SN_NOBREAK: (empty, its presence is enough) | 195 * sectionID == SN_NOBREAK: (empty, its presence is enough) |
192 * | 196 * |
193 * sectionID == SN_SYLLABLE: <syllable> | 197 * sectionID == SN_SYLLABLE: <syllable> |
288 * stored as an offset to the previous number in as | 292 * stored as an offset to the previous number in as |
289 * few bytes as possible, see offset2bytes()) | 293 * few bytes as possible, see offset2bytes()) |
290 */ | 294 */ |
291 | 295 |
292 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) | 296 #if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64) |
293 # include <io.h> /* for lseek(), must be before vim.h */ | 297 # include "vimio.h" /* for lseek(), must be before vim.h */ |
294 #endif | 298 #endif |
295 | 299 |
296 #include "vim.h" | 300 #include "vim.h" |
297 | 301 |
298 #if defined(FEAT_SYN_HL) || defined(PROTO) | 302 #if defined(FEAT_SYN_HL) || defined(PROTO) |
429 char_u *sl_kbyts; /* keep-case word bytes */ | 433 char_u *sl_kbyts; /* keep-case word bytes */ |
430 idx_T *sl_kidxs; /* keep-case word indexes */ | 434 idx_T *sl_kidxs; /* keep-case word indexes */ |
431 char_u *sl_pbyts; /* prefix tree word bytes */ | 435 char_u *sl_pbyts; /* prefix tree word bytes */ |
432 idx_T *sl_pidxs; /* prefix tree word indexes */ | 436 idx_T *sl_pidxs; /* prefix tree word indexes */ |
433 | 437 |
438 char_u *sl_info; /* infotext string or NULL */ | |
439 | |
434 char_u sl_regions[17]; /* table with up to 8 region names plus NUL */ | 440 char_u sl_regions[17]; /* table with up to 8 region names plus NUL */ |
435 | 441 |
436 char_u *sl_midword; /* MIDWORD string or NULL */ | 442 char_u *sl_midword; /* MIDWORD string or NULL */ |
437 | 443 |
438 hashtab_T sl_wordcount; /* hashtable with word count, wordcount_T */ | 444 hashtab_T sl_wordcount; /* hashtable with word count, wordcount_T */ |
439 | 445 |
440 int sl_compmax; /* COMPOUNDMAX (default: MAXWLEN) */ | 446 int sl_compmax; /* COMPOUNDMAX (default: MAXWLEN) */ |
441 int sl_compminlen; /* COMPOUNDMIN (default: 0) */ | 447 int sl_compminlen; /* COMPOUNDMIN (default: 0) */ |
442 int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */ | 448 int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */ |
443 regprog_T *sl_compprog; /* COMPOUNDFLAGS turned into a regexp progrm | 449 regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm |
444 * (NULL when no compounding) */ | 450 * (NULL when no compounding) */ |
445 char_u *sl_compstartflags; /* flags for first compound word */ | 451 char_u *sl_compstartflags; /* flags for first compound word */ |
446 char_u *sl_compallflags; /* all flags for compound words */ | 452 char_u *sl_compallflags; /* all flags for compound words */ |
447 char_u sl_nobreak; /* When TRUE: no spaces between words */ | 453 char_u sl_nobreak; /* When TRUE: no spaces between words */ |
448 char_u *sl_syllable; /* SYLLABLE repeatable chars or NULL */ | 454 char_u *sl_syllable; /* SYLLABLE repeatable chars or NULL */ |
532 #define SN_NOBREAK 10 /* NOBREAK section */ | 538 #define SN_NOBREAK 10 /* NOBREAK section */ |
533 #define SN_SUGFILE 11 /* timestamp for .sug file */ | 539 #define SN_SUGFILE 11 /* timestamp for .sug file */ |
534 #define SN_REPSAL 12 /* REPSAL items section */ | 540 #define SN_REPSAL 12 /* REPSAL items section */ |
535 #define SN_WORDS 13 /* common words */ | 541 #define SN_WORDS 13 /* common words */ |
536 #define SN_NOSPLITSUGS 14 /* don't split word for suggestions */ | 542 #define SN_NOSPLITSUGS 14 /* don't split word for suggestions */ |
543 #define SN_INFO 15 /* info section */ | |
537 #define SN_END 255 /* end of sections */ | 544 #define SN_END 255 /* end of sections */ |
538 | 545 |
539 #define SNF_REQUIRED 1 /* <sectionflags>: required section */ | 546 #define SNF_REQUIRED 1 /* <sectionflags>: required section */ |
540 | 547 |
541 /* Result values. Lower number is accepted over higher one. */ | 548 /* Result values. Lower number is accepted over higher one. */ |
1518 continue; | 1525 continue; |
1519 } | 1526 } |
1520 } | 1527 } |
1521 | 1528 |
1522 /* If the word ends the sequence of compound flags of the | 1529 /* If the word ends the sequence of compound flags of the |
1523 * words must match with one of the COMPOUNDFLAGS items and | 1530 * words must match with one of the COMPOUNDRULE items and |
1524 * the number of syllables must not be too large. */ | 1531 * the number of syllables must not be too large. */ |
1525 mip->mi_compflags[mip->mi_complen] = ((unsigned)flags >> 24); | 1532 mip->mi_compflags[mip->mi_complen] = ((unsigned)flags >> 24); |
1526 mip->mi_compflags[mip->mi_complen + 1] = NUL; | 1533 mip->mi_compflags[mip->mi_complen + 1] = NUL; |
1527 if (word_ends) | 1534 if (word_ends) |
1528 { | 1535 { |
2282 curbuf->b_fname, FALSE, curbuf)) | 2289 curbuf->b_fname, FALSE, curbuf)) |
2283 continue; | 2290 continue; |
2284 break; | 2291 break; |
2285 #endif | 2292 #endif |
2286 } | 2293 } |
2294 #ifdef FEAT_AUTOCMD | |
2295 break; | |
2296 #endif | |
2287 } | 2297 } |
2288 | 2298 |
2289 if (r == FAIL) | 2299 if (r == FAIL) |
2290 { | 2300 { |
2291 smsg((char_u *)_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), | 2301 smsg((char_u *)_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), |
2431 for (i = 0; i < lp->sl_prefixcnt; ++i) | 2441 for (i = 0; i < lp->sl_prefixcnt; ++i) |
2432 vim_free(lp->sl_prefprog[i]); | 2442 vim_free(lp->sl_prefprog[i]); |
2433 lp->sl_prefixcnt = 0; | 2443 lp->sl_prefixcnt = 0; |
2434 vim_free(lp->sl_prefprog); | 2444 vim_free(lp->sl_prefprog); |
2435 lp->sl_prefprog = NULL; | 2445 lp->sl_prefprog = NULL; |
2446 | |
2447 vim_free(lp->sl_info); | |
2448 lp->sl_info = NULL; | |
2436 | 2449 |
2437 vim_free(lp->sl_midword); | 2450 vim_free(lp->sl_midword); |
2438 lp->sl_midword = NULL; | 2451 lp->sl_midword = NULL; |
2439 | 2452 |
2440 vim_free(lp->sl_compprog); | 2453 vim_free(lp->sl_compprog); |
2618 goto truncerr; | 2631 goto truncerr; |
2619 | 2632 |
2620 res = 0; | 2633 res = 0; |
2621 switch (n) | 2634 switch (n) |
2622 { | 2635 { |
2636 case SN_INFO: | |
2637 lp->sl_info = read_string(fd, len); /* <infotext> */ | |
2638 if (lp->sl_info == NULL) | |
2639 goto endFAIL; | |
2640 break; | |
2641 | |
2623 case SN_REGION: | 2642 case SN_REGION: |
2624 res = read_region_section(fd, lp, len); | 2643 res = read_region_section(fd, lp, len); |
2625 break; | 2644 break; |
2626 | 2645 |
2627 case SN_CHARFLAGS: | 2646 case SN_CHARFLAGS: |
3384 c = getc(fd); /* <compsylmax> */ | 3403 c = getc(fd); /* <compsylmax> */ |
3385 if (c < 1) | 3404 if (c < 1) |
3386 c = MAXWLEN; | 3405 c = MAXWLEN; |
3387 slang->sl_compsylmax = c; | 3406 slang->sl_compsylmax = c; |
3388 | 3407 |
3389 /* Turn the COMPOUNDFLAGS items into a regexp pattern: | 3408 /* Turn the COMPOUNDRULE items into a regexp pattern: |
3390 * "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$". | 3409 * "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$". |
3391 * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. | 3410 * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes. |
3392 * Conversion to utf-8 may double the size. */ | 3411 * Conversion to utf-8 may double the size. */ |
3393 c = todo * 2 + 7; | 3412 c = todo * 2 + 7; |
3394 #ifdef FEAT_MBYTE | 3413 #ifdef FEAT_MBYTE |
4709 int si_region; /* region mask */ | 4728 int si_region; /* region mask */ |
4710 vimconv_T si_conv; /* for conversion to 'encoding' */ | 4729 vimconv_T si_conv; /* for conversion to 'encoding' */ |
4711 int si_memtot; /* runtime memory used */ | 4730 int si_memtot; /* runtime memory used */ |
4712 int si_verbose; /* verbose messages */ | 4731 int si_verbose; /* verbose messages */ |
4713 int si_msg_count; /* number of words added since last message */ | 4732 int si_msg_count; /* number of words added since last message */ |
4733 char_u *si_info; /* info text chars or NULL */ | |
4714 int si_region_count; /* number of regions supported (1 when there | 4734 int si_region_count; /* number of regions supported (1 when there |
4715 are no regions) */ | 4735 are no regions) */ |
4716 char_u si_region_name[16]; /* region names; used only if | 4736 char_u si_region_name[16]; /* region names; used only if |
4717 * si_region_count > 1) */ | 4737 * si_region_count > 1) */ |
4718 | 4738 |
4741 int si_newprefID; /* current value for ah_newID */ | 4761 int si_newprefID; /* current value for ah_newID */ |
4742 int si_newcompID; /* current value for compound ID */ | 4762 int si_newcompID; /* current value for compound ID */ |
4743 } spellinfo_T; | 4763 } spellinfo_T; |
4744 | 4764 |
4745 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); | 4765 static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); |
4766 static int spell_info_item __ARGS((char_u *s)); | |
4746 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); | 4767 static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); |
4747 static unsigned get_affitem __ARGS((int flagtype, char_u **pp)); | 4768 static unsigned get_affitem __ARGS((int flagtype, char_u **pp)); |
4748 static void process_compflags __ARGS((spellinfo_T *spin, afffile_T *aff, char_u *compflags)); | 4769 static void process_compflags __ARGS((spellinfo_T *spin, afffile_T *aff, char_u *compflags)); |
4749 static void check_renumber __ARGS((spellinfo_T *spin)); | 4770 static void check_renumber __ARGS((spellinfo_T *spin)); |
4750 static int flag_in_afflist __ARGS((int flagtype, char_u *afflist, unsigned flag)); | 4771 static int flag_in_afflist __ARGS((int flagtype, char_u *afflist, unsigned flag)); |
4934 hashitem_T *hi; | 4955 hashitem_T *hi; |
4935 int l; | 4956 int l; |
4936 int compminlen = 0; /* COMPOUNDMIN value */ | 4957 int compminlen = 0; /* COMPOUNDMIN value */ |
4937 int compsylmax = 0; /* COMPOUNDSYLMAX value */ | 4958 int compsylmax = 0; /* COMPOUNDSYLMAX value */ |
4938 int compmax = 0; /* COMPOUNDMAX value */ | 4959 int compmax = 0; /* COMPOUNDMAX value */ |
4939 char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDFLAGS | 4960 char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDRULE |
4940 concatenated */ | 4961 concatenated */ |
4941 char_u *midword = NULL; /* MIDWORD value */ | 4962 char_u *midword = NULL; /* MIDWORD value */ |
4942 char_u *syllable = NULL; /* SYLLABLE value */ | 4963 char_u *syllable = NULL; /* SYLLABLE value */ |
4943 char_u *sofofrom = NULL; /* SOFOFROM value */ | 4964 char_u *sofofrom = NULL; /* SOFOFROM value */ |
4944 char_u *sofoto = NULL; /* SOFOTO value */ | 4965 char_u *sofoto = NULL; /* SOFOTO value */ |
5021 if (*p == NUL) | 5042 if (*p == NUL) |
5022 break; | 5043 break; |
5023 if (itemcnt == MAXITEMCNT) /* too many items */ | 5044 if (itemcnt == MAXITEMCNT) /* too many items */ |
5024 break; | 5045 break; |
5025 items[itemcnt++] = p; | 5046 items[itemcnt++] = p; |
5026 while (*p > ' ') /* skip until white space or CR/NL */ | 5047 /* A few items have arbitrary text argument, don't split them. */ |
5027 ++p; | 5048 if (itemcnt == 2 && spell_info_item(items[0])) |
5049 while (*p >= ' ' || *p == TAB) /* skip until CR/NL */ | |
5050 ++p; | |
5051 else | |
5052 while (*p > ' ') /* skip until white space or CR/NL */ | |
5053 ++p; | |
5028 if (*p == NUL) | 5054 if (*p == NUL) |
5029 break; | 5055 break; |
5030 *p++ = NUL; | 5056 *p++ = NUL; |
5031 } | 5057 } |
5032 | 5058 |
5071 || aff->af_suff.ht_used > 0 | 5097 || aff->af_suff.ht_used > 0 |
5072 || aff->af_pref.ht_used > 0) | 5098 || aff->af_pref.ht_used > 0) |
5073 smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), | 5099 smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), |
5074 fname, lnum, items[1]); | 5100 fname, lnum, items[1]); |
5075 } | 5101 } |
5102 else if (spell_info_item(items[0])) | |
5103 { | |
5104 p = (char_u *)getroom(spin, | |
5105 (spin->si_info == NULL ? 0 : STRLEN(spin->si_info)) | |
5106 + STRLEN(items[0]) | |
5107 + STRLEN(items[1]) + 3, FALSE); | |
5108 if (p != NULL) | |
5109 { | |
5110 if (spin->si_info != NULL) | |
5111 { | |
5112 STRCPY(p, spin->si_info); | |
5113 STRCAT(p, "\n"); | |
5114 } | |
5115 STRCAT(p, items[0]); | |
5116 STRCAT(p, " "); | |
5117 STRCAT(p, items[1]); | |
5118 spin->si_info = p; | |
5119 } | |
5120 } | |
5076 else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2 | 5121 else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2 |
5077 && midword == NULL) | 5122 && midword == NULL) |
5078 { | 5123 { |
5079 midword = getroom_save(spin, items[1]); | 5124 midword = getroom_save(spin, items[1]); |
5080 } | 5125 } |
5123 fname, lnum); | 5168 fname, lnum); |
5124 } | 5169 } |
5125 else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2 | 5170 else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2 |
5126 && compflags == NULL) | 5171 && compflags == NULL) |
5127 { | 5172 { |
5128 /* Turn flag "c" into COMPOUNDFLAGS compatible string "c+", | 5173 /* Turn flag "c" into COMPOUNDRULE compatible string "c+", |
5129 * "Na" into "Na+", "1234" into "1234+". */ | 5174 * "Na" into "Na+", "1234" into "1234+". */ |
5130 p = getroom(spin, STRLEN(items[1]) + 2, FALSE); | 5175 p = getroom(spin, STRLEN(items[1]) + 2, FALSE); |
5131 if (p != NULL) | 5176 if (p != NULL) |
5132 { | 5177 { |
5133 STRCPY(p, items[1]); | 5178 STRCPY(p, items[1]); |
5134 STRCAT(p, "+"); | 5179 STRCAT(p, "+"); |
5135 compflags = p; | 5180 compflags = p; |
5136 } | 5181 } |
5137 } | 5182 } |
5138 else if (STRCMP(items[0], "COMPOUNDFLAGS") == 0 && itemcnt == 2) | 5183 else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2) |
5139 { | 5184 { |
5140 /* Concatenate this string to previously defined ones, using a | 5185 /* Concatenate this string to previously defined ones, using a |
5141 * slash to separate them. */ | 5186 * slash to separate them. */ |
5142 l = STRLEN(items[1]) + 1; | 5187 l = STRLEN(items[1]) + 1; |
5143 if (compflags != NULL) | 5188 if (compflags != NULL) |
5721 } | 5766 } |
5722 | 5767 |
5723 vim_free(pc); | 5768 vim_free(pc); |
5724 fclose(fd); | 5769 fclose(fd); |
5725 return aff; | 5770 return aff; |
5771 } | |
5772 | |
5773 /* | |
5774 * Return TRUE if "s" is the name of an info item in the affix file. | |
5775 */ | |
5776 static int | |
5777 spell_info_item(s) | |
5778 char_u *s; | |
5779 { | |
5780 return STRCMP(s, "NAME") == 0 | |
5781 || STRCMP(s, "HOME") == 0 | |
5782 || STRCMP(s, "VERSION") == 0 | |
5783 || STRCMP(s, "AUTHOR") == 0 | |
5784 || STRCMP(s, "EMAIL") == 0 | |
5785 || STRCMP(s, "COPYRIGHT") == 0; | |
5726 } | 5786 } |
5727 | 5787 |
5728 /* | 5788 /* |
5729 * Turn an affix flag name into a number, according to the FLAG type. | 5789 * Turn an affix flag name into a number, according to the FLAG type. |
5730 * returns zero for failure. | 5790 * returns zero for failure. |
7364 | 7424 |
7365 for (i = len - 1; i >= 0; --i) | 7425 for (i = len - 1; i >= 0; --i) |
7366 putc((int)(nr >> (i * 8)), fd); | 7426 putc((int)(nr >> (i * 8)), fd); |
7367 } | 7427 } |
7368 | 7428 |
7429 #ifdef _MSC_VER | |
7430 # if (_MSC_VER <= 1200) | |
7431 /* This line is required for VC6 without the service pack. Also see the | |
7432 * matching #pragma below. */ | |
7433 /* # pragma optimize("", off) */ | |
7434 # endif | |
7435 #endif | |
7436 | |
7369 /* | 7437 /* |
7370 * Write spin->si_sugtime to file "fd". | 7438 * Write spin->si_sugtime to file "fd". |
7371 */ | 7439 */ |
7372 static void | 7440 static void |
7373 put_sugtime(spin, fd) | 7441 put_sugtime(spin, fd) |
7387 { | 7455 { |
7388 c = (unsigned)spin->si_sugtime >> (i * 8); | 7456 c = (unsigned)spin->si_sugtime >> (i * 8); |
7389 putc(c, fd); | 7457 putc(c, fd); |
7390 } | 7458 } |
7391 } | 7459 } |
7460 | |
7461 #ifdef _MSC_VER | |
7462 # if (_MSC_VER <= 1200) | |
7463 /* # pragma optimize("", on) */ | |
7464 # endif | |
7465 #endif | |
7392 | 7466 |
7393 static int | 7467 static int |
7394 #ifdef __BORLANDC__ | 7468 #ifdef __BORLANDC__ |
7395 _RTLENTRYF | 7469 _RTLENTRYF |
7396 #endif | 7470 #endif |
7452 putc(VIMSPELLVERSION, fd); /* <versionnr> */ | 7526 putc(VIMSPELLVERSION, fd); /* <versionnr> */ |
7453 | 7527 |
7454 /* | 7528 /* |
7455 * <SECTIONS>: <section> ... <sectionend> | 7529 * <SECTIONS>: <section> ... <sectionend> |
7456 */ | 7530 */ |
7531 | |
7532 /* SN_INFO: <infotext> */ | |
7533 if (spin->si_info != NULL) | |
7534 { | |
7535 putc(SN_INFO, fd); /* <sectionID> */ | |
7536 putc(0, fd); /* <sectionflags> */ | |
7537 | |
7538 i = STRLEN(spin->si_info); | |
7539 put_bytes(fd, (long_u)i, 4); /* <sectionlen> */ | |
7540 fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */ | |
7541 } | |
7457 | 7542 |
7458 /* SN_REGION: <regionname> ... | 7543 /* SN_REGION: <regionname> ... |
7459 * Write the region names only if there is more than one. */ | 7544 * Write the region names only if there is more than one. */ |
7460 if (spin->si_region_count > 1) | 7545 if (spin->si_region_count > 1) |
7461 { | 7546 { |
14821 return SCORE_MAXMAX; | 14906 return SCORE_MAXMAX; |
14822 return minscore; | 14907 return minscore; |
14823 } | 14908 } |
14824 #endif | 14909 #endif |
14825 | 14910 |
14911 /* | |
14912 * ":spellinfo" | |
14913 */ | |
14914 /*ARGSUSED*/ | |
14915 void | |
14916 ex_spellinfo(eap) | |
14917 exarg_T *eap; | |
14918 { | |
14919 int lpi; | |
14920 langp_T *lp; | |
14921 char_u *p; | |
14922 | |
14923 if (no_spell_checking(curwin)) | |
14924 return; | |
14925 | |
14926 msg_start(); | |
14927 for (lpi = 0; lpi < curbuf->b_langp.ga_len && !got_int; ++lpi) | |
14928 { | |
14929 lp = LANGP_ENTRY(curbuf->b_langp, lpi); | |
14930 msg_puts((char_u *)"file: "); | |
14931 msg_puts(lp->lp_slang->sl_fname); | |
14932 msg_putchar('\n'); | |
14933 p = lp->lp_slang->sl_info; | |
14934 if (p != NULL) | |
14935 { | |
14936 msg_puts(p); | |
14937 msg_putchar('\n'); | |
14938 } | |
14939 } | |
14940 msg_end(); | |
14941 } | |
14942 | |
14826 #define DUMPFLAG_KEEPCASE 1 /* round 2: keep-case tree */ | 14943 #define DUMPFLAG_KEEPCASE 1 /* round 2: keep-case tree */ |
14827 #define DUMPFLAG_COUNT 2 /* include word count */ | 14944 #define DUMPFLAG_COUNT 2 /* include word count */ |
14828 #define DUMPFLAG_ICASE 4 /* ignore case when finding matches */ | 14945 #define DUMPFLAG_ICASE 4 /* ignore case when finding matches */ |
14829 #define DUMPFLAG_ONECAP 8 /* pattern starts with capital */ | 14946 #define DUMPFLAG_ONECAP 8 /* pattern starts with capital */ |
14830 #define DUMPFLAG_ALLCAP 16 /* pattern is all capitals */ | 14947 #define DUMPFLAG_ALLCAP 16 /* pattern is all capitals */ |
14900 n = captype(pat, NULL); | 15017 n = captype(pat, NULL); |
14901 if (n == WF_ONECAP) | 15018 if (n == WF_ONECAP) |
14902 dumpflags |= DUMPFLAG_ONECAP; | 15019 dumpflags |= DUMPFLAG_ONECAP; |
14903 else if (n == WF_ALLCAP | 15020 else if (n == WF_ALLCAP |
14904 #ifdef FEAT_MBYTE | 15021 #ifdef FEAT_MBYTE |
14905 && STRLEN(pat) > mb_ptr2len(pat) | 15022 && (int)STRLEN(pat) > mb_ptr2len(pat) |
14906 #else | 15023 #else |
14907 && STRLEN(pat) > 1 | 15024 && (int)STRLEN(pat) > 1 |
14908 #endif | 15025 #endif |
14909 ) | 15026 ) |
14910 dumpflags |= DUMPFLAG_ALLCAP; | 15027 dumpflags |= DUMPFLAG_ALLCAP; |
14911 } | 15028 } |
14912 } | 15029 } |