summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Romani <fromani@gmail.com>2014-07-06 16:11:44 +0200
committerSebastian Dröge <sebastian@centricular.com>2023-04-12 21:30:03 +0300
commit9afd14861cab5f3faffa9f51a9129f407a6413f0 (patch)
tree9512b8ebeacb2fc7cb91584cc78647e77c82c6ec
parent7caef9ff844c7f690543127f0055b4b0ccf6af72 (diff)
downloadorc-9afd14861cab5f3faffa9f51a9129f407a6413f0.tar.gz
parser: extract function to handle .param
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>
-rw-r--r--orc/orcparse.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/orc/orcparse.c b/orc/orcparse.c
index 0c55db8..ccbd8bb 100644
--- a/orc/orcparse.c
+++ b/orc/orcparse.c
@@ -101,6 +101,7 @@ static int orc_parse_handle_dest (OrcParser *parser, const OrcLine *line);
static int orc_parse_handle_accumulator (OrcParser *parser, const OrcLine *line);
static int orc_parse_handle_constant_str (OrcParser *parser, const OrcLine *line);
static int orc_parse_handle_temporary (OrcParser *parser, const OrcLine *line);
+static int orc_parse_handle_parameter (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);
@@ -440,15 +441,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], ".param") == 0) {
- if (n_tokens < 3) {
- orc_parse_add_error (parser, "line %d: .param without size or name\n",
- parser->line_number);
- } else {
- int size = strtol (token[1], NULL, 0);
- orc_program_add_parameter (parser->program, size, token[2]);
- }
- } else if (strcmp (token[0], ".longparam") == 0) {
+ if (strcmp (token[0], ".longparam") == 0) {
if (n_tokens < 3) {
orc_parse_add_error (parser, "line %d: .longparam without size or name\n",
parser->line_number);
@@ -734,6 +727,7 @@ orc_parse_handle_constant_str (OrcParser *parser, const OrcLine *line)
}
ORC_PARSE_ITEM (temporary)
+ORC_PARSE_ITEM (parameter)
static int
@@ -751,6 +745,7 @@ orc_parse_handle_directive (OrcParser *parser, const OrcLine *line)
{ ".accumulator", orc_parse_handle_accumulator },
{ ".const", orc_parse_handle_constant_str },
{ ".temp", orc_parse_handle_temporary },
+ { ".param", orc_parse_handle_parameter },
{ NULL, NULL }
};
int i;