// // ---------- Master 'map' defining all UserInput types and how to handle them ---------- // in particular, lists their name, and how to parse and print them, and (if required) how to destroy them static const struct { const char *const name; ///< type name int (*parser)(void*, const char*); ///< parser function to parse string as this type char *(*printer)(const void *); ///< 'printer' function returning string value for given type void (*destructor)(void*); ///< destructor for this variable type, NULL if none required } UserVarTypeMap[UVAR_TYPE_END] = { // either use 'manual' entries of the form // [UVAR_TYPE_\<UTYPE\>] = { "\<UTYPE\>", (parserT)XLALParseStringValueAs\<UTYPE\>, (printerT)XLALPrintStringValueOf\<UTYPE\>, (destructorT)XLALDestroy\<UTYPE\> }, // or the convenience macro for cases using 'standard' function names and API // REGULAR_MAP_ENTRY ( \<UTYPE\>, XLALDestroy\<UTYPE\> ), REGULAR_MAP_ENTRY ( BOOLEAN, NULL ), REGULAR_MAP_ENTRY ( INT4, NULL ), REGULAR_MAP_ENTRY ( REAL8, NULL ), REGULAR_MAP_ENTRY ( STRING, XLALFree ), REGULAR_MAP_ENTRY ( STRINGVector, XLALDestroyStringVector ), REGULAR_MAP_ENTRY ( EPOCH, NULL ), REGULAR_MAP_ENTRY ( RAJ, NULL ), REGULAR_MAP_ENTRY ( DECJ, NULL ), REGULAR_MAP_ENTRY ( REAL8Vector, XLALDestroyREAL8Vector ), REGULAR_MAP_ENTRY ( INT4Vector, XLALDestroyINT4Vector ) }; // ---------- The module-local linked list to hold the user-variables static LALUserVariable UVAR_vars; // empty head static const CHAR *program_name; // keep a pointer to the program name
// ---------- Master 'map' defining all UserInput types and how to handle them ---------- // in particular, lists their name, and how to parse and print them, and (if required) how to destroy them static const struct { const char *const name; ///< type name const char *const format_help; ///< help string describing format of user variable int (*parser)(void*, const char*); ///< parser function to parse string as this type char *(*printer)(const void *); ///< 'printer' function returning string value for given type void (*destructor)(void*); ///< destructor for this variable type, NULL if none required } UserVarTypeMap[UVAR_TYPE_END] = { // either use 'manual' entries of the form // [UVAR_TYPE_\<UTYPE\>] = { "\<UTYPE\>", (parserT)XLALParseStringValueAs\<UTYPE\>, (printerT)XLALPrintStringValueOf\<UTYPE\>, (destructorT)XLALDestroy\<UTYPE\> }, // or the convenience macro for cases using 'standard' function names and API // REGULAR_MAP_ENTRY ( \<UTYPE\>, XLALDestroy\<UTYPE\> ), REGULAR_MAP_ENTRY ( BOOLEAN, NULL, "[TRUE|FALSE | YES|NO | 1|0]" ), REGULAR_MAP_ENTRY ( INT4, NULL, "<4-byte integer>" ), REGULAR_MAP_ENTRY ( INT8, NULL, "<8-byte integer>" ), REGULAR_MAP_ENTRY ( REAL8, NULL, "<8-byte real>" ), REGULAR_MAP_ENTRY ( STRING, XLALFree, "<string>" ), REGULAR_MAP_ENTRY ( EPOCH, NULL, "<seconds>[.<nano-seconds>][GPS|MJD]" ), REGULAR_MAP_ENTRY ( RAJ, NULL, "<radians>|<hours>:<minutes>:<seconds>" ), REGULAR_MAP_ENTRY ( DECJ, NULL, "<radians>|<degrees>:<minutes>:<seconds>" ), REGULAR_MAP_ENTRY ( REAL8Range, NULL, "<start>[,<end>|/<band>|~<plus-minus>] where <>=<8-byte real>" ), REGULAR_MAP_ENTRY ( EPOCHRange, NULL, "<start>[,<end>|/<band>|~<plus-minus>] where <>=<seconds>[.<nano-seconds>][GPS|MJD]" ), REGULAR_MAP_ENTRY ( RAJRange, NULL, "<start>[,<end>|/<band>|~<plus-minus>] where <>=<radians>|<hours>:<minutes>:<seconds>" ), REGULAR_MAP_ENTRY ( DECJRange, NULL, "<start>[,<end>|/<band>|~<plus-minus>] where <>=<radians>|<degrees>:<minutes>:<seconds>" ), REGULAR_MAP_ENTRY ( STRINGVector, XLALDestroyStringVector, "<string>,..." ), REGULAR_MAP_ENTRY ( REAL8Vector, XLALDestroyREAL8Vector, "<8-byte real>,..." ),