annotate tools/gen_v8_binding.m4 @ 653:34710e86b4a2

Remove cairo-directfb.h but it will be needed at graphic layer initialization of SMP8654.
author Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
date Sat, 31 Jul 2010 16:36:53 +0800
parents aa52883534fc
children 32d0eef1ee46
rev   line source
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
1 dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
2 dnl Developers should provide SET, WRAP, UNWRAP, and THROW C macros.
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
3 dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 changequote(`[', `]')dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 include([foreach.m4])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 divert([-1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 define([UNQUOTE], [$*])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 define([QUOTE], [[[$*]]])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 define([COUNT],[ifelse([$*],[],0,[$#])])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 define([IMPORT],[define([$1],[$2$1(]$[]@[)])])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 define([PROJ_PREFIX], [xnjsmb_])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 define([START_ACCESSOR], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 divert([-1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 define([INT], [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 ]PROJ_PREFIX[]STRUCT_NAME[_get_$][1(Local<String> property, const AccessorInfo &info) {
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
23 Handle<Object> self = info.This();
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
24 STRUCT_TYPE *data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
25
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
26 data = (STRUCT_TYPE *)UNWRAP(self);
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 return Integer::New(data->$][1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 static void
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 ]PROJ_PREFIX[]STRUCT_NAME[_set_$][1(Local<String> property,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 Local<Value> value,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 const AccessorInfo &info) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 Handle<Object> self = info.This();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 STRUCT_TYPE *data;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 data = (STRUCT_TYPE *)UNWRAP(self);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 data->$][1 = value->Int32Value();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 define([OBJ], [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 ]PROJ_PREFIX[]STRUCT_NAME[_get_$][1(Local<String> property, const AccessorInfo &info) {
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
44 Handle<Object> self = info.This();
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
45 STRUCT_TYPE *data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
46
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
47 data = (STRUCT_TYPE *)UNWRAP(self);
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 return ]PROJ_PREFIX[$][2_new(data->$][1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 static void
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 ]PROJ_PREFIX[]STRUCT_NAME[_set_$][1(Local<String> property,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 Local<Value> value,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54 const AccessorInfo &info) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 Handle<Object> self = info.This();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 Handle<Object> obj;
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
57 $][3 *v;
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 STRUCT_TYPE *data;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
59
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
60 data = (STRUCT_TYPE *)UNWRAP(self);
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
61 obj = value->ToObject();
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
62 v = ($][3 *)UNWRAP(obj);
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
63 data->$][1 = v;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
65 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
66 define([STR], [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
67 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68 ]PROJ_PREFIX[]STRUCT_NAME[_get_$][1(Local<String> property, const AccessorInfo &info) {
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
69 Handle<Object> self = info.This();
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
70 STRUCT_TYPE *data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
71
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
72 data = (STRUCT_TYPE *)UNWRAP(self);
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73 return String::New(data->$][1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 static void
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77 ]PROJ_PREFIX[]STRUCT_NAME[_set_$][1(Local<String> property,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 Local<Value> value,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 const AccessorInfo &info) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 Handle<Object> self = info.This();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
81 STRUCT_TYPE *data;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
82
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
83 data = (STRUCT_TYPE *)UNWRAP(self);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
84 String::Utf8Value utf8(value->ToString());
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
85 free(data->$][1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
86 data->$][1 = strdup(*utf8);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
87 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
88 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
89 divert([])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
92 define([STOP_ACCESSOR], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
93 divert([-1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
94 undefine([INT])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
95 undefine([OBJ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
96 undefine([STR])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
97 divert([])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
98 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
99
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
100 define([SET_ACCESSSOR], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
101 define([INT], [$][1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
102 define([OBJ], [$][1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
103 define([STR], [$][1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
104 inst_temp->SetAccessor(String::New("$1"),
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
105 PROJ_PREFIX[]STRUCT_NAME[]_get_[]$1,
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
106 PROJ_PREFIX[]STRUCT_NAME[]_set_[]$1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
107 undefine([INT])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
108 undefine([OBJ])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
109 undefine([STR])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
110 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
111
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
112 define([START_METHOD_ARG_VAR], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
113 define([INT], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
114 int arg_$][1;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
115 ])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
116 define([OBJ], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
117 $][2 *arg_$][1;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
118 ])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
119 define([STR], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
120 char *arg_$][1;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
121 ])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
122 define([FUNC], [dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
123 Handle<Function> arg_$][1;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
124 ])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
125 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
126
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
127 define([START_METHOD_ARG_TYPE_CHK], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
128 define([INT], [ ||
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
129 !args[[i++]]->IsInt32()])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
130 define([OBJ], [ ||
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
131 !args[[i++]]->IsObject()])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
132 define([STR], [ ||
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
133 !args[[i++]]->IsString()])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
134 define([FUNC], [ ||
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
135 !args[[i++]]->IsFunction()])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
136 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
137
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
138 define([START_METHOD_ARG_ASSIGN], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
139 define([INT], [dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
140 arg_$][1 = args[[i++]]->Int32Value();
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
141 ])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
142 define([OBJ], [dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
143 arg_$][1 = ($][2 *)UNWRAP(args[[i++]]->ToObject());
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
144 ])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
145 define([STR], [dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
146 arg_$][1 = strdup(*String::Utf8Value(args[[i++]]->ToString()));
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
147 ])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
148 define([FUNC], [dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
149 arg_$][1 = args[[i++]].As<Function>();
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
150 ])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
151 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
152
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
153 define([START_METHOD_ARG_PASS], [dnl
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
154 define([INT], [arg_$][1])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
155 define([OBJ], [arg_$][1])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
156 define([STR], [arg_$][1])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
157 define([FUNC], [arg_$][1])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
158 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
159
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
160 define([START_METHOD_RET_VAL], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
161 define([INT], [dnl
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
162 int _ret;
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
163 ])dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
164 define([OBJ], [dnl
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
165 $][2 *_ret;
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
166 ])dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
167 define([STR], [dnl
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
168 char *_ret;
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
169 ])dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
170 define([FUNC], [dnl
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
171 Handle<Function> _ret;
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
172 ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
173 ])
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
174
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
175 define([START_METHOD_RET_ASSIGN], [dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
176 define([INT], [_ret = (int)])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
177 define([OBJ], [_ret = ($][2 *)])dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
178 define([STR], [_ret = (char *)])dnl
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
179 define([FUNC], [_ret = ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
180 ])
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
181
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
182 define([START_METHOD_RET], [dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
183 define([INT], [
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
184 return Integer::New(_ret);
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
185 ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
186 define([OBJ], [
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
187 return PROJ_PREFIX[]$][1[]_new(_ret);
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
188 ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
189 define([STR], [
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
190 return String::New(_ret);
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
191 ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
192 define([FUNC], [
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
193 return _ret;
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
194 ])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
195 ])
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
196
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
197 define([STOP_METHOD_ARG], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
198 undefine([INT])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
199 undefine([OBJ])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
200 undefine([STR])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
201 undefine([FUNC])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
202 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
203
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
204 define([START_METHOD], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
205 define([METHOD], [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
206 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
207 PROJ_PREFIX[]STRUCT_NAME[]_$][1(const Arguments &args) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
208 int i;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
209 int argc = args.Length();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
210 Handle<Object> self = args.This();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
211 STRUCT_TYPE *_self = (STRUCT_TYPE *)UNWRAP(self);
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
212 foreach([ITER], $][3, [START_METHOD_ARG_VAR[]ITER[]STOP_METHOD_ARG])dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
213 START_METHOD_RET_VAL[]$][5[]STOP_METHOD_ARG
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
214
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
215 if(argc != $][4)
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
216 THROW("Invalid number of arguments (!=$][4)");
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
217 i = 0;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
218 if(0]dnl
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
219 foreach([ITER], $][3, [START_METHOD_ARG_TYPE_CHK[]ITER[]STOP_METHOD_ARG])[)
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
220 THROW("Invalid argument type");
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
221
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
222 i = 0;
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
223 foreach([ITER], $][3, [START_METHOD_ARG_ASSIGN[]ITER[]STOP_METHOD_ARG])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
224
649
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
225 START_METHOD_RET_ASSIGN[]$][5[]STOP_METHOD_ARG[]$][2(_self[]foreach([ITER], $][3, [START_METHOD_ARG_PASS[], ITER[]STOP_METHOD_ARG]));
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
226 START_METHOD_RET[]$][5[]STOP_METHOD_ARG[]dnl
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
227 ifelse($][5, [], [
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
228 return Null();
2030e5d9f7f7 Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents: 648
diff changeset
229 ])dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
230 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
231 ])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
232 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
233
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
234 define([STOP_METHOD], [undefine([METHOD])])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
235
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
236 define([SET_METHOD], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
237 define([METHOD], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
238 SET(proto_temp, "$][1",
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
239 FunctionTemplate::New(PROJ_PREFIX[]STRUCT_NAME[]_$][1));
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
240 ])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
241 $1[]dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
242 undefine([METHOD])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
243 ])
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
244
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
245 dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
246 dnl STRUCT(struct_name, struct_type, member_vars, methods)
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
247 dnl
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
248 define([STRUCT], [dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
249 define([STRUCT_NAME], [$1])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
250 define([STRUCT_TYPE], [$2])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
251 [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
252 /* **************************************************
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
253 * STRUCT: $1
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
254 * Generated by gen_v8_binding.m4
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
255 */
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
256 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
257 ]PROJ_PREFIX[$1(const Arguments &args) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
258 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
259
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
260 static Persistent<FunctionTemplate> ]PROJ_PREFIX[$1][_temp;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
261
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
262 static Handle<Value>
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
263 ]PROJ_PREFIX[$1][_new($2 *data) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
264 Handle<Object> obj;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
265 Handle<Function> func;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
266
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
267 func = ]PROJ_PREFIX[$1][_temp->GetFunction();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
268 obj = func->NewInstance();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
269 WRAP(obj, data);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
270
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
271 return obj;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
272 }
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
273 ]dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
274 foreach([ITER], ($3), [START_ACCESSOR ITER STOP_ACCESSOR])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
275 foreach([ITER], ($4), [START_METHOD ITER STOP_METHOD])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
276 [
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
277 static void
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
278 ]PROJ_PREFIX[$1][_init(void) {
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
279 Handle<FunctionTemplate> func_temp;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
280 Handle<ObjectTemplate> inst_temp;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
281 Handle<ObjectTemplate> proto_temp;
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
282
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
283 func_temp = FunctionTemplate::New(]PROJ_PREFIX[$1);
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
284 func_temp->SetClassName(String::New("]STRUCT_NAME["));
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
285 inst_temp = func_temp->InstanceTemplate();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
286 inst_temp->SetInternalFieldCount(1);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
287 ]
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
288 foreach([ITER], ($3), [SET_ACCESSSOR(ITER)])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
289 inst_temp = func_temp->InstanceTemplate();
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
290
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
291 foreach([ITER], ($4), [SET_METHOD(ITER)])dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
292
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
293 PROJ_PREFIX[$1][_temp = Persistent<FunctionTemplate>::New(func_temp);
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
294 }]dnl
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
295 ])
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
296
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
297 dnl
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
298 dnl FUNCTION(func_name, real_func, arguments, arguement_count, return_type)
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
299 dnl
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
300 define([FUNCTION], [dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
301 /* **************************************************
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
302 * [FUNCTION]: $1
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
303 * Generated by gen_v8_binding.m4
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
304 */
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
305 static Handle<Value>
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
306 PROJ_PREFIX[]$1(const Arguments &args) {
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
307 int argc = args.Length();
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
308 int i;
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
309 foreach([ITER], ($3), [START_METHOD_ARG_VAR[]ITER[]STOP_METHOD_ARG])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
310 START_METHOD_RET_VAL[]$5[]STOP_METHOD_ARG[]dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
311
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
312 if(argc != $4)
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
313 THROW("Invalid number of arguments (!=$][4)");
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
314 i = 0;
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
315 if(0]dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
316 [foreach([ITER], ($3), [START_METHOD_ARG_TYPE_CHK[]ITER[]STOP_METHOD_ARG]))
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
317 THROW("Invalid argument type");
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
318
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
319 i = 0;
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents: 650
diff changeset
320 foreach([ITER], ($3), [START_METHOD_ARG_ASSIGN[]ITER[]STOP_METHOD_ARG])dnl
650
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
321
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
322 define([SEP], [])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
323 START_METHOD_RET_ASSIGN[]$5[]STOP_METHOD_ARG[]$2(foreach([ITER], ($3), [START_METHOD_ARG_PASS[]SEP[]ITER[]STOP_METHOD_ARG[]define([SEP], [, ])]));[]undefine([SEP])
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
324 START_METHOD_RET[]$][5[]STOP_METHOD_ARG[]dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
325 ifelse($][5, [], [
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
326 return Null();
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
327 ])dnl
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
328 }
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
329 static Persistent<FunctionTemplate> PROJ_PREFIX[]$1[]_temp;
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
330
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
331 static void
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
332 PROJ_PREFIX[]$1[]_init(void) {
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
333 Handle<FunctionTemplate> func_temp;
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
334
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
335 func_temp = FunctionTemplate::New(PROJ_PREFIX[]$1);
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
336 PROJ_PREFIX[]$1[]_temp = Persistent<FunctionTemplate>::New(func_temp);
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
337 }
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
338 ])
123e7eeff10c Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents: 649
diff changeset
339
648
e13dbfd37eab JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
340 divert([])dnl