1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
|
/*============================================================================
WCSLIB 4.8 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2011, 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/>.
Correspondence concerning WCSLIB may be directed to:
Internet email: mcalabre@atnf.csiro.au
Postal address: Dr. Mark Calabretta
Australia Telescope National Facility, CSIRO
PO Box 76
Epping NSW 1710
AUSTRALIA
Author: Mark Calabretta, Australia Telescope National Facility
http://www.atnf.csiro.au/~mcalabre/index.html
$Id: cel_f.c,v 4.8.1.1 2011/08/15 08:07:07 cal103 Exp cal103 $
*===========================================================================*/
#include <stdio.h>
#include <cel.h>
/* Fortran name mangling. */
#include <wcsconfig_f77.h>
#define celini_ F77_FUNC(celini, CELINI)
#define celput_ F77_FUNC(celput, CELPUT)
#define celget_ F77_FUNC(celget, CELGET)
#define celfree_ F77_FUNC(celfree, CELFREE)
#define celprt_ F77_FUNC(celprt, CELPRT)
#define celset_ F77_FUNC(celset, CELSET)
#define celx2s_ F77_FUNC(celx2s, CELX2S)
#define cels2x_ F77_FUNC(cels2x, CELS2X)
#define celptc_ F77_FUNC(celptc, CELPTC)
#define celptd_ F77_FUNC(celptd, CELPTD)
#define celpti_ F77_FUNC(celpti, CELPTI)
#define celgtc_ F77_FUNC(celgtc, CELGTC)
#define celgtd_ F77_FUNC(celgtd, CELGTD)
#define celgti_ F77_FUNC(celgti, CELGTI)
#define CEL_FLAG 100
#define CEL_OFFSET 101
#define CEL_PHI0 102
#define CEL_THETA0 103
#define CEL_REF 104
#define CEL_PRJ 105
#define CEL_EULER 200
#define CEL_LATPRQ 201
#define CEL_ISOLAT 202
#define CEL_ERR 203
/*--------------------------------------------------------------------------*/
int celini_(int *cel)
{
return celini((struct celprm *)cel);
}
/*--------------------------------------------------------------------------*/
int celput_(int *cel, const int *what, const void *value, const int *i)
{
int k;
int *icelp;
const int *ivalp;
const double *dvalp;
struct celprm *celp;
/* Cast pointers. */
celp = (struct celprm *)cel;
ivalp = (const int *)value;
dvalp = (const double *)value;
celp->flag = 0;
switch (*what) {
case CEL_FLAG:
celp->flag = *ivalp;
break;
case CEL_OFFSET:
celp->offset = *ivalp;
break;
case CEL_PHI0:
celp->phi0 = *dvalp;
break;
case CEL_THETA0:
celp->theta0 = *dvalp;
break;
case CEL_REF:
celp->ref[*i-1] = *dvalp;
break;
case CEL_PRJ:
k = (int *)(&(celp->prj)) - (int *)celp;
icelp = cel + k;
for (k = 0; k < PRJLEN; k++) {
*(icelp++) = *(ivalp++);
}
break;
default:
return 1;
}
return 0;
}
int celptc_(int *cel, const int *what, const char *value, const int *i)
{
return celput_(cel, what, value, i);
}
int celptd_(int *cel, const int *what, const double *value, const int *i)
{
return celput_(cel, what, value, i);
}
int celpti_(int *cel, const int *what, const int *value, const int *i)
{
return celput_(cel, what, value, i);
}
/*--------------------------------------------------------------------------*/
int celget_(const int *cel, const int *what, void *value)
{
int k;
int *ivalp;
double *dvalp;
const int *icelp;
const struct celprm *celp;
/* Cast pointers. */
celp = (const struct celprm *)cel;
ivalp = (int *)value;
dvalp = (double *)value;
switch (*what) {
case CEL_FLAG:
*ivalp = celp->flag;
break;
case CEL_OFFSET:
*ivalp = celp->offset;
break;
case CEL_PHI0:
*dvalp = celp->phi0;
break;
case CEL_THETA0:
*dvalp = celp->theta0;
break;
case CEL_REF:
for (k = 0; k < 4; k++) {
*(dvalp++) = celp->ref[k];
}
break;
case CEL_PRJ:
icelp = (int *)(&(celp->prj));
for (k = 0; k < PRJLEN; k++) {
*(ivalp++) = *(icelp++);
}
break;
case CEL_EULER:
for (k = 0; k < 5; k++) {
*(dvalp++) = celp->euler[k];
}
break;
case CEL_LATPRQ:
*ivalp = celp->latpreq;
break;
case CEL_ISOLAT:
*ivalp = celp->isolat;
break;
case CEL_ERR:
/* Copy the contents of the wcserr struct. */
if (celp->err) {
icelp = (int *)(celp->err);
for (k = 0; k < ERRLEN; k++) {
*(ivalp++) = *(icelp++);
}
} else {
for (k = 0; k < ERRLEN; k++) {
*(ivalp++) = 0;
}
}
break;
default:
return 1;
}
return 0;
}
int celgtc_(const int *cel, const int *what, char *value)
{
return celget_(cel, what, value);
}
int celgtd_(const int *cel, const int *what, double *value)
{
return celget_(cel, what, value);
}
int celgti_(const int *cel, const int *what, int *value)
{
return celget_(cel, what, value);
}
/*--------------------------------------------------------------------------*/
int celfree_(int *cel)
{
return celfree((struct celprm *)cel);
}
/*--------------------------------------------------------------------------*/
int celprt_(int *cel)
{
/* This may or may not force the Fortran I/O buffers to be flushed. If
* not, try CALL FLUSH(6) before calling CELPRT in the Fortran code. */
fflush(NULL);
return celprt((struct celprm *)cel);
}
/*--------------------------------------------------------------------------*/
int celset_(int *cel)
{
return celset((struct celprm *)cel);
}
/*--------------------------------------------------------------------------*/
int celx2s_(
int *cel,
const int *nx,
const int *ny,
const int *sxy,
const int *sll,
const double x[],
const double y[],
double phi[],
double theta[],
double lng[],
double lat[],
int stat[])
{
return celx2s((struct celprm *)cel, *nx, *ny, *sxy, *sll, x, y, phi, theta,
lng, lat, stat);
}
/*--------------------------------------------------------------------------*/
int cels2x_(
int *cel,
const int *nlng,
const int *nlat,
const int *sll,
const int *sxy,
const double lng[],
const double lat[],
double phi[],
double theta[],
double x[],
double y[],
int stat[])
{
return cels2x((struct celprm *)cel, *nlng, *nlat, *sll, *sxy, lng, lat,
phi, theta, x, y, stat);
}
|