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
September 2011
----- 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
996 discussions
Start a n
N
ew thread
Jacek Caban : vbscript: Added support for default getters.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: a8de7904f5236a24286a6ac061888180f0c6e441 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a8de7904f5236a24286a6ac06…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:28:52 2011 +0200 vbscript: Added support for default getters. --- dlls/vbscript/compile.c | 23 +++++++++++++++++++---- dlls/vbscript/interp.c | 5 +++-- dlls/vbscript/parser.y | 3 +-- dlls/vbscript/tests/lang.vbs | 8 ++++++++ dlls/vbscript/vbscript.h | 3 ++- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 1fc6612..bcf7b52 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -684,6 +684,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f case FUNC_PROPGET: case FUNC_PROPLET: case FUNC_PROPSET: + case FUNC_DEFGET: ctx->prop_end_label = alloc_label(ctx); if(ctx->prop_end_label == -1) return E_OUTOFMEMORY; @@ -846,6 +847,7 @@ static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_d case FUNC_FUNCTION: case FUNC_SUB: case FUNC_PROPGET: + case FUNC_DEFGET: invoke_type = VBDISP_CALLGET; break; case FUNC_PROPLET: @@ -885,7 +887,7 @@ static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) { - function_decl_t *func_decl; + function_decl_t *func_decl, *func_prop_decl; class_prop_decl_t *prop_decl; class_desc_t *class_desc; unsigned i; @@ -908,8 +910,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) class_desc->func_cnt = 1; /* always allocate slot for default getter */ class_desc->prop_cnt = 0; - for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next) - class_desc->func_cnt++; + for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next) { + for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->next_prop_func) { + if(func_prop_decl->type == FUNC_DEFGET) + break; + } + if(!func_prop_decl) + class_desc->func_cnt++; + } class_desc->funcs = compiler_alloc(ctx->code, class_desc->func_cnt*sizeof(*class_desc->funcs)); if(!class_desc->funcs) @@ -917,7 +925,14 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) memset(class_desc->funcs, 0, class_desc->func_cnt*sizeof(*class_desc->funcs)); for(func_decl = class_decl->funcs, i=1; func_decl; func_decl = func_decl->next, i++) { - hres = create_class_funcprop(ctx, func_decl, class_desc->funcs + i); + for(func_prop_decl = func_decl; func_prop_decl; func_prop_decl = func_prop_decl->next_prop_func) { + if(func_prop_decl->type == FUNC_DEFGET) { + i--; + break; + } + } + + hres = create_class_funcprop(ctx, func_decl, class_desc->funcs + (func_prop_decl ? 0 : i)); if(FAILED(hres)) return hres; } diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 899d989..4599cbf 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -92,7 +92,8 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ DISPID id; HRESULT hres; - if(invoke_type == VBDISP_LET && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET) + if(invoke_type == VBDISP_LET + && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET || ctx->func->type == FUNC_DEFGET) && !strcmpiW(name, ctx->func->name)) { ref->type = REF_VAR; ref->u.v = &ctx->ret_val; @@ -1237,7 +1238,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI } assert(!exec.top); - if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET) + if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET && func->type != FUNC_DEFGET) assert(V_VT(&exec.ret_val) == VT_EMPTY); if(SUCCEEDED(hres) && res) { diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index c345432..adf1aba 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -602,8 +602,7 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name, if(storage_flags & STORAGE_IS_DEFAULT) { if(type == FUNC_PROPGET) { - FIXME("default value not implemented\n"); - ctx->hres = E_NOTIMPL; + type = FUNC_DEFGET; }else { FIXME("Invalid default property\n"); ctx->hres = E_FAIL; diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 20f1f42..24bfecc 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -406,6 +406,14 @@ Class TestClass Call ok(false, "exit property not returned?") End Property + Public Default Property Get DefValGet + DefValGet = privateProp + funcCalled = "GetDefVal" + End Property + + Public Property Let DefValGet(x) + End Property + Public publicProp2 Public Sub publicSub diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 37fc7dd..37931db 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -214,7 +214,8 @@ typedef enum { FUNC_SUB, FUNC_PROPGET, FUNC_PROPLET, - FUNC_PROPSET + FUNC_PROPSET, + FUNC_DEFGET } function_type_t; typedef struct {
1
0
0
0
Jacek Caban : vbscript: Added interp_set_member implementation.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: a03ad6b2cd4113b4cf1a06614d1037322b2f336c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a03ad6b2cd4113b4cf1a06614…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:28:42 2011 +0200 vbscript: Added interp_set_member implementation. --- dlls/vbscript/interp.c | 36 ++++++++++++++++++++++++++++++++++-- dlls/vbscript/tests/lang.vbs | 2 ++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 7376d93..899d989 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -502,8 +502,40 @@ static HRESULT interp_assign_member(exec_ctx_t *ctx) static HRESULT interp_set_member(exec_ctx_t *ctx) { BSTR identifier = ctx->instr->arg1.bstr; - FIXME("%s\n", debugstr_w(identifier)); - return E_NOTIMPL; + IDispatch *obj, *val; + DISPID id; + HRESULT hres; + + TRACE("%s\n", debugstr_w(identifier)); + + hres = stack_pop_disp(ctx, &obj); + if(FAILED(hres)) + return hres; + + if(!obj) { + FIXME("NULL obj\n"); + return E_FAIL; + } + + hres = stack_pop_disp(ctx, &val); + if(FAILED(hres)) { + IDispatch_Release(obj); + return hres; + } + + hres = disp_get_id(obj, identifier, VBDISP_SET, FALSE, &id); + if(SUCCEEDED(hres)) { + VARIANT v; + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = val; + hres = disp_propput(ctx->script, obj, id, &v); + } + + if(val) + IDispatch_Release(val); + IDispatch_Release(obj); + return hres; } static HRESULT interp_new(exec_ctx_t *ctx) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 02d4438..20f1f42 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -462,5 +462,7 @@ Call ok(funcCalled = "gsProp get", "funcCalled = " & funcCalled) obj.gsProp = 3 Call ok(funcCalled = "gsProp let", "funcCalled = " & funcCalled) Call ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp) +Set obj.gsProp = New testclass +Call ok(funcCalled = "gsProp set", "funcCalled = " & funcCalled) reportSuccess()
1
0
0
0
Jacek Caban : vbscript: Added support for exit property statement.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 6c8c617df9c2c1c930d668ea48a08fbbd0491b9d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6c8c617df9c2c1c930d668ea4…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:28:29 2011 +0200 vbscript: Added support for exit property statement. --- dlls/vbscript/compile.c | 22 +++++++++++++++++++++- dlls/vbscript/parse.h | 1 + dlls/vbscript/parser.y | 1 + dlls/vbscript/tests/lang.vbs | 6 ++++++ 4 files changed, 29 insertions(+), 1 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 6c30a40..1fc6612 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -40,6 +40,7 @@ typedef struct { unsigned sub_end_label; unsigned func_end_label; + unsigned prop_end_label; dim_decl_t *dim_decls; dynamic_var_t *global_vars; @@ -585,6 +586,16 @@ static HRESULT compile_exitfunc_statement(compile_ctx_t *ctx) return push_instr_addr(ctx, OP_jmp, ctx->func_end_label); } +static HRESULT compile_exitprop_statement(compile_ctx_t *ctx) +{ + if(ctx->prop_end_label == -1) { + FIXME("Exit Property outside Property?\n"); + return E_FAIL; + } + + return push_instr_addr(ctx, OP_jmp, ctx->prop_end_label); +} + static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat) { HRESULT hres; @@ -603,6 +614,9 @@ static HRESULT compile_statement(compile_ctx_t *ctx, statement_t *stat) case STAT_EXITFUNC: hres = compile_exitfunc_statement(ctx); break; + case STAT_EXITPROP: + hres = compile_exitprop_statement(ctx); + break; case STAT_EXITSUB: hres = compile_exitsub_statement(ctx); break; @@ -654,6 +668,7 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f ctx->sub_end_label = -1; ctx->func_end_label = -1; + ctx->prop_end_label = -1; switch(func->type) { case FUNC_FUNCTION: @@ -669,7 +684,10 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f case FUNC_PROPGET: case FUNC_PROPLET: case FUNC_PROPSET: - /* FIXME */ + ctx->prop_end_label = alloc_label(ctx); + if(ctx->prop_end_label == -1) + return E_OUTOFMEMORY; + break; case FUNC_GLOBAL: break; } @@ -685,6 +703,8 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f label_set_addr(ctx, ctx->sub_end_label); if(ctx->func_end_label != -1) label_set_addr(ctx, ctx->func_end_label); + if(ctx->prop_end_label != -1) + label_set_addr(ctx, ctx->prop_end_label); if(push_instr(ctx, OP_ret) == -1) return E_OUTOFMEMORY; diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 6227e0c..245badc 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -94,6 +94,7 @@ typedef enum { STAT_CALL, STAT_DIM, STAT_EXITFUNC, + STAT_EXITPROP, STAT_EXITSUB, STAT_FUNC, STAT_IF, diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index f67abd5..c345432 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -155,6 +155,7 @@ Statement | IfStatement { $$ = $1; } | FunctionDecl { $$ = new_function_statement(ctx, $1); CHECK_ERROR; } | tEXIT tFUNCTION { $$ = new_statement(ctx, STAT_EXITFUNC, 0); CHECK_ERROR; } + | tEXIT tPROPERTY { $$ = new_statement(ctx, STAT_EXITPROP, 0); CHECK_ERROR; } | tEXIT tSUB { $$ = new_statement(ctx, STAT_EXITSUB, 0); CHECK_ERROR; } | tSET MemberExpression Arguments_opt '=' Expression { $2->args = $3; $$ = new_set_statement(ctx, $2, $5); CHECK_ERROR; } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 2a1bbb0..02d4438 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -402,6 +402,8 @@ Class TestClass Public Property Get gsProp() gsProp = privateProp funcCalled = "gsProp get" + exit property + Call ok(false, "exit property not returned?") End Property Public publicProp2 @@ -412,10 +414,14 @@ Class TestClass Public Property Let gsProp(val) privateProp = val funcCalled = "gsProp let" + exit property + Call ok(false, "exit property not returned?") End Property Public Property Set gsProp(val) funcCalled = "gsProp set" + exit property + Call ok(false, "exit property not returned?") End Property Public Sub setPrivateProp(x)
1
0
0
0
Jacek Caban : vbscript: Added compiler/runtime support for property getters /letters.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 097a75f6744273a37bcb08d6fde71a2cafd882d5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=097a75f6744273a37bcb08d6f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:28:18 2011 +0200 vbscript: Added compiler/runtime support for property getters/letters. --- dlls/vbscript/compile.c | 34 ++++++++++++++++++++++++--- dlls/vbscript/interp.c | 13 +++++----- dlls/vbscript/tests/lang.vbs | 8 ++++++ dlls/vbscript/vbdisp.c | 52 +++++++++++++++++++++++++++++++++--------- dlls/vbscript/vbscript.h | 2 +- 5 files changed, 87 insertions(+), 22 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 015e775..6c30a40 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -813,16 +813,42 @@ static BOOL lookup_class_name(compile_ctx_t *ctx, const WCHAR *name) static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_decl, vbdisp_funcprop_desc_t *desc) { + vbdisp_invoke_type_t invoke_type; + function_decl_t *funcprop_decl; + HRESULT hres; + desc->name = compiler_alloc_string(ctx->code, func_decl->name); if(!desc->name) return E_OUTOFMEMORY; - assert(!desc->entries[0]); + for(funcprop_decl = func_decl; funcprop_decl; funcprop_decl = funcprop_decl->next_prop_func) { + switch(funcprop_decl->type) { + case FUNC_FUNCTION: + case FUNC_SUB: + case FUNC_PROPGET: + invoke_type = VBDISP_CALLGET; + break; + case FUNC_PROPLET: + invoke_type = VBDISP_LET; + break; + case FUNC_PROPSET: + invoke_type = VBDISP_SET; + break; + default: + assert(0); + } - if(func_decl->is_public) - desc->is_public = TRUE; + assert(!desc->entries[invoke_type]); - return create_function(ctx, func_decl, desc->entries); + if(funcprop_decl->is_public) + desc->is_public = TRUE; + + hres = create_function(ctx, funcprop_decl, desc->entries+invoke_type); + if(FAILED(hres)) + return hres; + } + + return S_OK; } static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 27da9d3..7376d93 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -92,7 +92,8 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ DISPID id; HRESULT hres; - if(invoke_type == VBDISP_LET && ctx->func->type == FUNC_FUNCTION && !strcmpiW(name, ctx->func->name)) { + if(invoke_type == VBDISP_LET && (ctx->func->type == FUNC_FUNCTION || ctx->func->type == FUNC_PROPGET) + && !strcmpiW(name, ctx->func->name)) { ref->type = REF_VAR; ref->u.v = &ctx->ret_val; return S_OK; @@ -114,7 +115,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ } } - hres = disp_get_id(ctx->this_obj, name, TRUE, &id); + hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; ref->u.d.disp = ctx->this_obj; @@ -135,7 +136,7 @@ static HRESULT lookup_identifier(exec_ctx_t *ctx, BSTR name, vbdisp_invoke_type_ LIST_FOR_EACH_ENTRY(item, &ctx->script->named_items, named_item_t, entry) { if((item->flags & SCRIPTITEM_GLOBALMEMBERS) && item->disp != ctx->this_obj) { - hres = disp_get_id(item->disp, name, FALSE, &id); + hres = disp_get_id(item->disp, name, invoke_type, FALSE, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; ref->u.d.disp = item->disp; @@ -356,7 +357,7 @@ static HRESULT do_mcall(exec_ctx_t *ctx, VARIANT *res) vbstack_to_dp(ctx, arg_cnt, &dp); - hres = disp_get_id(obj, identifier, FALSE, &id); + hres = disp_get_id(obj, identifier, VBDISP_CALLGET, FALSE, &id); if(SUCCEEDED(hres)) hres = disp_call(ctx->script, obj, id, &dp, res); IDispatch_Release(obj); @@ -489,7 +490,7 @@ static HRESULT interp_assign_member(exec_ctx_t *ctx) return hres; } - hres = disp_get_id(obj, identifier, FALSE, &id); + hres = disp_get_id(obj, identifier, VBDISP_LET, FALSE, &id); if(SUCCEEDED(hres)) hres = disp_propput(ctx->script, obj, id, val.v); @@ -1204,7 +1205,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI } assert(!exec.top); - if(func->type != FUNC_FUNCTION) + if(func->type != FUNC_FUNCTION && func->type != FUNC_PROPGET) assert(V_VT(&exec.ret_val) == VT_EMPTY); if(SUCCEEDED(hres) && res) { diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index ac70b5f..2a1bbb0 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -449,4 +449,12 @@ obj.publicProp() = 3 Call obj.setPrivateProp(6) Call ok(obj.getPrivateProp = 6, "obj.getPrivateProp = " & obj.getPrivateProp) +Dim funcCalled +funcCalled = "" +Call ok(obj.gsProp = 6, "obj.gsProp = " & obj.gsProp) +Call ok(funcCalled = "gsProp get", "funcCalled = " & funcCalled) +obj.gsProp = 3 +Call ok(funcCalled = "gsProp let", "funcCalled = " & funcCalled) +Call ok(obj.getPrivateProp = 3, "obj.getPrivateProp = " & obj.getPrivateProp) + reportSuccess() diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index e9bcb2a..a5fa63c 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -27,15 +27,21 @@ static inline BOOL is_func_id(vbdisp_t *This, DISPID id) return id < This->desc->func_cnt; } -static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, BOOL search_private, DISPID *id) +static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id) { unsigned i; - for(i = 0; i < This->desc->func_cnt; i++) { - if(!search_private && !This->desc->funcs[i].is_public) - continue; - if(!This->desc->funcs[i].name) /* default value may not exist */ - continue; + for(i = invoke_type == VBDISP_ANY ? 0 : 1; i < This->desc->func_cnt; i++) { + if(invoke_type == VBDISP_ANY) { + if(!search_private && !This->desc->funcs[i].is_public) + continue; + if(!i && !This->desc->funcs[0].name) /* default value may not exist */ + continue; + }else { + if(!This->desc->funcs[i].entries[invoke_type] + || (!search_private && !This->desc->funcs[i].entries[invoke_type]->is_public)) + continue; + } if(!strcmpiW(This->desc->funcs[i].name, name)) { *id = i; @@ -46,11 +52,11 @@ static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, BOOL search_private, return FALSE; } -HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id) +HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id) { unsigned i; - if(get_func_id(This, name, search_private, id)) + if(get_func_id(This, name, invoke_type, search_private, id)) return S_OK; for(i=0; i < This->desc->prop_cnt; i++) { @@ -225,7 +231,7 @@ static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DW return E_NOTIMPL; } - return vbdisp_get_id(This, bstrName, FALSE, pid); + return vbdisp_get_id(This, bstrName, VBDISP_ANY, FALSE, pid); } static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, @@ -254,6 +260,30 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc } return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, pdp, pvarRes); + case DISPATCH_PROPERTYPUT: { + VARIANT *put_val; + DISPPARAMS dp = {NULL, NULL, 1, 0}; + + if(arg_cnt(pdp)) { + FIXME("arguments not implemented\n"); + return E_NOTIMPL; + } + + put_val = get_propput_arg(pdp); + if(!put_val) { + WARN("no value to set\n"); + return DISP_E_PARAMNOTOPTIONAL; + } + + dp.rgvarg = put_val; + func = This->desc->funcs[id].entries[V_VT(put_val) == VT_DISPATCH ? VBDISP_SET : VBDISP_LET]; + if(!func) { + FIXME("no letter/setter\n"); + return DISP_E_MEMBERNOTFOUND; + } + + return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, &dp, NULL); + } default: FIXME("flags %x\n", wFlags); return DISP_E_MEMBERNOTFOUND; @@ -355,7 +385,7 @@ HRESULT init_global(script_ctx_t *ctx) return create_vbdisp(&ctx->script_desc, &ctx->script_obj); } -HRESULT disp_get_id(IDispatch *disp, BSTR name, BOOL search_private, DISPID *id) +HRESULT disp_get_id(IDispatch *disp, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id) { IDispatchEx *dispex; vbdisp_t *vbdisp; @@ -363,7 +393,7 @@ HRESULT disp_get_id(IDispatch *disp, BSTR name, BOOL search_private, DISPID *id) vbdisp = unsafe_impl_from_IDispatch(disp); if(vbdisp) - return vbdisp_get_id(vbdisp, name, search_private, id); + return vbdisp_get_id(vbdisp, name, invoke_type, search_private, id); hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); if(FAILED(hres)) { diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 7433293..37fc7dd 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -93,7 +93,7 @@ typedef struct { } vbdisp_t; HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**); -HRESULT disp_get_id(IDispatch*,BSTR,BOOL,DISPID*); +HRESULT disp_get_id(IDispatch*,BSTR,vbdisp_invoke_type_t,BOOL,DISPID*); HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,DISPPARAMS*,VARIANT*); HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,VARIANT*);
1
0
0
0
Jacek Caban : vbscript: Added getters/setters parser implementation.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 32f336bd9dddc0d4331361b7043db68b6fa1ca39 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=32f336bd9dddc0d4331361b70…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:28:00 2011 +0200 vbscript: Added getters/setters parser implementation. --- dlls/vbscript/compile.c | 4 ++++ dlls/vbscript/parse.h | 1 + dlls/vbscript/parser.y | 37 +++++++++++++++++++++++++++++++++---- dlls/vbscript/tests/lang.vbs | 14 ++++++++++++++ dlls/vbscript/vbscript.h | 5 ++++- 5 files changed, 56 insertions(+), 5 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 14d2598..015e775 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -666,6 +666,10 @@ static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *f if(ctx->sub_end_label == -1) return E_OUTOFMEMORY; break; + case FUNC_PROPGET: + case FUNC_PROPLET: + case FUNC_PROPSET: + /* FIXME */ case FUNC_GLOBAL: break; } diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 63b2ded..6227e0c 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -140,6 +140,7 @@ typedef struct _function_decl_t { arg_decl_t *args; statement_t *body; struct _function_decl_t *next; + struct _function_decl_t *next_prop_func; } function_decl_t; typedef struct { diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 5224c71..f67abd5 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -115,7 +115,7 @@ static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,u %type <expression> Arguments_opt ArgumentList_opt ArgumentList %type <bool> OptionExplicit_opt %type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl -%type <func_decl> FunctionDecl +%type <func_decl> FunctionDecl PropertyDecl %type <elseif> ElseIfs_opt ElseIfs ElseIf %type <class_decl> ClassDeclaration ClassBody %type <uint> Storage Storage_opt @@ -295,6 +295,15 @@ ClassBody : /* empty */ { $$ = new_class_decl(ctx); } | FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } | Storage tIdentifier tNL ClassBody { $$ = add_variant_prop(ctx, $4, $2, $1); CHECK_ERROR; } + | PropertyDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } + +PropertyDecl + : Storage_opt tPROPERTY tGET tIdentifier EmptyBrackets_opt tNL StatementsNl_opt tEND tPROPERTY + { $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, NULL, $7); CHECK_ERROR; } + | Storage_opt tPROPERTY tLET tIdentifier '(' ArgumentDecl ')' tNL StatementsNl_opt tEND tPROPERTY + { $$ = new_function_decl(ctx, $4, FUNC_PROPLET, $1, $6, $9); CHECK_ERROR; } + | Storage_opt tPROPERTY tSET tIdentifier '(' ArgumentDecl ')' tNL StatementsNl_opt tEND tPROPERTY + { $$ = new_function_decl(ctx, $4, FUNC_PROPSET, $1, $6, $9); CHECK_ERROR; } FunctionDecl : Storage_opt tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB @@ -591,9 +600,14 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name, function_decl_t *decl; if(storage_flags & STORAGE_IS_DEFAULT) { - FIXME("Function declared as default property\n"); - ctx->hres = E_FAIL; - return NULL; + if(type == FUNC_PROPGET) { + FIXME("default value not implemented\n"); + ctx->hres = E_NOTIMPL; + }else { + FIXME("Invalid default property\n"); + ctx->hres = E_FAIL; + return NULL; + } } decl = parser_alloc(ctx, sizeof(*decl)); @@ -606,6 +620,7 @@ static function_decl_t *new_function_decl(parser_ctx_t *ctx, const WCHAR *name, decl->args = arg_decl; decl->body = body; decl->next = NULL; + decl->next_prop_func = NULL; return decl; } @@ -646,6 +661,20 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d ctx->hres = E_FAIL; return NULL; } + + while(1) { + if(iter->type == decl->type) { + FIXME("Redefinition of %s::%s\n", debugstr_w(class_decl->name), debugstr_w(decl->name)); + ctx->hres = E_FAIL; + return NULL; + } + if(!iter->next_prop_func) + break; + iter = iter->next_prop_func; + } + + iter->next_prop_func = decl; + return class_decl; } } diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index e29a20f..ac70b5f 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -399,11 +399,25 @@ Class TestClass publicFunction = 4 End Function + Public Property Get gsProp() + gsProp = privateProp + funcCalled = "gsProp get" + End Property + Public publicProp2 Public Sub publicSub End Sub + Public Property Let gsProp(val) + privateProp = val + funcCalled = "gsProp let" + End Property + + Public Property Set gsProp(val) + funcCalled = "gsProp set" + End Property + Public Sub setPrivateProp(x) privateProp = x End Sub diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index ce1fa01..7433293 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -211,7 +211,10 @@ typedef struct { typedef enum { FUNC_GLOBAL, FUNC_FUNCTION, - FUNC_SUB + FUNC_SUB, + FUNC_PROPGET, + FUNC_PROPLET, + FUNC_PROPSET } function_type_t; typedef struct {
1
0
0
0
Jacek Caban : vbscript: Added property invoke implementation.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: e843608748b3d6cfdc3af6aa6f577ab706f31c65 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e843608748b3d6cfdc3af6aa6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:27:48 2011 +0200 vbscript: Added property invoke implementation. --- dlls/vbscript/tests/lang.vbs | 16 ++++++++++ dlls/vbscript/tests/run.c | 30 ++++++++++++++++++ dlls/vbscript/vbdisp.c | 68 ++++++++++++++++++++++++++++++++++++++++-- dlls/vbscript/vbscript.h | 1 + 4 files changed, 112 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 3f9f73e..e29a20f 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -404,6 +404,14 @@ Class TestClass Public Sub publicSub End Sub + Public Sub setPrivateProp(x) + privateProp = x + End Sub + + Function getPrivateProp + getPrivateProp = privateProp + End Function + Private Sub privateSub End Sub End Class @@ -419,4 +427,12 @@ obj.publicSub() Call obj.publicSub Call obj.publicFunction() +Call ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj.publicProp)) +obj.publicProp = 3 +Call ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp) +obj.publicProp() = 3 + +Call obj.setPrivateProp(6) +Call ok(obj.getPrivateProp = 6, "obj.getPrivateProp = " & obj.getPrivateProp) + reportSuccess() diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 4fd46c9..f524b81 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -188,6 +188,36 @@ static void test_disp(IDispatch *disp) SysFreeString(str); ok(hres == S_OK, "GetDispID(publicProp2) failed: %08x\n", hres); + hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &v, &ei, NULL); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + ok(V_VT(&v) == VT_EMPTY, "V_VT(v) = %d\n", V_VT(&v)); + + V_VT(args) = VT_BOOL; + V_BOOL(args) = VARIANT_TRUE; + dp.cArgs = dp.cNamedArgs = 1; + V_VT(&v) = VT_BOOL; + hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT, &dp, &v, &ei, NULL); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + ok(V_VT(&v) == VT_EMPTY, "V_VT(v) = %d\n", V_VT(&v)); + + dp.cArgs = dp.cNamedArgs = 0; + hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &v, &ei, NULL); + ok(hres == S_OK, "InvokeEx failed: %08x\n", hres); + ok(V_VT(&v) == VT_BOOL, "V_VT(v) = %d\n", V_VT(&v)); + ok(V_BOOL(&v), "V_BOOL(v) = %x\n", V_BOOL(&v)); + + dp.cArgs = 1; + hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYGET|DISPATCH_METHOD, &dp, &v, &ei, NULL); + ok(hres == DISP_E_MEMBERNOTFOUND, "InvokeEx failed: %08x, expected DISP_E_MEMBERNOTFOUND\n", hres); + ok(V_VT(&v) == VT_EMPTY, "V_VT(v) = %d\n", V_VT(&v)); + + V_VT(args) = VT_BOOL; + V_BOOL(args) = VARIANT_FALSE; + dp.cArgs = 1; + V_VT(&v) = VT_BOOL; + hres = IDispatchEx_InvokeEx(dispex, public_prop_id, 0, DISPATCH_PROPERTYPUT, &dp, NULL, &ei, NULL); + ok(hres == DISP_E_PARAMNOTOPTIONAL, "InvokeEx failed: %08x, expected DISP_E_PARAMNOTOPTIONAL\n", hres); + str = a2bstr("publicFunction"); hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_func_id); SysFreeString(str); diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 2d0540f..e9bcb2a 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -67,6 +67,64 @@ HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id return DISP_E_UNKNOWNNAME; } +static VARIANT *get_propput_arg(const DISPPARAMS *dp) +{ + unsigned i; + + for(i=0; i < dp->cNamedArgs; i++) { + if(dp->rgdispidNamedArgs[i] == DISPID_PROPERTYPUT) + return dp->rgvarg+i; + } + + return NULL; +} + +static HRESULT invoke_variant_prop(vbdisp_t *This, VARIANT *v, WORD flags, DISPPARAMS *dp, VARIANT *res) +{ + HRESULT hres; + + switch(flags) { + case DISPATCH_PROPERTYGET|DISPATCH_METHOD: + if(dp->cArgs) { + WARN("called with arguments\n"); + return DISP_E_MEMBERNOTFOUND; /* That's what tests show */ + } + + hres = VariantCopy(res, v); + break; + + case DISPATCH_PROPERTYPUT: { + VARIANT *put_val; + + put_val = get_propput_arg(dp); + if(!put_val) { + WARN("no value to set\n"); + return DISP_E_PARAMNOTOPTIONAL; + } + + if(res) + V_VT(res) = VT_EMPTY; + + hres = VariantCopy(v, put_val); + break; + } + + default: + FIXME("unimplemented flags %x\n", flags); + return E_NOTIMPL; + } + + return hres; +} + +static void clean_props(vbdisp_t *This) +{ + unsigned i; + + for(i=0; i < This->desc->prop_cnt; i++) + VariantClear(This->props+i); +} + static inline vbdisp_t *impl_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, vbdisp_t, IDispatchEx_iface); @@ -110,8 +168,10 @@ static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) vbdisp_t *This = impl_from_IDispatchEx(iface); LONG ref = InterlockedIncrement(&This->ref); - if(!ref) + if(!ref) { + clean_props(This); heap_free(This); + } return ref; } @@ -200,7 +260,9 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc } } - FIXME("not implemented for non-function ids\n"); + if(id < This->desc->prop_cnt + This->desc->func_cnt) + return invoke_variant_prop(This, This->props+(id-This->desc->func_cnt), wFlags, pdp, pvarRes); + return DISP_E_MEMBERNOTFOUND; } @@ -275,7 +337,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) { vbdisp_t *vbdisp; - vbdisp = heap_alloc_zero(sizeof(*vbdisp)); + vbdisp = heap_alloc_zero(sizeof(*vbdisp) + (desc->prop_cnt-1)*sizeof(VARIANT)); if(!vbdisp) return E_OUTOFMEMORY; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index d886a4e..ce1fa01 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -89,6 +89,7 @@ typedef struct { LONG ref; const class_desc_t *desc; + VARIANT props[1]; } vbdisp_t; HRESULT create_vbdisp(const class_desc_t*,vbdisp_t**);
1
0
0
0
Jacek Caban : vbscript: Added GetDispID support for properties.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 4bb10ad385ccac1b427b463b7275579539eb14a7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4bb10ad385ccac1b427b463b7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:27:31 2011 +0200 vbscript: Added GetDispID support for properties. --- dlls/vbscript/tests/lang.vbs | 2 ++ dlls/vbscript/tests/run.c | 18 +++++++++++++++++- dlls/vbscript/vbdisp.c | 14 +++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index e23cd86..3f9f73e 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -399,6 +399,8 @@ Class TestClass publicFunction = 4 End Function + Public publicProp2 + Public Sub publicSub End Sub diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c index 6b2ec84..4fd46c9 100644 --- a/dlls/vbscript/tests/run.c +++ b/dlls/vbscript/tests/run.c @@ -160,7 +160,7 @@ static BOOL is_lang_english(void) static void test_disp(IDispatch *disp) { - DISPID id, public_func_id, public_sub_id; + DISPID id, public_prop_id, public_prop2_id, public_func_id, public_sub_id; DISPID named_args[5] = {DISPID_PROPERTYPUT}; VARIANT v, args[5]; DISPPARAMS dp = {args, named_args}; @@ -172,6 +172,22 @@ static void test_disp(IDispatch *disp) hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres); + str = a2bstr("publicProp"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_prop_id); + SysFreeString(str); + ok(hres == S_OK, "GetDispID(publicProp) failed: %08x\n", hres); + + str = a2bstr("PUBLICPROP"); + hres = IDispatchEx_GetDispID(dispex, str, 0, &id); + SysFreeString(str); + ok(hres == S_OK, "GetDispID(PUBLICPROP) failed: %08x\n", hres); + ok(public_prop_id == id, "id = %d\n", public_prop_id); + + str = a2bstr("publicPROP2"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_prop2_id); + SysFreeString(str); + ok(hres == S_OK, "GetDispID(publicProp2) failed: %08x\n", hres); + str = a2bstr("publicFunction"); hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseInsensitive, &public_func_id); SysFreeString(str); diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 666d04a..2d0540f 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -46,11 +46,23 @@ static BOOL get_func_id(vbdisp_t *This, const WCHAR *name, BOOL search_private, return FALSE; } -static HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id) +HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, BOOL search_private, DISPID *id) { + unsigned i; + if(get_func_id(This, name, search_private, id)) return S_OK; + for(i=0; i < This->desc->prop_cnt; i++) { + if(!search_private && !This->desc->props[i].is_public) + continue; + + if(!strcmpiW(This->desc->props[i].name, name)) { + *id = i + This->desc->func_cnt; + return S_OK; + } + } + *id = -1; return DISP_E_UNKNOWNNAME; }
1
0
0
0
Jacek Caban : vbscript: Added class properties compiler implementation.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: ae57aa14b39b70296955e66c21be0c2e7096519f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ae57aa14b39b70296955e66c2…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:27:22 2011 +0200 vbscript: Added class properties compiler implementation. --- dlls/vbscript/compile.c | 34 ++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.h | 7 +++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 10b2a9d..14d2598 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -821,9 +821,22 @@ static HRESULT create_class_funcprop(compile_ctx_t *ctx, function_decl_t *func_d return create_function(ctx, func_decl, desc->entries); } +static BOOL lookup_class_funcs(class_desc_t *class_desc, const WCHAR *name) +{ + unsigned i; + + for(i=0; i < class_desc->func_cnt; i++) { + if(class_desc->funcs[i].name && !strcmpiW(class_desc->funcs[i].name, name)) + return TRUE; + } + + return FALSE; +} + static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) { function_decl_t *func_decl; + class_prop_decl_t *prop_decl; class_desc_t *class_desc; unsigned i; HRESULT hres; @@ -843,6 +856,7 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) return E_OUTOFMEMORY; class_desc->func_cnt = 1; /* always allocate slot for default getter */ + class_desc->prop_cnt = 0; for(func_decl = class_decl->funcs; func_decl; func_decl = func_decl->next) class_desc->func_cnt++; @@ -858,6 +872,26 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) return hres; } + for(prop_decl = class_decl->props; prop_decl; prop_decl = prop_decl->next) + class_desc->prop_cnt++; + + class_desc->props = compiler_alloc(ctx->code, class_desc->prop_cnt*sizeof(*class_desc->props)); + if(!class_desc->props) + return E_OUTOFMEMORY; + + for(prop_decl = class_decl->props, i=0; prop_decl; prop_decl = prop_decl->next, i++) { + if(lookup_class_funcs(class_desc, prop_decl->name)) { + FIXME("Property %s redefined\n", debugstr_w(prop_decl->name)); + return E_FAIL; + } + + class_desc->props[i].name = compiler_alloc_string(ctx->code, prop_decl->name); + if(!class_desc->props[i].name) + return E_OUTOFMEMORY; + + class_desc->props[i].is_public = prop_decl->is_public; + } + class_desc->next = ctx->classes; ctx->classes = class_desc; return S_OK; diff --git a/dlls/vbscript/vbscript.h b/dlls/vbscript/vbscript.h index 26892db..d886a4e 100644 --- a/dlls/vbscript/vbscript.h +++ b/dlls/vbscript/vbscript.h @@ -63,6 +63,11 @@ typedef enum { } vbdisp_invoke_type_t; typedef struct { + BOOL is_public; + const WCHAR *name; +} vbdisp_prop_desc_t; + +typedef struct { const WCHAR *name; BOOL is_public; function_t *entries[VBDISP_ANY]; @@ -73,6 +78,8 @@ typedef struct _class_desc_t { script_ctx_t *ctx; unsigned func_cnt; vbdisp_funcprop_desc_t *funcs; + unsigned prop_cnt; + vbdisp_prop_desc_t *props; struct _class_desc_t *next; } class_desc_t;
1
0
0
0
Jacek Caban : vbscript: Added class property parser implementation.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 117fd7c0e1c0bf52d78f8c7a5409176297480b90 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=117fd7c0e1c0bf52d78f8c7a5…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Sep 16 13:27:11 2011 +0200 vbscript: Added class property parser implementation. --- dlls/vbscript/parse.h | 9 ++++++++- dlls/vbscript/parser.y | 24 ++++++++++++++++++++++++ dlls/vbscript/tests/lang.vbs | 4 ++++ 3 files changed, 36 insertions(+), 1 deletions(-) diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h index 918a6db..63b2ded 100644 --- a/dlls/vbscript/parse.h +++ b/dlls/vbscript/parse.h @@ -142,14 +142,21 @@ typedef struct _function_decl_t { struct _function_decl_t *next; } function_decl_t; -typedef struct _function_statement_t { +typedef struct { statement_t stat; function_decl_t *func_decl; } function_statement_t; +typedef struct _class_prop_decl_t { + BOOL is_public; + const WCHAR *name; + struct _class_prop_decl_t *next; +} class_prop_decl_t; + typedef struct _class_decl_t { const WCHAR *name; function_decl_t *funcs; + class_prop_decl_t *props; struct _class_decl_t *next; } class_decl_t; diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 63423d1..5224c71 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -62,6 +62,7 @@ static arg_decl_t *new_argument_decl(parser_ctx_t*,const WCHAR*,BOOL); static class_decl_t *new_class_decl(parser_ctx_t*); static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*); +static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,unsigned); #define STORAGE_IS_PRIVATE 1 #define STORAGE_IS_DEFAULT 2 @@ -293,6 +294,7 @@ ClassDeclaration ClassBody : /* empty */ { $$ = new_class_decl(ctx); } | FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } + | Storage tIdentifier tNL ClassBody { $$ = add_variant_prop(ctx, $4, $2, $1); CHECK_ERROR; } FunctionDecl : Storage_opt tSUB tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tSUB @@ -628,6 +630,7 @@ static class_decl_t *new_class_decl(parser_ctx_t *ctx) return NULL; class_decl->funcs = NULL; + class_decl->props = NULL; class_decl->next = NULL; return class_decl; } @@ -651,6 +654,27 @@ static class_decl_t *add_class_function(parser_ctx_t *ctx, class_decl_t *class_d return class_decl; } +static class_decl_t *add_variant_prop(parser_ctx_t *ctx, class_decl_t *class_decl, const WCHAR *identifier, unsigned storage_flags) +{ + class_prop_decl_t *prop; + + if(storage_flags & STORAGE_IS_DEFAULT) { + FIXME("variant prop van't be default value\n"); + ctx->hres = E_FAIL; + return NULL; + } + + prop = parser_alloc(ctx, sizeof(*prop)); + if(!prop) + return NULL; + + prop->name = identifier; + prop->is_public = !(storage_flags & STORAGE_IS_PRIVATE); + prop->next = class_decl->props; + class_decl->props = prop; + return class_decl; +} + void *parser_alloc(parser_ctx_t *ctx, size_t size) { void *ret; diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs index 867779d..e23cd86 100644 --- a/dlls/vbscript/tests/lang.vbs +++ b/dlls/vbscript/tests/lang.vbs @@ -390,6 +390,10 @@ Class EmptyClass End Class Class TestClass + Public publicProp + + Private privateProp + Public Function publicFunction() privateSub() publicFunction = 4
1
0
0
0
Piotr Caban : urlmon: Added 111 ordinal stub.
by Alexandre Julliard
16 Sep '11
16 Sep '11
Module: wine Branch: master Commit: 005808cb0e4a75a15820024ea7f83bc2d45aeb32 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=005808cb0e4a75a15820024ea…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Sep 16 11:21:24 2011 +0200 urlmon: Added 111 ordinal stub. --- dlls/urlmon/urlmon.spec | 1 + dlls/urlmon/urlmon_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/dlls/urlmon/urlmon.spec b/dlls/urlmon/urlmon.spec index 41bd263..28af3c5 100644 --- a/dlls/urlmon/urlmon.spec +++ b/dlls/urlmon/urlmon.spec @@ -94,6 +94,7 @@ @ stub WriteHitLogging @ stub ZonesReInit +111 stdcall @(wstr) IsProtectedModeURL 331 stdcall @(ptr long ptr) propsys.InitPropVariantFromBuffer 335 stdcall @(ptr long ptr) propsys.InitVariantFromBuffer 362 stdcall @(ptr ptr) propsys.InitVariantFromGUIDAsString diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c index 01442c1..5ba9c00 100644 --- a/dlls/urlmon/urlmon_main.c +++ b/dlls/urlmon/urlmon_main.c @@ -907,6 +907,16 @@ BOOL WINAPI IsLoggingEnabledW(LPCWSTR url) } /*********************************************************************** + * IsProtectedModeURL (URLMON.111) + * Undocumented, added in IE7 + */ +BOOL WINAPI IsProtectedModeURL(const WCHAR *url) +{ + FIXME("stub: %s\n", debugstr_w(url)); + return TRUE; +} + +/*********************************************************************** * URLMON_410 (URLMON.410) * Undocumented, added in IE8 */
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
100
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Results per page:
10
25
50
100
200