diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-05 01:13:19 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-05 01:13:19 +0000 |
commit | a975bf245f30d1ea1f48dc6087148a7cee52af04 (patch) | |
tree | 6d2f04f4bfeffc459df952f51657e2dd4bf5e5fa /ext/date/date_tmx.h | |
parent | 2473b2ceafb95a1240369cc6b951343d623cfd5a (diff) | |
download | ruby-a975bf245f30d1ea1f48dc6087148a7cee52af04.tar.gz |
* ext/date/date_tmx.h: now does not place decoded data. allows to
access indirectly via functions on demand.
* ext/date/date_strftime.c: ditto.
* ext/date/date_core.c: ditto.
* ext/date/date_core.c ({d|dt}_lite_to_s): use strftime.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_tmx.h')
-rw-r--r-- | ext/date/date_tmx.h | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/ext/date/date_tmx.h b/ext/date/date_tmx.h index cdb5b0ddad..2bdb80c316 100644 --- a/ext/date/date_tmx.h +++ b/ext/date/date_tmx.h @@ -1,17 +1,50 @@ +#ifndef DATE_TMX_H +#define DATE_TMX_H + +struct tmx_funcs { + VALUE (*year)(void *dat); + int (*yday)(void *dat); + int (*mon)(void *dat); + int (*mday)(void *dat); + VALUE (*cwyear)(void *dat); + int (*cweek)(void *dat); + int (*cwday)(void *dat); + int (*wnum0)(void *dat); + int (*wnum1)(void *dat); + int (*wday)(void *dat); + int (*hour)(void *dat); + int (*min)(void *dat); + int (*sec)(void *dat); + VALUE (*offset)(void *dat); + char *(*zone)(void *dat); + VALUE (*timev)(void *dat); +}; struct tmx { - VALUE year; - int yday; - int mon; - int mday; - int hour; - int min; - int sec; - int wday; - VALUE offset; - const char *zone; - VALUE timev; + void *dat; + struct tmx_funcs *funcs; }; +#define tmx_attr(x) (tmx->funcs->x)(tmx->dat) + +#define tmx_year tmx_attr(year) +#define tmx_yday tmx_attr(yday) +#define tmx_mon tmx_attr(mon) +#define tmx_mday tmx_attr(mday) +#define tmx_cwyear tmx_attr(cwyear) +#define tmx_cweek tmx_attr(cweek) +#define tmx_cwday tmx_attr(cwday) +#define tmx_wnum0 tmx_attr(wnum0) +#define tmx_wnum1 tmx_attr(wnum1) +#define tmx_wday tmx_attr(wday) +#define tmx_hour tmx_attr(hour) +#define tmx_min tmx_attr(min) +#define tmx_sec tmx_attr(sec) +#define tmx_offset tmx_attr(offset) +#define tmx_zone tmx_attr(zone) +#define tmx_timev tmx_attr(timev) + +#endif + /* Local variables: c-file-style: "ruby" |