wcslib.h
Go to the documentation of this file.
/*============================================================================
WCSLIB 4.19 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
WCSLIB is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with WCSLIB. If not, see http://www.gnu.org/licenses.
Direct correspondence concerning WCSLIB to mark@calabretta.id.au
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
$Id: wcslib.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
*=============================================================================
*
* WCSLIB 4.19 - C routines that implement the FITS World Coordinate System
* (WCS) standard.
*
* Summary of wcslib.h
* -------------------
* This header file is provided purely for convenience. Use it to include all
* of the separate WCSLIB headers.
*
*===========================================================================*/
#ifndef WCSLIB_WCSLIB
#define WCSLIB_WCSLIB
#include "cel.h"
#include "fitshdr.h"
#include "lin.h"
#include "log.h"
#include "prj.h"
#include "spc.h"
#include "sph.h"
#include "spx.h"
#include "tab.h"
#include "wcs.h"
#include "wcserr.h"
#include "wcsfix.h"
#include "wcshdr.h"
#include "wcsmath.h"
#include "wcsprintf.h"
#include "wcstrig.h"
#include "wcsunits.h"
#include "wcsutil.h"
#endif /* WCSLIB_WCSLIB */
wcserr_enable(1);
wcsprintf_set(stderr);
...
if (wcsset(&wcs) {
wcsperr(&wcs);
return wcs.err->status;
}
@endverbatim
In this example, if an error was generated in one of the prjset() functions,
wcsperr() would print an error traceback starting with wcsset(), then
celset(), and finally the particular projection-setting function that
generated the error. For each of them it would print the status return value,
function name, source file, line number, and an error message which may be
more specific and informative than the general error messages reported in the
first example. For example, in response to a deliberately generated error,
the @c twcs test program, which tests wcserr among other things, produces a
traceback similar to this:
@verbatim
ERROR 5 in wcsset() at line 1564 of file wcs.c:
Invalid parameter value.
ERROR 2 in celset() at line 196 of file cel.c:
Invalid projection parameters.
ERROR 2 in bonset() at line 5727 of file prj.c:
Invalid parameters for Bonne's projection.
@endverbatim
Each of the @ref structs "structs" in @ref overview "WCSLIB" includes a
pointer, called @a err, to a wcserr struct. When an error occurs, a struct is
allocated and error information stored in it. The wcserr pointers and the
@ref memory "memory" allocated for them are managed by the routines that
manage the various structs such as wcsini() and wcsfree().
wcserr messaging is an opt-in system enabled via wcserr_enable(), as in the
example above. If enabled, when an error occurs it is the user's
responsibility to free the memory allocated for the error message using
wcsfree(), celfree(), prjfree(), etc. Failure to do so before the struct goes
out of scope will result in memory leaks (if execution continues beyond the
error).
*/