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
5cb97d83
Commit
5cb97d83
authored
Sep 21, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate 16-bit spec files as assembly code too.
parent
331e09c2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
73 additions
and
184 deletions
+73
-184
Make.rules.in
Make.rules.in
+5
-4
Makefile.in
Makefile.in
+2
-2
Makedll.rules.in
dlls/Makedll.rules.in
+5
-5
Makefile.in
dlls/gdi/Makefile.in
+2
-2
Makefile.in
dlls/kernel/Makefile.in
+5
-10
Makefile.in
dlls/ntdll/Makefile.in
+3
-8
Makefile.in
dlls/shell32/Makefile.in
+2
-2
Makefile.in
dlls/user/Makefile.in
+6
-6
build.h
tools/winebuild/build.h
+2
-8
res16.c
tools/winebuild/res16.c
+41
-137
spec16.c
tools/winebuild/spec16.c
+0
-0
No files found.
Make.rules.in
View file @
5cb97d83
...
@@ -59,6 +59,7 @@ EXTRACFLAGS = @EXTRACFLAGS@
...
@@ -59,6 +59,7 @@ EXTRACFLAGS = @EXTRACFLAGS@
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
WINEBUILDFLAGS = $(DLLFLAGS) --as-cmd "$(AS)"
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
...
@@ -107,7 +108,7 @@ prog_manext = 1
...
@@ -107,7 +108,7 @@ prog_manext = 1
api_manext = 3w
api_manext = 3w
conf_manext = 5
conf_manext = 5
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
*.flc *.
spec.c *.
dbg.c *.tab.c *.tab.h @LEX_OUTPUT_ROOT@.c core
*.flc *.dbg.c *.tab.c *.tab.h @LEX_OUTPUT_ROOT@.c core
OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
...
@@ -116,7 +117,7 @@ LINTS = $(C_SRCS:.c=.ln)
...
@@ -116,7 +117,7 @@ LINTS = $(C_SRCS:.c=.ln)
# Implicit rules
# Implicit rules
.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.
c
.idl .tlb .h .ok .sfd .ttf
.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.
o
.idl .tlb .h .ok .sfd .ttf
.c.o:
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
$(CC) -c $(ALLCFLAGS) -o $@ $<
...
@@ -133,8 +134,8 @@ LINTS = $(C_SRCS:.c=.ln)
...
@@ -133,8 +134,8 @@ LINTS = $(C_SRCS:.c=.ln)
.res.res.o:
.res.res.o:
$(WINDRES) -i $< -o $@
$(WINDRES) -i $< -o $@
.spec.spec.
c
:
.spec.spec.
o
:
$(WINEBUILD) $(
DEF
S) --dll -o $@ --main-module $(MODULE) --export $<
$(WINEBUILD) $(
WINEBUILDFLAG
S) --dll -o $@ --main-module $(MODULE) --export $<
.idl.h:
.idl.h:
$(WIDL) $(IDLFLAGS) -h -H $@ $<
$(WIDL) $(IDLFLAGS) -h -H $@ $<
...
...
Makefile.in
View file @
5cb97d83
...
@@ -136,10 +136,10 @@ $(TESTSUBDIRS:%=%/__crosstest__): tools include
...
@@ -136,10 +136,10 @@ $(TESTSUBDIRS:%=%/__crosstest__): tools include
# Misc rules
# Misc rules
TAGS etags
:
TAGS etags
:
find
$(TOPSRCDIR)
-name
'*.[ch]'
-a
-not
-name
'*.
spec.c'
-a
-not
-name
'*.
dbg.c'
-print
| etags -
find
$(TOPSRCDIR)
-name
'*.[ch]'
-a
-not
-name
'*.dbg.c'
-print
| etags -
tags ctags
:
tags ctags
:
find
$(TOPSRCDIR)
-name
'*.[ch]'
-a
-not
-name
'*.
spec.c'
-a
-not
-name
'*.
dbg.c'
-print
| ctags
--c-types
=
+px
-L
-
find
$(TOPSRCDIR)
-name
'*.[ch]'
-a
-not
-name
'*.dbg.c'
-print
| ctags
--c-types
=
+px
-L
-
manpages htmlpages sgmlpages
:
manpages htmlpages sgmlpages
:
cd
documentation
&&
$(MAKE)
$@
cd
documentation
&&
$(MAKE)
$@
...
...
dlls/Makedll.rules.in
View file @
5cb97d83
...
@@ -67,7 +67,7 @@ lib$(BASEMODULE).a: $(SPEC_DEF) $(IMPLIB_OBJS)
...
@@ -67,7 +67,7 @@ lib$(BASEMODULE).a: $(SPEC_DEF) $(IMPLIB_OBJS)
$(WIN16_FILES:%=__checklink16__%): checklink16
$(WIN16_FILES:%=__checklink16__%): checklink16
checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
$(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_LIBS) -lwinecrt0 -lm && $(RM) checklink $(MAINSPEC).
s $(MAINSPEC).
o
$(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs $(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(ALL_LIBS) -lwinecrt0 -lm && $(RM) checklink $(MAINSPEC).o
checklink:: $(WIN16_FILES:%=__checklink16__%)
checklink:: $(WIN16_FILES:%=__checklink16__%)
...
@@ -77,10 +77,10 @@ check test:: $(SUBDIRS:%=%/__test__)
...
@@ -77,10 +77,10 @@ check test:: $(SUBDIRS:%=%/__test__)
crosstest:: $(SUBDIRS:%=%/__crosstest__)
crosstest:: $(SUBDIRS:%=%/__crosstest__)
# Rule to explicitly generate the .spec.
c
for debugging
# Rule to explicitly generate the .spec.
s
for debugging
$(MAINSPEC).s: $(MAINSPEC) $(ALL_OBJS)
$(MAINSPEC).s
$(MAINSPEC).o
: $(MAINSPEC) $(ALL_OBJS)
$(WINEBUILD) $(
DEFS) $(DLL
FLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%) $(DLLDIR)/libwinecrt0.a
$(WINEBUILD) $(
WINEBUILD
FLAGS) --dll -o $@ --export $(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) $(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%) $(DLLDIR)/libwinecrt0.a
# Rules for auto documentation
# Rules for auto documentation
...
@@ -137,6 +137,6 @@ uninstall::
...
@@ -137,6 +137,6 @@ uninstall::
clean::
clean::
$(RM) $(SPEC_DEF)
$(RM) $(SPEC_DEF)
$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.
c
): $(WINEBUILD)
$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.
o
): $(WINEBUILD)
# End of global dll rules
# End of global dll rules
dlls/gdi/Makefile.in
View file @
5cb97d83
...
@@ -71,8 +71,8 @@ EXTRASUBDIRS = \
...
@@ -71,8 +71,8 @@ EXTRASUBDIRS = \
# Special rules for 16-bit resource and spec files
# Special rules for 16-bit resource and spec files
gdi.exe.spec.
c
:
gdi.exe.spec version16.res
gdi.exe.spec.
o
:
gdi.exe.spec version16.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--heap
65520
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/gdi.exe.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--heap
65520
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/gdi.exe.spec
version16.res
:
version16.rc
version16.res
:
version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
...
...
dlls/kernel/Makefile.in
View file @
5cb97d83
...
@@ -84,8 +84,6 @@ C_SRCS16 = \
...
@@ -84,8 +84,6 @@ C_SRCS16 = \
toolhelp16.c
\
toolhelp16.c
\
win87em.c
win87em.c
ASM_SRCS
=
relay16asm.s
RC_SRCS
=
kernel.rc
RC_SRCS
=
kernel.rc
RC_SRCS16
=
\
RC_SRCS16
=
\
...
@@ -94,7 +92,7 @@ RC_SRCS16 = \
...
@@ -94,7 +92,7 @@ RC_SRCS16 = \
MC_SRCS
=
\
MC_SRCS
=
\
messages/winerr_enu.mc
messages/winerr_enu.mc
EXTRA_OBJS
=
$
(
ASM_SRCS:.s
=
.o
)
EXTRA_OBJS
=
relay16asm.o
SUBDIRS
=
tests
SUBDIRS
=
tests
EXTRASUBDIRS
=
messages nls
EXTRASUBDIRS
=
messages nls
...
@@ -102,18 +100,15 @@ EXTRASUBDIRS = messages nls
...
@@ -102,18 +100,15 @@ EXTRASUBDIRS = messages nls
kernel.res
:
$(MC_SRCS:.mc=.mc.rc)
kernel.res
:
$(MC_SRCS:.mc=.mc.rc)
relay16asm.
s
:
$(WINEBUILD)
relay16asm.
o
:
$(WINEBUILD)
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
-o
$@
--relay16
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
-o
$@
--relay16
# Special rules for 16-bit resource and spec files
# Special rules for 16-bit resource and spec files
krnl386.exe.spec.
c
:
krnl386.exe.spec version16.res
krnl386.exe.spec.
o
:
krnl386.exe.spec version16.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--dll-name
kernel
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/krnl386.exe.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--dll-name
kernel
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/krnl386.exe.spec
version16.res
:
version16.rc
version16.res
:
version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
clean
::
$(RM)
$(ASM_SRCS)
### Dependencies:
### Dependencies:
dlls/ntdll/Makefile.in
View file @
5cb97d83
...
@@ -49,18 +49,13 @@ C_SRCS = \
...
@@ -49,18 +49,13 @@ C_SRCS = \
virtual.c
\
virtual.c
\
wcstring.c
wcstring.c
ASM_SRCS
=
relay32.s
EXTRA_OBJS
=
relay32.o
EXTRA_OBJS
=
$
(
ASM_SRCS:.s
=
.o
)
SUBDIRS
=
tests
SUBDIRS
=
tests
@MAKE_DLL_RULES@
@MAKE_DLL_RULES@
relay32.s
:
$(WINEBUILD)
relay32.o
:
$(WINEBUILD)
$(WINEBUILD)
$(DEFS)
$(DLLFLAGS)
-o
$@
--relay32
$(WINEBUILD)
$(WINEBUILDFLAGS)
-o
$@
--relay32
clean
::
$(RM)
$(ASM_SRCS)
### Dependencies:
### Dependencies:
dlls/shell32/Makefile.in
View file @
5cb97d83
...
@@ -81,8 +81,8 @@ SUBDIRS = tests
...
@@ -81,8 +81,8 @@ SUBDIRS = tests
version16.res
:
version16.rc
version16.res
:
version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/version16.rc
shell.spec.
c
:
shell.spec version16.res
shell.spec.
o
:
shell.spec version16.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/shell.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
version16.res
--export
$(SRCDIR)
/shell.spec
authors.c
:
$(TOPSRCDIR)/AUTHORS
authors.c
:
$(TOPSRCDIR)/AUTHORS
(
LC_ALL
=
C
;
export
LC_ALL
;
echo
'const char * const SHELL_Authors[] = {'
&&
\
(
LC_ALL
=
C
;
export
LC_ALL
;
echo
'const char * const SHELL_Authors[] = {'
&&
\
...
...
dlls/user/Makefile.in
View file @
5cb97d83
...
@@ -152,14 +152,14 @@ EXTRASUBDIRS = resources
...
@@ -152,14 +152,14 @@ EXTRASUBDIRS = resources
# Special rules for 16-bit resource and spec files
# Special rules for 16-bit resource and spec files
user.exe.spec.
c
:
user.exe.spec resources/version16.res
user.exe.spec.
o
:
user.exe.spec resources/version16.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--heap
65520
--main-module
$(MODULE)
--res
resources/version16.res
--export
$(SRCDIR)
/user.exe.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--heap
65520
--main-module
$(MODULE)
--res
resources/version16.res
--export
$(SRCDIR)
/user.exe.spec
display.drv.spec.
c
:
display.drv.spec resources/display.res
display.drv.spec.
o
:
display.drv.spec resources/display.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
resources/display.res
--export
$(SRCDIR)
/display.drv.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
resources/display.res
--export
$(SRCDIR)
/display.drv.spec
mouse.drv.spec.
c
:
mouse.drv.spec resources/mouse.res
mouse.drv.spec.
o
:
mouse.drv.spec resources/mouse.res
$(WINEBUILD)
$(
DEFS)
$(DLL
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
resources/mouse.res
--export
$(SRCDIR)
/mouse.drv.spec
$(WINEBUILD)
$(
WINEBUILD
FLAGS)
--dll
-o
$@
--main-module
$(MODULE)
--res
resources/mouse.res
--export
$(SRCDIR)
/mouse.drv.spec
resources/display.res
:
resources/display.rc
resources/display.res
:
resources/display.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/resources/display.rc
$(LDPATH)
$(RC16)
$(RC16FLAGS)
-fo
$@
$(SRCDIR)
/resources/display.rc
...
...
tools/winebuild/build.h
View file @
5cb97d83
...
@@ -70,7 +70,6 @@ typedef struct
...
@@ -70,7 +70,6 @@ typedef struct
{
{
ORD_TYPE
type
;
ORD_TYPE
type
;
int
ordinal
;
int
ordinal
;
int
offset
;
int
lineno
;
int
lineno
;
int
flags
;
int
flags
;
char
*
name
;
/* public name of this function */
char
*
name
;
/* public name of this function */
...
@@ -206,13 +205,8 @@ extern void output_imports( FILE *outfile, DLLSPEC *spec );
...
@@ -206,13 +205,8 @@ extern void output_imports( FILE *outfile, DLLSPEC *spec );
extern
int
load_res32_file
(
const
char
*
name
,
DLLSPEC
*
spec
);
extern
int
load_res32_file
(
const
char
*
name
,
DLLSPEC
*
spec
);
extern
void
output_resources
(
FILE
*
outfile
,
DLLSPEC
*
spec
);
extern
void
output_resources
(
FILE
*
outfile
,
DLLSPEC
*
spec
);
extern
void
load_res16_file
(
const
char
*
name
,
DLLSPEC
*
spec
);
extern
void
load_res16_file
(
const
char
*
name
,
DLLSPEC
*
spec
);
extern
unsigned
int
get_res16_data_size
(
DLLSPEC
*
spec
,
unsigned
int
res_offset
,
extern
void
output_res16_data
(
FILE
*
outfile
,
DLLSPEC
*
spec
);
unsigned
int
alignment
);
extern
void
output_res16_directory
(
FILE
*
outfile
,
DLLSPEC
*
spec
,
const
char
*
header_name
);
extern
unsigned
int
output_res16_data
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
,
unsigned
int
res_offset
,
unsigned
int
alignment
);
extern
unsigned
int
get_res16_directory_size
(
DLLSPEC
*
spec
);
extern
unsigned
int
output_res16_directory
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
,
unsigned
int
res_offset
,
unsigned
int
alignment
);
extern
void
output_dll_init
(
FILE
*
outfile
,
const
char
*
constructor
,
const
char
*
destructor
);
extern
void
output_dll_init
(
FILE
*
outfile
,
const
char
*
constructor
,
const
char
*
destructor
);
extern
void
BuildRelays16
(
FILE
*
outfile
);
extern
void
BuildRelays16
(
FILE
*
outfile
);
...
...
tools/winebuild/res16.c
View file @
5cb97d83
...
@@ -241,189 +241,93 @@ static void free_resource_tree( struct res_tree *tree )
...
@@ -241,189 +241,93 @@ static void free_resource_tree( struct res_tree *tree )
free
(
tree
);
free
(
tree
);
}
}
inline
static
void
put_byte
(
unsigned
char
**
buffer
,
unsigned
char
val
)
{
*
(
*
buffer
)
++
=
val
;
}
inline
static
void
put_word
(
unsigned
char
**
buffer
,
WORD
val
)
{
#ifdef WORDS_BIGENDIAN
put_byte
(
buffer
,
HIBYTE
(
val
)
);
put_byte
(
buffer
,
LOBYTE
(
val
)
);
#else
put_byte
(
buffer
,
LOBYTE
(
val
)
);
put_byte
(
buffer
,
HIBYTE
(
val
)
);
#endif
}
/* output a string preceded by its length */
/* output a string preceded by its length */
static
void
output_string
(
unsigned
char
**
buffer
,
const
char
*
str
)
static
void
output_string
(
FILE
*
outfile
,
const
char
*
str
)
{
{
int
len
=
strlen
(
str
);
unsigned
int
i
,
len
=
strlen
(
str
);
put_byte
(
buffer
,
len
);
fprintf
(
outfile
,
"
\t
.byte 0x%02x"
,
len
);
while
(
len
--
)
put_byte
(
buffer
,
*
str
++
);
for
(
i
=
0
;
i
<
len
;
i
++
)
fprintf
(
outfile
,
",0x%02x"
,
(
unsigned
char
)
str
[
i
]
);
}
fprintf
(
outfile
,
" /* %s */
\n
"
,
str
);
/* get the resource data total size */
unsigned
int
get_res16_data_size
(
DLLSPEC
*
spec
,
unsigned
int
res_offset
,
unsigned
int
alignment
)
{
const
struct
resource
*
res
;
unsigned
int
i
,
total
;
unsigned
int
align_mask
=
(
1
<<
alignment
)
-
1
;
if
(
!
spec
->
nb_resources
)
return
0
;
/* add padding at the beginning if needed so that resources are properly aligned */
total
=
((
res_offset
+
align_mask
)
&
~
align_mask
)
-
res_offset
;
for
(
i
=
0
,
res
=
spec
->
resources
;
i
<
spec
->
nb_resources
;
i
++
,
res
++
)
total
+=
(
res
->
data_size
+
align_mask
)
&
~
align_mask
;
return
total
;
}
}
/* output the resource data */
/* output the resource data */
unsigned
int
output_res16_data
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
,
void
output_res16_data
(
FILE
*
outfile
,
DLLSPEC
*
spec
)
unsigned
int
res_offset
,
unsigned
int
alignment
)
{
{
const
struct
resource
*
res
;
const
struct
resource
*
res
;
unsigned
char
*
p
;
unsigned
int
i
;
unsigned
int
i
,
total
,
padding
;
unsigned
int
align_mask
=
(
1
<<
alignment
)
-
1
;
if
(
!
spec
->
nb_resources
)
return
0
;
/* add padding at the beginning if needed so that resources are properly aligned */
padding
=
((
res_offset
+
align_mask
)
&
~
align_mask
)
-
res_offset
;
for
(
i
=
total
=
0
,
res
=
spec
->
resources
;
i
<
spec
->
nb_resources
;
i
++
,
res
++
)
if
(
!
spec
->
nb_resources
)
return
;
total
+=
(
res
->
data_size
+
align_mask
)
&
~
align_mask
;
*
ret_buf
=
p
=
xmalloc
(
total
+
padding
);
memset
(
p
,
0
,
padding
);
p
+=
padding
;
for
(
i
=
0
,
res
=
spec
->
resources
;
i
<
spec
->
nb_resources
;
i
++
,
res
++
)
for
(
i
=
0
,
res
=
spec
->
resources
;
i
<
spec
->
nb_resources
;
i
++
,
res
++
)
{
{
unsigned
int
size
=
(
res
->
data_size
+
align_mask
)
&
~
align_mask
;
fprintf
(
outfile
,
".L__wine_spec_resource_%u:
\n
"
,
i
);
memcpy
(
p
,
res
->
data
,
res
->
data_size
);
dump_bytes
(
outfile
,
res
->
data
,
res
->
data_size
);
memset
(
p
+
res
->
data_size
,
0
,
size
-
res
->
data_size
);
fprintf
(
outfile
,
".L__wine_spec_resource_%u_end:
\n
"
,
i
);
p
+=
size
;
}
}
return
total
;
}
/* get the resource definitions total size */
unsigned
int
get_res16_directory_size
(
DLLSPEC
*
spec
)
{
unsigned
int
i
,
j
,
total_size
;
struct
res_tree
*
tree
;
const
struct
res_type
*
type
;
const
struct
resource
*
res
;
tree
=
build_resource_tree
(
spec
);
total_size
=
4
;
/* alignment + terminator */
total_size
+=
tree
->
nb_types
*
8
;
/* typeinfo structures */
total_size
+=
spec
->
nb_resources
*
12
;
/* nameinfo structures */
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
if
(
type
->
type
->
str
)
total_size
+=
strlen
(
type
->
type
->
str
)
+
1
;
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
if
(
res
->
name
.
str
)
total_size
+=
strlen
(
res
->
name
.
str
)
+
1
;
}
total_size
++
;
/* final terminator */
if
(
total_size
&
1
)
total_size
++
;
return
total_size
;
}
}
/* output the resource definitions */
/* output the resource definitions */
unsigned
int
output_res16_directory
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
,
void
output_res16_directory
(
FILE
*
outfile
,
DLLSPEC
*
spec
,
const
char
*
header_name
)
unsigned
int
res_offset
,
unsigned
int
alignment
)
{
{
int
offset
;
unsigned
int
i
,
j
;
unsigned
int
i
,
j
,
total_size
;
unsigned
int
align_mask
=
(
1
<<
alignment
)
-
1
;
struct
res_tree
*
tree
;
struct
res_tree
*
tree
;
const
struct
res_type
*
type
;
const
struct
res_type
*
type
;
const
struct
resource
*
res
;
const
struct
resource
*
res
;
unsigned
char
*
buffer
;
tree
=
build_resource_tree
(
spec
);
tree
=
build_resource_tree
(
spec
);
/* make sure data offset is properly aligned */
fprintf
(
outfile
,
"
\n
.L__wine_spec_ne_rsrctab:
\n
"
);
res_offset
=
(
res_offset
+
align_mask
)
&
~
align_mask
;
fprintf
(
outfile
,
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* alignment */
/* first compute total size */
offset
=
4
;
/* alignment + terminator */
offset
+=
tree
->
nb_types
*
8
;
/* typeinfo structures */
offset
+=
spec
->
nb_resources
*
12
;
/* nameinfo structures */
total_size
=
offset
;
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
if
(
type
->
type
->
str
)
total_size
+=
strlen
(
type
->
type
->
str
)
+
1
;
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
if
(
res
->
name
.
str
)
total_size
+=
strlen
(
res
->
name
.
str
)
+
1
;
}
total_size
++
;
/* final terminator */
if
(
total_size
&
1
)
total_size
++
;
*
ret_buf
=
buffer
=
xmalloc
(
total_size
);
put_word
(
&
buffer
,
alignment
);
/* type and name structures */
/* type and name structures */
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
{
if
(
type
->
type
->
str
)
if
(
type
->
type
->
str
)
{
fprintf
(
outfile
,
"
\t
%s .L__wine_spec_restype_%u-.L__wine_spec_ne_rsrctab
\n
"
,
put_word
(
&
buffer
,
offset
);
get_asm_short_keyword
(),
i
);
offset
+=
strlen
(
type
->
type
->
str
)
+
1
;
}
else
else
put_word
(
&
buffer
,
type
->
type
->
id
|
0x8000
);
fprintf
(
outfile
,
"
\t
%s 0x%04x
\n
"
,
get_asm_short_keyword
()
,
type
->
type
->
id
|
0x8000
);
put_word
(
&
buffer
,
type
->
nb_names
);
fprintf
(
outfile
,
"
\t
%s %u,0,0
\n
"
,
get_asm_short_keyword
(),
type
->
nb_names
);
put_word
(
&
buffer
,
0
);
put_word
(
&
buffer
,
0
);
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
{
{
put_word
(
&
buffer
,
res_offset
>>
alignment
);
fprintf
(
outfile
,
"
\t
%s .L__wine_spec_resource_%u-%s
\n
"
,
put_word
(
&
buffer
,
(
res
->
data_size
+
align_mask
)
>>
alignment
);
get_asm_short_keyword
(),
res
-
spec
->
resources
,
header_name
);
put_word
(
&
buffer
,
res
->
memopt
);
fprintf
(
outfile
,
"
\t
%s .L__wine_spec_resource_%u_end-.L__wine_spec_resource_%u
\n
"
,
get_asm_short_keyword
(),
res
-
spec
->
resources
,
res
-
spec
->
resources
);
fprintf
(
outfile
,
"
\t
%s 0x%04x
\n
"
,
get_asm_short_keyword
(),
res
->
memopt
);
if
(
res
->
name
.
str
)
if
(
res
->
name
.
str
)
{
fprintf
(
outfile
,
"
\t
%s .L__wine_spec_resname_%u_%u-.L__wine_spec_ne_rsrctab
\n
"
,
put_word
(
&
buffer
,
offset
);
get_asm_short_keyword
(),
i
,
j
);
offset
+=
strlen
(
res
->
name
.
str
)
+
1
;
}
else
else
put_word
(
&
buffer
,
res
->
name
.
id
|
0x8000
);
fprintf
(
outfile
,
"
\t
%s 0x%04x
\n
"
,
get_asm_short_keyword
(),
res
->
name
.
id
|
0x8000
);
put_word
(
&
buffer
,
0
);
put_word
(
&
buffer
,
0
);
fprintf
(
outfile
,
"
\t
%s 0,0
\n
"
,
get_asm_short_keyword
()
);
res_offset
+=
(
res
->
data_size
+
align_mask
)
&
~
align_mask
;
}
}
}
}
put_word
(
&
buffer
,
0
);
/* terminator */
fprintf
(
outfile
,
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* terminator */
/* name strings */
/* name strings */
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
{
if
(
type
->
type
->
str
)
output_string
(
&
buffer
,
type
->
type
->
str
);
if
(
type
->
type
->
str
)
{
fprintf
(
outfile
,
".L__wine_spec_restype_%u:
\n
"
,
i
);
output_string
(
outfile
,
type
->
type
->
str
);
}
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
{
{
if
(
res
->
name
.
str
)
output_string
(
&
buffer
,
res
->
name
.
str
);
if
(
res
->
name
.
str
)
{
fprintf
(
outfile
,
".L__wine_spec_resname_%u_%u:
\n
"
,
i
,
j
);
output_string
(
outfile
,
res
->
name
.
str
);
}
}
}
}
}
put_byte
(
&
buffer
,
0
);
/* names terminator */
fprintf
(
outfile
,
"
\t
.byte 0
\n
"
);
/* names terminator */
if
((
buffer
-
*
ret_buf
)
&
1
)
put_byte
(
&
buffer
,
0
);
/* align on word boundary */
assert
(
buffer
-
*
ret_buf
==
total_size
);
free_resource_tree
(
tree
);
free_resource_tree
(
tree
);
return
total_size
;
}
}
tools/winebuild/spec16.c
View file @
5cb97d83
This diff is collapsed.
Click to expand it.
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