LAL  7.5.0.1-b72065a
UserInputParse.c File Reference

Prototypes

int XLALParseStringValueAsINT8 (INT8 *valINT8, const char *valString)
 Parse a string into an INT8 This ignores initial whitespace, but throws an error on any non-converted trailing characters (including whitespace) More...
 
int XLALParseStringValueAsINT4 (INT4 *valINT4, const char *valString)
 Parse a string into an INT4 This ignores initial whitespace, but throws an error on any non-converted trailing characters (including whitespace) More...
 
int XLALParseStringValueAsUINT8 (UINT8 *valUINT8, const char *valString)
 Parse a string into an UINT8 This ignores initial whitespace, but throws an error on any non-converted trailing characters (including whitespace) More...
 
int XLALParseStringValueAsUINT4 (UINT4 *valUINT4, const char *valString)
 Parse a string into an UINT4 This ignores initial whitespace, but throws an error on any non-converted trailing characters (including whitespace) More...
 
int XLALParseStringValueAsREAL8 (REAL8 *valREAL8, const char *valString)
 Parse a string into a REAL8 This ignores initial whitespace, but throws an error on any non-converted trailing characters (including whitespace) More...
 
int XLALParseStringValueAsREAL4 (REAL4 *valREAL4, const char *valString)
 Parse a string into a REAL4. More...
 
int XLALParseStringValueAsINT4PlusFrac (INT4 *valINT4, REAL8 *valFrac, const char *valString)
 Parse a string containing a floating-point number into integer and fractional part, such that val = valINT + valFrac. More...
 
int XLALParseStringValueAsBOOLEAN (BOOLEAN *valBOOLEAN, const char *valString)
 Parse a string into a BOOLEAN Allowed string-values are (case-insensitive): {"yes", "true", "1"} --> TRUE {"no", "false", "0"} --> FALSE. More...
 
int XLALParseStringValueAsGPS (LIGOTimeGPS *gps, const char *valString)
 Parse a string representing a GPS time into LIGOTimeGPS, without loss of (ns) accuracy. More...
 
int XLALParseStringValueAsEPOCH (LIGOTimeGPS *gps, const char *valString)
 Parse a string representing an 'epoch' into an LIGOTimeGPS, allowing both GPS and MJD(TT) inputs, at ns accuracy. More...
 
int XLALParseStringValueAsRAJ (REAL8 *valRAJ, const char *valString)
 Parse a string representing an 'equatorial longitude' (aka right ascension or RA) into REAL8 radians, allowing for both radians or "hours:minutes:seconds" as input. More...
 
int XLALParseStringValueAsDECJ (REAL8 *valDECJ, const char *valString)
 Parse a string representing an 'equatorial latitude' (aka declination or DEC) into REAL8 radians, allowing for both radians or "degrees:minutes:seconds" as input. More...
 
static int SplitStringIntoRange (const char *str, char part[2][256], int T[2][2])
 
int XLALParseStringValueAsREAL8Range (REAL8Range real8Range, const char *valString)
 Parse a string representing a range of REAL8 values into a REAL8Range. More...
 
int XLALParseStringValueAsINT4Range (INT4Range int4Range, const char *valString)
 Parse a string representing a range of INT4 values into a INT4Range. More...
 
int XLALParseStringValueAsEPOCHRange (LIGOTimeGPSRange gpsRange, const char *valString)
 Parse a string representing a range of LIGOTimeGPS values into a LIGOTimeGPSRange. More...
 
int XLALParseStringValueAsRAJRange (REAL8Range rajRange, const char *valString)
 Parse a string representing a range of RAJ values into a REAL8Range. More...
 
int XLALParseStringValueAsDECJRange (REAL8Range decjRange, const char *valString)
 Parse a string representing a range of DECJ values into a REAL8Range. More...
 
int XLALParseStringValueAsUserEnum (int *valEnum, const UserChoices *enumData, const char *valString)
 Parse a string representing a user selection of an enumeration value. More...
 
int XLALParseStringValueAsUserFlag (int *valFlag, const UserChoices *flagData, const char *valString)
 Parse a string representing a user selection of a set of bitflags. More...
 
int XLALParseStringValueAsSTRING (CHAR **out, const CHAR *valStr)
 Duplicate string 'in', removing surrounding quotes " or \' if present. More...
 
int XLALParseStringValueAsSTRINGVector (LALStringVector **strVect, const CHAR *valString)
 Parse a string containing a list of comma-separated values (CSV) into a StringVector. More...
 
 DEFN_XLALParseStringValueAsVector (INT4)
 
 DEFN_XLALParseStringValueAsVector (UINT4)
 
 DEFN_XLALParseStringValueAsVector (REAL8)
 

Go to the source code of this file.

Macros

#define LAL_sINT4_MAX   LAL_INT8_C(2147483647)
 
#define LAL_sINT8_MAX   LAL_INT8_C(9223372036854775807)
 
#define MYMAX(x, y)   ( (x) > (y) ? (x) : (y) )
 
#define MYMIN(x, y)   ( (x) < (y) ? (x) : (y) )
 
#define DEFN_XLALParseStringValueAsVector(CTYPE)
 Parse a string containing a list of comma-separated values (CSV) into a <CTYPE>Vector. More...
 

Macro Definition Documentation

◆ LAL_sINT4_MAX

#define LAL_sINT4_MAX   LAL_INT8_C(2147483647)

Definition at line 39 of file UserInputParse.c.

◆ LAL_sINT8_MAX

#define LAL_sINT8_MAX   LAL_INT8_C(9223372036854775807)

Definition at line 40 of file UserInputParse.c.

◆ MYMAX

#define MYMAX (   x,
 
)    ( (x) > (y) ? (x) : (y) )

Definition at line 42 of file UserInputParse.c.

◆ MYMIN

#define MYMIN (   x,
 
)    ( (x) < (y) ? (x) : (y) )

Definition at line 43 of file UserInputParse.c.

◆ DEFN_XLALParseStringValueAsVector

#define DEFN_XLALParseStringValueAsVector (   CTYPE)
Value:
{ \
XLAL_CHECK ( (valString != NULL) && (strlen(valString) > 0), XLAL_EINVAL ); \
XLAL_CHECK ( (vect != NULL) && (*vect == NULL) , XLAL_EINVAL ); \
\
/* parse this as a string vector first */ \
LALStringVector *strVect = NULL; \
XLAL_CHECK ( XLALParseStringValueAsSTRINGVector ( &strVect, valString ) == XLAL_SUCCESS, XLAL_EFUNC ); \
UINT4 numElements = strVect->length; \
\
/* create corresponding output vector */ \
CTYPE##Vector *ret; \
XLAL_CHECK ( (ret = XLALCreate##CTYPE##Vector ( numElements )) != NULL, XLAL_EFUNC ); \
\
/* parse each string value into a REAL8 */ \
for ( UINT4 i = 0; i < numElements; i ++ ) \
{ \
XLAL_CHECK ( XLALParseStringValueAs##CTYPE ( &(ret->data[i]), strVect->data[i] ) == XLAL_SUCCESS, XLAL_EFUNC ); \
} \
(*vect) = ret; \
return XLAL_SUCCESS; \
\
} /* XLALParseStringValueAs<CTYPE>Vector() */
uint32_t UINT4
Four-byte unsigned integer.
void XLALDestroyStringVector(LALStringVector *vect)
XLAL-interface: Free a string-vector ;)
Definition: StringVector.c:204
#define DECL_XLALParseStringValueAsVector(CTYPE)
int XLALParseStringValueAsSTRINGVector(LALStringVector **strVect, const CHAR *valString)
Parse a string containing a list of comma-separated values (CSV) into a StringVector.
@ XLAL_SUCCESS
Success return value (not an error number)
Definition: XLALError.h:401
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
Definition: XLALError.h:462
@ XLAL_EINVAL
Invalid argument.
Definition: XLALError.h:409

Parse a string containing a list of comma-separated values (CSV) into a <CTYPE>Vector.

Note
The output string-vector (*vect) must be NULL

Definition at line 873 of file UserInputParse.c.

Function Documentation

◆ SplitStringIntoRange()

static int SplitStringIntoRange ( const char *  str,
char  part[2][256],
int  T[2][2] 
)
static

Definition at line 417 of file UserInputParse.c.

◆ DEFN_XLALParseStringValueAsVector() [1/3]

DEFN_XLALParseStringValueAsVector ( INT4  )

◆ DEFN_XLALParseStringValueAsVector() [2/3]

DEFN_XLALParseStringValueAsVector ( UINT4  )

◆ DEFN_XLALParseStringValueAsVector() [3/3]

DEFN_XLALParseStringValueAsVector ( REAL8  )