diff options
author | Francesco Romani <fromani@gmail.com> | 2014-07-06 15:48:59 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-04-12 21:13:53 +0300 |
commit | 334a1c809692cabcaf8956c4df6aff3992c57f4c (patch) | |
tree | a907dc88bb86cee9d49fe0ab34bc5de053f2640a /orc/orcparse.c | |
parent | ada3b11382b0514cebb178e0754c20e37c1a08be (diff) | |
download | orc-334a1c809692cabcaf8956c4df6aff3992c57f4c.tar.gz |
parser: extract function to handle .flags
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>
Diffstat (limited to 'orc/orcparse.c')
-rw-r--r-- | orc/orcparse.c | 23 |
1 files 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;i<n_tokens;i++){ - if (!strcmp (token[i], "2d")) { - orc_program_set_2d (parser->program); - } - } - } else if (strcmp (token[0], ".n") == 0) { + if (strcmp (token[0], ".n") == 0) { int i; for(i=1;i<n_tokens;i++){ if (strcmp (token[i], "mult") == 0) { @@ -659,12 +653,25 @@ orc_parse_handle_init (OrcParser *parser, const OrcLine *line) } static int +orc_parse_handle_flags (OrcParser *parser, const OrcLine *line) +{ + int i; + for (i=1;i<line->n_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; |