irplib_utils.h

00001 /* $Id: irplib_utils.h,v 1.31 2007/05/23 12:48:39 jmlarsen Exp $
00002  *
00003  * This file is part of the irplib package 
00004  * Copyright (C) 2002,2003 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: jmlarsen $
00023  * $Date: 2007/05/23 12:48:39 $
00024  * $Revision: 1.31 $
00025  * $Name: uves-3_3_1 $
00026  */
00027 
00028 #ifndef IRPLIB_UTILS_H
00029 #define IRPLIB_UTILS_H
00030 
00031 /*-----------------------------------------------------------------------------
00032                                    Includes
00033  -----------------------------------------------------------------------------*/
00034 
00035 #include <stdarg.h>
00036 
00037 #include <cpl.h>
00038 
00039 /*-----------------------------------------------------------------------------
00040                                    Define
00041  -----------------------------------------------------------------------------*/
00042 
00043 #if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(3, 1, 90)
00044 #define irplib_vsprintf cpl_vsprintf
00045 #define irplib_sprintf  cpl_sprintf
00046 #else
00047   /* FIXME: Remove once support for CPL 3.1 is dropped */
00048 
00049 /*
00050   @ingroup irplib_utils
00051   @brief  Create a string and fill it using vsnprintf()
00052   @param  format  The format string
00053   @param  arglist The argument list for the format
00054   @return The created string or NULL on error
00055   @note   The created string must be deallocated with cpl_free()
00056   @see vsnprintf()
00057  
00058  @hideinitializer
00059 */
00060 
00061 #define irplib_vsprintf(FORMAT, ARGLIST) \
00062    irplib_vsprintf_macro(FORMAT, ARGLIST, ARGLIST)
00063 
00064 #endif
00065 
00066 /* Useful for debugging */
00067 #define irplib_trace()  do if (cpl_error_get_code()) { \
00068     cpl_msg_debug(cpl_func, __FILE__ " at line %d: ERROR '%s' at %s", \
00069          __LINE__, cpl_error_get_message(), cpl_error_get_where()); \
00070   } else { \
00071     cpl_msg_debug(cpl_func, __FILE__ " at line %d: OK", __LINE__); \
00072   } while (0)
00073 
00074 /*-----------------------------------------------------------------------------
00075                                    Function prototypes
00076  -----------------------------------------------------------------------------*/
00077 
00078 void irplib_reset(void);
00079 int irplib_compare_tags(cpl_frame *, cpl_frame *);
00080 const char * irplib_frameset_find_file(const cpl_frameset *, const char *);
00081 cpl_frame * irplib_frameset_get_first_from_group(const cpl_frameset *,
00082                                                  cpl_frame_group);
00083 
00084 cpl_error_code irplib_apertures_find_max_flux(const cpl_apertures *, int *,
00085                                               int);
00086 
00087 cpl_type_bpp irplib_bpp_find(int, int);
00088 
00089 #if defined CPL_VERSION_CODE && CPL_VERSION_CODE >= CPL_VERSION(3, 1, 90)
00090 #else
00091   /* FIXME: Remove once support for CPL 3.1 is dropped */
00092 
00093 char * irplib_vsprintf_macro(const char *, va_list, va_list)
00094 #ifdef __GNUC__
00095      __attribute__((format (printf, 1, 0)))
00096 #endif
00097      ;
00098 
00099      char * irplib_sprintf(const char *, ...)
00100 #ifdef __GNUC__
00101      __attribute__((format (printf, 1, 2)))
00102 #endif
00103      ;
00104 #endif
00105 
00106 int irplib_isinf(double value);
00107 int irplib_isnan(double value);
00108 
00109 #endif

Generated on Tue Jun 19 14:39:14 2007 for UVES Pipeline Reference Manual by  doxygen 1.4.6