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
ea5dbc13
Commit
ea5dbc13
authored
Oct 22, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Implement String function.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
bd7132e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
3 deletions
+59
-3
global.c
dlls/vbscript/global.c
+31
-3
api.vbs
dlls/vbscript/tests/api.vbs
+28
-0
No files found.
dlls/vbscript/global.c
View file @
ea5dbc13
...
...
@@ -24,6 +24,7 @@
#include "mshtmhst.h"
#include "objsafe.h"
#include "wchar.h"
#include "wine/debug.h"
...
...
@@ -1543,10 +1544,37 @@ static HRESULT Global_Space(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt,
return
S_OK
;
}
static
HRESULT
Global_String
(
BuiltinDisp
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_String
(
BuiltinDisp
*
This
,
VARIANT
*
arg
s
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
WCHAR
ch
;
int
cnt
;
HRESULT
hres
;
TRACE
(
"%s %s
\n
"
,
debugstr_variant
(
args
),
debugstr_variant
(
args
+
1
));
hres
=
to_int
(
args
,
&
cnt
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
cnt
<
0
)
return
E_INVALIDARG
;
if
(
V_VT
(
args
+
1
)
!=
VT_BSTR
)
{
FIXME
(
"Unsupported argument %s
\n
"
,
debugstr_variant
(
args
+
1
));
return
E_NOTIMPL
;
}
if
(
!
SysStringLen
(
V_BSTR
(
args
+
1
)))
return
E_INVALIDARG
;
ch
=
V_BSTR
(
args
+
1
)[
0
];
if
(
res
)
{
BSTR
str
=
SysAllocStringLen
(
NULL
,
cnt
);
if
(
!
str
)
return
E_OUTOFMEMORY
;
wmemset
(
str
,
ch
,
cnt
);
V_VT
(
res
)
=
VT_BSTR
;
V_BSTR
(
res
)
=
str
;
}
return
S_OK
;
}
static
HRESULT
Global_InStr
(
BuiltinDisp
*
This
,
VARIANT
*
args
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
ea5dbc13
...
...
@@ -548,6 +548,34 @@ Call ok(Space(0.5) = "", "Space(0.5) = " & Space(0.5) & """")
Call
ok
(
Space
(
1.5
)
=
" "
,
"Space(1.5) = "
&
Space
(
1.5
)
&
"
""
"
)
Call
ok
(
Space
(
"1"
)
=
" "
,
"Space(
""
1
""
) = "
&
Space
(
"1"
)
&
"
""
"
)
sub
test_string
(
cnt
,
char
,
exp
)
call
ok
(
String
(
cnt
,
char
)
=
exp
,
"String("
&
cnt
&
",
""
"
&
char
&
"
""
=
""
"
&
_
String
(
cnt
,
char
)
&
"
""
expected
""
"
&
exp
&
"
""
"
)
end
sub
test_string
3
,
"x"
,
"xxx"
test_string
3
,
"xy"
,
"xxx"
test_string
1
,
"z"
,
"z"
test_string
0
,
"z"
,
""
test_string
"3"
,
"xy"
,
"xxx"
test_string
3
,
Chr
(
3
),
Chr
(
3
)
&
Chr
(
3
)
&
Chr
(
3
)
call
ok
(
getVT
(
String
(
0
,
"z"
))
=
"VT_BSTR"
,
"getVT(String(0,z)) = "
&
getVT
(
String
(
0
,
"z"
)))
sub
test_string_error
()
on
error
resume
next
dim
x
x
=
String
(
-
2
,
"x"
)
call
ok
(
err
.
number
=
5
,
"err.number = "
&
err
.
number
)
err
.
clear
x
=
String
(
3
,
""
)
call
ok
(
err
.
number
=
5
,
"err.number = "
&
err
.
number
)
err
.
clear
x
=
String
(
0
,
""
)
call
ok
(
err
.
number
=
5
,
"err.number = "
&
err
.
number
)
end
sub
call
test_string_error
Sub
TestStrReverse
(
str
,
ex
)
Call
ok
(
StrReverse
(
str
)
=
ex
,
"StrReverse("
&
str
&
") = "
&
StrReverse
(
str
))
End
Sub
...
...
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