Ruby  2.5.0dev(2017-10-22revision60238)
Macros | Functions
date_strptime.c File Reference
#include "ruby.h"
#include "ruby/encoding.h"
#include "ruby/re.h"
#include <ctype.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_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_end(o, i)   rb_funcall(o, rb_intern("end"), 1, i)
 
#define issign(c)   ((c) == '-' || (c) == '+')
 
#define NUM_PATTERN_P()   num_pattern_p(&fmt[fi + 1])
 
#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 fail()
 
#define fail_p()   (!NIL_P(ref_hash("_fail")))
 
#define READ_DIGITS(n, w)
 
#define READ_DIGITS_MAX(n)   READ_DIGITS(n, LONG_MAX)
 
#define recur(fmt)
 

Functions

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

Macro Definition Documentation

◆ del_hash

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

Definition at line 118 of file date_strptime.c.

◆ f_add

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

Definition at line 39 of file date_strptime.c.

◆ f_aref

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

Definition at line 53 of file date_strptime.c.

◆ f_div

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

Definition at line 42 of file date_strptime.c.

◆ f_end

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

Definition at line 54 of file date_strptime.c.

◆ f_expt

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

Definition at line 45 of file date_strptime.c.

◆ f_ge_p

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

Definition at line 50 of file date_strptime.c.

◆ f_gt_p

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

Definition at line 48 of file date_strptime.c.

◆ f_idiv

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

Definition at line 43 of file date_strptime.c.

◆ f_le_p

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

Definition at line 49 of file date_strptime.c.

◆ f_lt_p

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

Definition at line 47 of file date_strptime.c.

◆ f_match

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

Definition at line 52 of file date_strptime.c.

◆ f_mod

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

Definition at line 44 of file date_strptime.c.

◆ f_mul

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

Definition at line 41 of file date_strptime.c.

◆ f_negate

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

Definition at line 38 of file date_strptime.c.

◆ f_sub

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

Definition at line 40 of file date_strptime.c.

◆ fail

#define fail ( )
Value:
{ \
set_hash("_fail", Qtrue); \
return 0; \
}
#define Qtrue
Definition: ruby.h:437

Definition at line 120 of file date_strptime.c.

Referenced by ruby_setenv().

◆ fail_p

#define fail_p ( )    (!NIL_P(ref_hash("_fail")))

Definition at line 126 of file date_strptime.c.

◆ issign

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

Definition at line 56 of file date_strptime.c.

◆ NUM_PATTERN_P

#define NUM_PATTERN_P ( )    num_pattern_p(&fmt[fi + 1])

Definition at line 75 of file date_strptime.c.

◆ READ_DIGITS

#define READ_DIGITS (   n,
 
)
Value:
{ \
size_t l; \
l = read_digits(&str[si], &n, w); \
if (l == 0) \
fail(); \
si += l; \
}

Definition at line 128 of file date_strptime.c.

◆ READ_DIGITS_MAX

#define READ_DIGITS_MAX (   n)    READ_DIGITS(n, LONG_MAX)

Definition at line 137 of file date_strptime.c.

◆ recur

#define recur (   fmt)
Value:
{ \
size_t l; \
l = date__strptime_internal(&str[si], slen - si, \
fmt, sizeof fmt - 1, hash); \
if (fail_p()) \
return 0; \
si += l; \
}
#define fail_p()

Definition at line 149 of file date_strptime.c.

Referenced by rb_obj_singleton_methods().

◆ ref_hash

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

Definition at line 117 of file date_strptime.c.

◆ set_hash

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

Definition at line 116 of file date_strptime.c.

◆ sizeof_array

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

Definition at line 36 of file date_strptime.c.

Function Documentation

◆ date__strptime()

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

Definition at line 653 of file date_strptime.c.

◆ date_zone_to_diff()

VALUE date_zone_to_diff ( VALUE  )

Definition at line 353 of file date_parse.c.

References ALLOCV_N, Qnil, RSTRING_LEN, and RSTRING_PTR.