From 6a42b4fe28ba78e6f57416d943c96e61f540c1e4 Mon Sep 17 00:00:00 2001
From: Jan Breuer
Date: Sun, 17 Apr 2016 18:11:03 +0200
Subject: [PATCH] Fix compilation under Microchip C32/XC32 (issue #75)
---
libscpi/inc/scpi/config.h | 4 +++-
libscpi/src/error.c | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libscpi/inc/scpi/config.h b/libscpi/inc/scpi/config.h
index 1824ab23..45a9c3c2 100644
--- a/libscpi/inc/scpi/config.h
+++ b/libscpi/inc/scpi/config.h
@@ -190,8 +190,10 @@ extern "C" {
/* 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 */
diff --git a/libscpi/src/error.c b/libscpi/src/error.c
index 9d8e7569..feec31f1 100644
--- a/libscpi/src/error.c
+++ b/libscpi/src/error.c
@@ -126,7 +126,7 @@ static scpi_bool_t SCPI_ErrorAddInternal(scpi_t * context, int16_t err) {
struct error_reg {
int16_t from;
int16_t to;
- scpi_reg_val_t bit;
+ scpi_reg_val_t esrBit;
};
#define ERROR_DEFS_N 9
@@ -156,7 +156,7 @@ void SCPI_ErrorPush(scpi_t * context, int16_t err) {
for (i = 0; i < ERROR_DEFS_N; i++) {
if ((err <= errs[i].from) && (err >= errs[i].to)) {
- SCPI_RegSetBits(context, SCPI_REG_ESR, errs[i].bit);
+ SCPI_RegSetBits(context, SCPI_REG_ESR, errs[i].esrBit);
}
}