Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0b13d721
Commit
0b13d721
authored
Jul 11, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
Jul 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Implemented Sgn.
parent
393f4bc5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
29 deletions
+56
-29
global.c
dlls/vbscript/global.c
+24
-29
api.vbs
dlls/vbscript/tests/api.vbs
+31
-0
vbscript.h
dlls/vbscript/vbscript.h
+1
-0
No files found.
dlls/vbscript/global.c
View file @
0b13d721
...
@@ -182,35 +182,15 @@ HRESULT to_int(VARIANT *v, int *ret)
...
@@ -182,35 +182,15 @@ HRESULT to_int(VARIANT *v, int *ret)
static
HRESULT
to_double
(
VARIANT
*
v
,
double
*
ret
)
static
HRESULT
to_double
(
VARIANT
*
v
,
double
*
ret
)
{
{
switch
(
V_VT
(
v
))
{
VARIANT
dst
;
case
VT_I2
:
HRESULT
hres
;
*
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
;
V_VT
(
&
dst
)
=
VT_EMPTY
;
V_VT
(
&
dst
)
=
VT_EMPTY
;
hres
=
VariantChangeType
(
&
dst
,
v
,
VARIANT_LOCALBOOL
,
VT_R8
);
hres
=
VariantChangeType
(
&
dst
,
v
,
0
,
VT_R8
);
if
(
FAILED
(
hres
))
if
(
FAILED
(
hres
))
return
hres
;
return
hres
;
*
ret
=
V_R8
(
&
dst
);
break
;
}
default:
FIXME
(
"arg %s not supported
\n
"
,
debugstr_variant
(
v
));
return
E_NOTIMPL
;
}
*
ret
=
V_R8
(
&
dst
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1284,8 +1264,23 @@ static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
...
@@ -1284,8 +1264,23 @@ static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static
HRESULT
Global_Sgn
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_Sgn
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
{
FIXME
(
"
\n
"
);
double
v
;
return
E_NOTIMPL
;
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
)
static
HRESULT
Global_Now
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
0b13d721
...
@@ -878,4 +878,35 @@ Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " &
...
@@ -878,4 +878,35 @@ Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " &
Call
ok
(
VarType
(
CByte
(
255
))
=
vbByte
,
"VarType(CByte(255)) = "
&
VarType
(
CByte
(
255
)))
Call
ok
(
VarType
(
CByte
(
255
))
=
vbByte
,
"VarType(CByte(255)) = "
&
VarType
(
CByte
(
255
)))
Call
ok
(
getVT
(
VarType
(
CByte
(
255
)))
=
"VT_I2"
,
"getVT(VarType(CByte(255))) = "
&
getVT
(
VarType
(
CByte
(
255
))))
Call
ok
(
getVT
(
VarType
(
CByte
(
255
)))
=
"VT_I2"
,
"getVT(VarType(CByte(255))) = "
&
getVT
(
VarType
(
CByte
(
255
))))
Call
ok
(
Sgn
(
Empty
)
=
0
,
"Sgn(MyEmpty) = "
&
Sgn
(
Empty
))
Call
ok
(
getVT
(
Sgn
(
Empty
))
=
"VT_I2"
,
"getVT(Sgn(MyEmpty)) = "
&
getVT
(
Sgn
(
Empty
)))
Call
ok
(
Sgn
(
0
)
=
0
,
"Sgn(0) = "
&
Sgn
(
0
))
Call
ok
(
getVT
(
Sgn
(
0
))
=
"VT_I2"
,
"getVT(Sgn(0)) = "
&
getVT
(
Sgn
(
0
)))
Call
ok
(
Sgn
(
-
32769
)
=
-
1
,
"Sgn(-32769) = "
&
Sgn
(
-
32769
))
Call
ok
(
getVT
(
Sgn
(
-
32769
))
=
"VT_I2"
,
"getVT(Sgn(-32769)) = "
&
getVT
(
Sgn
(
-
32769
)))
Call
ok
(
Sgn
(
CSng
(
-
0.5
))
=
-
1
,
"Sgn(CSng(-0.5)) = "
&
Sgn
(
CSng
(
-
0.5
)))
Call
ok
(
getVT
(
Sgn
(
CSng
(
-
0.5
)))
=
"VT_I2"
,
"getVT(Sgn(CSng(-0.5))) = "
&
getVT
(
Sgn
(
CSng
(
-
0.5
))))
Call
ok
(
Sgn
(
0.5
)
=
1
,
"Sgn(0.5) = "
&
Sgn
(
0.5
))
Call
ok
(
getVT
(
Sgn
(
0.5
))
=
"VT_I2"
,
"getVT(Sgn(0.5)) = "
&
getVT
(
Sgn
(
0.5
)))
Call
ok
(
Sgn
(
CCur
(
-
1
))
=
-
1
,
"Sgn(CCur(-1)) = "
&
Sgn
(
CCur
(
-
1
)))
Call
ok
(
getVT
(
Sgn
(
CCur
(
-
1
)))
=
"VT_I2"
,
"getVT(Sgn(CCur(-1))) = "
&
getVT
(
Sgn
(
CCur
(
-
1
))))
Call
ok
(
Sgn
(
CStr
(
-
1
))
=
-
1
,
"Sgn(CStr(-1)) = "
&
Sgn
(
CStr
(
-
1
)))
Call
ok
(
getVT
(
Sgn
(
CStr
(
-
1
)))
=
"VT_I2"
,
"getVT(Sgn(CStr(-1))) = "
&
getVT
(
Sgn
(
CStr
(
-
1
))))
Call
ok
(
Sgn
(
False
)
=
0
,
"Sgn(False) = "
&
Sgn
(
False
))
Call
ok
(
getVT
(
Sgn
(
False
))
=
"VT_I2"
,
"getVT(Sgn(False)) = "
&
getVT
(
Sgn
(
False
)))
Call
ok
(
Sgn
(
True
)
=
-
1
,
"Sgn(True) = "
&
Sgn
(
True
))
Call
ok
(
getVT
(
Sgn
(
True
))
=
"VT_I2"
,
"getVT(Sgn(True)) = "
&
getVT
(
Sgn
(
True
)))
Call
ok
(
Sgn
(
CByte
(
1
))
=
1
,
"Sgn(CByte(1)) = "
&
Sgn
(
CByte
(
1
)))
Call
ok
(
getVT
(
Sgn
(
CByte
(
1
)))
=
"VT_I2"
,
"getVT(Sgn(CByte(1))) = "
&
getVT
(
Sgn
(
CByte
(
1
))))
Sub
testSgnError
(
strings
,
error_num
)
on
error
resume
next
Call
Err
.
clear
()
Call
Sgn
(
strings
)
Call
ok
(
Err
.
number
=
error_num
,
"Err.number = "
&
Err
.
number
)
End
Sub
Call
testSgnError
(
Null
,
94
)
Call
reportSuccess
()
Call
reportSuccess
()
dlls/vbscript/vbscript.h
View file @
0b13d721
...
@@ -406,6 +406,7 @@ HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
...
@@ -406,6 +406,7 @@ HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN;
#define VBSE_PERMISSION_DENIED 70
#define VBSE_PERMISSION_DENIED 70
#define VBSE_PATH_FILE_ACCESS 75
#define VBSE_PATH_FILE_ACCESS 75
#define VBSE_PATH_NOT_FOUND 76
#define VBSE_PATH_NOT_FOUND 76
#define VBSE_ILLEGAL_NULL_USE 94
#define VBSE_OLE_NOT_SUPPORTED 430
#define VBSE_OLE_NOT_SUPPORTED 430
#define VBSE_OLE_NO_PROP_OR_METHOD 438
#define VBSE_OLE_NO_PROP_OR_METHOD 438
#define VBSE_ACTION_NOT_SUPPORTED 445
#define VBSE_ACTION_NOT_SUPPORTED 445
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment