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
f504135e
Commit
f504135e
authored
Feb 06, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Always output resource strings in Unicode format.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ccfabb32
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
161 deletions
+66
-161
lang.c
tools/wmc/lang.c
+0
-18
lang.h
tools/wmc/lang.h
+0
-1
mcy.y
tools/wmc/mcy.y
+1
-1
wmc.c
tools/wmc/wmc.c
+1
-8
wmc.h
tools/wmc/wmc.h
+0
-1
wmc.man.in
tools/wmc/wmc.man.in
+2
-4
write.c
tools/wmc/write.c
+62
-128
No files found.
tools/wmc/lang.c
View file @
f504135e
...
...
@@ -188,14 +188,6 @@ const language_t *find_language(unsigned id)
#ifdef _WIN32
static
BOOL
CALLBACK
proc
(
char
*
cp
)
{
CPINFOEXA
info
;
GetCPInfoExA
(
atoi
(
cp
),
0
,
&
info
);
printf
(
"%-5s %s
\n
"
,
cp
,
info
.
CodePageName
);
return
TRUE
;
}
int
is_valid_codepage
(
int
id
)
{
return
IsValidCodePage
(
id
);
...
...
@@ -206,11 +198,6 @@ int wmc_mbstowcs( int codepage, int flags, const char *src, int srclen, WCHAR *d
return
MultiByteToWideChar
(
codepage
,
flags
,
src
,
srclen
,
dst
,
dstlen
);
}
int
wmc_wcstombs
(
int
codepage
,
int
flags
,
const
WCHAR
*
src
,
int
srclen
,
char
*
dst
,
int
dstlen
)
{
return
WideCharToMultiByte
(
codepage
,
flags
,
src
,
srclen
,
dst
,
dstlen
,
NULL
,
NULL
);
}
#else
/* _WIN32 */
#include "wine/unicode.h"
...
...
@@ -225,9 +212,4 @@ int wmc_mbstowcs( int codepage, int flags, const char *src, int srclen, WCHAR *d
return
wine_cp_mbstowcs
(
wine_cp_get_table
(
codepage
),
flags
,
src
,
srclen
,
dst
,
dstlen
);
}
int
wmc_wcstombs
(
int
codepage
,
int
flags
,
const
WCHAR
*
src
,
int
srclen
,
char
*
dst
,
int
dstlen
)
{
return
wine_cp_wcstombs
(
wine_cp_get_table
(
codepage
),
flags
,
src
,
srclen
,
dst
,
dstlen
,
NULL
,
NULL
);
}
#endif
/* _WIN32 */
tools/wmc/lang.h
View file @
f504135e
...
...
@@ -34,6 +34,5 @@ void show_languages(void);
const
language_t
*
find_language
(
unsigned
id
);
int
is_valid_codepage
(
int
id
);
int
wmc_mbstowcs
(
int
codepage
,
int
flags
,
const
char
*
src
,
int
srclen
,
WCHAR
*
dst
,
int
dstlen
);
int
wmc_wcstombs
(
int
codepage
,
int
flags
,
const
WCHAR
*
src
,
int
srclen
,
char
*
dst
,
int
dstlen
);
#endif
tools/wmc/mcy.y
View file @
f504135e
...
...
@@ -590,7 +590,7 @@ static lan_blk_t *block_messages(node_t *head)
int nmsg = 0;
int i;
int nl;
int factor =
unicodeout ? 2 : 1
;
int factor =
2
;
for(ndp = head; ndp; ndp = ndp->next)
{
...
...
tools/wmc/wmc.c
View file @
f504135e
...
...
@@ -94,11 +94,6 @@ int pedantic = 0;
int
unicodein
=
0
;
/*
* Unicode output (-U option)
*/
int
unicodeout
=
0
;
/*
* Inline the messagetables (don't write *.bin files; -i option)
*/
int
rcinline
=
0
;
...
...
@@ -249,8 +244,7 @@ int main(int argc,char *argv[])
case
'u'
:
unicodein
=
1
;
break
;
case
'U'
:
unicodeout
=
1
;
case
'U'
:
/* ignored for backwards compatibility */
break
;
case
'v'
:
show_languages
();
...
...
@@ -295,7 +289,6 @@ int main(int argc,char *argv[])
else
if
(
output_name
&&
strendswith
(
output_name
,
".pot"
))
output_format
=
FORMAT_POT
;
else
output_format
=
FORMAT_RC
;
}
if
(
output_format
==
FORMAT_RES
)
unicodeout
=
1
;
/* Generate appropriate outfile names */
if
(
!
output_name
)
...
...
tools/wmc/wmc.h
View file @
f504135e
...
...
@@ -42,7 +42,6 @@ extern int byteorder;
extern
int
decimal
;
extern
int
custombit
;
extern
int
unicodein
;
extern
int
unicodeout
;
extern
int
rcinline
;
extern
char
*
output_name
;
...
...
tools/wmc/wmc.man.in
View file @
f504135e
...
...
@@ -59,10 +59,8 @@ gettext convention, in particular in must contain one \fI.po\fR file for
each language, and a LINGUAS file listing the available languages.
.TP
.B \-u
Assume that the inputfile is in unicode.
.TP
.B \-U
Write resource output in unicode formatted messagetable(s).
Assume that the input file is in Unicode or UTF-8 format and skip
codepage conversions.
.TP
.B \-v
Show all supported codepages and languages.
...
...
tools/wmc/write.c
View file @
f504135e
...
...
@@ -306,131 +306,67 @@ static void write_rcbin(FILE *fp)
}
}
static
char
*
make_string
(
WCHAR
*
uc
,
int
len
,
int
codepage
)
static
char
*
make_string
(
WCHAR
*
uc
,
int
len
)
{
char
*
str
=
xmalloc
(
7
*
len
+
1
);
char
*
cptr
=
str
;
int
i
;
int
b
;
char
*
str
=
xmalloc
(
7
*
len
+
12
);
char
*
cptr
=
str
;
int
i
;
int
b
;
if
(
!
codepage
||
codepage
==
CP_UTF8
)
{
*
cptr
++
=
' '
;
*
cptr
++
=
'L'
;
*
cptr
++
=
'"'
;
for
(
i
=
b
=
0
;
i
<
len
;
i
++
,
uc
++
)
{
switch
(
*
uc
)
{
case
'\a'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'a'
;
b
+=
2
;
break
;
case
'\b'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'b'
;
b
+=
2
;
break
;
case
'\f'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'f'
;
b
+=
2
;
break
;
case
'\n'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'n'
;
b
+=
2
;
break
;
case
'\r'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'r'
;
b
+=
2
;
break
;
case
'\t'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
't'
;
b
+=
2
;
break
;
case
'\v'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'v'
;
b
+=
2
;
break
;
case
'\\'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'\\'
;
b
+=
2
;
break
;
case
'"'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'"'
;
b
+=
2
;
break
;
default:
if
(
*
uc
<
0x100
&&
isprint
(
*
uc
))
{
*
cptr
++
=
*
uc
;
b
++
;
}
else
{
int
n
=
sprintf
(
cptr
,
"
\\
x%04x"
,
*
uc
&
0xffff
);
cptr
+=
n
;
b
+=
n
;
}
break
;
}
if
(
i
<
len
-
1
&&
b
>=
72
)
{
*
cptr
++
=
'"'
;
*
cptr
++
=
','
;
*
cptr
++
=
'\n'
;
*
cptr
++
=
' '
;
*
cptr
++
=
'L'
;
*
cptr
++
=
'"'
;
b
=
0
;
}
}
if
(
unicodeout
)
len
=
(
len
+
1
)
&
~
1
;
else
len
=
(
len
+
3
)
&
~
3
;
for
(;
i
<
len
;
i
++
)
{
*
cptr
++
=
'\\'
;
*
cptr
++
=
'x'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
}
*
cptr
++
=
'"'
;
*
cptr
=
'\0'
;
}
else
{
char
*
tmp
,
*
cc
;
int
unilen
=
unistrlen
(
uc
)
+
1
;
cc
=
tmp
=
xmalloc
(
unilen
*
2
);
wmc_wcstombs
(
codepage
,
0
,
uc
,
unilen
,
cptr
,
unilen
*
2
);
*
cptr
++
=
' '
;
*
cptr
++
=
'"'
;
for
(
i
=
b
=
0
;
i
<
len
;
i
++
,
cc
++
)
{
switch
(
*
cc
)
{
case
'\a'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'a'
;
b
+=
2
;
break
;
case
'\b'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'b'
;
b
+=
2
;
break
;
case
'\f'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'f'
;
b
+=
2
;
break
;
case
'\n'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'n'
;
b
+=
2
;
break
;
case
'\r'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'r'
;
b
+=
2
;
break
;
case
'\t'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
't'
;
b
+=
2
;
break
;
case
'\v'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'v'
;
b
+=
2
;
break
;
case
'\\'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'\\'
;
b
+=
2
;
break
;
case
'"'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'"'
;
b
+=
2
;
break
;
default:
if
(
isprint
(
*
cc
))
{
*
cptr
++
=
*
cc
;
b
++
;
}
else
{
int
n
=
sprintf
(
cptr
,
"
\\
x%02x"
,
*
cc
&
0xff
);
cptr
+=
n
;
b
+=
n
;
}
break
;
}
if
(
i
<
len
-
1
&&
b
>=
72
)
{
*
cptr
++
=
'"'
;
*
cptr
++
=
','
;
*
cptr
++
=
'\n'
;
*
cptr
++
=
' '
;
*
cptr
++
=
'"'
;
b
=
0
;
}
}
len
=
(
len
+
3
)
&
~
3
;
for
(;
i
<
len
;
i
++
)
{
*
cptr
++
=
'\\'
;
*
cptr
++
=
'x'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
}
*
cptr
++
=
'"'
;
*
cptr
=
'\0'
;
free
(
tmp
);
}
return
str
;
*
cptr
++
=
' '
;
*
cptr
++
=
'L'
;
*
cptr
++
=
'"'
;
for
(
i
=
b
=
0
;
i
<
len
;
i
++
,
uc
++
)
{
switch
(
*
uc
)
{
case
'\a'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'a'
;
b
+=
2
;
break
;
case
'\b'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'b'
;
b
+=
2
;
break
;
case
'\f'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'f'
;
b
+=
2
;
break
;
case
'\n'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'n'
;
b
+=
2
;
break
;
case
'\r'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'r'
;
b
+=
2
;
break
;
case
'\t'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
't'
;
b
+=
2
;
break
;
case
'\v'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'v'
;
b
+=
2
;
break
;
case
'\\'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'\\'
;
b
+=
2
;
break
;
case
'"'
:
*
cptr
++
=
'\\'
;
*
cptr
++
=
'"'
;
b
+=
2
;
break
;
default:
if
(
*
uc
<
0x100
&&
isprint
(
*
uc
))
{
*
cptr
++
=
*
uc
;
b
++
;
}
else
{
int
n
=
sprintf
(
cptr
,
"
\\
x%04x"
,
*
uc
);
cptr
+=
n
;
b
+=
n
;
}
break
;
}
if
(
i
<
len
-
1
&&
b
>=
72
)
{
*
cptr
++
=
'"'
;
*
cptr
++
=
','
;
*
cptr
++
=
'\n'
;
*
cptr
++
=
' '
;
*
cptr
++
=
'L'
;
*
cptr
++
=
'"'
;
b
=
0
;
}
}
len
=
(
len
+
1
)
&
~
1
;
for
(;
i
<
len
;
i
++
)
{
*
cptr
++
=
'\\'
;
*
cptr
++
=
'x'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
*
cptr
++
=
'0'
;
}
*
cptr
++
=
'"'
;
*
cptr
=
'\0'
;
return
str
;
}
static
void
write_rcinline
(
FILE
*
fp
)
...
...
@@ -462,11 +398,9 @@ static void write_rcinline(FILE *fp)
char
*
cptr
;
int
l
=
blk
->
msgs
[
j
]
->
len
;
const
char
*
comma
=
j
==
blk
->
nmsg
-
1
&&
i
==
lbp
->
nblk
-
1
?
""
:
","
;
cptr
=
make_string
(
blk
->
msgs
[
j
]
->
msg
,
l
,
unicodeout
?
0
:
blk
->
msgs
[
j
]
->
cp
);
fprintf
(
fp
,
"
\n
/* Msg 0x%08x */ 0x%04x, 0x000%c,
\n
"
,
blk
->
idlo
+
j
,
(
unicodeout
?
(
l
*
2
+
3
)
&~
3
:
(
l
+
3
)
&~
3
)
+
4
,
unicodeout
?
'1'
:
'0'
);
cptr
=
make_string
(
blk
->
msgs
[
j
]
->
msg
,
l
);
fprintf
(
fp
,
"
\n
/* Msg 0x%08x */ 0x%04x, 0x0001,
\n
"
,
blk
->
idlo
+
j
,
((
l
*
2
+
3
)
&
~
3
)
+
4
);
fprintf
(
fp
,
"%s%s
\n
"
,
cptr
,
comma
);
free
(
cptr
);
}
...
...
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