jscript: Implement multiple Math functions.

Jacek Caban jacek at codeweavers.com
Thu Dec 11 05:39:42 CST 2008


Hi Patrick,

Patrick Rudolph wrote:
> From 0903060f5acac3bcadc4198bd59eb2ef87f78818 Mon Sep 17 00:00:00 2001
> From: Patrick Rudolph <patrick1804 at web.de>
> Date: Wed, 10 Dec 2008 16:51:19 +0100
> Subject: jscript: Implement multiple Math functions.
>
> 	modified:   math.c
> 	modified:   tests/api.js
> ---
>  dlls/jscript/math.c       |  293 +++++++++++++++++++++++++++++++++++++++------
>  dlls/jscript/tests/api.js |   32 +++++
>  2 files changed, 287 insertions(+), 38 deletions(-)
>
> diff --git a/dlls/jscript/math.c b/dlls/jscript/math.c
> index e6b7202..56ba9cf 100644
> --- a/dlls/jscript/math.c
> +++ b/dlls/jscript/math.c
> @@ -20,6 +20,7 @@
>  #include "wine/port.h"
>  
>  #include <math.h>
> +#include <sys/time.h>
>  
>  #include "jscript.h"
>  
> @@ -57,57 +58,105 @@ static const WCHAR tanW[] = {'t','a','n',0};
>  static HRESULT Math_E(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
>          VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp)
>  {
> -    FIXME("\n");
> -    return E_NOTIMPL;
> +    if(arg_cnt(dp) > 0) {
> +        FIXME("invalid arg_cnt %d\n", arg_cnt(dp));
> +        return E_NOTIMPL;
> +    }
> +
> +    if(retv)
> +    num_set_val(retv, exp(1));
> +    return S_OK;
>  }
>   

It's a JavaScript constant, not a function (and you've implemented it as 
if it would be a function). The same for other constants.

[...]

Please send smaller patches, preferable one patch per function, and add 
more tests. And first of all, make sure that tests are correct...
> diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
> index 2868c0f..6430397 100644
> --- a/dlls/jscript/tests/api.js
> +++ b/dlls/jscript/tests/api.js
> @@ -585,6 +585,38 @@ ok(tmp === 2, "Math.pow(2, 2) = " + tmp);
>  tmp = Math.pow(2, 2, 3);
>  ok(tmp === 4, "Math.pow(2, 2, 3) = " + tmp);
>  
> +tmp = Math.PI();
>   

What makes you think this test will work?


Jacek




More information about the wine-devel mailing list