OLD | NEW |
1 #include "license.hunspell" | 1 #include "license.hunspell" |
2 #include "license.myspell" | 2 #include "license.myspell" |
3 | 3 |
4 #ifndef MOZILLA_CLIENT | 4 #ifndef MOZILLA_CLIENT |
5 #include <cstdlib> | 5 #include <cstdlib> |
6 #include <cstring> | 6 #include <cstring> |
7 #include <cstdio> | 7 #include <cstdio> |
8 #include <cctype> | 8 #include <cctype> |
9 #else | 9 #else |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 ch[1] = '\0'; | 552 ch[1] = '\0'; |
553 } | 553 } |
554 return mystrdup((char *) ch); | 554 return mystrdup((char *) ch); |
555 } | 555 } |
556 | 556 |
557 #ifdef HUNSPELL_CHROME_CLIENT | 557 #ifdef HUNSPELL_CHROME_CLIENT |
558 int HashMgr::load_config() | 558 int HashMgr::load_config() |
559 { | 559 { |
560 utf8 = 1; // We always use UTF-8. | 560 utf8 = 1; // We always use UTF-8. |
561 | 561 |
| 562 // Read in the regular commands from the affix file. We care about the FLAG |
| 563 // line becuase the AF lines depend on this value, and the IGNORE line. |
| 564 // The rest of the commands will be read by the affix manager. |
| 565 char line[MAXDELEN+1]; |
| 566 hunspell::LineIterator iterator = bdict_reader->GetOtherLineIterator(); |
| 567 while (iterator.AdvanceAndCopy(line, MAXDELEN)) { |
| 568 // Parse in the ignored characters (for example, Arabic optional |
| 569 // diacritics characters. |
| 570 if (strncmp(line,"IGNORE",6) == 0) { |
| 571 parse_array(line, &ignorechars, &ignorechars_utf16, |
| 572 &ignorechars_utf16_len, "IGNORE", utf8); |
| 573 } |
| 574 // Retrieve the format of an AF line. |
| 575 if ((strncmp(line,"FLAG",4) == 0) && isspace(line[4])) { |
| 576 if (strstr(line, "long")) flag_mode = FLAG_LONG; |
| 577 if (strstr(line, "num")) flag_mode = FLAG_NUM; |
| 578 if (strstr(line, "UTF-8")) flag_mode = FLAG_UNI; |
| 579 } |
| 580 } |
| 581 |
562 // Read in all the AF lines which tell us the rules for each affix group ID. | 582 // Read in all the AF lines which tell us the rules for each affix group ID. |
563 char line[MAXDELEN+1]; | 583 iterator = bdict_reader->GetAfLineIterator(); |
564 hunspell::LineIterator iterator = bdict_reader->GetAfLineIterator(); | |
565 while (iterator.AdvanceAndCopy(line, MAXDELEN)) { | 584 while (iterator.AdvanceAndCopy(line, MAXDELEN)) { |
566 int rv = parse_aliasf(line, &iterator); | 585 int rv = parse_aliasf(line, &iterator); |
567 if (rv) | 586 if (rv) |
568 return rv; | 587 return rv; |
569 } | 588 } |
570 | 589 |
571 // Read in the regular commands from the affix file. We only care about the | |
572 // IGNORE line here. The rest of the commands will be read by the affix | |
573 // manager. | |
574 iterator = bdict_reader->GetOtherLineIterator(); | |
575 while (iterator.AdvanceAndCopy(line, MAXDELEN)) { | |
576 // Parse in the ignored characters (for example, Arabic optional | |
577 // diacritics characters. | |
578 if (strncmp(line,"IGNORE",6) == 0) { | |
579 parse_array(line, &ignorechars, &ignorechars_utf16, | |
580 &ignorechars_utf16_len, "IGNORE", utf8); | |
581 break; // All done. | |
582 } | |
583 } | |
584 | |
585 return 0; | 590 return 0; |
586 } | 591 } |
587 #else | 592 #else |
588 // read in aff file and set flag mode | 593 // read in aff file and set flag mode |
589 int HashMgr::load_config(FILE* aff_handle) | 594 int HashMgr::load_config(FILE* aff_handle) |
590 { | 595 { |
591 int firstline = 1; | 596 int firstline = 1; |
592 | 597 |
593 // io buffers | 598 // io buffers |
594 char line[MAXDELEN+1]; | 599 char line[MAXDELEN+1]; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 int HashMgr::is_aliasm() { | 952 int HashMgr::is_aliasm() { |
948 return (aliasm != NULL); | 953 return (aliasm != NULL); |
949 } | 954 } |
950 | 955 |
951 char * HashMgr::get_aliasm(int index) { | 956 char * HashMgr::get_aliasm(int index) { |
952 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; | 957 if ((index > 0) && (index <= numaliasm)) return aliasm[index - 1]; |
953 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); | 958 HUNSPELL_WARNING(stderr, "error: bad morph. alias index: %d\n", index); |
954 return NULL; | 959 return NULL; |
955 } | 960 } |
956 #endif | 961 #endif |
OLD | NEW |