📄 calendar.c
字号:
/* +----------------------------------------------------------------------+ | PHP Version 4 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_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 <colin@easydns.com> | | Hartmut Holzgraefe <hholzgra@php.net> | | Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ *//* $Id: calendar.c,v 1.30.2.4.2.2 2007/01/01 09:46:40 sebastian Exp $ */#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifdef PHP_WIN32#define _WINNLS_#endif#include "php.h"#include "ext/standard/info.h"#include "php_calendar.h"#include "sdncal.h"#include <stdio.h>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) PHP_FE(unixtojd, NULL) PHP_FE(jdtounix, NULL) PHP_FE(cal_to_jd, NULL) PHP_FE(cal_from_jd, NULL) PHP_FE(cal_days_in_month, NULL) PHP_FE(cal_info, NULL) {NULL, NULL, NULL}};zend_module_entry calendar_module_entry = { STANDARD_MODULE_HEADER, "calendar", calendar_functions, PHP_MINIT(calendar), NULL, NULL, NULL, PHP_MINFO(calendar), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES,};#ifdef COMPILE_DL_CALENDARZEND_GET_MODULE(calendar)#endif/* this order must match the conversion table below */enum cal_name_type_t { CAL_GREGORIAN = 0, CAL_JULIAN, CAL_JEWISH, CAL_FRENCH, CAL_NUM_CALS};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);struct cal_entry_t { 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;};static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = { {"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}};/* For jddayofweek */enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG };/* For jdmonthname */enum { CAL_MONTH_GREGORIAN_SHORT, CAL_MONTH_GREGORIAN_LONG, CAL_MONTH_JULIAN_SHORT, CAL_MONTH_JULIAN_LONG, CAL_MONTH_JEWISH, CAL_MONTH_FRENCH};/* for heb_number_to_chars */static char alef_bet[25] = "0噌忏溴骁栝腱铕耱赧鼬
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -