src: more code fixes
parent
91e3465541
commit
1f3d6d1f5d
|
@ -7,6 +7,7 @@
|
||||||
#include <toml.h>
|
#include <toml.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "script.h"
|
||||||
|
|
||||||
#define ERRBUFSZ 200
|
#define ERRBUFSZ 200
|
||||||
|
|
||||||
|
@ -37,5 +38,11 @@ int main(int argc, char **argv) {
|
||||||
error("missing key: name", "");
|
error("missing key: name", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Preparing to process %s...\n", name.u.s);
|
printf("Processing game %s...\n", name.u.s);
|
||||||
|
toml_array_t *scripts = toml_array_in(conf, "script");
|
||||||
|
|
||||||
|
for (int i = 0; ; i++) {
|
||||||
|
toml_table_t *toml_script = toml_table_at(scripts, i);
|
||||||
|
script_t script = script_create(toml_script);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,11 @@ script_t script_create(toml_table_t *table) {
|
||||||
#define TOML_GET_KEY(var, key, func) toml_datum_t (var) = func(table, (key));\
|
#define TOML_GET_KEY(var, key, func) toml_datum_t (var) = func(table, (key));\
|
||||||
if (!(var).ok) {\
|
if (!(var).ok) {\
|
||||||
char str[200];\
|
char str[200];\
|
||||||
snprintf(str, 200, "key '%s' missing from", (key)); \
|
snprintf(str, 200, "key '%s' missing", (key)); \
|
||||||
error(str, filename.u.s); \
|
error(str, ""); \
|
||||||
}
|
}
|
||||||
|
TOML_GET_KEY(name, "name", toml_string_in)
|
||||||
|
printf(" Processing script %s...\n", name.u.s);
|
||||||
TOML_GET_KEY(filename, "filename", toml_string_in)
|
TOML_GET_KEY(filename, "filename", toml_string_in)
|
||||||
TOML_GET_KEY(font_name, "font", toml_string_in)
|
TOML_GET_KEY(font_name, "font", toml_string_in)
|
||||||
TOML_GET_KEY(min_tiles, "min_tiles_per_line", toml_int_in)
|
TOML_GET_KEY(min_tiles, "min_tiles_per_line", toml_int_in)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
char *name;
|
||||||
char *filename;
|
char *filename;
|
||||||
font_t font;
|
font_t font;
|
||||||
char *format;
|
char *format;
|
||||||
|
@ -20,4 +21,7 @@ typedef struct {
|
||||||
bool little_endian;
|
bool little_endian;
|
||||||
} script_t;
|
} script_t;
|
||||||
|
|
||||||
|
script_t script_create(toml_table_t *table);
|
||||||
|
void script_destroy(script_t script);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue