On Fri, Feb 10, 2012 at 10:49 AM, Olе Streicher
<[log in to unmask]> wrote:
> Tim Jenness <[log in to unmask]> writes:
>>>> If you look hard in sla.c you will find an obfuscated version of
>>>> slaDeuler.
>
>>> Would you mind if I would just copy the palDeuler method to (debian's)
>>> slalib?
>
>> You'll need to make a SOFA package first since PAL calls SOFA (I
>> thought it was crazy to re-implement all the SOFA routines in PAL).
>
> OK, so I have to stay with the Fortran version -- not a big deal here
> since I use gfortran -frecursive.
>
It's a big deal for me. I wish you'd just wait until PAL is ready and
then just use that.
> Could you check if this code is correct there?
>
> ---------------------------8<--------------------------------------------
> F77_SUBROUTINE(sla_deuler) ( CHARACTER(ORDER),
> DOUBLE(PHI),
> DOUBLE(THETA),
> DOUBLE(PSI),
> DOUBLE_ARRAY(RMAT) TRAIL(STRING) );
>
> void slaDeuler ( const char *order, double phi, double theta, double psi,
> double rmat[3][3] ) {
> DECLARE_CHARACTER_DYN(ORDER);
> DECLARE_DOUBLE(PHI);
> DECLARE_DOUBLE(THETA);
> DECLARE_DOUBLE(PSI);
> DECLARE_DOUBLE_ARRAY(RMAT,9);
> F77_EXPORT_DOUBLE(phi, PHI);
> F77_EXPORT_DOUBLE(theta, THETA);
> F77_EXPORT_DOUBLE(psi, PSI);
> F77_CREATE_EXPORT_CHARACTER( order, ORDER );
> F77_LOCK( F77_CALL(sla_deuler)( CHARACTER_ARG(ORDER),
> DOUBLE_ARG(&PHI),
> DOUBLE_ARG(&THETA),
> DOUBLE_ARG(&PSI),
> DOUBLE_ARRAY_ARG(RMAT) TRAIL_ARG(ORDER)); )
> F77_IMPORT_DOUBLE_ARRAY(RMAT, rmat, 9);
> F77_FREE_CHARACTER(ORDER);
> }
If you look in the git history you'll find the original version. Given
the patching how are people going to distinguish proper SLA/F from a
Debian hacked version?
> ---------------------------8<--------------------------------------------
>
> BTW, do you know that there is an excellent header file "cfortran.h"
> that would make the conversion much simpler? With this, the code above
> would just be a header file:
>
CNF is actually excellent and handles more than simply providing
macros for C wrappers. You will find that a lot of the CNF code above
is due to overly pedantic worries concerning things like old VMS
compilers where C strings weren't really char*. If some extra
assumptions were allowed and we dropped the old VMS oddities it would
also be very simple (as you'll see if you look at the code after the
pre-processor is used).
> -----------------------------8<-------------------------------------------
> #include "cfortran.h"
>
> PROTOCCALLSFSUBr(SLA_DEULER,sla_deuler,STRING,DOUBLE,DOUBLE,DOUBLE,PDOUBLEVV)
> #define slaDeuler(order, phi, theta, psi,rmat) \
> CCALLSFSUB5(SLA_DEULER,sla_deuler,STRING,DOUBLE,DOUBLE,DOUBLE,PDOUBLEVV, \
> order, phi, theta, psi,rmat)
> -----------------------------8<-------------------------------------------
>
> Best regards
>
> Ole
|