From c9f299957dd67253529ea7053526c25fbaccd345 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 10 May 2010 07:59:48 -0500 Subject: [PATCH] move message init to v8_msg.ccp --- ext/v8/v8.cpp | 13 +------------ ext/v8/v8_msg.cpp | 12 ++++++++++++ ext/v8/v8_msg.h | 4 +++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ext/v8/v8.cpp b/ext/v8/v8.cpp index 0bf98ae..1f8e0cd 100644 --- a/ext/v8/v8.cpp +++ b/ext/v8/v8.cpp @@ -37,17 +37,6 @@ extern "C" { rr_init_template(); rr_init_obj(); rr_init_func(); - - - V8_C_Message = rb_define_class_under(rb_mNative, "Message", rb_cObject); - rb_define_method(V8_C_Message, "Get", (VALUE(*)(...))v8_Message_Get, 0); - rb_define_method(V8_C_Message, "GetSourceLine", (VALUE(*)(...))v8_Message_GetSourceLine, 0); - rb_define_method(V8_C_Message, "GetScriptResourceName", (VALUE(*)(...))v8_Message_GetScriptResourceName, 0); - rb_define_method(V8_C_Message, "GetLineNumber", (VALUE(*)(...))v8_Message_GetLineNumber, 0); - rb_define_method(V8_C_Message, "GetStartPosition", (VALUE(*)(...))v8_Message_GetStartPosition, 0); - rb_define_method(V8_C_Message, "GetEndPosition", (VALUE(*)(...)) v8_Message_GetEndPosition, 0); - rb_define_method(V8_C_Message, "GetStartColumn", (VALUE(*)(...)) v8_Message_GetStartColumn, 0); - rb_define_method(V8_C_Message, "GetEndColumn", (VALUE(*)(...)) v8_Message_GetEndColumn, 0); - + rr_init_msg(); } } diff --git a/ext/v8/v8_msg.cpp b/ext/v8/v8_msg.cpp index 02461e6..d4370e9 100644 --- a/ext/v8/v8_msg.cpp +++ b/ext/v8/v8_msg.cpp @@ -6,6 +6,18 @@ using namespace v8; VALUE V8_C_Message; +void rr_init_msg() { + V8_C_Message = rr_define_class("Message"); + rb_define_method(V8_C_Message, "Get", (VALUE(*)(...))v8_Message_Get, 0); + rb_define_method(V8_C_Message, "GetSourceLine", (VALUE(*)(...))v8_Message_GetSourceLine, 0); + rb_define_method(V8_C_Message, "GetScriptResourceName", (VALUE(*)(...))v8_Message_GetScriptResourceName, 0); + rb_define_method(V8_C_Message, "GetLineNumber", (VALUE(*)(...))v8_Message_GetLineNumber, 0); + rb_define_method(V8_C_Message, "GetStartPosition", (VALUE(*)(...))v8_Message_GetStartPosition, 0); + rb_define_method(V8_C_Message, "GetEndPosition", (VALUE(*)(...)) v8_Message_GetEndPosition, 0); + rb_define_method(V8_C_Message, "GetStartColumn", (VALUE(*)(...)) v8_Message_GetStartColumn, 0); + rb_define_method(V8_C_Message, "GetEndColumn", (VALUE(*)(...)) v8_Message_GetEndColumn, 0); +} + VALUE V8_Wrap_Message(Handle msg) { return V8_Ref_Create(V8_C_Message, msg); } diff --git a/ext/v8/v8_msg.h b/ext/v8/v8_msg.h index 97233ea..14db3ab 100644 --- a/ext/v8/v8_msg.h +++ b/ext/v8/v8_msg.h @@ -2,9 +2,11 @@ #define _RUBY_V8_MESSAGE_ #include "v8.h" -#include "ruby.h" +#include "rr.h" extern VALUE V8_C_Message; +void rr_init_msg(); + VALUE V8_Wrap_Message(v8::Handle msg); VALUE v8_Message_Get(VALUE self); VALUE v8_Message_GetSourceLine(VALUE self);