vbscipt: Added string constants.
This commit is contained in:
parent
b58dadf03b
commit
5f3c38ed61
|
@ -1609,59 +1609,15 @@ static HRESULT Global_GetRef(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VA
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbCr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbCrLf(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbNewLine(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbFormFeed(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbLf(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbNullChar(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbNullString(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbTab(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT Global_vbVerticalTab(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
static const string_constant_t vbCr = {1, {'\r'}};
|
||||
static const string_constant_t vbCrLf = {2, {'\r','\n'}};
|
||||
static const string_constant_t vbNewLine = {2, {'\r','\n'}};
|
||||
static const string_constant_t vbFormFeed = {1, {0xc}};
|
||||
static const string_constant_t vbLf = {1, {'\n'}};
|
||||
static const string_constant_t vbNullChar = {1};
|
||||
static const string_constant_t vbNullString = {0};
|
||||
static const string_constant_t vbTab = {1, {'\t'}};
|
||||
static const string_constant_t vbVerticalTab = {1, {0xb}};
|
||||
|
||||
static const builtin_prop_t global_props[] = {
|
||||
{DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, VT_I2, 0},
|
||||
|
@ -1736,15 +1692,15 @@ static const builtin_prop_t global_props[] = {
|
|||
{DISPID_GLOBAL_VBRED, NULL, BP_GET, VT_I4, 0x0000ff},
|
||||
{DISPID_GLOBAL_VBWHITE, NULL, BP_GET, VT_I4, 0xffffff},
|
||||
{DISPID_GLOBAL_VBYELLOW, NULL, BP_GET, VT_I4, 0x00ffff},
|
||||
{DISPID_GLOBAL_VBCR, Global_vbCr, BP_GET},
|
||||
{DISPID_GLOBAL_VBCRLF, Global_vbCrLf, BP_GET},
|
||||
{DISPID_GLOBAL_VBNEWLINE, Global_vbNewLine, BP_GET},
|
||||
{DISPID_GLOBAL_VBFORMFEED, Global_vbFormFeed, BP_GET},
|
||||
{DISPID_GLOBAL_VBLF, Global_vbLf, BP_GET},
|
||||
{DISPID_GLOBAL_VBNULLCHAR, Global_vbNullChar, BP_GET},
|
||||
{DISPID_GLOBAL_VBNULLSTRING, Global_vbNullString, BP_GET},
|
||||
{DISPID_GLOBAL_VBTAB, Global_vbTab, BP_GET},
|
||||
{DISPID_GLOBAL_VBVERTICALTAB, Global_vbVerticalTab, BP_GET},
|
||||
{DISPID_GLOBAL_VBCR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCr},
|
||||
{DISPID_GLOBAL_VBCRLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbCrLf},
|
||||
{DISPID_GLOBAL_VBNEWLINE, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNewLine},
|
||||
{DISPID_GLOBAL_VBFORMFEED, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbFormFeed},
|
||||
{DISPID_GLOBAL_VBLF, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbLf},
|
||||
{DISPID_GLOBAL_VBNULLCHAR, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullChar},
|
||||
{DISPID_GLOBAL_VBNULLSTRING, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbNullString},
|
||||
{DISPID_GLOBAL_VBTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbTab},
|
||||
{DISPID_GLOBAL_VBVERTICALTAB, NULL, BP_GET, VT_BSTR, (UINT_PTR)&vbVerticalTab},
|
||||
{DISPID_GLOBAL_CCUR, Global_CCur, 0, 1},
|
||||
{DISPID_GLOBAL_CINT, Global_CInt, 0, 1},
|
||||
{DISPID_GLOBAL_CLNG, Global_CLng, 0, 1},
|
||||
|
|
|
@ -48,6 +48,11 @@ Sub TestConstantI4(name, val, exval)
|
|||
Call ok(getVT(val) = "VT_I4*", "getVT(" & name & ") = " & getVT(val))
|
||||
End Sub
|
||||
|
||||
Sub TestConstantBSTR(name, val, exval)
|
||||
Call ok(val = exval, name & " = " & val & " expected " & exval)
|
||||
Call ok(getVT(val) = "VT_BSTR*", "getVT(" & name & ") = " & getVT(val))
|
||||
End Sub
|
||||
|
||||
TestConstant "vbEmpty", vbEmpty, 0
|
||||
TestConstant "vbNull", vbNull, 1
|
||||
TestConstant "vbLong", vbLong, 3
|
||||
|
@ -103,6 +108,15 @@ TestConstantI4 "vbMagenta", vbMagenta, &hff00ff&
|
|||
TestConstantI4 "vbRed", vbRed, &h0000ff&
|
||||
TestConstantI4 "vbWhite", vbWhite, &hffffff&
|
||||
TestConstantI4 "vbYellow", vbYellow, &h00ffff&
|
||||
TestConstantBSTR "vbCr", vbCr, Chr(13)
|
||||
TestConstantBSTR "vbCrLf", vbCrLf, Chr(13)&Chr(10)
|
||||
TestConstantBSTR "vbNewLine", vbNewLine, Chr(13)&Chr(10)
|
||||
TestConstantBSTR "vbFormFeed", vbFormFeed, Chr(12)
|
||||
TestConstantBSTR "vbLf", vbLf, Chr(10)
|
||||
TestConstantBSTR "vbNullChar", vbNullChar, Chr(0)
|
||||
TestConstantBSTR "vbNullString", vbNullString, ""
|
||||
TestConstantBSTR "vbTab", vbTab, chr(9)
|
||||
TestConstantBSTR "vbVerticalTab", vbVerticalTab, chr(11)
|
||||
|
||||
Sub TestCStr(arg, exval)
|
||||
dim x
|
||||
|
|
|
@ -160,6 +160,18 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f
|
|||
V_VT(res) = VT_I4;
|
||||
V_I4(res) = val;
|
||||
break;
|
||||
case VT_BSTR: {
|
||||
const string_constant_t *str = (const string_constant_t*)prop->max_args;
|
||||
BSTR ret;
|
||||
|
||||
ret = SysAllocStringLen(str->buf, str->len);
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
V_VT(res) = VT_BSTR;
|
||||
V_BSTR(res) = ret;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef struct {
|
|||
HRESULT (*proc)(vbdisp_t*,VARIANT*,unsigned,VARIANT*);
|
||||
DWORD flags;
|
||||
unsigned min_args;
|
||||
unsigned max_args;
|
||||
UINT_PTR max_args;
|
||||
} builtin_prop_t;
|
||||
|
||||
typedef struct _class_desc_t {
|
||||
|
@ -334,6 +334,11 @@ HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECL
|
|||
HRESULT exec_script(script_ctx_t*,function_t*,IDispatch*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
|
||||
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct {
|
||||
UINT16 len;
|
||||
WCHAR buf[7];
|
||||
} string_constant_t;
|
||||
|
||||
#define TID_LIST \
|
||||
XDIID(ErrObj) \
|
||||
XDIID(GlobalObj)
|
||||
|
|
Loading…
Reference in New Issue