mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (load_file): preserves $.. [ruby-core:24024]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0872a8c4a3
commit
7b90b70db2
3 changed files with 38 additions and 7 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Thu Jun 25 15:53:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (load_file): preserves $.. [ruby-core:24024]
|
||||
|
||||
Fri Jun 19 08:14:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (big_lshift, big_rshift): return Bignum always withou
|
||||
|
|
|
|||
35
ruby.c
35
ruby.c
|
|
@ -864,12 +864,19 @@ proc_options(argc, argv)
|
|||
|
||||
extern int ruby__end__seen;
|
||||
|
||||
static void
|
||||
load_file(fname, script)
|
||||
struct load_file_arg {
|
||||
const char *fname;
|
||||
int script;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
load_file_internal(arg)
|
||||
VALUE arg;
|
||||
{
|
||||
extern VALUE rb_stdin;
|
||||
struct load_file_arg *argp = (struct load_file_arg *)arg;
|
||||
const char *fname = argp->fname;
|
||||
int script = argp->script;
|
||||
VALUE f;
|
||||
int line_start = 1;
|
||||
|
||||
|
|
@ -919,7 +926,7 @@ load_file(fname, script)
|
|||
c = rb_io_getc(f);
|
||||
if (c == INT2FIX('#')) {
|
||||
line = rb_io_gets(f);
|
||||
if (NIL_P(line)) return;
|
||||
if (NIL_P(line)) return Qnil;
|
||||
line_start++;
|
||||
|
||||
if (RSTRING(line)->len > 2 && RSTRING(line)->ptr[0] == '!') {
|
||||
|
|
@ -972,7 +979,7 @@ load_file(fname, script)
|
|||
rb_io_ungetc(f, c);
|
||||
}
|
||||
require_libraries(); /* Why here? unnatural */
|
||||
if (NIL_P(c)) return;
|
||||
if (NIL_P(c)) return Qnil;
|
||||
}
|
||||
rb_compile_file(fname, f, line_start);
|
||||
if (script && ruby__end__seen) {
|
||||
|
|
@ -985,6 +992,26 @@ load_file(fname, script)
|
|||
if (ruby_parser_stack_on_heap()) {
|
||||
rb_gc();
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
restore_lineno(lineno)
|
||||
VALUE lineno;
|
||||
{
|
||||
return rb_gv_set("$.", lineno);
|
||||
}
|
||||
|
||||
static void
|
||||
load_file(fname, script)
|
||||
const char *fname;
|
||||
int script;
|
||||
{
|
||||
struct load_file_arg arg;
|
||||
arg.fname = fname;
|
||||
arg.script = script;
|
||||
rb_ensure(load_file_internal, (VALUE)&arg, restore_lineno, rb_gv_get("$."));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.8.8"
|
||||
#define RUBY_RELEASE_DATE "2009-06-23"
|
||||
#define RUBY_RELEASE_DATE "2009-06-25"
|
||||
#define RUBY_VERSION_CODE 188
|
||||
#define RUBY_RELEASE_CODE 20090623
|
||||
#define RUBY_RELEASE_CODE 20090625
|
||||
#define RUBY_PATCHLEVEL -1
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 8
|
||||
#define RUBY_RELEASE_YEAR 2009
|
||||
#define RUBY_RELEASE_MONTH 6
|
||||
#define RUBY_RELEASE_DAY 23
|
||||
#define RUBY_RELEASE_DAY 25
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue