From c8c00d2032c12f79df352d4eb573c228099b30cf Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周二, 31 5月 2016 18:15:28 +0800 Subject: [PATCH] Add channel list example call --- libscpi/inc/scpi/config.h | 55 +++++++++++++++++++++++++++++-------------------------- 1 files changed, 29 insertions(+), 26 deletions(-) diff --git a/libscpi/inc/scpi/config.h b/libscpi/inc/scpi/config.h index ea19d8e..7473d9d 100644 --- a/libscpi/inc/scpi/config.h +++ b/libscpi/inc/scpi/config.h @@ -90,13 +90,14 @@ #endif #ifndef USE_DEVICE_DEPENDENT_ERROR_INFORMATION -#define USE_DEVICE_DEPENDENT_ERROR_INFORMATION 1 - #ifndef USE_MEMORY_ALLOCATION_FREE - #define USE_MEMORY_ALLOCATION_FREE 1 - #endif +#define USE_DEVICE_DEPENDENT_ERROR_INFORMATION SYSTEM_TYPE #endif - +#if USE_DEVICE_DEPENDENT_ERROR_INFORMATION +#ifndef USE_MEMORY_ALLOCATION_FREE +#define USE_MEMORY_ALLOCATION_FREE 1 +#endif +#endif #ifndef USE_COMMAND_TAGS #define USE_COMMAND_TAGS 1 @@ -199,8 +200,10 @@ /* PIC32mx */ #if defined(__C32__) #define HAVE_STRNLEN 0 -#define HAVE_STRNCASECMP 1 +#define HAVE_STRNCASECMP 0 #define HAVE_STRNICMP 0 +#define isfinite finite +#define signbit(x) ((x)<0) #endif /* AVR libc */ @@ -243,39 +246,39 @@ #endif #if HAVE_DTOSTRE -#define SCPIDEFINE_floatToStr(v, s, l) strlen(dtostre((double)(v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE)) +#define SCPIDEFINE_floatToStr(v, s, l) dtostre((double)(v), (s), 6, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE) #elif USE_CUSTOM_DTOSTRE -#define SCPIDEFINE_floatToStr(v, s, l) strlen(SCPI_dtostre((v), (s), (l), 6, 0)) +#define SCPIDEFINE_floatToStr(v, s, l) SCPI_dtostre((v), (s), (l), 6, 0) #else #define SCPIDEFINE_floatToStr(v, s, l) snprintf((s), (l), "%g", (v)) #endif #if HAVE_DTOSTRE -#define SCPIDEFINE_doubleToStr(v, s, l) strlen(dtostre((v), (s), 15, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE)) +#define SCPIDEFINE_doubleToStr(v, s, l) dtostre((v), (s), 15, DTOSTR_PLUS_SIGN | DTOSTR_ALWAYS_SIGN | DTOSTR_UPPERCASE) #elif USE_CUSTOM_DTOSTRE -#define SCPIDEFINE_doubleToStr(v, s, l) strlen(SCPI_dtostre((v), (s), (l), 15, 0)) +#define SCPIDEFINE_doubleToStr(v, s, l) SCPI_dtostre((v), (s), (l), 15, 0) #else #define SCPIDEFINE_doubleToStr(v, s, l) snprintf((s), (l), "%.15lg", (v)) #endif #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION - #if USE_MEMORY_ALLOCATION_FREE - #include <stdlib.h> - #include <string.h> - #include <malloc.h> - #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 2 - #define SCPIDEFINE_strdup(h, s) strdup((s)) - #define SCPIDEFINE_free(h, s, r) free((s)) - #else - #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 3 - #define SCPIDEFINE_strdup(h, s) OUR_strdup((h), (s)) - #define SCPIDEFINE_free(h, s, r) OUR_free((h), (s), (r)) - #define SCPIDEFINE_get_parts(h, s, l1, s2, l2) OUR_get_parts((h), (s), (l1), (s2), (l2)) - #endif + +#if USE_MEMORY_ALLOCATION_FREE +#include <stdlib.h> +#include <string.h> +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 2 +#define SCPIDEFINE_strndup(h, s, l) strndup((s), (l)) +#define SCPIDEFINE_free(h, s, r) free((s)) #else - #define SCPIDEFINE_DESCRIPTION_MAX_PARTS 1 - #define SCPIDEFINE_strdup(h, s) NULL - #define SCPIDEFINE_free(h, s, r) (void) +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 3 +#define SCPIDEFINE_strndup(h, s, l) scpiheap_strndup((h), (s), (l)) +#define SCPIDEFINE_free(h, s, r) scpiheap_free((h), (s), (r)) +#define SCPIDEFINE_get_parts(h, s, l1, s2, l2) scpiheap_get_parts((h), (s), (l1), (s2), (l2)) +#endif +#else +#define SCPIDEFINE_DESCRIPTION_MAX_PARTS 1 +#define SCPIDEFINE_strndup(h, s, l) NULL +#define SCPIDEFINE_free(h, s, r) #endif #ifdef __cplusplus -- Gitblit v1.9.1