cvs: /php4/ext/calendar Makefile.in calendar.c easter.c php_calendar.h

From: Date: Sun, 16 Apr 2000 11:40:50 +0000
Subject: cvs: /php4/ext/calendar Makefile.in calendar.c easter.c php_calendar.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-13604@lists.php.net to get a copy of this message
hholzgra Sun Apr 16 04:40:50 2000 EDT Modified files: /php4/ext/calendar Makefile.in calendar.c easter.c php_calendar.h Log: added unixtojd() and jdtounix() to convert from unix time_t to Julian Days and vice versa Index: php4/ext/calendar/Makefile.in diff -u php4/ext/calendar/Makefile.in:1.1 php4/ext/calendar/Makefile.in:1.2 --- php4/ext/calendar/Makefile.in:1.1 Sat Apr 15 13:35:09 2000 +++ php4/ext/calendar/Makefile.in Sun Apr 16 04:40:19 2000 @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.1 2000/04/15 20:35:09 hholzgra Exp $ +# $Id: Makefile.in,v 1.2 2000/04/16 11:40:19 hholzgra Exp $ DEPTH = ../.. topsrcdir = @topsrcdir@ @@ -6,6 +6,6 @@ VPATH = @srcdir@ LTLIBRARY_NAME = libcalendar.la -LTLIBRARY_SOURCES = calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c +LTLIBRARY_SOURCES = calendar.c dow.c french.c gregor.c jewish.c julian.c easter.c cal_unix.c include $(topsrcdir)/build/ltlib.mk Index: php4/ext/calendar/calendar.c diff -u php4/ext/calendar/calendar.c:1.1 php4/ext/calendar/calendar.c:1.2 --- php4/ext/calendar/calendar.c:1.1 Sat Apr 15 13:35:09 2000 +++ php4/ext/calendar/calendar.c Sun Apr 16 04:40:19 2000 @@ -1,9 +1,23 @@ -/* interface functions. - - * code by Shane Caraveo shane@caraveo.com - * copy freely! - * +/* + +----------------------------------------------------------------------+ + | PHP version 4.0 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_01.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Shane Caraveo <shane@caraveo.com> | + | Colin Viebrock <cmv@easydns.com> | + | Hartmut Holzgraefe <hartmut@six.de> | + +----------------------------------------------------------------------+ */ +/* $Id: */ #include "php.h" #include "php_calendar.h" @@ -22,6 +36,8 @@ PHP_FE(jdmonthname, NULL) PHP_FE(easter_date, NULL) PHP_FE(easter_days, NULL) + PHP_FE(unixtojd, NULL) + PHP_FE(jdtounix, NULL) {NULL, NULL, NULL} }; @@ -222,26 +238,30 @@ } /* }}} */ -/* {{{ proto mixed jddayofweek(int juliandaycount, int mode) +/* {{{ proto mixed jddayofweek(int juliandaycount, [int mode]) Returns name or number of day of week from julian day count */ PHP_FUNCTION(jddayofweek) { - pval **julday, **mode; + pval *julday, *mode; int day; char *daynamel, *daynames; - - if (zend_get_parameters_ex(2, &julday, &mode) != SUCCESS) { + int myargc=ARG_COUNT(ht),mymode=0; + + if ((myargc < 1) || (myargc > 2) || (zend_get_parameters(ht,myargc, &julday, &mode) != SUCCESS)) { WRONG_PARAM_COUNT; } - convert_to_long_ex(julday); - convert_to_long_ex(mode); + convert_to_long(julday); + if(myargc==2) { + convert_to_long(mode); + mymode = mode->value.lval; + } - day = DayOfWeek((*julday)->value.lval); + day = DayOfWeek(julday->value.lval); daynamel = DayNameLong[day]; daynames = DayNameShort[day]; - switch ((*mode)->value.lval) { + switch (mymode) { case 0L: RETURN_LONG(day); break; Index: php4/ext/calendar/easter.c diff -u php4/ext/calendar/easter.c:1.1 php4/ext/calendar/easter.c:1.2 --- php4/ext/calendar/easter.c:1.1 Sat Apr 15 13:35:09 2000 +++ php4/ext/calendar/easter.c Sun Apr 16 04:40:19 2000 @@ -1,31 +1,23 @@ /* +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | + | PHP version 4.0 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-9 PHP Development Team (See Credits file) | + | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group | +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) the GNU General Public License as published by the Free Software | - | Foundation; either version 2 of the License, or (at your option) | - | any later version. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | This program is distributed in the hope that it will be useful, | - | but WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - | GNU General Public License for more details. | - | | - | You should have received a copy of both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | + | This source file is subject to version 2.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_01.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Colin Viebrock <cmv@easydns.com> | + | Authors: Shane Caraveo <shane@caraveo.com> | + | Colin Viebrock <cmv@easydns.com> | + | Hartmut Holzgraefe <hartmut@six.de> | +----------------------------------------------------------------------+ */ +/* $Id: */ #include "php.h" #include "php_calendar.h" @@ -40,7 +32,7 @@ pval *year_arg; struct tm *ta, te; time_t the_time; - int year, golden, solar, lunar, pfm, dom, tmp, easter; + long year, golden, solar, lunar, pfm, dom, tmp, easter; switch(ARG_COUNT(ht)) { case 0: @@ -58,7 +50,7 @@ default: WRONG_PARAM_COUNT; } - + if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */ php3_error(E_WARNING, "easter_date() is only valid for years between 1970 and 2037 inclusive"); RETURN_FALSE; Index: php4/ext/calendar/php_calendar.h diff -u php4/ext/calendar/php_calendar.h:1.1 php4/ext/calendar/php_calendar.h:1.2 --- php4/ext/calendar/php_calendar.h:1.1 Sat Apr 15 13:35:09 2000 +++ php4/ext/calendar/php_calendar.h Sun Apr 16 04:40:19 2000 @@ -27,6 +27,8 @@ PHP_FUNCTION(jdmonthname); PHP_FUNCTION(easter_days); PHP_FUNCTION(easter_date); +PHP_FUNCTION(unixtojd); +PHP_FUNCTION(jdtounix); #define phpext_calendar_ptr calendar_module_ptr

« previous php.version4 (#13604) next »