2000-04-16 19:40:19 +08:00
|
|
|
|
/*
|
|
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:32:16 +08:00
|
|
|
|
| PHP Version 4 |
|
2000-04-16 19:40:19 +08:00
|
|
|
|
+----------------------------------------------------------------------+
|
2003-01-01 00:08:15 +08:00
|
|
|
|
| Copyright (c) 1997-2003 The PHP Group |
|
2000-04-16 19:40:19 +08:00
|
|
|
|
+----------------------------------------------------------------------+
|
2003-06-11 04:04:29 +08:00
|
|
|
|
| This source file is subject to version 3.0 of the PHP license, |
|
2000-04-16 19:40:19 +08:00
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
|
| available through the world-wide-web at the following url: |
|
|
|
|
|
| http://www.php.net/license/3_0.txt. |
|
2000-04-16 19:40:19 +08:00
|
|
|
|
| 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> |
|
2002-09-20 05:51:34 +08:00
|
|
|
|
| Colin Viebrock <colin@easydns.com> |
|
2002-11-25 20:30:28 +08:00
|
|
|
|
| Hartmut Holzgraefe <hholzgra@php.net> |
|
2001-07-04 18:12:45 +08:00
|
|
|
|
| Wez Furlong <wez@thebrainroom.com> |
|
2000-04-16 19:40:19 +08:00
|
|
|
|
+----------------------------------------------------------------------+
|
2000-04-16 04:35:09 +08:00
|
|
|
|
*/
|
2001-07-04 18:12:45 +08:00
|
|
|
|
/* $Id$ */
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
2001-05-24 18:07:29 +08:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-07-06 17:51:03 +08:00
|
|
|
|
#ifdef PHP_WIN32
|
|
|
|
|
#define _WINNLS_
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-04-16 04:35:09 +08:00
|
|
|
|
#include "php.h"
|
2000-10-08 18:55:09 +08:00
|
|
|
|
#include "ext/standard/info.h"
|
2000-04-16 04:35:09 +08:00
|
|
|
|
#include "php_calendar.h"
|
|
|
|
|
#include "sdncal.h"
|
|
|
|
|
|
2002-10-31 17:16:23 +08:00
|
|
|
|
#include <stdio.h>
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2000-04-16 04:35:09 +08:00
|
|
|
|
function_entry calendar_functions[] = {
|
|
|
|
|
PHP_FE(jdtogregorian, NULL)
|
|
|
|
|
PHP_FE(gregoriantojd, NULL)
|
|
|
|
|
PHP_FE(jdtojulian, NULL)
|
|
|
|
|
PHP_FE(juliantojd, NULL)
|
|
|
|
|
PHP_FE(jdtojewish, NULL)
|
|
|
|
|
PHP_FE(jewishtojd, NULL)
|
|
|
|
|
PHP_FE(jdtofrench, NULL)
|
|
|
|
|
PHP_FE(frenchtojd, NULL)
|
|
|
|
|
PHP_FE(jddayofweek, NULL)
|
|
|
|
|
PHP_FE(jdmonthname, NULL)
|
|
|
|
|
PHP_FE(easter_date, NULL)
|
|
|
|
|
PHP_FE(easter_days, NULL)
|
2002-11-26 22:52:00 +08:00
|
|
|
|
PHP_FE(unixtojd, NULL)
|
|
|
|
|
PHP_FE(jdtounix, NULL)
|
|
|
|
|
PHP_FE(cal_to_jd, NULL)
|
|
|
|
|
PHP_FE(cal_from_jd, NULL)
|
2001-07-04 18:12:45 +08:00
|
|
|
|
PHP_FE(cal_days_in_month, NULL)
|
|
|
|
|
PHP_FE(cal_info, NULL)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{NULL, NULL, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zend_module_entry calendar_module_entry = {
|
2001-10-12 07:33:59 +08:00
|
|
|
|
STANDARD_MODULE_HEADER,
|
2002-11-26 22:52:00 +08:00
|
|
|
|
"calendar",
|
|
|
|
|
calendar_functions,
|
2001-07-30 14:18:13 +08:00
|
|
|
|
PHP_MINIT(calendar),
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
PHP_MINFO(calendar),
|
2001-10-12 07:33:59 +08:00
|
|
|
|
NO_VERSION_YET,
|
2001-07-30 14:18:13 +08:00
|
|
|
|
STANDARD_MODULE_PROPERTIES,
|
2000-04-16 04:35:09 +08:00
|
|
|
|
};
|
|
|
|
|
|
2000-05-23 21:46:16 +08:00
|
|
|
|
#ifdef COMPILE_DL_CALENDAR
|
2000-05-02 10:02:05 +08:00
|
|
|
|
ZEND_GET_MODULE(calendar)
|
|
|
|
|
#endif
|
2003-02-03 17:55:09 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
/* this order must match the conversion table below */
|
2001-07-05 17:55:13 +08:00
|
|
|
|
enum cal_name_type_t {
|
2001-07-04 18:12:45 +08:00
|
|
|
|
CAL_GREGORIAN = 0,
|
|
|
|
|
CAL_JULIAN,
|
|
|
|
|
CAL_JEWISH,
|
|
|
|
|
CAL_FRENCH,
|
|
|
|
|
CAL_NUM_CALS
|
|
|
|
|
};
|
2003-02-03 17:55:09 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
typedef long int (*cal_to_jd_func_t) (int month, int day, int year);
|
|
|
|
|
typedef void (*cal_from_jd_func_t) (long int jd, int *year, int *month, int *day);
|
|
|
|
|
typedef char *(*cal_as_string_func_t) (int year, int month, int day);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
2002-11-07 22:52:02 +08:00
|
|
|
|
struct cal_entry_t {
|
2002-11-26 22:52:00 +08:00
|
|
|
|
char *name;
|
|
|
|
|
char *symbol;
|
|
|
|
|
cal_to_jd_func_t to_jd;
|
|
|
|
|
cal_from_jd_func_t from_jd;
|
|
|
|
|
int num_months;
|
|
|
|
|
int max_days_in_month;
|
|
|
|
|
char **month_name_short;
|
|
|
|
|
char **month_name_long;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
};
|
2003-02-03 17:55:09 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = {
|
2002-11-26 22:52:00 +08:00
|
|
|
|
{"Gregorian", "CAL_GREGORIAN", GregorianToSdn, SdnToGregorian, 12, 31,
|
|
|
|
|
MonthNameShort, MonthNameLong},
|
|
|
|
|
{"Julian", "CAL_JULIAN", JulianToSdn, SdnToJulian, 12, 31,
|
|
|
|
|
MonthNameShort, MonthNameLong},
|
|
|
|
|
{"Jewish", "CAL_JEWISH", JewishToSdn, SdnToJewish, 13, 30,
|
|
|
|
|
JewishMonthName, JewishMonthName},
|
|
|
|
|
{"French", "CAL_FRENCH", FrenchToSdn, SdnToFrench, 13, 30,
|
|
|
|
|
FrenchMonthName, FrenchMonthName}
|
2001-07-04 18:12:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* For jddayofweek */
|
2002-11-26 22:52:00 +08:00
|
|
|
|
enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };
|
2003-02-03 17:55:09 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
/* For jdmonthname */
|
2002-11-26 22:52:00 +08:00
|
|
|
|
enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG,
|
2001-07-04 18:12:45 +08:00
|
|
|
|
CAL_MONTH_JULIAN_SHORT, CAL_MONTH_JULIAN_LONG, CAL_MONTH_JEWISH,
|
2002-11-26 22:52:00 +08:00
|
|
|
|
CAL_MONTH_FRENCH
|
|
|
|
|
};
|
2002-10-31 17:16:23 +08:00
|
|
|
|
|
|
|
|
|
/* for heb_number_to_chars */
|
2002-11-07 22:42:20 +08:00
|
|
|
|
static char alef_bet[25] = "0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
#define CAL_JEWISH_ADD_ALAFIM_GERESH 0x2
|
|
|
|
|
#define CAL_JEWISH_ADD_ALAFIM 0x4
|
|
|
|
|
#define CAL_JEWISH_ADD_GERESHAYIM 0x8
|
|
|
|
|
|
2000-04-16 04:35:09 +08:00
|
|
|
|
PHP_MINIT_FUNCTION(calendar)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_GREGORIAN", CAL_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_JULIAN", CAL_JULIAN, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_JEWISH", CAL_JEWISH, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_FRENCH", CAL_FRENCH, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_NUM_CALS", CAL_NUM_CALS, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
/* constants for jddayofweek */
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_DOW_DAYNO", CAL_DOW_DAYNO, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_DOW_SHORT", CAL_DOW_SHORT, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_DOW_LONG", CAL_DOW_LONG, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
/* constants for jdmonthname */
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_SHORT", CAL_MONTH_GREGORIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_GREGORIAN_LONG", CAL_MONTH_GREGORIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_SHORT", CAL_MONTH_JULIAN_SHORT, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_JULIAN_LONG", CAL_MONTH_JULIAN_LONG, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_JEWISH", CAL_MONTH_JEWISH, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_MONTH_FRENCH", CAL_MONTH_FRENCH, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
/* constants for easter calculation */
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_EASTER_DEFAULT", CAL_EASTER_DEFAULT, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_EASTER_ROMAN", CAL_EASTER_ROMAN, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_GREGORIAN", CAL_EASTER_ALWAYS_GREGORIAN, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_EASTER_ALWAYS_JULIAN", CAL_EASTER_ALWAYS_JULIAN, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
/* constants for Jewish date formatting */
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM_GERESH", CAL_JEWISH_ADD_ALAFIM_GERESH, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_ALAFIM", CAL_JEWISH_ADD_ALAFIM, CONST_CS | CONST_PERSISTENT);
|
|
|
|
|
REGISTER_LONG_CONSTANT("CAL_JEWISH_ADD_GERESHAYIM", CAL_JEWISH_ADD_GERESHAYIM, CONST_CS | CONST_PERSISTENT);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
return SUCCESS;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PHP_MINFO_FUNCTION(calendar)
|
|
|
|
|
{
|
2002-11-07 22:52:02 +08:00
|
|
|
|
php_info_print_table_start();
|
|
|
|
|
php_info_print_table_row(2, "Calendar support", "enabled");
|
|
|
|
|
php_info_print_table_end();
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
/* {{{ proto array cal_info(int calendar)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Returns information about a particular calendar */
|
2001-07-04 18:12:45 +08:00
|
|
|
|
PHP_FUNCTION(cal_info)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long cal;
|
|
|
|
|
zval *months, *smonths;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
int i;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
struct cal_entry_t *calendar;
|
|
|
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cal) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
2003-09-01 04:45:51 +08:00
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
calendar = &cal_conversion_table[cal];
|
2001-07-04 18:12:45 +08:00
|
|
|
|
array_init(return_value);
|
|
|
|
|
|
|
|
|
|
MAKE_STD_ZVAL(months);
|
|
|
|
|
MAKE_STD_ZVAL(smonths);
|
|
|
|
|
array_init(months);
|
|
|
|
|
array_init(smonths);
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
for (i = 1; i <= calendar->num_months; i++) {
|
2001-07-04 18:12:45 +08:00
|
|
|
|
add_index_string(months, i, calendar->month_name_long[i], 1);
|
|
|
|
|
add_index_string(smonths, i, calendar->month_name_short[i], 1);
|
|
|
|
|
}
|
|
|
|
|
add_assoc_zval(return_value, "months", months);
|
|
|
|
|
add_assoc_zval(return_value, "abbrevmonths", smonths);
|
|
|
|
|
add_assoc_long(return_value, "maxdaysinmonth", calendar->max_days_in_month);
|
|
|
|
|
add_assoc_string(return_value, "calname", calendar->name, 1);
|
|
|
|
|
add_assoc_string(return_value, "calsymbol", calendar->symbol, 1);
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int cal_days_in_month(int calendar, int month, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Returns the number of days in a month for a given year and calendar */
|
2001-07-04 18:12:45 +08:00
|
|
|
|
PHP_FUNCTION(cal_days_in_month)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long cal, month, year;
|
|
|
|
|
struct cal_entry_t *calendar;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
long sdn_start, sdn_next;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &cal, &month, &year) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
2003-09-01 04:45:51 +08:00
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
calendar = &cal_conversion_table[cal];
|
|
|
|
|
|
|
|
|
|
sdn_start = calendar->to_jd(year, month, 1);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
sdn_next = calendar->to_jd(year, 1 + month, 1);
|
|
|
|
|
|
|
|
|
|
if (sdn_next == 0) {
|
|
|
|
|
/* if invalid, try first month of the next year... */
|
|
|
|
|
sdn_next = calendar->to_jd(year + 1, 1, 1);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_LONG(sdn_next - sdn_start);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int cal_to_jd(int calendar, int month, int day, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts from a supported calendar to Julian Day Count */
|
2001-07-04 18:12:45 +08:00
|
|
|
|
PHP_FUNCTION(cal_to_jd)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long cal, month, day, year, jdate;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &cal, &month, &day, &year) != SUCCESS) {
|
|
|
|
|
RETURN_FALSE;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
2003-09-01 04:45:51 +08:00
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld.", cal);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
jdate = cal_conversion_table[cal].to_jd(year, month, day);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_LONG(jdate);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto array cal_from_jd(int jd, int calendar)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts from Julian Day Count to a supported calendar and return extended information */
|
2001-07-04 18:12:45 +08:00
|
|
|
|
PHP_FUNCTION(cal_from_jd)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long jd, cal;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
int month, day, year, dow;
|
|
|
|
|
char date[16];
|
2002-11-26 22:52:00 +08:00
|
|
|
|
struct cal_entry_t *calendar;
|
|
|
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS()TSRMLS_CC, "ll", &jd, &cal) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (cal < 0 || cal >= CAL_NUM_CALS) {
|
2003-09-01 04:45:51 +08:00
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid calendar ID %ld", cal);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
calendar = &cal_conversion_table[cal];
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
|
|
|
|
array_init(return_value);
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
calendar->from_jd(jd, &year, &month, &day);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
|
|
|
|
sprintf(date, "%i/%i/%i", month, day, year);
|
|
|
|
|
add_assoc_string(return_value, "date", date, 1);
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2001-07-04 18:12:45 +08:00
|
|
|
|
add_assoc_long(return_value, "month", month);
|
|
|
|
|
add_assoc_long(return_value, "day", day);
|
|
|
|
|
add_assoc_long(return_value, "year", year);
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* day of week */
|
|
|
|
|
dow = DayOfWeek(jd);
|
2001-07-04 18:12:45 +08:00
|
|
|
|
add_assoc_long(return_value, "dow", dow);
|
|
|
|
|
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
|
|
|
|
|
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* month name */
|
2001-07-04 18:12:45 +08:00
|
|
|
|
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1);
|
|
|
|
|
add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
|
|
|
|
/* {{{ proto string jdtogregorian(int juliandaycount)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a julian day count to a gregorian calendar date */
|
2000-04-16 04:35:09 +08:00
|
|
|
|
PHP_FUNCTION(jdtogregorian)
|
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int year, month, day;
|
|
|
|
|
char date[10];
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
SdnToGregorian(julday, &year, &month, &day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
sprintf(date, "%i/%i/%i", month, day, year);
|
|
|
|
|
|
2001-08-12 00:39:07 +08:00
|
|
|
|
RETURN_STRING(date, 1);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int gregoriantojd(int month, int day, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a gregorian calendar date to julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(gregoriantojd)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long year, month, day;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int jdate;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
jdate = GregorianToSdn(year, month, day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
|
|
|
|
RETURN_LONG(jdate);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto string jdtojulian(int juliandaycount)
|
|
|
|
|
Convert a julian day count to a julian calendar date */
|
2002-11-26 22:52:00 +08:00
|
|
|
|
PHP_FUNCTION(jdtojulian)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int year, month, day;
|
|
|
|
|
char date[10];
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
SdnToJulian(julday, &year, &month, &day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
sprintf(date, "%i/%i/%i", month, day, year);
|
|
|
|
|
|
2001-08-12 00:39:07 +08:00
|
|
|
|
RETURN_STRING(date, 1);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int juliantojd(int month, int day, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a julian calendar date to julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(juliantojd)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long year, month, day;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int jdate;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
jdate = JulianToSdn(year, month, day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
|
|
|
|
RETURN_LONG(jdate);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* {{{ heb_number_to_chars*/
|
|
|
|
|
/*
|
|
|
|
|
caution: the Hebrew format produces non unique result.
|
|
|
|
|
for example both: year '5' and year '5000' produce '<EFBFBD>'.
|
|
|
|
|
use the numeric one for calculations.
|
2002-10-31 17:16:23 +08:00
|
|
|
|
*/
|
2002-12-06 06:46:54 +08:00
|
|
|
|
static char *heb_number_to_chars(int n, int fl, char **ret)
|
2002-11-07 22:52:02 +08:00
|
|
|
|
{
|
2002-12-06 06:46:54 +08:00
|
|
|
|
char *p, old[18], *endofalafim;
|
2002-11-07 22:52:02 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
p = endofalafim = old;
|
|
|
|
|
/*
|
|
|
|
|
prevents the option breaking the jewish beliefs, and some other
|
|
|
|
|
critical resources ;)
|
|
|
|
|
*/
|
2002-12-06 06:46:54 +08:00
|
|
|
|
if (n > 9999 || n < 1) {
|
|
|
|
|
*ret = NULL;
|
2002-11-07 22:52:02 +08:00
|
|
|
|
return NULL;
|
2002-12-06 06:46:54 +08:00
|
|
|
|
}
|
2002-11-07 22:52:02 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* alafim (thousands) case */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
if (n / 1000) {
|
|
|
|
|
*p = alef_bet[n / 1000];
|
|
|
|
|
p++;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
if (CAL_JEWISH_ADD_ALAFIM_GERESH & fl) {
|
|
|
|
|
*p = '\'';
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
if (CAL_JEWISH_ADD_ALAFIM & fl) {
|
|
|
|
|
strcpy(p, " <20><><EFBFBD><EFBFBD><EFBFBD> ");
|
|
|
|
|
p += 7;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
endofalafim = p;
|
2002-11-07 22:52:02 +08:00
|
|
|
|
n = n % 1000;
|
|
|
|
|
}
|
2002-10-31 17:16:23 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* tav-tav (tav=400) case */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
while (n >= 400) {
|
|
|
|
|
*p = alef_bet[22];
|
|
|
|
|
p++;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
n -= 400;
|
2002-11-07 22:52:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* meot (hundreads) case */
|
|
|
|
|
if (n >= 100) {
|
|
|
|
|
*p = alef_bet[18 + n / 100];
|
2002-11-07 22:52:02 +08:00
|
|
|
|
p++;
|
|
|
|
|
n = n % 100;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* tet-vav & tet-zain case (special case for 15 and 16) */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
if (n == 15 || n == 16) {
|
|
|
|
|
*p = alef_bet[9];
|
|
|
|
|
p++;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
*p = alef_bet[n - 9];
|
2002-11-07 22:52:02 +08:00
|
|
|
|
p++;
|
|
|
|
|
} else {
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* asarot (tens) case */
|
|
|
|
|
if (n >= 10) {
|
|
|
|
|
*p = alef_bet[9 + n / 10];
|
2002-10-31 17:16:23 +08:00
|
|
|
|
p++;
|
2002-11-07 22:52:02 +08:00
|
|
|
|
n = n % 10;
|
2002-10-31 17:16:23 +08:00
|
|
|
|
}
|
2002-11-07 22:52:02 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* yehidot (ones) case */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
if (n > 0) {
|
|
|
|
|
*p = alef_bet[n];
|
2002-10-31 17:16:23 +08:00
|
|
|
|
p++;
|
|
|
|
|
}
|
2002-11-07 22:52:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (CAL_JEWISH_ADD_GERESHAYIM & fl) {
|
|
|
|
|
switch (p - endofalafim) {
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
*p = '\'';
|
|
|
|
|
p++;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
*(p) = *(p - 1);
|
|
|
|
|
*(p - 1) = '"';
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-07 22:52:02 +08:00
|
|
|
|
*p = '\0';
|
2002-12-06 06:46:54 +08:00
|
|
|
|
*ret = estrndup(old, (p - old) + 1);
|
|
|
|
|
p = *ret;
|
|
|
|
|
return p;
|
2002-10-31 17:16:23 +08:00
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
/* }}} */
|
2002-10-31 17:16:23 +08:00
|
|
|
|
|
2002-11-27 23:52:25 +08:00
|
|
|
|
/* {{{ proto string jdtojewish(int juliandaycount [, bool hebrew [, int fl]])
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a julian day count to a jewish calendar date */
|
2002-11-26 22:52:00 +08:00
|
|
|
|
PHP_FUNCTION(jdtojewish)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday, fl = 0;
|
2002-11-27 23:52:25 +08:00
|
|
|
|
zend_bool heb = 0;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int year, month, day;
|
2002-10-31 17:16:23 +08:00
|
|
|
|
char date[10], hebdate[25];
|
2002-12-06 06:46:54 +08:00
|
|
|
|
char *dayp, *yearp;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2002-11-27 23:52:25 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|bl", &julday, &heb, &fl) == FAILURE) {
|
2002-11-26 22:52:00 +08:00
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2002-10-31 17:16:23 +08:00
|
|
|
|
SdnToJewish(julday, &year, &month, &day);
|
2002-11-27 23:52:25 +08:00
|
|
|
|
if (!heb) {
|
2002-10-31 17:16:23 +08:00
|
|
|
|
sprintf(date, "%i/%i/%i", month, day, year);
|
|
|
|
|
RETURN_STRING(date, 1);
|
|
|
|
|
} else {
|
|
|
|
|
if (year <= 0 || year > 9999) {
|
2002-11-26 22:52:00 +08:00
|
|
|
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Year out of range (0-9999).");
|
2002-10-31 17:16:23 +08:00
|
|
|
|
RETURN_FALSE;
|
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2002-12-06 06:46:54 +08:00
|
|
|
|
sprintf(hebdate, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JewishMonthHebName[month], heb_number_to_chars(year, fl, &yearp));
|
|
|
|
|
|
|
|
|
|
if (dayp) {
|
|
|
|
|
efree(dayp);
|
|
|
|
|
}
|
|
|
|
|
if (yearp) {
|
|
|
|
|
efree(yearp);
|
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2002-10-31 17:16:23 +08:00
|
|
|
|
RETURN_STRING(hebdate, 1);
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
2002-10-31 17:16:23 +08:00
|
|
|
|
}
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int jewishtojd(int month, int day, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a jewish calendar date to a julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(jewishtojd)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long year, month, day;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int jdate;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
jdate = JewishToSdn(year, month, day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
|
|
|
|
RETURN_LONG(jdate);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto string jdtofrench(int juliandaycount)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a julian day count to a french republic calendar date */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(jdtofrench)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int year, month, day;
|
|
|
|
|
char date[10];
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &julday) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
SdnToFrench(julday, &year, &month, &day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
sprintf(date, "%i/%i/%i", month, day, year);
|
|
|
|
|
|
2001-08-12 00:39:07 +08:00
|
|
|
|
RETURN_STRING(date, 1);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto int frenchtojd(int month, int day, int year)
|
2001-09-05 05:07:17 +08:00
|
|
|
|
Converts a french republic calendar date to julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(frenchtojd)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long year, month, day;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int jdate;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &month, &day, &year) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
jdate = FrenchToSdn(year, month, day);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
|
|
|
|
RETURN_LONG(jdate);
|
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
2000-04-17 00:02:31 +08:00
|
|
|
|
/* {{{ proto mixed jddayofweek(int juliandaycount [, int mode])
|
2000-04-16 04:35:09 +08:00
|
|
|
|
Returns name or number of day of week from julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(jddayofweek)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday, mode = CAL_DOW_DAYNO;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
int day;
|
|
|
|
|
char *daynamel, *daynames;
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &julday, &mode) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
2002-11-26 22:52:00 +08:00
|
|
|
|
|
|
|
|
|
day = DayOfWeek(julday);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
daynamel = DayNameLong[day];
|
|
|
|
|
daynames = DayNameShort[day];
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
switch (mode) {
|
|
|
|
|
case CAL_DOW_SHORT:
|
|
|
|
|
RETURN_STRING(daynamel, 1);
|
|
|
|
|
break;
|
|
|
|
|
case CAL_DOW_LONG:
|
|
|
|
|
RETURN_STRING(daynames, 1);
|
|
|
|
|
break;
|
|
|
|
|
case CAL_DOW_DAYNO:
|
|
|
|
|
default:
|
|
|
|
|
RETURN_LONG(day);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
|
|
|
|
/* {{{ proto string jdmonthname(int juliandaycount, int mode)
|
|
|
|
|
Returns name of month for julian day count */
|
2002-11-07 22:52:02 +08:00
|
|
|
|
PHP_FUNCTION(jdmonthname)
|
2000-04-16 04:35:09 +08:00
|
|
|
|
{
|
2002-11-26 22:52:00 +08:00
|
|
|
|
long julday, mode;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
char *monthname = NULL;
|
|
|
|
|
int month, day, year;
|
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &julday, &mode) == FAILURE) {
|
|
|
|
|
RETURN_FALSE;
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
2001-07-04 18:12:45 +08:00
|
|
|
|
|
2002-11-26 22:52:00 +08:00
|
|
|
|
switch (mode) {
|
|
|
|
|
case CAL_MONTH_GREGORIAN_LONG: /* gregorian or julian month */
|
|
|
|
|
SdnToGregorian(julday, &year, &month, &day);
|
|
|
|
|
monthname = MonthNameLong[month];
|
|
|
|
|
break;
|
|
|
|
|
case CAL_MONTH_JULIAN_SHORT: /* gregorian or julian month */
|
|
|
|
|
SdnToJulian(julday, &year, &month, &day);
|
|
|
|
|
monthname = MonthNameShort[month];
|
|
|
|
|
break;
|
|
|
|
|
case CAL_MONTH_JULIAN_LONG: /* gregorian or julian month */
|
|
|
|
|
SdnToJulian(julday, &year, &month, &day);
|
|
|
|
|
monthname = MonthNameLong[month];
|
|
|
|
|
break;
|
|
|
|
|
case CAL_MONTH_JEWISH: /* jewish month */
|
|
|
|
|
SdnToJewish(julday, &year, &month, &day);
|
|
|
|
|
monthname = JewishMonthName[month];
|
|
|
|
|
break;
|
|
|
|
|
case CAL_MONTH_FRENCH: /* french month */
|
|
|
|
|
SdnToFrench(julday, &year, &month, &day);
|
|
|
|
|
monthname = FrenchMonthName[month];
|
|
|
|
|
break;
|
|
|
|
|
default: /* default gregorian */
|
|
|
|
|
case CAL_MONTH_GREGORIAN_SHORT: /* gregorian or julian month */
|
|
|
|
|
SdnToGregorian(julday, &year, &month, &day);
|
|
|
|
|
monthname = MonthNameShort[month];
|
|
|
|
|
break;
|
2001-07-04 18:12:45 +08:00
|
|
|
|
}
|
2000-04-16 04:35:09 +08:00
|
|
|
|
|
2001-08-12 00:39:07 +08:00
|
|
|
|
RETURN_STRING(monthname, 1);
|
2000-04-16 04:35:09 +08:00
|
|
|
|
}
|
|
|
|
|
/* }}} */
|
|
|
|
|
|
2001-06-06 21:06:12 +08:00
|
|
|
|
/*
|
|
|
|
|
* Local variables:
|
|
|
|
|
* tab-width: 4
|
|
|
|
|
* c-basic-offset: 4
|
|
|
|
|
* End:
|
2001-09-09 21:29:31 +08:00
|
|
|
|
* vim600: sw=4 ts=4 fdm=marker
|
|
|
|
|
* vim<600: sw=4 ts=4
|
2001-06-06 21:06:12 +08:00
|
|
|
|
*/
|