cvs: /php4/ext/mcal php_mcal.c php_mcal.h

From: Date: Sat, 11 Mar 2000 02:15:13 +0000
Subject: cvs: /php4/ext/mcal php_mcal.c php_mcal.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-11903@lists.php.net to get a copy of this message
chagenbu Fri Mar 10 18:15:13 2000 EDT Modified files: /php4/ext/mcal php_mcal.c php_mcal.h Log: Add mcal_week_of_year(), submitted by jtaskine@hit.fi. Index: php4/ext/mcal/php_mcal.c diff -u php4/ext/mcal/php_mcal.c:1.11 php4/ext/mcal/php_mcal.c:1.12 --- php4/ext/mcal/php_mcal.c:1.11 Mon Mar 6 10:41:11 2000 +++ php4/ext/mcal/php_mcal.c Fri Mar 10 18:15:13 2000 @@ -107,6 +107,7 @@ PHP_FE(mcal_time_valid,NULL) PHP_FE(mcal_day_of_week,NULL) PHP_FE(mcal_day_of_year,NULL) + PHP_FE(mcal_week_of_year,NULL) PHP_FE(mcal_date_compare,NULL) PHP_FE(mcal_event_init,NULL) PHP_FE(mcal_next_recurrence,NULL) @@ -1252,6 +1253,31 @@ dt_setdate(&mydate,year->value.lval,month->value.lval, day->value.lval); RETURN_LONG(dt_dayofyear(&mydate)); +} +/* }}} */ + +/* {{{ proto int mcal_week_of_year(int year, int month, int day) + Returns the week number of the given date */ +PHP_FUNCTION(mcal_week_of_year) +{ + pval *year, *month, *day; + int myargc; + + myargc = ARG_COUNT(ht); + if (myargc != 3 || getParameters(ht,myargc,&year,&month,&day) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(year); + convert_to_long(month); + convert_to_long(day); + + if (datevalid(year->value.lval,month->value.lval,day->value.lval)) { + RETURN_LONG(dt_weekofyear(day->value.lval,month->value.lval,year->value.lval)); + } + else { + RETURN_FALSE; + } } /* }}} */ Index: php4/ext/mcal/php_mcal.h diff -u php4/ext/mcal/php_mcal.h:1.5 php4/ext/mcal/php_mcal.h:1.6 --- php4/ext/mcal/php_mcal.h:1.5 Sat Mar 4 21:36:33 2000 +++ php4/ext/mcal/php_mcal.h Fri Mar 10 18:15:13 2000 @@ -1,4 +1,4 @@ -/* $Id: php_mcal.h,v 1.5 2000/03/05 05:36:33 chagenbu Exp $ */ +/* $Id: php_mcal.h,v 1.6 2000/03/11 02:15:13 chagenbu Exp $ */ #ifndef _INCLUDED_MCAL_H #define _INCLUDED_MCAL_H @@ -65,6 +65,7 @@ PHP_FUNCTION(mcal_time_valid); PHP_FUNCTION(mcal_day_of_week); PHP_FUNCTION(mcal_day_of_year); +PHP_FUNCTION(mcal_week_of_year); PHP_FUNCTION(mcal_date_compare); PHP_FUNCTION(mcal_event_init); PHP_FUNCTION(mcal_next_recurrence);

« previous php.version4 (#11903) next »