push c03b0bb7c67acf502e715114ece376179b90ac7c
[wine/hacks.git] / dlls / jscript / math.c
blob8454cfa87e302f4c0b8a3852a84a89877a8709cd
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "jscript.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(jscript);
25 static const WCHAR EW[] = {'E',0};
26 static const WCHAR LOG2EW[] = {'L','O','G','2','E',0};
27 static const WCHAR LOG10EW[] = {'L','O','G','1','0',0};
28 static const WCHAR LN2W[] = {'L','N','2',0};
29 static const WCHAR LN10W[] = {'L','N','1','0',0};
30 static const WCHAR PIW[] = {'P','I',0};
31 static const WCHAR SQRT2W[] = {'S','Q','R','T','2',0};
32 static const WCHAR SQRT1_2W[] = {'S','Q','R','T','1','_','2',0};
33 static const WCHAR absW[] = {'a','b','s',0};
34 static const WCHAR acosW[] = {'a','c','o','s',0};
35 static const WCHAR asinW[] = {'a','s','i','n',0};
36 static const WCHAR atanW[] = {'a','t','a','n',0};
37 static const WCHAR atan2W[] = {'a','t','a','n','2',0};
38 static const WCHAR ceilW[] = {'c','e','i','l',0};
39 static const WCHAR cosW[] = {'c','o','s',0};
40 static const WCHAR expW[] = {'e','x','p',0};
41 static const WCHAR floorW[] = {'f','l','o','o','r',0};
42 static const WCHAR logW[] = {'l','o','g',0};
43 static const WCHAR maxW[] = {'m','a','x',0};
44 static const WCHAR minW[] = {'m','i','n',0};
45 static const WCHAR powW[] = {'p','o','w',0};
46 static const WCHAR randomW[] = {'r','a','n','d','o','m',0};
47 static const WCHAR roundW[] = {'r','o','u','n','d',0};
48 static const WCHAR sinW[] = {'s','i','n',0};
49 static const WCHAR sqrtW[] = {'s','q','r','t',0};
50 static const WCHAR tanW[] = {'t','a','n',0};
52 static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
53 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
55 FIXME("\n");
56 return E_NOTIMPL;
59 static HRESULT Math_LOG2E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
60 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
62 FIXME("\n");
63 return E_NOTIMPL;
66 static HRESULT Math_LOG10E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
67 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
69 FIXME("\n");
70 return E_NOTIMPL;
73 static HRESULT Math_LN2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
74 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
76 FIXME("\n");
77 return E_NOTIMPL;
80 static HRESULT Math_LN10(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
81 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
83 FIXME("\n");
84 return E_NOTIMPL;
87 static HRESULT Math_PI(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
88 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
90 FIXME("\n");
91 return E_NOTIMPL;
94 static HRESULT Math_SQRT2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
95 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
97 FIXME("\n");
98 return E_NOTIMPL;
101 static HRESULT Math_SQRT1_2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
102 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
104 FIXME("\n");
105 return E_NOTIMPL;
108 static HRESULT Math_abs(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
109 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
111 FIXME("\n");
112 return E_NOTIMPL;
115 static HRESULT Math_acos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
116 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
118 FIXME("\n");
119 return E_NOTIMPL;
122 static HRESULT Math_asin(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
123 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
125 FIXME("\n");
126 return E_NOTIMPL;
129 static HRESULT Math_atan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
130 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
132 FIXME("\n");
133 return E_NOTIMPL;
136 static HRESULT Math_atan2(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
137 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
139 FIXME("\n");
140 return E_NOTIMPL;
143 static HRESULT Math_ceil(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
144 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
146 FIXME("\n");
147 return E_NOTIMPL;
150 static HRESULT Math_cos(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
151 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
153 FIXME("\n");
154 return E_NOTIMPL;
157 static HRESULT Math_exp(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
158 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
160 FIXME("\n");
161 return E_NOTIMPL;
164 static HRESULT Math_floor(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
165 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
167 FIXME("\n");
168 return E_NOTIMPL;
171 static HRESULT Math_log(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
172 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
174 FIXME("\n");
175 return E_NOTIMPL;
178 static HRESULT Math_max(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
179 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
181 FIXME("\n");
182 return E_NOTIMPL;
185 static HRESULT Math_min(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
186 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
188 FIXME("\n");
189 return E_NOTIMPL;
192 static HRESULT Math_pow(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
193 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
195 FIXME("\n");
196 return E_NOTIMPL;
199 static HRESULT Math_random(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
200 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
202 FIXME("\n");
203 return E_NOTIMPL;
206 static HRESULT Math_round(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
207 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
209 FIXME("\n");
210 return E_NOTIMPL;
213 static HRESULT Math_sin(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
214 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
216 FIXME("\n");
217 return E_NOTIMPL;
220 static HRESULT Math_sqrt(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
221 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
223 FIXME("\n");
224 return E_NOTIMPL;
227 static HRESULT Math_tan(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
228 VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
230 FIXME("\n");
231 return E_NOTIMPL;
234 static const builtin_prop_t Math_props[] = {
235 {EW, Math_E, 0},
236 {LOG2EW, Math_LOG2E, 0},
237 {LOG10EW, Math_LOG10E, 0},
238 {LN2W, Math_LN2, 0},
239 {LN10W, Math_LN10, 0},
240 {PIW, Math_PI, 0},
241 {SQRT1_2W, Math_SQRT1_2, 0},
242 {SQRT2W, Math_SQRT2, 0},
243 {absW, Math_abs, PROPF_METHOD},
244 {acosW, Math_acos, PROPF_METHOD},
245 {asinW, Math_asin, PROPF_METHOD},
246 {atanW, Math_atan, PROPF_METHOD},
247 {atan2W, Math_atan2, PROPF_METHOD},
248 {ceilW, Math_ceil, PROPF_METHOD},
249 {cosW, Math_cos, PROPF_METHOD},
250 {expW, Math_exp, PROPF_METHOD},
251 {floorW, Math_floor, PROPF_METHOD},
252 {logW, Math_log, PROPF_METHOD},
253 {maxW, Math_max, PROPF_METHOD},
254 {minW, Math_min, PROPF_METHOD},
255 {powW, Math_pow, PROPF_METHOD},
256 {randomW, Math_random, PROPF_METHOD},
257 {roundW, Math_round, PROPF_METHOD},
258 {sinW, Math_sin, PROPF_METHOD},
259 {sqrtW, Math_sqrt, PROPF_METHOD},
260 {tanW, Math_tan, PROPF_METHOD}
263 static const builtin_info_t Math_info = {
264 JSCLASS_MATH,
265 {NULL, NULL, 0},
266 sizeof(Math_props)/sizeof(*Math_props),
267 Math_props,
268 NULL,
269 NULL
272 HRESULT create_math(script_ctx_t *ctx, DispatchEx **ret)
274 return create_dispex(ctx, &Math_info, NULL, ret);