From 315bd87f8e5e889d08dc869104298b2d5c294d5b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 5 Jan 2016 13:11:38 -0500 Subject: [PATCH] drop copy of epicsParse* --- src/utils/configuration.cpp | 124 ------------------------------------ 1 file changed, 124 deletions(-) diff --git a/src/utils/configuration.cpp b/src/utils/configuration.cpp index d5fa1ac..713af0b 100644 --- a/src/utils/configuration.cpp +++ b/src/utils/configuration.cpp @@ -4,20 +4,12 @@ * in file LICENSE that is included with this distribution. */ -#include -#include -#include -#include -#include -#include - #include #include #include #include -#include #include #define epicsExportSharedSymbols @@ -34,122 +26,6 @@ namespace pvAccess { using namespace epics::pvData; using namespace std; -#ifndef EPICS_VERSION_INT -#define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P)) -#define EPICS_VERSION_INT VERSION_INT(EPICS_VERSION, EPICS_REVISION, EPICS_MODIFICATION, EPICS_PATCH_LEVEL) -#endif - -#if EPICS_VERSION_INT < VERSION_INT(3,15,0,1) -/* integer conversion primitives added to epicsStdlib.c in 3.15.0.1 */ - -#define S_stdlib_noConversion 1 /* No digits to convert */ -#define S_stdlib_extraneous 2 /* Extraneous characters */ -#define S_stdlib_underflow 3 /* Too small to represent */ -#define S_stdlib_overflow 4 /* Too large to represent */ -#define S_stdlib_badBase 5 /* Number base not supported */ - -static int -epicsParseDouble(const char *str, double *to, char **units) -{ - int c; - char *endp; - double value; - - while ((c = *str) && isspace(c)) - ++str; - - errno = 0; - value = epicsStrtod(str, &endp); - - if (endp == str) - return S_stdlib_noConversion; - if (errno == ERANGE) - return (value == 0) ? S_stdlib_underflow : S_stdlib_overflow; - - while ((c = *endp) && isspace(c)) - ++endp; - if (c && !units) - return S_stdlib_extraneous; - - *to = value; - if (units) - *units = endp; - return 0; -} - -static int -epicsParseFloat(const char *str, float *to, char **units) -{ - double value, abs; - int status = epicsParseDouble(str, &value, units); - - if (status) - return status; - - abs = fabs(value); - if (value > 0 && abs <= FLT_MIN) - return S_stdlib_underflow; - // NOTE: 'finite' is deprecated in OS X 10.9, use 'isfinite' instead - if (isfinite(value) && abs >= FLT_MAX) - return S_stdlib_overflow; - - *to = (float)value; - return 0; -} - -static int -epicsParseLong(const char *str, long *to, int base, char **units) -{ - int c; - char *endp; - long value; - - while ((c = *str) && isspace(c)) - ++str; - - errno = 0; - value = strtol(str, &endp, base); - - if (endp == str) - return S_stdlib_noConversion; - if (errno == EINVAL) /* Not universally supported */ - return S_stdlib_badBase; - if (errno == ERANGE) - return S_stdlib_overflow; - - while ((c = *endp) && isspace(c)) - ++endp; - if (c && !units) - return S_stdlib_extraneous; - - *to = value; - if (units) - *units = endp; - return 0; -} - -static int -epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units) -{ - long value; - int status = epicsParseLong(str, &value, base, units); - - if (status) - return status; - -#if (LONG_MAX > 0x7fffffff) - if (value < -0x80000000L || value > 0x7fffffffL) - return S_stdlib_overflow; -#endif - - *to = (epicsInt32)value; - return 0; -} - -#endif - - - Properties::Properties() {} Properties::Properties(const string &fileName) : _fileName(fileName) {}