Ruby  2.4.2p198(2017-09-14revision59899)
Macros | Functions | Variables
date_parse.c File Reference
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include <ctype.h>
#include "zonetab.h"
Include dependency graph for date_parse.c:

Go to the source code of this file.

Macros

#define sizeof_array(o)   (sizeof o / sizeof o[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_idiv(x, y)   rb_funcall(x, rb_intern("div"), 1, y)
 
#define f_mod(x, y)   rb_funcall(x, '%', 1, y)
 
#define f_expt(x, y)   rb_funcall(x, rb_intern("**"), 1, y)
 
#define f_lt_p(x, y)   rb_funcall(x, '<', 1, y)
 
#define f_gt_p(x, y)   rb_funcall(x, '>', 1, y)
 
#define f_le_p(x, y)   rb_funcall(x, rb_intern("<="), 1, y)
 
#define f_ge_p(x, y)   rb_funcall(x, rb_intern(">="), 1, y)
 
#define f_to_s(x)   rb_funcall(x, rb_intern("to_s"), 0)
 
#define f_match(r, s)   rb_funcall(r, rb_intern("match"), 1, s)
 
#define f_aref(o, i)   rb_funcall(o, rb_intern("[]"), 1, i)
 
#define f_aref2(o, i, j)   rb_funcall(o, rb_intern("[]"), 2, i, j)
 
#define f_begin(o, i)   rb_funcall(o, rb_intern("begin"), 1, i)
 
#define f_end(o, i)   rb_funcall(o, rb_intern("end"), 1, i)
 
#define f_aset(o, i, v)   rb_funcall(o, rb_intern("[]="), 2, i, v)
 
#define f_aset2(o, i, j, v)   rb_funcall(o, rb_intern("[]="), 3, i, j, v)
 
#define f_sub_bang(s, r, x)   rb_funcall(s, rb_intern("sub!"), 2, r, x)
 
#define f_gsub_bang(s, r, x)   rb_funcall(s, rb_intern("gsub!"), 2, r, x)
 
#define set_hash(k, v)   rb_hash_aset(hash, ID2SYM(rb_intern(k)), v)
 
#define ref_hash(k)   rb_hash_aref(hash, ID2SYM(rb_intern(k)))
 
#define del_hash(k)   rb_hash_delete(hash, ID2SYM(rb_intern(k)))
 
#define cstr2num(s)   rb_cstr_to_inum(s, 10, 0)
 
#define str2num(s)   rb_str_to_inum(s, 10, 0)
 
#define issign(c)   ((c) == '-' || (c) == '+')
 
#define asp_string()   rb_str_new(" ", 1)
 
#define DECDIGIT   "0123456789"
 
#define DAYS   "sunday|monday|tuesday|wednesday|thursday|friday|saturday"
 
#define MONTHS   "january|february|march|april|may|june|july|august|september|october|november|december"
 
#define ABBR_DAYS   "sun|mon|tue|wed|thu|fri|sat"
 
#define ABBR_MONTHS   "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
 
#define REGCOMP(pat, opt)
 
#define REGCOMP_0(pat)   REGCOMP(pat, 0)
 
#define REGCOMP_I(pat)   REGCOMP(pat, ONIG_OPTION_IGNORECASE)
 
#define MATCH(s, p, c)
 
#define SUBS(s, p, c)
 
#define HAVE_ALPHA   (1<<0)
 
#define HAVE_DIGIT   (1<<1)
 
#define HAVE_DASH   (1<<2)
 
#define HAVE_DOT   (1<<3)
 
#define HAVE_SLASH   (1<<4)
 
#define HAVE_ELEM_P(x)   ((check_class(str) & (x)) == (x))
 
#define SNUM   14
 
#define SNUM   17
 
#define SNUM   5
 
#define iso8601_bas_time_cb   iso8601_ext_time_cb
 
#define SNUM   8
 
#define SNUM   8
 
#define SNUM   5
 
#define SNUM   4
 
#define SNUM   8
 
#define SNUM   8
 
#define SNUM   8
 
#define SNUM   7
 
#define SNUM   9
 

Functions

RUBY_EXTERN VALUE rb_int_positive_pow (long x, unsigned long y)
 
RUBY_EXTERN unsigned long ruby_scan_digits (const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
 
static void s3e (VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
 
static VALUE regcomp (const char *source, long len, int opt)
 
static int match (VALUE str, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
 
static int subx (VALUE str, VALUE rep, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
 
static int str_end_with (const char *s, long l, const char *w)
 
VALUE date_zone_to_diff (VALUE str)
 
static int day_num (VALUE s)
 
static int mon_num (VALUE s)
 
static int parse_day_cb (VALUE m, VALUE hash)
 
static int parse_day (VALUE str, VALUE hash)
 
static int parse_time2_cb (VALUE m, VALUE hash)
 
static int parse_time_cb (VALUE m, VALUE hash)
 
static int parse_time (VALUE str, VALUE hash)
 
static int parse_eu_cb (VALUE m, VALUE hash)
 
static int parse_eu (VALUE str, VALUE hash)
 
static int parse_us_cb (VALUE m, VALUE hash)
 
static int parse_us (VALUE str, VALUE hash)
 
static int parse_iso_cb (VALUE m, VALUE hash)
 
static int parse_iso (VALUE str, VALUE hash)
 
static int parse_iso21_cb (VALUE m, VALUE hash)
 
static int parse_iso21 (VALUE str, VALUE hash)
 
static int parse_iso22_cb (VALUE m, VALUE hash)
 
static int parse_iso22 (VALUE str, VALUE hash)
 
static int parse_iso23_cb (VALUE m, VALUE hash)
 
static int parse_iso23 (VALUE str, VALUE hash)
 
static int parse_iso24_cb (VALUE m, VALUE hash)
 
static int parse_iso24 (VALUE str, VALUE hash)
 
static int parse_iso25_cb (VALUE m, VALUE hash)
 
static int parse_iso25 (VALUE str, VALUE hash)
 
static int parse_iso26_cb (VALUE m, VALUE hash)
 
static int parse_iso26 (VALUE str, VALUE hash)
 
static int parse_iso2 (VALUE str, VALUE hash)
 
static int gengo (int c)
 
static int parse_jis_cb (VALUE m, VALUE hash)
 
static int parse_jis (VALUE str, VALUE hash)
 
static int parse_vms11_cb (VALUE m, VALUE hash)
 
static int parse_vms11 (VALUE str, VALUE hash)
 
static int parse_vms12_cb (VALUE m, VALUE hash)
 
static int parse_vms12 (VALUE str, VALUE hash)
 
static int parse_vms (VALUE str, VALUE hash)
 
static int parse_sla_cb (VALUE m, VALUE hash)
 
static int parse_sla (VALUE str, VALUE hash)
 
static int parse_dot_cb (VALUE m, VALUE hash)
 
static int parse_dot (VALUE str, VALUE hash)
 
static int parse_year_cb (VALUE m, VALUE hash)
 
static int parse_year (VALUE str, VALUE hash)
 
static int parse_mon_cb (VALUE m, VALUE hash)
 
static int parse_mon (VALUE str, VALUE hash)
 
static int parse_mday_cb (VALUE m, VALUE hash)
 
static int parse_mday (VALUE str, VALUE hash)
 
static int n2i (const char *s, long f, long w)
 
static int parse_ddd_cb (VALUE m, VALUE hash)
 
static int parse_ddd (VALUE str, VALUE hash)
 
static int parse_bc_cb (VALUE m, VALUE hash)
 
static int parse_bc (VALUE str, VALUE hash)
 
static int parse_frag_cb (VALUE m, VALUE hash)
 
static int parse_frag (VALUE str, VALUE hash)
 
static unsigned check_class (VALUE s)
 
VALUE date__parse (VALUE str, VALUE comp)
 
static VALUE comp_year69 (VALUE y)
 
static VALUE comp_year50 (VALUE y)
 
static VALUE sec_fraction (VALUE f)
 
static int iso8601_ext_datetime_cb (VALUE m, VALUE hash)
 
static int iso8601_ext_datetime (VALUE str, VALUE hash)
 
static int iso8601_bas_datetime_cb (VALUE m, VALUE hash)
 
static int iso8601_bas_datetime (VALUE str, VALUE hash)
 
static int iso8601_ext_time_cb (VALUE m, VALUE hash)
 
static int iso8601_ext_time (VALUE str, VALUE hash)
 
static int iso8601_bas_time (VALUE str, VALUE hash)
 
VALUE date__iso8601 (VALUE str)
 
static int rfc3339_cb (VALUE m, VALUE hash)
 
static int rfc3339 (VALUE str, VALUE hash)
 
VALUE date__rfc3339 (VALUE str)
 
static int xmlschema_datetime_cb (VALUE m, VALUE hash)
 
static int xmlschema_datetime (VALUE str, VALUE hash)
 
static int xmlschema_time_cb (VALUE m, VALUE hash)
 
static int xmlschema_time (VALUE str, VALUE hash)
 
static int xmlschema_trunc_cb (VALUE m, VALUE hash)
 
static int xmlschema_trunc (VALUE str, VALUE hash)
 
VALUE date__xmlschema (VALUE str)
 
static int rfc2822_cb (VALUE m, VALUE hash)
 
static int rfc2822 (VALUE str, VALUE hash)
 
VALUE date__rfc2822 (VALUE str)
 
static int httpdate_type1_cb (VALUE m, VALUE hash)
 
static int httpdate_type1 (VALUE str, VALUE hash)
 
static int httpdate_type2_cb (VALUE m, VALUE hash)
 
static int httpdate_type2 (VALUE str, VALUE hash)
 
static int httpdate_type3_cb (VALUE m, VALUE hash)
 
static int httpdate_type3 (VALUE str, VALUE hash)
 
VALUE date__httpdate (VALUE str)
 
static int jisx0301_cb (VALUE m, VALUE hash)
 
static int jisx0301 (VALUE str, VALUE hash)
 
VALUE date__jisx0301 (VALUE str)
 

Variables

static const char abbr_days [][4]
 
static const char abbr_months [][4]
 

Macro Definition Documentation

◆ ABBR_DAYS

#define ABBR_DAYS   "sun|mon|tue|wed|thu|fri|sat"

Definition at line 235 of file date_parse.c.

Referenced by httpdate_type1(), httpdate_type3(), parse_day(), and rfc2822().

◆ ABBR_MONTHS

#define ABBR_MONTHS   "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"

◆ asp_string

#define asp_string ( )    rb_str_new(" ", 1)

Definition at line 61 of file date_parse.c.

Referenced by date__parse().

◆ cstr2num

#define cstr2num (   s)    rb_cstr_to_inum(s, 10, 0)

Definition at line 47 of file date_parse.c.

Referenced by s3e().

◆ DAYS

#define DAYS   "sunday|monday|tuesday|wednesday|thursday|friday|saturday"

Definition at line 233 of file date_parse.c.

Referenced by httpdate_type2().

◆ DECDIGIT

#define DECDIGIT   "0123456789"

Definition at line 69 of file date_parse.c.

Referenced by parse_time(), and s3e().

◆ del_hash

#define del_hash (   k)    rb_hash_delete(hash, ID2SYM(rb_intern(k)))

Definition at line 45 of file date_parse.c.

Referenced by date__parse().

◆ f_add

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

◆ f_aref

#define f_aref (   o,
 
)    rb_funcall(o, rb_intern("[]"), 1, i)

Definition at line 34 of file date_parse.c.

◆ f_aref2

#define f_aref2 (   o,
  i,
 
)    rb_funcall(o, rb_intern("[]"), 2, i, j)

Definition at line 35 of file date_parse.c.

◆ f_aset

#define f_aset (   o,
  i,
 
)    rb_funcall(o, rb_intern("[]="), 2, i, v)

Definition at line 38 of file date_parse.c.

◆ f_aset2

#define f_aset2 (   o,
  i,
  j,
 
)    rb_funcall(o, rb_intern("[]="), 3, i, j, v)

Definition at line 39 of file date_parse.c.

Referenced by subx().

◆ f_begin

#define f_begin (   o,
 
)    rb_funcall(o, rb_intern("begin"), 1, i)

Definition at line 36 of file date_parse.c.

Referenced by subx().

◆ f_div

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

Definition at line 21 of file date_parse.c.

◆ f_end

#define f_end (   o,
 
)    rb_funcall(o, rb_intern("end"), 1, i)

Definition at line 37 of file date_parse.c.

Referenced by subx().

◆ f_expt

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

Definition at line 24 of file date_parse.c.

Referenced by parse_ddd_cb(), parse_time2_cb(), and sec_fraction().

◆ f_ge_p

#define f_ge_p (   x,
 
)    rb_funcall(x, rb_intern(">="), 1, y)

Definition at line 29 of file date_parse.c.

Referenced by comp_year50(), comp_year69(), date__parse(), httpdate_type2_cb(), and parse_frag_cb().

◆ f_gsub_bang

#define f_gsub_bang (   s,
  r,
 
)    rb_funcall(s, rb_intern("gsub!"), 2, r, x)

Definition at line 41 of file date_parse.c.

Referenced by date__parse().

◆ f_gt_p

#define f_gt_p (   x,
 
)    rb_funcall(x, '>', 1, y)

Definition at line 27 of file date_parse.c.

◆ f_idiv

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

Definition at line 22 of file date_parse.c.

◆ f_le_p

#define f_le_p (   x,
 
)    rb_funcall(x, rb_intern("<="), 1, y)

Definition at line 28 of file date_parse.c.

Referenced by date__parse(), httpdate_type2_cb(), and parse_frag_cb().

◆ f_lt_p

#define f_lt_p (   x,
 
)    rb_funcall(x, '<', 1, y)

Definition at line 26 of file date_parse.c.

◆ f_match

#define f_match (   r,
 
)    rb_funcall(r, rb_intern("match"), 1, s)

Definition at line 33 of file date_parse.c.

Referenced by match(), parse_iso25(), parse_iso26(), parse_time_cb(), and subx().

◆ f_mod

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

Definition at line 23 of file date_parse.c.

◆ f_mul

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

Definition at line 20 of file date_parse.c.

◆ f_negate

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

Definition at line 17 of file date_parse.c.

Referenced by date__parse().

◆ f_sub

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

Definition at line 19 of file date_parse.c.

◆ f_sub_bang

#define f_sub_bang (   s,
  r,
 
)    rb_funcall(s, rb_intern("sub!"), 2, r, x)

Definition at line 40 of file date_parse.c.

◆ f_to_s

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

Definition at line 31 of file date_parse.c.

Referenced by s3e().

◆ HAVE_ALPHA

#define HAVE_ALPHA   (1<<0)

Definition at line 2014 of file date_parse.c.

Referenced by check_class(), and date__parse().

◆ HAVE_DASH

#define HAVE_DASH   (1<<2)

Definition at line 2016 of file date_parse.c.

Referenced by check_class(), and date__parse().

◆ HAVE_DIGIT

#define HAVE_DIGIT   (1<<1)

Definition at line 2015 of file date_parse.c.

Referenced by check_class(), and date__parse().

◆ HAVE_DOT

#define HAVE_DOT   (1<<3)

Definition at line 2017 of file date_parse.c.

Referenced by check_class(), and date__parse().

◆ HAVE_ELEM_P

#define HAVE_ELEM_P (   x)    ((check_class(str) & (x)) == (x))

Definition at line 2042 of file date_parse.c.

Referenced by date__parse().

◆ HAVE_SLASH

#define HAVE_SLASH   (1<<4)

Definition at line 2018 of file date_parse.c.

Referenced by check_class(), and date__parse().

◆ iso8601_bas_time_cb

#define iso8601_bas_time_cb   iso8601_ext_time_cb

Definition at line 2443 of file date_parse.c.

Referenced by iso8601_bas_time().

◆ issign

#define issign (   c)    ((c) == '-' || (c) == '+')

Definition at line 60 of file date_parse.c.

Referenced by date_zone_to_diff(), and s3e().

◆ MATCH

#define MATCH (   s,
  p,
 
)
Value:
{ \
return match(s, p, hash, c); \
}
static unsigned int hash(str, len) register const char *str
struct ComplexDateData c
Definition: date_core.c:285
static int match(VALUE str, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
Definition: date_parse.c:280
struct SimpleDateData s
Definition: date_core.c:284

Definition at line 274 of file date_parse.c.

Referenced by httpdate_type1(), httpdate_type2(), httpdate_type3(), iso8601_bas_datetime(), iso8601_bas_time(), iso8601_ext_datetime(), iso8601_ext_time(), jisx0301(), rfc2822(), rfc3339(), xmlschema_datetime(), xmlschema_time(), and xmlschema_trunc().

◆ MONTHS

#define MONTHS   "january|february|march|april|may|june|july|august|september|october|november|december"

Definition at line 234 of file date_parse.c.

◆ ref_hash

#define ref_hash (   k)    rb_hash_aref(hash, ID2SYM(rb_intern(k)))

Definition at line 44 of file date_parse.c.

Referenced by date__parse(), and parse_frag_cb().

◆ REGCOMP

#define REGCOMP (   pat,
  opt 
)
Value:
{ \
if (NIL_P(pat)) \
pat = regcomp(pat##_source, sizeof pat##_source - 1, opt); \
}
static VALUE regcomp(const char *source, long len, int opt)
Definition: date_parse.c:256
#define NIL_P(v)
Definition: ruby.h:451

Definition at line 265 of file date_parse.c.

◆ REGCOMP_0

#define REGCOMP_0 (   pat)    REGCOMP(pat, 0)

◆ REGCOMP_I

#define REGCOMP_I (   pat)    REGCOMP(pat, ONIG_OPTION_IGNORECASE)

◆ set_hash

#define set_hash (   k,
 
)    rb_hash_aset(hash, ID2SYM(rb_intern(k)), v)

◆ sizeof_array

#define sizeof_array (   o)    (sizeof o / sizeof o[0])

Definition at line 15 of file date_parse.c.

Referenced by day_num(), and mon_num().

◆ SNUM [1/12]

#define SNUM   14

◆ SNUM [2/12]

#define SNUM   17

Definition at line 2926 of file date_parse.c.

◆ SNUM [3/12]

#define SNUM   5

Definition at line 2926 of file date_parse.c.

◆ SNUM [4/12]

#define SNUM   8

Definition at line 2926 of file date_parse.c.

◆ SNUM [5/12]

#define SNUM   8

Definition at line 2926 of file date_parse.c.

◆ SNUM [6/12]

#define SNUM   5

Definition at line 2926 of file date_parse.c.

◆ SNUM [7/12]

#define SNUM   4

Definition at line 2926 of file date_parse.c.

◆ SNUM [8/12]

#define SNUM   8

Definition at line 2926 of file date_parse.c.

◆ SNUM [9/12]

#define SNUM   8

Definition at line 2926 of file date_parse.c.

◆ SNUM [10/12]

#define SNUM   8

Definition at line 2926 of file date_parse.c.

◆ SNUM [11/12]

#define SNUM   7

Definition at line 2926 of file date_parse.c.

◆ SNUM [12/12]

#define SNUM   9

Definition at line 2926 of file date_parse.c.

◆ str2num

#define str2num (   s)    rb_str_to_inum(s, 10, 0)

◆ SUBS

#define SUBS (   s,
  p,
 
)
Value:
{ \
return subx(s, asp_string(), p, hash, c); \
}
static unsigned int hash(str, len) register const char *str
struct ComplexDateData c
Definition: date_core.c:285
static int subx(VALUE str, VALUE rep, VALUE pat, VALUE hash, int(*cb)(VALUE, VALUE))
Definition: date_parse.c:295
#define asp_string()
Definition: date_parse.c:61
struct SimpleDateData s
Definition: date_core.c:284

Definition at line 316 of file date_parse.c.

Referenced by parse_bc(), parse_day(), parse_ddd(), parse_dot(), parse_eu(), parse_frag(), parse_iso(), parse_iso21(), parse_iso22(), parse_iso23(), parse_iso24(), parse_iso25(), parse_iso26(), parse_jis(), parse_mday(), parse_mon(), parse_sla(), parse_time(), parse_us(), parse_vms11(), parse_vms12(), and parse_year().

Function Documentation

◆ check_class()

static unsigned check_class ( VALUE  s)
static

Definition at line 2021 of file date_parse.c.

References HAVE_ALPHA, HAVE_DASH, HAVE_DIGIT, HAVE_DOT, HAVE_SLASH, RSTRING_LEN, and RSTRING_PTR.

◆ comp_year50()

static VALUE comp_year50 ( VALUE  y)
static

Definition at line 2223 of file date_parse.c.

References f_add, f_ge_p, and INT2FIX.

Referenced by rfc2822_cb().

◆ comp_year69()

static VALUE comp_year69 ( VALUE  y)
static

Definition at line 2215 of file date_parse.c.

References f_add, f_ge_p, and INT2FIX.

Referenced by httpdate_type2_cb(), iso8601_bas_datetime_cb(), and iso8601_ext_datetime_cb().

◆ date__httpdate()

VALUE date__httpdate ( VALUE  str)

◆ date__iso8601()

VALUE date__iso8601 ( VALUE  str)

◆ date__jisx0301()

VALUE date__jisx0301 ( VALUE  str)

◆ date__parse()

VALUE date__parse ( VALUE  str,
VALUE  comp 
)

◆ date__rfc2822()

VALUE date__rfc2822 ( VALUE  str)

◆ date__rfc3339()

VALUE date__rfc3339 ( VALUE  str)

◆ date__xmlschema()

VALUE date__xmlschema ( VALUE  str)

◆ date_zone_to_diff()

VALUE date_zone_to_diff ( VALUE  str)

◆ day_num()

static int day_num ( VALUE  s)
static

◆ gengo()

static int gengo ( int  c)
static

Definition at line 1200 of file date_parse.c.

Referenced by jisx0301_cb(), and parse_jis_cb().

◆ httpdate_type1()

static int httpdate_type1 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2799 of file date_parse.c.

References ABBR_DAYS, ABBR_MONTHS, httpdate_type1_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__httpdate().

◆ httpdate_type1_cb()

static int httpdate_type1_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2774 of file date_parse.c.

References day_num(), INT2FIX, mon_num(), Qnil, rb_reg_nth_match(), set_hash, SNUM, and str2num.

Referenced by httpdate_type1().

◆ httpdate_type2()

static int httpdate_type2 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2846 of file date_parse.c.

References ABBR_MONTHS, DAYS, httpdate_type2_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__httpdate().

◆ httpdate_type2_cb()

static int httpdate_type2_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2818 of file date_parse.c.

References comp_year69(), day_num(), f_ge_p, f_le_p, INT2FIX, mon_num(), Qnil, rb_reg_nth_match(), set_hash, SNUM, and str2num.

Referenced by httpdate_type2().

◆ httpdate_type3()

static int httpdate_type3 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2888 of file date_parse.c.

References ABBR_DAYS, ABBR_MONTHS, httpdate_type3_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__httpdate().

◆ httpdate_type3_cb()

static int httpdate_type3_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2865 of file date_parse.c.

References day_num(), INT2FIX, mon_num(), Qnil, rb_reg_nth_match(), set_hash, SNUM, and str2num.

Referenced by httpdate_type3().

◆ iso8601_bas_datetime()

static int iso8601_bas_datetime ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2396 of file date_parse.c.

References iso8601_bas_datetime_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__iso8601().

◆ iso8601_bas_datetime_cb()

static int iso8601_bas_datetime_cb ( VALUE  m,
VALUE  hash 
)
static

◆ iso8601_bas_time()

static int iso8601_bas_time ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2458 of file date_parse.c.

References iso8601_bas_time_cb, MATCH, Qnil, and REGCOMP_I.

Referenced by date__iso8601().

◆ iso8601_ext_datetime()

static int iso8601_ext_datetime ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2307 of file date_parse.c.

References iso8601_ext_datetime_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__iso8601().

◆ iso8601_ext_datetime_cb()

static int iso8601_ext_datetime_cb ( VALUE  m,
VALUE  hash 
)
static

◆ iso8601_ext_time()

static int iso8601_ext_time ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2446 of file date_parse.c.

References iso8601_ext_time_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__iso8601().

◆ iso8601_ext_time_cb()

static int iso8601_ext_time_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2418 of file date_parse.c.

References date_zone_to_diff(), NIL_P, Qnil, rb_reg_nth_match(), sec_fraction(), set_hash, SNUM, and str2num.

Referenced by iso8601_ext_time().

◆ jisx0301()

static int jisx0301 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2963 of file date_parse.c.

References jisx0301_cb(), MATCH, Qnil, and REGCOMP_I.

Referenced by date__jisx0301().

◆ jisx0301_cb()

static int jisx0301_cb ( VALUE  m,
VALUE  hash 
)
static

◆ match()

static int match ( VALUE  str,
VALUE  pat,
VALUE  hash,
int(*)(VALUE, VALUE cb 
)
static

◆ mon_num()

static int mon_num ( VALUE  s)
static

◆ n2i()

static int n2i ( const char *  s,
long  f,
long  w 
)
static

Definition at line 1658 of file date_parse.c.

Referenced by parse_ddd_cb().

◆ parse_bc()

static int parse_bc ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1920 of file date_parse.c.

References parse_bc_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_bc_cb()

static int parse_bc_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1913 of file date_parse.c.

References Qtrue, and set_hash.

Referenced by parse_bc().

◆ parse_day()

static int parse_day ( VALUE  str,
VALUE  hash 
)
static

Definition at line 512 of file date_parse.c.

References ABBR_DAYS, parse_day_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_day_cb()

static int parse_day_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 502 of file date_parse.c.

References day_num(), INT2FIX, rb_reg_nth_match(), and set_hash.

Referenced by parse_day().

◆ parse_ddd()

static int parse_ddd ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1878 of file date_parse.c.

References parse_ddd_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_ddd_cb()

static int parse_ddd_cb ( VALUE  m,
VALUE  hash 
)
static

◆ parse_dot()

static int parse_dot ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1478 of file date_parse.c.

References INT2FIX, mon_num(), parse_dot_cb(), Qnil, rb_reg_nth_match(), REGCOMP_I, s3e(), and SUBS.

Referenced by date__parse().

◆ parse_dot_cb()

static int parse_dot_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1460 of file date_parse.c.

References rb_reg_nth_match(), and s3e().

Referenced by parse_dot().

◆ parse_eu()

static int parse_eu ( VALUE  str,
VALUE  hash 
)
static

Definition at line 783 of file date_parse.c.

References ABBR_MONTHS, parse_eu_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_eu_cb()

static int parse_eu_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 750 of file date_parse.c.

References INT2FIX, mon_num(), NIL_P, rb_reg_nth_match(), RSTRING_PTR, and s3e().

Referenced by parse_eu().

◆ parse_frag()

static int parse_frag ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1954 of file date_parse.c.

References FPT, parse_frag_cb(), Qnil, REGCOMP_0, REGCOMP_I, RSTRING_LEN, RSTRING_PTR, and SUBS.

Referenced by date__parse().

◆ parse_frag_cb()

static int parse_frag_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1931 of file date_parse.c.

References f_ge_p, f_le_p, INT2FIX, NIL_P, rb_reg_nth_match(), ref_hash, set_hash, and str2num.

Referenced by parse_frag().

◆ parse_iso()

static int parse_iso ( VALUE  str,
VALUE  hash 
)
static

Definition at line 925 of file date_parse.c.

References parse_iso_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by date__parse().

◆ parse_iso2()

static int parse_iso2 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1179 of file date_parse.c.

References parse_iso21(), parse_iso22(), parse_iso23(), parse_iso24(), parse_iso25(), and parse_iso26().

Referenced by date__parse().

◆ parse_iso21()

static int parse_iso21 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 963 of file date_parse.c.

References parse_iso21_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by parse_iso2().

◆ parse_iso21_cb()

static int parse_iso21_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 945 of file date_parse.c.

References NIL_P, rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso21().

◆ parse_iso22()

static int parse_iso22 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 993 of file date_parse.c.

References parse_iso22_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by parse_iso2().

◆ parse_iso22_cb()

static int parse_iso22_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 983 of file date_parse.c.

References rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso22().

◆ parse_iso23()

static int parse_iso23 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1028 of file date_parse.c.

References parse_iso23_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by parse_iso2().

◆ parse_iso23_cb()

static int parse_iso23_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1013 of file date_parse.c.

References NIL_P, rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso23().

◆ parse_iso24()

static int parse_iso24 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1063 of file date_parse.c.

References parse_iso24_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by parse_iso2().

◆ parse_iso24_cb()

static int parse_iso24_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1048 of file date_parse.c.

References NIL_P, rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso24().

◆ parse_iso25()

static int parse_iso25 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1097 of file date_parse.c.

References f_match, NIL_P, parse_iso25_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by parse_iso2().

◆ parse_iso25_cb()

static int parse_iso25_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1083 of file date_parse.c.

References rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso25().

◆ parse_iso26()

static int parse_iso26 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1143 of file date_parse.c.

References f_match, NIL_P, parse_iso26_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by parse_iso2().

◆ parse_iso26_cb()

static int parse_iso26_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1133 of file date_parse.c.

References rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_iso26().

◆ parse_iso_cb()

static int parse_iso_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 907 of file date_parse.c.

References rb_reg_nth_match(), and s3e().

Referenced by parse_iso().

◆ parse_jis()

static int parse_jis ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1235 of file date_parse.c.

References parse_jis_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_jis_cb()

static int parse_jis_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1215 of file date_parse.c.

References f_add, gengo(), INT2FIX, rb_reg_nth_match(), RSTRING_PTR, set_hash, and str2num.

Referenced by parse_jis().

◆ parse_mday()

static int parse_mday ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1638 of file date_parse.c.

References parse_mday_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_mday_cb()

static int parse_mday_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1628 of file date_parse.c.

References rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_mday().

◆ parse_mon()

static int parse_mon ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1608 of file date_parse.c.

References ABBR_MONTHS, parse_mon_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_mon_cb()

static int parse_mon_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1598 of file date_parse.c.

References INT2FIX, mon_num(), rb_reg_nth_match(), and set_hash.

Referenced by parse_mon().

◆ parse_sla()

static int parse_sla ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1370 of file date_parse.c.

References INT2FIX, mon_num(), parse_sla_cb(), Qnil, rb_reg_nth_match(), REGCOMP_I, s3e(), and SUBS.

Referenced by date__parse().

◆ parse_sla_cb()

static int parse_sla_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1352 of file date_parse.c.

References rb_reg_nth_match(), and s3e().

Referenced by parse_sla().

◆ parse_time()

static int parse_time ( VALUE  str,
VALUE  hash 
)
static

Definition at line 608 of file date_parse.c.

References DECDIGIT, f, NIL_P, parse_time_cb(), Qnil, Qtrue, rb_reg_nth_match(), REGCOMP_I, RSTRING_PTR, set_hash, and SUBS.

Referenced by date__parse().

◆ parse_time2_cb()

static int parse_time2_cb ( VALUE  m,
VALUE  hash 
)
static

◆ parse_time_cb()

static int parse_time_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 575 of file date_parse.c.

References f_match, NIL_P, parse_time2_cb(), Qnil, rb_reg_nth_match(), REGCOMP_I, and set_hash.

Referenced by parse_time().

◆ parse_us()

static int parse_us ( VALUE  str,
VALUE  hash 
)
static

Definition at line 861 of file date_parse.c.

References ABBR_MONTHS, parse_us_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by date__parse().

◆ parse_us_cb()

static int parse_us_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 827 of file date_parse.c.

References INT2FIX, mon_num(), NIL_P, rb_reg_nth_match(), RSTRING_PTR, and s3e().

Referenced by parse_us().

◆ parse_vms()

static int parse_vms ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1339 of file date_parse.c.

References parse_vms11(), and parse_vms12().

Referenced by date__parse().

◆ parse_vms11()

static int parse_vms11 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1275 of file date_parse.c.

References ABBR_MONTHS, parse_vms11_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by parse_vms().

◆ parse_vms11_cb()

static int parse_vms11_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1255 of file date_parse.c.

References INT2FIX, mon_num(), rb_reg_nth_match(), and s3e().

Referenced by parse_vms11().

◆ parse_vms12()

static int parse_vms12 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1317 of file date_parse.c.

References ABBR_MONTHS, parse_vms12_cb(), Qnil, REGCOMP_I, and SUBS.

Referenced by parse_vms().

◆ parse_vms12_cb()

static int parse_vms12_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1297 of file date_parse.c.

References INT2FIX, mon_num(), rb_reg_nth_match(), and s3e().

Referenced by parse_vms12().

◆ parse_year()

static int parse_year ( VALUE  str,
VALUE  hash 
)
static

Definition at line 1578 of file date_parse.c.

References parse_year_cb(), Qnil, REGCOMP_0, and SUBS.

Referenced by date__parse().

◆ parse_year_cb()

static int parse_year_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 1568 of file date_parse.c.

References rb_reg_nth_match(), set_hash, and str2num.

Referenced by parse_year().

◆ rb_int_positive_pow()

RUBY_EXTERN VALUE rb_int_positive_pow ( long  x,
unsigned long  y 
)

Definition at line 3949 of file numeric.c.

Referenced by date_zone_to_diff(), parse_rational(), and rb_str_format().

◆ regcomp()

static VALUE regcomp ( const char *  source,
long  len,
int  opt 
)
static

Definition at line 256 of file date_parse.c.

References rb_gc_register_mark_object(), and rb_reg_new().

◆ rfc2822()

static int rfc2822 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2741 of file date_parse.c.

References ABBR_DAYS, ABBR_MONTHS, MATCH, Qnil, REGCOMP_I, and rfc2822_cb().

Referenced by date__rfc2822().

◆ rfc2822_cb()

static int rfc2822_cb ( VALUE  m,
VALUE  hash 
)
static

◆ rfc3339()

static int rfc3339 ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2524 of file date_parse.c.

References MATCH, Qnil, REGCOMP_I, and rfc3339_cb().

Referenced by date__rfc3339().

◆ rfc3339_cb()

static int rfc3339_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2498 of file date_parse.c.

References date_zone_to_diff(), NIL_P, Qnil, rb_reg_nth_match(), sec_fraction(), set_hash, SNUM, and str2num.

Referenced by rfc3339().

◆ ruby_scan_digits()

RUBY_EXTERN unsigned long ruby_scan_digits ( const char *  str,
ssize_t  len,
int  base,
size_t *  retlen,
int *  overflow 
)

Definition at line 84 of file util.c.

Referenced by date_zone_to_diff().

◆ s3e()

static void s3e ( VALUE  hash,
VALUE  y,
VALUE  m,
VALUE  d,
int  bc 
)
static

◆ sec_fraction()

static VALUE sec_fraction ( VALUE  f)
static

◆ str_end_with()

static int str_end_with ( const char *  s,
long  l,
const char *  w 
)
static

Definition at line 346 of file date_parse.c.

References strlen().

Referenced by date_zone_to_diff().

◆ subx()

static int subx ( VALUE  str,
VALUE  rep,
VALUE  pat,
VALUE  hash,
int(*)(VALUE, VALUE cb 
)
static

Definition at line 295 of file date_parse.c.

References f_aset2, f_begin, f_end, f_match, hash(), INT2FIX, LONG2NUM, NIL_P, and NUM2LONG.

◆ xmlschema_datetime()

static int xmlschema_datetime ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2588 of file date_parse.c.

References MATCH, Qnil, REGCOMP_I, and xmlschema_datetime_cb().

Referenced by date__xmlschema().

◆ xmlschema_datetime_cb()

static int xmlschema_datetime_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2555 of file date_parse.c.

References date_zone_to_diff(), NIL_P, Qnil, rb_reg_nth_match(), sec_fraction(), set_hash, SNUM, and str2num.

Referenced by xmlschema_datetime().

◆ xmlschema_time()

static int xmlschema_time ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2631 of file date_parse.c.

References MATCH, Qnil, REGCOMP_I, and xmlschema_time_cb().

Referenced by date__xmlschema().

◆ xmlschema_time_cb()

static int xmlschema_time_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2605 of file date_parse.c.

References date_zone_to_diff(), NIL_P, Qnil, rb_reg_nth_match(), sec_fraction(), set_hash, SNUM, and str2num.

Referenced by xmlschema_time().

◆ xmlschema_trunc()

static int xmlschema_trunc ( VALUE  str,
VALUE  hash 
)
static

Definition at line 2672 of file date_parse.c.

References MATCH, Qnil, REGCOMP_I, and xmlschema_trunc_cb().

Referenced by date__xmlschema().

◆ xmlschema_trunc_cb()

static int xmlschema_trunc_cb ( VALUE  m,
VALUE  hash 
)
static

Definition at line 2646 of file date_parse.c.

References date_zone_to_diff(), NIL_P, Qnil, rb_reg_nth_match(), set_hash, SNUM, and str2num.

Referenced by xmlschema_trunc().

Variable Documentation

◆ abbr_days

const char abbr_days[][4]
static
Initial value:
= {
"sun", "mon", "tue", "wed",
"thu", "fri", "sat"
}

Definition at line 50 of file date_parse.c.

Referenced by day_num().

◆ abbr_months

const char abbr_months[][4]
static
Initial value:
= {
"jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec"
}

Definition at line 55 of file date_parse.c.

Referenced by mon_num().