winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
703 discussions
Start a n
N
ew thread
Zebediah Figura : widl: Introduce type_iface_get_async_iface().
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: b4fe4ccc96403aa7af0eacf727fc007d4c27d52d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b4fe4ccc96403aa7af0eacf7…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Wed Aug 14 21:45:46 2019 -0500 widl: Introduce type_iface_get_async_iface(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/header.c | 6 +++--- tools/widl/parser.y | 2 +- tools/widl/proxy.c | 12 ++++++------ tools/widl/typegen.c | 6 +++--- tools/widl/typetree.h | 7 +++++++ tools/widl/widl.c | 6 +++--- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tools/widl/header.c b/tools/widl/header.c index a862a72..f4bf13a 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -1651,8 +1651,8 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts) if (is_object(iface) || is_attr(iface->attrs, ATTR_DISPINTERFACE)) { write_forward(header, iface); - if (iface->details.iface->async_iface) - write_forward(header, iface->details.iface->async_iface); + if (type_iface_get_async_iface(iface)) + write_forward(header, type_iface_get_async_iface(iface)); } } else if (type_get_type(stmt->u.type) == TYPE_COCLASS) @@ -1688,7 +1688,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons if (type_get_type(stmt->u.type) == TYPE_INTERFACE) { type_t *iface = stmt->u.type; - type_t *async_iface = iface->details.iface->async_iface; + type_t *async_iface = type_iface_get_async_iface(iface); if (is_object(iface)) is_object_interface++; if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type)) { diff --git a/tools/widl/parser.y b/tools/widl/parser.y index daff825..e39d801 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -2809,7 +2809,7 @@ static void check_async_uuid(type_t *iface) inherit = iface->details.iface->inherit; if (inherit && strcmp(inherit->name, "IUnknown")) - inherit = inherit->details.iface->async_iface; + inherit = type_iface_get_async_iface(inherit); if (!inherit) error_loc("async_uuid applied to an interface with incompatible parent\n"); diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 466c462..22c045d 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -739,7 +739,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "{\n"); indent++; print_proxy( "%s_%s\n", - iface->details.iface->async_iface == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer", + type_iface_get_async_iface(iface) == iface ? "CStdAsyncStubBuffer" : "CStdStubBuffer", need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS"); indent--; print_proxy( "}\n"); @@ -840,8 +840,8 @@ static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_ if (need_proxy(iface)) { write_proxy(iface, proc_offset); - if (iface->details.iface->async_iface) - write_proxy(iface->details.iface->async_iface, proc_offset); + if (type_iface_get_async_iface(iface)) + write_proxy(type_iface_get_async_iface(iface), proc_offset); } } } @@ -870,9 +870,9 @@ static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[], { *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) ); (*ifaces)[(*count)++] = iface; - if (iface->details.iface->async_iface) + if (type_iface_get_async_iface(iface)) { - iface = iface->details.iface->async_iface; + iface = type_iface_get_async_iface(iface); *ifaces = xrealloc( *ifaces, (*count + 1) * sizeof(**ifaces) ); (*ifaces)[(*count)++] = iface; } @@ -1012,7 +1012,7 @@ static void write_proxy_routines(const statement_list_t *stmts) table_version = get_stub_mode() == MODE_Oif ? 2 : 1; for (i = 0; i < count; i++) { - if (interfaces[i]->details.iface->async_iface != interfaces[i]) continue; + if (type_iface_get_async_iface(interfaces[i]) != interfaces[i]) continue; if (table_version != 6) { fprintf(proxy, "static const IID *_AsyncInterfaceTable[] =\n"); diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 86611ae..47d12f5 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1394,7 +1394,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface, if (is_attr( func->attrs, ATTR_NOTIFY )) ext_flags |= 0x08; /* HasNotify */ if (is_attr( func->attrs, ATTR_NOTIFYFLAG )) ext_flags |= 0x10; /* HasNotify2 */ - if (iface == iface->details.iface->async_iface) oi2_flags |= 0x20; + if (iface == type_iface_get_async_iface(iface)) oi2_flags |= 0x20; size = get_function_buffer_size( func, PASS_IN ); print_file( file, indent, "NdrFcShort(0x%x),\t/* client buffer = %u */\n", size, size ); @@ -1493,8 +1493,8 @@ static void for_each_iface(const statement_list_t *stmts, iface = stmt->u.type; if (!pred(iface)) continue; proc(iface, file, indent, offset); - if (iface->details.iface->async_iface) - proc(iface->details.iface->async_iface, file, indent, offset); + if (type_iface_get_async_iface(iface)) + proc(type_iface_get_async_iface(iface), file, indent, offset); } } diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 22232fc..4eb0a0a 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -162,6 +162,13 @@ static inline type_t *type_iface_get_inherit(const type_t *type) return type->details.iface->inherit; } +static inline type_t *type_iface_get_async_iface(const type_t *type) +{ + type = type_get_real_type(type); + assert(type_get_type(type) == TYPE_INTERFACE); + return type->details.iface->async_iface; +} + static inline var_list_t *type_dispiface_get_props(const type_t *type) { type = type_get_real_type(type); diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 0bcf67b..1620dfd 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -494,10 +494,10 @@ static void write_id_data_stmts(const statement_list_t *stmts) uuid = get_attrp(type->attrs, ATTR_UUID); write_id_guid(idfile, "IID", is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID", type->name, uuid); - if (type->details.iface->async_iface) + if (type_iface_get_async_iface(type)) { - uuid = get_attrp(type->details.iface->async_iface->attrs, ATTR_UUID); - write_id_guid(idfile, "IID", "IID", type->details.iface->async_iface->name, uuid); + uuid = get_attrp(type_iface_get_async_iface(type)->attrs, ATTR_UUID); + write_id_guid(idfile, "IID", "IID", type_iface_get_async_iface(type)->name, uuid); } } else if (type_get_type(type) == TYPE_COCLASS)
1
0
0
0
Zebediah Figura : d3dcompiler: Get rid of the "node" field from struct hlsl_ir_var.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: bf31a900d1c684f6e5b3fadc9f5c13f018d83c92 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf31a900d1c684f6e5b3fadc…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Aug 13 10:23:32 2019 -0500 d3dcompiler: Get rid of the "node" field from struct hlsl_ir_var. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/d3dcompiler_private.h | 14 ++++--------- dlls/d3dcompiler_43/hlsl.y | 34 +++++++++++++++---------------- dlls/d3dcompiler_43/utils.c | 26 +++++++---------------- 3 files changed, 27 insertions(+), 47 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=bf31a900d1c684f6e5b3…
1
0
0
0
Zebediah Figura : d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: 32fd9ff4791e2c50a2e3ca049a85334424e87478 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=32fd9ff4791e2c50a2e3ca04…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Tue Aug 13 10:23:31 2019 -0500 d3dcompiler: Get rid of the "node" field from struct hlsl_ir_function_decl. Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dcompiler_43/d3dcompiler_private.h | 4 ++-- dlls/d3dcompiler_43/hlsl.y | 20 ++++++++++---------- dlls/d3dcompiler_43/utils.c | 4 +--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h index 0506b16..d9befd1 100644 --- a/dlls/d3dcompiler_43/d3dcompiler_private.h +++ b/dlls/d3dcompiler_43/d3dcompiler_private.h @@ -712,7 +712,6 @@ enum hlsl_ir_node_type HLSL_IR_CONSTRUCTOR, HLSL_IR_DEREF, HLSL_IR_EXPR, - HLSL_IR_FUNCTION_DECL, HLSL_IR_IF, HLSL_IR_LOOP, HLSL_IR_JUMP, @@ -776,7 +775,8 @@ struct hlsl_ir_function struct hlsl_ir_function_decl { - struct hlsl_ir_node node; + struct hlsl_type *return_type; + struct source_location loc; struct wine_rb_entry entry; struct hlsl_ir_function *func; const char *semantic; diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index 5585b89..7c14ad00 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -1084,28 +1084,28 @@ hlsl_prog: /* empty */ { if (decl->body && $2.decl->body) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "redefinition of function %s", debugstr_a($2.name)); YYABORT; } - else if (!compare_hlsl_types(decl->node.data_type, $2.decl->node.data_type)) + else if (!compare_hlsl_types(decl->return_type, $2.decl->return_type)) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "redefining function %s with a different return type", debugstr_a($2.name)); - hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE, + hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_NOTE, "%s previously declared here", debugstr_a($2.name)); YYABORT; } } - if ($2.decl->node.data_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic) + if ($2.decl->return_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic) { - hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line, - $2.decl->node.loc.col, HLSL_LEVEL_ERROR, + hlsl_report_message($2.decl->loc.file, $2.decl->loc.line, + $2.decl->loc.col, HLSL_LEVEL_ERROR, "void function with a semantic"); } @@ -1280,7 +1280,7 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c } $$.name = $3; $$.decl->semantic = $7.semantic; - set_location(&$$.decl->node.loc, &@3); + set_location(&$$.decl->loc, &@3); } compound_statement: '{' '}' diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c index d2275da..ca603e4 100644 --- a/dlls/d3dcompiler_43/utils.c +++ b/dlls/d3dcompiler_43/utils.c @@ -1577,8 +1577,7 @@ struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struc ERR("Out of memory.\n"); return NULL; } - decl->node.type = HLSL_IR_FUNCTION_DECL; - decl->node.data_type = return_type; + decl->return_type = return_type; decl->parameters = parameters; return decl; @@ -1775,7 +1774,6 @@ static const char *debug_node_type(enum hlsl_ir_node_type type) "HLSL_IR_CONSTRUCTOR", "HLSL_IR_DEREF", "HLSL_IR_EXPR", - "HLSL_IR_FUNCTION_DECL", "HLSL_IR_IF", "HLSL_IR_JUMP", "HLSL_IR_SWIZZLE",
1
0
0
0
Benedikt Bär : ucrtbase: Link missing functions to msvcrt that are needed by api-ms-win-crt-private-l1-1-0.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: a20295ce3ddde224f9d958f6a4e5d117528e9279 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a20295ce3ddde224f9d958f6…
Author: Benedikt Bär <beniwtv(a)relamp.tk> Date: Wed Aug 14 14:41:13 2019 +0200 ucrtbase: Link missing functions to msvcrt that are needed by api-ms-win-crt-private-l1-1-0. Signed-off-by: Benedikt Bär <beniwtv(a)relamp.tk> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- .../api-ms-win-crt-private-l1-1-0.spec | 22 +++++++++++----------- dlls/ucrtbase/ucrtbase.spec | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec index f010434..d496889 100644 --- a/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec +++ b/dlls/api-ms-win-crt-private-l1-1-0/api-ms-win-crt-private-l1-1-0.spec @@ -156,7 +156,7 @@ @ stub _o___stdio_common_vfwscanf @ cdecl _o___stdio_common_vsnprintf_s(int64 ptr long long str ptr ptr) ucrtbase._o___stdio_common_vsnprintf_s @ stub _o___stdio_common_vsnwprintf_s -@ stub _o___stdio_common_vsprintf +@ cdecl _o___stdio_common_vsprintf(int64 ptr long str ptr ptr) ucrtbase._o___stdio_common_vsprintf @ stub _o___stdio_common_vsprintf_p @ cdecl _o___stdio_common_vsprintf_s(int64 ptr long str ptr ptr) ucrtbase._o___stdio_common_vsprintf_s @ stub _o___stdio_common_vsscanf @@ -692,7 +692,7 @@ @ stub _o__strcoll_l @ stub _o__strdate @ stub _o__strdate_s -@ stub _o__strdup +@ cdecl _o__strdup(str) ucrtbase._o__strdup @ stub _o__strerror @ stub _o__strerror_s @ stub _o__strftime_l @@ -706,7 +706,7 @@ @ stub _o__strlwr_s_l @ stub _o__strncoll @ stub _o__strncoll_l -@ stub _o__strnicmp +@ cdecl _o__strnicmp(str str long) ucrtbase._o__strnicmp @ stub _o__strnicmp_l @ stub _o__strnicoll @ stub _o__strnicoll_l @@ -912,7 +912,7 @@ @ stub _o_atanh @ stub _o_atanhf @ stub _o_atanhl -@ stub _o_atof +@ cdecl _o_atof(str) ucrtbase._o_atof @ stub _o_atoi @ stub _o_atol @ stub _o_atoll @@ -977,7 +977,7 @@ @ stub _o_fwrite @ stub _o_getc @ stub _o_getchar -@ stub _o_getenv +@ cdecl _o_getenv(str) ucrtbase._o_getenv @ stub _o_getenv_s @ stub _o_gets @ stub _o_gets_s @@ -1011,7 +1011,7 @@ @ stub _o_iswspace @ stub _o_iswupper @ stub _o_iswxdigit -@ stub _o_isxdigit +@ cdecl _o_isxdigit(long) ucrtbase._o_isxdigit @ stub _o_ldexp @ stub _o_lgamma @ stub _o_lgammaf @@ -1023,7 +1023,7 @@ @ stub _o_llroundf @ stub _o_llroundl @ stub _o_localeconv -@ stub _o_log +@ cdecl _o_log(double) ucrtbase._o_log @ stub _o_log10 @ stub _o_log10f @ stub _o_log1p @@ -1054,7 +1054,7 @@ @ stub _o_mbstowcs_s @ stub _o_mbtowc @ stub _o_memcpy_s -@ stub _o_modf +@ cdecl _o_modf(double ptr) ucrtbase._o_modf @ stub _o_modff @ stub _o_nan @ stub _o_nanf @@ -1068,7 +1068,7 @@ @ stub _o_nexttoward @ stub _o_nexttowardf @ stub _o_nexttowardl -@ stub _o_pow +@ cdecl _o_pow(double double) ucrtbase._o_pow @ stub _o_powf @ stub _o_putc @ stub _o_putchar @@ -1104,13 +1104,13 @@ @ stub _o_scalbnl @ stub _o_set_terminate @ stub _o_setbuf -@ stub _o_setlocale +@ cdecl _o_setlocale(long str) ucrtbase._o_setlocale @ stub _o_setvbuf @ stub _o_sin @ stub _o_sinf @ stub _o_sinh @ stub _o_sinhf -@ stub _o_sqrt +@ cdecl _o_sqrt(double) ucrtbase._o_sqrt @ stub _o_sqrtf @ stub _o_srand @ cdecl _o_strcat_s(str long str) ucrtbase._o_strcat_s diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 2a5fdf2..6684742 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -820,7 +820,7 @@ @ stub _o___stdio_common_vfwscanf @ cdecl _o___stdio_common_vsnprintf_s(int64 ptr long long str ptr ptr) MSVCRT__stdio_common_vsnprintf_s @ stub _o___stdio_common_vsnwprintf_s -@ stub _o___stdio_common_vsprintf +@ cdecl _o___stdio_common_vsprintf(int64 ptr long str ptr ptr) __stdio_common_vsprintf @ stub _o___stdio_common_vsprintf_p @ cdecl _o___stdio_common_vsprintf_s(int64 ptr long str ptr ptr) MSVCRT__stdio_common_vsprintf_s @ stub _o___stdio_common_vsscanf @@ -1356,7 +1356,7 @@ @ stub _o__strcoll_l @ stub _o__strdate @ stub _o__strdate_s -@ stub _o__strdup +@ cdecl _o__strdup(str) MSVCRT__strdup @ stub _o__strerror @ stub _o__strerror_s @ stub _o__strftime_l @@ -1370,7 +1370,7 @@ @ stub _o__strlwr_s_l @ stub _o__strncoll @ stub _o__strncoll_l -@ stub _o__strnicmp +@ cdecl _o__strnicmp(str str long) MSVCRT__strnicmp @ stub _o__strnicmp_l @ stub _o__strnicoll @ stub _o__strnicoll_l @@ -1576,7 +1576,7 @@ @ stub _o_atanh @ stub _o_atanhf @ stub _o_atanhl -@ stub _o_atof +@ cdecl _o_atof(str) MSVCRT_atof @ stub _o_atoi @ stub _o_atol @ stub _o_atoll @@ -1641,7 +1641,7 @@ @ stub _o_fwrite @ stub _o_getc @ stub _o_getchar -@ stub _o_getenv +@ cdecl _o_getenv(str) MSVCRT_getenv @ stub _o_getenv_s @ stub _o_gets @ stub _o_gets_s @@ -1675,7 +1675,7 @@ @ stub _o_iswspace @ stub _o_iswupper @ stub _o_iswxdigit -@ stub _o_isxdigit +@ cdecl _o_isxdigit(long) MSVCRT_isxdigit @ stub _o_ldexp @ stub _o_lgamma @ stub _o_lgammaf @@ -1687,7 +1687,7 @@ @ stub _o_llroundf @ stub _o_llroundl @ stub _o_localeconv -@ stub _o_log +@ cdecl _o_log(double) MSVCRT_log @ stub _o_log10 @ stub _o_log10f @ stub _o_log1p @@ -1719,7 +1719,7 @@ @ stub _o_mbtowc @ stub _o_memcpy_s @ stub _o_memset -@ stub _o_modf +@ cdecl _o_modf(double ptr) MSVCRT_modf @ stub _o_modff @ stub _o_nan @ stub _o_nanf @@ -1733,7 +1733,7 @@ @ stub _o_nexttoward @ stub _o_nexttowardf @ stub _o_nexttowardl -@ stub _o_pow +@ cdecl _o_pow(double double) MSVCRT_pow @ stub _o_powf @ stub _o_putc @ stub _o_putchar @@ -1769,13 +1769,13 @@ @ stub _o_scalbnl @ stub _o_set_terminate @ stub _o_setbuf -@ stub _o_setlocale +@ cdecl _o_setlocale(long str) MSVCRT_setlocale @ stub _o_setvbuf @ stub _o_sin @ stub _o_sinf @ stub _o_sinh @ stub _o_sinhf -@ stub _o_sqrt +@ cdecl _o_sqrt(double) MSVCRT_sqrt @ stub _o_sqrtf @ stub _o_srand @ cdecl _o_strcat_s(str long str) MSVCRT_strcat_s
1
0
0
0
Jacek Caban : mshtml: Add Function.prototype.bind tests.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: eb166fe3493b8fe63a768d45780a7501527db9e1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=eb166fe3493b8fe63a768d45…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:19:03 2019 +0200 mshtml: Add Function.prototype.bind tests. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/tests/es5.js | 80 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 69c0d86..85a6899 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -724,6 +724,83 @@ function test_getPrototypeOf() { next_test(); } +function test_bind() { + var f, r; + var o = new Object(), o2 = new Object(); + + f = (function() { + ok(this === o, "this != o"); + ok(arguments.length === 0, "arguments.length = " + arguments.length); + return 1; + }).bind(o); + ok(f.length === 0, "f.length = " + f.length); + r = f.call(o2); + ok(r === 1, "r = " + r); + + f = (function() { + ok(this === o, "this != o"); + ok(arguments.length === 1, "arguments.length = " + arguments.length); + ok(arguments[0] === 1, "arguments[0] = " + arguments[0]); + return 1; + }).bind(o, 1); + ok(f.length === 0, "f.length = " + f.length); + r = f.call(o2); + ok(r === 1, "r = " + r); + + f = (function() { + ok(this === o, "this != o"); + ok(arguments.length === 2, "arguments.length = " + arguments.length); + ok(arguments[0] === 1, "arguments[0] = " + arguments[0]); + ok(arguments[1] === 2, "arguments[1] = " + arguments[0]); + return 1; + }).bind(o, 1); + r = f.call(o2, 2); + ok(r === 1, "r = " + r); + + o2.f = f; + r = o2.f(2); + ok(r === 1, "r = " + r); + + f = (function test(x, y, z) { + ok(this === o, "this != o"); + ok(arguments.length === 2, "arguments.length = " + arguments.length); + ok(x === 1, "x = " + x); + ok(y === 2, "y = " + y); + ok(z === undefined, "z = " + z); + return 1; + }).bind(o, 1); + ok(f.length === 2, "f.length = " + f.length); + r = f.call(o2, 2); + ok(r === 1, "r = " + r); + ok(f.toString() === "\nfunction() {\n [native code]\n}\n", "f.toString() = " + f.toString()); + ok(!("prototype" in f), "bound function has prototype"); + + var a = []; + f = Array.prototype.push.bind(a, 1); + f(); + ok(a.length === 1, "a.length = " + a.length); + f(2); + ok(a.length === 3, "a.length = " + a.length); + ok(f.length === 0, "f.length = " + f.length); + ok(f.toString() === "\nfunction() {\n [native code]\n}\n", "f.toString() = " + f.toString()); + ok(a.toString() === "1,1,2", "a = " + a); + f.call([], 3); + ok(a.toString() === "1,1,2,1,3", "a = " + a); + + f = (function() { return this; }).bind(a); + ok(f() === a, "f() != a"); + + var t; + f = (function() { return t = this; }).bind(a); + ok(new f() === t, "new f() != a"); + ok(typeof(t) === "object", "typeof(t) = " + typeof(t)); + ok(t != a, "t == a"); + + ok(Function.prototype.bind.length === 1, "Function.prototype.bind.length = " + Function.prototype.bind.length); + + next_test(); +} + var tests = [ test_date_now, test_toISOString, @@ -738,5 +815,6 @@ var tests = [ test_string_trim, test_global_properties, test_string_split, - test_getPrototypeOf + test_getPrototypeOf, + test_bind ];
1
0
0
0
Jacek Caban : jscript: Implement Function.prototype.bind.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: 11a9b373e72825a0f6b112c7783efd4e3f3451fc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=11a9b373e72825a0f6b112c7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:18:52 2019 +0200 jscript: Implement Function.prototype.bind. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/function.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index d373cbe..7a44f50 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -54,6 +54,14 @@ typedef struct { } NativeFunction; typedef struct { + FunctionInstance function; + FunctionInstance *target; + IDispatch *this; + unsigned argc; + jsval_t args[1]; +} BindFunction; + +typedef struct { jsdisp_t jsdisp; InterpretedFunction *function; jsval_t *buf; @@ -61,6 +69,8 @@ typedef struct { unsigned argc; } ArgumentsInstance; +static HRESULT create_bind_function(script_ctx_t*,FunctionInstance*,IDispatch*,unsigned,jsval_t*,jsdisp_t**r); + static inline FunctionInstance *function_from_jsdisp(jsdisp_t *jsdisp) { return CONTAINING_RECORD(jsdisp, FunctionInstance, dispex); @@ -86,6 +96,7 @@ static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0}; static const WCHAR lengthW[] = {'l','e','n','g','t','h',0}; static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; static const WCHAR applyW[] = {'a','p','p','l','y',0}; +static const WCHAR bindW[] = {'b','i','n','d',0}; static const WCHAR callW[] = {'c','a','l','l',0}; static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; @@ -424,6 +435,39 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns return hres; } +static HRESULT Function_bind(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, + jsval_t *r) +{ + FunctionInstance *function; + jsdisp_t *new_function; + HRESULT hres; + + TRACE("\n"); + + if(!(function = function_this(jsthis))) + return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL); + + if(argc < 1) { + FIXME("no this argument\n"); + return E_NOTIMPL; + } + + if(!is_object_instance(argv[0]) || !get_object(argv[0])) { + FIXME("%s is not an object instance\n", debugstr_jsval(argv[0])); + return E_NOTIMPL; + } + + hres = create_bind_function(ctx, function, get_object(argv[0]), argc - 1, argv + 1, &new_function); + if(FAILED(hres)) + return hres; + + if(r) + *r = jsval_obj(new_function); + else + jsdisp_release(new_function); + return S_OK; +} + HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { @@ -490,6 +534,7 @@ static void Function_destructor(jsdisp_t *dispex) static const builtin_prop_t Function_props[] = { {applyW, Function_apply, PROPF_METHOD|2}, {argumentsW, NULL, 0, Function_get_arguments}, + {bindW, Function_bind, PROPF_METHOD|PROPF_ES5|1}, {callW, Function_call, PROPF_METHOD|1}, {lengthW, NULL, 0, Function_get_length}, {toStringW, Function_toString, PROPF_METHOD} @@ -758,6 +803,94 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod return S_OK; } +static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r) +{ + BindFunction *function = (BindFunction*)func; + jsval_t *call_args = NULL; + unsigned call_argc; + HRESULT hres; + + TRACE("%p\n", function); + + call_argc = function->argc + argc; + if(call_argc) { + call_args = heap_alloc(function->argc * sizeof(*function->args)); + if(!call_args) + return E_OUTOFMEMORY; + + if(function->argc) + memcpy(call_args, function->args, function->argc * sizeof(*call_args)); + if(argc) + memcpy(call_args + function->argc, argv, argc * sizeof(*call_args)); + } + + hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r); + + heap_free(call_args); + return hres; +} + +static HRESULT BindFunction_toString(FunctionInstance *function, jsstr_t **ret) +{ + static const WCHAR native_functionW[] = + {'\n','f','u','n','c','t','i','o','n','(',')',' ','{','\n', + ' ',' ',' ',' ','[','n','a','t','i','v','e',' ','c','o','d','e',']','\n', + '}','\n',0}; + + *ret = jsstr_alloc(native_functionW); + return *ret ? S_OK : E_OUTOFMEMORY; +} + +static void BindFunction_destructor(FunctionInstance *func) +{ + BindFunction *function = (BindFunction*)func; + unsigned i; + + TRACE("%p\n", function); + + for(i = 0; i < function->argc; i++) + jsval_release(function->args[i]); + jsdisp_release(&function->target->dispex); + IDispatch_Release(function->this); +} + +static const function_vtbl_t BindFunctionVtbl = { + BindFunction_call, + BindFunction_toString, + BindFunction_destructor +}; + +static HRESULT create_bind_function(script_ctx_t *ctx, FunctionInstance *target, IDispatch *bound_this, unsigned argc, + jsval_t *argv, jsdisp_t **ret) +{ + BindFunction *function; + HRESULT hres; + + hres = create_function(ctx, NULL, &BindFunctionVtbl, FIELD_OFFSET(BindFunction, args[argc]), PROPF_METHOD, + FALSE, NULL, (void**)&function); + if(FAILED(hres)) + return hres; + + jsdisp_addref(&target->dispex); + function->target = target; + + IDispatch_AddRef(function->this = bound_this); + + for(function->argc = 0; function->argc < argc; function->argc++) { + hres = jsval_copy(argv[function->argc], function->args + function->argc); + if(FAILED(hres)) { + jsdisp_release(&function->function.dispex); + return hres; + } + } + + function->function.length = target->length > argc ? target->length - argc : 0; + + *ret = &function->function.dispex; + return S_OK; +} + static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *argv, IDispatch **ret) { WCHAR *str = NULL, *ptr;
1
0
0
0
Jacek Caban : jscript: Move function name to NativeFunction.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: 462ab9b42b12dae252e5876998d72b8b8ab005c1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=462ab9b42b12dae252e58769…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:18:39 2019 +0200 jscript: Move function name to NativeFunction. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/function.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 447fe62..d373cbe 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -30,7 +30,6 @@ typedef struct _function_vtbl_t function_vtbl_t; typedef struct { jsdisp_t dispex; const function_vtbl_t *vtbl; - const WCHAR *name; DWORD flags; DWORD length; } FunctionInstance; @@ -51,6 +50,7 @@ typedef struct { typedef struct { FunctionInstance function; builtin_invoke_t proc; + const WCHAR *name; } NativeFunction; typedef struct { @@ -567,8 +567,9 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, ID return hres; } -static HRESULT NativeFunction_toString(FunctionInstance *function, jsstr_t **ret) +static HRESULT NativeFunction_toString(FunctionInstance *func, jsstr_t **ret) { + NativeFunction *function = (NativeFunction*)func; DWORD name_len; jsstr_t *str; WCHAR *ptr; @@ -623,7 +624,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, } function->proc = value_proc; - function->function.name = name; + function->name = name; *ret = &function->function.dispex; return S_OK; @@ -886,13 +887,13 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype) return hres; prot->proc = FunctionProt_value; - prot->function.name = prototypeW; + prot->name = prototypeW; hres = create_function(ctx, &FunctionInst_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR|1, TRUE, &prot->function.dispex, (void**)&constr); if(SUCCEEDED(hres)) { constr->proc = FunctionConstr_value; - constr->function.name = FunctionW; + constr->name = FunctionW; hres = jsdisp_define_data_property(&constr->function.dispex, prototypeW, 0, jsval_obj(&prot->function.dispex)); if(SUCCEEDED(hres)) hres = set_constructor_prop(ctx, &constr->function.dispex, &prot->function.dispex);
1
0
0
0
Jacek Caban : jscript: Introduce InterpretedFunction struct.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: cc22ee7f2ee233bf8715b506ad8851302d5e0132 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cc22ee7f2ee233bf8715b506…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:18:30 2019 +0200 jscript: Introduce InterpretedFunction struct. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/function.c | 53 +++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 79f1153..447fe62 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -32,9 +32,6 @@ typedef struct { const function_vtbl_t *vtbl; const WCHAR *name; DWORD flags; - scope_chain_t *scope_chain; - bytecode_t *code; - function_code_t *func_code; DWORD length; } FunctionInstance; @@ -46,12 +43,19 @@ struct _function_vtbl_t { typedef struct { FunctionInstance function; + scope_chain_t *scope_chain; + bytecode_t *code; + function_code_t *func_code; +} InterpretedFunction; + +typedef struct { + FunctionInstance function; builtin_invoke_t proc; } NativeFunction; typedef struct { jsdisp_t jsdisp; - FunctionInstance *function; + InterpretedFunction *function; jsval_t *buf; call_frame_t *frame; unsigned argc; @@ -105,7 +109,7 @@ static void Arguments_destructor(jsdisp_t *jsdisp) heap_free(arguments->buf); } - jsdisp_release(&arguments->function->dispex); + jsdisp_release(&arguments->function->function.dispex); heap_free(arguments); } @@ -135,7 +139,8 @@ static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) return jsval_copy(*ref, r); /* FIXME: Accessing by name won't work for duplicated argument names */ - return jsdisp_propget_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], r); + return jsdisp_propget_name(arguments->frame->base_scope->jsobj, + arguments->function->func_code->params[idx], r); } static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) @@ -158,7 +163,8 @@ static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) } /* FIXME: Accessing by name won't work for duplicated argument names */ - return jsdisp_propput_name(arguments->frame->base_scope->jsobj, arguments->function->func_code->params[idx], val); + return jsdisp_propput_name(arguments->frame->base_scope->jsobj, + arguments->function->func_code->params[idx], val); } static const builtin_info_t Arguments_info = { @@ -189,7 +195,7 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame) return hres; } - args->function = function_from_jsdisp(jsdisp_addref(frame->function_instance)); + args->function = (InterpretedFunction*)function_from_jsdisp(jsdisp_addref(frame->function_instance)); args->argc = frame->argc; args->frame = frame; @@ -197,7 +203,7 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame) jsval_number(args->argc)); if(SUCCEEDED(hres)) hres = jsdisp_define_data_property(&args->jsdisp, caleeW, PROPF_WRITABLE | PROPF_CONFIGURABLE, - jsval_obj(&args->function->dispex)); + jsval_obj(&args->function->function.dispex)); if(SUCCEEDED(hres)) hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_WRITABLE, jsval_obj(&args->jsdisp)); if(FAILED(hres)) { @@ -651,9 +657,10 @@ HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_pro return S_OK; } -static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned flags, +static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_obj, unsigned flags, unsigned argc, jsval_t *argv, jsval_t *r) { + InterpretedFunction *function = (InterpretedFunction*)func; jsdisp_t *var_disp, *new_obj = NULL; DWORD exec_flags = 0; HRESULT hres; @@ -666,7 +673,7 @@ static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *fun } if(flags & DISPATCH_CONSTRUCT) { - hres = create_object(ctx, &function->dispex, &new_obj); + hres = create_object(ctx, &function->function.dispex, &new_obj); if(FAILED(hres)) return hres; this_obj = to_disp(new_obj); @@ -680,7 +687,7 @@ static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *fun hres = create_dispex(ctx, NULL, NULL, &var_disp); if(SUCCEEDED(hres)) hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, - &function->dispex, var_disp, argc, argv, r); + &function->function.dispex, var_disp, argc, argv, r); if(new_obj) jsdisp_release(new_obj); @@ -688,14 +695,18 @@ static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *fun return hres; } -static HRESULT InterpretedFunction_toString(FunctionInstance *function, jsstr_t **ret) +static HRESULT InterpretedFunction_toString(FunctionInstance *func, jsstr_t **ret) { + InterpretedFunction *function = (InterpretedFunction*)func; + *ret = jsstr_alloc_len(function->func_code->source, function->func_code->source_len); return *ret ? S_OK : E_OUTOFMEMORY; } -static void InterpretedFunction_destructor(FunctionInstance *function) +static void InterpretedFunction_destructor(FunctionInstance *func) { + InterpretedFunction *function = (InterpretedFunction*)func; + release_bytecode(function->code); if(function->scope_chain) scope_release(function->scope_chain); @@ -710,7 +721,7 @@ static const function_vtbl_t InterpretedFunctionVtbl = { HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_code_t *func_code, scope_chain_t *scope_chain, jsdisp_t **ret) { - FunctionInstance *function; + InterpretedFunction *function; jsdisp_t *prototype; HRESULT hres; @@ -718,15 +729,15 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod if(FAILED(hres)) return hres; - hres = create_function(ctx, NULL, &InterpretedFunctionVtbl, sizeof(FunctionInstance), PROPF_CONSTR, + hres = create_function(ctx, NULL, &InterpretedFunctionVtbl, sizeof(InterpretedFunction), PROPF_CONSTR, FALSE, NULL, (void**)&function); if(SUCCEEDED(hres)) { - hres = jsdisp_define_data_property(&function->dispex, prototypeW, PROPF_WRITABLE, + hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, PROPF_WRITABLE, jsval_obj(prototype)); if(SUCCEEDED(hres)) - hres = set_constructor_prop(ctx, &function->dispex, prototype); + hres = set_constructor_prop(ctx, &function->function.dispex, prototype); if(FAILED(hres)) - jsdisp_release(&function->dispex); + jsdisp_release(&function->function.dispex); } jsdisp_release(prototype); if(FAILED(hres)) @@ -740,9 +751,9 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod bytecode_addref(code); function->code = code; function->func_code = func_code; - function->length = function->func_code->param_cnt; + function->function.length = function->func_code->param_cnt; - *ret = &function->dispex; + *ret = &function->function.dispex; return S_OK; }
1
0
0
0
Jacek Caban : jscript: Move value_proc to BuiltinFunction struct.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: 2204c06909a8a0e8ecf498c2122ae4f4b80476ee URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2204c06909a8a0e8ecf498c2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:18:21 2019 +0200 jscript: Move value_proc to BuiltinFunction struct. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/function.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index d4b3473..79f1153 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -30,7 +30,6 @@ typedef struct _function_vtbl_t function_vtbl_t; typedef struct { jsdisp_t dispex; const function_vtbl_t *vtbl; - builtin_invoke_t value_proc; const WCHAR *name; DWORD flags; scope_chain_t *scope_chain; @@ -47,6 +46,7 @@ struct _function_vtbl_t { typedef struct { FunctionInstance function; + builtin_invoke_t proc; } NativeFunction; typedef struct { @@ -541,9 +541,10 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_ return S_OK; } -static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, unsigned flags, +static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *func, IDispatch *this_disp, unsigned flags, unsigned argc, jsval_t *argv, jsval_t *r) { + NativeFunction *function = (NativeFunction*)func; vdisp_t vthis; HRESULT hres; @@ -554,7 +555,7 @@ static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *function else set_jsdisp(&vthis, ctx->global); - hres = function->value_proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r); + hres = function->proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r); vdisp_release(&vthis); return hres; @@ -598,7 +599,7 @@ static const function_vtbl_t NativeFunctionVtbl = { HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret) { - FunctionInstance *function; + NativeFunction *function; HRESULT hres; hres = create_function(ctx, builtin_info, &NativeFunctionVtbl, sizeof(NativeFunction), flags, FALSE, NULL, (void**)&function); @@ -606,19 +607,19 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc, return hres; if(builtin_info) - hres = jsdisp_define_data_property(&function->dispex, lengthW, 0, - jsval_number(function->length)); + hres = jsdisp_define_data_property(&function->function.dispex, lengthW, 0, + jsval_number(function->function.length)); if(SUCCEEDED(hres)) - hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype)); + hres = jsdisp_define_data_property(&function->function.dispex, prototypeW, 0, jsval_obj(prototype)); if(FAILED(hres)) { - jsdisp_release(&function->dispex); + jsdisp_release(&function->function.dispex); return hres; } - function->value_proc = value_proc; - function->name = name; + function->proc = value_proc; + function->function.name = name; - *ret = &function->dispex; + *ret = &function->function.dispex; return S_OK; } @@ -873,13 +874,13 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype) if(FAILED(hres)) return hres; - prot->function.value_proc = FunctionProt_value; + prot->proc = FunctionProt_value; prot->function.name = prototypeW; hres = create_function(ctx, &FunctionInst_info, &NativeFunctionVtbl, sizeof(NativeFunction), PROPF_CONSTR|1, TRUE, &prot->function.dispex, (void**)&constr); if(SUCCEEDED(hres)) { - constr->function.value_proc = FunctionConstr_value; + constr->proc = FunctionConstr_value; constr->function.name = FunctionW; hres = jsdisp_define_data_property(&constr->function.dispex, prototypeW, 0, jsval_obj(&prot->function.dispex)); if(SUCCEEDED(hres))
1
0
0
0
Jacek Caban : jscript: Move function call implementation into vtbl.
by Alexandre Julliard
15 Aug '19
15 Aug '19
Module: wine Branch: master Commit: 5c5397d1efa1ce35e19131fcf3baaecd0c0cd1de URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5c5397d1efa1ce35e19131fc…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Aug 14 13:18:09 2019 +0200 jscript: Move function call implementation into vtbl. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/function.c | 148 +++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 85 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 3b50a5d..d4b3473 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -40,6 +40,7 @@ typedef struct { } FunctionInstance; struct _function_vtbl_t { + HRESULT (*call)(script_ctx_t*,FunctionInstance*,IDispatch*,unsigned,unsigned,jsval_t*,jsval_t*); HRESULT (*toString)(FunctionInstance*,jsstr_t**); void (*destructor)(FunctionInstance*); }; @@ -243,69 +244,8 @@ void detach_arguments_object(jsdisp_t *args_disp) jsdisp_release(frame->arguments_obj); } -static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned argc, jsval_t *argv, - BOOL is_constructor, BOOL caller_execs_source, jsval_t *r) -{ - jsdisp_t *var_disp; - DWORD exec_flags = 0; - HRESULT hres; - - if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) { - WARN("Script engine state does not allow running code.\n"); - return E_UNEXPECTED; - } - - if(!function->func_code) { - FIXME("no source\n"); - return E_FAIL; - } - - hres = create_dispex(ctx, NULL, NULL, &var_disp); - if(FAILED(hres)) - return hres; - - if(caller_execs_source) - exec_flags |= EXEC_RETURN_TO_INTERP; - if(is_constructor) - exec_flags |= EXEC_CONSTRUCTOR; - hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, - &function->dispex, var_disp, argc, argv, r); - - jsdisp_release(var_disp); - return hres; -} - -static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, - unsigned argc, jsval_t *argv, jsval_t *r) -{ - vdisp_t vthis; - HRESULT hres; - - if(this_disp) - set_disp(&vthis, this_disp); - else if(ctx->host_global) - set_disp(&vthis, ctx->host_global); - else - set_jsdisp(&vthis, ctx->global); - - hres = function->value_proc(ctx, &vthis, flags, argc, argv, r); - - vdisp_release(&vthis); - return hres; -} - -static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, - unsigned argc, jsval_t *argv, BOOL caller_execs_source, jsval_t *r) -{ - if(function->value_proc) - return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, argc, argv, r); - - return invoke_source(ctx, function, this_obj, argc, argv, FALSE, caller_execs_source, r); -} - HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) { - const BOOL caller_execs_source = (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0; FunctionInstance *function; TRACE("func %p this %p\n", func_this, jsthis); @@ -313,25 +253,7 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi assert(is_class(func_this, JSCLASS_FUNCTION)); function = function_from_jsdisp(func_this); - flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; - if(function->value_proc) - return invoke_value_proc(function->dispex.ctx, function, jsthis, flags, argc, argv, r); - - if(flags == DISPATCH_CONSTRUCT) { - jsdisp_t *this_obj; - HRESULT hres; - - hres = create_object(function->dispex.ctx, &function->dispex, &this_obj); - if(FAILED(hres)) - return hres; - - hres = invoke_source(function->dispex.ctx, function, to_disp(this_obj), argc, argv, TRUE, caller_execs_source, r); - jsdisp_release(this_obj); - return hres; - } - - assert(flags == DISPATCH_METHOD); - return invoke_source(function->dispex.ctx, function, jsthis, argc, argv, FALSE, caller_execs_source, r); + return function->vtbl->call(function->dispex.ctx, function, jsthis, flags, argc, argv, r); } static HRESULT Function_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) @@ -445,7 +367,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un if(SUCCEEDED(hres)) { if(function) { - hres = call_function(ctx, function, this_obj, cnt, args, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); + hres = function->vtbl->call(ctx, function, this_obj, flags, cnt, args, r); }else { jsval_t res; hres = disp_call_value(ctx, jsthis->u.disp, this_obj, DISPATCH_METHOD, cnt, args, &res); @@ -489,7 +411,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns cnt = argc-1; } - hres = call_function(ctx, function, this_obj, cnt, argv+1, (flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) != 0, r); + hres = function->vtbl->call(ctx, function, this_obj, flags, cnt, argv + 1, r); if(this_obj) IDispatch_Release(this_obj); @@ -509,9 +431,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned } function = function_from_jsdisp(jsthis->u.jsdisp); - - assert(function->value_proc != NULL); - return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r); + return function->vtbl->call(ctx, function, NULL, flags, argc, argv, r); } HRESULT Function_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) @@ -621,6 +541,25 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_ return S_OK; } +static HRESULT NativeFunction_call(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r) +{ + vdisp_t vthis; + HRESULT hres; + + if(this_disp) + set_disp(&vthis, this_disp); + else if(ctx->host_global) + set_disp(&vthis, ctx->host_global); + else + set_jsdisp(&vthis, ctx->global); + + hres = function->value_proc(ctx, &vthis, flags & ~DISPATCH_JSCRIPT_INTERNAL_MASK, argc, argv, r); + + vdisp_release(&vthis); + return hres; +} + static HRESULT NativeFunction_toString(FunctionInstance *function, jsstr_t **ret) { DWORD name_len; @@ -651,6 +590,7 @@ static void NativeFunction_destructor(FunctionInstance *function) } static const function_vtbl_t NativeFunctionVtbl = { + NativeFunction_call, NativeFunction_toString, NativeFunction_destructor }; @@ -710,6 +650,43 @@ HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_pro return S_OK; } +static HRESULT InterpretedFunction_call(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, unsigned flags, + unsigned argc, jsval_t *argv, jsval_t *r) +{ + jsdisp_t *var_disp, *new_obj = NULL; + DWORD exec_flags = 0; + HRESULT hres; + + TRACE("%p\n", function); + + if(ctx->state == SCRIPTSTATE_UNINITIALIZED || ctx->state == SCRIPTSTATE_CLOSED) { + WARN("Script engine state does not allow running code.\n"); + return E_UNEXPECTED; + } + + if(flags & DISPATCH_CONSTRUCT) { + hres = create_object(ctx, &function->dispex, &new_obj); + if(FAILED(hres)) + return hres; + this_obj = to_disp(new_obj); + } + + if(flags & DISPATCH_JSCRIPT_CALLEREXECSSOURCE) + exec_flags |= EXEC_RETURN_TO_INTERP; + if(flags & DISPATCH_CONSTRUCT) + exec_flags |= EXEC_CONSTRUCTOR; + + hres = create_dispex(ctx, NULL, NULL, &var_disp); + if(SUCCEEDED(hres)) + hres = exec_source(ctx, exec_flags, function->code, function->func_code, function->scope_chain, this_obj, + &function->dispex, var_disp, argc, argv, r); + if(new_obj) + jsdisp_release(new_obj); + + jsdisp_release(var_disp); + return hres; +} + static HRESULT InterpretedFunction_toString(FunctionInstance *function, jsstr_t **ret) { *ret = jsstr_alloc_len(function->func_code->source, function->func_code->source_len); @@ -724,6 +701,7 @@ static void InterpretedFunction_destructor(FunctionInstance *function) } static const function_vtbl_t InterpretedFunctionVtbl = { + InterpretedFunction_call, InterpretedFunction_toString, InterpretedFunction_destructor };
1
0
0
0
← Newer
1
...
36
37
38
39
40
41
42
...
71
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Results per page:
10
25
50
100
200