Commit ceba1949 authored by Karl Wette's avatar Karl Wette

Merge branch 'deprecate-lalapps-h' into 'master'

Deprecate lalapps/src/lalapps/lalapps.[ch]

Closes #313

See merge request !1500
parents 508cce2e e07751a3
Pipeline #184117 passed with stages
in 200 minutes and 3 seconds
......@@ -345,3 +345,76 @@ void REPORTSTATUS(LALStatus * status)
}
return;
}
/*
* Error handlers for LALApps applications
*/
#define FAILMSG( stat, func, file, line, id ) \
do { \
if ( lalDebugLevel & LALERROR ) \
{ \
LALPrintError( "Error[0]: file %s, line %d, %s\n" \
"\tLAL_CALL: Function call `%s' failed.\n", file, line, id, func ); \
} \
if ( vrbflg ) \
{ \
fprintf(stderr,"Level 0: %s\n\tFunction call `%s' failed.\n" \
"\tfile %s, line %d\n", id, func, file, line ); \
REPORTSTATUS( stat ); \
} \
} while( 0 )
int vrbflg = 0;
lal_errhandler_t lal_errhandler = LAL_ERR_DFLT;
int LAL_ERR_EXIT(
LALStatus *stat,
const char *func,
const char *file,
const int line,
volatile const char *id
)
{
if ( stat->statusCode )
{
FAILMSG( stat, func, file, line, id );
exit( 1 );
}
return stat->statusCode;
}
int LAL_ERR_ABRT(
LALStatus *stat,
const char *func,
const char *file,
const int line,
volatile const char *id
)
{
if ( stat->statusCode )
{
FAILMSG( stat, func, file, line, id );
abort();
}
return 0;
}
int LAL_ERR_RTRN(
LALStatus *stat,
const char *func,
const char *file,
const int line,
volatile const char *id
)
{
if ( stat->statusCode )
{
FAILMSG( stat, func, file, line, id );
}
return stat->statusCode;
}
......@@ -135,6 +135,46 @@ void REPORTSTATUS(LALStatus * status);
#endif /* NDEBUG */
/*
* Error handlers for LALApps applications
*/
typedef int ( *lal_errhandler_t )(
LALStatus *,
const char *func,
const char *file,
const int line,
volatile const char *id
);
#define LAL_ERR_DFLT LAL_ERR_ABRT
extern lal_errhandler_t lal_errhandler;
extern int LAL_ERR_EXIT(
LALStatus *,
const char *func,
const char *file,
const int line,
volatile const char *id
);
extern int LAL_ERR_ABRT(
LALStatus *,
const char *func,
const char *file,
const int line,
volatile const char *id
);
extern int LAL_ERR_RTRN(
LALStatus *,
const char *func,
const char *file,
const int line,
volatile const char *id
);
#define LAL_CALL( function, statusptr ) \
((function),lal_errhandler(statusptr,#function,__FILE__,__LINE__,"$Id$"))
#endif /* SWIG */
/*
......
......@@ -83,3 +83,22 @@ char *XLALVCSInfoString(const LALVCSInfoList vcs_list, const int verbose, const
return str;
}
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
{
/* check input */
XLAL_CHECK( fp != NULL, XLAL_EFAULT );
/* generate VCS and build information string */
char *str = XLALVCSInfoString( vcs_list, verbose, prefix );
XLAL_CHECK( str != NULL, XLAL_EFUNC );
/* output string */
XLAL_CHECK( fprintf( fp, "%s", str ) >= 0, XLAL_ESYS );
XLALFree( str );
return XLAL_SUCCESS;
}
......@@ -21,6 +21,8 @@
#ifndef _LALVCSINFOTYPE_H
#define _LALVCSINFOTYPE_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
......@@ -65,6 +67,12 @@ typedef const LALVCSInfo *const LALVCSInfoList[16];
*/
char *XLALVCSInfoString(const LALVCSInfoList vcs_list, const int verbose, const char *prefix);
/**
* Output VCS and build information, as generated by XLALVCSInfoString(), to a file pointer \p fp.
* The arguments \p vcs_list, \p verbose, and \p prefix are as for XLALVCSInfoString().
*/
int XLALOutputVCSInfo(FILE *fp, const LALVCSInfoList vcs_list, const int verbose, const char *prefix);
/** @} */
#ifdef __cplusplus
......
......@@ -66,7 +66,6 @@ the model given in Jaranowski, Krolak, and Schutz gr-qc/9804014.
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* #include <lalapps.h> */ /* 05/20/03 gam */
#include <lal/LALStdlib.h>
#include <lal/LALgetopt.h>
#include <lal/LALConstants.h>
......
AC_PREREQ([2.63])
AC_INIT([LALApps],[7.0.0.1],[lal-discuss@ligo.org])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([src/lalapps/lalapps.c])
AC_CONFIG_SRCDIR([src/lalapps/tconvert.c])
AC_CONFIG_AUX_DIR([gnuscripts])
AC_CONFIG_MACRO_DIR([gnuscripts])
AC_CONFIG_FILES([\
......
......@@ -27,6 +27,8 @@
*-----------------------------------------------------------------------
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
......@@ -49,7 +51,7 @@
#include <lal/LIGOLwXML.h>
#include <lal/LIGOLwXMLRead.h>
#include <lal/LIGOMetadataUtils.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#define CVS_ID_STRING "$Id$"
#define CVS_NAME_STRING "$Name$"
......
......@@ -22,7 +22,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#include <lal/LALStdlib.h>
#include <lal/LALConstants.h>
#include <lal/LALgetopt.h>
......@@ -83,7 +83,7 @@ int main ( int argc, char *argv[] )
usage( program );
return 0;
case 'V':
PRINT_VERSION( "hello" );
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
return 0;
case 'v':
vrbflg = 1;
......
......@@ -33,11 +33,15 @@
/***********************************************************************************************/
/* includes */
#include "config.h"
/* disable -Wstrict-prototypes flag for this header file as this */
/* a build failure for cfitsio-3.440+ */
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#include <fitsio.h>
#pragma GCC diagnostic pop
#include <math.h>
#include <gsl/gsl_interp.h> /* needed for the gsl interpolation */
#include <gsl/gsl_spline.h> /* needed for the gsl interpolation */
......@@ -51,7 +55,6 @@
#include <lal/LALFrameIO.h>
#include <lal/LALFrStream.h>
#include <lalappsfrutils.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
/***********************************************************************************************/
......@@ -270,7 +273,7 @@ typedef struct {
/***********************************************************************************************/
/* global variables */
extern int vrbflg; /**< defined in lalapps.c */
extern int vrbflg; /**< defined in lal/lib/std/LALError.c */
/* keywords in FITS file header */
char string_OBJECT[] = "OBJECT";
......@@ -3120,7 +3123,7 @@ int XLALXTEUINT4TimeSeriesArrayToFrames(XTEUINT4TimeSeriesArray *ts, /**< [
{
CHAR *versionstring = NULL; /* pointer to a string containing the git version information */
versionstring = XLALGetVersionString(1);
versionstring = XLALVCSInfoString(lalAppsVCSInfoList, 1, "%% ");
XLALFrameAddFrHistory(outFrame,"headerdump",ts->headerdump);
XLALFrameAddFrHistory(outFrame,"comment",ts->comment);
XLALFrameAddFrHistory(outFrame,"versionstring",versionstring);
......
......@@ -72,7 +72,7 @@
#endif
#include <lal/XLALError.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#define MAXPULSARS 64
......@@ -260,8 +260,8 @@ int parseinput(int argc, char **argv){
double tempamp;
switch (c) {
case 'v':
if ( XLALOutputVersionString(stdout,0) != XLAL_SUCCESS ) {
XLALPrintError("XLALOutputVersionString() failed!\n");
if ( XLALOutputVCSInfo(stdout, lalAppsVCSInfoList, 0, "%% ") != XLAL_SUCCESS ) {
XLALPrintError("XLALOutputVCSInfo() failed!\n");
exit(1);
}
exit(0);
......
......@@ -36,7 +36,6 @@
#include <assert.h>
#include <string.h>
#include <time.h>
#include <lalapps.h>
#include <lal/LALStdio.h>
#include <lal/LALgetopt.h>
#include <lal/LALStdlib.h>
......@@ -419,7 +418,7 @@ static REAL4TimeSeries *injectWaveform(
int main( int argc, char *argv[] )
{
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
LIGOTimeGPS gpsStartTime = {0, 0};
LIGOTimeGPS earliestEndTime = {0, 0};
ResponseFunction injectionResponse = noResponse;
......@@ -604,7 +603,7 @@ int main( int argc, char *argv[] )
/* print version information and exit */
fprintf( stdout, "blind hardware injection generation routine\n"
"Stephen Fairhurst\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit( 0 );
break;
......
......@@ -38,7 +38,6 @@
#include <time.h>
#include <math.h>
#include <lalapps.h>
#include <series.h>
#include <lalappsfrutils.h>
......@@ -156,7 +155,7 @@ int coireflg; /* is input file coire (1) or inj (null) */
int main( int argc, char *argv[] )
{
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
UINT4 k;
UINT4 kLow;
......@@ -382,7 +381,7 @@ int main( int argc, char *argv[] )
/* print version information and exit */
fprintf( stdout, "calculation of expected SNR of injections\n"
"Gareth Jones\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit( 0 );
break;
......
......@@ -23,7 +23,7 @@
#include <math.h>
#include <string.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#include <lal/LALStdio.h>
#include <lal/LALgetopt.h>
#include <lal/LALStdlib.h>
......@@ -106,7 +106,7 @@ double chirpDist(SimInspiralTable *inj, char ifo){
int main(int argc, char *argv[])
{
LALStatus status=blank_status;
LALStatus XLAL_INIT_DECL(status);
CHAR inputfile[FILENAME_MAX];
CHAR outputpath[1000];
CHAR injtype[30];
......
......@@ -19,6 +19,8 @@
* MA 02111-1307 USA
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -36,7 +38,6 @@
#include <lal/Units.h>
#include <lal/LALFrameL.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
/* program info */
......@@ -62,7 +63,7 @@ extern int vrbflg;
INT4 main(INT4 argc, CHAR **argv)
{
/* status */
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* counters */
int c;
......@@ -211,7 +212,7 @@ INT4 main(INT4 argc, CHAR **argv)
case 'V':
/* print version information and exit */
fprintf(stdout, "Numerical Relativity Frame Generation\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit(0);
break;
......
......@@ -266,7 +266,6 @@
#include <time.h>
#include <math.h>
#include <lalapps.h>
#include <series.h>
#include <lalappsfrutils.h>
......@@ -378,7 +377,7 @@ CHAR comment[LIGOMETA_COMMENT_MAX]; /* process param comment */
int main( int argc, char *argv[] )
{
/* lal function variables */
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* frame input data */
LALCache *frInCache = NULL;
......@@ -1520,7 +1519,7 @@ int arg_parse_check( int argc, char *argv[], MetadataTable procparams )
/* print version information and exit */
fprintf( stdout, "LIGO/LSC Inspiral Injection Program\n"
"Steve Fairhurst <sfairhur@gravity.phys.uwm.edu>\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit( 0 );
break;
......
......@@ -366,8 +366,9 @@
* </dl>
*/
#include "config.h"
#include <ctype.h>
#include <lalapps.h>
#include <lal/Date.h>
#include <lal/LALgetopt.h>
#include <lal/LIGOMetadataTables.h>
......@@ -1922,7 +1923,7 @@ int main( int argc, char *argv[] )
CHAR *virgoFakePsd=NULL;
REAL8FrequencySeries *ligoPsd = NULL;
REAL8FrequencySeries *virgoPsd = NULL;
status=blank_status;
XLAL_INIT_MEM(status);
/* LALgetopt arguments */
struct LALoption long_options[] =
......@@ -3066,7 +3067,7 @@ int main( int argc, char *argv[] )
case 'V':
/* print version information and exit */
fprintf( stdout, "LIGO/LSC inspiral injection engine\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit( 0 );
break;
......
......@@ -20,7 +20,9 @@
#ifndef _LALAPPS_INSPIRAL_H
#define _LALAPPS_INSPIRAL_H
#include <lalapps.h>
#include "config.h"
#include <LALAppsVCSInfo.h>
#include <lal/LALConfig.h>
#include <lal/LALStdio.h>
#include <lal/LALStdlib.h>
......
......@@ -38,7 +38,7 @@
#include <time.h>
#include <math.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#include <series.h>
#include <lalappsfrutils.h>
......@@ -129,7 +129,7 @@ REAL4 XLALCandleDistanceTD(
UINT4 cut)
{
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
InspiralTemplate tmplt;
REAL4Vector *waveform = NULL;
......
......@@ -35,7 +35,7 @@
#include <string.h>
#include <time.h>
#include <config.h>
#include <lalapps.h>
#include <LALAppsVCSInfo.h>
#include <lal/LALStdio.h>
#include <lal/LALgetopt.h>
#include <lal/LALStdlib.h>
......@@ -99,7 +99,7 @@ int main ( int argc, char *argv[] )
/* xml output data */
CHAR fname[256];
CHAR *userTag = NULL;
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
MetadataTable proctable;
MetadataTable procparams;
MetadataTable injections;
......
......@@ -27,13 +27,13 @@
*/
#include "config.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <lalapps.h>
#include <lal/LALConfig.h>
#include <lal/LALStdio.h>
#include <lal/LALStdlib.h>
......@@ -120,7 +120,7 @@ static int parse_group_list ( NrParRange *range, CHAR *list);
/* main program entry */
int main(INT4 argc, CHAR *argv[])
{
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* frame file stuff */
LALCache *frGlobCache = NULL;
......
......@@ -37,7 +37,6 @@
#include <regex.h>
#include <time.h>
#include <lalapps.h>
#include <series.h>
#include <lal/LALConfig.h>
......@@ -93,7 +92,7 @@ INT4 outCompress = 0;
int main ( int argc, char *argv[] )
{
/* lal function variables */
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* templates */
RandomParams *randParams = NULL;
......
......@@ -32,7 +32,6 @@
#include <assert.h>
#include <string.h>
#include <time.h>
#include <lalapps.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_roots.h>
......
......@@ -135,8 +135,6 @@
#include <regex.h>
#include <time.h>
#include <lalapps.h>
#include <lal/LALConfig.h>
#include <lal/LALgetopt.h>
#include <lal/LALStdio.h>
......@@ -175,7 +173,7 @@ extern int vrbflg; /* verbocity of lal function */
int main ( int argc, char *argv[] )
{
/* lal function variables */
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* template bank generation parameters */
CHAR *bankFileName = NULL;
......@@ -375,7 +373,7 @@ int main ( int argc, char *argv[] )
/* print version information and exit */
fprintf( stdout, "Inspiral Template Bank Splitter\n"
"Duncan Brown <duncan@gravity.phys.uwm.edu>\n");
XLALOutputVersionString(stderr, 0);
XLALOutputVCSInfo(stderr, lalAppsVCSInfoList, 0, "%% ");
exit( 0 );
break;
......
......@@ -38,7 +38,6 @@
#include <time.h>
#include <math.h>
#include <lalapps.h>
#include <series.h>
#include <lal/LALConfig.h>
......@@ -228,7 +227,7 @@ REAL4FrequencySeries *readPSD(const char *fname, REAL4 fNyq, REAL4 df, UINT4 N,
int main ( int argc, char *argv[] )
{
/* lal function variables */
LALStatus status = blank_status;
LALStatus XLAL_INIT_DECL(status);
/* templates */
RandomParams *randParams = NULL;
......