From 2e78fdc66afab833fdbba16dd12f0e69df54700c Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@mobatime.cz>
Date: 周三, 05 9月 2018 23:35:28 +0800
Subject: [PATCH] Fix #103 semicolon with empty command causes problems

---
 libscpi/inc/scpi/cc.h |   75 +++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/libscpi/inc/scpi/cc.h b/libscpi/inc/scpi/cc.h
index 0ad081e..d0d0a1e 100644
--- a/libscpi/inc/scpi/cc.h
+++ b/libscpi/inc/scpi/cc.h
@@ -1,28 +1,29 @@
 /*-
- * Copyright (c) 2012-2013 Jan Breuer,
+ * BSD 2-Clause License
  *
- * All Rights Reserved
+ * Copyright (c) 2012-2018, 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:
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 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.
+ * modification, are permitted provided that the following conditions are met:
  *
- * 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
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ *
+ * * 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 /**
@@ -59,11 +60,11 @@
 #endif
 
 #if _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
-#define HAVE_SNPRINTF 1
+    #define HAVE_SNPRINTF 1
 #endif
 
 #if _POSIX_C_SOURCE >= 200112L
-#define HAVE_STRNCASECMP 1
+    #define HAVE_STRNCASECMP 1
 #endif
 
 #if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || C99
@@ -83,6 +84,10 @@
     #define HAVE_STRTOF 1
 #endif
 
+#if _ISOC99_SOURCE || C99
+    #define HAVE_STDBOOL 1
+#endif
+
 /* Compiler specific */
 /* RealView/Keil ARM Compiler, e.g. Cortex-M CPUs */
 #if defined(__CC_ARM)
@@ -92,7 +97,6 @@
 /* National Instruments (R) CVI x86/x64 PC platform */
 #if defined(_CVI_)
 #define HAVE_STRNICMP           1
-#define HAVE_STDBOOL            0
 #endif
 
 /* 8bit PIC - PIC16, etc */
@@ -113,8 +117,11 @@
 #if defined(__AVR__)
 #include <stdlib.h>
 #define HAVE_DTOSTRE            1
+#undef HAVE_STRTOF
+#define HAVE_STRTOF				0
 #endif
 
+/* default values */
 #ifndef HAVE_STRNLEN
 #define HAVE_STRNLEN            0
 #endif
@@ -128,39 +135,43 @@
 #endif
 
 #ifndef HAVE_STDBOOL
-#define HAVE_STDBOOL            1
+#define HAVE_STDBOOL            0
 #endif
 
 #ifndef HAVE_SNPRINTF
-#define HAVE_SNPRINTF 0
+#define HAVE_SNPRINTF           0
 #endif
 
 #ifndef HAVE_STRNCASECMP
-#define HAVE_STRNCASECMP 0
+#define HAVE_STRNCASECMP        0
 #endif
 
 #ifndef HAVE_ISNAN
-#define HAVE_ISNAN 0
+#define HAVE_ISNAN              0
 #endif
 
 #ifndef HAVE_ISFINITE
-#define HAVE_ISFINITE 0
+#define HAVE_ISFINITE           0
+#endif
+
+#ifndef HAVE_FINITE
+#define HAVE_FINITE             0
 #endif
 
 #ifndef HAVE_SIGNBIT
-#define HAVE_SIGNBIT 0
+#define HAVE_SIGNBIT            0
 #endif
 
 #ifndef HAVE_STRTOLL
-#define HAVE_STRTOLL 0
+#define HAVE_STRTOLL            0
 #endif
 
 #ifndef HAVE_STRTOF
-#define HAVE_STRTOF 0
+#define HAVE_STRTOF             0
 #endif
 
 #ifdef	__cplusplus
 }
 #endif
 
-#endif /* __SCPI_CC_H_ */
\ No newline at end of file
+#endif /* __SCPI_CC_H_ */

--
Gitblit v1.9.1