00001 /*============================================================================ 00002 00003 WCSLIB 4.7 - an implementation of the FITS WCS standard. 00004 Copyright (C) 1995-2011, 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 Correspondence concerning WCSLIB may be directed to: 00022 Internet email: mcalabre@atnf.csiro.au 00023 Postal address: Dr. Mark Calabretta 00024 Australia Telescope National Facility, CSIRO 00025 PO Box 76 00026 Epping NSW 1710 00027 AUSTRALIA 00028 00029 Author: Mark Calabretta, Australia Telescope National Facility 00030 http://www.atnf.csiro.au/~mcalabre/index.html 00031 $Id: wcsutil.h,v 4.7 2011/02/07 07:03:42 cal103 Exp $ 00032 *============================================================================= 00033 * 00034 * Summary of the wcsutil routines 00035 * ------------------------------- 00036 * Simple utility functions used by WCSLIB. They are documented here solely as 00037 * an aid to understanding the code. Thay are not intended for external use - 00038 * the API may change without notice! 00039 * 00040 * 00041 * wcsutil_blank_fill() - Fill a character string with blanks 00042 * ---------------------------------------------------------- 00043 * wcsutil_blank_fill() pads a character string with blanks starting with the 00044 * terminating NULL character. 00045 * 00046 * Used by the Fortran wrapper functions in translating C character strings 00047 * into Fortran CHARACTER variables. 00048 * 00049 * Given: 00050 * n int Length of the character array, c[]. 00051 * 00052 * Given and returned: 00053 * c char[] The character string. It will not be null-terminated 00054 * on return. 00055 * 00056 * Function return value: 00057 * void 00058 * 00059 * 00060 * wcsutil_null_fill() - Fill a character string with NULLs 00061 * -------------------------------------------------------- 00062 * wcsutil_null_fill() strips off trailing blanks and pads the character array 00063 * holding the string with NULL characters. 00064 * 00065 * Used mainly to make character strings intelligible in the GNU debugger which 00066 * prints the rubbish following the terminating NULL, obscuring the valid part 00067 * of the string. 00068 * 00069 * Given: 00070 * n int Number of characters. 00071 * 00072 * Given and returned: 00073 * c char[] The character string. 00074 * 00075 * Function return value: 00076 * void 00077 * 00078 * 00079 * wcsutil_allEq() - Test for equality of a particular vector element 00080 * ------------------------------------------------------------------ 00081 * wcsutil_allEq() tests for equality of a particular element in a set of 00082 * vectors. 00083 * 00084 * Given: 00085 * nvec int The number of vectors. 00086 * nelem int The length of each vector. 00087 * first const double* 00088 * Pointer to the first element to test in the array. 00089 * The elements tested for equality are 00090 * 00091 = *first == *(first + nelem) 00092 = == *(first + nelem*2) 00093 = : 00094 = == *(first + nelem*(nvec-1)); 00095 * 00096 * The array might be dimensioned as 00097 * 00098 = double v[nvec][nelem]; 00099 * 00100 * Function return value: 00101 * int Status return value: 00102 * 0: Not all equal. 00103 * 1: All equal. 00104 * 00105 * 00106 * wcsutil_setAll() - Set a particular vector element 00107 * -------------------------------------------------- 00108 * wcsutil_setAll() sets the value of a particular element in a set of vectors. 00109 * 00110 * Given: 00111 * nvec int The number of vectors. 00112 * nelem int The length of each vector. 00113 * 00114 * Given and returned: 00115 * first double* Pointer to the first element in the array, the value 00116 * of which is used to set the others 00117 * 00118 = *(first + nelem) = *first; 00119 = *(first + nelem*2) = *first; 00120 = : 00121 = *(first + nelem*(nvec-1)) = *first; 00122 * 00123 * The array might be dimensioned as 00124 * 00125 = double v[nvec][nelem]; 00126 * 00127 * Function return value: 00128 * void 00129 * 00130 * 00131 * wcsutil_setAli() - Set a particular vector element 00132 * -------------------------------------------------- 00133 * wcsutil_setAli() sets the value of a particular element in a set of vectors. 00134 * 00135 * Given: 00136 * nvec int The number of vectors. 00137 * nelem int The length of each vector. 00138 * 00139 * Given and returned: 00140 * first int* Pointer to the first element in the array, the value 00141 * of which is used to set the others 00142 * 00143 = *(first + nelem) = *first; 00144 = *(first + nelem*2) = *first; 00145 = : 00146 = *(first + nelem*(nvec-1)) = *first; 00147 * 00148 * The array might be dimensioned as 00149 * 00150 = int v[nvec][nelem]; 00151 * 00152 * Function return value: 00153 * void 00154 * 00155 * 00156 * wcsutil_setBit() - Set bits in selected elements of an array 00157 * ------------------------------------------------------------ 00158 * wcsutil_setBit() sets bits in selected elements of an array. 00159 * 00160 * Given: 00161 * nelem int Number of elements in the array. 00162 * sel const int* 00163 * Address of a selection array of length nelem. 00164 * May be specified as the null pointer in which case all 00165 * elements are selected. 00166 * bits int Bit mask. 00167 * 00168 * Given and returned: 00169 * array int* Address of the array of length nelem. 00170 * 00171 * Function return value: 00172 * void 00173 * 00174 *===========================================================================*/ 00175 00176 #ifndef WCSLIB_WCSUTIL 00177 #define WCSLIB_WCSUTIL 00178 00179 void wcsutil_blank_fill(int n, char c[]); 00180 void wcsutil_null_fill (int n, char c[]); 00181 00182 int wcsutil_allEq (int nvec, int nelem, const double *first); 00183 void wcsutil_setAll(int nvec, int nelem, double *first); 00184 void wcsutil_setAli(int nvec, int nelem, int *first); 00185 void wcsutil_setBit(int nelem, const int *sel, int bits, int *array); 00186 00187 #endif /* WCSLIB_WCSUTIL */