Lines Matching refs:fd

306 static int write_spell_prefcond(FILE *fd, garray_T *gap);
307 static int read_region_section(FILE *fd, slang_T *slang, int len);
308 static int read_charflags_section(FILE *fd);
309 static int read_prefcond_section(FILE *fd, slang_T *lp);
310 static int read_rep_section(FILE *fd, garray_T *gap, short *first);
311 static int read_sal_section(FILE *fd, slang_T *slang);
312 static int read_words_section(FILE *fd, slang_T *lp, int len);
313 static int read_sofo_section(FILE *fd, slang_T *slang);
314 static int read_compound(FILE *fd, slang_T *slang, int len);
318 static int spell_read_tree(FILE *fd, char_u **bytsp, long *bytsp_len, idx_T **idxsp, int prefixtree…
319 static idx_T read_tree_node(FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx_T startidx, int pr…
352 FILE *fd; in spell_load_file() local
364 fd = mch_fopen((char *)fname, "r"); in spell_load_file() local
365 if (fd == NULL) in spell_load_file()
410 buf[i] = getc(fd); // <fileID> in spell_load_file()
416 c = getc(fd); // <versionnr> in spell_load_file()
435 n = getc(fd); // <sectionID> or <sectionend> in spell_load_file()
438 c = getc(fd); // <sectionflags> in spell_load_file()
439 len = get4c(fd); // <sectionlen> in spell_load_file()
447 lp->sl_info = read_string(fd, len); // <infotext> in spell_load_file()
453 res = read_region_section(fd, lp, len); in spell_load_file()
457 res = read_charflags_section(fd); in spell_load_file()
461 lp->sl_midword = read_string(fd, len); // <midword> in spell_load_file()
467 res = read_prefcond_section(fd, lp); in spell_load_file()
471 res = read_rep_section(fd, &lp->sl_rep, lp->sl_rep_first); in spell_load_file()
475 res = read_rep_section(fd, &lp->sl_repsal, lp->sl_repsal_first); in spell_load_file()
479 res = read_sal_section(fd, lp); in spell_load_file()
483 res = read_sofo_section(fd, lp); in spell_load_file()
487 p = read_string(fd, len); // <mapstr> in spell_load_file()
495 res = read_words_section(fd, lp, len); in spell_load_file()
499 lp->sl_sugtime = get8ctime(fd); // <timestamp> in spell_load_file()
511 res = read_compound(fd, lp, len); in spell_load_file()
519 lp->sl_syllable = read_string(fd, len); // <syllable> in spell_load_file()
535 if (getc(fd) < 0) in spell_load_file()
556 res = spell_read_tree(fd, &lp->sl_fbyts, &lp->sl_fbyts_len, in spell_load_file()
562 res = spell_read_tree(fd, &lp->sl_kbyts, NULL, &lp->sl_kidxs, FALSE, 0); in spell_load_file()
567 res = spell_read_tree(fd, &lp->sl_pbyts, NULL, &lp->sl_pidxs, TRUE, in spell_load_file()
590 if (fd != NULL) in spell_load_file()
591 fclose(fd); in spell_load_file()
673 FILE *fd; in suggest_load_files() local
698 fd = mch_fopen((char *)slang->sl_fname, "r"); in suggest_load_files()
699 if (fd == NULL) in suggest_load_files()
706 buf[i] = getc(fd); // <fileID> in suggest_load_files()
713 c = getc(fd); // <versionnr> in suggest_load_files()
729 timestamp = get8ctime(fd); // <timestamp> in suggest_load_files()
741 if (spell_read_tree(fd, &slang->sl_sbyts, NULL, &slang->sl_sidxs, in suggest_load_files()
762 wcount = get4c(fd); in suggest_load_files()
774 c = getc(fd); // <sugline> in suggest_load_files()
795 if (fd != NULL) in suggest_load_files()
796 fclose(fd); in suggest_load_files()
811 read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) in read_cnt_string() argument
820 int c = getc(fd); in read_cnt_string()
833 str = read_string(fd, cnt); in read_cnt_string()
844 read_region_section(FILE *fd, slang_T *lp, int len) in read_region_section() argument
851 lp->sl_regions[i] = getc(fd); // <regionname> in read_region_section()
862 read_charflags_section(FILE *fd) in read_charflags_section() argument
869 flags = read_cnt_string(fd, 1, &flagslen); in read_charflags_section()
874 fol = read_cnt_string(fd, 2, &follen); in read_charflags_section()
899 read_prefcond_section(FILE *fd, slang_T *lp) in read_prefcond_section() argument
908 cnt = get2c(fd); // <prefcondcnt> in read_prefcond_section()
920 n = getc(fd); // <condlen> in read_prefcond_section()
931 *p++ = getc(fd); // <condstr> in read_prefcond_section()
944 read_rep_section(FILE *fd, garray_T *gap, short *first) in read_rep_section() argument
950 cnt = get2c(fd); // <repcount> in read_rep_section()
961 ftp->ft_from = read_cnt_string(fd, 1, &i); in read_rep_section()
966 ftp->ft_to = read_cnt_string(fd, 1, &i); in read_rep_section()
993 read_sal_section(FILE *fd, slang_T *slang) in read_sal_section() argument
1004 i = getc(fd); // <salflags> in read_sal_section()
1012 cnt = get2c(fd); // <salcount> in read_sal_section()
1027 ccnt = getc(fd); // <salfromlen> in read_sal_section()
1037 c = getc(fd); // <salfrom> in read_sal_section()
1051 c = getc(fd); // <salfrom> in read_sal_section()
1058 c = getc(fd); in read_sal_section()
1069 *p++ = getc(fd); // <salfrom> in read_sal_section()
1073 smp->sm_to = read_cnt_string(fd, 1, &ccnt); in read_sal_section()
1141 read_words_section(FILE *fd, slang_T *lp, int len) in read_words_section() argument
1153 c = getc(fd); in read_words_section()
1175 read_sofo_section(FILE *fd, slang_T *slang) in read_sofo_section() argument
1184 from = read_cnt_string(fd, 2, &cnt); in read_sofo_section()
1189 to = read_cnt_string(fd, 2, &cnt); in read_sofo_section()
1215 read_compound(FILE *fd, slang_T *slang, int len) in read_compound() argument
1232 c = getc(fd); // <compmax> in read_compound()
1238 c = getc(fd); // <compminlen> in read_compound()
1244 c = getc(fd); // <compsylmax> in read_compound()
1249 c = getc(fd); // <compoptions> in read_compound()
1251 ungetc(c, fd); // be backwards compatible with Vim 7.0b in read_compound()
1255 c = getc(fd); // only use the lower byte for now in read_compound()
1260 c = get2c(fd); // <comppatcount> in read_compound()
1269 read_cnt_string(fd, 1, &cnt); in read_compound()
1324 c = getc(fd); // <compflags> in read_compound()
1580 FILE *fd, in spell_read_tree() argument
1594 len = get4c(fd); in spell_read_tree()
1617 idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt); in spell_read_tree()
1636 FILE *fd, in read_tree_node() argument
1652 len = getc(fd); // <siblingcount> in read_tree_node()
1663 c = getc(fd); // <byte> in read_tree_node()
1683 c = getc(fd) << 24; // <pflags> in read_tree_node()
1687 c |= getc(fd); // <affixID> in read_tree_node()
1689 n = get2c(fd); // <prefcondnr> in read_tree_node()
1700 c = getc(fd); // <flags> in read_tree_node()
1702 c = (getc(fd) << 8) + c; // <flags2> in read_tree_node()
1704 c = (getc(fd) << 16) + c; // <region> in read_tree_node()
1706 c = (getc(fd) << 24) + c; // <affixID> in read_tree_node()
1715 n = get3c(fd); in read_tree_node()
1719 c = getc(fd); // <xbyte> in read_tree_node()
1736 idx = read_tree_node(fd, byts, idxs, maxidx, idx, in read_tree_node()
2012 static int put_node(FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree);
2188 FILE *fd; in spell_read_aff() local
2226 fd = mch_fopen((char *)fname, "r"); in spell_read_aff()
2227 if (fd == NULL) in spell_read_aff()
2254 fclose(fd); in spell_read_aff()
2264 while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) in spell_read_aff()
3105 fclose(fd); in spell_read_aff()
3508 FILE *fd; in spell_read_dic() local
3520 fd = mch_fopen((char *)fname, "r"); in spell_read_dic()
3521 if (fd == NULL) in spell_read_dic()
3538 if (vim_fgets(line, MAXLINELEN, fd) || !vim_isdigit(*skipwhite(line))) in spell_read_dic()
3546 while (!vim_fgets(line, MAXLINELEN, fd) && !got_int) in spell_read_dic()
3701 fclose(fd); in spell_read_dic()
4088 FILE *fd; in spell_read_wordfile() local
4104 fd = mch_fopen((char *)fname, "r"); in spell_read_wordfile()
4105 if (fd == NULL) in spell_read_wordfile()
4117 while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) in spell_read_wordfile()
4268 fclose(fd); in spell_read_wordfile()
4858 FILE *fd; in write_vim_spell() local
4873 fd = mch_fopen((char *)fname, "w"); in write_vim_spell()
4874 if (fd == NULL) in write_vim_spell()
4882 fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd); in write_vim_spell()
4887 putc(VIMSPELLVERSION, fd); // <versionnr> in write_vim_spell()
4896 putc(SN_INFO, fd); // <sectionID> in write_vim_spell()
4897 putc(0, fd); // <sectionflags> in write_vim_spell()
4900 put_bytes(fd, (long_u)i, 4); // <sectionlen> in write_vim_spell()
4901 fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); // <infotext> in write_vim_spell()
4908 putc(SN_REGION, fd); // <sectionID> in write_vim_spell()
4909 putc(SNF_REQUIRED, fd); // <sectionflags> in write_vim_spell()
4911 put_bytes(fd, (long_u)l, 4); // <sectionlen> in write_vim_spell()
4912 fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd); in write_vim_spell()
4933 putc(SN_CHARFLAGS, fd); // <sectionID> in write_vim_spell()
4934 putc(SNF_REQUIRED, fd); // <sectionflags> in write_vim_spell()
4945 put_bytes(fd, (long_u)(1 + 128 + 2 + l), 4); // <sectionlen> in write_vim_spell()
4947 fputc(128, fd); // <charflagslen> in write_vim_spell()
4955 fputc(flags, fd); // <charflags> in write_vim_spell()
4958 put_bytes(fd, (long_u)l, 2); // <folcharslen> in write_vim_spell()
4959 fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); // <folchars> in write_vim_spell()
4965 putc(SN_MIDWORD, fd); // <sectionID> in write_vim_spell()
4966 putc(SNF_REQUIRED, fd); // <sectionflags> in write_vim_spell()
4969 put_bytes(fd, (long_u)i, 4); // <sectionlen> in write_vim_spell()
4970 fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); in write_vim_spell()
4977 putc(SN_PREFCOND, fd); // <sectionID> in write_vim_spell()
4978 putc(SNF_REQUIRED, fd); // <sectionflags> in write_vim_spell()
4981 put_bytes(fd, (long_u)l, 4); // <sectionlen> in write_vim_spell()
4983 write_spell_prefcond(fd, &spin->si_prefcond); in write_vim_spell()
5017 putc(i, fd); // <sectionID> in write_vim_spell()
5020 putc(0, fd); // <sectionflags> in write_vim_spell()
5032 put_bytes(fd, (long_u)l, 4); // <sectionlen> in write_vim_spell()
5043 putc(i, fd); // <salflags> in write_vim_spell()
5046 put_bytes(fd, (long_u)gap->ga_len, 2); // <repcount> or <salcount> in write_vim_spell()
5056 putc(l, fd); in write_vim_spell()
5058 fwv &= fwrite(p, l, (size_t)1, fd); in write_vim_spell()
5068 putc(SN_SOFO, fd); // <sectionID> in write_vim_spell()
5069 putc(0, fd); // <sectionflags> in write_vim_spell()
5072 put_bytes(fd, (long_u)(l + STRLEN(spin->si_sofoto) + 4), 4); in write_vim_spell()
5075 put_bytes(fd, (long_u)l, 2); // <sofofromlen> in write_vim_spell()
5076 fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); // <sofofrom> in write_vim_spell()
5079 put_bytes(fd, (long_u)l, 2); // <sofotolen> in write_vim_spell()
5080 fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); // <sofoto> in write_vim_spell()
5087 putc(SN_WORDS, fd); // <sectionID> in write_vim_spell()
5088 putc(0, fd); // <sectionflags> in write_vim_spell()
5105 fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd); in write_vim_spell()
5109 put_bytes(fd, (long_u)len, 4); // <sectionlen> in write_vim_spell()
5117 putc(SN_MAP, fd); // <sectionID> in write_vim_spell()
5118 putc(0, fd); // <sectionflags> in write_vim_spell()
5120 put_bytes(fd, (long_u)l, 4); // <sectionlen> in write_vim_spell()
5121 fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd); in write_vim_spell()
5134 putc(SN_SUGFILE, fd); // <sectionID> in write_vim_spell()
5135 putc(0, fd); // <sectionflags> in write_vim_spell()
5136 put_bytes(fd, (long_u)8, 4); // <sectionlen> in write_vim_spell()
5140 put_time(fd, spin->si_sugtime); // <timestamp> in write_vim_spell()
5148 putc(SN_NOSPLITSUGS, fd); // <sectionID> in write_vim_spell()
5149 putc(0, fd); // <sectionflags> in write_vim_spell()
5150 put_bytes(fd, (long_u)0, 4); // <sectionlen> in write_vim_spell()
5158 putc(SN_NOCOMPOUNDSUGS, fd); // <sectionID> in write_vim_spell()
5159 putc(0, fd); // <sectionflags> in write_vim_spell()
5160 put_bytes(fd, (long_u)0, 4); // <sectionlen> in write_vim_spell()
5168 putc(SN_COMPOUND, fd); // <sectionID> in write_vim_spell()
5169 putc(0, fd); // <sectionflags> in write_vim_spell()
5174 put_bytes(fd, (long_u)(l + 7), 4); // <sectionlen> in write_vim_spell()
5176 putc(spin->si_compmax, fd); // <compmax> in write_vim_spell()
5177 putc(spin->si_compminlen, fd); // <compminlen> in write_vim_spell()
5178 putc(spin->si_compsylmax, fd); // <compsylmax> in write_vim_spell()
5179 putc(0, fd); // for Vim 7.0b compatibility in write_vim_spell()
5180 putc(spin->si_compoptions, fd); // <compoptions> in write_vim_spell()
5181 put_bytes(fd, (long_u)spin->si_comppat.ga_len, 2); in write_vim_spell()
5186 putc((int)STRLEN(p), fd); // <comppatlen> in write_vim_spell()
5187 fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd); in write_vim_spell()
5192 (size_t)1, fd); in write_vim_spell()
5198 putc(SN_NOBREAK, fd); // <sectionID> in write_vim_spell()
5199 putc(0, fd); // <sectionflags> in write_vim_spell()
5202 put_bytes(fd, (long_u)0, 4); // <sectionlen> in write_vim_spell()
5210 putc(SN_SYLLABLE, fd); // <sectionID> in write_vim_spell()
5211 putc(0, fd); // <sectionflags> in write_vim_spell()
5214 put_bytes(fd, (long_u)l, 4); // <sectionlen> in write_vim_spell()
5215 fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); in write_vim_spell()
5220 putc(SN_END, fd); // <sectionend> in write_vim_spell()
5245 put_bytes(fd, (long_u)nodecount, 4); // <nodecount> in write_vim_spell()
5249 (void)put_node(fd, tree, 0, regionmask, round == 3); in write_vim_spell()
5253 if (putc(0, fd) == EOF) in write_vim_spell()
5256 if (fclose(fd) == EOF) in write_vim_spell()
5303 FILE *fd, // NULL when only counting in put_node() argument
5326 if (fd != NULL) in put_node()
5327 putc(siblingcount, fd); // <siblingcount> in put_node()
5334 if (fd != NULL) in put_node()
5344 putc(BY_NOFLAGS, fd); // <byte> in put_node()
5347 putc(BY_FLAGS, fd); // <byte> in put_node()
5348 putc(np->wn_flags, fd); // <pflags> in put_node()
5350 putc(np->wn_affixID, fd); // <affixID> in put_node()
5351 put_bytes(fd, (long_u)np->wn_region, 2); // <prefcondnr> in put_node()
5364 putc(BY_NOFLAGS, fd); // <byte> in put_node()
5370 putc(BY_FLAGS2, fd); // <byte> in put_node()
5371 putc(flags, fd); // <flags> in put_node()
5372 putc((unsigned)flags >> 8, fd); // <flags2> in put_node()
5376 putc(BY_FLAGS, fd); // <byte> in put_node()
5377 putc(flags, fd); // <flags> in put_node()
5380 putc(np->wn_region, fd); // <region> in put_node()
5382 putc(np->wn_affixID, fd); // <affixID> in put_node()
5393 if (fd != NULL) in put_node()
5395 putc(BY_INDEX, fd); // <byte> in put_node()
5397 put_bytes(fd, (long_u)np->wn_child->wn_u1.index, 3); in put_node()
5404 if (fd != NULL) in put_node()
5405 if (putc(np->wn_byte, fd) == EOF) // <byte> or <xbyte> in put_node()
5420 newindex = put_node(fd, np->wn_child, newindex, regionmask, in put_node()
5793 FILE *fd; in sug_write() local
5802 fd = mch_fopen((char *)fname, "w"); in sug_write()
5803 if (fd == NULL) in sug_write()
5816 if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) // <fileID> in sug_write()
5821 putc(VIMSUGVERSION, fd); // <versionnr> in sug_write()
5824 put_time(fd, spin->si_sugtime); // <timestamp> in sug_write()
5841 put_bytes(fd, (long_u)nodecount, 4); // <nodecount> in sug_write()
5845 (void)put_node(fd, tree, 0, 0, FALSE); in sug_write()
5851 put_bytes(fd, (long_u)wcount, 4); // <sugwcount> in sug_write()
5858 if (fwrite(line, (size_t)len, (size_t)1, fd) == 0) in sug_write()
5867 if (putc(0, fd) == EOF) in sug_write()
5876 fclose(fd); in sug_write()
6186 FILE *fd = NULL; in spell_add_word() local
6255 fd = mch_fopen((char *)fname, "r"); in spell_add_word()
6256 if (fd != NULL) in spell_add_word()
6258 while (!vim_fgets(line, MAXWLEN * 2, fd)) in spell_add_word()
6261 fpos_next = ftell(fd); in spell_add_word()
6268 fclose(fd); in spell_add_word()
6269 fd = mch_fopen((char *)fname, "r+"); in spell_add_word()
6270 if (fd == NULL) in spell_add_word()
6272 if (fseek(fd, fpos, SEEK_SET) == 0) in spell_add_word()
6274 fputc('#', fd); in spell_add_word()
6282 if (fseek(fd, fpos_next, SEEK_SET) != 0) in spell_add_word()
6289 if (fd != NULL) in spell_add_word()
6290 fclose(fd); in spell_add_word()
6296 fd = mch_fopen((char *)fname, "a"); in spell_add_word()
6297 if (fd == NULL && new_spf) in spell_add_word()
6314 fd = mch_fopen((char *)fname, "a"); in spell_add_word()
6318 if (fd == NULL) in spell_add_word()
6323 fprintf(fd, "%.*s/!\n", len, word); in spell_add_word()
6325 fprintf(fd, "%.*s/?\n", len, word); in spell_add_word()
6327 fprintf(fd, "%.*s\n", len, word); in spell_add_word()
6328 fclose(fd); in spell_add_word()
6335 if (fd != NULL) in spell_add_word()
6573 write_spell_prefcond(FILE *fd, garray_T *gap) in write_spell_prefcond() argument
6581 if (fd != NULL) in write_spell_prefcond()
6582 put_bytes(fd, (long_u)gap->ga_len, 2); // <prefcondcnt> in write_spell_prefcond()
6593 if (fd != NULL) in write_spell_prefcond()
6595 fputc(len, fd); in write_spell_prefcond()
6596 x &= fwrite(p, (size_t)len, (size_t)1, fd); in write_spell_prefcond()
6600 else if (fd != NULL) in write_spell_prefcond()
6601 fputc(0, fd); in write_spell_prefcond()