11 #include <epicsVersion.h> 13 #include <epicsMath.h> 18 #define epicsExportSharedSymbols 24 #if (ULONG_MAX == 0xfffffffful) || defined(_WIN32) || defined(__rtems__) || defined(__APPLE__) 31 epicsParseLongLong(
const char *
str,
long long *to,
int base,
char **units)
37 while ((c = *str) && isspace(c))
41 value =
strtoll(str, &endp, base);
50 while ((c = *endp) && isspace(c))
62 epicsParseULongLong(
const char *
str,
unsigned long long *to,
int base,
char **units)
66 unsigned long long value;
68 while ((c = *
str) && isspace(c))
81 while ((c = *endp) && isspace(c))
94 void handleParseError(
int err)
100 case S_stdlib_underflow:
throw std::runtime_error(
"parseToPOD: Too small to represent");
101 case S_stdlib_overflow:
throw std::runtime_error(
"parseToPOD: Too large to represent");
102 case S_stdlib_badBase:
throw std::runtime_error(
"parseToPOD: Number base not supported");
104 throw std::runtime_error(
"parseToPOD: unknown error");
108 namespace epics {
namespace pvData {
namespace detail {
117 throw std::runtime_error(
"parseToPOD: string no match true/false");
120 #define INTFN(T, S) \ 121 void parseToPOD(const char* in, T *out) { \ 123 int err = epicsParse ## S (in, &temp, 0, NULL); \ 124 if(err) handleParseError(err); \ 130 INTFN(int16_t, Int16);
131 INTFN(uint16_t, UInt16);
132 INTFN(int32_t, Int32);
133 INTFN(uint32_t, UInt32);
137 int err = epicsParseLongLong(in, out, 0,
NULL);
141 if(err) handleParseError(err);
146 int err = epicsParseULongLong(in, out, 0,
NULL);
150 if(err) handleParseError(err);
155 if(err) handleParseError(err);
160 if(err) handleParseError(err);
173 }
while (isspace(c));
175 if (c ==
'-' || c ==
'+')
#define S_stdlib_underflow
#define S_stdlib_noConversion
TODO only here because of the Lockable.
LIBCOM_API int epicsParseFloat(const char *str, float *to, char **units)
int epicsStrCaseCmp(const char *s1, const char *s2)
#define S_stdlib_extraneous
LIBCOM_API int epicsParseULong(const char *str, unsigned long *to, int base, char **units)
void parseToPOD(const char *in, boolean *out)
LIBCOM_API int epicsParseDouble(const char *str, double *to, char **units)
LIBCOM_API int epicsParseLong(const char *str, long *to, int base, char **units)
#define S_stdlib_overflow