Commit 8fcf5def authored by Alejandro Mery's avatar Alejandro Mery
Browse files

script_bin: add pr_debug() helper

parent 9bb5adf7
...@@ -27,8 +27,14 @@ ...@@ -27,8 +27,14 @@
#define MAX_LINE 255 #define MAX_LINE 255
#define pr_info(...) fprintf(stderr, "fex2bin: " __VA_ARGS__) #define pr_info(...) errf("fexc-fex: " __VA_ARGS__)
#define pr_err(...) pr_info("E: " __VA_ARGS__) #define pr_err(...) errf("E: fexc-fex: " __VA_ARGS__)
#ifdef DEBUG
#define pr_debug(...) errf("D: fexc-fex: " __VA_ARGS__)
#else
#define pr_debug(...)
#endif
/* /*
* generator * generator
...@@ -239,11 +245,9 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) ...@@ -239,11 +245,9 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
/* string */ /* string */
p++; *--pe = '\0'; p++; *--pe = '\0';
if (script_string_entry_new(last_section, key, pe-p, p)) { if (script_string_entry_new(last_section, key, pe-p, p)) {
#ifdef VERBOSE pr_debug("%s.%s = \"%.*s\"\n",
errf("%s.%s = \"%.*s\"\n",
last_section->name, key, last_section->name, key,
(int)(pe-p), p); (int)(pe-p), p);
#endif
continue; continue;
} }
perror("malloc"); perror("malloc");
...@@ -291,12 +295,10 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) ...@@ -291,12 +295,10 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
goto invalid_char_at_p; goto invalid_char_at_p;
if (script_gpio_entry_new(last_section, key, if (script_gpio_entry_new(last_section, key,
port, port_num, data)) { port, port_num, data)) {
#ifdef VERBOSE pr_debug("%s.%s = GPIO %d.%d (%d,%d,%d,%d)\n",
errf("%s.%s = GPIO %d.%d (%d,%d,%d,%d)\n",
last_section->name, key, last_section->name, key,
port, port_num, port, port_num,
data[0], data[1], data[2], data[3]); data[0], data[1], data[2], data[3]);
#endif
continue; continue;
} }
perror("malloc"); perror("malloc");
...@@ -313,10 +315,8 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) ...@@ -313,10 +315,8 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script)
errf("E: %s:%zu: value out of range %lld.\n", errf("E: %s:%zu: value out of range %lld.\n",
filename, line, v); filename, line, v);
} else if (script_single_entry_new(last_section, key, v)) { } else if (script_single_entry_new(last_section, key, v)) {
#ifdef VERBOSE pr_debug("%s.%s = %lld\n",
errf("%s.%s = %lld\n",
last_section->name, key, v); last_section->name, key, v);
#endif
continue; continue;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment