Ruby: move to 1.9 version

Originally committed to SVN as r919.
This commit is contained in:
pomyk 2007-02-01 18:20:55 +00:00
parent 5aaf235655
commit b5ac82d5b2
3 changed files with 18 additions and 10 deletions

View file

@ -137,7 +137,7 @@ namespace Automation4 {
rb_protect(rbLoadWrapper, rb_str_new2(t), &status); rb_protect(rbLoadWrapper, rb_str_new2(t), &status);
if(status > 0) // something bad happened (probably parsing error) if(status > 0) // something bad happened (probably parsing error)
{ {
throw StringValueCStr(ruby_errinfo); //throw StringValueCStr(ruby_errinfo);
} }
VALUE global_var = rb_gv_get("$script_name"); VALUE global_var = rb_gv_get("$script_name");
@ -564,7 +564,7 @@ namespace Automation4 {
VALUE result; VALUE result;
result = rb_protect(rbCallWrapper, reinterpret_cast<VALUE>(&arg), &error); result = rb_protect(rbCallWrapper, reinterpret_cast<VALUE>(&arg), &error);
if(error) { if(error) {
throw StringValueCStr(ruby_errinfo); //throw StringValueCStr(ruby_errinfo);
} }
return result; return result;
} }

View file

@ -350,7 +350,7 @@ namespace Automation4 {
new_entry = reinterpret_cast<AssEntry*>(rb_protect(rb2AssWrapper, rbEntry, &status)); new_entry = reinterpret_cast<AssEntry*>(rb_protect(rb2AssWrapper, rbEntry, &status));
--size; --size;
}while(status != 0); // broken lines at the beginning? }while(status != 0); // broken lines at the beginning?
ruby_errinfo = Qnil; // just in case rb_set_errinfo(Qnil);; // just in case
entryIter e = ass->Line.begin(); entryIter e = ass->Line.begin();
if(new_entry->GetType() == ENTRY_DIALOGUE) // check if the first line is a dialogue if(new_entry->GetType() == ENTRY_DIALOGUE) // check if the first line is a dialogue
@ -368,10 +368,14 @@ namespace Automation4 {
rbEntry = rb_ary_shift(subtitles); rbEntry = rb_ary_shift(subtitles);
new_entry = reinterpret_cast<AssEntry*>(rb_protect(rb2AssWrapper, rbEntry, &status)); new_entry = reinterpret_cast<AssEntry*>(rb_protect(rb2AssWrapper, rbEntry, &status));
if(status == 0) ass->Line.push_back(new_entry); if(status == 0) ass->Line.push_back(new_entry);
else { else
{
if(RubyProgressSink::inst) if(RubyProgressSink::inst)
RubyProgressSink::inst->RubyDebugOut(1, &ruby_errinfo, Qnil); {
ruby_errinfo = Qnil; // clear the error VALUE err = rb_errinfo();
RubyProgressSink::inst->RubyDebugOut(1, &err, Qnil);
}
rb_set_errinfo(Qnil);
} }
} }
RubyObjects::Get()->Unregister(subtitles); RubyObjects::Get()->Unregister(subtitles);
@ -418,10 +422,14 @@ namespace Automation4 {
{ {
VALUE res = rb_protect(rbAss2RbWrapper, reinterpret_cast<VALUE>(*entry), &status); VALUE res = rb_protect(rbAss2RbWrapper, reinterpret_cast<VALUE>(*entry), &status);
if(status == 0) rb_ary_push(rbAssFile, res); if(status == 0) rb_ary_push(rbAssFile, res);
else { else
{
if(RubyProgressSink::inst) if(RubyProgressSink::inst)
RubyProgressSink::inst->RubyDebugOut(1, &ruby_errinfo, Qnil); {
ruby_errinfo = Qnil; VALUE err = rb_errinfo();
RubyProgressSink::inst->RubyDebugOut(1, &err, Qnil);
}
rb_set_errinfo(Qnil);
} }
} }

View file

@ -34,7 +34,7 @@
// //
#include "auto4_ruby.h" #include "auto4_ruby.h"
#include "../ruby/include/ruby.h" #include <ruby.h>
#include <wx/window.h> #include <wx/window.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/gbsizer.h> #include <wx/gbsizer.h>