This is Unofficial EPICS BASE Doxygen Site
epicsStdlib.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 /* epicsStdlib.h */
10 /* Author: Eric Norum */
11 
12 #ifndef INC_epicsStdlib_H
13 #define INC_epicsStdlib_H
14 
15 #include <stdlib.h>
16 #include <limits.h>
17 
18 #include "libComAPI.h"
19 #include "osdStrtod.h"
20 #include "epicsTypes.h"
21 #include "errMdef.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define S_stdlib_noConversion (M_stdlib | 1) /* No digits to convert */
28 #define S_stdlib_extraneous (M_stdlib | 2) /* Extraneous characters */
29 #define S_stdlib_underflow (M_stdlib | 3) /* Too small to represent */
30 #define S_stdlib_overflow (M_stdlib | 4) /* Too large to represent */
31 #define S_stdlib_badBase (M_stdlib | 5) /* Number base not supported */
32 
33 
34 LIBCOM_API int
35  epicsParseLong(const char *str, long *to, int base, char **units);
36 LIBCOM_API int
37  epicsParseULong(const char *str, unsigned long *to, int base, char **units);
38 LIBCOM_API int
39  epicsParseLLong(const char *str, long long *to, int base, char **units);
40 LIBCOM_API int
41  epicsParseULLong(const char *str, unsigned long long *to, int base, char **units);
42 LIBCOM_API int
43  epicsParseDouble(const char *str, double *to, char **units);
44 
45 LIBCOM_API int
46  epicsParseFloat(const char *str, float *to, char **units);
47 
48 LIBCOM_API int
49  epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units);
50 LIBCOM_API int
51  epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units);
52 LIBCOM_API int
53  epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units);
54 LIBCOM_API int
55  epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units);
56 
57 LIBCOM_API int
58  epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units);
59 LIBCOM_API int
60  epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units);
61 
62 LIBCOM_API int
63  epicsParseInt64(const char *str, epicsInt64 *to, int base, char **units);
64 LIBCOM_API int
65  epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units);
66 
67 #define epicsParseFloat32(str, to, units) epicsParseFloat(str, to, units)
68 #define epicsParseFloat64(str, to, units) epicsParseDouble(str, to, units)
69 
70 /* These macros return 1 if successful, 0 on failure.
71  * This is analagous to the return value from sscanf()
72  */
73 #define epicsScanLong(str, to, base) (!epicsParseLong(str, to, base, NULL))
74 #define epicsScanULong(str, to, base) (!epicsParseULong(str, to, base, NULL))
75 #define epicsScanLLong(str, to, base) (!epicsParseLLong(str, to, base, NULL))
76 #define epicsScanULLong(str, to, base) (!epicsParseULLong(str, to, base, NULL))
77 #define epicsScanFloat(str, to) (!epicsParseFloat(str, to, NULL))
78 #define epicsScanDouble(str, to) (!epicsParseDouble(str, to, NULL))
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* INC_epicsStdlib_H */
LIBCOM_API int epicsParseULLong(const char *str, unsigned long long *to, int base, char **units)
Definition: epicsStdlib.c:118
LIBCOM_API int epicsParseInt8(const char *str, epicsInt8 *to, int base, char **units)
Definition: epicsStdlib.c:181
LIBCOM_API int epicsParseInt16(const char *str, epicsInt16 *to, int base, char **units)
Definition: epicsStdlib.c:213
unsigned short epicsUInt16
Definition: epicsTypes.h:41
LIBCOM_API int epicsParseULong(const char *str, unsigned long *to, int base, char **units)
Definition: epicsStdlib.c:56
unsigned char epicsUInt8
Definition: epicsTypes.h:39
#define str(v)
unsigned int epicsUInt32
Definition: epicsTypes.h:43
LIBCOM_API int epicsParseInt64(const char *str, epicsInt64 *to, int base, char **units)
Definition: epicsStdlib.c:281
unsigned long long epicsUInt64
Definition: epicsTypes.h:45
LIBCOM_API int epicsParseFloat(const char *str, float *to, char **units)
Definition: epicsStdlib.c:318
LIBCOM_API int epicsParseUInt16(const char *str, epicsUInt16 *to, int base, char **units)
Definition: epicsStdlib.c:229
LIBCOM_API int epicsParseInt32(const char *str, epicsInt32 *to, int base, char **units)
Definition: epicsStdlib.c:245
LIBCOM_API int epicsParseDouble(const char *str, double *to, char **units)
Definition: epicsStdlib.c:149
char epicsInt8
Definition: epicsTypes.h:38
LIBCOM_API int epicsParseLong(const char *str, long *to, int base, char **units)
Definition: epicsStdlib.c:25
LIBCOM_API int epicsParseUInt64(const char *str, epicsUInt64 *to, int base, char **units)
Definition: epicsStdlib.c:299
int * base
Definition: flex.c:92
short epicsInt16
Definition: epicsTypes.h:40
LIBCOM_API int epicsParseLLong(const char *str, long long *to, int base, char **units)
Definition: epicsStdlib.c:87
int epicsInt32
Definition: epicsTypes.h:42
LIBCOM_API int epicsParseUInt8(const char *str, epicsUInt8 *to, int base, char **units)
Definition: epicsStdlib.c:197
long long epicsInt64
Definition: epicsTypes.h:44
LIBCOM_API int epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units)
Definition: epicsStdlib.c:263