* include/ruby/ruby.h (RB_EVENT_HOOKS_HAVE_CALLBACK_DATA):

new macro for compatibility check.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-05-21 03:07:45 +00:00
parent 060f433f48
commit c6a24c45f8
4 changed files with 27 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Thu May 21 12:07:43 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (RB_EVENT_HOOKS_HAVE_CALLBACK_DATA):
new macro for compatibility check.
Thu May 21 01:43:40 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/ruby.h (rb_long2int, RARRAY_LENINT): check long to

View File

@ -1234,7 +1234,7 @@ Specifies the name of the script ($0).
** Hooks for the Interpreter Events
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_t events)
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
Adds a hook function for the specified interpreter events.
events should be Or'ed value of:
@ -1251,9 +1251,13 @@ events should be Or'ed value of:
The definition of rb_event_hook_func_t is below:
typedef void (*rb_event_hook_func_t)(rb_event_t event, NODE *node,
typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
VALUE self, ID id, VALUE klass)
The third argument `data' to rb_add_event_hook() is passed to the hook
function as the second argument, which was the pointer to the current
NODE in 1.8. See RB_EVENT_HOOKS_HAVE_CALLBACK_DATA below.
int rb_remove_event_hook(rb_event_hook_func_t func)
Removes the specified hook function.
@ -1293,6 +1297,11 @@ Defined in ruby.h and means correspoinding header is available. For
instance, when HAVE_RUBY_ST_H is defined you should use ruby/st.h not
mere st.h.
RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
Means that rb_add_event_hook() takes the third argument `data', to be
passed to the given event hook function.
Appendix C. Functions Available in extconf.rb
These functions are available in extconf.rb:

View File

@ -1332,7 +1332,7 @@ void ruby_script(char *name)
** インタプリタのイベントのフック
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_t events)
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
指定されたインタプリタのイベントに対するフック関数を追加します.
eventsは以下の値のorでなければなりません:
@ -1349,9 +1349,13 @@ events
rb_event_hook_func_tの定義は以下の通りです:
typedef void (*rb_event_hook_func_t)(rb_event_t event, NODE *node,
typedef void (*rb_event_hook_func_t)(rb_event_t event, VALUE data,
VALUE self, ID id, VALUE klass)
rb_add_event_hook() の第3引数 data はフック関数の第2引数と
して渡されますこれは1.8では現在のNODEへのポインタでした
下の RB_EVENT_HOOKS_HAVE_CALLBACK_DATA も参照してください.
int rb_remove_event_hook(rb_event_hook_func_t func)
指定されたフック関数を削除します.
@ -1393,6 +1397,10 @@ HAVE_RUBY_*_H
を意味するたとえばHAVE_RUBY_ST_H が定義されている場合は
単なる st.h ではなく ruby/st.h を使用する.
RB_EVENT_HOOKS_HAVE_CALLBACK_DATA
rb_add_event_hook() がフック関数に渡す data を第3引数として
受け取ることを意味する.
Appendix C. extconf.rbで使える関数たち

View File

@ -1220,6 +1220,7 @@ typedef struct rb_event_hook_struct {
struct rb_event_hook_struct *next;
} rb_event_hook_t;
#define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events,
VALUE data);
int rb_remove_event_hook(rb_event_hook_func_t func);