diff options
Diffstat (limited to 'ext/-test-')
-rw-r--r-- | ext/-test-/bug_reporter/bug_reporter.c | 24 | ||||
-rw-r--r-- | ext/-test-/bug_reporter/extconf.rb | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/ext/-test-/bug_reporter/bug_reporter.c b/ext/-test-/bug_reporter/bug_reporter.c new file mode 100644 index 0000000000..875c3a4617 --- /dev/null +++ b/ext/-test-/bug_reporter/bug_reporter.c @@ -0,0 +1,24 @@ +#include <ruby.h>
+#include <stdio.h>
+
+int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
+
+static void
+sample_bug_reporter(FILE *out, void *ptr)
+{
+ int n = (int)ptr;
+ fprintf(out, "Sample bug reporter: %d\n", n);
+}
+
+static VALUE
+register_sample_bug_reporter(VALUE self, VALUE obj)
+{
+ rb_bug_reporter_add(sample_bug_reporter, NUM2INT(obj));
+ return Qnil;
+}
+
+void
+Init_bug_reporter(void)
+{
+ rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1);
+}
diff --git a/ext/-test-/bug_reporter/extconf.rb b/ext/-test-/bug_reporter/extconf.rb new file mode 100644 index 0000000000..76c1e6ff78 --- /dev/null +++ b/ext/-test-/bug_reporter/extconf.rb @@ -0,0 +1 @@ +create_makefile("-test-/bug_reporter/bug_reporter")
|