From 8746b911b06fe0fc3060c9c12493c13edfcdbd7e Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 摹曛, 08 10月 2015 04:08:06 +0800
Subject: [PATCH] Add SCPI_Param tests for Int32, UInt32, Int64 and UInt64

---
 libscpi/src/utils.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/libscpi/src/utils.c b/libscpi/src/utils.c
index 456e8f3..1d309ec 100644
--- a/libscpi/src/utils.c
+++ b/libscpi/src/utils.c
@@ -179,7 +179,7 @@
     } else {
 
         switch (base) {
-            case 2: 
+            case 2:
                 x = 0x8000000000000000ULL;
                 break;
             case 8:
@@ -245,7 +245,18 @@
 }
 
 /**
- * Converts double value to string
+ * Converts float (32 bit) value to string
+ * @param val   long value
+ * @param str   converted textual representation
+ * @param len   string buffer length
+ * @return number of bytes written to str (without '\0')
+ */
+size_t SCPI_FloatToStr(float val, char * str, size_t len) {
+    return SCPIDEFINE_floatToStr(val, str, len);
+}
+
+/**
+ * Converts double (64 bit) value to string
  * @param val   double value
  * @param str   converted textual representation
  * @param len   string buffer length
@@ -303,9 +314,20 @@
     return endptr - str;
 }
 
+/**
+ * Converts string to float (32 bit) representation
+ * @param str   string value
+ * @param val   float result
+ * @return      number of bytes used in string
+ */
+size_t strToFloat(const char * str, float * val) {
+    char * endptr;
+    *val = strtof(str, &endptr);
+    return endptr - str;
+}
 
 /**
- * Converts string to double representation
+ * Converts string to double (64 bit) representation
  * @param str   string value
  * @param val   double result
  * @return      number of bytes used in string

--
Gitblit v1.9.1