vbscript: Added interp_assign_member implementation.
This commit is contained in:
parent
a822569db2
commit
151056bde2
|
@ -144,6 +144,33 @@ static inline void release_val(variant_val_t *v)
|
|||
VariantClear(v->v);
|
||||
}
|
||||
|
||||
static HRESULT stack_pop_disp(exec_ctx_t *ctx, IDispatch **ret)
|
||||
{
|
||||
VARIANT *v = stack_pop(ctx);
|
||||
|
||||
if(V_VT(v) == VT_DISPATCH) {
|
||||
*ret = V_DISPATCH(v);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if(V_VT(v) != (VT_VARIANT|VT_BYREF)) {
|
||||
FIXME("not supported type: %s\n", debugstr_variant(v));
|
||||
VariantClear(v);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
v = V_BYREF(v);
|
||||
if(V_VT(v) != VT_DISPATCH) {
|
||||
FIXME("not disp %s\n", debugstr_variant(v));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(V_DISPATCH(v))
|
||||
IDispatch_AddRef(V_DISPATCH(v));
|
||||
*ret = V_DISPATCH(v);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void vbstack_to_dp(exec_ctx_t *ctx, unsigned arg_cnt, DISPPARAMS *dp)
|
||||
{
|
||||
dp->cArgs = arg_cnt;
|
||||
|
@ -259,8 +286,36 @@ static HRESULT interp_assign_ident(exec_ctx_t *ctx)
|
|||
|
||||
static HRESULT interp_assign_member(exec_ctx_t *ctx)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
BSTR identifier = ctx->instr->arg1.bstr;
|
||||
variant_val_t val;
|
||||
IDispatch *obj;
|
||||
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_val(ctx, &val);
|
||||
if(FAILED(hres)) {
|
||||
IDispatch_Release(obj);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = disp_get_id(obj, identifier, &id);
|
||||
if(SUCCEEDED(hres))
|
||||
hres = disp_propput(ctx->script, obj, id, val.v);
|
||||
|
||||
release_val(&val);
|
||||
IDispatch_Release(obj);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT interp_ret(exec_ctx_t *ctx)
|
||||
|
|
|
@ -158,6 +158,8 @@ HRESULT exec_script(script_ctx_t*,function_t*) DECLSPEC_HIDDEN;
|
|||
|
||||
HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
|
||||
|
||||
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline void *heap_alloc(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
|
|
|
@ -31,6 +31,38 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
|||
|
||||
static HINSTANCE vbscript_hinstance;
|
||||
|
||||
const char *debugstr_variant(const VARIANT *v)
|
||||
{
|
||||
if(!v)
|
||||
return "(null)";
|
||||
|
||||
if(V_ISBYREF(v))
|
||||
return wine_dbg_sprintf("{V_BYREF -> %s}", debugstr_variant(V_BYREF(v)));
|
||||
|
||||
switch(V_VT(v)) {
|
||||
case VT_EMPTY:
|
||||
return "{VT_EMPTY}";
|
||||
case VT_NULL:
|
||||
return "{VT_NULL}";
|
||||
case VT_I2:
|
||||
return wine_dbg_sprintf("{VT_I2: %d}", V_I2(v));
|
||||
case VT_I4:
|
||||
return wine_dbg_sprintf("{VT_I4: %d}", V_I4(v));
|
||||
case VT_UI4:
|
||||
return wine_dbg_sprintf("{VT_UI4: %u}", V_UI4(v));
|
||||
case VT_R8:
|
||||
return wine_dbg_sprintf("{VT_R8: %lf}", V_R8(v));
|
||||
case VT_BSTR:
|
||||
return wine_dbg_sprintf("{VT_BSTR: %s}", debugstr_w(V_BSTR(v)));
|
||||
case VT_DISPATCH:
|
||||
return wine_dbg_sprintf("{VT_DISPATCH: %p}", V_DISPATCH(v));
|
||||
case VT_BOOL:
|
||||
return wine_dbg_sprintf("{VT_BOOL: %x}", V_BOOL(v));
|
||||
default:
|
||||
return wine_dbg_sprintf("{vt %d}", V_VT(v));
|
||||
}
|
||||
}
|
||||
|
||||
#define MIN_BLOCK_SIZE 128
|
||||
|
||||
static inline DWORD block_size(DWORD block)
|
||||
|
|
Loading…
Reference in New Issue