summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:06:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-08 14:06:14 +0000
commitb12951c688e541308bd3869470cd751c159091c3 (patch)
treebd16ae067aa231ed4d8ef1f70e47e91d6c7f80e0 /eval.c
parent3081543be9a6b8b78839b79903cc1e87115e1a5a (diff)
* eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore. * eval.c (rb_thread_save_context): restore lastline and lastmatch. * numeric.c (flo_to_s): should handle negative float value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 78cb432967..1f6f9f4352 100644
--- a/eval.c
+++ b/eval.c
@@ -7154,6 +7154,7 @@ rb_thread_save_context(th)
{
VALUE *pos;
int len;
+ static VALUE tval;
len = stack_length(&pos);
th->stk_len = 0;
@@ -7181,8 +7182,12 @@ rb_thread_save_context(th)
th->tracing = tracing;
th->errinfo = ruby_errinfo;
th->last_status = rb_last_status;
- th->last_line = rb_lastline_get();
- th->last_match = rb_backref_get();
+ tval = rb_lastline_get();
+ rb_lastline_set(th->last_line);
+ th->last_line = tval;
+ tval = rb_backref_get();
+ rb_backref_set(th->last_match);
+ th->last_match = tval;
th->safe = ruby_safe_level;
th->file = ruby_sourcefile;
@@ -7246,6 +7251,7 @@ rb_thread_restore_context(th, exit)
VALUE v;
static rb_thread_t tmp;
static int ex;
+ static VALUE tval;
if (!th->stk_ptr) rb_bug("unsaved context");
@@ -7282,8 +7288,12 @@ rb_thread_restore_context(th, exit)
FLUSH_REGISTER_WINDOWS;
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
+ tval = rb_lastline_get();
rb_lastline_set(tmp->last_line);
+ tmp->last_line = tval;
+ tval = rb_backref_get();
rb_backref_set(tmp->last_match);
+ tmp->last_match = tval;
longjmp(tmp->context, ex);
}