Ruby
1.9.3p448(2013-06-27revision41675)
|
#include "ruby/ruby.h"
#include "timev.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 | FLAG_FOUND() |
#define | NEEDS(n) do if (s >= endp || (n) >= endp - s - 1) goto err; while (0) |
#define | FILL_PADDING(i) |
#define | FMT(def_pad, def_prec, fmt, val) |
#define | STRFTIME(fmt) |
#define | FMTV(def_pad, def_prec, fmt, val) |
Functions | |
static int | weeknumber () |
adddecl (static int iso8601wknum();) | |
static int | max (int a, int b) |
static size_t | rb_strftime_with_timespec (char *s, size_t maxsize, const char *format, const struct vtm *vtm, VALUE timev, struct timespec *ts, int gmt) |
size_t | rb_strftime (char *s, size_t maxsize, const char *format, const struct vtm *vtm, VALUE timev, int gmt) |
size_t | rb_strftime_timespec (char *s, size_t maxsize, const char *format, 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 (struct tm *timeptr) const |
static int | iso8601wknum_v (const struct vtm *vtm) |
static int | weeknumber (struct tm *timeptr, int firstweekday) const |
static int | weeknumber_v (const struct vtm *vtm, int firstweekday) |
#define add | ( | x, | |
y | |||
) | (rb_funcall((x), '+', 1, (y))) |
Definition at line 161 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define adddecl | ( | stuff | ) | stuff |
Definition at line 93 of file strftime.c.
#define BIT_OF | ( | n | ) | (1U<<(n)) |
Referenced by rb_strftime_with_timespec().
#define const |
Definition at line 101 of file strftime.c.
#define div | ( | x, | |
y | |||
) | (rb_funcall((x), rb_intern("div"), 1, (y))) |
Definition at line 165 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define FILL_PADDING | ( | i | ) |
#define FLAG_FOUND | ( | ) |
Referenced by rb_strftime_with_timespec().
#define FMT | ( | def_pad, | |
def_prec, | |||
fmt, | |||
val | |||
) |
Referenced by rb_strftime_with_timespec().
#define FMTV | ( | def_pad, | |
def_prec, | |||
fmt, | |||
val | |||
) |
Referenced by rb_strftime_with_timespec().
Definition at line 75 of file strftime.c.
Definition at line 74 of file strftime.c.
#define mod | ( | x, | |
y | |||
) | (rb_funcall((x), '%', 1, (y))) |
Definition at line 166 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 163 of file strftime.c.
Referenced by rb_strftime_with_timespec().
Referenced by rb_strftime_with_timespec().
#define POSIX2_DATE 1 /* stuff in Posix 1003.2 date command */ |
Definition at line 72 of file strftime.c.
#define quo | ( | x, | |
y | |||
) | (rb_funcall((x), rb_intern("quo"), 1, (y))) |
Definition at line 164 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 162 of file strftime.c.
Referenced by rb_strftime_with_timespec().
#define SUNOS_EXT 1 /* stuff in SunOS strftime routine */ |
Definition at line 71 of file strftime.c.
#define SYSV_EXT 1 /* stuff in System V ascftime routine */ |
Definition at line 70 of file strftime.c.
Definition at line 73 of file strftime.c.
adddecl | ( | static int iso8601wknum(); | ) |
Definition at line 103 of file strftime.c.
|
static |
Definition at line 807 of file strftime.c.
Referenced by iso8601wknum().
|
static |
Definition at line 848 of file strftime.c.
References isleap(), and weeknumber().
Referenced by iso8601wknum_v().
Definition at line 960 of file strftime.c.
References iso8601wknum(), and vtm2tm_noyear().
Referenced by rb_strftime_with_timespec().
|
inlinestatic |
Definition at line 147 of file strftime.c.
size_t rb_strftime | ( | char * | s, |
size_t | maxsize, | ||
const char * | format, | ||
const struct vtm * | vtm, | ||
VALUE | timev, | ||
int | gmt | ||
) |
Definition at line 792 of file strftime.c.
References NULL, and rb_strftime_with_timespec().
Referenced by rb_strftime_alloc().
size_t rb_strftime_timespec | ( | char * | s, |
size_t | maxsize, | ||
const char * | format, | ||
const struct vtm * | vtm, | ||
struct timespec * | ts, | ||
int | gmt | ||
) |
Definition at line 798 of file strftime.c.
References Qnil, and rb_strftime_with_timespec().
Referenced by rb_strftime_alloc().
|
static |
Definition at line 171 of file strftime.c.
References add, args, BIT_OF, div, err, errno, FILL_PADDING, FIX2LONG, FIXNUM_P, FLAG_FOUND, FMT, FMTV, vtm::hour, i, INT2FIX, ISLOWER, iso8601wknum_v(), ISUPPER, vtm::mday, vtm::min, mod, vtm::mon, mul, NEEDS, NULL, NUM2INT, NUM2LONG(), PRI_TIMET_PREFIX, range, rb_funcall(), rb_intern, rb_str_format(), rb_str_new2(), result, vtm::sec, snprintf, strchr(), STRFTIME, StringValueCStr, strlcpy(), strlen(), sub, TOLOWER, TOUPPER, timespec::tv_nsec, timespec::tv_sec, vtm::utc_offset, vtm::wday, weeknumber_v(), vtm::yday, vtm::year, and vtm::zone.
Referenced by rb_strftime(), and rb_strftime_timespec().
Definition at line 819 of file strftime.c.
References FIX2INT, vtm::hour, INT2FIX, vtm::isdst, vtm::mday, vtm::min, mod, vtm::mon, NUM2LONG(), vtm::sec, vtm::utc_offset, vtm::wday, vtm::yday, vtm::year, and vtm::zone.
Referenced by iso8601wknum_v(), and weeknumber_v().
|
static |
Referenced by iso8601wknum(), and weeknumber_v().
|
static |
Definition at line 975 of file strftime.c.
Definition at line 999 of file strftime.c.
References vtm2tm_noyear(), and weeknumber().
Referenced by rb_strftime_with_timespec().