| | |
| | | * @param buffer |
| | | * @param interface |
| | | */ |
| | | void SCPI_Init(scpi_t * context) { |
| | | void SCPI_Init(scpi_t * context, |
| | | const scpi_command_t * commands, |
| | | scpi_interface_t * interface, |
| | | const scpi_unit_def_t * units, |
| | | const char * idn1, const char * idn2, const char * idn3, const char * idn4, |
| | | char * input_buffer, size_t input_buffer_length, |
| | | int16_t * error_queue_data, int16_t error_queue_size) { |
| | | memset(context, 0, sizeof(*context)); |
| | | context->cmdlist = commands; |
| | | context->interface = interface; |
| | | context->units = units; |
| | | context->idn[0] = idn1; |
| | | context->idn[1] = idn2; |
| | | context->idn[2] = idn3; |
| | | context->idn[3] = idn4; |
| | | context->buffer.data = input_buffer; |
| | | context->buffer.length = input_buffer_length; |
| | | context->buffer.position = 0; |
| | | SCPI_ErrorInit(context); |
| | | SCPI_ErrorInit(context, error_queue_data, error_queue_size); |
| | | } |
| | | |
| | | /** |
| | |
| | | case 4: |
| | | case 8: |
| | | result += SCPI_ResultArbitraryBlockHeader(context, count * item_size); |
| | | break; |
| | | default: |
| | | SCPI_ErrorPush(context, SCPI_ERROR_SYSTEM_ERROR); |
| | | return 0; |
| | |
| | | size_t i;\ |
| | | for (i = 0; i < count; i++) {\ |
| | | result += func(context, array[i]);\ |
| | | }\ |
| | | if (count > 0) {\ |
| | | result += count - 1; /* add length of commas */\ |
| | | }\ |
| | | } else {\ |
| | | result = parserResultArrayBinary(context, array, count, sizeof(*array), format);\ |