1 #ifndef _WIMLIB_TEXTFILE_H_
2 #define _WIMLIB_TEXTFILE_H_
4 #include <wimlib/types.h>
9 size_t num_alloc_strings;
12 #define STRING_SET_INITIALIZER \
13 { .strings = NULL, .num_strings = 0, .num_alloc_strings = 0, }
15 #define STRING_SET(_strings) \
16 struct string_set _strings = STRING_SET_INITIALIZER
18 typedef int (*line_mangle_t)(tchar *line, const tchar *filename,
19 unsigned long line_no);
21 struct text_file_section {
23 struct string_set *strings;
27 do_load_text_file(const tchar *path, tchar *buf, size_t buflen, tchar **buf_ret,
28 const struct text_file_section *pos_sections,
29 int num_pos_sections, line_mangle_t mangle_line);
32 load_text_file(const tchar *path, tchar **buf_ret,
33 const struct text_file_section *pos_sections,
34 int num_pos_sections, line_mangle_t mangle_line)
36 return do_load_text_file(path, NULL, 0, buf_ret,
37 pos_sections, num_pos_sections, mangle_line);
41 load_text_buffer(tchar *buf, size_t buflen,
42 const struct text_file_section *pos_sections,
43 int num_pos_sections, line_mangle_t mangle_line)
45 return do_load_text_file(NULL, buf, buflen, &buf,
46 pos_sections, num_pos_sections, mangle_line);
49 #endif /* _WIMLIB_TEXTFILE_H_ */