Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "timev.h"
#include "internal.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <errno.h>
#include <math.h>
Go to the source code of this file.
Macros | |
#define | SYSV_EXT 1 /* stuff in System V ascftime routine */ |
#define | SUNOS_EXT 1 /* stuff in SunOS strftime routine */ |
#define | POSIX2_DATE 1 /* stuff in Posix 1003.2 date command */ |
#define | VMS_EXT 1 /* include %v for VMS date format */ |
#define | MAILHEADER_EXT 1 /* add %z for HHMM format */ |
#define | ISO_DATE_EXT 1 /* %G and %g for year of ISO week */ |
#define | adddecl(stuff) stuff |
#define | const |
#define | range(low, item, hi) max((low), min((item), (hi))) |
#define | add(x, y) (rb_funcall((x), '+', 1, (y))) |
#define | sub(x, y) (rb_funcall((x), '-', 1, (y))) |
#define | mul(x, y) (rb_funcall((x), '*', 1, (y))) |
#define | quo(x, y) (rb_funcall((x), rb_intern("quo"), 1, (y))) |
#define | div(x, y) (rb_funcall((x), rb_intern("div"), 1, (y))) |
#define | mod(x, y) (rb_funcall((x), '%', 1, (y))) |
#define | BIT_OF(n) (1U<<(n)) |
#define | TBUFSIZE 100 |
#define | FLAG_FOUND() |
#define | NEEDS(n) |
#define | FILL_PADDING(i) |
#define | FMT_PADDING(fmt, def_pad) |
#define | FMT_PRECISION(def_prec) |
#define | FMT(def_pad, def_prec, fmt, val) |
#define | STRFTIME(fmt) |
#define | FMTV(def_pad, def_prec, fmt, val) |
Enumerations | |
enum | { LEFT, CHCASE, LOWER, UPPER } |
Functions | |
static int | weeknumber () |
adddecl (static int iso8601wknum();) | |
static int | max (int a, int b) |
static char * | resize_buffer (VALUE ftime, char *s, const char **start, const char **endp, ptrdiff_t n, size_t maxsize) |
static void | buffer_size_check (const char *s, const char *format_end, size_t format_len, rb_encoding *enc) |
static char * | case_conv (char *s, ptrdiff_t i, int flags) |
static VALUE | format_value (VALUE val, int base) |
static VALUE | rb_strftime_with_timespec (VALUE ftime, const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, VALUE timev, struct timespec *ts, int gmt, size_t maxsize) |
static size_t | strftime_size_limit (size_t format_len) |
VALUE | rb_strftime (const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, VALUE timev, int gmt) |
VALUE | rb_strftime_timespec (const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, struct timespec *ts, int gmt) |
static int | isleap (long year) |
static void | vtm2tm_noyear (const struct vtm *vtm, struct tm *result) |
static int | iso8601wknum (const struct tm *timeptr) |
static int | iso8601wknum_v (const struct vtm *vtm) |
static int | weeknumber (const struct tm *timeptr, int firstweekday) |
static int | weeknumber_v (const struct vtm *vtm, int firstweekday) |
#define add | ( | x, | |
y | |||
) | (rb_funcall((x), '+', 1, (y))) |
Definition at line 151 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define adddecl | ( | stuff | ) | stuff |
Definition at line 95 of file strftime.c.
#define BIT_OF | ( | n | ) | (1U<<(n)) |
Definition at line 161 of file strftime.c.
Referenced by case_conv(), and rb_strftime_with_timespec().
#define const |
Definition at line 103 of file strftime.c.
#define div | ( | x, | |
y | |||
) | (rb_funcall((x), rb_intern("div"), 1, (y))) |
Definition at line 155 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define FILL_PADDING | ( | i | ) |
Referenced by rb_strftime_with_timespec().
#define FLAG_FOUND | ( | ) |
Referenced by rb_strftime_with_timespec().
#define FMT | ( | def_pad, | |
def_prec, | |||
fmt, | |||
val | |||
) |
Referenced by rb_strftime_with_timespec().
#define FMT_PADDING | ( | fmt, | |
def_pad | |||
) |
#define FMT_PRECISION | ( | def_prec | ) |
#define FMTV | ( | def_pad, | |
def_prec, | |||
fmt, | |||
val | |||
) |
Referenced by rb_strftime_with_timespec().
#define ISO_DATE_EXT 1 /* %G and %g for year of ISO week */ |
Definition at line 77 of file strftime.c.
#define MAILHEADER_EXT 1 /* add %z for HHMM format */ |
Definition at line 76 of file strftime.c.
#define mod | ( | x, | |
y | |||
) | (rb_funcall((x), '%', 1, (y))) |
Definition at line 156 of file strftime.c.
Referenced by rb_strftime_with_timespec(), and vtm2tm_noyear().
#define mul | ( | x, | |
y | |||
) | (rb_funcall((x), '*', 1, (y))) |
Definition at line 153 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define NEEDS | ( | n | ) |
Referenced by rb_strftime_with_timespec().
#define POSIX2_DATE 1 /* stuff in Posix 1003.2 date command */ |
Definition at line 74 of file strftime.c.
#define quo | ( | x, | |
y | |||
) | (rb_funcall((x), rb_intern("quo"), 1, (y))) |
Definition at line 154 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define STRFTIME | ( | fmt | ) |
Referenced by rb_strftime_with_timespec().
#define sub | ( | x, | |
y | |||
) | (rb_funcall((x), '-', 1, (y))) |
Definition at line 152 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define SUNOS_EXT 1 /* stuff in SunOS strftime routine */ |
Definition at line 73 of file strftime.c.
#define SYSV_EXT 1 /* stuff in System V ascftime routine */ |
Definition at line 72 of file strftime.c.
#define TBUFSIZE 100 |
Referenced by rb_strftime_with_timespec().
#define VMS_EXT 1 /* include %v for VMS date format */ |
Definition at line 75 of file strftime.c.
anonymous enum |
Enumerator | |
---|---|
LEFT | |
CHCASE | |
LOWER | |
UPPER |
Definition at line 160 of file strftime.c.
adddecl | ( | static int iso8601wknum(); | ) |
Definition at line 105 of file strftime.c.
|
static |
Definition at line 182 of file strftime.c.
References rb_enc_str_new(), and rb_syserr_fail_str().
|
static |
Definition at line 194 of file strftime.c.
References BIT_OF, ISLOWER, ISUPPER, LOWER, TOLOWER, and TOUPPER.
Referenced by rb_strftime_with_timespec().
Definition at line 215 of file strftime.c.
References rb_big2str(), rb_Integer(), RB_TYPE_P, and T_BIGNUM.
|
static |
Definition at line 947 of file strftime.c.
Referenced by iso8601wknum().
|
static |
Definition at line 982 of file strftime.c.
References isleap(), L, and weeknumber().
Referenced by iso8601wknum_v().
|
static |
Definition at line 1089 of file strftime.c.
References iso8601wknum(), and vtm2tm_noyear().
Referenced by rb_strftime_with_timespec().
|
inlinestatic |
Definition at line 142 of file strftime.c.
Referenced by ary_join_0(), cmp_clamp(), compile_array_(), econv_putback(), get_max_match_length(), list_ids_bsearch(), optimize_node_left(), rand_int(), rand_random(), rand_range(), rb_alloc_tmp_buffer2(), rb_block_arity(), rb_method_entry_arity(), rb_pipe(), rb_proc_arity(), rb_szqueue_initialize(), rb_szqueue_max_set(), rb_thread_priority_set(), ruby_setenv(), select_internal(), set_mml(), and tr_trans().
VALUE rb_strftime | ( | const char * | format, |
size_t | format_len, | ||
rb_encoding * | enc, | ||
const struct vtm * | vtm, | ||
VALUE | timev, | ||
int | gmt | ||
) |
Definition at line 913 of file strftime.c.
References NULL, rb_enc_str_new(), rb_strftime_with_timespec(), result, and strftime_size_limit().
Referenced by rb_strftime_alloc().
VALUE rb_strftime_timespec | ( | const char * | format, |
size_t | format_len, | ||
rb_encoding * | enc, | ||
const struct vtm * | vtm, | ||
struct timespec * | ts, | ||
int | gmt | ||
) |
Definition at line 923 of file strftime.c.
References Qnil, rb_enc_str_new(), rb_strftime_with_timespec(), result, and strftime_size_limit().
Referenced by rb_strftime_alloc().
|
static |
Definition at line 228 of file strftime.c.
References add, BIT_OF, case_conv(), CHCASE, div, ECONV_INVALID_REPLACE, ECONV_UNDEF_REPLACE, err, FILL_PADDING, FIX2LONG, FIXNUM_P, FLAG_FOUND, FMT, FMTV, INT2FIX, iso8601wknum_v(), LEFT, len, LOWER, memcpy, mod, mul, NEEDS, NULL, NUM2INT, NUM2LONG, PRI_TIMET_PREFIX, Qnil, range, rb_ascii8bit_encoding(), rb_funcall(), rb_intern, rb_locale_encoding(), rb_str_capacity(), rb_str_conv_enc_opts(), rb_str_format(), rb_str_new2, rb_str_new_cstr(), rb_str_resize(), rb_str_set_len(), rb_usascii_encoding(), result, RSTRING_LEN, RSTRING_PTR, ruby_scan_digits(), snprintf, strchr(), STRFTIME, StringValueCStr, strlcpy(), strlen(), sub, TBUFSIZE, timespec::tv_nsec, timespec::tv_sec, and weeknumber_v().
Referenced by rb_strftime(), and rb_strftime_timespec().
|
static |
Definition at line 164 of file strftime.c.
References len, rb_str_modify_expand(), rb_str_set_len(), and RSTRING_PTR.
|
static |
Definition at line 904 of file strftime.c.
Referenced by rb_strftime(), and rb_strftime_timespec().
|
static |
Definition at line 954 of file strftime.c.
References FIX2INT, INT2FIX, mod, and NUM2LONG.
Referenced by iso8601wknum_v(), and weeknumber_v().
|
static |
Referenced by iso8601wknum(), and weeknumber_v().
|
static |
Definition at line 1103 of file strftime.c.
|
static |
Definition at line 1121 of file strftime.c.
References argc, argv, I, main(), NULL, vtm2tm_noyear(), and weeknumber().
Referenced by rb_strftime_with_timespec().