Ruby  2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
Data Structures | Macros | Enumerations | Functions
date_core.c File Reference
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/util.h"
#include <math.h>
#include <time.h>
#include <assert.h>
#include "date_tmx.h"
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  SimpleDateData
 
struct  ComplexDateData
 
union  DateData
 

Macros

#define NDEBUG
 
#define USE_PACK
 
#define f_boolcast(x)   ((x) ? Qtrue : Qfalse)
 
#define f_abs(x)   rb_funcall(x, rb_intern("abs"), 0)
 
#define f_negate(x)   rb_funcall(x, rb_intern("-@"), 0)
 
#define f_add(x, y)   rb_funcall(x, '+', 1, y)
 
#define f_sub(x, y)   rb_funcall(x, '-', 1, y)
 
#define f_mul(x, y)   rb_funcall(x, '*', 1, y)
 
#define f_div(x, y)   rb_funcall(x, '/', 1, y)
 
#define f_quo(x, y)   rb_funcall(x, rb_intern("quo"), 1, y)
 
#define f_idiv(x, y)   rb_funcall(x, rb_intern("div"), 1, y)
 
#define f_mod(x, y)   rb_funcall(x, '%', 1, y)
 
#define f_remainder(x, y)   rb_funcall(x, rb_intern("remainder"), 1, y)
 
#define f_expt(x, y)   rb_funcall(x, rb_intern("**"), 1, y)
 
#define f_floor(x)   rb_funcall(x, rb_intern("floor"), 0)
 
#define f_ceil(x)   rb_funcall(x, rb_intern("ceil"), 0)
 
#define f_truncate(x)   rb_funcall(x, rb_intern("truncate"), 0)
 
#define f_round(x)   rb_funcall(x, rb_intern("round"), 0)
 
#define f_to_i(x)   rb_funcall(x, rb_intern("to_i"), 0)
 
#define f_to_r(x)   rb_funcall(x, rb_intern("to_r"), 0)
 
#define f_to_s(x)   rb_funcall(x, rb_intern("to_s"), 0)
 
#define f_inspect(x)   rb_funcall(x, rb_intern("inspect"), 0)
 
#define f_add3(x, y, z)   f_add(f_add(x, y), z)
 
#define f_sub3(x, y, z)   f_sub(f_sub(x, y), z)
 
#define RETURN_FALSE_UNLESS_NUMERIC(obj)   if(!RTEST(rb_obj_is_kind_of((obj), rb_cNumeric))) return Qfalse
 
#define f_nonzero_p(x)   (!f_zero_p(x))
 
#define f_positive_p(x)   (!f_negative_p(x))
 
#define f_ajd(x)   rb_funcall(x, rb_intern("ajd"), 0)
 
#define f_jd(x)   rb_funcall(x, rb_intern("jd"), 0)
 
#define f_year(x)   rb_funcall(x, rb_intern("year"), 0)
 
#define f_mon(x)   rb_funcall(x, rb_intern("mon"), 0)
 
#define f_mday(x)   rb_funcall(x, rb_intern("mday"), 0)
 
#define f_wday(x)   rb_funcall(x, rb_intern("wday"), 0)
 
#define f_hour(x)   rb_funcall(x, rb_intern("hour"), 0)
 
#define f_min(x)   rb_funcall(x, rb_intern("min"), 0)
 
#define f_sec(x)   rb_funcall(x, rb_intern("sec"), 0)
 
#define NDIV(x, y)   (-(-((x)+1)/(y))-1)
 
#define NMOD(x, y)   ((y)-(-((x)+1)%(y))-1)
 
#define DIV(n, d)   ((n)<0 ? NDIV((n),(d)) : (n)/(d))
 
#define MOD(n, d)   ((n)<0 ? NMOD((n),(d)) : (n)%(d))
 
#define HAVE_JD   (1 << 0)
 
#define HAVE_DF   (1 << 1)
 
#define HAVE_CIVIL   (1 << 2)
 
#define HAVE_TIME   (1 << 3)
 
#define COMPLEX_DAT   (1 << 7)
 
#define have_jd_p(x)   ((x)->flags & HAVE_JD)
 
#define have_df_p(x)   ((x)->flags & HAVE_DF)
 
#define have_civil_p(x)   ((x)->flags & HAVE_CIVIL)
 
#define have_time_p(x)   ((x)->flags & HAVE_TIME)
 
#define complex_dat_p(x)   ((x)->flags & COMPLEX_DAT)
 
#define simple_dat_p(x)   (!complex_dat_p(x))
 
#define ITALY   2299161 /* 1582-10-15 */
 
#define ENGLAND   2361222 /* 1752-09-14 */
 
#define JULIAN   positive_inf
 
#define GREGORIAN   negative_inf
 
#define DEFAULT_SG   ITALY
 
#define UNIX_EPOCH_IN_CJD   INT2FIX(2440588) /* 1970-01-01 */
 
#define MINUTE_IN_SECONDS   60
 
#define HOUR_IN_SECONDS   3600
 
#define DAY_IN_SECONDS   86400
 
#define SECOND_IN_MILLISECONDS   1000
 
#define SECOND_IN_NANOSECONDS   1000000000
 
#define JC_PERIOD0   1461 /* 365.25 * 4 */
 
#define GC_PERIOD0   146097 /* 365.2425 * 400 */
 
#define CM_PERIOD0   71149239 /* (lcm 7 1461 146097) */
 
#define CM_PERIOD   (0xfffffff / CM_PERIOD0 * CM_PERIOD0)
 
#define CM_PERIOD_JCY   (CM_PERIOD / JC_PERIOD0 * 4)
 
#define CM_PERIOD_GCY   (CM_PERIOD / GC_PERIOD0 * 400)
 
#define REFORM_BEGIN_YEAR   1582
 
#define REFORM_END_YEAR   1930
 
#define REFORM_BEGIN_JD   2298874 /* ns 1582-01-01 */
 
#define REFORM_END_JD   2426355 /* os 1930-12-31 */
 
#define SEC_WIDTH   6
 
#define MIN_WIDTH   6
 
#define HOUR_WIDTH   5
 
#define MDAY_WIDTH   5
 
#define MON_WIDTH   4
 
#define SEC_SHIFT   0
 
#define MIN_SHIFT   SEC_WIDTH
 
#define HOUR_SHIFT   (MIN_WIDTH + SEC_WIDTH)
 
#define MDAY_SHIFT   (HOUR_WIDTH + MIN_WIDTH + SEC_WIDTH)
 
#define MON_SHIFT   (MDAY_WIDTH + HOUR_WIDTH + MIN_WIDTH + SEC_WIDTH)
 
#define PK_MASK(x)   ((1 << (x)) - 1)
 
#define EX_SEC(x)   (((x) >> SEC_SHIFT) & PK_MASK(SEC_WIDTH))
 
#define EX_MIN(x)   (((x) >> MIN_SHIFT) & PK_MASK(MIN_WIDTH))
 
#define EX_HOUR(x)   (((x) >> HOUR_SHIFT) & PK_MASK(HOUR_WIDTH))
 
#define EX_MDAY(x)   (((x) >> MDAY_SHIFT) & PK_MASK(MDAY_WIDTH))
 
#define EX_MON(x)   (((x) >> MON_SHIFT) & PK_MASK(MON_WIDTH))
 
#define PACK5(m, d, h, min, s)
 
#define PACK2(m, d)    (((m) << MON_SHIFT) | ((d) << MDAY_SHIFT))
 
#define date_sg_t   double
 
#define get_d1(x)
 
#define get_d1a(x)
 
#define get_d1b(x)
 
#define get_d2(x, y)
 
#define set_to_simple(obj, x, _nth, _jd, _sg, _year, _mon, _mday, _flags)
 
#define set_to_complex(obj, x, _nth, _jd, _df, _sf, _of, _sg, _year, _mon, _mday, _hour, _min, _sec, _flags)
 
#define copy_simple_to_complex(obj, x, y)
 
#define copy_complex_to_simple(obj, x, y)
 
#define canonicalize_jd(_nth, _jd)
 
#define HALF_DAYS_IN_SECONDS   (DAY_IN_SECONDS / 2)
 
#define decode_offset(of, s, h, m)
 
#define valid_sg(sg)
 
#define jd_trunc   d_trunc
 
#define k_trunc   d_trunc
 
#define num2num_with_frac(s, n)
 
#define num2int_with_frac(s, n)
 
#define canon24oc()
 
#define add_frac()
 
#define val2sg(vsg, dsg)
 
#define set_hash0(k, v)   rb_hash_aset(hash, k, v)
 
#define ref_hash0(k)   rb_hash_aref(hash, k)
 
#define del_hash0(k)   rb_hash_delete(hash, k)
 
#define sym(x)   ID2SYM(rb_intern(x""))
 
#define set_hash(k, v)   set_hash0(sym(k), v)
 
#define ref_hash(k)   ref_hash0(sym(k))
 
#define del_hash(k)   del_hash0(sym(k))
 
#define val2off(vof, iof)
 
#define SMALLBUF   100
 
#define MILLISECOND_IN_NANOSECONDS   1000000
 
#define f_subsec(x)   rb_funcall(x, rb_intern("subsec"), 0)
 
#define f_utc_offset(x)   rb_funcall(x, rb_intern("utc_offset"), 0)
 
#define f_local3(x, y, m, d)   rb_funcall(x, rb_intern("local"), 3, y, m, d)
 
#define rb_intern(str)   rb_intern_const(str)
 

Enumerations

enum  {
  DBL_BIGDIG = ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG), COROUTINE_REGISTERS = 6, COROUTINE_REGISTERS = 8, COROUTINE_REGISTERS = 0xb0 / 8,
  COROUTINE_REGISTERS, COROUTINE_REGISTERS = 4, COROUTINE_REGISTERS = 8, COROUTINE_XMM_REGISTERS = 1+10*2,
  COROUTINE_REGISTERS = 4, NAME_ERR_MESG__MESG, NAME_ERR_MESG__RECV, NAME_ERR_MESG__NAME,
  NAME_ERR_MESG_COUNT, raise_opt_cause, raise_max_opt, RAISED_EXCEPTION = 1,
  RAISED_STACKOVERFLOW = 2, RAISED_NOMEMORY = 4, DECIMAL_SIZE_OF_LONG = DECIMAL_SIZE_OF_BITS(CHAR_BIT*sizeof(long)), JISX0301_DATE_SIZE = DECIMAL_SIZE_OF_LONG+8,
  FLAG_RETURNS_128BITS = 1 << (31-31), FLAG_RETURNS_NOTHING = 1 << (31-30), FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28),
  FLAG_RETURNS_STRUCT = 1 << (31-27), FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), FLAG_4_GPR_ARGUMENTS = 1 << (31- 5),
  FLAG_RETVAL_REFERENCE = 1 << (31- 4), FLAG_RETURNS_SMST = 1 << (31-31), FLAG_RETURNS_NOTHING = 1 << (31-30), FLAG_RETURNS_FP = 1 << (31-29),
  FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-27), FLAG_COMPAT = 1 << (31- 8), FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
  FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, FLAG_FP_ARGUMENTS = 1 << (31- 6), FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4),
  JSON_object_start = 1, ossl_asn1_info_size = (sizeof(ossl_asn1_info)/sizeof(ossl_asn1_info[0])), tIGNORED_NL = tLAST_TOKEN + 1, tCOMMENT,
  tEMBDOC_BEG, tEMBDOC, tEMBDOC_END, tHEREDOC_BEG,
  tHEREDOC_END, k__END__, ORDINAL_PARAM = -1, NO_PARAM = 0,
  NUMPARAM_MAX = 9, BITS_SIZE = sizeof(bits_t), BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT ), RSTRUCT_EMBED_LEN_MAX = RVALUE_EMBED_LEN_MAX,
  RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1), RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1), RSTRUCT_TRANSIENT_FLAG = FL_USER3, RSTRUCT_ENUM_END,
  bom_prefix_len = (int)sizeof(bom_prefix) - 1, MT_MAX_STATE = N, PCH_NOT_READY, PCH_FAILED,
  PCH_SUCCESS, ORDINAL_PARAM = -1, NO_PARAM = 0, NUMPARAM_MAX = 9,
  COMPILATION_FEATURES, DEFAULT_FEATURES, LONGEST_SIGNAME = 7, LEFT,
  CHCASE, LOWER, UPPER, AREF_HASH_UNIT = 5,
  AREF_HASH_THRESHOLD = 10, TMOPT_IN, TMOPT_MAX_, CALLER_BINDING_SELF,
  CALLER_BINDING_CLASS, CALLER_BINDING_BINDING, CALLER_BINDING_ISEQ, CALLER_BINDING_CFP,
  VM_FRAME_MAGIC_METHOD = 0x11110001, VM_FRAME_MAGIC_BLOCK = 0x22220001, VM_FRAME_MAGIC_CLASS = 0x33330001, VM_FRAME_MAGIC_TOP = 0x44440001,
  VM_FRAME_MAGIC_CFUNC = 0x55550001, VM_FRAME_MAGIC_IFUNC = 0x66660001, VM_FRAME_MAGIC_EVAL = 0x77770001, VM_FRAME_MAGIC_RESCUE = 0x78880001,
  VM_FRAME_MAGIC_DUMMY = 0x79990001, VM_FRAME_MAGIC_MASK = 0x7fff0001, VM_FRAME_FLAG_PASSED = 0x0010, VM_FRAME_FLAG_FINISH = 0x0020,
  VM_FRAME_FLAG_BMETHOD = 0x0040, VM_FRAME_FLAG_CFRAME = 0x0080, VM_FRAME_FLAG_LAMBDA = 0x0100, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM = 0x0200,
  VM_FRAME_FLAG_CFRAME_KW = 0x0400, VM_FRAME_FLAG_CFRAME_EMPTY_KW = 0x0800, VM_ENV_FLAG_LOCAL = 0x0002, VM_ENV_FLAG_ESCAPED = 0x0004,
  VM_ENV_FLAG_WB_REQUIRED = 0x0008, MINIMUM_REPARSE_BUFFER_PATH_LEN = 4, SI_USER = 0, SI_ASYNCIO = 2,
  SI_MESGQ, SI_TIMER, SI_QUEUE, SI_KERNEL,
  ILL_ILLOPC = 7, ILL_ILLOPN, ILL_ILLADR, ILL_ILLTRP,
  ILL_PRVOPC, ILL_PRVREG, ILL_COPROC, ILL_BADSTK,
  FPE_INTDIV = 15, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF,
  FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB,
  SEGV_MAPERR = 23, SEGV_ACCERR, BUS_ADRALN = 25, BUS_ADRERR,
  BUS_OBJERR, CLD_EXITED = 28, CLD_KILLED, CLD_DUMPED,
  CLD_TRAPPED, CLD_STOPPED, CLD_CONTINUED
}
 

Functions

VALUE date_zone_to_diff (VALUE)
 
VALUE date__strptime (const char *str, size_t slen, const char *fmt, size_t flen, VALUE hash)
 
VALUE date__parse (VALUE str, VALUE comp)
 
VALUE date__iso8601 (VALUE)
 
VALUE date__rfc3339 (VALUE)
 
VALUE date__xmlschema (VALUE)
 
VALUE date__rfc2822 (VALUE)
 
VALUE date__httpdate (VALUE)
 
VALUE date__jisx0301 (VALUE)
 
size_t date_strftime (char *s, size_t maxsize, const char *format, const struct tmx *tmx)
 
void Init_date_core (void)
 

Macro Definition Documentation

◆ add_frac

#define add_frac ( )
Value:
do {\
if (f_nonzero_p(fr2))\
ret = d_lite_plus(ret, fr2);\
} while (0)

Definition at line 3258 of file date_core.c.

◆ canon24oc

#define canon24oc ( )
Value:
do {\
if (rh == 24) {\
rh = 0;\
fr2 = f_add(fr2, INT2FIX(1));\
}\
} while (0)

Definition at line 3250 of file date_core.c.

◆ canonicalize_jd

#define canonicalize_jd (   _nth,
  _jd 
)
Value:
do {\
if (_jd < 0) {\
_nth = f_sub(_nth, INT2FIX(1));\
_jd += CM_PERIOD;\
}\
if (_jd >= CM_PERIOD) {\
_nth = f_add(_nth, INT2FIX(1));\
_jd -= CM_PERIOD;\
}\
} while (0)

Definition at line 1120 of file date_core.c.

◆ CM_PERIOD

#define CM_PERIOD   (0xfffffff / CM_PERIOD0 * CM_PERIOD0)

Definition at line 195 of file date_core.c.

◆ CM_PERIOD0

#define CM_PERIOD0   71149239 /* (lcm 7 1461 146097) */

Definition at line 194 of file date_core.c.

◆ CM_PERIOD_GCY

#define CM_PERIOD_GCY   (CM_PERIOD / GC_PERIOD0 * 400)

Definition at line 197 of file date_core.c.

◆ CM_PERIOD_JCY

#define CM_PERIOD_JCY   (CM_PERIOD / JC_PERIOD0 * 4)

Definition at line 196 of file date_core.c.

◆ COMPLEX_DAT

#define COMPLEX_DAT   (1 << 7)

Definition at line 169 of file date_core.c.

◆ complex_dat_p

#define complex_dat_p (   x)    ((x)->flags & COMPLEX_DAT)

Definition at line 175 of file date_core.c.

◆ copy_complex_to_simple

#define copy_complex_to_simple (   obj,
  x,
 
)
Value:
do {\
RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
(x)->jd = (y)->jd;\
(x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->pc = PACK2(EX_MON((y)->pc), EX_MDAY((y)->pc));\
(x)->flags = (y)->flags;\
} while (0)

Definition at line 426 of file date_core.c.

◆ copy_simple_to_complex

#define copy_simple_to_complex (   obj,
  x,
 
)
Value:
do {\
RB_OBJ_WRITE((obj), &(x)->nth, (y)->nth);\
(x)->jd = (y)->jd;\
(x)->df = 0;\
RB_OBJ_WRITE((obj), &(x)->sf, INT2FIX(0));\
(x)->of = 0;\
(x)->sg = (date_sg_t)((y)->sg);\
(x)->year = (y)->year;\
(x)->pc = PACK5(EX_MON((y)->pc), EX_MDAY((y)->pc), 0, 0, 0);\
(x)->flags = (y)->flags;\
} while (0)

Definition at line 400 of file date_core.c.

◆ date_sg_t

#define date_sg_t   double

Definition at line 240 of file date_core.c.

◆ DAY_IN_SECONDS

#define DAY_IN_SECONDS   86400

Definition at line 188 of file date_core.c.

◆ decode_offset

#define decode_offset (   of,
  s,
  h,
 
)
Value:
do {\
int a;\
s = (of < 0) ? '-' : '+';\
a = (of < 0) ? -of : of;\
h = a / HOUR_IN_SECONDS;\
} while (0)

Definition at line 1939 of file date_core.c.

◆ DEFAULT_SG

#define DEFAULT_SG   ITALY

Definition at line 182 of file date_core.c.

◆ del_hash

#define del_hash (   k)    del_hash0(sym(k))

Definition at line 3720 of file date_core.c.

◆ del_hash0

#define del_hash0 (   k)    rb_hash_delete(hash, k)

Definition at line 3714 of file date_core.c.

◆ DIV

#define DIV (   n,
 
)    ((n)<0 ? NDIV((n),(d)) : (n)/(d))

Definition at line 162 of file date_core.c.

◆ ENGLAND

#define ENGLAND   2361222 /* 1752-09-14 */

Definition at line 179 of file date_core.c.

◆ EX_HOUR

#define EX_HOUR (   x)    (((x) >> HOUR_SHIFT) & PK_MASK(HOUR_WIDTH))

Definition at line 221 of file date_core.c.

◆ EX_MDAY

#define EX_MDAY (   x)    (((x) >> MDAY_SHIFT) & PK_MASK(MDAY_WIDTH))

Definition at line 222 of file date_core.c.

◆ EX_MIN

#define EX_MIN (   x)    (((x) >> MIN_SHIFT) & PK_MASK(MIN_WIDTH))

Definition at line 220 of file date_core.c.

◆ EX_MON

#define EX_MON (   x)    (((x) >> MON_SHIFT) & PK_MASK(MON_WIDTH))

Definition at line 223 of file date_core.c.

◆ EX_SEC

#define EX_SEC (   x)    (((x) >> SEC_SHIFT) & PK_MASK(SEC_WIDTH))

Definition at line 219 of file date_core.c.

◆ f_abs

#define f_abs (   x)    rb_funcall(x, rb_intern("abs"), 0)

Definition at line 31 of file date_core.c.

◆ f_add

#define f_add (   x,
 
)    rb_funcall(x, '+', 1, y)

Definition at line 33 of file date_core.c.

◆ f_add3

#define f_add3 (   x,
  y,
 
)    f_add(f_add(x, y), z)

Definition at line 52 of file date_core.c.

◆ f_ajd

#define f_ajd (   x)    rb_funcall(x, rb_intern("ajd"), 0)

Definition at line 149 of file date_core.c.

◆ f_boolcast

#define f_boolcast (   x)    ((x) ? Qtrue : Qfalse)

Definition at line 29 of file date_core.c.

◆ f_ceil

#define f_ceil (   x)    rb_funcall(x, rb_intern("ceil"), 0)

Definition at line 43 of file date_core.c.

◆ f_div

#define f_div (   x,
 
)    rb_funcall(x, '/', 1, y)

Definition at line 36 of file date_core.c.

◆ f_expt

#define f_expt (   x,
 
)    rb_funcall(x, rb_intern("**"), 1, y)

Definition at line 41 of file date_core.c.

◆ f_floor

#define f_floor (   x)    rb_funcall(x, rb_intern("floor"), 0)

Definition at line 42 of file date_core.c.

◆ f_hour

#define f_hour (   x)    rb_funcall(x, rb_intern("hour"), 0)

Definition at line 155 of file date_core.c.

◆ f_idiv

#define f_idiv (   x,
 
)    rb_funcall(x, rb_intern("div"), 1, y)

Definition at line 38 of file date_core.c.

◆ f_inspect

#define f_inspect (   x)    rb_funcall(x, rb_intern("inspect"), 0)

Definition at line 50 of file date_core.c.

◆ f_jd

#define f_jd (   x)    rb_funcall(x, rb_intern("jd"), 0)

Definition at line 150 of file date_core.c.

◆ f_local3

#define f_local3 (   x,
  y,
  m,
 
)    rb_funcall(x, rb_intern("local"), 3, y, m, d)

Definition at line 8512 of file date_core.c.

◆ f_mday

#define f_mday (   x)    rb_funcall(x, rb_intern("mday"), 0)

Definition at line 153 of file date_core.c.

◆ f_min

#define f_min (   x)    rb_funcall(x, rb_intern("min"), 0)

Definition at line 156 of file date_core.c.

◆ f_mod

#define f_mod (   x,
 
)    rb_funcall(x, '%', 1, y)

Definition at line 39 of file date_core.c.

◆ f_mon

#define f_mon (   x)    rb_funcall(x, rb_intern("mon"), 0)

Definition at line 152 of file date_core.c.

◆ f_mul

#define f_mul (   x,
 
)    rb_funcall(x, '*', 1, y)

Definition at line 35 of file date_core.c.

◆ f_negate

#define f_negate (   x)    rb_funcall(x, rb_intern("-@"), 0)

Definition at line 32 of file date_core.c.

◆ f_nonzero_p

#define f_nonzero_p (   x)    (!f_zero_p(x))

Definition at line 137 of file date_core.c.

◆ f_positive_p

#define f_positive_p (   x)    (!f_negative_p(x))

Definition at line 147 of file date_core.c.

◆ f_quo

#define f_quo (   x,
 
)    rb_funcall(x, rb_intern("quo"), 1, y)

Definition at line 37 of file date_core.c.

◆ f_remainder

#define f_remainder (   x,
 
)    rb_funcall(x, rb_intern("remainder"), 1, y)

Definition at line 40 of file date_core.c.

◆ f_round

#define f_round (   x)    rb_funcall(x, rb_intern("round"), 0)

Definition at line 45 of file date_core.c.

◆ f_sec

#define f_sec (   x)    rb_funcall(x, rb_intern("sec"), 0)

Definition at line 157 of file date_core.c.

◆ f_sub

#define f_sub (   x,
 
)    rb_funcall(x, '-', 1, y)

Definition at line 34 of file date_core.c.

◆ f_sub3

#define f_sub3 (   x,
  y,
 
)    f_sub(f_sub(x, y), z)

Definition at line 53 of file date_core.c.

◆ f_subsec

#define f_subsec (   x)    rb_funcall(x, rb_intern("subsec"), 0)

Definition at line 8510 of file date_core.c.

◆ f_to_i

#define f_to_i (   x)    rb_funcall(x, rb_intern("to_i"), 0)

Definition at line 47 of file date_core.c.

◆ f_to_r

#define f_to_r (   x)    rb_funcall(x, rb_intern("to_r"), 0)

Definition at line 48 of file date_core.c.

◆ f_to_s

#define f_to_s (   x)    rb_funcall(x, rb_intern("to_s"), 0)

Definition at line 49 of file date_core.c.

◆ f_truncate

#define f_truncate (   x)    rb_funcall(x, rb_intern("truncate"), 0)

Definition at line 44 of file date_core.c.

◆ f_utc_offset

#define f_utc_offset (   x)    rb_funcall(x, rb_intern("utc_offset"), 0)

Definition at line 8511 of file date_core.c.

◆ f_wday

#define f_wday (   x)    rb_funcall(x, rb_intern("wday"), 0)

Definition at line 154 of file date_core.c.

◆ f_year

#define f_year (   x)    rb_funcall(x, rb_intern("year"), 0)

Definition at line 151 of file date_core.c.

◆ GC_PERIOD0

#define GC_PERIOD0   146097 /* 365.2425 * 400 */

Definition at line 193 of file date_core.c.

◆ get_d1

#define get_d1 (   x)
Value:
union DateData *dat;\
TypedData_Get_Struct(x, union DateData, &d_lite_type, dat);

Definition at line 297 of file date_core.c.

◆ get_d1a

#define get_d1a (   x)
Value:
union DateData *adat;\
TypedData_Get_Struct(x, union DateData, &d_lite_type, adat);

Definition at line 301 of file date_core.c.

◆ get_d1b

#define get_d1b (   x)
Value:
union DateData *bdat;\
TypedData_Get_Struct(x, union DateData, &d_lite_type, bdat);

Definition at line 305 of file date_core.c.

◆ get_d2

#define get_d2 (   x,
 
)
Value:
union DateData *adat, *bdat;\
TypedData_Get_Struct(x, union DateData, &d_lite_type, adat);\
TypedData_Get_Struct(y, union DateData, &d_lite_type, bdat);

Definition at line 309 of file date_core.c.

◆ GREGORIAN

#define GREGORIAN   negative_inf

Definition at line 181 of file date_core.c.

◆ HALF_DAYS_IN_SECONDS

#define HALF_DAYS_IN_SECONDS   (DAY_IN_SECONDS / 2)

Definition at line 1567 of file date_core.c.

◆ HAVE_CIVIL

#define HAVE_CIVIL   (1 << 2)

Definition at line 167 of file date_core.c.

◆ have_civil_p

#define have_civil_p (   x)    ((x)->flags & HAVE_CIVIL)

Definition at line 173 of file date_core.c.

◆ HAVE_DF

#define HAVE_DF   (1 << 1)

Definition at line 166 of file date_core.c.

◆ have_df_p

#define have_df_p (   x)    ((x)->flags & HAVE_DF)

Definition at line 172 of file date_core.c.

◆ HAVE_JD

#define HAVE_JD   (1 << 0)

Definition at line 165 of file date_core.c.

◆ have_jd_p

#define have_jd_p (   x)    ((x)->flags & HAVE_JD)

Definition at line 171 of file date_core.c.

◆ HAVE_TIME

#define HAVE_TIME   (1 << 3)

Definition at line 168 of file date_core.c.

◆ have_time_p

#define have_time_p (   x)    ((x)->flags & HAVE_TIME)

Definition at line 174 of file date_core.c.

◆ HOUR_IN_SECONDS

#define HOUR_IN_SECONDS   3600

Definition at line 187 of file date_core.c.

◆ HOUR_SHIFT

#define HOUR_SHIFT   (MIN_WIDTH + SEC_WIDTH)

Definition at line 213 of file date_core.c.

◆ HOUR_WIDTH

#define HOUR_WIDTH   5

Definition at line 207 of file date_core.c.

◆ ITALY

#define ITALY   2299161 /* 1582-10-15 */

Definition at line 178 of file date_core.c.

◆ JC_PERIOD0

#define JC_PERIOD0   1461 /* 365.25 * 4 */

Definition at line 192 of file date_core.c.

◆ jd_trunc

#define jd_trunc   d_trunc

Definition at line 3176 of file date_core.c.

◆ JULIAN

#define JULIAN   positive_inf

Definition at line 180 of file date_core.c.

◆ k_trunc

#define k_trunc   d_trunc

Definition at line 3177 of file date_core.c.

◆ MDAY_SHIFT

#define MDAY_SHIFT   (HOUR_WIDTH + MIN_WIDTH + SEC_WIDTH)

Definition at line 214 of file date_core.c.

◆ MDAY_WIDTH

#define MDAY_WIDTH   5

Definition at line 208 of file date_core.c.

◆ MILLISECOND_IN_NANOSECONDS

#define MILLISECOND_IN_NANOSECONDS   1000000

Definition at line 6660 of file date_core.c.

◆ MIN_SHIFT

#define MIN_SHIFT   SEC_WIDTH

Definition at line 212 of file date_core.c.

◆ MIN_WIDTH

#define MIN_WIDTH   6

Definition at line 206 of file date_core.c.

◆ MINUTE_IN_SECONDS

#define MINUTE_IN_SECONDS   60

Definition at line 186 of file date_core.c.

◆ MOD

#define MOD (   n,
 
)    ((n)<0 ? NMOD((n),(d)) : (n)%(d))

Definition at line 163 of file date_core.c.

◆ MON_SHIFT

#define MON_SHIFT   (MDAY_WIDTH + HOUR_WIDTH + MIN_WIDTH + SEC_WIDTH)

Definition at line 215 of file date_core.c.

◆ MON_WIDTH

#define MON_WIDTH   4

Definition at line 209 of file date_core.c.

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file date_core.c.

◆ NDIV

#define NDIV (   x,
 
)    (-(-((x)+1)/(y))-1)

Definition at line 160 of file date_core.c.

◆ NMOD

#define NMOD (   x,
 
)    ((y)-(-((x)+1)%(y))-1)

Definition at line 161 of file date_core.c.

◆ num2int_with_frac

#define num2int_with_frac (   s,
  n 
)
Value:
do {\
s = NUM2INT(s##_trunc(v##s, &fr));\
if (f_nonzero_p(fr)) {\
if (argc > n)\
rb_raise(eDateError, "invalid fraction");\
fr2 = fr;\
}\
} while (0)

Definition at line 3240 of file date_core.c.

◆ num2num_with_frac

#define num2num_with_frac (   s,
  n 
)
Value:
do {\
s = s##_trunc(v##s, &fr);\
if (f_nonzero_p(fr)) {\
if (argc > n)\
rb_raise(eDateError, "invalid fraction");\
fr2 = fr;\
}\
} while (0)

Definition at line 3230 of file date_core.c.

◆ PACK2

#define PACK2 (   m,
 
)     (((m) << MON_SHIFT) | ((d) << MDAY_SHIFT))

Definition at line 229 of file date_core.c.

◆ PACK5

#define PACK5 (   m,
  d,
  h,
  min,
 
)
Value:
(((m) << MON_SHIFT) | ((d) << MDAY_SHIFT) |\
((h) << HOUR_SHIFT) | ((min) << MIN_SHIFT) | ((s) << SEC_SHIFT))

Definition at line 225 of file date_core.c.

◆ PK_MASK

#define PK_MASK (   x)    ((1 << (x)) - 1)

Definition at line 217 of file date_core.c.

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

◆ ref_hash

#define ref_hash (   k)    ref_hash0(sym(k))

Definition at line 3719 of file date_core.c.

◆ ref_hash0

#define ref_hash0 (   k)    rb_hash_aref(hash, k)

Definition at line 3713 of file date_core.c.

◆ REFORM_BEGIN_JD

#define REFORM_BEGIN_JD   2298874 /* ns 1582-01-01 */

Definition at line 201 of file date_core.c.

◆ REFORM_BEGIN_YEAR

#define REFORM_BEGIN_YEAR   1582

Definition at line 199 of file date_core.c.

◆ REFORM_END_JD

#define REFORM_END_JD   2426355 /* os 1930-12-31 */

Definition at line 202 of file date_core.c.

◆ REFORM_END_YEAR

#define REFORM_END_YEAR   1930

Definition at line 200 of file date_core.c.

◆ RETURN_FALSE_UNLESS_NUMERIC

#define RETURN_FALSE_UNLESS_NUMERIC (   obj)    if(!RTEST(rb_obj_is_kind_of((obj), rb_cNumeric))) return Qfalse

Definition at line 58 of file date_core.c.

◆ SEC_SHIFT

#define SEC_SHIFT   0

Definition at line 211 of file date_core.c.

◆ SEC_WIDTH

#define SEC_WIDTH   6

Definition at line 205 of file date_core.c.

◆ SECOND_IN_MILLISECONDS

#define SECOND_IN_MILLISECONDS   1000

Definition at line 189 of file date_core.c.

◆ SECOND_IN_NANOSECONDS

#define SECOND_IN_NANOSECONDS   1000000000

Definition at line 190 of file date_core.c.

◆ set_hash

#define set_hash (   k,
  v 
)    set_hash0(sym(k), v)

Definition at line 3718 of file date_core.c.

◆ set_hash0

#define set_hash0 (   k,
  v 
)    rb_hash_aset(hash, k, v)

Definition at line 3712 of file date_core.c.

◆ set_to_complex

#define set_to_complex (   obj,
  x,
  _nth,
  _jd,
  _df,
  _sf,
  _of,
  _sg,
  _year,
  _mon,
  _mday,
  _hour,
  _min,
  _sec,
  _flags 
)
Value:
do {\
RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth));\
(x)->jd = _jd;\
(x)->df = _df;\
RB_OBJ_WRITE((obj), &(x)->sf, canon(_sf));\
(x)->of = _of;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->pc = PACK5(_mon, _mday, _hour, _min, _sec);\
(x)->flags = (_flags) | COMPLEX_DAT;\
} while (0)

Definition at line 367 of file date_core.c.

◆ set_to_simple

#define set_to_simple (   obj,
  x,
  _nth,
  _jd,
  _sg,
  _year,
  _mon,
  _mday,
  _flags 
)
Value:
do {\
RB_OBJ_WRITE((obj), &(x)->nth, canon(_nth)); \
(x)->jd = _jd;\
(x)->sg = (date_sg_t)(_sg);\
(x)->year = _year;\
(x)->pc = PACK2(_mon, _mday);\
(x)->flags = (_flags) & ~COMPLEX_DAT;\
} while (0)

Definition at line 337 of file date_core.c.

◆ simple_dat_p

#define simple_dat_p (   x)    (!complex_dat_p(x))

Definition at line 176 of file date_core.c.

◆ SMALLBUF

#define SMALLBUF   100

Definition at line 6608 of file date_core.c.

◆ sym

#define sym (   x)    ID2SYM(rb_intern(x""))

Definition at line 3716 of file date_core.c.

◆ UNIX_EPOCH_IN_CJD

#define UNIX_EPOCH_IN_CJD   INT2FIX(2440588) /* 1970-01-01 */

Definition at line 184 of file date_core.c.

◆ USE_PACK

#define USE_PACK

Definition at line 21 of file date_core.c.

◆ val2off

#define val2off (   vof,
  iof 
)
Value:
do {\
if (!offset_to_sec(vof, &iof)) {\
iof = 0;\
rb_warning("invalid offset is ignored");\
}\
} while (0)

Definition at line 4718 of file date_core.c.

◆ val2sg

#define val2sg (   vsg,
  dsg 
)
Value:
do {\
dsg = NUM2DBL(vsg);\
if (!c_valid_start_p(dsg)) {\
dsg = DEFAULT_SG;\
rb_warning("invalid start is ignored");\
}\
} while (0)

Definition at line 3264 of file date_core.c.

◆ valid_sg

#define valid_sg (   sg)
Value:
do {\
if (!c_valid_start_p(sg)) {\
sg = 0;\
rb_warning("invalid start is ignored");\
}\
} while (0)

Definition at line 2429 of file date_core.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DBL_BIGDIG 
COROUTINE_REGISTERS 
COROUTINE_REGISTERS 
COROUTINE_REGISTERS 
COROUTINE_REGISTERS 
COROUTINE_REGISTERS 
COROUTINE_REGISTERS 
COROUTINE_XMM_REGISTERS 
COROUTINE_REGISTERS 
NAME_ERR_MESG__MESG 
NAME_ERR_MESG__RECV 
NAME_ERR_MESG__NAME 
NAME_ERR_MESG_COUNT 
raise_opt_cause 
raise_max_opt 
RAISED_EXCEPTION 
RAISED_STACKOVERFLOW 
RAISED_NOMEMORY 
DECIMAL_SIZE_OF_LONG 
JISX0301_DATE_SIZE 
FLAG_RETURNS_128BITS 
FLAG_RETURNS_NOTHING 
FLAG_RETURNS_FP 
FLAG_RETURNS_64BITS 
FLAG_RETURNS_STRUCT 
FLAG_ARG_NEEDS_COPY 
FLAG_FP_ARGUMENTS 
FLAG_4_GPR_ARGUMENTS 
FLAG_RETVAL_REFERENCE 
FLAG_RETURNS_SMST 
FLAG_RETURNS_NOTHING 
FLAG_RETURNS_FP 
FLAG_RETURNS_64BITS 
FLAG_RETURNS_128BITS 
FLAG_COMPAT 
FLAG_ARG_NEEDS_COPY 
FLAG_ARG_NEEDS_PSAVE 
FLAG_FP_ARGUMENTS 
FLAG_4_GPR_ARGUMENTS 
FLAG_RETVAL_REFERENCE 
JSON_object_start 
ossl_asn1_info_size 
tIGNORED_NL 
tCOMMENT 
tEMBDOC_BEG 
tEMBDOC 
tEMBDOC_END 
tHEREDOC_BEG 
tHEREDOC_END 
k__END__ 
ORDINAL_PARAM 
NO_PARAM 
NUMPARAM_MAX 
BITS_SIZE 
BITS_BITLENGTH 
RSTRUCT_EMBED_LEN_MAX 
RSTRUCT_EMBED_LEN_MASK 
RSTRUCT_EMBED_LEN_SHIFT 
RSTRUCT_TRANSIENT_FLAG 
RSTRUCT_ENUM_END 
bom_prefix_len 
MT_MAX_STATE 
PCH_NOT_READY 
PCH_FAILED 
PCH_SUCCESS 
ORDINAL_PARAM 
NO_PARAM 
NUMPARAM_MAX 
COMPILATION_FEATURES 
DEFAULT_FEATURES 
LONGEST_SIGNAME 
LEFT 
CHCASE 
LOWER 
UPPER 
AREF_HASH_UNIT 
AREF_HASH_THRESHOLD 
TMOPT_IN 
TMOPT_MAX_ 
CALLER_BINDING_SELF 
CALLER_BINDING_CLASS 
CALLER_BINDING_BINDING 
CALLER_BINDING_ISEQ 
CALLER_BINDING_CFP 
VM_FRAME_MAGIC_METHOD 
VM_FRAME_MAGIC_BLOCK 
VM_FRAME_MAGIC_CLASS 
VM_FRAME_MAGIC_TOP 
VM_FRAME_MAGIC_CFUNC 
VM_FRAME_MAGIC_IFUNC 
VM_FRAME_MAGIC_EVAL 
VM_FRAME_MAGIC_RESCUE 
VM_FRAME_MAGIC_DUMMY 
VM_FRAME_MAGIC_MASK 
VM_FRAME_FLAG_PASSED 
VM_FRAME_FLAG_FINISH 
VM_FRAME_FLAG_BMETHOD 
VM_FRAME_FLAG_CFRAME 
VM_FRAME_FLAG_LAMBDA 
VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM 
VM_FRAME_FLAG_CFRAME_KW 
VM_FRAME_FLAG_CFRAME_EMPTY_KW 
VM_ENV_FLAG_LOCAL 
VM_ENV_FLAG_ESCAPED 
VM_ENV_FLAG_WB_REQUIRED 
MINIMUM_REPARSE_BUFFER_PATH_LEN 
SI_USER 
SI_ASYNCIO 
SI_MESGQ 
SI_TIMER 
SI_QUEUE 
SI_KERNEL 
ILL_ILLOPC 
ILL_ILLOPN 
ILL_ILLADR 
ILL_ILLTRP 
ILL_PRVOPC 
ILL_PRVREG 
ILL_COPROC 
ILL_BADSTK 
FPE_INTDIV 
FPE_INTOVF 
FPE_FLTDIV 
FPE_FLTOVF 
FPE_FLTUND 
FPE_FLTRES 
FPE_FLTINV 
FPE_FLTSUB 
SEGV_MAPERR 
SEGV_ACCERR 
BUS_ADRALN 
BUS_ADRERR 
BUS_OBJERR 
CLD_EXITED 
CLD_KILLED 
CLD_DUMPED 
CLD_TRAPPED 
CLD_STOPPED 
CLD_CONTINUED 

Definition at line 7042 of file date_core.c.

Function Documentation

◆ date__httpdate()

VALUE date__httpdate ( VALUE  )

◆ date__iso8601()

VALUE date__iso8601 ( VALUE  )

◆ date__jisx0301()

VALUE date__jisx0301 ( VALUE  )

◆ date__parse()

VALUE date__parse ( VALUE  str,
VALUE  comp 
)

◆ date__rfc2822()

VALUE date__rfc2822 ( VALUE  )

◆ date__rfc3339()

VALUE date__rfc3339 ( VALUE  )

◆ date__strptime()

VALUE date__strptime ( const char str,
size_t  slen,
const char fmt,
size_t  flen,
VALUE  hash 
)

◆ date__xmlschema()

VALUE date__xmlschema ( VALUE  )

◆ date_strftime()

size_t date_strftime ( char s,
size_t  maxsize,
const char format,
const struct tmx tmx 
)

Definition at line 628 of file date_strftime.c.

◆ date_zone_to_diff()

VALUE date_zone_to_diff ( VALUE  )

Definition at line 410 of file date_parse.c.

◆ Init_date_core()

void Init_date_core ( void  )

Definition at line 9099 of file date_core.c.

MIN_SHIFT
#define MIN_SHIFT
Definition: date_core.c:212
EX_MDAY
#define EX_MDAY(x)
Definition: date_core.c:222
INT2FIX
#define INT2FIX(i)
Definition: ruby.h:263
MDAY_SHIFT
#define MDAY_SHIFT
Definition: date_core.c:214
COMPLEX_DAT
#define COMPLEX_DAT
Definition: date_core.c:169
EX_MON
#define EX_MON(x)
Definition: date_core.c:223
PACK5
#define PACK5(m, d, h, min, s)
Definition: date_core.c:225
CM_PERIOD
#define CM_PERIOD
Definition: date_core.c:195
HOUR_SHIFT
#define HOUR_SHIFT
Definition: date_core.c:213
MON_SHIFT
#define MON_SHIFT
Definition: date_core.c:215
h
size_t st_index_t h
Definition: rb_mjit_min_header-2.7.2.h:5497
pc
rb_control_frame_t const VALUE * pc
Definition: rb_mjit_min_header-2.7.2.h:16986
PACK2
#define PACK2(m, d)
Definition: date_core.c:229
DateData::s
struct SimpleDateData s
Definition: date_core.c:293
f_add
#define f_add(x, y)
Definition: date_core.c:33
DEFAULT_SG
#define DEFAULT_SG
Definition: date_core.c:182
HOUR_IN_SECONDS
#define HOUR_IN_SECONDS
Definition: date_core.c:187
obj
const VALUE VALUE obj
Definition: rb_mjit_min_header-2.7.2.h:5777
DateData
Definition: date_core.c:291
date_sg_t
#define date_sg_t
Definition: date_core.c:240
SEC_SHIFT
#define SEC_SHIFT
Definition: date_core.c:211
argc
int argc
Definition: ruby.c:222
MINUTE_IN_SECONDS
#define MINUTE_IN_SECONDS
Definition: date_core.c:186
v
int VALUE v
Definition: rb_mjit_min_header-2.7.2.h:12380
f_nonzero_p
#define f_nonzero_p(x)
Definition: date_core.c:137
f_sub
#define f_sub(x, y)
Definition: date_core.c:34
NUM2INT
#define NUM2INT(x)
Definition: ruby.h:715
DateData::flags
unsigned flags
Definition: date_core.c:292
NUM2DBL
#define NUM2DBL(x)
Definition: ruby.h:774
n
const char size_t n
Definition: rb_mjit_min_header-2.7.2.h:5491