Go to the source code of this file.
Functions |
NPY_NO_EXPORT char * | NumPyOS_ascii_formatd (char *buffer, size_t buf_size, const char *format, double val, int decimal) |
NPY_NO_EXPORT char * | NumPyOS_ascii_formatf (char *buffer, size_t buf_size, const char *format, float val, int decimal) |
NPY_NO_EXPORT char * | NumPyOS_ascii_formatl (char *buffer, size_t buf_size, const char *format, long double val, int decimal) |
NPY_NO_EXPORT double | NumPyOS_ascii_strtod (const char *s, char **endptr) |
NPY_NO_EXPORT int | NumPyOS_ascii_ftolf (FILE *fp, double *value) |
NPY_NO_EXPORT int | NumPyOS_ascii_isspace (char c) |
Function Documentation
NPY_NO_EXPORT char* NumPyOS_ascii_formatd |
( |
char * |
buffer, |
|
|
size_t |
buf_size, |
|
|
const char * |
format, |
|
|
double |
val, |
|
|
int |
decimal |
|
) |
| |
NPY_NO_EXPORT char* NumPyOS_ascii_formatf |
( |
char * |
buffer, |
|
|
size_t |
buf_size, |
|
|
const char * |
format, |
|
|
float |
val, |
|
|
int |
decimal |
|
) |
| |
NPY_NO_EXPORT char* NumPyOS_ascii_formatl |
( |
char * |
buffer, |
|
|
size_t |
buf_size, |
|
|
const char * |
format, |
|
|
long double |
val, |
|
|
int |
decimal |
|
) |
| |
NPY_NO_EXPORT int NumPyOS_ascii_ftolf |
( |
FILE * |
fp, |
|
|
double * |
value |
|
) |
| |
- NumPyOS_ascii_ftolf:
-
fp: FILE pointer
-
value: Place to store the value read
Similar to PyOS_ascii_strtod, except that it reads input from a file.
Similarly to fscanf, this function always consumes leading whitespace, and any text that could be the leading part in valid input.
- Return value: similar to fscanf.
-
0 if no number read,
-
1 if a number read,
-
EOF if end-of-file met before reading anything.
Pass on to PyOS_ascii_strtod the leftmost matching part in regexp <blockquote>
- s*[+-]? ( [0-9]*.[0-9]+([eE][+-]?[0-9]+)
nan ( ([:alphanum:_]*) )?
inf(inity)?
System Message: WARNING/2 (<string>
, line 6) Line block ends without a blank line.
)
</blockquote>
case-insensitively.
The "do { ... } while (0)" wrapping in macros ensures that they behave properly eg. in "if ... else" structures.
-
emulate fscanf EOF handling
-
consume leading whitespace unconditionally
-
start reading matching input to buffer
4.1 sign (optional)
4.2 nan, inf, infinity; [case-insensitive]
accept nan([:alphanum:_]*), similarly to strtod
4.3 mantissa
4.4 exponent
return 1 if something read, else 0
NPY_NO_EXPORT int NumPyOS_ascii_isspace |
( |
char |
c | ) |
|
NPY_NO_EXPORT double NumPyOS_ascii_strtod |
( |
const char * |
s, |
|
|
char ** |
endptr |
|
) |
| |
NumPyOS_ascii_strtod:
Work around bugs in PyOS_ascii_strtod
##1
Recognize POSIX inf/nan representations on all platforms.
End of ##1
## 2
At least Python versions <= 2.5.2 and <= 2.6.1
Fails to do best-efforts parsing of strings of the form "1<DP>234" where <DP> is the decimal point under the foreign locale.
End of ##2
References NPY_INFINITY, and NumPyOS_ascii_strncasecmp().