This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
/
v8.c
100 lines (95 loc) · 2.62 KB
/
v8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "ruby.h"
void Init_v8() {
VALUE rb_mVB = rb_define_module("V8");
rb_define_class_under(rb_mV8, "Context", rb_cObject);
// rb_define_alloc_func(rb_cContext, rv8_Context__alloc);
}
// v8.c: In function ‘Init_v8’:
// v8.c:5: error: ‘rb_mV8’ undeclared (first use in this function)
// v8.c:5: error: (Each undeclared identifier is reported only once
// v8.c:5: error: for each function it appears in.)
// make: *** [v8.o] Error 1
// #include "glue.h"
//
// VALUE rb_mV8;
// VALUE rb_cContext;
//
//
// VALUE rv8_Context__dealloc(VALUE self) {
// printf("dealloc\n");
// void * context;
// Data_Get_Struct(self, void, context);
// return Qnil;
// }
//
// VALUE rv8_Context__alloc() {
// printf("alloc\n");
// void * context = cpp_v8_Context__new();
// VALUE instance = Data_Wrap_Struct(rb_cContext, -1, rv8_Context__dealloc, context);
// rb_obj_init(instance);
// return instance;
// }
//
// VALUE rv8_Context_pooh(VALUE self) {
// int * i;
// Data_Get_Struct(self, int , i);
// return INT2NUM(*i);
// }
//
// void Init_v8() {
// rb_mV8 = rb_define_module("V8");
// rb_cContext = rb_define_class_under(rb_mV8, "Context", rb_cObject);
// rb_define_alloc_func(rb_cContext, rv8_Context__alloc);
// }
// #include <v8.h>
// #include <stdio.h>
//
//
// using namespace v8;
//
// extern "C" {
// #include "ruby.h"
//
// VALUE rv8;
// VALUE rv8_Context;
//
// VALUE rv8_Context_new(...);
// VALUE rv8_Context_enter(VALUE self);
//
// VALUE rv8_Context__alloc(VALUE klass);
// void rv8_Context_free(VALUE robj);
//
// void Init_rchassis() {
// rv8 = rb_define_module("V8");
// rv8_Context = rb_define_class_under(rv8, "Context", rb_cObject);
// rb_define_alloc_func(rv8_Context, rv8_Context__alloc);
// rb_define_method(rv8_Context, "enter", rv8_Context_enter, 0);
// }
//
// VALUE rv8_Context__alloc(VALUE klass) {
// Persistent<Context> context = Context::New();
// VALUE robj = Data_Wrap_Struct(rv8_Context, -1, rv8_Context_free, &context);
// return robj;
// }
//
// VALUE rv8_Context_enter(VALUE self) {
//
// }
//
// void rv8_Context_free(VALUE robj) {
// Persistent<Context> * context;
// printf("Let my people go!");
// Data_Get_Struct(robj, Persistent<Context> , context);
// printf("Get my people!");
// context->Dispose();
// }
//
// // VALUE rv8_Context_open(...) {
// // HandleScope scopes;
// // Persistent<Context> context = Context::New();
// // Context::Scope scope(context);
// // VALUE result = rb_yield(Qnil);
// // context.Dispose();
// // return result;
// // }
// }