summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Romani <fromani@gmail.com>2014-07-06 15:48:59 +0200
committerSebastian Dröge <sebastian@centricular.com>2023-04-12 21:13:53 +0300
commit334a1c809692cabcaf8956c4df6aff3992c57f4c (patch)
treea907dc88bb86cee9d49fe0ab34bc5de053f2640a
parentada3b11382b0514cebb178e0754c20e37c1a08be (diff)
downloadorc-334a1c809692cabcaf8956c4df6aff3992c57f4c.tar.gz
parser: extract function to handle .flags
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>
-rw-r--r--orc/orcparse.c23
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;