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
fffdb2b2
Commit
fffdb2b2
authored
Nov 16, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Implement FormatNumber().
parent
b0915dfb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
3 deletions
+65
-3
global.c
dlls/vbscript/global.c
+29
-3
api.vbs
dlls/vbscript/tests/api.vbs
+36
-0
No files found.
dlls/vbscript/global.c
View file @
fffdb2b2
...
...
@@ -2945,10 +2945,36 @@ static HRESULT Global_ScriptEngineBuildVersion(BuiltinDisp *This, VARIANT *arg,
return
return_int
(
res
,
VBSCRIPT_BUILD_VERSION
);
}
static
HRESULT
Global_FormatNumber
(
BuiltinDisp
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_FormatNumber
(
BuiltinDisp
*
This
,
VARIANT
*
arg
s
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
union
{
struct
{
int
num_dig
,
inc_lead
,
use_parens
,
group
;
}
s
;
int
val
[
4
];
}
int_args
=
{
.
s
.
num_dig
=
-
1
,
.
s
.
inc_lead
=
-
2
,
.
s
.
use_parens
=
-
2
,
.
s
.
group
=
-
2
};
HRESULT
hres
;
BSTR
str
;
int
i
;
TRACE
(
"
\n
"
);
assert
(
1
<=
args_cnt
&&
args_cnt
<=
5
);
for
(
i
=
1
;
i
<
args_cnt
;
++
i
)
{
if
(
V_VT
(
args
+
i
)
==
VT_ERROR
)
continue
;
if
(
V_VT
(
args
+
i
)
==
VT_NULL
)
return
MAKE_VBSERROR
(
VBSE_ILLEGAL_NULL_USE
);
if
(
FAILED
(
hres
=
to_int
(
args
+
i
,
&
int_args
.
val
[
i
-
1
])))
return
hres
;
}
hres
=
VarFormatNumber
(
args
,
int_args
.
s
.
num_dig
,
int_args
.
s
.
inc_lead
,
int_args
.
s
.
use_parens
,
int_args
.
s
.
group
,
0
,
&
str
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bstr
(
res
,
str
);
}
static
HRESULT
Global_FormatCurrency
(
BuiltinDisp
*
This
,
VARIANT
*
args
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
fffdb2b2
...
...
@@ -2436,4 +2436,40 @@ end sub
call
testFormatDateTime
()
call
testFormatDateTimeError
()
sub
testFormatNumberError
()
on
error
resume
next
dim
x
call
Err
.
clear
()
x
=
FormatNumber
(
null
)
call
ok
(
Err
.
number
=
13
,
"Err.number = "
&
Err
.
number
)
call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT = "
&
getVT
(
x
))
call
Err
.
clear
()
x
=
FormatNumber
(.
10,
null
)
call
ok
(
Err
.
number
=
94
,
"Err.number = "
&
Err
.
number
)
call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT = "
&
getVT
(
x
))
call
Err
.
clear
()
x
=
FormatNumber
(.
10,0,
null
)
call
ok
(
Err
.
number
=
94
,
"Err.number = "
&
Err
.
number
)
call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT = "
&
getVT
(
x
))
call
Err
.
clear
()
x
=
FormatNumber
(.
10,0,0,
null
)
call
ok
(
Err
.
number
=
94
,
"Err.number = "
&
Err
.
number
)
call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT = "
&
getVT
(
x
))
call
Err
.
clear
()
x
=
FormatNumber
(.
10,0,0,0,
null
)
call
ok
(
Err
.
number
=
94
,
"Err.number = "
&
Err
.
number
)
call
ok
(
getVT
(
x
)
=
"VT_EMPTY*"
,
"getVT = "
&
getVT
(
x
))
end
sub
sub
testFormatNumber
()
dim
x
x
=
FormatNumber
(
0
)
x
=
FormatNumber
(.
12,,,-1)
call
ok
(
getVT
(
x
)
=
"VT_BSTR*"
,
"getVT = "
&
getVT
(
x
))
end
sub
call
testFormatNumber
()
call
testFormatNumberError
()
Call
reportSuccess
()
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