comparison src/spell.c @ 2214:f8222d1f9a73 vim73

Included patch for persistent undo. Lots of changes and added test.
author Bram Moolenaar <bram@vim.org>
date Sun, 23 May 2010 23:34:36 +0200
parents 12aba62fa7c6
children d45902a5c61c
comparison
equal deleted inserted replaced
2213:0e0e99d1092e 2214:f8222d1f9a73
852 static void spell_load_lang __ARGS((char_u *lang)); 852 static void spell_load_lang __ARGS((char_u *lang));
853 static char_u *spell_enc __ARGS((void)); 853 static char_u *spell_enc __ARGS((void));
854 static void int_wordlist_spl __ARGS((char_u *fname)); 854 static void int_wordlist_spl __ARGS((char_u *fname));
855 static void spell_load_cb __ARGS((char_u *fname, void *cookie)); 855 static void spell_load_cb __ARGS((char_u *fname, void *cookie));
856 static slang_T *spell_load_file __ARGS((char_u *fname, char_u *lang, slang_T *old_lp, int silent)); 856 static slang_T *spell_load_file __ARGS((char_u *fname, char_u *lang, slang_T *old_lp, int silent));
857 static int get2c __ARGS((FILE *fd));
858 static int get3c __ARGS((FILE *fd));
859 static int get4c __ARGS((FILE *fd));
860 static time_t get8c __ARGS((FILE *fd)); 857 static time_t get8c __ARGS((FILE *fd));
861 static char_u *read_cnt_string __ARGS((FILE *fd, int cnt_bytes, int *lenp)); 858 static char_u *read_cnt_string __ARGS((FILE *fd, int cnt_bytes, int *lenp));
862 static char_u *read_string __ARGS((FILE *fd, int cnt)); 859 static char_u *read_string __ARGS((FILE *fd, int cnt));
863 static int read_region_section __ARGS((FILE *fd, slang_T *slang, int len)); 860 static int read_region_section __ARGS((FILE *fd, slang_T *slang, int len));
864 static int read_charflags_section __ARGS((FILE *fd)); 861 static int read_charflags_section __ARGS((FILE *fd));
2986 } 2983 }
2987 2984
2988 /* 2985 /*
2989 * Read 2 bytes from "fd" and turn them into an int, MSB first. 2986 * Read 2 bytes from "fd" and turn them into an int, MSB first.
2990 */ 2987 */
2991 static int 2988 int
2992 get2c(fd) 2989 get2c(fd)
2993 FILE *fd; 2990 FILE *fd;
2994 { 2991 {
2995 long n; 2992 long n;
2996 2993
3000 } 2997 }
3001 2998
3002 /* 2999 /*
3003 * Read 3 bytes from "fd" and turn them into an int, MSB first. 3000 * Read 3 bytes from "fd" and turn them into an int, MSB first.
3004 */ 3001 */
3005 static int 3002 int
3006 get3c(fd) 3003 get3c(fd)
3007 FILE *fd; 3004 FILE *fd;
3008 { 3005 {
3009 long n; 3006 long n;
3010 3007
3015 } 3012 }
3016 3013
3017 /* 3014 /*
3018 * Read 4 bytes from "fd" and turn them into an int, MSB first. 3015 * Read 4 bytes from "fd" and turn them into an int, MSB first.
3019 */ 3016 */
3020 static int 3017 int
3021 get4c(fd) 3018 get4c(fd)
3022 FILE *fd; 3019 FILE *fd;
3023 { 3020 {
3024 long n; 3021 long n;
3025 3022
8016 } 8013 }
8017 8014
8018 /* 8015 /*
8019 * Write a number to file "fd", MSB first, in "len" bytes. 8016 * Write a number to file "fd", MSB first, in "len" bytes.
8020 */ 8017 */
8021 void 8018 int
8022 put_bytes(fd, nr, len) 8019 put_bytes(fd, nr, len)
8023 FILE *fd; 8020 FILE *fd;
8024 long_u nr; 8021 long_u nr;
8025 int len; 8022 int len;
8026 { 8023 {
8027 int i; 8024 int i;
8028 8025
8029 for (i = len - 1; i >= 0; --i) 8026 for (i = len - 1; i >= 0; --i)
8030 putc((int)(nr >> (i * 8)), fd); 8027 if (putc((int)(nr >> (i * 8)), fd) == EOF)
8028 return FAIL;
8029 return OK;
8031 } 8030 }
8032 8031
8033 #ifdef _MSC_VER 8032 #ifdef _MSC_VER
8034 # if (_MSC_VER <= 1200) 8033 # if (_MSC_VER <= 1200)
8035 /* This line is required for VC6 without the service pack. Also see the 8034 /* This line is required for VC6 without the service pack. Also see the