Add USE_COMMAND_TAGS and USE_DEPRECATED_FUNCTIONS defines
| | |
| | | } |
| | | |
| | | scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) { |
| | | SCPI_ResultInt(context, CONTROL_PORT); |
| | | SCPI_ResultInt32(context, CONTROL_PORT); |
| | | return SCPI_RES_OK; |
| | | } |
| | | |
| | |
| | | #define USE_USER_ERROR_LIST 0 |
| | | #endif |
| | | |
| | | #ifndef USE_COMMAND_TAGS |
| | | #define USE_COMMAND_TAGS 1 |
| | | #endif |
| | | |
| | | #ifndef USE_DEPRECATED_FUNCTIONS |
| | | #define USE_DEPRECATED_FUNCTIONS 1 |
| | | #endif |
| | | |
| | | /* Compiler specific */ |
| | | /* RealView/Keil ARM Compiler, e.g. Cortex-M CPUs */ |
| | | #if defined(__CC_ARM) |
| | |
| | | * Copyright (c) 2012-2013 Jan Breuer, |
| | | * |
| | | * All Rights Reserved |
| | | * |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are |
| | | * met: |
| | |
| | | * 2. Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * |
| | | * |
| | | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR |
| | | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| | | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| | |
| | | /** |
| | | * @file scpi_parser.h |
| | | * @date Thu Nov 15 10:58:45 UTC 2012 |
| | | * |
| | | * |
| | | * @brief SCPI parser implementation |
| | | * |
| | | * |
| | | * |
| | | * |
| | | */ |
| | | |
| | | #ifndef SCPI_PARSER_H |
| | |
| | | scpi_bool_t SCPI_ParamChoice(scpi_t * context, const scpi_choice_def_t * options, int32_t * value, scpi_bool_t mandatory); |
| | | |
| | | scpi_bool_t SCPI_IsCmd(scpi_t * context, const char * cmd); |
| | | #if USE_COMMAND_TAGS |
| | | int32_t SCPI_CmdTag(scpi_t * context); |
| | | #endif /* USE_COMMAND_TAGS */ |
| | | scpi_bool_t SCPI_Match(const char * pattern, const char * value, size_t len); |
| | | scpi_bool_t SCPI_CommandNumbers(scpi_t * context, int32_t * numbers, size_t len, int32_t default_value); |
| | | |
| | | #if USE_DEPRECATED_FUNCTIONS |
| | | // deprecated finction, should be removed later |
| | | #define SCPI_ResultIntBase(context, val, base) SCPI_ResultInt32Base ((context), (val), (base), TRUE) |
| | | #define SCPI_ResultInt(context, val) SCPI_ResultInt32 ((context), (val)) |
| | |
| | | #define SCPI_ParamToUnsignedInt(context, parameter, value) SCPI_ParamToUInt32((context), (parameter), (value)) |
| | | #define SCPI_ParamInt(context, value, mandatory) SCPI_ParamInt32((context), (value), (mandatory)) |
| | | #define SCPI_ParamUnsignedInt(context, value, mandatory) SCPI_ParamUInt32((context), (value), (mandatory)) |
| | | #endif /* USE_DEPRECATED_FUNCTIONS */ |
| | | |
| | | #ifdef __cplusplus |
| | | } |
| | |
| | | struct _scpi_command_t { |
| | | const char * pattern; |
| | | scpi_command_callback_t callback; |
| | | #if USE_COMMAND_TAGS |
| | | int32_t tag; |
| | | #endif /* USE_COMMAND_TAGS */ |
| | | }; |
| | | |
| | | struct _scpi_interface_t { |
| | |
| | | size_t i = 0; |
| | | while (scpiLex_DecimalNumericProgramData(state, ¶m)) { |
| | | if (i < length) { |
| | | SCPI_ParamToInt(context, ¶m, &values[i]); |
| | | SCPI_ParamToInt32(context, ¶m, &values[i]); |
| | | } |
| | | |
| | | if (scpiLex_SpecificCharacter(state, ¶m, '!')) { |
| | |
| | | return matchCommand(pattern, cmd, strlen(cmd), NULL, 0, 0); |
| | | } |
| | | |
| | | #if USE_COMMAND_TAGS |
| | | /** |
| | | * Return the .tag field of the matching scpi_command_t |
| | | * @param context |
| | |
| | | return 0; |
| | | } |
| | | } |
| | | #endif /* USE_COMMAND_TAGS */ |
| | | |
| | | scpi_bool_t SCPI_Match(const char * pattern, const char * value, size_t len) { |
| | | return matchCommand(pattern, value, len, NULL, 0, 0); |