/* test_week.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__2 = 2;

/* Main program */ int MAIN__(void)
{
    /* Format strings */
    static char fmt_200[] = "(a,i4,a,i5,i3,i3)";
    static char fmt_100[] = "(2a)";
    static char fmt_300[] = "(a,i5,i3,i3,2a)";
    static char fmt_400[] = "(a,i5,i3,i3,a,i3)";

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

    /* Local variables */
    extern /* Subroutine */ int cv_date_to_weekn__(integer *, integer *, 
	    integer *, integer *), cv_weekn_to_date__(integer *, integer *, 
	    integer *, integer *);
    static integer iy;
    static char cday[9], cday1[9], cday2[9];
    static integer iday1, iday2, idow1, imon1, imon2, idow2, nbcha, iyear, 
	    iweek1, iweek2, iyear1, iyear2, idoty1, idoty2;
    extern /* Subroutine */ int cp_fr_day_name__(integer *, char *, integer *,
	     ftnlen), cv_date_to_dotw__(integer *, integer *, integer *, 
	    integer *), cv_date_to_doty__(integer *, integer *, integer *, 
	    integer *), cv_doty_to_date__(integer *, integer *, integer *, 
	    integer *);

    /* Fortran I/O blocks */
    static cilist io___3 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___4 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___5 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___11 = { 0, 6, 0, fmt_100, 0 };
    static cilist io___12 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___13 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___20 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___21 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___24 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___25 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___26 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___27 = { 0, 6, 0, fmt_200, 0 };
    static cilist io___31 = { 0, 6, 0, fmt_300, 0 };
    static cilist io___32 = { 0, 6, 0, fmt_300, 0 };
    static cilist io___33 = { 0, 6, 0, fmt_400, 0 };
    static cilist io___34 = { 0, 6, 0, fmt_400, 0 };


/*     ***************************************************************0** */
/* *   Test_Week: test procedures concerning date and week in the year */
/*     P. Robert, Dec 2006 */
/*     ***************************************************************0** */
    for (iy = 1998; iy <= 2018; ++iy) {
	iyear = iy;
	s_wsfe(&io___3);
	do_fio(&c__1, "------------", (ftnlen)12);
	e_wsfe();
	s_wsfe(&io___4);
	do_fio(&c__1, "annee ", (ftnlen)6);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___5);
	do_fio(&c__1, "------------", (ftnlen)12);
	e_wsfe();
	cv_date_to_dotw__(&iyear, &c__1, &c__1, &idow1);
	cp_fr_day_name__(&idow1, cday, &nbcha, (ftnlen)9);
	cv_date_to_weekn__(&iyear, &c__1, &c__1, &iweek1);
	cv_date_to_weekn__(&iyear, &c__2, &c__1, &iweek2);

	s_wsfe(&io___11);
	do_fio(&c__1, "Le premier jour de l'annee est un ", (ftnlen)34);
	do_fio(&c__1, cday, nbcha);
	e_wsfe();
	s_wsfe(&io___12);
	do_fio(&c__1, "Le premier janvier est la semaine ", (ftnlen)34);
	do_fio(&c__1, (char *)&iweek1, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___13);
	do_fio(&c__1, "Le premier fevrier est la semaine ", (ftnlen)34);
	do_fio(&c__1, (char *)&iweek2, (ftnlen)sizeof(integer));
	e_wsfe();
/* L300: */
/* L400: */

	iyear1 = iyear;
	iyear2 = iyear;
	cv_weekn_to_date__(&iweek1, &iyear1, &imon1, &iday1);
	cv_weekn_to_date__(&iweek2, &iyear2, &imon2, &iday2);
	s_wsfe(&io___20);
	do_fio(&c__1, "la semaine ", (ftnlen)11);
	do_fio(&c__1, (char *)&iweek1, (ftnlen)sizeof(integer));
	do_fio(&c__1, " correspondant a", (ftnlen)16);
	do_fio(&c__1, (char *)&iyear1, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon1, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday1, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___21);
	do_fio(&c__1, "la semaine ", (ftnlen)11);
	do_fio(&c__1, (char *)&iweek2, (ftnlen)sizeof(integer));
	do_fio(&c__1, " correspondant a", (ftnlen)16);
	do_fio(&c__1, (char *)&iyear2, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon2, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday2, (ftnlen)sizeof(integer));
	e_wsfe();
	cv_date_to_doty__(&iyear, &c__1, &c__1, &idoty1);
	cv_date_to_doty__(&iyear, &c__2, &c__1, &idoty2);
	s_wsfe(&io___24);
	do_fio(&c__1, "Le premier janvier est le jour num. ", (ftnlen)36);
	do_fio(&c__1, (char *)&idoty1, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___25);
	do_fio(&c__1, "Le premier fevrier est le jour num. ", (ftnlen)36);
	do_fio(&c__1, (char *)&idoty2, (ftnlen)sizeof(integer));
	e_wsfe();
	cv_doty_to_date__(&idoty1, &iyear, &imon1, &iday1);
	cv_doty_to_date__(&idoty2, &iyear, &imon2, &iday2);
	s_wsfe(&io___26);
	do_fio(&c__1, "et le jour ", (ftnlen)11);
	do_fio(&c__1, (char *)&idoty1, (ftnlen)sizeof(integer));
	do_fio(&c__1, " est le ", (ftnlen)8);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon1, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday1, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___27);
	do_fio(&c__1, "et le jour ", (ftnlen)11);
	do_fio(&c__1, (char *)&idoty2, (ftnlen)sizeof(integer));
	do_fio(&c__1, " est le ", (ftnlen)8);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon2, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday2, (ftnlen)sizeof(integer));
	e_wsfe();
	cv_date_to_dotw__(&iyear, &imon1, &iday1, &idow1);
	cv_date_to_dotw__(&iyear, &imon2, &iday2, &idow2);
	cp_fr_day_name__(&idow1, cday1, &nbcha, (ftnlen)9);
	cp_fr_day_name__(&idow2, cday2, &nbcha, (ftnlen)9);
	s_wsfe(&io___31);
	do_fio(&c__1, "et ", (ftnlen)3);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon1, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday1, (ftnlen)sizeof(integer));
	do_fio(&c__1, " est un ", (ftnlen)8);
	do_fio(&c__1, cday1, (ftnlen)9);
	e_wsfe();
	s_wsfe(&io___32);
	do_fio(&c__1, "et ", (ftnlen)3);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon2, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday2, (ftnlen)sizeof(integer));
	do_fio(&c__1, " est un ", (ftnlen)8);
	do_fio(&c__1, cday2, (ftnlen)9);
	e_wsfe();
	cv_date_to_weekn__(&iyear, &imon1, &iday1, &iweek1);
	cv_date_to_weekn__(&iyear, &imon2, &iday2, &iweek2);
	s_wsfe(&io___33);
	do_fio(&c__1, "et le ", (ftnlen)6);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon1, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday1, (ftnlen)sizeof(integer));
	do_fio(&c__1, " donne la semaine ", (ftnlen)18);
	do_fio(&c__1, (char *)&iweek1, (ftnlen)sizeof(integer));
	e_wsfe();
	s_wsfe(&io___34);
	do_fio(&c__1, "et le ", (ftnlen)6);
	do_fio(&c__1, (char *)&iyear, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&imon2, (ftnlen)sizeof(integer));
	do_fio(&c__1, (char *)&iday2, (ftnlen)sizeof(integer));
	do_fio(&c__1, " donne la semaine ", (ftnlen)18);
	do_fio(&c__1, (char *)&iweek2, (ftnlen)sizeof(integer));
	e_wsfe();
    }
    s_stop("test_week.exe: normal termination", (ftnlen)33);
    return 0;
} /* MAIN__ */

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