SDDSlib
|
Provides functions for scanning and parsing free-format data. More...
#include "mdb.h"
#include <ctype.h>
Go to the source code of this file.
Macros | |
#define | float_start(m_c) |
#define | int_start(m_c) |
#define | skip_it(m_c) |
#define | nskip_it(m_c) |
Functions | |
int | get_double (double *dptr, char *s) |
Parses a double value from the given string. | |
int | get_longdouble (long double *dptr, char *s) |
Parses a long double value from the given string. | |
int | get_double1 (double *dptr, char *s) |
Parses a double value from the given string without modifying the string. | |
int | get_double1_old (double *dptr, char *s) |
int | get_float (float *fptr, char *s) |
Parses a float value from the given string. | |
int | get_long (long *iptr, char *s) |
Parses a long integer value from the given string. | |
int | get_long1 (long *lptr, char *s) |
Parses a long integer value from the given string without modifying the string. | |
int | get_long1_old (long *iptr, char *s) |
int | get_short (short *iptr, char *s) |
Parses a short integer value from the given string. | |
int | get_int (int *iptr, char *s) |
Parses an integer value from the given string. | |
char * | get_token (char *s) |
Extracts the next token from the input string. | |
char * | get_token_buf (char *s, char *buf, long lbuf) |
Extracts the next token from the input string into a provided buffer. | |
long | tokenIsInteger (char *token) |
Checks if the given token represents a valid integer. | |
long | tokenIsNumber (char *token) |
Checks if the given token represents a valid number. | |
Provides functions for scanning and parsing free-format data.
This file contains functions such as get_double(), get_float(), get_long(), get_token(), and get_token_buf() to facilitate easy scanning and parsing of numerical and token-based data from strings.
Definition in file data_scan.c.
#define float_start | ( | m_c | ) |
Definition at line 23 of file data_scan.c.
#define int_start | ( | m_c | ) |
Definition at line 24 of file data_scan.c.
#define nskip_it | ( | m_c | ) |
Definition at line 27 of file data_scan.c.
#define skip_it | ( | m_c | ) |
Definition at line 26 of file data_scan.c.
int get_double | ( | double * | dptr, |
char * | s ) |
Parses a double value from the given string.
This function scans the input string for a valid double-precision floating-point number, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | dptr | Pointer to store the parsed double value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 40 of file data_scan.c.
int get_double1 | ( | double * | dptr, |
char * | s ) |
Parses a double value from the given string without modifying the string.
This function scans the input string for a valid double-precision floating-point number, stores the result in the provided pointer, and ensures that the string remains unchanged after parsing.
[out] | dptr | Pointer to store the parsed double value. |
[in] | s | Input string to scan. It remains unchanged after parsing. |
Definition at line 133 of file data_scan.c.
int get_double1_old | ( | double * | dptr, |
char * | s ) |
Definition at line 163 of file data_scan.c.
int get_float | ( | float * | fptr, |
char * | s ) |
Parses a float value from the given string.
This function scans the input string for a valid single-precision floating-point number, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | fptr | Pointer to store the parsed float value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 208 of file data_scan.c.
int get_int | ( | int * | iptr, |
char * | s ) |
Parses an integer value from the given string.
This function scans the input string for a valid integer, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | iptr | Pointer to store the parsed integer value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 380 of file data_scan.c.
int get_long | ( | long * | iptr, |
char * | s ) |
Parses a long integer value from the given string.
This function scans the input string for a valid long integer, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | iptr | Pointer to store the parsed long integer value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 255 of file data_scan.c.
int get_long1 | ( | long * | lptr, |
char * | s ) |
Parses a long integer value from the given string without modifying the string.
This function scans the input string for a valid long integer, stores the result in the provided pointer, and ensures that the string remains unchanged after parsing.
[out] | lptr | Pointer to store the parsed long integer value. |
[in] | s | Input string to scan. It remains unchanged after parsing. |
Definition at line 288 of file data_scan.c.
int get_long1_old | ( | long * | iptr, |
char * | s ) |
Definition at line 318 of file data_scan.c.
int get_longdouble | ( | long double * | dptr, |
char * | s ) |
Parses a long double value from the given string.
This function scans the input string for a valid long double floating-point number, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | dptr | Pointer to store the parsed long double value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 88 of file data_scan.c.
int get_short | ( | short * | iptr, |
char * | s ) |
Parses a short integer value from the given string.
This function scans the input string for a valid short integer, stores the result in the provided pointer, and updates the string pointer to the position following the parsed number.
[out] | iptr | Pointer to store the parsed short integer value. |
[in,out] | s | Input string to scan. It will be modified to point after the parsed number. |
Definition at line 347 of file data_scan.c.
char * get_token | ( | char * | s | ) |
Extracts the next token from the input string.
This function scans the input string for the next token, which can be a quoted string or a sequence of non-separator characters. It allocates memory for the token, copies it to the allocated space, and updates the input string pointer to the position following the token.
[in,out] | s | Input string to scan. It will be modified to point after the extracted token. |
Definition at line 413 of file data_scan.c.
char * get_token_buf | ( | char * | s, |
char * | buf, | ||
long | lbuf ) |
Extracts the next token from the input string into a provided buffer.
This function scans the input string for the next token, which can be a quoted string or a sequence of non-separator characters. It copies the token into the provided buffer if it fits, and updates the input string pointer to the position following the token.
[in,out] | s | Input string to scan. It will be modified to point after the extracted token. |
[out] | buf | Buffer to store the extracted token. |
[in] | lbuf | Length of the buffer to prevent overflow. |
Definition at line 463 of file data_scan.c.
long tokenIsInteger | ( | char * | token | ) |
Checks if the given token represents a valid integer.
This function verifies whether the input token string is a valid integer, which may include an optional leading '+' or '-' sign followed by digits.
[in] | token | The token string to check. |
Definition at line 509 of file data_scan.c.
long tokenIsNumber | ( | char * | token | ) |
Checks if the given token represents a valid number.
This function verifies whether the input token string is a valid numerical value, which may include integers, floating-point numbers, and numbers in exponential notation.
[in] | token | The token string to check. |
Definition at line 530 of file data_scan.c.