mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:15:41 +00:00
[VBSCRIPT]
* Sync with Wine 1.7.27. CORE-8540 svn path=/trunk/; revision=64608
This commit is contained in:
parent
1b1cd5f38d
commit
0b53a29c3a
10 changed files with 1695 additions and 1682 deletions
|
@ -1649,11 +1649,10 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl)
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
class_desc->props[i].is_public = prop_decl->is_public;
|
||||
class_desc->props[i].is_array = prop_decl->is_array;
|
||||
|
||||
if(prop_decl->is_array) {
|
||||
class_desc->props[i].is_array = TRUE;
|
||||
if(prop_decl->is_array)
|
||||
class_desc->array_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if(class_desc->array_cnt) {
|
||||
|
|
|
@ -85,6 +85,15 @@ static HRESULT return_bstr(VARIANT *res, BSTR str)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT return_bool(VARIANT *res, BOOL val)
|
||||
{
|
||||
if(res) {
|
||||
V_VT(res) = VT_BOOL;
|
||||
V_BOOL(res) = val ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT return_short(VARIANT *res, short val)
|
||||
{
|
||||
if(res) {
|
||||
|
@ -108,16 +117,6 @@ static HRESULT return_int(VARIANT *res, int val)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT return_bool(VARIANT *res, int val)
|
||||
{
|
||||
if(res) {
|
||||
V_VT(res) = VT_BOOL;
|
||||
V_BOOL(res) = val != 0 ? VARIANT_TRUE : VARIANT_FALSE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline HRESULT return_double(VARIANT *res, double val)
|
||||
{
|
||||
if(res) {
|
||||
|
@ -146,75 +145,29 @@ static inline HRESULT return_date(VARIANT *res, double date)
|
|||
|
||||
HRESULT to_int(VARIANT *v, int *ret)
|
||||
{
|
||||
if(V_VT(v) == (VT_BYREF|VT_VARIANT))
|
||||
v = V_VARIANTREF(v);
|
||||
VARIANT r;
|
||||
HRESULT hres;
|
||||
|
||||
switch(V_VT(v)) {
|
||||
case VT_I2:
|
||||
*ret = V_I2(v);
|
||||
break;
|
||||
case VT_I4:
|
||||
*ret = V_I4(v);
|
||||
break;
|
||||
case VT_R8: {
|
||||
double n = floor(V_R8(v)+0.5);
|
||||
INT32 i;
|
||||
|
||||
if(!is_int32(n)) {
|
||||
FIXME("%lf is out of int range\n", n);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Round half to even */
|
||||
i = n;
|
||||
if(i%2 && n-V_R8(v) == 0.5)
|
||||
i--;
|
||||
|
||||
*ret = i;
|
||||
break;
|
||||
}
|
||||
case VT_BOOL:
|
||||
*ret = V_BOOL(v) ? -1 : 0;
|
||||
break;
|
||||
default:
|
||||
FIXME("not supported %s\n", debugstr_variant(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
V_VT(&r) = VT_EMPTY;
|
||||
hres = VariantChangeType(&r, v, 0, VT_I4);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*ret = V_I4(&r);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT to_double(VARIANT *v, double *ret)
|
||||
{
|
||||
switch(V_VT(v)) {
|
||||
case VT_I2:
|
||||
*ret = V_I2(v);
|
||||
break;
|
||||
case VT_I4:
|
||||
*ret = V_I4(v);
|
||||
break;
|
||||
case VT_R4:
|
||||
*ret = V_R4(v);
|
||||
break;
|
||||
case VT_R8:
|
||||
*ret = V_R8(v);
|
||||
break;
|
||||
case VT_BSTR: {
|
||||
VARIANT dst;
|
||||
HRESULT hres;
|
||||
VARIANT dst;
|
||||
HRESULT hres;
|
||||
|
||||
V_VT(&dst) = VT_EMPTY;
|
||||
hres = VariantChangeType(&dst, v, VARIANT_LOCALBOOL, VT_R8);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
*ret = V_R8(&dst);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
FIXME("arg %s not supported\n", debugstr_variant(v));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
V_VT(&dst) = VT_EMPTY;
|
||||
hres = VariantChangeType(&dst, v, 0, VT_R8);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*ret = V_R8(&dst);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -323,14 +276,15 @@ static IUnknown *create_object(script_ctx_t *ctx, const WCHAR *progid)
|
|||
return obj;
|
||||
}
|
||||
|
||||
static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, VARIANT *res)
|
||||
static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, unsigned type, BSTR orig_title, VARIANT *res)
|
||||
{
|
||||
SCRIPTUICHANDLING uic_handling = SCRIPTUICHANDLING_ALLOW;
|
||||
IActiveScriptSiteUIControl *ui_control;
|
||||
IActiveScriptSiteWindow *acts_window;
|
||||
WCHAR *title_buf = NULL;
|
||||
const WCHAR *title;
|
||||
HWND hwnd = NULL;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IActiveScriptSiteUIControl, (void**)&ui_control);
|
||||
|
@ -351,23 +305,43 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, VARIANT *res)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
title = (ctx->safeopt & INTERFACE_USES_SECURITY_MANAGER) ? vbscriptW : emptyW;
|
||||
|
||||
hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IActiveScriptSiteWindow, (void**)&acts_window);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("No IActiveScriptSiteWindow\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(ctx->safeopt & INTERFACE_USES_SECURITY_MANAGER) {
|
||||
if(orig_title && *orig_title) {
|
||||
WCHAR *ptr;
|
||||
|
||||
title = title_buf = heap_alloc(sizeof(vbscriptW) + (strlenW(orig_title)+2)*sizeof(WCHAR));
|
||||
if(!title)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
memcpy(title_buf, vbscriptW, sizeof(vbscriptW));
|
||||
ptr = title_buf + sizeof(vbscriptW)/sizeof(WCHAR)-1;
|
||||
|
||||
*ptr++ = ':';
|
||||
*ptr++ = ' ';
|
||||
strcpyW(ptr, orig_title);
|
||||
}else {
|
||||
title = vbscriptW;
|
||||
}
|
||||
}else {
|
||||
title = orig_title ? orig_title : emptyW;
|
||||
}
|
||||
|
||||
hres = IActiveScriptSiteWindow_GetWindow(acts_window, &hwnd);
|
||||
if(SUCCEEDED(hres)) {
|
||||
hres = IActiveScriptSiteWindow_EnableModeless(acts_window, FALSE);
|
||||
if(SUCCEEDED(hres)) {
|
||||
ret = MessageBoxW(hwnd, prompt, title, MB_OK);
|
||||
ret = MessageBoxW(hwnd, prompt, title, type);
|
||||
hres = IActiveScriptSiteWindow_EnableModeless(acts_window, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
heap_free(title_buf);
|
||||
IActiveScriptSiteWindow_Release(acts_window);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("failed: %08x\n", hres);
|
||||
|
@ -379,64 +353,111 @@ static HRESULT show_msgbox(script_ctx_t *ctx, BSTR prompt, VARIANT *res)
|
|||
|
||||
static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
int val;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = to_int(arg, &val);
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, 0, VT_CY);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_int(res, val);
|
||||
if(!res) {
|
||||
VariantClear(&v);
|
||||
return DISP_E_BADVARTYPE;
|
||||
}
|
||||
|
||||
*res = v;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
static HRESULT Global_CInt(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
int val;
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
switch(V_VT(arg)) {
|
||||
case VT_I2:
|
||||
val = V_I2(arg);
|
||||
break;
|
||||
case VT_I4:
|
||||
val = V_I4(arg);
|
||||
break;
|
||||
case VT_R4:
|
||||
val = V_R4(arg) > 0.0 || V_R4(arg) < 0.0;
|
||||
break;
|
||||
case VT_R8:
|
||||
val = V_R8(arg) > 0.0 || V_R8(arg) < 0.0;
|
||||
break;
|
||||
default:
|
||||
ERR("Not a numeric value: %s\n", debugstr_variant(arg));
|
||||
return E_FAIL;
|
||||
}
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, 0, VT_I2);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_bool(res, val);
|
||||
if(!res)
|
||||
return DISP_E_BADVARTYPE;
|
||||
else {
|
||||
*res = v;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
int i;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = to_int(arg, &i);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
if(!res)
|
||||
return DISP_E_BADVARTYPE;
|
||||
|
||||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = i;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, VARIANT_LOCALBOOL, VT_BOOL);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(res)
|
||||
*res = v;
|
||||
else
|
||||
VariantClear(&v);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, VARIANT_LOCALBOOL, VT_UI1);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!res) {
|
||||
VariantClear(&v);
|
||||
return DISP_E_BADVARTYPE;
|
||||
}
|
||||
|
||||
*res = v;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_CDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -447,14 +468,45 @@ static HRESULT Global_CDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VAR
|
|||
|
||||
static HRESULT Global_CDbl(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, 0, VT_R8);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!res)
|
||||
return DISP_E_BADVARTYPE;
|
||||
else {
|
||||
*res = v;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT Global_CSng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = VariantChangeType(&v, arg, 0, VT_R4);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(!res)
|
||||
return DISP_E_BADVARTYPE;
|
||||
|
||||
*res = v;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_CStr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -526,8 +578,16 @@ static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
|
|||
|
||||
static HRESULT Global_VarType(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
if(V_VT(arg) & ~VT_TYPEMASK) {
|
||||
FIXME("not supported %s\n", debugstr_variant(arg));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
return return_short(res, V_VT(arg));
|
||||
}
|
||||
|
||||
static HRESULT Global_IsDate(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -564,8 +624,16 @@ static HRESULT Global_IsNull(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
|
|||
|
||||
static HRESULT Global_IsNumeric(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
|
||||
return return_bool(res, SUCCEEDED(hres));
|
||||
}
|
||||
|
||||
static HRESULT Global_IsArray(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -587,46 +655,94 @@ static HRESULT Global_IsObject(vbdisp_t *This, VARIANT *arg, unsigned args_cnt,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_Ant(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_double(res, atan(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_double(res, cos(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_double(res, sin(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_double(res, tan(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
return return_double(res, exp(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(d <= 0)
|
||||
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
|
||||
else
|
||||
return return_double(res, log(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
double d;
|
||||
|
||||
hres = to_double(arg, &d);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(d < 0)
|
||||
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
|
||||
else
|
||||
return return_double(res, sqrt(d));
|
||||
}
|
||||
|
||||
static HRESULT Global_Randomize(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -1123,9 +1239,15 @@ static HRESULT Global_Asc(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* The function supports only single-byte and double-byte character sets. It
|
||||
* ignores language specified by IActiveScriptSite::GetLCID. The argument needs
|
||||
* to be in range of short or unsigned short. */
|
||||
static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
int c;
|
||||
int cp, c, len = 0;
|
||||
CPINFO cpi;
|
||||
WCHAR ch;
|
||||
char buf[2];
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
@ -1134,14 +1256,26 @@ static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(c < 0 || c >= 0x100) {
|
||||
FIXME("invalid arg\n");
|
||||
cp = GetACP();
|
||||
if(!GetCPInfo(cp, &cpi))
|
||||
cpi.MaxCharSize = 1;
|
||||
|
||||
if((c!=(short)c && c!=(unsigned short)c) ||
|
||||
(unsigned short)c>=(cpi.MaxCharSize>1 ? 0x10000 : 0x100)) {
|
||||
WARN("invalid arg %d\n", c);
|
||||
return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
|
||||
}
|
||||
|
||||
if(c>>8)
|
||||
buf[len++] = c>>8;
|
||||
if(!len || IsDBCSLeadByteEx(cp, buf[0]))
|
||||
buf[len++] = c;
|
||||
if(!MultiByteToWideChar(0, 0, buf, len, &ch, 1)) {
|
||||
WARN("invalid arg %d, cp %d\n", c, cp);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(res) {
|
||||
WCHAR ch = c;
|
||||
|
||||
V_VT(res) = VT_BSTR;
|
||||
V_BSTR(res) = SysAllocStringLen(&ch, 1);
|
||||
if(!V_BSTR(res))
|
||||
|
@ -1164,26 +1298,86 @@ static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
|
|||
|
||||
static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
VARIANT dst;
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = VarAbs(arg, &dst);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if (res)
|
||||
*res = dst;
|
||||
else
|
||||
VariantClear(&dst);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
VARIANT dst;
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = VarFix(arg, &dst);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if (res)
|
||||
*res = dst;
|
||||
else
|
||||
VariantClear(&dst);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
HRESULT hres;
|
||||
VARIANT dst;
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
hres = VarInt(arg, &dst);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if (res)
|
||||
*res = dst;
|
||||
else
|
||||
VariantClear(&dst);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
double v;
|
||||
short val;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
if(V_VT(arg) == VT_NULL)
|
||||
return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
|
||||
|
||||
hres = to_double(arg, &v);
|
||||
if (FAILED(hres))
|
||||
return hres;
|
||||
|
||||
val = v == 0 ? 0 : (v > 0 ? 1 : -1);
|
||||
return return_short(res, val);
|
||||
}
|
||||
|
||||
static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -1200,14 +1394,38 @@ static HRESULT Global_Now(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
|
|||
|
||||
static HRESULT Global_Date(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
SYSTEMTIME lt;
|
||||
UDATE ud;
|
||||
DATE date;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
GetLocalTime(<);
|
||||
ud.st = lt;
|
||||
ud.wDayOfYear = 0;
|
||||
hres = VarDateFromUdateEx(&ud, 0, VAR_DATEVALUEONLY, &date);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
return return_date(res, date);
|
||||
}
|
||||
|
||||
static HRESULT Global_Time(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
SYSTEMTIME lt;
|
||||
UDATE ud;
|
||||
DATE time;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
GetLocalTime(<);
|
||||
ud.st = lt;
|
||||
ud.wDayOfYear = 0;
|
||||
hres = VarDateFromUdateEx(&ud, 0, VAR_TIMEVALUEONLY, &time);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
return return_date(res, time);
|
||||
}
|
||||
|
||||
static HRESULT Global_Day(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -1284,22 +1502,34 @@ static HRESULT Global_InputBox(vbdisp_t *This, VARIANT *arg, unsigned args_cnt,
|
|||
|
||||
static HRESULT Global_MsgBox(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
BSTR prompt;
|
||||
BSTR prompt, title = NULL;
|
||||
int type = MB_OK;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if(args_cnt != 1) {
|
||||
FIXME("unsupported arg_cnt %d\n", args_cnt);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
assert(1 <= args_cnt && args_cnt <= 5);
|
||||
|
||||
hres = to_string(args, &prompt);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = show_msgbox(This->desc->ctx, prompt, res);
|
||||
if(args_cnt > 1)
|
||||
hres = to_int(args+1, &type);
|
||||
|
||||
if(SUCCEEDED(hres) && args_cnt > 2)
|
||||
hres = to_string(args+2, &title);
|
||||
|
||||
if(SUCCEEDED(hres) && args_cnt > 3) {
|
||||
FIXME("unsupported arg_cnt %d\n", args_cnt);
|
||||
hres = E_NOTIMPL;
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hres))
|
||||
hres = show_msgbox(This->desc->ctx, prompt, type, title, res);
|
||||
|
||||
SysFreeString(prompt);
|
||||
SysFreeString(title);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -1408,8 +1638,52 @@ static HRESULT Global_DatePart(vbdisp_t *This, VARIANT *arg, unsigned args_cnt,
|
|||
|
||||
static HRESULT Global_TypeName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR ByteW[] = {'B', 'y', 't', 'e', 0};
|
||||
static const WCHAR IntegerW[] = {'I', 'n', 't', 'e', 'g', 'e', 'r', 0};
|
||||
static const WCHAR LongW[] = {'L', 'o', 'n', 'g', 0};
|
||||
static const WCHAR SingleW[] = {'S', 'i', 'n', 'g', 'l', 'e', 0};
|
||||
static const WCHAR DoubleW[] = {'D', 'o', 'u', 'b', 'l', 'e', 0};
|
||||
static const WCHAR CurrencyW[] = {'C', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 0};
|
||||
static const WCHAR DecimalW[] = {'D', 'e', 'c', 'i', 'm', 'a', 'l', 0};
|
||||
static const WCHAR DateW[] = {'D', 'a', 't', 'e', 0};
|
||||
static const WCHAR StringW[] = {'S', 't', 'r', 'i', 'n', 'g', 0};
|
||||
static const WCHAR BooleanW[] = {'B', 'o', 'o', 'l', 'e', 'a', 'n', 0};
|
||||
static const WCHAR EmptyW[] = {'E', 'm', 'p', 't', 'y', 0};
|
||||
static const WCHAR NullW[] = {'N', 'u', 'l', 'l', 0};
|
||||
|
||||
TRACE("(%s)\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 1);
|
||||
|
||||
switch(V_VT(arg)) {
|
||||
case VT_UI1:
|
||||
return return_string(res, ByteW);
|
||||
case VT_I2:
|
||||
return return_string(res, IntegerW);
|
||||
case VT_I4:
|
||||
return return_string(res, LongW);
|
||||
case VT_R4:
|
||||
return return_string(res, SingleW);
|
||||
case VT_R8:
|
||||
return return_string(res, DoubleW);
|
||||
case VT_CY:
|
||||
return return_string(res, CurrencyW);
|
||||
case VT_DECIMAL:
|
||||
return return_string(res, DecimalW);
|
||||
case VT_DATE:
|
||||
return return_string(res, DateW);
|
||||
case VT_BSTR:
|
||||
return return_string(res, StringW);
|
||||
case VT_BOOL:
|
||||
return return_string(res, BooleanW);
|
||||
case VT_EMPTY:
|
||||
return return_string(res, EmptyW);
|
||||
case VT_NULL:
|
||||
return return_string(res, NullW);
|
||||
default:
|
||||
FIXME("arg %s not supported\n", debugstr_variant(arg));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT Global_Array(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -1485,26 +1759,53 @@ static HRESULT Global_LoadPicture(vbdisp_t *This, VARIANT *arg, unsigned args_cn
|
|||
|
||||
static HRESULT Global_ScriptEngine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 0);
|
||||
|
||||
return return_string(res, vbscriptW);
|
||||
}
|
||||
|
||||
static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 0);
|
||||
|
||||
if(res) {
|
||||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = VBSCRIPT_MAJOR_VERSION;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 0);
|
||||
|
||||
if(res) {
|
||||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = VBSCRIPT_MINOR_VERSION;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("%s\n", debugstr_variant(arg));
|
||||
|
||||
assert(args_cnt == 0);
|
||||
|
||||
if(res) {
|
||||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = VBSCRIPT_BUILD_VERSION;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Global_FormatNumber(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
|
@ -1765,7 +2066,7 @@ static const builtin_prop_t global_props[] = {
|
|||
{DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1},
|
||||
{DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1},
|
||||
{DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1},
|
||||
{DISPID_GLOBAL_ATN, Global_Ant, 0, 1},
|
||||
{DISPID_GLOBAL_ATN, Global_Atn, 0, 1},
|
||||
{DISPID_GLOBAL_COS, Global_Cos, 0, 1},
|
||||
{DISPID_GLOBAL_SIN, Global_Sin, 0, 1},
|
||||
{DISPID_GLOBAL_TAN, Global_Tan, 0, 1},
|
||||
|
|
|
@ -555,7 +555,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
|
|||
v = V_VT(ref.u.v) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(ref.u.v) : ref.u.v;
|
||||
|
||||
if(arg_cnt) {
|
||||
SAFEARRAY *array;
|
||||
SAFEARRAY *array = NULL;
|
||||
|
||||
switch(V_VT(v)) {
|
||||
case VT_ARRAY|VT_BYREF|VT_VARIANT:
|
||||
|
@ -564,11 +564,20 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
|
|||
case VT_ARRAY|VT_VARIANT:
|
||||
array = V_ARRAY(ref.u.v);
|
||||
break;
|
||||
case VT_DISPATCH:
|
||||
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
|
||||
hres = disp_call(ctx->script, V_DISPATCH(v), DISPID_VALUE, &dp, res);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
break;
|
||||
default:
|
||||
FIXME("arguments not implemented\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if(!array)
|
||||
break;
|
||||
|
||||
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
|
||||
hres = array_access(ctx, array, &dp, &v);
|
||||
if(FAILED(hres))
|
||||
|
@ -1270,6 +1279,7 @@ static HRESULT interp_errmode(exec_ctx_t *ctx)
|
|||
TRACE("%d\n", err_mode);
|
||||
|
||||
ctx->resume_next = err_mode;
|
||||
ctx->script->err_number = S_OK;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include "vbscript.h"
|
||||
#include "parser.tab.h"
|
||||
|
||||
#include <wine/config.h>
|
||||
#include <wine/port.h>
|
||||
|
||||
static const WCHAR andW[] = {'a','n','d',0};
|
||||
static const WCHAR byrefW[] = {'b','y','r','e','f',0};
|
||||
static const WCHAR byvalW[] = {'b','y','v','a','l',0};
|
||||
|
@ -251,28 +254,91 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret)
|
|||
|
||||
static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
|
||||
{
|
||||
double n = 0;
|
||||
BOOL use_int = TRUE;
|
||||
LONGLONG d = 0, hlp;
|
||||
int exp = 0;
|
||||
double r;
|
||||
|
||||
if(*ctx->ptr == '0' && !('0' <= ctx->ptr[1] && ctx->ptr[1] <= '9') && ctx->ptr[1] != '.')
|
||||
return *ctx->ptr++;
|
||||
|
||||
do {
|
||||
n = n*10 + *ctx->ptr++ - '0';
|
||||
}while('0' <= *ctx->ptr && *ctx->ptr <= '9');
|
||||
|
||||
if(*ctx->ptr != '.') {
|
||||
if((LONG)n == n) {
|
||||
LONG l = n;
|
||||
*(LONG*)ret = l;
|
||||
return (short)l == l ? tShort : tLong;
|
||||
while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
|
||||
hlp = d*10 + *(ctx->ptr++) - '0';
|
||||
if(d>MAXLONGLONG/10 || hlp<0) {
|
||||
exp++;
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
double e = 1.0;
|
||||
while('0' <= *++ctx->ptr && *ctx->ptr <= '9')
|
||||
n += (e /= 10.0)*(*ctx->ptr-'0');
|
||||
else
|
||||
d = hlp;
|
||||
}
|
||||
while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
|
||||
exp++;
|
||||
ctx->ptr++;
|
||||
}
|
||||
|
||||
*(double*)ret = n;
|
||||
if(*ctx->ptr == '.') {
|
||||
use_int = FALSE;
|
||||
ctx->ptr++;
|
||||
|
||||
while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr)) {
|
||||
hlp = d*10 + *(ctx->ptr++) - '0';
|
||||
if(d>MAXLONGLONG/10 || hlp<0)
|
||||
break;
|
||||
|
||||
d = hlp;
|
||||
exp--;
|
||||
}
|
||||
while(ctx->ptr < ctx->end && isdigitW(*ctx->ptr))
|
||||
ctx->ptr++;
|
||||
}
|
||||
|
||||
if(*ctx->ptr == 'e' || *ctx->ptr == 'E') {
|
||||
int e = 0, sign = 1;
|
||||
|
||||
if(*++ctx->ptr == '-') {
|
||||
ctx->ptr++;
|
||||
sign = -1;
|
||||
}
|
||||
|
||||
if(!isdigitW(*ctx->ptr)) {
|
||||
FIXME("Invalid numeric literal\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
use_int = FALSE;
|
||||
|
||||
do {
|
||||
e = e*10 + *(ctx->ptr++) - '0';
|
||||
if(sign == -1 && -e+exp < -(INT_MAX/100)) {
|
||||
/* The literal will be rounded to 0 anyway. */
|
||||
while(isdigitW(*ctx->ptr))
|
||||
ctx->ptr++;
|
||||
*(double*)ret = 0;
|
||||
return tDouble;
|
||||
}
|
||||
|
||||
if(sign*e + exp > INT_MAX/100) {
|
||||
FIXME("Invalid numeric literal\n");
|
||||
return 0;
|
||||
}
|
||||
} while(isdigitW(*ctx->ptr));
|
||||
|
||||
exp += sign*e;
|
||||
}
|
||||
|
||||
if(use_int && (LONG)d == d) {
|
||||
LONG l = d;
|
||||
*(LONG*)ret = l;
|
||||
return (short)l == l ? tShort : tLong;
|
||||
}
|
||||
|
||||
r = exp>=0 ? d*pow(10, exp) : d/pow(10, -exp);
|
||||
if(isinf(r)) {
|
||||
FIXME("Invalid numeric literal\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
*(double*)ret = r;
|
||||
return tDouble;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,19 +1,19 @@
|
|||
/* A Bison parser, made by GNU Bison 2.5. */
|
||||
/* A Bison parser, made by GNU Bison 3.0.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
@ -26,96 +26,102 @@
|
|||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
tEOF = 258,
|
||||
tNL = 259,
|
||||
tREM = 260,
|
||||
tEMPTYBRACKETS = 261,
|
||||
tTRUE = 262,
|
||||
tFALSE = 263,
|
||||
tNOT = 264,
|
||||
tAND = 265,
|
||||
tOR = 266,
|
||||
tXOR = 267,
|
||||
tEQV = 268,
|
||||
tIMP = 269,
|
||||
tNEQ = 270,
|
||||
tIS = 271,
|
||||
tLTEQ = 272,
|
||||
tGTEQ = 273,
|
||||
tMOD = 274,
|
||||
tCALL = 275,
|
||||
tDIM = 276,
|
||||
tSUB = 277,
|
||||
tFUNCTION = 278,
|
||||
tPROPERTY = 279,
|
||||
tGET = 280,
|
||||
tLET = 281,
|
||||
tCONST = 282,
|
||||
tIF = 283,
|
||||
tELSE = 284,
|
||||
tELSEIF = 285,
|
||||
tEND = 286,
|
||||
tTHEN = 287,
|
||||
tEXIT = 288,
|
||||
tWHILE = 289,
|
||||
tWEND = 290,
|
||||
tDO = 291,
|
||||
tLOOP = 292,
|
||||
tUNTIL = 293,
|
||||
tFOR = 294,
|
||||
tTO = 295,
|
||||
tSTEP = 296,
|
||||
tEACH = 297,
|
||||
tIN = 298,
|
||||
tSELECT = 299,
|
||||
tCASE = 300,
|
||||
tBYREF = 301,
|
||||
tBYVAL = 302,
|
||||
tOPTION = 303,
|
||||
tEXPLICIT = 304,
|
||||
tSTOP = 305,
|
||||
tNOTHING = 306,
|
||||
tEMPTY = 307,
|
||||
tNULL = 308,
|
||||
tCLASS = 309,
|
||||
tSET = 310,
|
||||
tNEW = 311,
|
||||
tPUBLIC = 312,
|
||||
tPRIVATE = 313,
|
||||
tDEFAULT = 314,
|
||||
tME = 315,
|
||||
tERROR = 316,
|
||||
tNEXT = 317,
|
||||
tON = 318,
|
||||
tRESUME = 319,
|
||||
tGOTO = 320,
|
||||
tIdentifier = 321,
|
||||
tString = 322,
|
||||
tLong = 323,
|
||||
tShort = 324,
|
||||
tDouble = 325
|
||||
};
|
||||
#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
|
||||
# define YY_PARSER_PARSER_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int parser_debug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
tEOF = 258,
|
||||
tNL = 259,
|
||||
tREM = 260,
|
||||
tEMPTYBRACKETS = 261,
|
||||
tTRUE = 262,
|
||||
tFALSE = 263,
|
||||
tNOT = 264,
|
||||
tAND = 265,
|
||||
tOR = 266,
|
||||
tXOR = 267,
|
||||
tEQV = 268,
|
||||
tIMP = 269,
|
||||
tNEQ = 270,
|
||||
tIS = 271,
|
||||
tLTEQ = 272,
|
||||
tGTEQ = 273,
|
||||
tMOD = 274,
|
||||
tCALL = 275,
|
||||
tDIM = 276,
|
||||
tSUB = 277,
|
||||
tFUNCTION = 278,
|
||||
tPROPERTY = 279,
|
||||
tGET = 280,
|
||||
tLET = 281,
|
||||
tCONST = 282,
|
||||
tIF = 283,
|
||||
tELSE = 284,
|
||||
tELSEIF = 285,
|
||||
tEND = 286,
|
||||
tTHEN = 287,
|
||||
tEXIT = 288,
|
||||
tWHILE = 289,
|
||||
tWEND = 290,
|
||||
tDO = 291,
|
||||
tLOOP = 292,
|
||||
tUNTIL = 293,
|
||||
tFOR = 294,
|
||||
tTO = 295,
|
||||
tSTEP = 296,
|
||||
tEACH = 297,
|
||||
tIN = 298,
|
||||
tSELECT = 299,
|
||||
tCASE = 300,
|
||||
tBYREF = 301,
|
||||
tBYVAL = 302,
|
||||
tOPTION = 303,
|
||||
tEXPLICIT = 304,
|
||||
tSTOP = 305,
|
||||
tNOTHING = 306,
|
||||
tEMPTY = 307,
|
||||
tNULL = 308,
|
||||
tCLASS = 309,
|
||||
tSET = 310,
|
||||
tNEW = 311,
|
||||
tPUBLIC = 312,
|
||||
tPRIVATE = 313,
|
||||
tDEFAULT = 314,
|
||||
tME = 315,
|
||||
tERROR = 316,
|
||||
tNEXT = 317,
|
||||
tON = 318,
|
||||
tRESUME = 319,
|
||||
tGOTO = 320,
|
||||
tIdentifier = 321,
|
||||
tString = 322,
|
||||
tLong = 323,
|
||||
tShort = 324,
|
||||
tDouble = 325
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 88 "parser.y"
|
||||
#line 88 "parser.y" /* yacc.c:1909 */
|
||||
|
||||
const WCHAR *string;
|
||||
statement_t *statement;
|
||||
|
@ -131,19 +137,17 @@ typedef union YYSTYPE
|
|||
case_clausule_t *case_clausule;
|
||||
unsigned uint;
|
||||
LONG lng;
|
||||
BOOL bool;
|
||||
BOOL boolean;
|
||||
double dbl;
|
||||
|
||||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 141 "parser.tab.h"
|
||||
} YYSTYPE;
|
||||
#line 144 "parser.tab.h" /* yacc.c:1909 */
|
||||
};
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int parser_parse (parser_ctx_t *ctx);
|
||||
|
||||
#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */
|
||||
|
|
|
@ -100,7 +100,7 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0};
|
|||
case_clausule_t *case_clausule;
|
||||
unsigned uint;
|
||||
LONG lng;
|
||||
BOOL bool;
|
||||
BOOL boolean;
|
||||
double dbl;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ static const WCHAR propertyW[] = {'p','r','o','p','e','r','t','y',0};
|
|||
%type <expression> ConstExpression NumericLiteralExpression
|
||||
%type <member> MemberExpression
|
||||
%type <expression> Arguments_opt ArgumentList_opt Step_opt ExpressionList
|
||||
%type <bool> OptionExplicit_opt DoType
|
||||
%type <boolean> OptionExplicit_opt DoType
|
||||
%type <arg_decl> ArgumentsDecl_opt ArgumentDeclList ArgumentDecl
|
||||
%type <func_decl> FunctionDecl PropertyDecl
|
||||
%type <elseif> ElseIfs_opt ElseIfs ElseIf
|
||||
|
@ -403,8 +403,8 @@ ClassBody
|
|||
| 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 tGET tIdentifier ArgumentsDecl_opt tNL StatementsNl_opt tEND tPROPERTY
|
||||
{ $$ = new_function_decl(ctx, $4, FUNC_PROPGET, $1, $5, $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
|
||||
|
|
|
@ -334,12 +334,14 @@ static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
|||
|
||||
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
vbdisp_t *This = impl_from_IDispatchEx(iface);
|
||||
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||
|
||||
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
||||
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
return E_NOTIMPL;
|
||||
|
||||
return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, NULL);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
||||
|
@ -383,6 +385,15 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
|
|||
function_t *func;
|
||||
|
||||
switch(wFlags) {
|
||||
case DISPATCH_PROPERTYGET:
|
||||
func = This->desc->funcs[id].entries[VBDISP_CALLGET];
|
||||
if(!func || (func->type != FUNC_PROPGET && func->type != FUNC_DEFGET)) {
|
||||
WARN("no getter\n");
|
||||
return DISP_E_MEMBERNOTFOUND;
|
||||
}
|
||||
|
||||
return exec_script(This->desc->ctx, func, This, pdp, pvarRes);
|
||||
|
||||
case DISPATCH_METHOD:
|
||||
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
|
||||
func = This->desc->funcs[id].entries[VBDISP_CALLGET];
|
||||
|
|
|
@ -417,6 +417,7 @@ HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
|
|||
#define VBSE_PERMISSION_DENIED 70
|
||||
#define VBSE_PATH_FILE_ACCESS 75
|
||||
#define VBSE_PATH_NOT_FOUND 76
|
||||
#define VBSE_ILLEGAL_NULL_USE 94
|
||||
#define VBSE_OLE_NOT_SUPPORTED 430
|
||||
#define VBSE_OLE_NO_PROP_OR_METHOD 438
|
||||
#define VBSE_ACTION_NOT_SUPPORTED 445
|
||||
|
@ -436,8 +437,6 @@ HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
|
|||
HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
|
||||
const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline void *heap_alloc(size_t len)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||
|
@ -474,6 +473,10 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define VBSCRIPT_BUILD_VERSION 16978
|
||||
#define VBSCRIPT_MAJOR_VERSION 5
|
||||
#define VBSCRIPT_MINOR_VERSION 8
|
||||
|
||||
#include "parse.h"
|
||||
#include "regexp.h"
|
||||
#include "vbscript_defs.h"
|
||||
|
|
|
@ -203,7 +203,7 @@ reactos/dll/win32/url # Synced to Wine-1.7.17
|
|||
reactos/dll/win32/urlmon # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/usp10 # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/uxtheme # Forked
|
||||
reactos/dll/win32/vbscript # Synced to Wine-1.7.17
|
||||
reactos/dll/win32/vbscript # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/version # Synced to Wine-1.7.17
|
||||
reactos/dll/win32/wbemdisp # Synced to Wine-1.7.17
|
||||
reactos/dll/win32/wbemprox # Synced to Wine-1.7.17
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue