Jan Breuer
2015-10-16 fbe83efc8183980109846bd884da28104ca1faa1
Add USE_COMMAND_TAGS and USE_DEPRECATED_FUNCTIONS defines
6个文件已修改
20 ■■■■■ 已修改文件
examples/test-tcp-srq/main.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/config.h 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/parser.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/types.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/expression.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/parser.c 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp-srq/main.c
@@ -112,7 +112,7 @@
}
scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) {
    SCPI_ResultInt(context, CONTROL_PORT);
    SCPI_ResultInt32(context, CONTROL_PORT);
    return SCPI_RES_OK;
}
libscpi/inc/scpi/config.h
@@ -89,6 +89,14 @@
#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)
libscpi/inc/scpi/parser.h
@@ -87,10 +87,13 @@
    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))
@@ -98,6 +101,7 @@
#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
}
libscpi/inc/scpi/types.h
@@ -276,7 +276,9 @@
    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 {
libscpi/src/expression.c
@@ -193,7 +193,7 @@
    size_t i = 0;
    while (scpiLex_DecimalNumericProgramData(state, &param)) {
        if (i < length) {
            SCPI_ParamToInt(context, &param, &values[i]);
            SCPI_ParamToInt32(context, &param, &values[i]);
        }
        if (scpiLex_SpecificCharacter(state, &param, '!')) {
libscpi/src/parser.c
@@ -1350,6 +1350,7 @@
    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
@@ -1362,6 +1363,7 @@
        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);