From 326768484a8884767b50fbdf5472eff236ce316c Mon Sep 17 00:00:00 2001 From: Iztok Jeras <iztok.jeras@redpitaya.com> Date: ćšć, 08 10æ 2015 03:00:34 +0800 Subject: [PATCH] integer parser: renamed some more static functions, to add Base or Sign keyword --- libscpi/src/parser.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c index ffd8de1..cac80ec 100644 --- a/libscpi/src/parser.c +++ b/libscpi/src/parser.c @@ -591,7 +591,7 @@ * @param sign * @return TRUE if succesful */ -static scpi_bool_t ParamToInt32(scpi_t * context, scpi_parameter_t * parameter, int32_t * value, scpi_bool_t sign) { +static scpi_bool_t ParamSignToUInt32(scpi_t * context, scpi_parameter_t * parameter, uint32_t * value, scpi_bool_t sign) { if (!value) { SCPI_ErrorPush(context, SCPI_ERROR_SYSTEM_ERROR); @@ -600,17 +600,17 @@ switch (parameter->type) { case SCPI_TOKEN_HEXNUM: - return strToUInt32(parameter->ptr, (uint32_t *)value, 16) > 0 ? TRUE : FALSE; + return strBaseToUInt32(parameter->ptr, value, 16) > 0 ? TRUE : FALSE; case SCPI_TOKEN_OCTNUM: - return strToUInt32(parameter->ptr, (uint32_t *)value, 8) > 0 ? TRUE : FALSE; + return strBaseToUInt32(parameter->ptr, value, 8) > 0 ? TRUE : FALSE; case SCPI_TOKEN_BINNUM: - return strToUInt32(parameter->ptr, (uint32_t *)value, 2) > 0 ? TRUE : FALSE; + return strBaseToUInt32(parameter->ptr, value, 2) > 0 ? TRUE : FALSE; case SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA: case SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA_WITH_SUFFIX: if (sign) { - return strToInt32(parameter->ptr, value, 10) > 0 ? TRUE : FALSE; + return strBaseToInt32(parameter->ptr, (uint32_t *)value, 10) > 0 ? TRUE : FALSE; } else { - return strToUInt32(parameter->ptr, (uint32_t *)value, 10) > 0 ? TRUE : FALSE; + return strBaseToUInt32(parameter->ptr, value, 10) > 0 ? TRUE : FALSE; } default: return FALSE; @@ -625,7 +625,7 @@ * @return TRUE if succesful */ scpi_bool_t SCPI_ParamToInt32(scpi_t * context, scpi_parameter_t * parameter, int32_t * value) { - return ParamToInt32(context, parameter, value, TRUE); + return ParamSignToUInt32(context, parameter, (uint32_t *)value, TRUE); } /** @@ -636,7 +636,7 @@ * @return TRUE if succesful */ scpi_bool_t SCPI_ParamToUInt32(scpi_t * context, scpi_parameter_t * parameter, uint32_t * value) { - return ParamToInt32(context, parameter, (int32_t *)value, FALSE); + return ParamSignToUInt32(context, parameter, value, FALSE); } /** @@ -712,7 +712,7 @@ * @param sign * @return */ -static scpi_bool_t ParamInt32(scpi_t * context, int32_t * value, scpi_bool_t mandatory, scpi_bool_t sign) { +static scpi_bool_t ParamSignUInt32(scpi_t * context, uint32_t * value, scpi_bool_t mandatory, scpi_bool_t sign) { scpi_bool_t result; scpi_parameter_t param; @@ -724,7 +724,7 @@ result = SCPI_Parameter(context, ¶m, mandatory); if (result) { if (SCPI_ParamIsNumber(¶m, FALSE)) { - result = ParamToInt32(context, ¶m, value, sign); + result = ParamSignToUInt32(context, ¶m, value, sign); } else if (SCPI_ParamIsNumber(¶m, TRUE)) { SCPI_ErrorPush(context, SCPI_ERROR_SUFFIX_NOT_ALLOWED); result = FALSE; @@ -744,7 +744,7 @@ * @return */ scpi_bool_t SCPI_ParamInt32(scpi_t * context, int32_t * value, scpi_bool_t mandatory) { - return ParamInt32(context, value, mandatory, TRUE); + return ParamSignUInt32(context, (uint32_t *)value, mandatory, TRUE); } /** @@ -755,7 +755,7 @@ * @return */ scpi_bool_t SCPI_ParamUInt32(scpi_t * context, uint32_t * value, scpi_bool_t mandatory) { - return ParamInt32(context, (int32_t *)value, mandatory, FALSE); + return ParamSignUInt32(context, value, mandatory, FALSE); } /** -- Gitblit v1.9.1