From 9afd14861cab5f3faffa9f51a9129f407a6413f0 Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Sun, 6 Jul 2014 16:11:44 +0200 Subject: [PATCH] parser: extract function to handle .param Part-of: --- orc/orcparse.c | 13 ++++--------- 1 file 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; -- 2.7.4