Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
44224325
Commit
44224325
authored
Jan 09, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Added support for utf-8 codepage.
parent
d8c3e7de
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
parser.l
tools/wrc/parser.l
+2
-1
utils.c
tools/wrc/utils.c
+20
-8
No files found.
tools/wrc/parser.l
View file @
44224325
...
...
@@ -347,12 +347,13 @@ static struct keyword *iskeyword(char *kw)
<pp_pragma>[^\n]* yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'",yytext);
<pp_code_page>\({ws}*default{ws}*\)[^\n]* current_codepage = -1; yy_pop_state();
<pp_code_page>\({ws}*utf8{ws}*\)[^\n]* current_codepage = CP_UTF8; yy_pop_state();
<pp_code_page>\({ws}*[0-9]+{ws}*\)[^\n]* {
char *p = yytext;
yy_pop_state();
while (*p < '0' || *p > '9') p++;
current_codepage = strtol( p, NULL, 10 );
if (current_codepage && !wine_cp_get_table( current_codepage ))
if (current_codepage &&
current_codepage != CP_UTF8 &&
!wine_cp_get_table( current_codepage ))
{
parser_error("Codepage %d not supported", current_codepage);
current_codepage = 0;
...
...
tools/wrc/utils.c
View file @
44224325
...
...
@@ -244,26 +244,38 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage)
{
const
union
cptable
*
cptable
=
codepage
?
wine_cp_get_table
(
codepage
)
:
NULL
;
string_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
));
int
res
;
if
(
!
c
ptabl
e
&&
str
->
type
!=
type
)
error
(
"Current language is Unicode only, cannot convert strings
"
);
if
(
!
c
odepag
e
&&
str
->
type
!=
type
)
parser_error
(
"Current language is Unicode only, cannot convert string
"
);
if
((
str
->
type
==
str_char
)
&&
(
type
==
str_unicode
))
{
ret
->
type
=
str_unicode
;
ret
->
size
=
wine_cp_mbstowcs
(
cptable
,
0
,
str
->
str
.
cstr
,
str
->
size
,
NULL
,
0
);
ret
->
size
=
cptable
?
wine_cp_mbstowcs
(
cptable
,
0
,
str
->
str
.
cstr
,
str
->
size
,
NULL
,
0
)
:
wine_utf8_mbstowcs
(
0
,
str
->
str
.
cstr
,
str
->
size
,
NULL
,
0
);
ret
->
str
.
wstr
=
xmalloc
(
(
ret
->
size
+
1
)
*
sizeof
(
WCHAR
)
);
wine_cp_mbstowcs
(
cptable
,
0
,
str
->
str
.
cstr
,
str
->
size
,
ret
->
str
.
wstr
,
ret
->
size
);
if
(
cptable
)
res
=
wine_cp_mbstowcs
(
cptable
,
MB_ERR_INVALID_CHARS
,
str
->
str
.
cstr
,
str
->
size
,
ret
->
str
.
wstr
,
ret
->
size
);
else
res
=
wine_utf8_mbstowcs
(
MB_ERR_INVALID_CHARS
,
str
->
str
.
cstr
,
str
->
size
,
ret
->
str
.
wstr
,
ret
->
size
);
if
(
res
==
-
2
)
parser_error
(
"Invalid character in string '%.*s' for codepage %u
\n
"
,
str
->
size
,
str
->
str
.
cstr
,
codepage
);
ret
->
str
.
wstr
[
ret
->
size
]
=
0
;
}
else
if
((
str
->
type
==
str_unicode
)
&&
(
type
==
str_char
))
{
ret
->
type
=
str_char
;
ret
->
size
=
wine_cp_wcstombs
(
cptable
,
0
,
str
->
str
.
wstr
,
str
->
size
,
NULL
,
0
,
NULL
,
NULL
);
ret
->
size
=
cptable
?
wine_cp_wcstombs
(
cptable
,
0
,
str
->
str
.
wstr
,
str
->
size
,
NULL
,
0
,
NULL
,
NULL
)
:
wine_utf8_wcstombs
(
str
->
str
.
wstr
,
str
->
size
,
NULL
,
0
);
ret
->
str
.
cstr
=
xmalloc
(
ret
->
size
+
1
);
wine_cp_wcstombs
(
cptable
,
0
,
str
->
str
.
wstr
,
str
->
size
,
ret
->
str
.
cstr
,
ret
->
size
,
NULL
,
NULL
);
if
(
cptable
)
wine_cp_wcstombs
(
cptable
,
0
,
str
->
str
.
wstr
,
str
->
size
,
ret
->
str
.
cstr
,
ret
->
size
,
NULL
,
NULL
);
else
wine_utf8_wcstombs
(
str
->
str
.
wstr
,
str
->
size
,
ret
->
str
.
cstr
,
ret
->
size
);
ret
->
str
.
cstr
[
ret
->
size
]
=
0
;
}
else
if
(
str
->
type
==
str_unicode
)
...
...
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