Reformat; change return parameter type
| | |
| | | |
| | | scpi_result_t TEST_ChoiceQ(scpi_t * context) { |
| | | |
| | | size_t param; |
| | | int32_t param; |
| | | |
| | | if (!SCPI_ParamChoice(context, trigger_source, ¶m, true)) { |
| | | return SCPI_RES_ERR; |
| | | } |
| | | |
| | | fprintf(stderr, "\tP1=%s (%u)\r\n", trigger_source[param], param); |
| | | fprintf(stderr, "\tP1=%s (%d)\r\n", trigger_source[param], param); |
| | | |
| | | SCPI_ResultInt(context, param); |
| | | |
| | |
| | | bool_t SCPI_ParamString(scpi_t * context, const char ** value, size_t * len, bool_t mandatory); |
| | | bool_t SCPI_ParamText(scpi_t * context, const char ** value, size_t * len, bool_t mandatory); |
| | | bool_t SCPI_ParamBool(scpi_t * context, bool_t * value, bool_t mandatory); |
| | | bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], size_t * value, bool_t mandatory); |
| | | bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], int32_t * value, bool_t mandatory); |
| | | |
| | | |
| | | #ifdef __cplusplus |
| | |
| | | * @param mandatory |
| | | * @return |
| | | */ |
| | | bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], size_t * value, bool_t mandatory) { |
| | | bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], int32_t * value, bool_t mandatory) { |
| | | const char * param; |
| | | size_t param_len; |
| | | size_t res; |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | for (res = 0; options[res]; ++res) { |
| | | if (matchPattern(options[res], strlen(options[res]), param, param_len)) { |
| | | *value = res; |
| | | return TRUE; |
| | | } |
| | | for (res = 0; options[res]; ++res) { |
| | | if (matchPattern(options[res], strlen(options[res]), param, param_len)) { |
| | | *value = res; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | SCPI_ErrorPush(context, SCPI_ERROR_ILLEGAL_PARAMETER_VALUE); |
| | | SCPI_ErrorPush(context, SCPI_ERROR_ILLEGAL_PARAMETER_VALUE); |
| | | return FALSE; |
| | | } |
| | | |