/** @file  slalib.h
*
*  @brief Simple wrapper of the required fortran SLALIB functions
*
*  @ingroup AstroImage
*
*  @author Robert DeSonia, MHPCC
*
*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
*  @date $Date: 2004-10-12 21:10:41 $
*
*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
*/

#ifndef SLALIB_H
#define SLALIB_H

#ifdef FORTRAN_UNDERSCORE_PREFIX
#ifdef FORTRAN_DOUBLE_UNDERSCORE_SUFFIX
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa _SLA_AOPPA__
#define fslaAopqk _SLA_AOPQK__
#define fslaOapqk _SLA_OAPQK__
#define fslaAirmas _SLA_AIRMAS__
#else
#define fslaAoppa _sla_aoppa__
#define fslaAopqk _sla_aopqk__
#define fslaOapqk _sla_oapqk__
#define fslaAirmas _sla_airmas__
#endif
#elif FORTRAN_NO_UNDERSCORE_SUFFIX
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa _SLA_AOPPA
#define fslaAopqk _SLA_AOPQK
#define fslaOapqk _SLA_OAPQK
#define fslaAirmas _SLA_AIRMAS
#else
#define fslaAoppa _sla_aoppa
#define fslaAopqk _sla_aopqk
#define fslaOapqk _sla_oapqk
#define fslaAirmas _sla_airmas
#endif
#else
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa _SLA_AOPPA_
#define fslaAopqk _SLA_AOPQK_
#define fslaOapqk _SLA_OAPQK_
#define fslaAirmas _SLA_AIRMAS_
#else
#define fslaAoppa _sla_aoppa_
#define fslaAopqk _sla_aopqk_
#define fslaOapqk _sla_oapqk_
#define fslaAirmas _sla_airmas_
#endif
#endif
#else
#ifdef FORTRAN_DOUBLE_UNDERSCORE_SUFFIX
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa SLA_AOPPA__
#define fslaAopqk SLA_AOPQK__
#define fslaOapqk SLA_OAPQK__
#define fslaAirmas SLA_AIRMAS__
#else
#define fslaAoppa sla_aoppa__
#define fslaAopqk sla_aopqk__
#define fslaOapqk sla_oapqk__
#define fslaAirmas sla_airmas__
#endif
#elif FORTRAN_NO_UNDERSCORE_SUFFIX
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa SLA_AOPPA
#define fslaAopqk SLA_AOPQK
#define fslaOapqk SLA_OAPQK
#define fslaAirmas SLA_AIRMAS
#else
#define fslaAoppa sla_aoppa
#define fslaAopqk sla_aopqk
#define fslaOapqk sla_oapqk
#define fslaAirmas sla_airmas
#endif
#else
#ifdef FORTRAN_UPPERCASE
#define fslaAoppa SLA_AOPPA_
#define fslaAopqk SLA_AOPQK_
#define fslaOapqk SLA_OAPQK_
#define fslaAirmas SLA_AIRMAS_
#else
#define fslaAoppa sla_aoppa_
#define fslaAopqk sla_aopqk_
#define fslaOapqk sla_oapqk_
#define fslaAirmas sla_airmas_
#endif
#endif
#endif

extern void fslaAoppa(
        const double* date,
        const double* dut,
        const double* elongm,
        const double* phim,
        const double* him,
        const double* xp,
        const double* yp,
        const double* tdk,
        const double* pmb,
        const double* rh,
        const double* wl,
        const double* tlr,
        double* AOPRMS
    );

extern void fslaAopqk(
        const double* RAP,
        const double* DAP,
        double* AOPRMS,
        double* AOB,
        double* ZOB,
        double* HOB,
        double* DOB,
        double* ROB
    );

extern void fslaOapqk(
        char* TYPE,
        const double* OB1,
        const double* OB2,
        double* AOPRMS,
        double* RAP,
        double* DAP
    );

extern double fslaAirmas(
        const double* zenithDistance
    );

/*
    void slaAoppa(date, dut, elongm, phim, hm, xp, yp, tdk, pmb, rh, wl, tlr, aoprms)
    
    PARAMETERS
    
    double date
    double dut
    double elongm
    double phim
    double hm
    double xp
    double yp
    double tdk
    double pmb
    double rh
    double wl
    double tlr
    double *aoprms
*/
#define slaAoppa(date,dut,elongm,phim,him,xp,yp,tdk,pmb,rh,wl,tlr,AOPRMS) \
fslaAoppa(&date,&dut,&elongm,&phim,&him,&xp,&yp,&tdk,&pmb,&rh,&wl,&tlr,AOPRMS)

/*
    void slaAopqk(rap, dap, aoprms, aob, zob, hob, dob, rob)
    
    PARAMETERS
    
    double rap
    double dap
    double *aoprms
    double *aob
    double *zob
    double *hob
    double *dob
    double *rob
*/

#define slaAopqk(RAP,DAP,AOPRMS,AOB,ZOB,HOB,DOB,ROB) \
fslaAopqk(&RAP,&DAP,AOPRMS,AOB,ZOB,HOB,DOB,ROB)

/*
    void slaOapqk(type, ob1, ob2, aoprms, rap, dap)
    
    PARAMETERS
    
    char *type
    double ob1
    double ob2
    double *aoprms
    double *rap
    double *dap
*/

#define slaOapqk(TYPE, OB1, OB2, AOPRMS, RAP, DAP) \
fslaOapqk(TYPE, &OB1, &OB2, AOPRMS, RAP, DAP)

/*
    double slaAirmas(zd)
    
    PARAMETERS
    
    double zd
*/
#define slaAirmas(ZD) fslaAirmas(&ZD)

#endif
