WCSLIB 4.17: wcslib.h Source File

- Main Page
- Related Pages
- Data Structures
- Files

# wcslib.h

Go to the documentation of this file.

    00001 /*============================================================================
    00002
    00003   WCSLIB 4.17 - an implementation of the FITS WCS standard.
    00004   Copyright (C) 1995-2013, Mark Calabretta
    00005
    00006   This file is part of WCSLIB.
    00007
    00008   WCSLIB is free software: you can redistribute it and/or modify it under the
    00009   terms of the GNU Lesser General Public License as published by the Free
    00010   Software Foundation, either version 3 of the License, or (at your option)
    00011   any later version.
    00012
    00013   WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
    00014   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00015   FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    00016   more details.
    00017
    00018   You should have received a copy of the GNU Lesser General Public License
    00019   along with WCSLIB.  If not, see http://www.gnu.org/licenses.
    00020
    00021   Direct correspondence concerning WCSLIB to mark@calabretta.id.au
    00022
    00023   Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
    00024   http://www.atnf.csiro.au/people/Mark.Calabretta
    00025   $Id: wcslib.h,v 4.17 2013/01/29 05:29:20 cal103 Exp $
    00026 *=============================================================================
    00027 *
    00028 * WCSLIB 4.17 - C routines that implement the FITS World Coordinate System
    00029 * (WCS) standard.
    00030 *
    00031 * Summary of wcslib.h
    00032 * -------------------
    00033 * This header file is provided purely for convenience.  Use it to include all
    00034 * of the separate WCSLIB headers.
    00035 *
    00036 *===========================================================================*/
    00037
    00038 #ifndef WCSLIB_WCSLIB
    00039 #define WCSLIB_WCSLIB
    00040
    00041 #include "cel.h"
    00042 #include "fitshdr.h"
    00043 #include "lin.h"
    00044 #include "log.h"
    00045 #include "prj.h"
    00046 #include "spc.h"
    00047 #include "sph.h"
    00048 #include "spx.h"
    00049 #include "tab.h"
    00050 #include "wcs.h"
    00051 #include "wcserr.h"
    00052 #include "wcsfix.h"
    00053 #include "wcshdr.h"
    00054 #include "wcsmath.h"
    00055 #include "wcsprintf.h"
    00056 #include "wcstrig.h"
    00057 #include "wcsunits.h"
    00058 #include "wcsutil.h"
    00059
    00060 #endif /* WCSLIB_WCSLIB */
    00061
    01934   wcserr_enable(1);
    01935   wcsprintf_set(stderr);
    01936
    01937   ...
    01938
    01939   if (wcsset(&wcs) {
    01940     wcsperr(&wcs);
    01941     return wcs.err->status;
    01942   }
    01943 @endverbatim
    01944 In this example, if an error was generated in one of the prjset() functions,
    01945 wcsperr() would print an error traceback starting with wcsset(), then
    01946 celset(), and finally the particular projection-setting function that
    01947 generated the error.  For each of them it would print the status return value,
    01948 function name, source file, line number, and an error message which may be
    01949 more specific and informative than the general error messages reported in the
    01950 first example.  For example, in response to a deliberately generated error,
    01951 the @c twcs test program, which tests wcserr among other things, produces a
    01952 traceback similar to this:
    01953 @verbatim
    01954 ERROR 5 in wcsset() at line 1564 of file wcs.c:
    01955   Invalid parameter value.
    01956 ERROR 2 in celset() at line 196 of file cel.c:
    01957   Invalid projection parameters.
    01958 ERROR 2 in bonset() at line 5727 of file prj.c:
    01959   Invalid parameters for Bonne's projection.
    01960 @endverbatim
    01961
    01962 Each of the @ref structs "structs" in @ref overview "WCSLIB" includes a
    01963 pointer, called @a err, to a wcserr struct.  When an error occurs, a struct is
    01964 allocated and error information stored in it.  The wcserr pointers and the
    01965 @ref memory "memory" allocated for them are managed by the routines that
    01966 manage the various structs such as wcsini() and wcsfree().
    01967
    01968 wcserr messaging is an opt-in system enabled via wcserr_enable(), as in the
    01969 example above.  If enabled, when an error occurs it is the user's
    01970 responsibility to free the memory allocated for the error message using
    01971 wcsfree(), celfree(), prjfree(), etc.  Failure to do so before the struct goes
    01972 out of scope will result in memory leaks (if execution continues beyond the
    01973 error).
    01974 */
    01975
    01976