00001 /*============================================================================ 00002 00003 WCSLIB 4.4 - an implementation of the FITS WCS standard. 00004 Copyright (C) 1995-2009, 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_8h-source.html,v 1.1 2009/09/14 20:25:25 irby 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() pads a character string with NULL characters. 00063 * 00064 * Used mainly to make character strings intelligible in the GNU debugger - it 00065 * prints the rubbish following the terminating NULL, obscuring the valid part 00066 * of the string. 00067 * 00068 * Given: 00069 * n int Number of characters. 00070 * 00071 * Given and returned: 00072 * c char[] The character string. 00073 * 00074 * Function return value: 00075 * void 00076 * 00077 * 00078 * wcsutil_allEq() - Test for equality of a particular vector element 00079 * ------------------------------------------------------------------ 00080 * wcsutil_allEq() tests for equality of a particular element in a set of 00081 * vectors. 00082 * 00083 * Given: 00084 * nvec int The number of vectors. 00085 * nelem int The length of each vector. 00086 * first const double* 00087 * Pointer to the first element to test in the array. 00088 * The elements tested for equality are 00089 * 00090 = *first == *(first + nelem) 00091 = == *(first + nelem*2) 00092 = : 00093 = == *(first + nelem*(nvec-1)); 00094 * 00095 * The array might be dimensioned as 00096 * 00097 = double v[nvec][nelem]; 00098 * 00099 * Function return value: 00100 * int Status return value: 00101 * 0: Not all equal. 00102 * 1: All equal. 00103 * 00104 * 00105 * wcsutil_setAll() - Set a particular vector element 00106 * -------------------------------------------------- 00107 * wcsutil_setAll() sets the value of a particular element in a set of vectors. 00108 * 00109 * Given: 00110 * nvec int The number of vectors. 00111 * nelem int The length of each vector. 00112 * 00113 * Given and returned: 00114 * first double* Pointer to the first element in the array, the value 00115 * of which is used to set the others 00116 * 00117 = *(first + nelem) = *first; 00118 = *(first + nelem*2) = *first; 00119 = : 00120 = *(first + nelem*(nvec-1)) = *first; 00121 * 00122 * The array might be dimensioned as 00123 * 00124 = double v[nvec][nelem]; 00125 * 00126 * Function return value: 00127 * void 00128 * 00129 * 00130 * wcsutil_setAli() - Set a particular vector element 00131 * -------------------------------------------------- 00132 * wcsutil_setAli() sets the value of a particular element in a set of vectors. 00133 * 00134 * Given: 00135 * nvec int The number of vectors. 00136 * nelem int The length of each vector. 00137 * 00138 * Given and returned: 00139 * first int* Pointer to the first element in the array, the value 00140 * of which is used to set the others 00141 * 00142 = *(first + nelem) = *first; 00143 = *(first + nelem*2) = *first; 00144 = : 00145 = *(first + nelem*(nvec-1)) = *first; 00146 * 00147 * The array might be dimensioned as 00148 * 00149 = int v[nvec][nelem]; 00150 * 00151 * Function return value: 00152 * void 00153 * 00154 * 00155 * wcsutil_setBit() - Set bits in selected elements of an array 00156 * ------------------------------------------------------------ 00157 * wcsutil_setBit() sets bits in selected elements of an array. 00158 * 00159 * Given: 00160 * nelem int Number of elements in the array. 00161 * sel const int* 00162 * Address of a selection array of length nelem. 00163 * May be specified as the null pointer in which case all 00164 * elements are selected. 00165 * bits int Bit mask. 00166 * 00167 * Given and returned: 00168 * array int* Address of the array of length nelem. 00169 * 00170 * Function return value: 00171 * void 00172 * 00173 *===========================================================================*/ 00174 00175 #ifndef WCSLIB_WCSUTIL 00176 #define WCSLIB_WCSUTIL 00177 00178 void wcsutil_blank_fill(int n, char c[]); 00179 void wcsutil_null_fill (int n, char c[]); 00180 00181 int wcsutil_allEq (int nvec, int nelem, const double *first); 00182 void wcsutil_setAll(int nvec, int nelem, double *first); 00183 void wcsutil_setAli(int nvec, int nelem, int *first); 00184 void wcsutil_setBit(int nelem, const int *sel, int bits, int *array); 00185 00186 #endif /* WCSLIB_WCSUTIL */