From 9b43058766282733ab8c2c290f4736e2d8bd5014 Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周日, 24 4月 2016 22:12:06 +0800 Subject: [PATCH] Add tests for Device dependent error information --- libscpi/inc/scpi/config.h | 35 ++++++++++++++++++++++------------- 1 files changed, 22 insertions(+), 13 deletions(-) diff --git a/libscpi/inc/scpi/config.h b/libscpi/inc/scpi/config.h index c2c95d4..0abb9c2 100644 --- a/libscpi/inc/scpi/config.h +++ b/libscpi/inc/scpi/config.h @@ -90,11 +90,13 @@ #endif #ifndef USE_DEVICE_DEPENDENT_ERROR_INFORMATION -#define USE_DEVICE_DEPENDENT_ERROR_INFORMATION 1 +#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 @@ -198,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 */ @@ -258,18 +262,23 @@ #endif #if USE_DEVICE_DEPENDENT_ERROR_INFORMATION - #if USE_MEMORY_ALLOCATION_FREE - #include <string.h> - #include <malloc.h> - #define SCPIDEFINE_strdup(s) strdup((s)) - #define SCPIDEFINE_free(s) free((s)) - #else - #define SCPIDEFINE_strdup(s) NULL - #define SCPIDEFINE_free(s) NULL - #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_strdup(s) NULL - #define SCPIDEFINE_free(s) NULL +#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