/* vdh_to_gse.f -- translated by f2c (version 20100827).
   You must link the resulting object file with libf2c:
	on Microsoft Windows system, link with libf2c.lib;
	on Linux or Unix systems, link with .../path/to/libf2c.a -lm
	or, if you install libf2c.a in a standard place, with -lf2c -lm
	-- in that order, at the end of the command line, as in
		cc *.o -lf2c -lm
	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,

		http://www.netlib.org/f2c/libf2c.zip
*/

#include "f2c.h"

/* Table of constant values */

static integer c__1 = 1;
static integer c__4 = 4;

/* Main program */ int MAIN__(void)
{
    /* Format strings */
    static char fmt_100[] = "(a,3i5)";
    static char fmt_200[] = "(a,3f10.5)";

    /* Builtin functions */
    integer s_wsfe(cilist *), e_wsfe(void), do_fio(integer *, char *, ftnlen),
	     s_rsle(cilist *), do_lio(integer *, integer *, char *, ftnlen), 
	    e_rsle(void);
    /* Subroutine */ int s_stop(char *, ftnlen);

    /* Local variables */
    static integer ih, im, is, iday;
    static real rlat, xgeo, ygeo, zgeo, xgse, ygse, zgse, xvdh, yvdh, zvdh, 
	    rlon;
    extern /* Subroutine */ int t_geo_to_gse__(real *, real *, real *, real *,
	     real *, real *), t_vdh_to_geo__(real *, real *, real *, real *, 
	    real *, real *, real *, real *);
    static integer iyear;
    extern /* Subroutine */ int cp_time_param__(integer *, integer *, integer 
	    *, integer *, integer *, integer *), r_date__(integer *, integer *
	    , integer *), r_time__(integer *, integer *, integer *);
    static integer imonth;

    /* Fortran I/O blocks */
    static cilist io___1 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___2 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___3 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___4 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___5 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___12 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___13 = { 0, 5, 0, 0, 0 };
    static cilist io___17 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___18 = { 0, 5, 0, 0, 0 };
    static cilist io___27 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___28 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___29 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___30 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___31 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___32 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___33 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___34 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___35 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___36 = { 0, 6, 0, fmt_200, 0 };



/*     ------------------------------------------------------------------ */

/* *   Rocot_Example of using Rocotlib */

/*     ------------------------------------------------------------------ */


    s_wsfe(&io___1);
    e_wsfe();
    s_wsfe(&io___2);
    do_fio(&c__1, "****************************************************", (
	    ftnlen)52);
    e_wsfe();
    s_wsfe(&io___3);
    e_wsfe();
    s_wsfe(&io___4);
    do_fio(&c__1, "vdh_to_gse:", (ftnlen)11);
    e_wsfe();
    s_wsfe(&io___5);
    e_wsfe();
/* L200: */

    r_date__(&iyear, &imonth, &iday);
    r_time__(&ih, &im, &is);
    cp_time_param__(&iyear, &imonth, &iday, &ih, &im, &is);

    s_wsfe(&io___12);
    do_fio(&c__1, "x,y,z in VDH ?", (ftnlen)14);
    e_wsfe();
    s_rsle(&io___13);
    do_lio(&c__4, &c__1, (char *)&xvdh, (ftnlen)sizeof(real));
    do_lio(&c__4, &c__1, (char *)&yvdh, (ftnlen)sizeof(real));
    do_lio(&c__4, &c__1, (char *)&zvdh, (ftnlen)sizeof(real));
    e_rsle();

    s_wsfe(&io___17);
    do_fio(&c__1, "lat et long en degre?", (ftnlen)21);
    e_wsfe();
    s_rsle(&io___18);
    do_lio(&c__4, &c__1, (char *)&rlat, (ftnlen)sizeof(real));
    do_lio(&c__4, &c__1, (char *)&rlon, (ftnlen)sizeof(real));
    e_rsle();
    rlat = rlat * 3.1415927f / 180.f;
    rlon = rlon * 3.1415927f / 180.f;

    t_vdh_to_geo__(&xvdh, &yvdh, &zvdh, &rlat, &rlon, &xgeo, &ygeo, &zgeo);
    t_geo_to_gse__(&xgeo, &ygeo, &zgeo, &xgse, &ygse, &zgse);
    s_wsfe(&io___27);
    e_wsfe();
    s_wsfe(&io___28);
    do_fio(&c__1, "date: MM/JJ/YY=", (ftnlen)15);
    do_fio(&c__1, (char *)&imonth, (ftnlen)sizeof(integer));
    do_fio(&c__1, (char *)&iday, (ftnlen)sizeof(integer));
    do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
    e_wsfe();
    s_wsfe(&io___29);
    do_fio(&c__1, "time: HH/MM/SS=", (ftnlen)15);
    do_fio(&c__1, (char *)&ih, (ftnlen)sizeof(integer));
    do_fio(&c__1, (char *)&im, (ftnlen)sizeof(integer));
    do_fio(&c__1, (char *)&is, (ftnlen)sizeof(integer));
    e_wsfe();
    s_wsfe(&io___30);
    e_wsfe();
    s_wsfe(&io___31);
    do_fio(&c__1, "xyz in VDH:", (ftnlen)11);
    do_fio(&c__1, (char *)&xvdh, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&yvdh, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&zvdh, (ftnlen)sizeof(real));
    e_wsfe();
    s_wsfe(&io___32);
    do_fio(&c__1, "xyz in GEO:", (ftnlen)11);
    do_fio(&c__1, (char *)&xgeo, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&ygeo, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&zgeo, (ftnlen)sizeof(real));
    e_wsfe();
    s_wsfe(&io___33);
    do_fio(&c__1, "xyz in GSE:", (ftnlen)11);
    do_fio(&c__1, (char *)&xgse, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&ygse, (ftnlen)sizeof(real));
    do_fio(&c__1, (char *)&zgse, (ftnlen)sizeof(real));
    e_wsfe();
    s_wsfe(&io___34);
    e_wsfe();
    s_wsfe(&io___35);
    do_fio(&c__1, "****************************************************", (
	    ftnlen)52);
    e_wsfe();
    s_wsfe(&io___36);
    e_wsfe();
    s_stop("vdh_to_gse.exe: normal termination", (ftnlen)34);
    return 0;
} /* MAIN__ */

/* Main program alias */ int vdh_to_gse__ () { MAIN__ (); return 0; }
