git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-07-25 07:21:54 +00:00
Родитель 2f7ff9d1b8
Коммит 993204f632
4 изменённых файлов: 34 добавлений и 20 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Tue Jul 25 15:16:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (rb_p): redirect to $defout.
Mon Jul 24 18:52:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp> Mon Jul 24 18:52:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* win32/win32.c (win32_getenv): should remove `static'. * win32/win32.c (win32_getenv): should remove `static'.

6
io.c
Просмотреть файл

@ -2108,10 +2108,8 @@ void
rb_p(obj) /* for debug print within C code */ rb_p(obj) /* for debug print within C code */
VALUE obj; VALUE obj;
{ {
obj = rb_obj_as_string(rb_inspect(obj)); rb_io_write(rb_defout, rb_obj_as_string(rb_inspect(obj)));
fwrite(RSTRING(obj)->ptr, 1, RSTRING(obj)->len, stdout); rb_io_write(rb_defout, rb_default_rs);
obj = rb_default_rs;
fwrite(RSTRING(obj)->ptr, 1, RSTRING(obj)->len, stdout);
} }
static VALUE static VALUE

Просмотреть файл

@ -28,6 +28,7 @@
include Math include Math
require "date.rb" require "date.rb"
require "parsearg.rb" require "parsearg.rb"
require "parsedate.rb"
def usage() def usage()
print "Usage:\n" print "Usage:\n"
@ -56,22 +57,31 @@ def getPosition(z)
return phys, emot, geist return phys, emot, geist
end end
def parsedate(s)
ParseDate::parsedate(s).indexes(0, 1, 2)
end
def name_of_week(date)
Date::DAYNAMES[(date.jd + 1) % 7]
end
# #
# main program # main program
# #
parseArgs(0, nil, "vg", "D:", "sdate", "date:", "birthday:", "days:") parseArgs(0, nil, "vg", "D:", "sdate", "date:", "birthday:", "days:")
if $OPT_D if $OPT_D
dd = Date.new(Time.now.strftime("%Y%m%d")) now = Time.now
bd = Date.new($OPT_D) dd = Date.new(now.year, now.month, now.day)
bd = Date.new(*parsedate($OPT_D))
ausgabeart = "g" ausgabeart = "g"
else else
if $OPT_birthday if $OPT_birthday
bd = Date.new($OPT_birthday) bd = Date.new(*parsedate($OPT_birthday))
else else
printf(STDERR, "Birthday (YYYYMMDD) : ") printf(STDERR, "Birthday (YYYYMMDD) : ")
if (si = STDIN.gets.chop) != "" if (si = STDIN.gets.chop) != ""
bd = Date.new(si) bd = Date.new(*parsedate(si))
end end
end end
if !bd if !bd
@ -80,17 +90,19 @@ else
end end
if $OPT_sdate if $OPT_sdate
dd = Date.new(Time.now.strftime("%Y%m%d")) now = Time.now
dd = Date.new(now.year, now.month, now.day)
elsif $OPT_date elsif $OPT_date
dd = Date.new($OPT_date) dd = Date.new(*parsedate($OPT_date))
else else
printf(STDERR, "Date [<RETURN> for Systemdate] (YYYYMMDD) : ") printf(STDERR, "Date [<RETURN> for Systemdate] (YYYYMMDD) : ")
if (si = STDIN.gets.chop) != "" if (si = STDIN.gets.chop) != ""
dd = Date.new(si) dd = Date.new(*parsedate(si))
end end
end end
if !dd if !dd
dd = Date.new(Time.now.strftime("%Y%m%d")) now = Time.now
dd = Date.new(now.year, now.month, now.day)
end end
if $OPT_v if $OPT_v
@ -103,10 +115,10 @@ else
end end
end end
if (ausgabeart == "v") if (ausgabeart == "v")
printHeader(bd.year, bd.month, bd.day, dd.period - bd.period, bd.name_of_week) printHeader(bd.year, bd.month, bd.day, dd.jd - bd.jd, name_of_week(bd))
print "\n" print "\n"
phys, emot, geist = getPosition(dd.period - bd.period) phys, emot, geist = getPosition(dd.jd - bd.jd)
printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day
printf "Physical: %d%%\n", phys printf "Physical: %d%%\n", phys
printf "Emotional: %d%%\n", emot printf "Emotional: %d%%\n", emot
@ -127,13 +139,13 @@ else
end end
end end
printHeader(bd.year, bd.month, bd.day, dd.period - bd.period, bd.name_of_week) printHeader(bd.year, bd.month, bd.day, dd.jd - bd.jd, name_of_week(bd))
print " P=physical, E=emotional, M=mental\n" print " P=physical, E=emotional, M=mental\n"
print " -------------------------+-------------------------\n" print " -------------------------+-------------------------\n"
print " Bad Condition | Good Condition\n" print " Bad Condition | Good Condition\n"
print " -------------------------+-------------------------\n" print " -------------------------+-------------------------\n"
for z in (dd.period - bd.period)..(dd.period - bd.period + display_period) for z in (dd.jd - bd.jd)..(dd.jd - bd.jd + display_period)
phys, emot, geist = getPosition(z) phys, emot, geist = getPosition(z)
printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.4" #define RUBY_VERSION "1.5.5"
#define RUBY_RELEASE_DATE "2000-07-24" #define RUBY_RELEASE_DATE "2000-07-25"
#define RUBY_VERSION_CODE 154 #define RUBY_VERSION_CODE 155
#define RUBY_RELEASE_CODE 20000724 #define RUBY_RELEASE_CODE 20000725