LALPrimerTest.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Jolien Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 /* <lalVerbatim> */
00021 #include <stdlib.h>
00022 #include <lal/LALStdlib.h>
00023 #include <lal/LALPrimer.h>
00024 
00025 NRCSID( LALPRIMERTESTC, "$Id: LALPrimerTest.c,v 1.5 2007/06/08 14:41:54 bema Exp $" );
00026 
00027 int lalDebugLevel = 0;
00028 
00029 int
00030 main( int argc, char **argv )
00031      /* Divides two numbers given on the command input line. */
00032 {
00033   static LALStatus stat;
00034   REAL4 ratio;
00035 
00036   /* Parse input line. */
00037   if ( argc == 4 )
00038     lalDebugLevel = atoi( argv[3] );
00039   else if ( argc != 3 )
00040     {
00041       fprintf( stderr, "Usage: %s numer denom [ lalDebugLevel ]\n",
00042                argv[0] );
00043       return 0; /* so that test script won't fail */
00044     }
00045 
00046   /* Compute ratio. */
00047   REAL4Divide( &stat, &ratio, atof( argv[1] ), atof( argv[2] ) );
00048   if ( stat.statusCode && ( lalDebugLevel > 0 ) )
00049     fprintf( stderr,
00050              "Error[0] 1: program %s, file %s, line %i, %s\n"
00051              "         Function REAL4Divide() failed\n",
00052              argv[0], __FILE__, __LINE__, LALPRIMERTESTC );
00053 
00054   /* Print result. */
00055   if ( !stat.statusCode )
00056     fprintf( stdout, "\nRatio = %f\n", ratio );
00057   REPORTSTATUS( &stat );
00058   return stat.statusCode;
00059 }
00060 /* </lalVerbatim> */

Generated on Sat Sep 6 03:07:12 2008 for LAL by  doxygen 1.5.2