152#include <fc_config.h>
175#define MAX_LEN_SECPATH 1024
178#define SAVE_TABLES TRUE
180#define SPECVEC_TAG astring
188 const char *tok,
struct inputfile *file);
239 static const char *
const allowed =
"_.,-[]";
241 while (
'\0' != *
name) {
254 struct entry *pentry)
257 struct entry *hentry;
266 if (entry_hash_replace_full(secfile->
hash.
entries, buf, pentry,
271 "Tried to insert same value twice: %s", buf);
283 struct entry *pentry)
294 return entry_hash_remove(secfile->
hash.
entries, buf);
301 const char *filename,
306 struct section *psection = NULL;
307 struct section *single_section = NULL;
308 bool table_state =
FALSE;
309 int table_lineno = 0;
314 struct astring_vector columns;
315 bool found_my_section =
FALSE;
327 secfile->
name = NULL;
330 astring_vector_init(&columns);
333 log_verbose(
"Reading registry from \"%s\"", filename);
348 if (found_my_section) {
356 inf_log_str(inf,
"Found requested section; finishing"));
375 single_section = psection;
376 found_my_section =
TRUE;
407 int num_columns = astring_vector_size(&columns);
411 if (i < num_columns) {
413 table_lineno,
astr_str(&columns.p[i]));
416 table_lineno,
astr_str(&columns.p[num_columns - 1]),
417 (
int) (i - num_columns + 1));
434 inf_log_str(inf,
"Expected end of line or comma"));
466 if (tok[0] !=
'\"') {
468 inf_log_str(inf,
"Table column header non-string"));
475 n_prev = astring_vector_size(&columns);
476 for (j = i + 1; j < n_prev; j++) {
479 astring_vector_reserve(&columns, i + 1);
480 for (j = n_prev; j < i + 1; j++) {
484 astr_set(&columns.p[i],
"%s", tok + 1);
490 inf_log_str(inf,
"Expected end of line or comma"));
525 inf_log_str(inf,
"Expected end of line or comma"));
533 "Finished registry before end of table");
541 for (i = 0; i < astring_vector_size(&columns); i++) {
544 astring_vector_free(&columns);
547 if (!found_my_section) {
597 char real_filename[1024];
642 int compression_level,
enum fz_method compression_method)
644 char real_filename[1024];
645 char pentry_name[128];
646 const char *col_entry_name;
648 const struct entry_list_link *ent_iter, *save_iter, *col_iter;
649 struct entry *pentry, *col_pentry;
654 if (NULL == filename) {
655 filename = secfile->
name;
660 compression_method, compression_level);
663 SECFILE_LOG(secfile, NULL,
_(
"Could not open %s for writing"), real_filename);
671 ent_iter && (pentry = entry_list_link_data(ent_iter));
672 ent_iter = entry_list_link_next(ent_iter)) {
682 ent_iter && (pentry = entry_list_link_data(ent_iter));
683 ent_iter = entry_list_link_next(ent_iter)) {
697 ent_iter && (pentry = entry_list_link_data(ent_iter));
698 ent_iter = entry_list_link_next(ent_iter)) {
708 char *c, *first,
base[64];
709 int offset, irow, icol, ncol;
723 c = first = pentry_name;
730 if (0 != strncmp(c,
"0.", 2)) {
739 first[offset - 2] =
'\0';
741 first[offset - 2] =
'0';
747 save_iter = ent_iter;
751 col_iter = save_iter;
752 for (; (col_pentry = entry_list_link_data(col_iter));
753 col_iter = entry_list_link_next(col_iter)) {
755 if (strncmp(col_entry_name, first, offset) != 0) {
758 fz_fprintf(fs,
"%s\"%s\"", (ncol == 0 ?
"" :
","),
759 col_entry_name + offset);
769 col_iter = save_iter;
773 pentry = entry_list_link_data(ent_iter);
774 col_pentry = entry_list_link_data(col_iter);
780 if ((!pentry) || (strcmp(
entry_name(pentry), expect) != 0)) {
792 "%s.%s (or the entries are out of order). This means\n"
793 "a less efficient non-tabular format will be used.\n"
794 "To avoid this make sure all rows of a table are\n"
795 "filled out with an entry for every column.",
808 ent_iter = entry_list_link_next(ent_iter);
809 col_iter = entry_list_link_next(col_iter);
816 col_iter = save_iter;
834 col_iter = entry_list_link_next(ent_iter);
835 col_pentry = entry_list_link_data(col_iter);
836 if (NULL == col_pentry) {
840 "%s,%d", col_entry_name, i);
841 if (0 != strcmp(pentry_name,
entry_name(col_pentry))) {
860 SECFILE_LOG(secfile, NULL,
"Error before closing %s: %s",
866 SECFILE_LOG(secfile, NULL,
"Error closing %s", real_filename);
887 if (!any && secfile->
name) {
893 secfile->
name != NULL ? secfile->
name :
"nameless",
896#ifdef FREECIV_TESTMATIC
898 secfile->
name != NULL ? secfile->
name :
"nameless",
918 if (NULL == secfile) {
920 }
else if (secfile->
name) {
921 return secfile->
name;
923 return "(anonymous)";
932 const char **pent_name)
940 ent_name = strchr(fullpath,
'.');
943 "Section and entry names must be separated by a dot.");
949 *pent_name = path + (ent_name - fullpath) + 1;
964 const char *path, ...)
967 const char *ent_name;
969 struct entry *pentry = NULL;
974 va_start(args, path);
985 if (NULL != pentry) {
997 if (NULL == pentry) {
1001 if (NULL != pentry && NULL !=
comment) {
1013 const bool *values,
size_t dim,
1014 const char *
comment,
bool allow_replace,
1015 const char *path, ...)
1023 va_start(args, path);
1031 allow_replace,
"%s", fullpath)) {
1034 for (i = 1; i < dim; i++) {
1036 allow_replace,
"%s,%d",
1037 fullpath, (
int) i)) {
1051 const char *path, ...)
1054 const char *ent_name;
1056 struct entry *pentry = NULL;
1061 va_start(args, path);
1070 if (allow_replace) {
1072 if (NULL != pentry) {
1084 if (NULL == pentry) {
1088 if (NULL != pentry && NULL !=
comment) {
1100 const int *values,
size_t dim,
1101 const char *
comment,
bool allow_replace,
1102 const char *path, ...)
1110 va_start(args, path);
1118 allow_replace,
"%s", fullpath)) {
1121 for (i = 1; i < dim; i++) {
1123 allow_replace,
"%s,%d",
1124 fullpath, (
int) i)) {
1138 const char *path, ...)
1141 const char *ent_name;
1143 struct entry *pentry = NULL;
1148 va_start(args, path);
1157 if (allow_replace) {
1159 if (NULL != pentry) {
1171 if (NULL == pentry) {
1175 if (NULL != pentry && NULL !=
comment) {
1186 const char *filename)
1210 const char *comment)
1239 const char *path, ...)
1242 const char *ent_name;
1244 struct entry *pentry = NULL;
1249 va_start(args, path);
1259 log_error(
"Tried to insert wrong type of entry to section");
1263 if (allow_replace) {
1265 if (NULL != pentry) {
1277 if (NULL == pentry) {
1281 if (NULL != pentry && NULL !=
comment) {
1297 const char *
const *strings,
size_t dim,
1298 const char *
comment,
bool allow_replace,
1299 bool no_escape,
const char *path, ...)
1307 va_start(args, path);
1315 allow_replace, no_escape,
FALSE,
1319 for (i = 1; i < dim; i++) {
1321 allow_replace, no_escape,
FALSE,
1322 "%s,%d", fullpath, (
int) i)) {
1334 const char *filename,
1335 const char *path, ...)
1338 const char *ent_name;
1340 struct entry *pentry = NULL;
1345 va_start(args, path);
1355 log_error(
"Tried to insert normal entry to different kind of section");
1359 if (NULL == pentry) {
1374 const char *path, ...)
1378 const char *ent_name;
1380 struct entry *pentry = NULL;
1385 str = name_fn(enumerator);
1388 va_start(args, path);
1397 if (allow_replace) {
1399 if (NULL != pentry) {
1411 if (NULL == pentry) {
1415 if (NULL != pentry && NULL !=
comment) {
1427 const int *enumurators,
size_t dim,
1431 const char *path, ...)
1440 va_start(args, path);
1449 allow_replace,
"%s",
1453 for (i = 1; i < dim; i++) {
1456 allow_replace,
"%s,%d",
1457 fullpath, (
int) i)) {
1480 const char *path, ...)
1483 const char *ent_name;
1485 struct entry *pentry = NULL;
1497 if (0 != bitwise_val) {
1498 for (i = begin_fn(); i != end_fn(); i = next_fn(i)) {
1499 if (i & bitwise_val) {
1500 if (
'\0' ==
str[0]) {
1509 va_start(args, path);
1518 if (allow_replace) {
1520 if (NULL != pentry) {
1532 if (NULL == pentry) {
1536 if (NULL != pentry && NULL !=
comment) {
1548 const int *bitwise_vals,
1556 const char *path, ...)
1568 va_start(args, path);
1576 name_fn, begin_fn, end_fn,
1578 allow_replace,
"%s",
1582 for (i = 1; i < dim; i++) {
1584 name_fn, begin_fn, end_fn,
1586 allow_replace,
"%s,%d",
1587 fullpath, (
int) i)) {
1600 int value,
bool bitwise,
1605 const char *path, ...)
1608 const char *ent_name, *val_name;
1610 struct entry *pentry = NULL;
1621 for (i = 0; (val_name = name_fn(data, i)); i++) {
1622 if ((1 << i) &
value) {
1623 if (
'\0' ==
str[0]) {
1632 if (!(val_name = name_fn(data,
value))) {
1639 va_start(args, path);
1648 if (allow_replace) {
1650 if (NULL != pentry) {
1662 if (NULL == pentry) {
1666 if (NULL != pentry && NULL !=
comment) {
1678 const int *values,
size_t dim,
1684 const char *path, ...)
1693 va_start(args, path);
1702 allow_replace,
"%s",
1706 for (i = 1; i < dim; i++) {
1709 allow_replace,
"%s,%d",
1710 fullpath, (
int) i)) {
1734 len = strlen(fullpath);
1735 if (
len > 2 && fullpath[
len - 2] ==
',' && fullpath[
len - 1] ==
'0') {
1736 fullpath[
len - 2] =
'\0';
1740 struct entry *pentry;
1742 if (entry_hash_lookup(secfile->
hash.
entries, fullpath, &pentry)) {
1750 ent_name = strchr(fullpath,
'.');
1769 const char *path, ...)
1773 struct entry *pentry;
1777 va_start(args, path);
1782 SECFILE_LOG(secfile, NULL,
"Path %s does not exists.", fullpath);
1795 const char *path, ...)
1802 va_start(args, path);
1813 const char *path, ...)
1816 const struct entry *pentry;
1821 va_start(args, path);
1826 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
1838 bool def,
const char *path, ...)
1841 const struct entry *pentry;
1847 va_start(args, path);
1868 size_t *dim,
const char *path, ...)
1878 va_start(args, path);
1890 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
1895 for (i = 0; i < *dim; i++) {
1898 "An error occurred when looking up to \"%s,%d\" entry.",
1913 const char *path, ...)
1916 const struct entry *pentry;
1921 va_start(args, path);
1926 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
1938 const char *path, ...)
1941 const struct entry *pentry;
1947 va_start(args, path);
1968 int defval,
int minval,
int maxval,
1969 const char *path, ...)
1972 const struct entry *pentry;
1978 va_start(args, path);
1990 if (
value < minval) {
1992 "\"%s\" should be in the interval [%d, %d] but is %d;"
1993 "using the minimal value.",
1994 fullpath, minval, maxval,
value);
1998 if (
value > maxval) {
2000 "\"%s\" should be in the interval [%d, %d] but is %d;"
2001 "using the maximal value.",
2002 fullpath, minval, maxval,
value);
2015 size_t *dim,
const char *path, ...)
2025 va_start(args, path);
2037 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2042 for (i = 0; i < *dim; i++) {
2045 "An error occurred when looking up to \"%s,%d\" entry.",
2060 const char *path, ...)
2063 const struct entry *pentry;
2068 va_start(args, path);
2073 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2085 float def,
const char *path, ...)
2088 const struct entry *pentry;
2094 va_start(args, path);
2113 const char *path, ...)
2116 const struct entry *pentry;
2122 va_start(args, path);
2127 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2144 const char *path, ...)
2147 const struct entry *pentry;
2153 va_start(args, path);
2165 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't have a string.", fullpath);
2177 size_t *dim,
const char *path, ...)
2187 va_start(args, path);
2199 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2203 vec =
fc_malloc(i *
sizeof(
const char *));
2204 for (i = 0; i < *dim; i++) {
2206 fullpath, (
int) i))) {
2208 "An error occurred when looking up to \"%s,%d\" entry.",
2226 const char *path, ...)
2229 const struct entry *pentry;
2238 va_start(args, path);
2243 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2251 *penumerator = by_name_fn(
str, strcmp);
2252 if (is_valid_fn(*penumerator)) {
2257 "Entry \"%s\": no match for \"%s\".",
2266 *secfile,
int defval,
2271 const char *path, ...)
2274 const struct entry *pentry;
2283 va_start(args, path);
2295 val = by_name_fn(
str, strcmp);
2296 if (is_valid_fn(val)) {
2314 const char *path, ...)
2326 va_start(args, path);
2338 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2343 for (i = 0; i < *dim; i++) {
2345 by_name_fn,
"%s,%d",
2346 fullpath, (
int) i)) {
2348 "An error occurred when looking up to \"%s,%d\" entry.",
2366 const char *path, ...)
2369 const struct entry *pentry;
2370 const char *
str, *p;
2380 va_start(args, path);
2385 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2394 if (
'\0' ==
str[0]) {
2401 p = strchr(
str,
'|');
2410 val = by_name_fn(val_name, strcmp);
2411 if (!is_valid_fn(val)) {
2413 "Entry \"%s\": no match for \"%s\".",
2417 *penumerator |= val;
2419 }
while (NULL != p);
2428 *secfile,
int defval,
2433 const char *path, ...)
2436 const struct entry *pentry;
2437 const char *
str, *p;
2446 va_start(args, path);
2458 if (
'\0' ==
str[0]) {
2466 p = strchr(
str,
'|');
2475 val = by_name_fn(val_name, strcmp);
2476 if (!is_valid_fn(val)) {
2481 }
while (NULL != p);
2497 const char *path, ...)
2509 va_start(args, path);
2521 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2526 for (i = 0; i < *dim; i++) {
2528 by_name_fn,
"%s,%d",
2529 fullpath, (
int) i)) {
2531 "An error occurred when looking up to \"%s,%d\" entry.",
2547 int *pvalue,
bool bitwise,
2552 const struct entry *pentry;
2562 va_start(args, path);
2567 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2577 if (
'\0' ==
str[0]) {
2584 p = strchr(
str,
'|');
2593 for (val = 0; (
name = name_fn(data, val)); val++) {
2600 "Entry \"%s\": no match for \"%s\".",
2604 *pvalue |= 1 << val;
2606 }
while (NULL != p);
2608 for (val = 0; (
name = name_fn(data, val)); val++) {
2616 "Entry \"%s\": no match for \"%s\".",
2629 int defval,
bool bitwise,
2632 const char *path, ...)
2635 const struct entry *pentry;
2644 va_start(args, path);
2649 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2659 if (
'\0' ==
str[0]) {
2666 p = strchr(
str,
'|');
2675 for (val = 0; (
name = name_fn(data, val)); val++) {
2676 if (0 == strcmp(
name, val_name)) {
2682 "Entry \"%s\": no match for \"%s\".",
2688 }
while (NULL != p);
2690 for (val = 0; (
name = name_fn(data, val)); val++) {
2698 "Entry \"%s\": no match for \"%s\".",
2712 size_t *dim,
bool bitwise,
2725 va_start(args, path);
2737 SECFILE_LOG(secfile, NULL,
"\"%s\" entry doesn't exist.", fullpath);
2742 for (i = 0; i < *dim; i++) {
2744 "%s,%d", fullpath, (
int) i)) {
2746 "An error occurred when looking up to \"%s,%d\" entry.",
2778 const char *path, ...)
2785 va_start(args, path);
2796const struct section_list *
2799 return (NULL != secfile ? secfile->
sections : NULL);
2807struct section_list *
2811 struct section_list *matches = NULL;
2817 len = strlen(prefix);
2824 if (NULL == matches) {
2825 matches = section_list_new();
2827 section_list_append(matches, psection);
2844 if (NULL ==
name ||
'\0' ==
name[0]) {
2889 if ((secfile = psection->
secfile)) {
2891 if (section_list_remove(secfile->
sections, psection)) {
2900 entry_list_destroy(psection->
entries);
2901 free(psection->
name);
2913 entry_list_clear(psection->
entries);
2915 if (0 < entry_list_size(psection->
entries)) {
2917 "After clearing all, %d entries are still remaining.",
2918 entry_list_size(psection->
entries));
2934 if (NULL ==
name ||
'\0' ==
name[0]) {
2942 "\"%s\" is not a valid section name for section \"%s\".",
2948 && pother != psection) {
2965 free(psection->
name);
2987 return (NULL != psection ? psection->
entries : NULL);
3012 const char *path, ...)
3015 struct entry *pentry;
3020 va_start(args, path);
3044 struct entry *pentry;
3049 if (NULL ==
name ||
'\0' ==
name[0]) {
3091 if (NULL != pentry) {
3107 if (NULL != pentry) {
3123 if (NULL != pentry) {
3140 if (NULL != pentry) {
3159 if (NULL != pentry) {
3175 if (NULL == pentry) {
3179 if ((psection = pentry->
psection)) {
3181 if (entry_list_remove(psection->
entries, pentry)) {
3193 switch (pentry->
type) {
3211 if (NULL != pentry->
comment) {
3222 return (NULL != pentry ? pentry->
psection : NULL);
3248 return (NULL != pentry ? pentry->
name : NULL);
3265 if (NULL ==
name ||
'\0' ==
name[0]) {
3266 SECFILE_LOG(secfile, psection,
"No new name for entry \"%s\".",
3273 "\"%s\" is not a valid entry name for entry \"%s\".",
3281 if (NULL != pother && pother != pentry) {
3304 return (NULL != pentry ? pentry->
comment : NULL);
3312 if (NULL == pentry) {
3316 if (NULL != pentry->
comment) {
3328 return (0 < pentry->
used);
3362 if (NULL !=
value) {
3390 if (NULL !=
value) {
3420 if (NULL !=
value) {
3448 if (NULL !=
value) {
3519 static char buf[8192];
3523 switch (pentry->
type) {
3532 for (i = 0; buf[i] !=
'\0' ; i++) {
3533 if (buf[i] ==
'.') {
void astr_free(struct astring *astr)
void astr_set(struct astring *astr, const char *format,...)
void astr_init(struct astring *astr)
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
void bugreport_request(const char *reason_format,...)
bool are_deprecation_warnings_enabled(void)
#define log_deprecation_always(message,...)
static void base(QVariant data1, QVariant data2)
int fz_fprintf(fz_FILE *fp, const char *format,...)
fz_FILE * fz_from_file(const char *filename, const char *in_mode, enum fz_method method, int compress_level)
const char * fz_strerror(fz_FILE *fp)
int fz_fclose(fz_FILE *fp)
int fz_ferror(fz_FILE *fp)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_error(message,...)
#define log_testmatic(message,...)
struct section_file * secfile_new(bool allow_duplicates)
const char * section_name(const struct section *psection)
void secfile_destroy(struct section_file *secfile)
static struct entry * entry_new(struct section *psection, const char *name)
int secfile_lookup_bitwise_enum_default_full(const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
void entry_set_comment(struct entry *pentry, const char *comment)
size_t secfile_insert_bool_vec_full(struct section_file *secfile, const bool *values, size_t dim, const char *comment, bool allow_replace, const char *path,...)
bool entry_bool_get(const struct entry *pentry, bool *value)
void section_destroy(struct section *psection)
bool secfile_lookup_float(const struct section_file *secfile, float *fval, const char *path,...)
void secfile_check_unused(const struct section_file *secfile)
int entry_path(const struct entry *pentry, char *buf, size_t buf_len)
bool secfile_lookup_int(const struct section_file *secfile, int *ival, const char *path,...)
struct section * secfile_insert_long_comment(struct section_file *secfile, const char *comment)
static struct entry * section_entry_filereference_new(struct section *psection, const char *name, const char *value)
bool secfile_entry_delete(struct section_file *secfile, const char *path,...)
bool entry_set_name(struct entry *pentry, const char *name)
bool secfile_lookup_enum_data(const struct section_file *secfile, int *pvalue, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
static bool secfile_hash_insert(struct section_file *secfile, struct entry *pentry)
bool entry_str_escaped(const struct entry *pentry)
struct entry * section_entry_int_new(struct section *psection, const char *name, int value)
struct entry * secfile_insert_bool_full(struct section_file *secfile, bool value, const char *comment, bool allow_replace, const char *path,...)
struct entry * secfile_insert_int_full(struct section_file *secfile, int value, const char *comment, bool allow_replace, const char *path,...)
struct section * entry_section(const struct entry *pentry)
struct section_list * secfile_sections_by_name_prefix(const struct section_file *secfile, const char *prefix)
int secfile_lookup_enum_default_data(const struct section_file *secfile, int defval, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
const struct entry_list * section_entries(const struct section *psection)
struct section_file * secfile_load_section(const char *filename, const char *section, bool allow_duplicates)
bool entry_bool_set(struct entry *pentry, bool value)
struct section_file * secfile_from_stream(fz_FILE *stream, bool allow_duplicates)
size_t secfile_insert_bitwise_enum_vec_full(struct section_file *secfile, const int *bitwise_vals, size_t dim, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...)
static void entry_to_file(const struct entry *pentry, fz_FILE *fs)
static void entry_from_inf_token(struct section *psection, const char *name, const char *tok, struct inputfile *file)
bool entry_float_get(const struct entry *pentry, float *value)
const char ** secfile_lookup_str_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
bool entry_str_set_escaped(struct entry *pentry, bool escaped)
const char * entry_name(const struct entry *pentry)
struct entry * secfile_entry_lookup(const struct section_file *secfile, const char *path,...)
bool entry_str_get(const struct entry *pentry, const char **value)
struct entry * secfile_insert_enum_data_full(struct section_file *secfile, int value, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...)
bool entry_str_set_gt_marking(struct entry *pentry, bool gt_marking)
size_t secfile_insert_int_vec_full(struct section_file *secfile, const int *values, size_t dim, const char *comment, bool allow_replace, const char *path,...)
const char * secfile_lookup_str(const struct section_file *secfile, const char *path,...)
void entry_destroy(struct entry *pentry)
static bool entry_used(const struct entry *pentry)
void section_clear_all(struct section *psection)
int * secfile_lookup_int_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
bool entry_float_set(struct entry *pentry, float value)
float secfile_lookup_float_default(const struct section_file *secfile, float def, const char *path,...)
bool * secfile_lookup_bool_vec(const struct section_file *secfile, size_t *dim, const char *path,...)
int secfile_lookup_plain_enum_default_full(const struct section_file *secfile, int defval, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
size_t secfile_insert_str_vec_full(struct section_file *secfile, const char *const *strings, size_t dim, const char *comment, bool allow_replace, bool no_escape, const char *path,...)
size_t secfile_insert_plain_enum_vec_full(struct section_file *secfile, const int *enumurators, size_t dim, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...)
bool secfile_save(const struct section_file *secfile, const char *filename, int compression_level, enum fz_method compression_method)
struct entry * secfile_insert_float_full(struct section_file *secfile, float value, const char *comment, bool allow_replace, const char *path,...)
struct section * secfile_insert_include(struct section_file *secfile, const char *filename)
struct entry * secfile_insert_plain_enum_full(struct section_file *secfile, int enumerator, secfile_enum_name_fn_t name_fn, const char *comment, bool allow_replace, const char *path,...)
bool secfile_lookup_bool_default(const struct section_file *secfile, bool def, const char *path,...)
bool entry_int_set(struct entry *pentry, int value)
static bool is_secfile_entry_name_valid(const char *name)
struct entry * section_entry_by_name(const struct section *psection, const char *name)
const struct section_list * secfile_sections(const struct section_file *secfile)
struct entry * secfile_insert_filereference(struct section_file *secfile, const char *filename, const char *path,...)
bool section_set_name(struct section *psection, const char *name)
struct entry * section_entry_str_new(struct section *psection, const char *name, const char *value, bool escaped)
struct entry * section_entry_float_new(struct section *psection, const char *name, float value)
int secfile_lookup_int_default(const struct section_file *secfile, int def, const char *path,...)
struct entry * section_entry_lookup(const struct section *psection, const char *path,...)
bool entry_int_get(const struct entry *pentry, int *value)
int * secfile_lookup_bitwise_enum_vec_full(const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
static void entry_use(struct entry *pentry)
int * secfile_lookup_enum_vec_data(const struct section_file *secfile, size_t *dim, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *path,...)
struct entry * section_entry_bool_new(struct section *psection, const char *name, bool value)
bool secfile_lookup_plain_enum_full(const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
const char * secfile_name(const struct section_file *secfile)
struct section * secfile_section_new(struct section_file *secfile, const char *name)
const char * entry_comment(const struct entry *pentry)
static bool secfile_hash_delete(struct section_file *secfile, struct entry *pentry)
struct entry * secfile_entry_by_path(const struct section_file *secfile, const char *path)
static struct section_file * secfile_from_input_file(struct inputfile *inf, const char *filename, const char *section, bool allow_duplicates)
struct section * secfile_section_by_name(const struct section_file *secfile, const char *name)
struct entry * secfile_insert_bitwise_enum_full(struct section_file *secfile, int bitwise_val, secfile_enum_name_fn_t name_fn, secfile_enum_iter_fn_t begin_fn, secfile_enum_iter_fn_t end_fn, secfile_enum_next_fn_t next_fn, const char *comment, bool allow_replace, const char *path,...)
struct entry * secfile_insert_str_full(struct section_file *secfile, const char *str, const char *comment, bool allow_replace, bool no_escape, enum entry_special_type stype, const char *path,...)
int * secfile_lookup_plain_enum_vec_full(const struct section_file *secfile, size_t *dim, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
struct section * secfile_section_lookup(const struct section_file *secfile, const char *path,...)
const char * secfile_lookup_str_default(const struct section_file *secfile, const char *def, const char *path,...)
static bool is_legal_table_entry_name(char c, bool num)
bool entry_str_set(struct entry *pentry, const char *value)
bool secfile_lookup_bitwise_enum_full(const struct section_file *secfile, int *penumerator, secfile_enum_is_valid_fn_t is_valid_fn, secfile_enum_by_name_fn_t by_name_fn, const char *path,...)
size_t secfile_insert_enum_vec_data_full(struct section_file *secfile, const int *values, size_t dim, bool bitwise, secfile_enum_name_data_fn_t name_fn, secfile_data_t data, const char *comment, bool allow_replace, const char *path,...)
bool secfile_lookup_bool(const struct section_file *secfile, bool *bval, const char *path,...)
static const char * datafilename(const char *filename)
int secfile_lookup_int_def_min_max(const struct section_file *secfile, int defval, int minval, int maxval, const char *path,...)
static struct section * secfile_insert_base(struct section_file *secfile, const char *path, const char **pent_name)
enum entry_type entry_type_get(const struct entry *pentry)
int(* secfile_enum_iter_fn_t)(void)
const char *(* secfile_enum_name_data_fn_t)(secfile_data_t data, int enumerator)
#define section_list_iterate(seclist, psection)
#define entry_list_iterate_end
bool(* secfile_enum_is_valid_fn_t)(int enumerator)
const char *(* secfile_enum_name_fn_t)(int enumerator)
#define section_list_iterate_end
#define entry_list_iterate(entlist, pentry)
int(* secfile_enum_by_name_fn_t)(const char *enum_name, int(*strcmp_fn)(const char *, const char *))
int(* secfile_enum_next_fn_t)(int enumerator)
const void * secfile_data_t
bool entry_from_token(struct section *psection, const char *name, const char *tok)
#define SECFILE_LOG(secfile, psection, format,...)
#define SECFILE_RETURN_VAL_IF_FAIL(secfile, psection, condition, value)
#define SECFILE_RETURN_IF_FAIL(secfile, psection, condition)
const char * fileinfoname(const struct strvec *dirs, const char *filename)
void interpret_tilde(char *buf, size_t buf_size, const char *filename)
void remove_leading_trailing_spaces(char *s)
const struct strvec * get_data_dirs(void)
struct entry::@2::@6 floating
struct entry::@2::@7 string
struct section * psection
struct entry::@2::@4 boolean
struct entry::@2::@5 integer
struct entry_hash * entries
struct section_file::@8 hash
struct section_list * sections
bool allow_digital_boolean
unsigned int num_includes
unsigned int num_long_comments
struct entry_list * entries
enum entry_special_type special
struct section_file * secfile
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
void make_escapes(const char *str, char *buf, size_t buf_len)
int fc_strcasecmp(const char *str0, const char *str1)
int cat_snprintf(char *str, size_t n, const char *format,...)
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
#define sz_strlcpy(dest, src)