From 9fa36c9eb1bb294c58b4e4dd7592893f829ce282 Mon Sep 17 00:00:00 2001
From: Justin Fichtner <Justin.Fichtner@lakeshore.com>
Date: 周一, 14 8月 2017 23:36:13 +0800
Subject: [PATCH] Add support for STATus:OPERation:CONDition register and general handling of condition registers

---
 libscpi/src/parser.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c
index 1f16ecf..e2f0c2f 100644
--- a/libscpi/src/parser.c
+++ b/libscpi/src/parser.c
@@ -1270,6 +1270,15 @@
     return FALSE;
 }
 
+/*
+ * Definition of BOOL choice list
+ */
+const scpi_choice_def_t scpi_bool_def[] = {
+    {"OFF", 0},
+    {"ON", 1},
+    SCPI_CHOICE_LIST_END /* termination of option list */
+};
+
 /**
  * Read BOOL parameter (0,1,ON,OFF)
  * @param context
@@ -1281,12 +1290,6 @@
     scpi_bool_t result;
     scpi_parameter_t param;
     int32_t intval;
-
-    scpi_choice_def_t bool_options[] = {
-        {"OFF", 0},
-        {"ON", 1},
-        SCPI_CHOICE_LIST_END /* termination of option list */
-    };
 
     if (!value) {
         SCPI_ErrorPush(context, SCPI_ERROR_SYSTEM_ERROR);
@@ -1300,7 +1303,7 @@
             SCPI_ParamToInt32(context, &param, &intval);
             *value = intval ? TRUE : FALSE;
         } else {
-            result = SCPI_ParamToChoice(context, &param, bool_options, &intval);
+            result = SCPI_ParamToChoice(context, &param, scpi_bool_def, &intval);
             if (result) {
                 *value = intval ? TRUE : FALSE;
             }

--
Gitblit v1.9.1