Ruby  2.5.0dev(2017-10-22revision60238)
Macros | Functions
date_parse.c File Reference
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include <ctype.h>
#include "zonetab.h"

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)
 
VALUE date_zone_to_diff (VALUE str)
 
VALUE date__parse (VALUE str, VALUE comp)
 
VALUE date__iso8601 (VALUE str)
 
VALUE date__rfc3339 (VALUE str)
 
VALUE date__xmlschema (VALUE str)
 
VALUE date__rfc2822 (VALUE str)
 
VALUE date__httpdate (VALUE str)
 
VALUE date__jisx0301 (VALUE str)
 

Macro Definition Documentation

◆ ABBR_DAYS

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

Definition at line 235 of file date_parse.c.

◆ ABBR_MONTHS

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

Definition at line 236 of file date_parse.c.

◆ asp_string

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

Definition at line 61 of file date_parse.c.

◆ cstr2num

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

Definition at line 47 of file date_parse.c.

◆ DAYS

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

Definition at line 233 of file date_parse.c.

◆ DECDIGIT

#define DECDIGIT   "0123456789"

Definition at line 69 of file date_parse.c.

◆ del_hash

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

Definition at line 45 of file date_parse.c.

◆ f_add

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

Definition at line 18 of file date_parse.c.

◆ 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.

◆ f_begin

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

Definition at line 36 of file date_parse.c.

◆ 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.

◆ f_expt

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

Definition at line 24 of file date_parse.c.

◆ f_ge_p

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

Definition at line 29 of file date_parse.c.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ HAVE_ALPHA

#define HAVE_ALPHA   (1<<0)

Definition at line 2014 of file date_parse.c.

◆ HAVE_DASH

#define HAVE_DASH   (1<<2)

Definition at line 2016 of file date_parse.c.

◆ HAVE_DIGIT

#define HAVE_DIGIT   (1<<1)

Definition at line 2015 of file date_parse.c.

◆ HAVE_DOT

#define HAVE_DOT   (1<<3)

Definition at line 2017 of file date_parse.c.

◆ HAVE_ELEM_P

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

Definition at line 2042 of file date_parse.c.

◆ HAVE_SLASH

#define HAVE_SLASH   (1<<4)

Definition at line 2018 of file date_parse.c.

◆ iso8601_bas_time_cb

#define iso8601_bas_time_cb   iso8601_ext_time_cb

Definition at line 2443 of file date_parse.c.

◆ issign

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

Definition at line 60 of file date_parse.c.

◆ MATCH

#define MATCH (   s,
  p,
 
)
Value:
{ \
return match(s, p, hash, c); \
}
struct ComplexDateData c
Definition: date_core.c:285
struct SimpleDateData s
Definition: date_core.c:284

Definition at line 274 of file date_parse.c.

◆ 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.

◆ REGCOMP

#define REGCOMP (   pat,
  opt 
)
Value:
{ \
if (NIL_P(pat)) \
pat = regcomp(pat##_source, sizeof pat##_source - 1, opt); \
}
#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)

Definition at line 271 of file date_parse.c.

◆ REGCOMP_I

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

Definition at line 272 of file date_parse.c.

◆ set_hash

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

Definition at line 43 of file date_parse.c.

◆ sizeof_array

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

Definition at line 15 of file date_parse.c.

◆ SNUM [1/12]

#define SNUM   14

Definition at line 2926 of file date_parse.c.

◆ 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)

Definition at line 48 of file date_parse.c.

◆ SUBS

#define SUBS (   s,
  p,
 
)
Value:
{ \
return subx(s, asp_string(), p, hash, c); \
}
struct ComplexDateData c
Definition: date_core.c:285
#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.

Function Documentation

◆ date__httpdate()

VALUE date__httpdate ( VALUE  str)

Definition at line 2903 of file date_parse.c.

◆ date__iso8601()

VALUE date__iso8601 ( VALUE  str)

Definition at line 2470 of file date_parse.c.

◆ date__jisx0301()

VALUE date__jisx0301 ( VALUE  str)

Definition at line 2977 of file date_parse.c.

◆ date__parse()

VALUE date__parse ( VALUE  str,
VALUE  comp 
)

Definition at line 2049 of file date_parse.c.

◆ date__rfc2822()

VALUE date__rfc2822 ( VALUE  str)

Definition at line 2757 of file date_parse.c.

◆ date__rfc3339()

VALUE date__rfc3339 ( VALUE  str)

Definition at line 2538 of file date_parse.c.

◆ date__xmlschema()

VALUE date__xmlschema ( VALUE  str)

Definition at line 2684 of file date_parse.c.

◆ date_zone_to_diff()

VALUE date_zone_to_diff ( VALUE  str)

Definition at line 353 of file date_parse.c.

References ALLOCV_N, Qnil, RSTRING_LEN, and RSTRING_PTR.

◆ rb_int_positive_pow()

RUBY_EXTERN VALUE rb_int_positive_pow ( long  x,
unsigned long  y 
)

Definition at line 3942 of file numeric.c.

◆ 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.