From 0b93e27428f5cbe2d3ddb8758fbb4866ad963bdf Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Sun, 6 Jul 2014 16:14:36 +0200 Subject: [PATCH] parser: extract function to handle .floatparam Part-of: --- orc/orcparse.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/orc/orcparse.c b/orc/orcparse.c index 3ad8edf..2e4c0b8 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -103,6 +103,7 @@ 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_parameter_int64 (OrcParser *parser, const OrcLine *line); +static int orc_parse_handle_parameter_float (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); @@ -442,15 +443,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], ".floatparam") == 0) { - if (n_tokens < 3) { - orc_parse_add_error (parser, "line %d: .floatparam without size or name\n", - parser->line_number); - } else { - int size = strtol (token[1], NULL, 0); - orc_program_add_parameter_float (parser->program, size, token[2]); - } - } else if (strcmp (token[0], ".doubleparam") == 0) { + if (strcmp (token[0], ".doubleparam") == 0) { if (n_tokens < 3) { orc_parse_add_error (parser, "line %d: .doubleparam without size or name\n", parser->line_number); @@ -720,6 +713,7 @@ orc_parse_handle_constant_str (OrcParser *parser, const OrcLine *line) ORC_PARSE_ITEM (temporary) ORC_PARSE_ITEM (parameter) ORC_PARSE_ITEM (parameter_int64) +ORC_PARSE_ITEM (parameter_float) static int @@ -739,6 +733,7 @@ orc_parse_handle_directive (OrcParser *parser, const OrcLine *line) { ".temp", orc_parse_handle_temporary }, { ".param", orc_parse_handle_parameter }, { ".longparam", orc_parse_handle_parameter_int64 }, + { ".floatparam", orc_parse_handle_parameter_float }, { NULL, NULL } }; int i; -- 2.7.4