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
|
/*============================================================================
WCSLIB 7.4 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2021, 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.
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
$Id: spx_f.c,v 7.4 2021/01/31 02:24:52 mcalabre Exp $
*===========================================================================*/
#include <string.h>
#include <wcserr.h>
#include <wcsutil.h>
#include <spx.h>
// Fortran name mangling.
#include <wcsconfig_f77.h>
#define spxget_ F77_FUNC(spxget, SPXGET)
#define specx_ F77_FUNC(specx, SPECX)
// Must match the value set in spx.inc.
#define SPX_ERR 200
//----------------------------------------------------------------------------
int spxget_(const int *spx, const int *what, void *value)
{
unsigned int l;
int *ivalp;
const int *ispxp;
const struct spxprm *spxp;
// Cast pointers.
spxp = (const struct spxprm *)spx;
ivalp = (int *)value;
switch (*what) {
case SPX_ERR:
// Copy the contents of the wcserr struct.
if (spxp->err) {
ispxp = (int *)(spxp->err);
for (l = 0; l < ERRLEN; l++) {
*(ivalp++) = *(ispxp++);
}
} else {
for (l = 0; l < ERRLEN; l++) {
*(ivalp++) = 0;
}
}
break;
default:
return 1;
}
return 0;
}
int spxgti_(const int *spx, const int *what, int *value)
{
return spxget_(spx, what, value);
}
//----------------------------------------------------------------------------
int specx_(
const char type[4],
const double *spec,
const double *restfrq,
const double *restwav,
double *specs)
{
char type_[5];
wcsutil_strcvt(4, '\0', type, type_);
type_[4] = '\0';
return specx(type_, *spec, *restfrq, *restwav, (struct spxprm *)specs);
}
//----------------------------------------------------------------------------
#define SPX_FWRAP(scode, SCODE) \
int F77_FUNC(scode, SCODE)( \
const double *rest, \
const int *n1, \
const int *s1, \
const int *s2, \
const double spec1[], \
double spec2[], \
int stat[]) \
{return scode(*rest, *n1, *s1, *s2, spec1, spec2, stat);}
SPX_FWRAP(freqafrq, FREQAFRQ)
SPX_FWRAP(afrqfreq, AFRQFREQ)
SPX_FWRAP(freqener, FREQENER)
SPX_FWRAP(enerfreq, ENERFREQ)
SPX_FWRAP(freqwavn, FREQWAVN)
SPX_FWRAP(wavnfreq, WAVNFREQ)
SPX_FWRAP(freqvrad, FREQVRAD)
SPX_FWRAP(vradfreq, VRADFREQ)
SPX_FWRAP(freqwave, FREQWAVE)
SPX_FWRAP(wavefreq, WAVEFREQ)
SPX_FWRAP(freqawav, FREQAWAV)
SPX_FWRAP(awavfreq, AWAVFREQ)
SPX_FWRAP(freqvelo, FREQVELO)
SPX_FWRAP(velofreq, VELOFREQ)
SPX_FWRAP(wavevopt, WAVEVOPT)
SPX_FWRAP(voptwave, VOPTWAVE)
SPX_FWRAP(wavezopt, WAVEZOPT)
SPX_FWRAP(zoptwave, ZOPTWAVE)
SPX_FWRAP(waveawav, WAVEAWAV)
SPX_FWRAP(awavwave, AWAVWAVE)
SPX_FWRAP(wavevelo, WAVEVELO)
SPX_FWRAP(velowave, VELOWAVE)
SPX_FWRAP(awavvelo, AWAVVELO)
SPX_FWRAP(veloawav, VELOAWAV)
SPX_FWRAP(velobeta, VELOBETA)
SPX_FWRAP(betavelo, BETAVELO)
|