From 334a1c809692cabcaf8956c4df6aff3992c57f4c Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Sun, 6 Jul 2014 15:48:59 +0200 Subject: [PATCH] parser: extract function to handle .flags Part-of: --- orc/orcparse.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/orc/orcparse.c b/orc/orcparse.c index 6ef13ed..db3fdec 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -93,6 +93,7 @@ static void orc_parse_sanity_check (OrcParser *parser, OrcProgram *program); static int orc_parse_handle_legacy (OrcParser *parser, const OrcLine *line); static int orc_parse_handle_function (OrcParser *parser, const OrcLine *line); static int orc_parse_handle_init (OrcParser *parser, const OrcLine *line); +static int orc_parse_handle_flags (OrcParser *parser, const OrcLine *line); static int orc_parse_handle_directive (OrcParser *parser, const OrcLine *line); static int orc_parse_handle_opcode (OrcParser *parser, const OrcLine *line); @@ -432,14 +433,7 @@ orc_parse_handle_legacy (OrcParser *parser, const OrcLine *line) const char **token = (const char **)(line->tokens); int n_tokens = line->n_tokens; - if (strcmp (token[0], ".flags") == 0) { - int i; - for(i=1;iprogram); - } - } - } else if (strcmp (token[0], ".n") == 0) { + if (strcmp (token[0], ".n") == 0) { int i; for(i=1;in_tokens;i++) { + if (!strcmp (line->tokens[i], "2d")) { + orc_program_set_2d (parser->program); + } + } + return 1; +} + +static int orc_parse_handle_directive (OrcParser *parser, const OrcLine *line) { static const OrcDirective dirs[] = { { ".function", orc_parse_handle_function }, { ".backup", orc_parse_handle_backup }, { ".init", orc_parse_handle_init }, + { ".flags", orc_parse_handle_flags }, { NULL, NULL } }; int i; -- 2.7.4