Mercurial > MadButterfly
annotate tools/gen_v8_binding.m4 @ 659:d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 01 Aug 2010 11:28:09 +0800 |
parents | 32d0eef1ee46 |
children | dde4e3cc9529 |
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 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
16 define([EXPAND], [$1]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
17 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 define([PROJ_PREFIX], [xnjsmb_]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 define([START_ACCESSOR], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 divert([-1])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 define([INT], [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 ]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
|
25 Handle<Object> self = info.This(); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
26 STRUCT_TYPE *data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
27 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
28 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
|
29 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
|
30 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 static void |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 ]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
|
34 Local<Value> value, |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 const AccessorInfo &info) { |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 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
|
37 STRUCT_TYPE *data; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 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
|
40 data->$][1 = value->Int32Value(); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 ]) |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
43 define([NUMBER], [ |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
44 static Handle<Value> |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
45 ]PROJ_PREFIX[]STRUCT_NAME[_get_$][1(Local<String> property, const AccessorInfo &info) { |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
46 Handle<Object> self = info.This(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
47 STRUCT_TYPE *data; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
48 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
49 data = (STRUCT_TYPE *)UNWRAP(self); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
50 return Number::New(data->$][1); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
51 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
52 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
53 static void |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
54 ]PROJ_PREFIX[]STRUCT_NAME[_set_$][1(Local<String> property, |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
55 Local<Value> value, |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
56 const AccessorInfo &info) { |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
57 Handle<Object> self = info.This(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
58 STRUCT_TYPE *data; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
59 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
60 data = (STRUCT_TYPE *)UNWRAP(self); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
61 data->$][1 = value->NumberValue(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
62 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
63 ]) |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 define([OBJ], [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 ]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
|
67 Handle<Object> self = info.This(); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
68 STRUCT_TYPE *data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
69 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
70 data = (STRUCT_TYPE *)UNWRAP(self); |
657
32d0eef1ee46
Force type-casting for member variables.
Thinker K.F. Li <thinker@branda.to>
parents:
651
diff
changeset
|
71 return ]PROJ_PREFIX[$][2_new(($][3 *)data->$][1); |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
72 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 static void |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 ]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
|
76 Local<Value> value, |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 const AccessorInfo &info) { |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
78 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
|
79 Handle<Object> obj; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
80 $][3 *v; |
648
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 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
83 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
|
84 obj = value->ToObject(); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
85 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
|
86 data->$][1 = v; |
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 define([STR], [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
90 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
91 ]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
|
92 Handle<Object> self = info.This(); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
93 STRUCT_TYPE *data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
94 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
95 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
|
96 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
|
97 } |
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 static void |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
100 ]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
|
101 Local<Value> value, |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
102 const AccessorInfo &info) { |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
103 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
|
104 STRUCT_TYPE *data; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
105 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
106 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
|
107 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
|
108 free(data->$][1); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
109 data->$][1 = strdup(*utf8); |
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 divert([])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
113 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
114 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
115 define([STOP_ACCESSOR], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
116 divert([-1])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
117 undefine([INT]) |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
118 undefine([NUMBER]) |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
119 undefine([OBJ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
120 undefine([STR]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
121 divert([])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
122 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
123 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
124 define([SET_ACCESSSOR], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
125 define([INT], [$][1])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
126 define([NUMBER], [$][1])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
127 define([OBJ], [$][1])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
128 define([STR], [$][1])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 undefine([INT])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
133 undefine([NUMBER])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
134 undefine([OBJ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 undefine([STR])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_VAR], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
139 define([INT], [dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
140 int arg_$][1; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
141 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
142 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
143 double arg_$][1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
144 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
145 define([OBJ], [dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
146 $][2 *arg_$][1; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
147 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
148 define([STR], [dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
149 char *arg_$][1; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
150 ])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
151 define([FUNC], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
152 Handle<Function> arg_$][1; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
153 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
154 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
155 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
156 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
|
157 define([INT], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
158 !args[[i++]]->IsInt32()])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
159 define([NUMBER], [ || |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
160 !args[[i++]]->IsNumber()])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
161 define([OBJ], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
162 !args[[i++]]->IsObject()])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
163 define([STR], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
164 !args[[i++]]->IsString()])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
165 define([FUNC], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
166 !args[[i++]]->IsFunction()])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
167 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
168 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
169 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
|
170 define([INT], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
171 arg_$][1 = args[[i++]]->Int32Value(); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
172 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
173 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
174 arg_$][1 = args[[i++]]->NumberValue(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
175 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
176 define([OBJ], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
177 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
|
178 ])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
179 define([STR], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
180 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
|
181 ])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
182 define([FUNC], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
183 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
|
184 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
185 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
186 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
187 define([START_VALUE_ASSIGN], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
188 define([INT], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
189 $1 = $2->Int32Value(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
190 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
191 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
192 $1 = $2->NumberValue(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
193 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
194 define([OBJ], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
195 $1 = ($][2 *)UNWRAP($2->ToObject()); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
196 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
197 define([STR], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
198 $1 = strdup(*String::Utf8Value($2->ToString())); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
199 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
200 define([FUNC], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
201 $1 = $2.As<Function>(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
202 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
203 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
204 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
205 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
|
206 define([INT], [arg_$][1])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
207 define([NUMBER], [arg_$][1])dnl |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
208 define([OBJ], [arg_$][1])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
209 define([STR], [arg_$][1])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
210 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
|
211 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
212 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
213 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
|
214 define([INT], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
215 int _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
216 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
217 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
218 double _ret; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
219 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
220 define([OBJ], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
221 $][2 *_ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
222 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
223 define([STR], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
224 char *_ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
225 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
226 define([FUNC], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
227 Handle<Function> _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
228 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
229 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
230 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
231 define([START_VAR], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
232 define([INT], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
233 int $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
234 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
235 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
236 double $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
237 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
238 define([OBJ], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
239 $][2 *$1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
240 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
241 define([STR], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
242 char *$1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
243 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
244 define([FUNC], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
245 Handle<Function> $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
246 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
247 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
248 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
249 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
|
250 define([INT], [_ret = (int)])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
251 define([NUMBER], [_ret = (double)])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
252 define([OBJ], [_ret = ($][2 *)])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
253 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
|
254 define([FUNC], [_ret = ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
255 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
256 |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
257 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
|
258 define([INT], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
259 return Integer::New(_ret); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
260 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
261 define([NUMBER], [ |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
262 return Number::New(_ret); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
263 ])dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
264 define([OBJ], [ |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
265 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
|
266 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
267 define([STR], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
268 return String::New(_ret); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
269 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
270 define([FUNC], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
271 return _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
272 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
273 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
274 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
275 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
|
276 undefine([INT])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
277 undefine([NUMBER])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
278 undefine([OBJ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
279 undefine([STR])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
280 undefine([FUNC])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
281 ]) |
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 define([START_METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
284 define([METHOD], [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
285 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
286 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
|
287 int i; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
288 int argc = args.Length(); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 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
|
293 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
294 if(argc != $][4) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
295 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
|
296 i = 0; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
297 if(0]dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
298 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
|
299 THROW("Invalid argument type"); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
300 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
301 i = 0; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
302 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
|
303 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
304 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
|
305 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
|
306 ifelse($][5, [], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
307 return Null(); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
308 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
309 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
310 ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
311 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
312 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
313 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
|
314 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
315 define([SET_METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
316 define([METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
317 SET(proto_temp, "$][1", |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
318 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
|
319 ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
320 $1[]dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
321 undefine([METHOD])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
322 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
323 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
324 define([DEF_GET_INDEX], [ |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
325 static Handle<Value> |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
326 PROJ_PREFIX[]STRUCT_NAME[]_get_index(uint32_t index, const AccessorInfo &info) { |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
327 Handle<Object> self = info.This(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
328 STRUCT_TYPE *obj = (STRUCT_TYPE *)UNWRAP(self); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
329 START_METHOD_RET_VAL[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
330 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
331 _ret = $1(obj, index); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
332 START_METHOD_RET[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
333 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
334 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
335 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
336 define([DEF_SET_INDEX], [ |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
337 static Handle<Value> |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
338 PROJ_PREFIX[]STRUCT_NAME[]_set_index(uint32_t index, Local<Value> value, |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
339 const AccessorInfo &info) { |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
340 Handle<Object> self = info.This(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
341 STRUCT_TYPE *obj = (STRUCT_TYPE *)UNWRAP(self); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
342 START_VAR([in_value])[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
343 START_METHOD_RET_VAL[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
344 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
345 START_VALUE_ASSIGN(in_value, value)[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
346 _ret = $1(obj, index, in_value); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
347 START_METHOD_RET[]$2[]STOP_METHOD_ARG[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
348 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
349 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
350 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
351 define([INSTALL_INDEX_FUNCTIONS],[]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
352 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
353 dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
354 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
|
355 dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
356 define([STRUCT], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
357 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
|
358 define([STRUCT_TYPE], [$2])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
359 dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
360 ifelse([$5], [], [], [foreach([ITER], $5, [EXPAND([define]ITER)])])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
361 dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
362 [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
363 /* ************************************************** |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
364 * STRUCT: $1 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
365 * 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
|
366 */ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
367 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
368 ]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
|
369 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
370 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
371 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
|
372 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
373 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
374 ]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
|
375 Handle<Object> obj; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
376 Handle<Function> func; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
377 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
378 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
|
379 obj = func->NewInstance(); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
380 WRAP(obj, data); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
381 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
382 return obj; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
383 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
384 ]dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
385 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
|
386 foreach([ITER], ($4), [START_METHOD ITER STOP_METHOD])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
387 ifdef([GET_INDEX], [EXPAND([DEF_GET_INDEX]GET_INDEX)])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
388 ifdef([SET_INDEX], [EXPAND([DEF_SET_INDEX]SET_INDEX)])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
389 [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
390 static void |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
391 ]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
|
392 Handle<FunctionTemplate> func_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
393 Handle<ObjectTemplate> inst_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
394 Handle<ObjectTemplate> proto_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
395 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
396 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
|
397 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
|
398 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
|
399 inst_temp->SetInternalFieldCount(1); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
400 ] |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
401 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
|
402 inst_temp = func_temp->InstanceTemplate(); |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
403 INSTALL_INDEX_FUNCTIONS[]dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
404 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
405 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
|
406 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
407 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
|
408 }]dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
409 dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
410 ifelse([$5], [], [], [foreach([ITER], $5, [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
411 define([DUMMY], [undefine]ITER)dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
412 DUMMY[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
413 undefine([DUMMY])])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
414 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
415 dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
416 ]) |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
417 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
418 dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
419 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
|
420 dnl |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
421 define([FUNCTION], [dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
422 /* ************************************************** |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
423 * [FUNCTION]: $1 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
424 * Generated by gen_v8_binding.m4 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
425 */ |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
426 static Handle<Value> |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
427 PROJ_PREFIX[]$1(const Arguments &args) { |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
428 int argc = args.Length(); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
429 int i; |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
430 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
|
431 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
|
432 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
433 if(argc != $4) |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
434 THROW("Invalid number of arguments (!=$][4)"); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
435 i = 0; |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
436 if(0]dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
437 [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
|
438 THROW("Invalid argument type"); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
439 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
440 i = 0; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
441 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
|
442 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
443 define([SEP], [])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
444 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
|
445 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
|
446 ifelse($][5, [], [ |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
447 return Null(); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
448 ])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
449 } |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
450 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
|
451 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
452 static void |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
453 PROJ_PREFIX[]$1[]_init(void) { |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
454 Handle<FunctionTemplate> func_temp; |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
455 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
456 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
|
457 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
|
458 } |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
459 ]) |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
460 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
461 divert([])dnl |