Mercurial > MadButterfly
annotate tools/gen_v8_binding.m4 @ 663:974d98233eab
Fix mis-using of arguments of OBJ() argument type
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 02 Aug 2010 10:14:33 +0800 |
parents | dde4e3cc9529 |
children | 08fd45d119c9 |
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 |
663
974d98233eab
Fix mis-using of arguments of OBJ() argument type
Thinker K.F. Li <thinker@branda.to>
parents:
660
diff
changeset
|
146 $][3 *arg_$][1; |
651
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 |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
154 define([SELF], [])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
155 define([ERR], [])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
156 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
157 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
158 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
|
159 define([INT], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
160 !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
|
161 define([NUMBER], [ || |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
162 !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
|
163 define([OBJ], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
164 !args[[i++]]->IsObject()])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
165 define([STR], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
166 !args[[i++]]->IsString()])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
167 define([FUNC], [ || |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
168 !args[[i++]]->IsFunction()])dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
169 define([SELF], [])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
170 define([ERR], [])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
171 ]) |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
172 |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
173 define([START_TYPE_CHK], [dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
174 define([INT], [$1->IsInt32()])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
175 define([NUMBER], [$1->IsNumber()])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
176 define([OBJ], [$1->IsObject()])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
177 define([STR], [$1->IsString()])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
178 define([FUNC], [$1->IsFunction()])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
179 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
180 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
181 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
|
182 define([INT], [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++]]->Int32Value(); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
184 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
185 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
186 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
|
187 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
188 define([OBJ], [dnl |
663
974d98233eab
Fix mis-using of arguments of OBJ() argument type
Thinker K.F. Li <thinker@branda.to>
parents:
660
diff
changeset
|
189 arg_$][1 = ($][3 *)UNWRAP(args[[i++]]->ToObject()); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
190 ])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
191 define([STR], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
192 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
|
193 ])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
194 define([FUNC], [dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
195 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
|
196 ])dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
197 define([SELF], [])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
198 define([ERR], [])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
199 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
200 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
201 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
|
202 define([INT], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
203 $1 = $2->Int32Value(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
204 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
205 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
206 $1 = $2->NumberValue(); |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
207 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
208 define([OBJ], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
209 $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
|
210 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
211 define([STR], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
212 $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
|
213 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
214 define([FUNC], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
215 $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
|
216 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
217 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
218 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
219 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
|
220 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
|
221 define([NUMBER], [arg_$][1])dnl |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
222 define([OBJ], [arg_$][1])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
223 define([STR], [arg_$][1])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
224 define([FUNC], [arg_$][1])dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
225 define([SELF], [self])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
226 define([ERR], [&_err])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
227 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
228 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
229 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
|
230 define([INT], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
231 int _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
232 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
233 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
234 double _ret; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
235 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
236 define([OBJ], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
237 $][2 *_ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
238 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
239 define([STR], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
240 char *_ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
241 ])dnl |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
242 define([FUNC], [dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
243 Handle<Function> _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
244 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
245 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
246 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
247 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
|
248 define([INT], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
249 int $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
250 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
251 define([NUMBER], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
252 double $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
253 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
254 define([OBJ], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
255 $][2 *$1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
256 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
257 define([STR], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
258 char *$1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
259 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
260 define([FUNC], [dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
261 Handle<Function> $1; |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
262 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
263 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
264 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 define([OBJ], [_ret = ($][2 *)])dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
269 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
|
270 define([FUNC], [_ret = ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
271 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
272 |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
273 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
|
274 define([INT], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
275 return Integer::New(_ret); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
276 ])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
277 define([NUMBER], [ |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
278 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
|
279 ])dnl |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
280 define([OBJ], [ |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
281 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
|
282 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
283 define([STR], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
284 return String::New(_ret); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
285 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
286 define([FUNC], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
287 return _ret; |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
288 ])dnl |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
289 ]) |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
290 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
291 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
|
292 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
|
293 undefine([NUMBER])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
294 undefine([OBJ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
295 undefine([STR])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
296 undefine([FUNC])dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
297 undefine([SELF])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
298 undefine([ERR])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
299 ]) |
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 define([START_METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
302 define([METHOD], [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
303 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
304 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
|
305 int i; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
306 int argc = args.Length(); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
307 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
|
308 STRUCT_TYPE *_self = (STRUCT_TYPE *)UNWRAP(self); |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
309 const char *_err = NULL; |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
310 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
|
311 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
|
312 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
313 if(argc != $][4) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
314 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
|
315 i = 0; |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
316 if(0[]dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
317 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
|
318 THROW("Invalid argument type"); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
319 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
320 i = 0; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
321 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
|
322 |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
323 START_METHOD_RET_ASSIGN[]$][5[]STOP_METHOD_ARG[]$][2(_self[]foreach([ITER], $][3, [START_METHOD_ARG_PASS[], ITER[]STOP_METHOD_ARG])); |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
324 if(_err) |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
325 THROW(_err); |
649
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
326 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
|
327 ifelse($][5, [], [ |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
328 return Null(); |
2030e5d9f7f7
Support return value for methodes of JS binding
Thinker K.F. Li <thinker@branda.to>
parents:
648
diff
changeset
|
329 ])dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
330 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
331 ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
332 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
333 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
334 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
|
335 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
336 define([SET_METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
337 define([METHOD], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
338 SET(proto_temp, "$][1", |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
339 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
|
340 ])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
341 $1[]dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
342 undefine([METHOD])dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
343 ]) |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
344 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
345 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
|
346 static Handle<Value> |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
347 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
|
348 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
|
349 STRUCT_TYPE *obj = (STRUCT_TYPE *)UNWRAP(self); |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
350 const char *_err = NULL; |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
351 START_METHOD_RET_VAL[]$2[]STOP_METHOD_ARG[]dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
352 |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
353 _ret = $1(obj, self, index, &_err); |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
354 if(_err) |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
355 THROW(_err); |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
356 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
|
357 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
358 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
359 |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
360 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
|
361 static Handle<Value> |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
362 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
|
363 const AccessorInfo &info) { |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
364 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
|
365 STRUCT_TYPE *obj = (STRUCT_TYPE *)UNWRAP(self); |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
366 const char *_err = NULL; |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
367 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
|
368 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
|
369 |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
370 if(START_TYPE_CHK(value)[]![]$2[]STOP_METHOD_ARG) |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
371 THROW("Invalid value type"); |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
372 |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
373 START_VALUE_ASSIGN(in_value, value)[]$2[]STOP_METHOD_ARG[]dnl |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
374 _ret = $1(obj, self, index, in_value, &_err); |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
375 if(_err) THROW(_err); |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
376 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
|
377 } |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
378 ]) |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
379 |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
380 define([INSTALL_INDEX_FUNCTIONS],[dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
381 define([FIRST], [$][1])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
382 ifdef([GET_INDEX], [ifdef([SET_INDEX], [dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
383 inst_temp->SetIndexedPropertyHandler(PROJ_PREFIX[]STRUCT_NAME[]_get_index, |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
384 PROJ_PREFIX[]STRUCT_NAME[]_set_index); |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
385 ], [dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
386 inst_temp->SetIndexedPropertyHandler(PROJ_PREFIX[]STRUCT_NAME[]_get_index); |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
387 ])])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
388 undefine([FIRST])dnl |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
389 ]) |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
390 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
391 dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
392 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
|
393 dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
394 define([STRUCT], [dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
395 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
|
396 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
|
397 dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
398 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
|
399 dnl |
648
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 /* ************************************************** |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
402 * STRUCT: $1 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
403 * 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
|
404 */ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
405 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
406 ]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
|
407 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
408 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
409 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
|
410 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
411 static Handle<Value> |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
412 ]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
|
413 Handle<Object> obj; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
414 Handle<Function> func; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
415 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
416 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
|
417 obj = func->NewInstance(); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
418 WRAP(obj, data); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
419 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
420 return obj; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
421 } |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
422 ]dnl |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 [ |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
428 static void |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
429 ]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
|
430 Handle<FunctionTemplate> func_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
431 Handle<ObjectTemplate> inst_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
432 Handle<ObjectTemplate> proto_temp; |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
433 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
434 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
|
435 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
|
436 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
|
437 inst_temp->SetInternalFieldCount(1); |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
438 ] |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
439 foreach([ITER], ($3), [SET_ACCESSSOR(ITER)])dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
440 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
|
441 |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
442 proto_temp = func_temp->PrototypeTemplate(); |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
443 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
|
444 |
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
445 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
|
446 }]dnl |
659
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
447 dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
448 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
|
449 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
|
450 DUMMY[]dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
451 undefine([DUMMY])])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
452 ])dnl |
d4aa1cce0af7
Supporting setter/Getter of index of objects for JS
Thinker K.F. Li <thinker@branda.to>
parents:
657
diff
changeset
|
453 dnl |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
454 ]) |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
455 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
456 dnl |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
457 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
|
458 dnl |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
459 define([FUNCTION], [dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
460 /* ************************************************** |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
461 * [FUNCTION]: $1 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
462 * Generated by gen_v8_binding.m4 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
463 */ |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
464 static Handle<Value> |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
465 PROJ_PREFIX[]$1(const Arguments &args) { |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
466 int argc = args.Length(); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
467 int i; |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
468 const char *_err = NULL; |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
469 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
|
470 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
|
471 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
472 if(argc != $4) |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
473 THROW("Invalid number of arguments (!=$][4)"); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
474 i = 0; |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
475 if(0]dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
476 [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
|
477 THROW("Invalid argument type"); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
478 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
479 i = 0; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
650
diff
changeset
|
480 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
|
481 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
482 define([SEP], [])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
483 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]) |
660
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
484 if(_err) |
dde4e3cc9529
Enabling error handling on binding
Thinker K.F. Li <thinker@branda.to>
parents:
659
diff
changeset
|
485 THROW(_err); |
650
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
486 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
|
487 ifelse($][5, [], [ |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
488 return Null(); |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
489 ])dnl |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
490 } |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
491 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
|
492 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
493 static void |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
494 PROJ_PREFIX[]$1[]_init(void) { |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
495 Handle<FunctionTemplate> func_temp; |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
496 |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
497 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
|
498 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
|
499 } |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
500 ]) |
123e7eeff10c
Generate JS binding for a function
Thinker K.F. Li <thinker@branda.to>
parents:
649
diff
changeset
|
501 |
648
e13dbfd37eab
JS binding generator and observer definition with the generator
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
502 divert([])dnl |