From af1171de59bfa506df1fb7e2097b97a2eb65fee1 Mon Sep 17 00:00:00 2001 From: Jon Feldman Date: Mon, 9 Oct 2017 13:51:48 -0400 Subject: [PATCH] parser: add support for GAME section --- src/parser.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/parser.c b/src/parser.c index 65a732d..638de51 100644 --- a/src/parser.c +++ b/src/parser.c @@ -16,6 +16,7 @@ static const char *TOKEN_ALL_SECTION = "ALL"; static const char *TOKEN_KERNEL_SECTION = "KERNEL"; +static const char *TOKEN_GAME_SECTION = "GAME"; #ifdef NO_STRING #include @@ -42,6 +43,18 @@ static int strcmp(const char * s1, const char * s2) return (*s1 - *s2); } +static int strncmp(const char * s1, const char * s2, size_t count) +{ + while ((*s1) && (*s1 == *s2) && count != 0) + { + ++s1; + ++s2; + --count; + } + if (count == 0) return 0; + return (*s1 - *s2); +} + #endif // NO_STRING static inline int is_continuation_byte(char b) @@ -243,6 +256,11 @@ void taihen_config_parse(const char *input, const char *section, taihen_config_h { record_entries = 1; } + else if (strcmp(ctx.line_pos, TOKEN_GAME_SECTION) == 0 && strcmp(section, TOKEN_KERNEL_SECTION) != 0 && + strlen(section) == 9 && strncmp(section, "PCS", 3) == 0 && section[3] >= 'A' && section[3] <= 'H') + { + record_entries = 1; + } else if (strcmp(section, ctx.line_pos) == 0) { record_entries = 1; -- 2.39.5