root/trunk/infrastructure/pyd/generators/op_wrap.txt

Revision 26, 6.3 kB (checked in by KirkMcDonald, 2 years ago)

Function wrapping improvements, and some automatic operator overload wrapping.

Line 
1 template opAdd_wrap(T) {
2     static if (is(typeof(&T.opAdd))) {
3         const binaryfunc opAdd_wrap = &opfunc_binary_wrap!(T, T.opAdd).func;
4     } else {
5         const binaryfunc opAdd_wrap = null;
6     }
7 }
8
9
10 template opSub_wrap(T) {
11     static if (is(typeof(&T.opSub))) {
12         const binaryfunc opSub_wrap = &opfunc_binary_wrap!(T, T.opSub).func;
13     } else {
14         const binaryfunc opSub_wrap = null;
15     }
16 }
17
18
19 template opMul_wrap(T) {
20     static if (is(typeof(&T.opMul))) {
21         const binaryfunc opMul_wrap = &opfunc_binary_wrap!(T, T.opMul).func;
22     } else {
23         const binaryfunc opMul_wrap = null;
24     }
25 }
26
27
28 template opDiv_wrap(T) {
29     static if (is(typeof(&T.opDiv))) {
30         const binaryfunc opDiv_wrap = &opfunc_binary_wrap!(T, T.opDiv).func;
31     } else {
32         const binaryfunc opDiv_wrap = null;
33     }
34 }
35
36
37 template opMod_wrap(T) {
38     static if (is(typeof(&T.opMod))) {
39         const binaryfunc opMod_wrap = &opfunc_binary_wrap!(T, T.opMod).func;
40     } else {
41         const binaryfunc opMod_wrap = null;
42     }
43 }
44
45
46 template opAnd_wrap(T) {
47     static if (is(typeof(&T.opAnd))) {
48         const binaryfunc opAnd_wrap = &opfunc_binary_wrap!(T, T.opAnd).func;
49     } else {
50         const binaryfunc opAnd_wrap = null;
51     }
52 }
53
54
55 template opOr_wrap(T) {
56     static if (is(typeof(&T.opOr))) {
57         const binaryfunc opOr_wrap = &opfunc_binary_wrap!(T, T.opOr).func;
58     } else {
59         const binaryfunc opOr_wrap = null;
60     }
61 }
62
63
64 template opXor_wrap(T) {
65     static if (is(typeof(&T.opXor))) {
66         const binaryfunc opXor_wrap = &opfunc_binary_wrap!(T, T.opXor).func;
67     } else {
68         const binaryfunc opXor_wrap = null;
69     }
70 }
71
72
73 template opShl_wrap(T) {
74     static if (is(typeof(&T.opShl))) {
75         const binaryfunc opShl_wrap = &opfunc_binary_wrap!(T, T.opShl).func;
76     } else {
77         const binaryfunc opShl_wrap = null;
78     }
79 }
80
81
82 template opShr_wrap(T) {
83     static if (is(typeof(&T.opShr))) {
84         const binaryfunc opShr_wrap = &opfunc_binary_wrap!(T, T.opShr).func;
85     } else {
86         const binaryfunc opShr_wrap = null;
87     }
88 }
89
90
91 template opUShr_wrap(T) {
92     static if (is(typeof(&T.opUShr))) {
93         const binaryfunc opUShr_wrap = &opfunc_binary_wrap!(T, T.opUShr).func;
94     } else {
95         const binaryfunc opUShr_wrap = null;
96     }
97 }
98
99
100 template opCat_wrap(T) {
101     static if (is(typeof(&T.opCat))) {
102         const binaryfunc opCat_wrap = &opfunc_binary_wrap!(T, T.opCat).func;
103     } else {
104         const binaryfunc opCat_wrap = null;
105     }
106 }
107
108
109 template opAddAssign_wrap(T) {
110     static if (is(typeof(&T.opAddAssign))) {
111         const binaryfunc opAddAssign_wrap = &opfunc_binary_wrap!(T, T.opAddAssign).func;
112     } else {
113         const binaryfunc opAddAssign_wrap = null;
114     }
115 }
116
117
118 template opSubAssign_wrap(T) {
119     static if (is(typeof(&T.opSubAssign))) {
120         const binaryfunc opSubAssign_wrap = &opfunc_binary_wrap!(T, T.opSubAssign).func;
121     } else {
122         const binaryfunc opSubAssign_wrap = null;
123     }
124 }
125
126
127 template opMulAssign_wrap(T) {
128     static if (is(typeof(&T.opMulAssign))) {
129         const binaryfunc opMulAssign_wrap = &opfunc_binary_wrap!(T, T.opMulAssign).func;
130     } else {
131         const binaryfunc opMulAssign_wrap = null;
132     }
133 }
134
135
136 template opDivAssign_wrap(T) {
137     static if (is(typeof(&T.opDivAssign))) {
138         const binaryfunc opDivAssign_wrap = &opfunc_binary_wrap!(T, T.opDivAssign).func;
139     } else {
140         const binaryfunc opDivAssign_wrap = null;
141     }
142 }
143
144
145 template opModAssign_wrap(T) {
146     static if (is(typeof(&T.opModAssign))) {
147         const binaryfunc opModAssign_wrap = &opfunc_binary_wrap!(T, T.opModAssign).func;
148     } else {
149         const binaryfunc opModAssign_wrap = null;
150     }
151 }
152
153
154 template opAndAssign_wrap(T) {
155     static if (is(typeof(&T.opAndAssign))) {
156         const binaryfunc opAndAssign_wrap = &opfunc_binary_wrap!(T, T.opAndAssign).func;
157     } else {
158         const binaryfunc opAndAssign_wrap = null;
159     }
160 }
161
162
163 template opOrAssign_wrap(T) {
164     static if (is(typeof(&T.opOrAssign))) {
165         const binaryfunc opOrAssign_wrap = &opfunc_binary_wrap!(T, T.opOrAssign).func;
166     } else {
167         const binaryfunc opOrAssign_wrap = null;
168     }
169 }
170
171
172 template opXorAssign_wrap(T) {
173     static if (is(typeof(&T.opXorAssign))) {
174         const binaryfunc opXorAssign_wrap = &opfunc_binary_wrap!(T, T.opXorAssign).func;
175     } else {
176         const binaryfunc opXorAssign_wrap = null;
177     }
178 }
179
180
181 template opShlAssign_wrap(T) {
182     static if (is(typeof(&T.opShlAssign))) {
183         const binaryfunc opShlAssign_wrap = &opfunc_binary_wrap!(T, T.opShlAssign).func;
184     } else {
185         const binaryfunc opShlAssign_wrap = null;
186     }
187 }
188
189
190 template opShrAssign_wrap(T) {
191     static if (is(typeof(&T.opShrAssign))) {
192         const binaryfunc opShrAssign_wrap = &opfunc_binary_wrap!(T, T.opShrAssign).func;
193     } else {
194         const binaryfunc opShrAssign_wrap = null;
195     }
196 }
197
198
199 template opUShrAssign_wrap(T) {
200     static if (is(typeof(&T.opUShrAssign))) {
201         const binaryfunc opUShrAssign_wrap = &opfunc_binary_wrap!(T, T.opUShrAssign).func;
202     } else {
203         const binaryfunc opUShrAssign_wrap = null;
204     }
205 }
206
207
208 template opCatAssign_wrap(T) {
209     static if (is(typeof(&T.opCatAssign))) {
210         const binaryfunc opCatAssign_wrap = &opfunc_binary_wrap!(T, T.opCatAssign).func;
211     } else {
212         const binaryfunc opCatAssign_wrap = null;
213     }
214 }
215
216
217 template opIn_wrap(T) {
218     static if (is(typeof(&T.opIn))) {
219         const binaryfunc opIn_wrap = &opfunc_binary_wrap!(T, T.opIn).func;
220     } else {
221         const binaryfunc opIn_wrap = null;
222     }
223 }
224
225
226 template opNeg_wrap(T) {
227     static if (is(typeof(&T.opNeg))) {
228         const unaryfunc opNeg_wrap = &opfunc_unary_wrap!(T, T.opNeg).func;
229     } else {
230         const unaryfunc opNeg_wrap = null;
231     }
232 }
233
234 template opPos_wrap(T) {
235     static if (is(typeof(&T.opPos))) {
236         const unaryfunc opPos_wrap = &opfunc_unary_wrap!(T, T.opPos).func;
237     } else {
238         const unaryfunc opPos_wrap = null;
239     }
240 }
241
242 template opCom_wrap(T) {
243     static if (is(typeof(&T.opCom))) {
244         const unaryfunc opCom_wrap = &opfunc_unary_wrap!(T, T.opCom).func;
245     } else {
246         const unaryfunc opCom_wrap = null;
247     }
248 }
Note: See TracBrowser for help on using the browser.