Commit 830bfc68 authored by Karl Wette's avatar Karl Wette Committed by Reinhard Prix

UserInput: integrated support for -v|--version output

- Handle as a special case rather than as a separate user-defined option
- XLALUserVarReadAllInput() now takes an LALVCSInfoList argument
- -v|--version prints non-verbose output using XLALVCSInfoString()
- --version=verbose prints verbose output using XLALVCSInfoString()
- Update calls to XLALUserVarReadAllInput(), remove BOOLEAN version
  user-defined options, and remove calls to XLALGetVersionString()
  where output is not otherwise needed
- Refs #5437
Original: 69bcf58ac86229253ff808333da9f61930c60c0a
parent f2b92575
......@@ -286,6 +286,10 @@ XLALRegisterUserVar ( void *cvar, /**< pointer to the actual C-variable to link
XLAL_CHECK ( strcmp ( name, "help" ) != 0, XLAL_EINVAL, "Long-option name '--%s' is reserved for help!\n", name );
XLAL_CHECK ( optchar != 'h', XLAL_EINVAL, "Short-option '-%c' is reserved for help!\n", optchar );
// check that neither short- nor long-option are used by version
XLAL_CHECK ( strcmp ( name, "version" ) != 0, XLAL_EINVAL, "Long-option name '--%s' is reserved for version!\n", name );
XLAL_CHECK ( optchar != 'v', XLAL_EINVAL, "Short-option '-%c' is reserved for version!\n", optchar );
// find end of uvar-list && check that neither short- nor long-option are taken already
LALUserVariable *ptr = &UVAR_vars;
while ( ptr->next != NULL )
......@@ -373,7 +377,7 @@ XLALDestroyUserVars ( void )
* caller should exit immediately.
*/
int
XLALUserVarReadCmdline ( BOOLEAN *should_exit, int argc, char *argv[] )
XLALUserVarReadCmdline ( BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list )
{
XLAL_CHECK ( should_exit != NULL, XLAL_EFAULT );
XLAL_CHECK ( argv != NULL, XLAL_EINVAL, "Input error, NULL argv[] pointer passed.\n" );
......@@ -387,8 +391,15 @@ XLALUserVarReadCmdline ( BOOLEAN *should_exit, int argc, char *argv[] )
// ---------- build optstring of short-options
UINT4 numvars = 0;
char optstring[512] = "\0"; // string of short-options
ptr = &UVAR_vars; // set to empty head
pos = 0;
// add special version option
optstring[pos++] = 'v';
optstring[pos++] = ':';
optstring[pos++] = ':';
// add user-specified options
ptr = &UVAR_vars; // set to empty head
while ( (ptr = ptr->next) != NULL )
{
numvars ++; /* counter number of user-variables */
......@@ -401,12 +412,23 @@ XLALUserVarReadCmdline ( BOOLEAN *should_exit, int argc, char *argv[] )
optstring[pos++] = ':';
}
} // while ptr->next
// null-terminate array
optstring[pos] = '\0';
// ---------- fill option-struct for long-options
struct LALoption *long_options = LALCalloc (1, (numvars+1) * sizeof(struct LALoption));
ptr = &UVAR_vars; // start again from beginning: empty head
struct LALoption *long_options = LALCalloc (1, (numvars+2) * sizeof(struct LALoption));
pos = 0;
// add special version option
long_options[pos].name = "version";
long_options[pos].has_arg = optional_argument;
long_options[pos].flag = NULL;
long_options[pos].val = 0;
pos ++;
// add user-specified options
ptr = &UVAR_vars; // start again from beginning: empty head
while ( (ptr= ptr->next) != NULL)
{
long_options[pos].name = ptr->name;
......@@ -451,6 +473,31 @@ XLALUserVarReadCmdline ( BOOLEAN *should_exit, int argc, char *argv[] )
return XLAL_SUCCESS;
}
// handle special version option
if ( (c != 0) ? (c == 'v') : !strcmp(long_options[longindex].name, "version") )
{
int verbose = 0;
if ( LALoptarg != NULL )
{
if ( !strcmp(LALoptarg, "verbose") )
{
verbose = 1;
}
else
{
XLALPrintError( "\n%s: invalid value '%s' given to option " UVAR_FMT "\n\n", program_name, LALoptarg, "version" );
*should_exit = 1;
return XLAL_SUCCESS;
}
}
char *str = XLALVCSInfoString( vcs_list, verbose, NULL );
XLAL_CHECK( str != NULL, XLAL_EFUNC );
printf( "%s", str );
XLALFree( str );
*should_exit = 1;
return XLAL_SUCCESS;
}
if (c != 0) // find short-option character
{
ptr = &UVAR_vars;
......@@ -660,7 +707,7 @@ XLALUserVarPrintUsage ( FILE *file )
XLAL_CHECK ( UVAR_vars.next != NULL, XLAL_EINVAL, "No UVAR memory allocated. Did you register any user-variables?" );
/* Print usage: only required and regular arguments are printed */
fprintf( file, "\nUsage: %s [-h|--help] [@<config-file>]", program_name );
fprintf( file, "\nUsage: %s [-h|--help] [-v|--version] [@<config-file>]", program_name );
for ( LALUserVariable *ptr = &UVAR_vars; (ptr=ptr->next) != NULL; )
{
switch ( ptr->category )
......@@ -811,6 +858,7 @@ XLALUserVarPrintHelp ( FILE *file )
fprintf( f, "\n" );
fprintf( f, "\nSYNOPSIS\n" );
fprintf( f, " %s -h|--help\n", program_name );
fprintf( f, " %s -v|--version[=verbose]\n", program_name );
fprintf( f, " %s [@<config-file>] [<options>...]\n", program_name );
/* Print options in sections */
......@@ -925,7 +973,7 @@ XLALUserVarPrintHelp ( FILE *file )
* program should exit immediately with a non-zero status.
*/
int
XLALUserVarReadAllInput ( BOOLEAN *should_exit, int argc, char *argv[] )
XLALUserVarReadAllInput ( BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list )
{
XLAL_CHECK ( should_exit != NULL, XLAL_EFAULT );
XLAL_CHECK ( argc > 0, XLAL_EINVAL );
......@@ -989,7 +1037,7 @@ XLALUserVarReadAllInput ( BOOLEAN *should_exit, int argc, char *argv[] )
}
// ---------- now parse cmdline: overloads previous config-file settings
XLAL_CHECK ( XLALUserVarReadCmdline ( should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALUserVarReadCmdline ( should_exit, argc, argv, vcs_list ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( *should_exit ) {
return XLAL_SUCCESS;
}
......@@ -999,11 +1047,6 @@ XLALUserVarReadAllInput ( BOOLEAN *should_exit, int argc, char *argv[] )
for ( LALUserVariable *ptr = &UVAR_vars; (ptr=ptr->next) != NULL; )
{
// check 'special' category, which suppresses the CheckRequired test
if ( (ptr->category == UVAR_CATEGORY_SPECIAL) && ptr->was_set ) {
skipCheckRequired = TRUE;
}
// handle DEPRECATED options by outputting a warning (on error-level to make this very noticeable!)
if ( ptr->category == UVAR_CATEGORY_DEPRECATED && ptr->was_set ) {
XLALPrintError ("\n%s: option " UVAR_FMT " is DEPRECATED: %s\n\n", program_name, ptr->name, ptr->help );
......
......@@ -29,6 +29,7 @@ extern "C" {
#include <lal/ConfigFile.h>
#include <lal/UserInputParse.h>
#include <lal/LALVCSInfoType.h>
/**
* \defgroup UserInput_h Header UserInput.h
......@@ -100,7 +101,7 @@ extern "C" {
* XLALRegisterUvarMember( specialGeekSwitch, REAL8, 'g', DEVELOPER, "This REAL8 user-variable may not be relevant for standard usage");
*
* // 3. step: parse all user-input, from either config-file if given, or commandline (overloads config-file values)
* XLAL_CHECK ( XLALUserVarReadAllInput ( argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC);
* XLAL_CHECK ( XLALUserVarReadAllInput ( argc, argv, lalAppsVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC);
*
* if (uvar->help){ // if user had requested help, then we're already done here
* return 0;
......@@ -189,7 +190,6 @@ typedef enum tagUserVarCategory {
UVAR_CATEGORY_DEVELOPER, ///< optional and hidden in help-output until lalDebugLevel>=warning
UVAR_CATEGORY_DEPRECATED, ///< optional and hidden until lalDebugLevel>=info; still supported but output warning if used
UVAR_CATEGORY_DEFUNCT, ///< hidden completely from help output; not supported, will output error + help-string if used
UVAR_CATEGORY_SPECIAL, ///< optional and *turns off* all checking of required variables, useful for output of version info
UVAR_CATEGORY_NODEFAULT, ///< optional and supresses printing the default value in the help, where it doesn't make sense
UVAR_CATEGORY_END ///< internal end marker for range checking
} UserVarCategory;
......@@ -213,9 +213,9 @@ extern const char *lalUserVarHelpBrief;
/* Function prototypes */
void XLALDestroyUserVars( void );
int XLALUserVarReadCmdline( BOOLEAN *should_exit, int argc, char *argv[] );
int XLALUserVarReadCmdline( BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list );
int XLALUserVarReadCfgfile( BOOLEAN *should_exit, const CHAR *cfgfile );
int XLALUserVarReadAllInput( BOOLEAN *should_exit, int argc, char *argv[] );
int XLALUserVarReadAllInput( BOOLEAN *should_exit, int argc, char *argv[], const LALVCSInfoList vcs_list );
int XLALUserVarWasSet( const void *cvar );
void XLALUserVarCheck( BOOLEAN *should_exit, const int assertion, const CHAR *fmt, ... ) _LAL_GCC_PRINTF_FORMAT_(3,4);
CHAR * XLALUserVarGetLog ( UserVarLogFormat format );
......
......@@ -19,6 +19,7 @@
*/
#include <math.h>
#include <lal/LALVCSInfo.h>
#include <lal/Date.h>
#include <lal/LALString.h>
......@@ -122,13 +123,13 @@ main(int argc, char *argv[])
BOOLEAN should_exit = 0;
if ( argc > 1 ) {
/* parse actual command-line arguments: this is only useful for debugging and testing, never used by 'make check' */
XLAL_CHECK ( XLALUserVarReadAllInput ( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALUserVarReadAllInput ( &should_exit, argc, argv, lalVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) {
return EXIT_FAILURE;
}
} else {
/* parse constructed command-line arguments: used by 'make check' */
XLAL_CHECK ( XLALUserVarReadAllInput ( &should_exit, my_argc, my_argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( XLALUserVarReadAllInput ( &should_exit, my_argc, my_argv, lalVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK ( should_exit == 0, XLAL_EFUNC );
}
......
......@@ -21,6 +21,7 @@
#include <config.h>
#include <lal/LALVCSInfo.h>
#include <lal/LALConstants.h>
#include <lal/XLALError.h>
#include <lal/AVFactories.h>
......@@ -135,7 +136,7 @@ main ( int argc, char *argv[] )
XLALRegisterUvarMember( outAlign, INT4, 'b', OPTIONAL, "Alignment of output vectors; default is sizeof(void*), i.e. no particular alignment" );
BOOLEAN should_exit = 0;
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv, lalVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) {
exit (1);
}
......
......@@ -169,7 +169,6 @@ typedef struct {
CHAR *outputdir; /**< name of output directory */
REAL8 deltat; /**< the desired sampling time */
INT4 goodxenon; /**< flag for using goodxenon data */
BOOLEAN version; /**< output version-info */
} UserInput_t;
/***********************************************************************************************/
......@@ -360,7 +359,6 @@ int main( int argc, char *argv[] )
void ReadUserVars(LALStatus *status,int argc,char *argv[],UserInput_t *uvar,CHAR *clargs)
{
CHAR *version_string;
INT4 i;
INITSTATUS(status);
......@@ -379,24 +377,12 @@ void ReadUserVars(LALStatus *status,int argc,char *argv[],UserInput_t *uvar,CHAR
LALregSTRINGUserStruct(status,outputdir, 'o', UVAR_REQUIRED, "The output frame file directory");
LALregREALUserStruct(status, deltat, 't', UVAR_OPTIONAL, "The output sampling time (in seconds)");
LALregINTUserStruct(status, goodxenon, 'x', UVAR_OPTIONAL, "Set this flag to include good xenon data");
LALregBOOLUserStruct(status, version, 'V', UVAR_SPECIAL, "Output code version");
/* do ALL cmdline and cfgfile handling */
BOOLEAN should_exit = 0;
LAL_CALL (LALUserVarReadAllInput(status->statusPtr, &should_exit, argc, argv), status->statusPtr);
if (should_exit) exit(1);
if ((version_string = XLALGetVersionString(0)) == NULL) {
XLALPrintError("XLALGetVersionString(0) failed.\n");
exit(1);
}
if (uvar->version) {
printf("%s\n",version_string);
exit(0);
}
XLALFree(version_string);
/* put clargs into string */
strcpy(clargs,"");
for (i=0;i<argc;i++) {
......
......@@ -100,7 +100,6 @@ typedef struct {
CHAR *inputfile; /**< input frame file name pattern */
CHAR *channel; /**< the frame channel to read */
CHAR *outputfile; /**< name of output file */
BOOLEAN version; /**< output version-info */
} UserInput_t;
/***********************************************************************************************/
......@@ -232,8 +231,6 @@ int main( int argc, char *argv[] )
void ReadUserVars(LALStatus *status,int argc,char *argv[],UserInput_t *uvar)
{
CHAR *version_string;
INITSTATUS(status);
ATTATCHSTATUSPTR (status);
......@@ -246,24 +243,12 @@ void ReadUserVars(LALStatus *status,int argc,char *argv[],UserInput_t *uvar)
LALregSTRINGUserStruct(status,inputfile, 'i', UVAR_REQUIRED, "The input frame name pattern");
LALregSTRINGUserStruct(status,outputfile, 'o', UVAR_REQUIRED, "The output statistics file");
LALregSTRINGUserStruct(status,channel, 'c', UVAR_REQUIRED, "The frame channel to be read");
LALregBOOLUserStruct(status, version, 'V', UVAR_SPECIAL, "Output code version");
/* do ALL cmdline and cfgfile handling */
BOOLEAN should_exit = 0;
LAL_CALL (LALUserVarReadAllInput(status->statusPtr, &should_exit, argc, argv), status->statusPtr);
if (should_exit) exit(1);
if ((version_string = XLALGetVersionString(0)) == NULL) {
XLALPrintError("XLALGetVersionString(0) failed.\n");
exit(1);
}
if (uvar->version) {
printf("%s\n",version_string);
exit(0);
}
XLALFree(version_string);
DETATCHSTATUSPTR (status);
RETURN (status);
......
......@@ -48,6 +48,7 @@
#include <lal/LALFrStream.h>
#include <lalappsfrutils.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
/***********************************************************************************************/
/* some global constants */
......@@ -261,7 +262,6 @@ typedef struct {
CHAR *outputdir; /**< name of output directory */
REAL8 deltat; /**< the desired sampling time */
BOOLEAN bary; /**< flag for performing barycentering */
BOOLEAN version; /**< output version-info */
} UserInput_t;
/***********************************************************************************************/
......@@ -489,22 +489,12 @@ ReadUserVars( int argc,char *argv[], UserInput_t *uvar, CHAR *clargs)
XLALRegisterUvarMember( outputdir, STRING, 'o', REQUIRED, "The output frame file directory name");
XLALRegisterUvarMember( deltat, REAL8, 't', OPTIONAL, "The output sampling time (in seconds)");
XLALRegisterUvarMember( bary, BOOLEAN, 'b', OPTIONAL, "Output barycentered data");
XLALRegisterUvarMember( version, BOOLEAN, 'V', SPECIAL, "Output code version");
/* do ALL cmdline and cfgfile handling */
BOOLEAN should_exit = 0;
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv, lalAppsVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) { exit(1); }
if (uvar->version) {
CHAR *version_string;
XLAL_CHECK ( (version_string = XLALGetVersionString(0)) != NULL, XLAL_EFUNC );
printf("%s\n",version_string);
XLALFree(version_string);
exit(0);
}
/* put clargs into string */
strcpy(clargs,"");
for ( int i=0;i<argc;i++) {
......
......@@ -201,7 +201,7 @@ int main(INT4 argc, CHAR *argv[])
/* read all command line variables */
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv) == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv, lalAppsVCSInfoList) == XLAL_SUCCESS, XLAL_EFUNC);
if (should_exit)
exit(1);
......
......@@ -23,6 +23,7 @@
#include <config.h>
#include <stdio.h>
#include <lal/LALDatatypes.h>
#include <LALAppsVCSInfo.h>
#if defined(__cplusplus)
extern "C" {
......
......@@ -43,7 +43,6 @@
/* user input variables */
BOOLEAN uvar_version; /**< output version information */
BOOLEAN uvar_averagePsi;
BOOLEAN uvar_averageIota;
BOOLEAN uvar_autoCorrelate;
......@@ -205,8 +204,6 @@ int main(int argc, char *argv[]){
static SFTConstraints constraints;
INT4 sftcounter = 0, slidingcounter = 1, listLength = 0;
CHAR *VCSInfoString; /**< LAL + LALapps Git version string */
/* to time the code*/
time_t t1, t2;
......@@ -218,21 +215,10 @@ int main(int argc, char *argv[]){
/* read all command line variables */
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN( XLALUserVarReadAllInput(&should_exit, argc, argv) == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN( XLALUserVarReadAllInput(&should_exit, argc, argv, lalAppsVCSInfoList) == XLAL_SUCCESS, XLAL_EFUNC);
if (should_exit)
exit(1);
if ( (VCSInfoString = XLALGetVersionString(0)) == NULL ) {
XLALPrintError("XLALGetVersionString(0) failed.\n");
exit(1);
}
if ( uvar_version ) {
printf ("%s\n", VCSInfoString );
exit (0);
}
/* very basic consistency checks on user input */
if ( uvar_f0 < 0 ) {
fprintf(stderr, "start frequency must be positive\n");
......@@ -1066,9 +1052,6 @@ printf("%g %g\n", sigmasq->data[i] * ualpha->data[i].re, sigmasq->data[i] * ualp
XLALDestroyREAL8Vector(galphare);
XLALDestroyREAL8Vector(galphaim);
if ( VCSInfoString )
XLALFree ( VCSInfoString );
if (!uvar_averagePsi) {
LALFree(psi);
}
......@@ -1715,7 +1698,6 @@ void initUserVars (LALStatus *status)
uvar_maxlag = 0;
uvar_version = FALSE;
uvar_averagePsi = TRUE;
uvar_averageIota = TRUE;
uvar_autoCorrelate = FALSE;
......@@ -1767,7 +1749,6 @@ void initUserVars (LALStatus *status)
strcpy(uvar_skyfile,SKYFILE);
/* register user input variables */
XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &uvar_version, "version", BOOLEAN, 'V', SPECIAL, "Output version information") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &uvar_averagePsi, "averagePsi", BOOLEAN, 0, OPTIONAL, "Use average over psi") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &uvar_averageIota, "averageIota", BOOLEAN, 0, OPTIONAL, "Use average over iota") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_LAL( status, XLALRegisterNamedUvar( &uvar_autoCorrelate, "autoCorrelate", BOOLEAN, 0, OPTIONAL, "Include autocorrelations") == XLAL_SUCCESS, XLAL_EFUNC );
......
......@@ -90,7 +90,6 @@ typedef struct{
CHAR *gammaAveOutputFilename; /**< output filename to write Gamma_ave = (aa+bb)/10 */
CHAR *gammaCircOutputFilename; /**< output filename to write Gamma_circ = (ab-ba)/10 */
CHAR *toplistFilename; /**< output filename containing candidates in toplist */
BOOLEAN version; /**<output version information*/
CHAR *logFilename; /**< name of log file*/
} UserInput_t;
......@@ -164,7 +163,7 @@ int main(int argc, char *argv[]){
/* read user input from the command line or config file */
BOOLEAN should_exit = 0;
if ( XLALUserVarReadAllInput ( &should_exit, argc, argv ) != XLAL_SUCCESS ) {
if ( XLALUserVarReadAllInput ( &should_exit, argc, argv, lalAppsVCSInfoList ) != XLAL_SUCCESS ) {
LogPrintf ( LOG_CRITICAL, "%s: XLALUserVarReadAllInput() failed with errno=%d\n", __func__, xlalErrno );
XLAL_ERROR( XLAL_EFUNC );
}
......@@ -172,12 +171,6 @@ int main(int argc, char *argv[]){
return EXIT_FAILURE;
CHAR *VCSInfoString = XLALGetVersionString(0); /**<LAL + LALapps Vsersion string*/
/*If the version information was requested, output it and exit*/
if ( uvar.version ){
XLAL_CHECK ( VCSInfoString != NULL, XLAL_EFUNC, "XLALGetVersionString(0) failed.\n" );
printf ("%s\n", VCSInfoString );
exit (0);
}
/* configure useful variables based on user input */
if ( XLALInitializeConfigVars ( &config, &uvar) != XLAL_SUCCESS ) {
......@@ -999,7 +992,6 @@ int XLALInitUserVars (UserInput_t *uvar)
/* initialize number of candidates in toplist -- default is just to return the single best candidate */
uvar->numCand = 1;
uvar->toplistFilename = XLALStringDuplicate("toplist_crosscorr.dat");
uvar->version = FALSE;
/* register user-variables */
XLALRegisterUvarMember( startTime, INT4, 0, REQUIRED, "Desired start time of analysis in GPS seconds");
......@@ -1042,7 +1034,6 @@ int XLALInitUserVars (UserInput_t *uvar)
XLALRegisterUvarMember( gammaCircOutputFilename, STRING, 0, OPTIONAL, "Name of file to which to write ab-ba weights (for e.g., systematic error)");
XLALRegisterUvarMember( toplistFilename, STRING, 0, OPTIONAL, "Output filename containing candidates in toplist");
XLALRegisterUvarMember( logFilename, STRING, 0, OPTIONAL, "Output a meta-data file for the search");
XLALRegisterUvarMember( version, BOOLEAN, 'V', SPECIAL, "Output version(VCS) information");
if ( xlalErrno ) {
XLALPrintError ("%s: user variable initialization failed with errno = %d.\n", __func__, xlalErrno );
XLAL_ERROR ( XLAL_EFUNC );
......
......@@ -115,7 +115,7 @@ int main(int argc, char **argv)
XLAL_CHECK_MAIN( XLALRegisterNamedUvar(&sunFile, "sunFile", STRING, 'z', OPTIONAL, "sun .dat file" ) == XLAL_SUCCESS, XLAL_EFUNC);
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv) == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv, lalAppsVCSInfoList) == XLAL_SUCCESS, XLAL_EFUNC);
if (should_exit)
return(1);
......
......@@ -82,7 +82,6 @@ typedef struct {
REAL8 upsampling; /**< factor by which to upsample the frequency resolution by */
BOOLEAN version; /**< output version-info */
} UserInput_t;
/* ---------- local prototypes ---------- */
......
......@@ -30,6 +30,7 @@
#include <lal/LFTandTSutils.h>
#include <lal/LALString.h>
#include <lal/UserInput.h>
#include <lal/LALPulsarVCSInfo.h>
// benchmark ComputeFstat() functions for performance and memory usage
REAL8 XLALGetCurrentHeapUsageMB ( void );
......@@ -141,21 +142,12 @@ main ( int argc, char *argv[] )
XLAL_CHECK_MAIN ( XLALRegisterUvarMember ( ephemSun, STRING, 0, DEVELOPER, "Sun ephemeris file to use") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_MAIN ( XLALRegisterUvarMember ( randSeed, INT4, 0, DEVELOPER, "Random seed to use for rand() to draw randomized parameters.") == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_MAIN ( XLALRegisterUvarMember( version, BOOLEAN, 'V', SPECIAL, "Output version information") == XLAL_SUCCESS, XLAL_EFUNC );
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_MAIN ( XLALUserVarReadAllInput( &should_exit, argc, argv, lalPulsarVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) {
return EXIT_FAILURE;
}
if ( uvar->version )
{
printf ( "%s\n", VCSInfoString );
XLALFree ( VCSInfoString );
exit (0);
}
// produce log-string (for output-file headers)
CHAR *logstring = NULL;
XLAL_CHECK_MAIN ( (logstring = XLALStringAppend ( logstring, "%% cmdline: " )) != NULL, XLAL_EFUNC );
......
......@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
// Parse user input
BOOLEAN should_exit = 0;
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv, lalAppsVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
// Check user input
XLALUserVarCheck( &should_exit, UVAR_SET2(square, age_braking) == 1, "Exactly one of " UVAR_STR2AND(square, age_braking) " must be specified" );
......
......@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
/* Get command line arguments */
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv) == XLAL_SUCCESS, XLAL_EFUNC);
XLAL_CHECK_MAIN(XLALUserVarReadAllInput(&should_exit, argc, argv, lalAppsVCSInfoList) == XLAL_SUCCESS, XLAL_EFUNC);
if (should_exit)
return EXIT_FAILURE;
......
......@@ -280,8 +280,6 @@ typedef struct {
CHAR *workingDir; /**< directory to use for output files */
REAL8 timerCount; /**< output progress-meter every timerCount seconds */
BOOLEAN version; /**< output version information */
CHAR *outputFstatAtoms; /**< output per-SFT, per-IFO 'atoms', ie quantities required to compute F-stat */
BOOLEAN outputSingleFstats; /**< in multi-detector case, also output single-detector F-stats */
......@@ -390,17 +388,11 @@ int main(int argc,char *argv[])
/* do ALL cmdline and cfgfile handling */
BOOLEAN should_exit = 0;
XLAL_CHECK_MAIN( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK_MAIN( XLALUserVarReadAllInput( &should_exit, argc, argv, lalAppsVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) {
exit (1);
}
if ( uvar.version )
{
printf ( "%s\n", GV.VCSInfoString );
exit (0);
}
/* do some sanity checks on the user-input before we proceed */
XLAL_CHECK_MAIN ( checkUserInputConsistency ( &uvar ) == XLAL_SUCCESS, XLAL_EFUNC );
......@@ -952,8 +944,6 @@ initUserVars ( UserInput_t *uvar )
uvar->metricMismatch = 0.02;
uvar->version = FALSE;
uvar->outputLogfile = NULL;
uvar->outputFstat = NULL;
uvar->outputLoudest = NULL;
......@@ -1095,8 +1085,6 @@ initUserVars ( UserInput_t *uvar )
XLALRegisterUvarMember(FstatMethod, STRING, 0, OPTIONAL, "F-statistic method to use. Available methods: %s", XLALFstatMethodHelpString() );
XLALRegisterUvarMember( version, BOOLEAN, 'V', SPECIAL, "Output version information");
/* ----- more experimental/expert options ----- */
XLALRegisterUvarMember( UseNoiseWeights,BOOLEAN, 'W', DEVELOPER, "Use per-SFT noise weights");
XLALRegisterUvarMember(ephemEarth, STRING, 0, DEVELOPER, "Earth ephemeris file to use");
......
......@@ -129,8 +129,6 @@ typedef struct {
REAL8 transientStartTime; /**< GPS start-time of transient window */
REAL8 transientTauDays; /**< time-scale in days of transient window */
BOOLEAN version; /**< output version-info */
} UserInput_t;
/* ---------- local prototypes ---------- */
......@@ -166,18 +164,13 @@ int main(int argc,char *argv[])
/* do ALL cmdline and cfgfile handling */
BOOLEAN should_exit = 0;
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv ) == XLAL_SUCCESS, XLAL_EFUNC );
XLAL_CHECK( XLALUserVarReadAllInput( &should_exit, argc, argv, lalAppsVCSInfoList ) == XLAL_SUCCESS, XLAL_EFUNC );
if ( should_exit ) {
exit (1);
}
XLAL_CHECK_MAIN ( (VCSInfoString = XLALGetVersionString(0)) != NULL, XLAL_EFUNC );
if ( uvar.version ) {
printf ("%s\n", VCSInfoString );
exit(0);
}