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
d0a6c806
Commit
d0a6c806
authored
Dec 30, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Explicitly define structure creation functions instead of playing with macros.
parent
5fabc5cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
51 deletions
+153
-51
newstruc.c
tools/wrc/newstruc.c
+134
-21
newstruc.h
tools/wrc/newstruc.h
+19
-30
No files found.
tools/wrc/newstruc.c
View file @
d0a6c806
...
...
@@ -45,31 +45,144 @@ typedef struct
}
BITMAPOS2HEADER
;
#include <poppack.h>
/* Generate new_* functions that have no parameters (NOTE: no ';') */
__NEW_STRUCT_FUNC
(
dialog
)
__NEW_STRUCT_FUNC
(
name_id
)
__NEW_STRUCT_FUNC
(
menu
)
__NEW_STRUCT_FUNC
(
menu_item
)
__NEW_STRUCT_FUNC
(
control
)
__NEW_STRUCT_FUNC
(
icon
)
__NEW_STRUCT_FUNC
(
cursor
)
__NEW_STRUCT_FUNC
(
versioninfo
)
__NEW_STRUCT_FUNC
(
ver_value
)
__NEW_STRUCT_FUNC
(
ver_block
)
__NEW_STRUCT_FUNC
(
stt_entry
)
__NEW_STRUCT_FUNC
(
accelerator
)
__NEW_STRUCT_FUNC
(
event
)
__NEW_STRUCT_FUNC
(
raw_data
)
__NEW_STRUCT_FUNC
(
lvc
)
__NEW_STRUCT_FUNC
(
res_count
)
__NEW_STRUCT_FUNC
(
string
)
__NEW_STRUCT_FUNC
(
toolbar_item
)
__NEW_STRUCT_FUNC
(
ani_any
)
/* New instances for all types of structures */
/* Very inefficient (in size), but very functional :-]
* Especially for type-checking.
*/
dialog_t
*
new_dialog
(
void
)
{
dialog_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
name_id_t
*
new_name_id
(
void
)
{
name_id_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
menu_t
*
new_menu
(
void
)
{
menu_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
menu_item_t
*
new_menu_item
(
void
)
{
menu_item_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
control_t
*
new_control
(
void
)
{
control_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
icon_t
*
new_icon
(
void
)
{
icon_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
cursor_t
*
new_cursor
(
void
)
{
cursor_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
versioninfo_t
*
new_versioninfo
(
void
)
{
versioninfo_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
ver_value_t
*
new_ver_value
(
void
)
{
ver_value_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
ver_block_t
*
new_ver_block
(
void
)
{
ver_block_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
stt_entry_t
*
new_stt_entry
(
void
)
{
stt_entry_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
accelerator_t
*
new_accelerator
(
void
)
{
accelerator_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
event_t
*
new_event
(
void
)
{
event_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
raw_data_t
*
new_raw_data
(
void
)
{
raw_data_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
lvc_t
*
new_lvc
(
void
)
{
lvc_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
res_count_t
*
new_res_count
(
void
)
{
res_count_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
string_t
*
new_string
(
void
)
{
string_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
toolbar_item_t
*
new_toolbar_item
(
void
)
{
toolbar_item_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
ani_any_t
*
new_ani_any
(
void
)
{
ani_any_t
*
ret
=
xmalloc
(
sizeof
(
*
ret
)
);
memset
(
ret
,
0
,
sizeof
(
*
ret
)
);
return
ret
;
}
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
*
lan
)
{
resource_t
*
r
=
xmalloc
(
sizeof
(
resource_t
));
...
...
tools/wrc/newstruc.h
View file @
d0a6c806
...
...
@@ -23,36 +23,25 @@
#include "wrctypes.h"
#define __NEW_STRUCT_FUNC(p) \
p##_t *new_##p(void)\
{\
p##_t * ret = xmalloc(sizeof(*ret)); \
memset( ret, 0, sizeof(*ret) ); \
return ret; \
}
#define __NEW_STRUCT_PROTO(p) p##_t *new_##p(void)
__NEW_STRUCT_PROTO
(
dialog
);
__NEW_STRUCT_PROTO
(
name_id
);
__NEW_STRUCT_PROTO
(
menu
);
__NEW_STRUCT_PROTO
(
menu_item
);
__NEW_STRUCT_PROTO
(
control
);
__NEW_STRUCT_PROTO
(
icon
);
__NEW_STRUCT_PROTO
(
cursor
);
__NEW_STRUCT_PROTO
(
versioninfo
);
__NEW_STRUCT_PROTO
(
ver_value
);
__NEW_STRUCT_PROTO
(
ver_block
);
__NEW_STRUCT_PROTO
(
stt_entry
);
__NEW_STRUCT_PROTO
(
accelerator
);
__NEW_STRUCT_PROTO
(
event
);
__NEW_STRUCT_PROTO
(
raw_data
);
__NEW_STRUCT_PROTO
(
lvc
);
__NEW_STRUCT_PROTO
(
res_count
);
__NEW_STRUCT_PROTO
(
string
);
__NEW_STRUCT_PROTO
(
toolbar_item
);
__NEW_STRUCT_PROTO
(
ani_any
);
dialog_t
*
new_dialog
(
void
);
name_id_t
*
new_name_id
(
void
);
menu_t
*
new_menu
(
void
);
menu_item_t
*
new_menu_item
(
void
);
control_t
*
new_control
(
void
);
icon_t
*
new_icon
(
void
);
cursor_t
*
new_cursor
(
void
);
versioninfo_t
*
new_versioninfo
(
void
);
ver_value_t
*
new_ver_value
(
void
);
ver_block_t
*
new_ver_block
(
void
);
stt_entry_t
*
new_stt_entry
(
void
);
accelerator_t
*
new_accelerator
(
void
);
event_t
*
new_event
(
void
);
raw_data_t
*
new_raw_data
(
void
);
lvc_t
*
new_lvc
(
void
);
res_count_t
*
new_res_count
(
void
);
string_t
*
new_string
(
void
);
toolbar_item_t
*
new_toolbar_item
(
void
);
ani_any_t
*
new_ani_any
(
void
);
resource_t
*
new_resource
(
enum
res_e
t
,
void
*
res
,
int
memopt
,
language_t
*
lan
);
version_t
*
new_version
(
DWORD
v
);
characts_t
*
new_characts
(
DWORD
c
);
...
...
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