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
49bea92b
Commit
49bea92b
authored
Apr 01, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Store language as a simple integer.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
234710e8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
165 deletions
+120
-165
genres.c
tools/wrc/genres.c
+22
-25
newstruc.c
tools/wrc/newstruc.c
+7
-22
newstruc.h
tools/wrc/newstruc.h
+1
-3
parser.y
tools/wrc/parser.y
+26
-37
po.c
tools/wrc/po.c
+49
-49
utils.c
tools/wrc/utils.c
+3
-3
utils.h
tools/wrc/utils.h
+1
-1
wrc.c
tools/wrc/wrc.c
+7
-16
wrc.h
tools/wrc/wrc.h
+1
-1
wrctypes.h
tools/wrc/wrctypes.h
+3
-8
No files found.
tools/wrc/genres.c
View file @
49bea92b
...
@@ -175,7 +175,7 @@ static int parse_accel_string( const string_t *key, int flags )
...
@@ -175,7 +175,7 @@ static int parse_accel_string( const string_t *key, int flags )
* size member)
* size member)
*****************************************************************************
*****************************************************************************
*/
*/
static
void
put_string
(
const
string_t
*
str
,
int
isterm
,
const
language_t
*
lang
)
static
void
put_string
(
const
string_t
*
str
,
int
isterm
,
language_t
lang
)
{
{
int
cnt
,
codepage
;
int
cnt
,
codepage
;
...
@@ -183,10 +183,7 @@ static void put_string(const string_t *str, int isterm, const language_t *lang)
...
@@ -183,10 +183,7 @@ static void put_string(const string_t *str, int isterm, const language_t *lang)
{
{
string_t
*
newstr
;
string_t
*
newstr
;
if
(
lang
)
codepage
=
get_language_codepage
(
lang
->
id
,
lang
->
sub
);
codepage
=
get_language_codepage
(
lang
);
else
codepage
=
get_language_codepage
(
0
,
0
);
assert
(
codepage
!=
-
1
);
newstr
=
convert_string_unicode
(
str
,
codepage
);
newstr
=
convert_string_unicode
(
str
,
codepage
);
if
(
str
->
type
==
str_char
&&
check_valid_utf8
(
str
,
codepage
))
if
(
str
->
type
==
str_char
&&
check_valid_utf8
(
str
,
codepage
))
{
{
...
@@ -223,7 +220,7 @@ static void put_string(const string_t *str, int isterm, const language_t *lang)
...
@@ -223,7 +220,7 @@ static void put_string(const string_t *str, int isterm, const language_t *lang)
* Function : put_name_id
* Function : put_name_id
*****************************************************************************
*****************************************************************************
*/
*/
static
void
put_name_id
(
name_id_t
*
nid
,
int
upcase
,
const
language_t
*
lang
)
static
void
put_name_id
(
name_id_t
*
nid
,
int
upcase
,
language_t
lang
)
{
{
switch
(
nid
->
type
)
switch
(
nid
->
type
)
{
{
...
@@ -249,8 +246,8 @@ static void put_name_id(name_id_t *nid, int upcase, const language_t *lang)
...
@@ -249,8 +246,8 @@ static void put_name_id(name_id_t *nid, int upcase, const language_t *lang)
*/
*/
static
void
put_lvc
(
lvc_t
*
lvc
)
static
void
put_lvc
(
lvc_t
*
lvc
)
{
{
if
(
lvc
&&
lvc
->
language
)
if
(
lvc
)
put_word
(
MAKELANGID
(
lvc
->
language
->
id
,
lvc
->
language
->
sub
)
);
put_word
(
lvc
->
language
);
else
else
put_word
(
0
);
/* Neutral */
put_word
(
0
);
/* Neutral */
if
(
lvc
&&
lvc
->
version
)
if
(
lvc
&&
lvc
->
version
)
...
@@ -296,7 +293,7 @@ static int put_res_header(int type, name_id_t *name, unsigned int memopt, lvc_t
...
@@ -296,7 +293,7 @@ static int put_res_header(int type, name_id_t *name, unsigned int memopt, lvc_t
{
{
put_byte
(
0xff
);
/* ResType */
put_byte
(
0xff
);
/* ResType */
put_word
(
type
);
put_word
(
type
);
put_name_id
(
name
,
TRUE
,
NULL
);
/* ResName */
put_name_id
(
name
,
TRUE
,
0
);
/* ResName */
put_word
(
memopt
);
/* Memory options */
put_word
(
memopt
);
/* Memory options */
tag
=
output_buffer_pos
;
tag
=
output_buffer_pos
;
put_dword
(
4
);
/* ResSize overwritten later*/
put_dword
(
4
);
/* ResSize overwritten later*/
...
@@ -466,21 +463,21 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
...
@@ -466,21 +463,21 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
put_word
(
dlg
->
width
);
put_word
(
dlg
->
width
);
put_word
(
dlg
->
height
);
put_word
(
dlg
->
height
);
if
(
dlg
->
menu
)
if
(
dlg
->
menu
)
put_name_id
(
dlg
->
menu
,
TRUE
,
NULL
);
put_name_id
(
dlg
->
menu
,
TRUE
,
0
);
else
else
put_byte
(
0
);
put_byte
(
0
);
if
(
dlg
->
dlgclass
)
if
(
dlg
->
dlgclass
)
put_name_id
(
dlg
->
dlgclass
,
TRUE
,
NULL
);
put_name_id
(
dlg
->
dlgclass
,
TRUE
,
0
);
else
else
put_byte
(
0
);
put_byte
(
0
);
if
(
dlg
->
title
)
if
(
dlg
->
title
)
put_string
(
dlg
->
title
,
TRUE
,
NULL
);
put_string
(
dlg
->
title
,
TRUE
,
0
);
else
else
put_byte
(
0
);
put_byte
(
0
);
if
(
dlg
->
font
)
if
(
dlg
->
font
)
{
{
put_word
(
dlg
->
font
->
size
);
put_word
(
dlg
->
font
->
size
);
put_string
(
dlg
->
font
->
name
,
TRUE
,
NULL
);
put_string
(
dlg
->
font
->
name
,
TRUE
,
0
);
}
}
for
(
ctrl
=
dlg
->
controls
;
ctrl
;
ctrl
=
ctrl
->
next
)
for
(
ctrl
=
dlg
->
controls
;
ctrl
;
ctrl
=
ctrl
->
next
)
...
@@ -496,11 +493,11 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
...
@@ -496,11 +493,11 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
&&
ctrl
->
ctlclass
->
name
.
i_name
<=
0x85
)
&&
ctrl
->
ctlclass
->
name
.
i_name
<=
0x85
)
put_byte
(
ctrl
->
ctlclass
->
name
.
i_name
);
put_byte
(
ctrl
->
ctlclass
->
name
.
i_name
);
else
if
(
ctrl
->
ctlclass
->
type
==
name_str
)
else
if
(
ctrl
->
ctlclass
->
type
==
name_str
)
put_name_id
(
ctrl
->
ctlclass
,
FALSE
,
NULL
);
put_name_id
(
ctrl
->
ctlclass
,
FALSE
,
0
);
else
else
error
(
"Unknown control-class %04x
\n
"
,
ctrl
->
ctlclass
->
name
.
i_name
);
error
(
"Unknown control-class %04x
\n
"
,
ctrl
->
ctlclass
->
name
.
i_name
);
if
(
ctrl
->
title
)
if
(
ctrl
->
title
)
put_name_id
(
ctrl
->
title
,
FALSE
,
NULL
);
put_name_id
(
ctrl
->
title
,
FALSE
,
0
);
else
else
put_byte
(
0
);
put_byte
(
0
);
...
@@ -517,7 +514,7 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
...
@@ -517,7 +514,7 @@ static void dialog2res(name_id_t *name, dialog_t *dlg)
* Remarks : Self recursive
* Remarks : Self recursive
*****************************************************************************
*****************************************************************************
*/
*/
static
void
menuitem2res
(
menu_item_t
*
menitem
,
const
language_t
*
lang
)
static
void
menuitem2res
(
menu_item_t
*
menitem
,
language_t
lang
)
{
{
menu_item_t
*
itm
=
menitem
;
menu_item_t
*
itm
=
menitem
;
...
@@ -545,7 +542,7 @@ static void menuitem2res(menu_item_t *menitem, const language_t *lang)
...
@@ -545,7 +542,7 @@ static void menuitem2res(menu_item_t *menitem, const language_t *lang)
* Remarks : Self recursive
* Remarks : Self recursive
*****************************************************************************
*****************************************************************************
*/
*/
static
void
menuexitem2res
(
menu_item_t
*
menitem
,
const
language_t
*
lang
)
static
void
menuexitem2res
(
menu_item_t
*
menitem
,
language_t
lang
)
{
{
menu_item_t
*
itm
=
menitem
;
menu_item_t
*
itm
=
menitem
;
assert
(
win32
!=
0
);
assert
(
win32
!=
0
);
...
@@ -604,7 +601,7 @@ static void menu2res(name_id_t *name, menu_t *men)
...
@@ -604,7 +601,7 @@ static void menu2res(name_id_t *name, menu_t *men)
else
/* win16 */
else
/* win16 */
{
{
put_dword
(
0
);
/* Menuheader: Version and HeaderSize */
put_dword
(
0
);
/* Menuheader: Version and HeaderSize */
menuitem2res
(
men
->
items
,
NULL
);
menuitem2res
(
men
->
items
,
0
);
}
}
set_res_size
(
restag
);
set_res_size
(
restag
);
}
}
...
@@ -952,8 +949,8 @@ static void user2res(name_id_t *name, user_t *usr)
...
@@ -952,8 +949,8 @@ static void user2res(name_id_t *name, user_t *usr)
}
}
else
/* win16 */
else
/* win16 */
{
{
put_name_id
(
usr
->
type
,
TRUE
,
NULL
);
put_name_id
(
usr
->
type
,
TRUE
,
0
);
put_name_id
(
name
,
TRUE
,
NULL
);
/* ResName */
put_name_id
(
name
,
TRUE
,
0
);
/* ResName */
put_word
(
usr
->
memopt
);
/* Memory options */
put_word
(
usr
->
memopt
);
/* Memory options */
tag
=
output_buffer_pos
;
tag
=
output_buffer_pos
;
put_dword
(
4
);
/* ResSize overwritten later*/
put_dword
(
4
);
/* ResSize overwritten later*/
...
@@ -971,7 +968,7 @@ static void user2res(name_id_t *name, user_t *usr)
...
@@ -971,7 +968,7 @@ static void user2res(name_id_t *name, user_t *usr)
* Remarks : Self recursive
* Remarks : Self recursive
*****************************************************************************
*****************************************************************************
*/
*/
static
void
versionblock2res
(
ver_block_t
*
blk
,
int
level
,
const
language_t
*
lang
)
static
void
versionblock2res
(
ver_block_t
*
blk
,
int
level
,
language_t
lang
)
{
{
ver_value_t
*
val
;
ver_value_t
*
val
;
int
blksizetag
;
int
blksizetag
;
...
@@ -985,7 +982,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
...
@@ -985,7 +982,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
put_word
(
0
);
put_word
(
0
);
if
(
win32
)
if
(
win32
)
put_word
(
0
);
/* level ? */
put_word
(
0
);
/* level ? */
put_string
(
blk
->
name
,
TRUE
,
NULL
);
put_string
(
blk
->
name
,
TRUE
,
0
);
align_output
(
4
);
align_output
(
4
);
for
(
val
=
blk
->
values
;
val
;
val
=
val
->
next
)
for
(
val
=
blk
->
values
;
val
;
val
=
val
->
next
)
{
{
...
@@ -1000,7 +997,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
...
@@ -1000,7 +997,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
{
{
put_word
(
level
);
put_word
(
level
);
}
}
put_string
(
val
->
key
,
TRUE
,
NULL
);
put_string
(
val
->
key
,
TRUE
,
0
);
align_output
(
4
);
align_output
(
4
);
tag
=
output_buffer_pos
;
tag
=
output_buffer_pos
;
put_string
(
val
->
value
.
str
,
TRUE
,
lang
);
put_string
(
val
->
value
.
str
,
TRUE
,
lang
);
...
@@ -1020,7 +1017,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
...
@@ -1020,7 +1017,7 @@ static void versionblock2res(ver_block_t *blk, int level, const language_t *lang
{
{
put_word
(
level
);
put_word
(
level
);
}
}
put_string
(
val
->
key
,
TRUE
,
NULL
);
put_string
(
val
->
key
,
TRUE
,
0
);
align_output
(
4
);
align_output
(
4
);
tag
=
output_buffer_pos
;
tag
=
output_buffer_pos
;
for
(
i
=
0
;
i
<
val
->
value
.
words
->
nwords
;
i
++
)
for
(
i
=
0
;
i
<
val
->
value
.
words
->
nwords
;
i
++
)
...
@@ -1089,7 +1086,7 @@ static void versioninfo2res(name_id_t *name, versioninfo_t *ver)
...
@@ -1089,7 +1086,7 @@ static void versioninfo2res(name_id_t *name, versioninfo_t *ver)
set_word
(
valsizetag
,
output_buffer_pos
-
tag
);
set_word
(
valsizetag
,
output_buffer_pos
-
tag
);
/* Descend into the blocks */
/* Descend into the blocks */
for
(
blk
=
ver
->
blocks
;
blk
;
blk
=
blk
->
next
)
for
(
blk
=
ver
->
blocks
;
blk
;
blk
=
blk
->
next
)
versionblock2res
(
blk
,
0
,
win32
?
ver
->
lvc
.
language
:
NULL
);
versionblock2res
(
blk
,
0
,
win32
?
ver
->
lvc
.
language
:
0
);
/* Set root block's size */
/* Set root block's size */
set_word
(
rootblocksizetag
,
output_buffer_pos
-
rootblocksizetag
);
set_word
(
rootblocksizetag
,
output_buffer_pos
-
rootblocksizetag
);
set_res_size
(
restag
);
set_res_size
(
restag
);
...
...
tools/wrc/newstruc.c
View file @
49bea92b
...
@@ -185,7 +185,7 @@ ani_any_t *new_ani_any(void)
...
@@ -185,7 +185,7 @@ ani_any_t *new_ani_any(void)
return
ret
;
return
ret
;
}
}
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
*
lan
)
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
lan
)
{
{
resource_t
*
r
=
xmalloc
(
sizeof
(
resource_t
));
resource_t
*
r
=
xmalloc
(
sizeof
(
resource_t
));
memset
(
r
,
0
,
sizeof
(
*
r
)
);
memset
(
r
,
0
,
sizeof
(
*
r
)
);
...
@@ -210,20 +210,6 @@ characts_t *new_characts(unsigned int c)
...
@@ -210,20 +210,6 @@ characts_t *new_characts(unsigned int c)
return
cp
;
return
cp
;
}
}
language_t
*
new_language
(
int
id
,
int
sub
)
{
language_t
*
lan
=
xmalloc
(
sizeof
(
language_t
));
lan
->
id
=
id
;
lan
->
sub
=
sub
;
return
lan
;
}
language_t
*
dup_language
(
language_t
*
l
)
{
if
(
!
l
)
return
NULL
;
return
new_language
(
l
->
id
,
l
->
sub
);
}
version_t
*
dup_version
(
version_t
*
v
)
version_t
*
dup_version
(
version_t
*
v
)
{
{
if
(
!
v
)
return
NULL
;
if
(
!
v
)
return
NULL
;
...
@@ -337,10 +323,9 @@ typedef struct {
...
@@ -337,10 +323,9 @@ typedef struct {
int
id
;
int
id
;
}
id_alloc_t
;
}
id_alloc_t
;
static
int
get_new_id
(
id_alloc_t
**
list
,
int
*
n
,
language_t
*
lan
)
static
int
get_new_id
(
id_alloc_t
**
list
,
int
*
n
,
language_t
lan
)
{
{
int
i
;
int
i
;
assert
(
lan
!=
NULL
);
assert
(
list
!=
NULL
);
assert
(
list
!=
NULL
);
assert
(
n
!=
NULL
);
assert
(
n
!=
NULL
);
...
@@ -348,25 +333,25 @@ static int get_new_id(id_alloc_t **list, int *n, language_t *lan)
...
@@ -348,25 +333,25 @@ static int get_new_id(id_alloc_t **list, int *n, language_t *lan)
{
{
*
list
=
xmalloc
(
sizeof
(
id_alloc_t
));
*
list
=
xmalloc
(
sizeof
(
id_alloc_t
));
*
n
=
1
;
*
n
=
1
;
(
*
list
)[
0
].
lan
=
*
lan
;
(
*
list
)[
0
].
lan
=
lan
;
(
*
list
)[
0
].
id
=
1
;
(
*
list
)[
0
].
id
=
1
;
return
1
;
return
1
;
}
}
for
(
i
=
0
;
i
<
*
n
;
i
++
)
for
(
i
=
0
;
i
<
*
n
;
i
++
)
{
{
if
((
*
list
)[
i
].
lan
.
id
==
lan
->
id
&&
(
*
list
)[
i
].
lan
.
sub
==
lan
->
sub
)
if
((
*
list
)[
i
].
lan
==
lan
)
return
++
((
*
list
)[
i
].
id
);
return
++
((
*
list
)[
i
].
id
);
}
}
*
list
=
xrealloc
(
*
list
,
sizeof
(
id_alloc_t
)
*
(
*
n
+
1
));
*
list
=
xrealloc
(
*
list
,
sizeof
(
id_alloc_t
)
*
(
*
n
+
1
));
(
*
list
)[
*
n
].
lan
=
*
lan
;
(
*
list
)[
*
n
].
lan
=
lan
;
(
*
list
)[
*
n
].
id
=
1
;
(
*
list
)[
*
n
].
id
=
1
;
*
n
+=
1
;
*
n
+=
1
;
return
1
;
return
1
;
}
}
static
int
alloc_icon_id
(
language_t
*
lan
)
static
int
alloc_icon_id
(
language_t
lan
)
{
{
static
id_alloc_t
*
idlist
=
NULL
;
static
id_alloc_t
*
idlist
=
NULL
;
static
int
nid
=
0
;
static
int
nid
=
0
;
...
@@ -374,7 +359,7 @@ static int alloc_icon_id(language_t *lan)
...
@@ -374,7 +359,7 @@ static int alloc_icon_id(language_t *lan)
return
get_new_id
(
&
idlist
,
&
nid
,
lan
);
return
get_new_id
(
&
idlist
,
&
nid
,
lan
);
}
}
static
int
alloc_cursor_id
(
language_t
*
lan
)
static
int
alloc_cursor_id
(
language_t
lan
)
{
{
static
id_alloc_t
*
idlist
=
NULL
;
static
id_alloc_t
*
idlist
=
NULL
;
static
int
nid
=
0
;
static
int
nid
=
0
;
...
...
tools/wrc/newstruc.h
View file @
49bea92b
...
@@ -42,11 +42,9 @@ res_count_t *new_res_count(void);
...
@@ -42,11 +42,9 @@ res_count_t *new_res_count(void);
string_t
*
new_string
(
void
);
string_t
*
new_string
(
void
);
toolbar_item_t
*
new_toolbar_item
(
void
);
toolbar_item_t
*
new_toolbar_item
(
void
);
ani_any_t
*
new_ani_any
(
void
);
ani_any_t
*
new_ani_any
(
void
);
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
*
lan
);
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
lan
);
version_t
*
new_version
(
unsigned
int
v
);
version_t
*
new_version
(
unsigned
int
v
);
characts_t
*
new_characts
(
unsigned
int
c
);
characts_t
*
new_characts
(
unsigned
int
c
);
language_t
*
new_language
(
int
id
,
int
sub
);
language_t
*
dup_language
(
language_t
*
l
);
version_t
*
dup_version
(
version_t
*
v
);
version_t
*
dup_version
(
version_t
*
v
);
characts_t
*
dup_characts
(
characts_t
*
c
);
characts_t
*
dup_characts
(
characts_t
*
c
);
html_t
*
new_html
(
raw_data_t
*
rd
,
int
*
memopt
);
html_t
*
new_html
(
raw_data_t
*
rd
,
int
*
memopt
);
...
...
tools/wrc/parser.y
View file @
49bea92b
...
@@ -174,7 +174,7 @@ static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
...
@@ -174,7 +174,7 @@ static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2);
static raw_data_t *str2raw_data(string_t *str);
static raw_data_t *str2raw_data(string_t *str);
static raw_data_t *int2raw_data(int i);
static raw_data_t *int2raw_data(int i);
static raw_data_t *long2raw_data(int i);
static raw_data_t *long2raw_data(int i);
static raw_data_t *load_file(string_t *name, language_t
*
lang);
static raw_data_t *load_file(string_t *name, language_t lang);
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid);
static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev);
static event_t *add_event(int key, int id, int flags, event_t *prev);
static event_t *add_event(int key, int id, int flags, event_t *prev);
...
@@ -182,7 +182,7 @@ static name_id_t *convert_ctlclass(name_id_t *cls);
...
@@ -182,7 +182,7 @@ static name_id_t *convert_ctlclass(name_id_t *cls);
static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
static dialog_t *dialog_language(language_t
*
l, dialog_t *dlg);
static dialog_t *dialog_language(language_t l, dialog_t *dlg);
static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg);
static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg);
...
@@ -227,7 +227,7 @@ static int rsrcid_to_token(int lookahead);
...
@@ -227,7 +227,7 @@ static int rsrcid_to_token(int lookahead);
control_t *ctl;
control_t *ctl;
name_id_t *nid;
name_id_t *nid;
font_id_t *fntid;
font_id_t *fntid;
language_t
*
lan;
language_t lan;
version_t *ver;
version_t *ver;
characts_t *chars;
characts_t *chars;
event_t *event;
event_t *event;
...
@@ -388,8 +388,7 @@ resources
...
@@ -388,8 +388,7 @@ resources
while(rsc)
while(rsc)
{
{
if(rsc->type
==
head->type
if(rsc->type
==
head->type
&&
rsc->lan->id
==
head->lan->id
&&
rsc->lan
==
head->lan
&&
rsc->lan->sub
==
head->lan->sub
&&
!compare_name_id(rsc->name,
head->name)
&&
!compare_name_id(rsc->name,
head->name)
&&
(rsc->type
!=
res_usr
||
!compare_name_id(rsc->res.usr->type,head->res.usr->type)))
&&
(rsc->type
!=
res_usr
||
!compare_name_id(rsc->res.usr->type,head->res.usr->type)))
{
{
...
@@ -503,12 +502,11 @@ resource
...
@@ -503,12 +502,11 @@ resource
if(!win32)
if(!win32)
parser_warning("LANGUAGE
not
supported
in
16-bit
mode\n");
parser_warning("LANGUAGE
not
supported
in
16-bit
mode\n");
free(currentlanguage);
currentlanguage
=
MAKELANGID($3,
$5);
if
(get_language_codepage($3,
$5)
==
-1)
if
(get_language_codepage(currentlanguage)
==
-1)
yyerror(
"Language
%04x
is
not
supported",
($5<<10)
+
$3);
yyerror(
"Language
%04x
is
not
supported",
currentlanguage);
currentlanguage
=
new_language($3,
$5);
$$
=
NULL;
$$
=
NULL;
chat("Got
LANGUAGE
%d,%d
(0x%04x)\n",
$3,
$5,
($5<<10)
+
$3
);
chat("Got
LANGUAGE
%d,%d
(0x%04x)\n",
$3,
$5,
currentlanguage
);
}
}
;
;
...
@@ -744,8 +742,7 @@ accelerators
...
@@ -744,8 +742,7 @@ accelerators
$$->lvc
=
*($3);
$$->lvc
=
*($3);
free($3);
free($3);
}
}
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
);
}
}
;
;
...
@@ -807,8 +804,7 @@ dialog : tDIALOG loadmemopts expr ',' expr ',' expr ',' expr dlg_attributes
...
@@ -807,8 +804,7 @@ dialog : tDIALOG loadmemopts expr ',' expr ',' expr ',' expr dlg_attributes
$$
-
>
style-
>
or_mask
&=
~(
$$
-
>
style-
>
and_mask
);
$$
-
>
style-
>
or_mask
&=
~(
$$
-
>
style-
>
and_mask
);
$$
-
>
style-
>
and_mask
=
0
;
$$
-
>
style-
>
and_mask
=
0
;
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
);
}
}
;
;
...
@@ -1023,8 +1019,7 @@ dialogex: tDIALOGEX loadmemopts expr ',' expr ',' expr ',' expr helpid dlgex_att
...
@@ -1023,8 +1019,7 @@ dialogex: tDIALOGEX loadmemopts expr ',' expr ',' expr ',' expr helpid dlgex_att
$$
-
>
style-
>
or_mask
&=
~(
$$
-
>
style-
>
and_mask
);
$$
-
>
style-
>
or_mask
&=
~(
$$
-
>
style-
>
and_mask
);
$$
-
>
style-
>
and_mask
=
0
;
$$
-
>
style-
>
and_mask
=
0
;
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
);
}
}
;
;
...
@@ -1200,8 +1195,7 @@ menu : tMENU loadmemopts opt_lvc menu_body {
...
@@ -1200,8 +1195,7 @@ menu : tMENU loadmemopts opt_lvc menu_body {
$$->lvc
=
*($3);
$$->lvc
=
*($3);
free($3);
free($3);
}
}
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
);
}
}
;
;
...
@@ -1276,8 +1270,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body {
...
@@ -1276,8 +1270,7 @@ menuex : tMENUEX loadmemopts opt_lvc menuex_body {
$$->lvc
=
*($3);
$$->lvc
=
*($3);
free($3);
free($3);
}
}
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
);
}
}
;
;
...
@@ -1492,7 +1485,7 @@ versioninfo
...
@@ -1492,7 +1485,7 @@ versioninfo
$$
-
>
memopt
=
WRC_MO_MOVEABLE
|
(
win32
?
WRC_MO_PURE
:
0
);
$$
-
>
memopt
=
WRC_MO_MOVEABLE
|
(
win32
?
WRC_MO_PURE
:
0
);
$$
-
>
blocks
=
get_ver_block_head
(
$
5
);
$$
-
>
blocks
=
get_ver_block_head
(
$
5
);
/* Set language; there is no version or characteristics */
/* Set language; there is no version or characteristics */
$$
-
>
lvc
.language
=
dup_language
(
currentlanguage
)
;
$$
-
>
lvc
.language
=
currentlanguage
;
}
}
;
;
...
@@ -1627,10 +1620,7 @@ toolbar: tTOOLBAR loadmemopts expr ',' expr opt_lvc tBEGIN toolbar_items tEND {
...
@@ -1627,10 +1620,7 @@ toolbar: tTOOLBAR loadmemopts expr ',' expr opt_lvc tBEGIN toolbar_items tEND {
$$->lvc
=
*($6);
$$->lvc
=
*($6);
free($6);
free($6);
}
}
if
(!
$$
-
>
lvc
.language
)
if
(!
$$
-
>
lvc
.language
)
$$
-
>
lvc
.language
=
currentlanguage
;
{
$$->lvc.language
=
dup_language(currentlanguage);
}
}
}
;
;
...
@@ -1730,9 +1720,9 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
...
@@ -1730,9 +1720,9 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); }
* The conflict is now moved to the expression handling below.
* The conflict is now moved to the expression handling below.
*/
*/
opt_language
opt_language
:
tLANGUAGE
expr
','
expr
{
$$
=
new_language
($2,
$4);
:
tLANGUAGE
expr
','
expr
{
$$
=
MAKELANGID
($2,
$4);
if
(get_language_codepage($
2,
$4
)
==
-1)
if
(get_language_codepage($
$
)
==
-1)
yyerror(
"Language
%04x
is
not
supported",
($4<<10)
+
$2
);
yyerror(
"Language
%04x
is
not
supported",
$$
);
}
}
;
;
...
@@ -1753,7 +1743,7 @@ raw_data: opt_lvc tBEGIN raw_elements tEND {
...
@@ -1753,7 +1743,7 @@ raw_data: opt_lvc tBEGIN raw_elements tEND {
}
}
if
(!
$
3-
>
lvc
.language
)
if
(!
$
3-
>
lvc
.language
)
$
3-
>
lvc
.language
=
dup_language
(
currentlanguage
)
;
$
3-
>
lvc
.language
=
currentlanguage
;
$$
=
$
3
;
$$
=
$
3
;
}
}
...
@@ -1775,7 +1765,7 @@ raw_elements
...
@@ -1775,7 +1765,7 @@ raw_elements
;
;
/* File data or raw data */
/* File data or raw data */
file_raw
:
filename
{
$$
=
load_file($1,
dup_language(currentlanguage)
);
}
file_raw
:
filename
{
$$
=
load_file($1,
currentlanguage
);
}
|
raw_data
{
$$
=
$1;
}
|
raw_data
{
$$
=
$1;
}
;
;
...
@@ -1896,7 +1886,7 @@ static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg)
...
@@ -1896,7 +1886,7 @@ static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg)
return
dlg;
return
dlg;
}
}
static
dialog_t
*
dialog_language
(
language_t
*
l
,
dialog_t
*
dlg
)
static
dialog_t
*
dialog_language
(
language_t
l
,
dialog_t
*
dlg
)
{
{
assert(dlg
!=
NULL);
assert(dlg
!=
NULL);
if(dlg->lvc.language)
if(dlg->lvc.language)
...
@@ -2152,7 +2142,7 @@ static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
...
@@ -2152,7 +2142,7 @@ static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
}
}
/* Raw data functions */
/* Raw data functions */
static
raw_data_t
*
load_file
(
string_t
*
filename
,
language_t
*
lang
)
static
raw_data_t
*
load_file
(
string_t
*
filename
,
language_t
lang
)
{
{
FILE
*fp
=
NULL;
FILE
*fp
=
NULL;
char
*path,
*name;
char
*path,
*name;
...
@@ -2334,12 +2324,11 @@ static stringtable_t *find_stringtable(lvc_t *lvc)
...
@@ -2334,12 +2324,11 @@ static stringtable_t *find_stringtable(lvc_t *lvc)
assert(lvc
!=
NULL);
assert(lvc
!=
NULL);
if(!lvc->language)
if(!lvc->language)
lvc->language
=
dup_language(currentlanguage)
;
lvc->language
=
currentlanguage
;
for(stt
=
sttres;
stt;
stt
=
stt->next)
for(stt
=
sttres;
stt;
stt
=
stt->next)
{
{
if(stt->lvc.language->id
==
lvc->language->id
if(stt->lvc.language
==
lvc->language)
&&
stt->lvc.language->sub
==
lvc->language->sub)
{
{
/* Found a table with the same language */
/* Found a table with the same language */
/* The version and characteristics are now handled
/* The version and characteristics are now handled
...
@@ -2640,7 +2629,7 @@ static resource_t *build_fontdirs(resource_t *tail)
...
@@ -2640,7 +2629,7 @@ static resource_t *build_fontdirs(resource_t *tail)
{
{
if(!fnt[j])
if(!fnt[j])
continue;
continue;
if(fnt[j]->lan
->id
==
fnd[i]->lan->id
&&
fnt[j]->lan->sub
==
fnd[i]->lan->sub
)
if(fnt[j]->lan
==
fnd[i]->lan
)
{
{
lanfnt[nlanfnt]
=
fnt[j];
lanfnt[nlanfnt]
=
fnt[j];
nlanfnt++;
nlanfnt++;
...
@@ -2670,7 +2659,7 @@ static resource_t *build_fontdirs(resource_t *tail)
...
@@ -2670,7 +2659,7 @@ static resource_t *build_fontdirs(resource_t *tail)
fnt[i]
=
NULL;
fnt[i]
=
NULL;
fntleft--;
fntleft--;
}
}
else
if
(
fnt
[
i
]
-
>
lan
-
>
id
==
lanfnt
[
0
]
-
>
lan-
>
id
&&
fnt
[
i
]
-
>
lan-
>
sub
==
lanfnt
[
0
]
-
>
lan-
>
sub
)
else
if
(
fnt
[
i
]
-
>
lan
==
lanfnt
[
0
]
-
>
lan
)
goto
addlanfnt
;
goto
addlanfnt
;
}
}
}
}
...
...
tools/wrc/po.c
View file @
49bea92b
This diff is collapsed.
Click to expand it.
tools/wrc/utils.c
View file @
49bea92b
...
@@ -673,15 +673,15 @@ static const struct lang2cp lang2cps[] =
...
@@ -673,15 +673,15 @@ static const struct lang2cp lang2cps[] =
{
LANG_ZULU
,
SUBLANG_NEUTRAL
,
1252
}
{
LANG_ZULU
,
SUBLANG_NEUTRAL
,
1252
}
};
};
int
get_language_codepage
(
unsigned
short
lang
,
unsigned
short
sub
lang
)
int
get_language_codepage
(
language_t
lang
)
{
{
unsigned
int
i
;
unsigned
int
i
;
int
cp
=
-
1
,
defcp
=
-
1
;
int
cp
=
-
1
,
defcp
=
-
1
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lang2cps
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lang2cps
);
i
++
)
{
{
if
(
lang2cps
[
i
].
lang
!=
lang
)
continue
;
if
(
lang2cps
[
i
].
lang
!=
PRIMARYLANGID
(
lang
)
)
continue
;
if
(
lang2cps
[
i
].
sublang
==
sublang
)
if
(
lang2cps
[
i
].
sublang
==
SUBLANGID
(
lang
)
)
{
{
cp
=
lang2cps
[
i
].
cp
;
cp
=
lang2cps
[
i
].
cp
;
break
;
break
;
...
...
tools/wrc/utils.h
View file @
49bea92b
...
@@ -38,7 +38,7 @@ string_t *convert_string_unicode( const string_t *str, int codepage );
...
@@ -38,7 +38,7 @@ string_t *convert_string_unicode( const string_t *str, int codepage );
char
*
convert_string_utf8
(
const
string_t
*
str
,
int
codepage
);
char
*
convert_string_utf8
(
const
string_t
*
str
,
int
codepage
);
void
free_string
(
string_t
*
str
);
void
free_string
(
string_t
*
str
);
int
check_valid_utf8
(
const
string_t
*
str
,
int
codepage
);
int
check_valid_utf8
(
const
string_t
*
str
,
int
codepage
);
int
get_language_codepage
(
unsigned
short
lang
,
unsigned
short
sub
lang
);
int
get_language_codepage
(
language_t
lang
);
int
is_valid_codepage
(
int
cp
);
int
is_valid_codepage
(
int
cp
);
#endif
#endif
tools/wrc/wrc.c
View file @
49bea92b
...
@@ -109,8 +109,8 @@ int extensions = 1;
...
@@ -109,8 +109,8 @@ int extensions = 1;
/*
/*
* Language setting for resources (-l option)
* Language setting for resources (-l option)
*/
*/
static
language_t
*
defaultlanguage
;
static
language_t
defaultlanguage
;
language_t
*
currentlanguage
=
NULL
;
language_t
currentlanguage
=
0
;
/*
/*
* Set when extra warnings should be generated (-W option)
* Set when extra warnings should be generated (-W option)
...
@@ -271,7 +271,7 @@ static int load_file( const char *input_name, const char *output_name )
...
@@ -271,7 +271,7 @@ static int load_file( const char *input_name, const char *output_name )
}
}
/* Reset the language */
/* Reset the language */
currentlanguage
=
d
up_language
(
defaultlanguage
)
;
currentlanguage
=
d
efaultlanguage
;
check_utf8
=
1
;
check_utf8
=
1
;
/* Go from .rc to .res */
/* Go from .rc to .res */
...
@@ -288,7 +288,6 @@ static int load_file( const char *input_name, const char *output_name )
...
@@ -288,7 +288,6 @@ static int load_file( const char *input_name, const char *output_name )
unlink
(
temp_name
);
unlink
(
temp_name
);
temp_name
=
NULL
;
temp_name
=
NULL
;
}
}
free
(
currentlanguage
);
return
ret
;
return
ret
;
}
}
...
@@ -376,14 +375,10 @@ static void option_callback( int optc, char *optarg )
...
@@ -376,14 +375,10 @@ static void option_callback( int optc, char *optarg )
else
if
(
strcmp
(
optarg
,
"rc"
))
error
(
"Output format %s not supported.
\n
"
,
optarg
);
else
if
(
strcmp
(
optarg
,
"rc"
))
error
(
"Output format %s not supported.
\n
"
,
optarg
);
break
;
break
;
case
'l'
:
case
'l'
:
{
defaultlanguage
=
strtol
(
optarg
,
NULL
,
0
);
int
lan
;
if
(
get_language_codepage
(
defaultlanguage
)
==
-
1
)
lan
=
strtol
(
optarg
,
NULL
,
0
);
error
(
"Language %04x is not supported
\n
"
,
defaultlanguage
);
if
(
get_language_codepage
(
PRIMARYLANGID
(
lan
),
SUBLANGID
(
lan
))
==
-
1
)
break
;
error
(
"Language %04x is not supported
\n
"
,
lan
);
defaultlanguage
=
new_language
(
PRIMARYLANGID
(
lan
),
SUBLANGID
(
lan
));
}
break
;
case
'm'
:
case
'm'
:
if
(
!
strcmp
(
optarg
,
"16"
))
win32
=
0
;
if
(
!
strcmp
(
optarg
,
"16"
))
win32
=
0
;
else
win32
=
1
;
else
win32
=
1
;
...
@@ -474,10 +469,6 @@ int main(int argc,char *argv[])
...
@@ -474,10 +469,6 @@ int main(int argc,char *argv[])
(
debuglevel
&
DEBUGLEVEL_PPTRACE
)
!=
0
,
(
debuglevel
&
DEBUGLEVEL_PPTRACE
)
!=
0
,
(
debuglevel
&
DEBUGLEVEL_PPMSG
)
!=
0
);
(
debuglevel
&
DEBUGLEVEL_PPMSG
)
!=
0
);
/* Check if the user set a language, else set default */
if
(
!
defaultlanguage
)
defaultlanguage
=
new_language
(
0
,
0
);
atexit
(
cleanup_files
);
atexit
(
cleanup_files
);
for
(
i
=
0
;
i
<
input_files
.
count
;
i
++
)
for
(
i
=
0
;
i
<
input_files
.
count
;
i
++
)
...
...
tools/wrc/wrc.h
View file @
49bea92b
...
@@ -48,7 +48,7 @@ extern int line_number;
...
@@ -48,7 +48,7 @@ extern int line_number;
extern
int
char_number
;
extern
int
char_number
;
extern
resource_t
*
resource_top
;
extern
resource_t
*
resource_top
;
extern
language_t
*
currentlanguage
;
extern
language_t
currentlanguage
;
void
write_pot_file
(
const
char
*
outname
);
void
write_pot_file
(
const
char
*
outname
);
void
write_po_files
(
const
char
*
outname
);
void
write_po_files
(
const
char
*
outname
);
...
...
tools/wrc/wrctypes.h
View file @
49bea92b
...
@@ -102,17 +102,12 @@ typedef struct name_id {
...
@@ -102,17 +102,12 @@ typedef struct name_id {
enum
name_e
type
;
enum
name_e
type
;
}
name_id_t
;
}
name_id_t
;
/* Language definitions */
typedef
unsigned
int
language_t
;
typedef
struct
language
{
int
id
;
int
sub
;
}
language_t
;
typedef
unsigned
int
characts_t
;
typedef
unsigned
int
characts_t
;
typedef
unsigned
int
version_t
;
typedef
unsigned
int
version_t
;
typedef
struct
lvc
{
typedef
struct
lvc
{
language_t
*
language
;
language_t
language
;
version_t
*
version
;
version_t
*
version
;
characts_t
*
characts
;
characts_t
*
characts
;
}
lvc_t
;
}
lvc_t
;
...
@@ -555,7 +550,7 @@ typedef struct resource {
...
@@ -555,7 +550,7 @@ typedef struct resource {
struct
resource
*
prev
;
struct
resource
*
prev
;
enum
res_e
type
;
enum
res_e
type
;
name_id_t
*
name
;
/* resource's name */
name_id_t
*
name
;
/* resource's name */
language_t
*
lan
;
/* Only used as a sorting key and c-name creation*/
language_t
lan
;
/* Only used as a sorting key and c-name creation*/
union
{
union
{
accelerator_t
*
acc
;
accelerator_t
*
acc
;
ani_curico_t
*
ani
;
ani_curico_t
*
ani
;
...
...
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