From ed07df16da675c4c123e02a996822daf13d69c63 Mon Sep 17 00:00:00 2001
From: lhoerl <coder@lolux.de>
Date: 周一, 03 8月 2015 22:42:07 +0800
Subject: [PATCH] added full SCPI error messages added list for device dependent error messages some minor changes to get rid of compiler warnings added support for Keil ARM compiler added support for National Instruments CVI compiler removed bug if(c = '\0')...

---
 libscpi/src/parser.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c
index 375f4ac..21ac60a 100644
--- a/libscpi/src/parser.c
+++ b/libscpi/src/parser.c
@@ -44,6 +44,7 @@
 #include "scpi/error.h"
 #include "scpi/constants.h"
 #include "scpi/utils.h"
+#include "scpi/scpi_debug.h"
 
 /**
  * Write data to SCPI output
@@ -90,7 +91,15 @@
 static size_t writeNewLine(scpi_t * context) {
     if (context->output_count > 0) {
         size_t len;
+#if   (USED_ENDCODE == ENDCODE_CR)
+         len = writeData(context, "\r", 1);
+#elif (USED_ENDCODE == ENDCODE_LF)
+         len = writeData(context, "\n", 1);
+#elif (USED_ENDCODE == ENDCODE_CRLF)
         len = writeData(context, "\r\n", 2);
+#else
+#error no termination character defined
+#endif
         flushData(context);
         return len;
     } else {
@@ -528,7 +537,7 @@
  * @param context
  * @param parameter
  * @param value result
- * @return true if succesful
+ * @return TRUE if succesful
  */
 scpi_bool_t SCPI_ParamToInt(scpi_t * context, scpi_parameter_t * parameter, int32_t * value) {
 
@@ -556,7 +565,7 @@
  * @param context
  * @param parameter
  * @param value result
- * @return true if succesful
+ * @return TRUE if succesful
  */
 scpi_bool_t SCPI_ParamToDouble(scpi_t * context, scpi_parameter_t * parameter, double * value) {
     scpi_bool_t result = FALSE;
@@ -783,7 +792,7 @@
  * @param options specifications of choices numbers (patterns)
  * @param tag numerical representatio of choice
  * @param text result text
- * @return true if succesfule, else false
+ * @return TRUE if succesfule, else false
  */
 scpi_bool_t SCPI_ChoiceToName(const scpi_choice_def_t * options, int32_t tag, const char ** text) {
     int i;
@@ -1012,11 +1021,13 @@
  * @return 
  */
 scpi_bool_t SCPI_IsCmd(scpi_t * context, const char * cmd) {
+    const char * pattern;
+
     if (!context->param_list.cmd) {
         return FALSE;
     }
 
-    const char * pattern = context->param_list.cmd->pattern;
+    pattern = context->param_list.cmd->pattern;
     return matchCommand (pattern, cmd, strlen (cmd), NULL, 0);
 }
 

--
Gitblit v1.9.1