1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-07-07 03:20:53 +00:00
parent 1ec4d9d3e4
commit 3043170b14
8 changed files with 58 additions and 15 deletions

View file

@ -1,6 +1,27 @@
Fri Jul 7 03:30:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* parse.y (aref_args): should allow Hash[:a=>2] etc.
* numeric.c (fix_aref): convert index by NUM2INT, not FIX2INT.
(ruby-bugs:#PR37)
* time.c (time_localtime): should prohibit for frozen time.
* time.c (time_gmtime): ditto.
Thu Jul 6 19:12:12 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (rb_file_s_open): should not terminate fptr; just clear it.
* ruby.c (proc_options): should not call require_libraries()
twice.
* ruby.c (require_libraries): clear req_list_head.next after
execution.
Thu Jul 6 13:51:57 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* object.c (rb_to_id): name may not be symbol or fixnum.
* object.c (rb_to_id): name may not be symbol nor fixnum.
* struct.c (rb_struct_s_def): name may be nil.
@ -40,7 +61,7 @@ Wed Jul 5 09:47:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* io.c (rb_io_reopen): clear fptr->path after free() to prevent
potential GC crash.
* io.c (rb_file_s_open): terminate fptr uless null.
* io.c (rb_file_s_open): terminate fptr unless null.
* io.c (rb_file_initialize): ditto.

View file

@ -585,7 +585,7 @@ at the top of the file. You can use the functions below to check the
condition.
have_library(lib, func): check whether library containing function exists.
have_func(func): check whether function exists
have_func(func, header): check whether function exists
have_header(header): check whether header file exists
create_makefile(target): generate Makefile
@ -975,11 +975,11 @@ These functions are available in extconf.rb:
Checks whether library which contains specified function exists.
Returns true if the library exists.
have_func(func)
have_func(func, header)
Checks whether func exists. Returns true if the function exists. To
check functions in the additional library, you need to check that
library first using have_library().
Checks whether func exists with header. Returns true if the function
exists. To check functions in the additional library, you need to
check that library first using have_library().
have_header(header)

View file

@ -694,7 +694,7 @@ Makefile
数を使うことが出来ます.
have_library(lib, func): ライブラリの存在チェック
have_func(func): 関数の存在チェック
have_func(func, header): 関数の存在チェック
have_header(header): ヘッダファイルの存在チェック
create_makefile(target): Makefileの生成
@ -1134,11 +1134,12 @@ find_library(lib, func, path...)
関数funcを定義しているライブラリlibの存在を -Lpath を追加
しながらチェックするライブラリが見付かった時trueを返す
have_func(func)
have_func(func, header)
関数funcの存在をチェックするfuncが標準ではリンクされない
ライブラリ内のものである時には先にhave_libraryでそのライブ
ラリをチェックしておく事関数が存在する時trueを返す
ヘッダファイルheaderをインクルードして関数funcの存在をチェッ
クするfuncが標準ではリンクされないライブラリ内のものであ
る時には先にhave_libraryでそのライブラリをチェックしておく
関数が存在する時trueを返す
have_header(header)

2
ToDo
View file

@ -6,7 +6,7 @@ Language Spec.
- %w(a\ b\ c abc) => ["a b c", "abc"]
- objectify symbols
- class variable (prefix @@)
- rescue RuntimeError =>n err
- rescue RuntimeError => err
* operator !! for rescue. ???
* objectify characters
* ../... outside condition invokes operator method too.

View file

@ -1314,7 +1314,7 @@ fix_aref(fix, idx)
VALUE fix, idx;
{
unsigned long val = FIX2LONG(fix);
int i = FIX2LONG(idx);
int i = NUM2INT(idx);
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i)
return INT2FIX(0);

View file

@ -862,6 +862,14 @@ aref_args : none
value_expr($4);
$$ = arg_concat($1, $4);
}
| assocs
{
$$ = NEW_LIST(NEW_HASH($1));
}
| assocs ','
{
$$ = NEW_LIST(NEW_HASH($1));
}
| tSTAR arg opt_nl
{
value_expr($2);
@ -3381,6 +3389,7 @@ yylex()
tokadd(c);
tokfix();
yylval.id = rb_intern(tok());
/* xxx shouldn't check if valid option variable */
return tGVAR;
case '&': /* $&: last match */

3
ruby.c
View file

@ -255,6 +255,7 @@ require_libraries()
free(list);
list = tmp;
}
req_list_head.next = 0;
ruby_eval_tree = save[0];
ruby_eval_tree_begin = save[1];
ruby_sourcefile = orig_sourcefile;
@ -638,7 +639,6 @@ proc_options(argc, argv)
rb_compile_string(script, e_script, 1);
}
else if (strlen(script) == 1 && script[0] == '-') {
require_libraries();
load_stdin();
}
else {
@ -925,6 +925,7 @@ ruby_prog_init()
ruby_sourcefile = "ruby";
rb_define_variable("$VERBOSE", &ruby_verbose);
rb_define_variable("$-v", &ruby_verbose);
rb_define_variable("$-w", &ruby_verbose);
rb_define_variable("$DEBUG", &ruby_debug);
rb_define_variable("$-d", &ruby_debug);
rb_define_readonly_variable("$-p", &do_print);

11
time.c
View file

@ -535,6 +535,15 @@ time_clone(time)
return clone;
}
static void
time_modify(time)
VALUE time;
{
if (OBJ_FROZEN(time)) rb_error_frozen("Time");
if (!OBJ_TAINTED(time) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify Time");
}
static VALUE
time_localtime(time)
VALUE time;
@ -547,6 +556,7 @@ time_localtime(time)
if (tobj->tm_got && !tobj->gmt) {
return time;
}
time_modify(time);
t = tobj->tv.tv_sec;
tm_tmp = localtime(&t);
tobj->tm = *tm_tmp;
@ -567,6 +577,7 @@ time_gmtime(time)
if (tobj->tm_got && tobj->gmt) {
return time;
}
time_modify(time);
t = tobj->tv.tv_sec;
tm_tmp = gmtime(&t);
tobj->tm = *tm_tmp;