85#define INF_DEBUG_FOUND FALSE
86#define INF_DEBUG_NOT_FOUND FALSE
88#define INF_MAGIC (0xabdc0132)
143#define inf_log(inf, level, message, ...) \
144 if (log_do_output_for_level(level)) { \
145 do_log(__FILE__, __FUNCTION__, __FC_LINE__, FALSE, level, "%s", \
146 inf_log_str(inf, message, ## __VA_ARGS__)); \
148#define inf_warn(inf, message) \
149 inf_log(inf, LOG_NORMAL, "%s", message);
156 return (c ==
'#' || c ==
';');
168 inf->filename =
nullptr;
170 inf->datafn =
nullptr;
171 inf->included_from =
nullptr;
172 inf->line_num =
inf->cur_line_pos = 0;
174 inf->string_start_line = 0;
210 return inf->filename;
212 return "(anonymous)";
253 inf->filename =
nullptr;
285 inf->filename =
nullptr;
309 if (
inf->included_from) {
312 inf->included_from =
nullptr;
369 static size_t len = 0;
384 ||
inf->cur_line_pos > 0) {
404 "Did not find opening doublequote for '*include' line");
411 while (*c !=
'\0' && *c !=
'\"') c++;
414 "Did not find closing doublequote for '*include' line");
451 }
while ((
inc =
inc->included_from));
511 if (
inf->in_string) {
545 inf->cur_line_pos = 0;
553 if (
inf->included_from) {
574 static char str[512];
588 (
inf->at_eof ?
", EOF" :
""));
594 if (
inf->in_string) {
596 "\n processing string starting at line %d",
597 inf->string_start_line);
599 while ((
inf =
inf->included_from)) {
668 const char *c, *start;
677 while (*c !=
'\0' && *c !=
']') {
683 *((
char *) c) =
'\0';
697 const char *c, *start, *end;
713 if (!(*c !=
'\0' && (
fc_isspace(*c) || *c ==
'='))) {
717 while (*c !=
'\0' && *c !=
'=' && !
is_comment(*c)) {
724 *((
char *) end) =
'\0';
754 inf->cur_line_pos = 0;
815 const char *c, *start;
830 if (*c ==
'-' || *c ==
'+' ||
fc_isdigit(*c)) {
850 *((
char *) c) =
'\0';
860 if (*c ==
'_' && *(c + 1) ==
'(') {
883 if (*c ==
'\0' || *c ==
'\n') {
896 *((
char *) (c - 1)) =
'\0';
901 _(
"Cannot find stringfile \"%s\"."), start);
909 _(
"Cannot open stringfile \"%s\"."),
rfname);
912 log_debug(
"Stringfile \"%s\" opened ok", start);
923 if (
ret ==
nullptr) {
951 *((
char *) c) =
'\0';
975 inf->string_start_line =
inf->line_num;
978 partial = &
inf->partial;
987 if (*c ==
'\\' && *(c + 1) !=
'\0') {
1003 "Bad return for multi-line string from read_a_line");
1011 *((
char *) c) =
'\0';
1021 inf->cur_line_pos++;
1023 inf_warn(
inf,
"Missing end of i18n string marking");
void astr_free(struct astring *astr)
void astr_set(struct astring *astr, const char *format,...)
void astr_reserve(struct astring *astr, size_t n)
void astr_clear(struct astring *astr)
void astr_init(struct astring *astr)
void astr_add(struct astring *astr, const char *format,...)
static size_t astr_capacity(const struct astring *astr) fc__attribute((nonnull(1)))
static size_t astr_len(const struct astring *astr) fc__attribute((nonnull(1)))
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
static bool astr_empty(const struct astring *astr) fc__attribute((nonnull(1)))
char * fz_fgets(char *buffer, int size, fz_FILE *fp)
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 fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_error(message,...)
const char * fileinfoname(const struct strvec *dirs, const char *filename)
const struct strvec * get_data_dirs(void)
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_strlcat(dest, src)
#define fc_strncmp(_s1_, _s2_, _len_)