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
deaf02a5
Commit
deaf02a5
authored
Feb 26, 2003
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Feb 26, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove assembly generation from wrc.
parent
f498d4b8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
231 deletions
+37
-231
wrc.c
tools/wrc/wrc.c
+24
-156
wrc.h
tools/wrc/wrc.h
+0
-4
wrc.man
tools/wrc/wrc.man
+13
-40
writeres.c
tools/wrc/writeres.c
+0
-0
writeres.h
tools/wrc/writeres.h
+0
-31
No files found.
tools/wrc/wrc.c
View file @
deaf02a5
...
@@ -65,7 +65,6 @@
...
@@ -65,7 +65,6 @@
#include "wrc.h"
#include "wrc.h"
#include "utils.h"
#include "utils.h"
#include "writeres.h"
#include "readres.h"
#include "readres.h"
#include "dumpres.h"
#include "dumpres.h"
#include "genres.h"
#include "genres.h"
...
@@ -86,7 +85,6 @@
...
@@ -86,7 +85,6 @@
static
char
usage
[]
=
static
char
usage
[]
=
"Usage: wrc [options...] [infile[.rc|.res]] [outfile]
\n
"
"Usage: wrc [options...] [infile[.rc|.res]] [outfile]
\n
"
" -a n Alignment of resource (win16 only, default is 4)
\n
"
" -a n Alignment of resource (win16 only, default is 4)
\n
"
" -b Create an assembly array from a binary .res file
\n
"
" -B x Set output byte-order x={n[ative], l[ittle], b[ig]}
\n
"
" -B x Set output byte-order x={n[ative], l[ittle], b[ig]}
\n
"
" (win32 only; default is "
ENDIAN
"-endian)
\n
"
" (win32 only; default is "
ENDIAN
"-endian)
\n
"
" -C cp Set the resource's codepage to cp (default is 0)
\n
"
" -C cp Set the resource's codepage to cp (default is 0)
\n
"
...
@@ -95,18 +93,15 @@ static char usage[] =
...
@@ -95,18 +93,15 @@ static char usage[] =
" -e Disable recognition of win32 keywords in 16bit compile
\n
"
" -e Disable recognition of win32 keywords in 16bit compile
\n
"
" -E Preprocess only
\n
"
" -E Preprocess only
\n
"
" -F target Ignored for compatibility with windres
\n
"
" -F target Ignored for compatibility with windres
\n
"
" -g Add symbols to the global c namespace
\n
"
" -h Prints this summary.
\n
"
" -h Prints this summary.
\n
"
" -i file The name of the input file.
\n
"
" -i file The name of the input file.
\n
"
" -I path Set include search dir to path (multiple -I allowed)
\n
"
" -I path Set include search dir to path (multiple -I allowed)
\n
"
" -J Do not search the standard include path
\n
"
" -J Do not search the standard include path
\n
"
" -l lan Set default language to lan (default is neutral {0, 0})
\n
"
" -l lan Set default language to lan (default is neutral {0, 0})
\n
"
" -m Do not remap numerical resource IDs
\n
"
" -m Do not remap numerical resource IDs
\n
"
" -o file Output to file (default is infile.[res|s]
\n
"
" -o file Output to file (default is infile.res)
\n
"
" -O format The output format: one of `res', 'asm'.
\n
"
" -O format The output format (must be `res').
\n
"
" -p prefix Give a prefix for the generated names
\n
"
" -P program Specifies the preprocessor to use, including arguments.
\n
"
" -P program Specifies the preprocessor to use, including arguments.
\n
"
" -s Add structure with win32/16 (PE/NE) resource directory
\n
"
" -v Enable verbose mode.
\n
"
" -v Enable verbose mode.
\n
"
" -V Print version and exit
\n
"
" -V Print version and exit
\n
"
" -w 16|32 Select win16 or win32 output (default is win32)
\n
"
" -w 16|32 Select win16 or win32 output (default is win32)
\n
"
...
@@ -136,7 +131,7 @@ static char usage[] =
...
@@ -136,7 +131,7 @@ static char usage[] =
" * 0x10 Preprocessor lex messages
\n
"
" * 0x10 Preprocessor lex messages
\n
"
" * 0x20 Preprocessor yacc trace
\n
"
" * 0x20 Preprocessor yacc trace
\n
"
"If no input filename is given and the output name is not overridden
\n
"
"If no input filename is given and the output name is not overridden
\n
"
"with -o, then the output is written to
\"
wrc.tab.
{s,res}
\"\n
"
"with -o, then the output is written to
\"
wrc.tab.
res
\"\n
"
;
;
char
version_string
[]
=
"Wine Resource Compiler Version "
WRC_FULLVERSION
"
\n
"
char
version_string
[]
=
"Wine Resource Compiler Version "
WRC_FULLVERSION
"
\n
"
...
@@ -144,10 +139,9 @@ char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
...
@@ -144,10 +139,9 @@ char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
" 1994 Martin von Loewis
\n
"
;
" 1994 Martin von Loewis
\n
"
;
/*
/*
* Default prefix for resource names used in the C array.
* External functions
* Option '-p name' sets it to 'name'
*/
*/
char
*
prefix
=
__ASM_NAME
(
"_Resource"
);
void
write_resfile
(
char
*
outname
,
resource_t
*
top
);
/*
/*
* Set if compiling in 32bit mode (default).
* Set if compiling in 32bit mode (default).
...
@@ -155,11 +149,6 @@ char *prefix = __ASM_NAME("_Resource");
...
@@ -155,11 +149,6 @@ char *prefix = __ASM_NAME("_Resource");
int
win32
=
1
;
int
win32
=
1
;
/*
/*
* Output type (default res)
*/
enum
output_t
{
output_def
,
output_res
,
output_asm
}
output_type
=
output_def
;
/*
* debuglevel == DEBUGLEVEL_NONE Don't bother
* debuglevel == DEBUGLEVEL_NONE Don't bother
* debuglevel & DEBUGLEVEL_CHAT Say whats done
* debuglevel & DEBUGLEVEL_CHAT Say whats done
* debuglevel & DEBUGLEVEL_DUMP Dump internal structures
* debuglevel & DEBUGLEVEL_DUMP Dump internal structures
...
@@ -177,22 +166,6 @@ int debuglevel = DEBUGLEVEL_NONE;
...
@@ -177,22 +166,6 @@ int debuglevel = DEBUGLEVEL_NONE;
int
extensions
=
1
;
int
extensions
=
1
;
/*
/*
* Set when creating C array from .res file (-b option).
*/
int
binary
=
0
;
/*
* Set when the NE/PE resource directory should be dumped into
* the output file.
*/
int
create_dir
=
0
;
/*
* Set when all symbols should be added to the global namespace (-g option)
*/
int
global
=
0
;
/*
* NE segment resource aligment (-a option)
* NE segment resource aligment (-a option)
*/
*/
int
alignment
=
4
;
int
alignment
=
4
;
...
@@ -250,7 +223,7 @@ static void rm_tempfile(void);
...
@@ -250,7 +223,7 @@ static void rm_tempfile(void);
static
void
segvhandler
(
int
sig
);
static
void
segvhandler
(
int
sig
);
static
const
char
*
short_options
=
static
const
char
*
short_options
=
"a:A
bB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:P:rs
tTvVw:W"
;
"a:A
B:cC:d:D:eEF:hH:i:I:Jl:LmnNo:O:P:r
tTvVw:W"
;
#ifdef HAVE_GETOPT_LONG
#ifdef HAVE_GETOPT_LONG
static
struct
option
long_options
[]
=
{
static
struct
option
long_options
[]
=
{
{
"input"
,
1
,
0
,
'i'
},
{
"input"
,
1
,
0
,
'i'
},
...
@@ -320,9 +293,6 @@ int main(int argc,char *argv[])
...
@@ -320,9 +293,6 @@ int main(int argc,char *argv[])
case
'a'
:
case
'a'
:
alignment
=
atoi
(
optarg
);
alignment
=
atoi
(
optarg
);
break
;
break
;
case
'b'
:
binary
=
1
;
break
;
case
'B'
:
case
'B'
:
switch
(
optarg
[
0
])
switch
(
optarg
[
0
])
{
{
...
@@ -361,9 +331,6 @@ int main(int argc,char *argv[])
...
@@ -361,9 +331,6 @@ int main(int argc,char *argv[])
case
'F'
:
case
'F'
:
/* ignored for compatibility with windres */
/* ignored for compatibility with windres */
break
;
break
;
case
'g'
:
global
=
1
;
break
;
case
'h'
:
case
'h'
:
printf
(
usage
);
printf
(
usage
);
exit
(
0
);
exit
(
0
);
...
@@ -394,20 +361,13 @@ int main(int argc,char *argv[])
...
@@ -394,20 +361,13 @@ int main(int argc,char *argv[])
else
error
(
"Too many output files.
\n
"
);
else
error
(
"Too many output files.
\n
"
);
break
;
break
;
case
'O'
:
case
'O'
:
if
(
strcmp
(
optarg
,
"res"
)
==
0
)
output_type
=
output_res
;
if
(
strcmp
(
optarg
,
"res"
))
else
if
(
strcmp
(
optarg
,
"asm"
)
==
0
)
output_type
=
output_asm
;
error
(
"Output format %s not supported."
,
optarg
);
else
error
(
"Output format %s not supported."
,
optarg
);
break
;
case
'p'
:
prefix
=
xstrdup
(
optarg
);
break
;
break
;
case
'P'
:
case
'P'
:
if
(
strcmp
(
optarg
,
"cat"
)
==
0
)
no_preprocess
=
1
;
if
(
strcmp
(
optarg
,
"cat"
)
==
0
)
no_preprocess
=
1
;
else
fprintf
(
stderr
,
"-P option not yet supported, ignored.
\n
"
);
else
fprintf
(
stderr
,
"-P option not yet supported, ignored.
\n
"
);
break
;
break
;
case
's'
:
create_dir
=
1
;
break
;
case
'v'
:
case
'v'
:
debuglevel
=
DEBUGLEVEL_CHAT
;
debuglevel
=
DEBUGLEVEL_CHAT
;
break
;
break
;
...
@@ -460,19 +420,6 @@ int main(int argc,char *argv[])
...
@@ -460,19 +420,6 @@ int main(int argc,char *argv[])
else
error
(
"Too many output files.
\n
"
);
else
error
(
"Too many output files.
\n
"
);
}
}
/* Try to guess the output format based on output name */
if
(
output_type
==
output_def
)
{
char
*
dotstr
=
output_name
?
strrchr
(
output_name
,
'.'
)
:
0
;
output_type
=
output_res
;
/* by default generate .res files */
if
(
dotstr
)
{
if
(
strcmp
(
dotstr
+
1
,
"s"
)
==
0
)
output_type
=
output_asm
;
}
}
/* Check the command line options for invalid combinations */
/* Check the command line options for invalid combinations */
if
(
win32
)
if
(
win32
)
{
{
...
@@ -483,51 +430,6 @@ int main(int argc,char *argv[])
...
@@ -483,51 +430,6 @@ int main(int argc,char *argv[])
}
}
}
}
if
(
output_type
==
output_res
)
{
if
(
global
)
{
warning
(
"Option -g ignored with compile to .res
\n
"
);
global
=
0
;
}
if
(
create_dir
)
{
error
(
"Option -r and -s cannot be used together
\n
"
);
}
if
(
binary
)
{
error
(
"Option -r and -b cannot be used together
\n
"
);
}
}
if
(
byteorder
!=
WRC_BO_NATIVE
)
{
if
(
binary
)
error
(
"Forced byteordering not supported for binary resources
\n
"
);
}
if
(
preprocess_only
)
{
if
(
global
)
{
warning
(
"Option -g ignored with preprocess only
\n
"
);
global
=
0
;
}
if
(
create_dir
)
{
warning
(
"Option -s ignored with preprocess only
\n
"
);
create_dir
=
0
;
}
if
(
binary
)
{
error
(
"Option -E and -b cannot be used together
\n
"
);
}
}
/* Set alignment power */
/* Set alignment power */
a
=
alignment
;
a
=
alignment
;
for
(
alignment_pwr
=
0
;
alignment_pwr
<
10
&&
a
>
1
;
alignment_pwr
++
)
for
(
alignment_pwr
=
0
;
alignment_pwr
<
10
&&
a
>
1
;
alignment_pwr
++
)
...
@@ -575,21 +477,15 @@ int main(int argc,char *argv[])
...
@@ -575,21 +477,15 @@ int main(int argc,char *argv[])
if
(
!
currentlanguage
)
if
(
!
currentlanguage
)
currentlanguage
=
new_language
(
0
,
0
);
currentlanguage
=
new_language
(
0
,
0
);
if
(
binary
&&
!
input_name
)
{
error
(
"Binary mode requires .res file as input
\n
"
);
}
/* Generate appropriate outfile names */
/* Generate appropriate outfile names */
if
(
!
output_name
&&
!
preprocess_only
)
if
(
!
output_name
&&
!
preprocess_only
)
{
{
output_name
=
dup_basename
(
input_name
,
binary
?
".res"
:
".rc"
);
output_name
=
dup_basename
(
input_name
,
".rc"
);
if
(
output_type
==
output_res
)
strcat
(
output_name
,
".res"
);
strcat
(
output_name
,
".res"
);
else
if
(
output_type
==
output_asm
)
strcat
(
output_name
,
".s"
);
}
}
/* Run the preprocessor on the input */
/* Run the preprocessor on the input */
if
(
!
no_preprocess
&&
!
binary
)
if
(
!
no_preprocess
)
{
{
/*
/*
* Preprocess the input to a temp-file, or stdout if
* Preprocess the input to a temp-file, or stdout if
...
@@ -626,54 +522,26 @@ int main(int argc,char *argv[])
...
@@ -626,54 +522,26 @@ int main(int argc,char *argv[])
input_name
=
temp_name
;
input_name
=
temp_name
;
}
}
if
(
!
binary
)
/* Go from .rc to .res */
{
chat
(
"Starting parse"
);
/* Go from .rc to .res or .s */
chat
(
"Starting parse"
);
if
(
!
(
yyin
=
fopen
(
input_name
,
"rb"
)))
error
(
"Could not open %s for input
\n
"
,
input_name
);
ret
=
yyparse
();
if
(
!
(
yyin
=
fopen
(
input_name
,
"rb"
)))
error
(
"Could not open %s for input
\n
"
,
input_name
);
if
(
input_name
)
ret
=
yyparse
();
fclose
(
yyin
);
if
(
ret
)
if
(
input_name
)
fclose
(
yyin
);
{
/* Error during parse */
exit
(
1
);
}
if
(
debuglevel
&
DEBUGLEVEL_DUMP
)
if
(
ret
)
exit
(
1
);
/* Error during parse */
dump_resources
(
resource_top
);
/* Convert the internal lists to binary data */
if
(
debuglevel
&
DEBUGLEVEL_DUMP
)
resources2r
es
(
resource_top
);
dump_resourc
es
(
resource_top
);
if
(
output_type
==
output_res
)
/* Convert the internal lists to binary data */
{
resources2res
(
resource_top
);
chat
(
"Writing .res-file"
);
write_resfile
(
output_name
,
resource_top
);
}
else
if
(
output_type
==
output_asm
)
{
chat
(
"Writing .s-file"
);
write_s_file
(
output_name
,
resource_top
);
}
}
chat
(
"Writing .res-file"
);
else
write_resfile
(
output_name
,
resource_top
);
{
/* Go from .res to .s */
chat
(
"Reading .res-file"
);
resource_top
=
read_resfile
(
input_name
);
if
(
output_type
==
output_asm
)
{
chat
(
"Writing .s-file"
);
write_s_file
(
output_name
,
resource_top
);
}
}
return
0
;
return
0
;
}
}
...
...
tools/wrc/wrc.h
View file @
deaf02a5
...
@@ -51,9 +51,6 @@ extern int debuglevel;
...
@@ -51,9 +51,6 @@ extern int debuglevel;
extern
int
win32
;
extern
int
win32
;
extern
int
create_res
;
extern
int
create_res
;
extern
int
extensions
;
extern
int
extensions
;
extern
int
binary
;
extern
int
create_dir
;
extern
int
global
;
extern
int
alignment
;
extern
int
alignment
;
extern
int
alignment_pwr
;
extern
int
alignment_pwr
;
extern
int
create_s
;
extern
int
create_s
;
...
@@ -64,7 +61,6 @@ extern int preprocess_only;
...
@@ -64,7 +61,6 @@ extern int preprocess_only;
extern
int
no_preprocess
;
extern
int
no_preprocess
;
extern
int
remap
;
extern
int
remap
;
extern
char
*
prefix
;
extern
char
*
output_name
;
extern
char
*
output_name
;
extern
char
*
input_name
;
extern
char
*
input_name
;
extern
char
*
cmdline
;
extern
char
*
cmdline
;
...
...
tools/wrc/wrc.man
View file @
deaf02a5
...
@@ -5,39 +5,25 @@ wrc \- Wine Resource Compiler
...
@@ -5,39 +5,25 @@ wrc \- Wine Resource Compiler
.BI "wrc " "[options] " "[inputfile]"
.BI "wrc " "[options] " "[inputfile]"
.SH DESCRIPTION
.SH DESCRIPTION
.B wrc
.B wrc
compiles resources from
compiles resources from \fBinputfile\fR
.I inputfile
into win16 and win32 compatible binary format.
into win16 and win32 compatible
binary format.
.B wrc
outputs the binary data either in a standard \fB.res\fR formatted binary
file, or an assembly file.
.B wrc
is also capable of reading \fB.res\fR formatted files and convert them
into an assembly file.
.PP
.PP
The source\-file is preprocessed with a builtin ANSI\-C compatible
The source\-file is preprocessed with a builtin ANSI\-C compatible
preprocessor before the resources are compiled. See \fBPREPROCESSOR\fR
preprocessor before the resources are compiled. See \fBPREPROCESSOR\fR
below.
below.
.PP
.PP
.B wrc
.B wrc
takes only one \fBinputfile\fR as argument. The \fBinputfile\fR has
takes only one \fBinputfile\fR as argument. The resources are read from
extension \fB.rc\fR for resources in source form and \fB.res\fR for
standard input if no inputfile is given. If the output file is not
binary resources. The resources are read from standard input if no
specified with \fI-o\fR, then \fBwrc\fR will write the output to
inputfile is given. If the outputfile is not specified with \fI-o\fR,
\fBinputfile.res\fR with \fB.rc\fR stripped, or to \fBwrc.tab.res\fR if
then \fBwrc\fR will write the output to \fBinputfile.{s,res}\fR
no inputfile was given.
with \fB.rc\fR stripped, depending on the mode of compilation.
The outputfile is named \fBwrc.tab.{s,res}\fR if no inputfile was
given.
.SH OPTIONS
.SH OPTIONS
.TP
.TP
.I \-a n
.I \-a n
Win16 only; set the alignment between resources n. The alignment must
Win16 only; set the alignment between resources n. The alignment must
be a power of 2. The default is 4.
be a power of 2. The default is 4.
.TP
.TP
.I \-b
Create an assembly file from a binary \fB.res\fR file.
.TP
.I \-B x
.I \-B x
Win32 only; set output byte\-ordering, where \fIx\fR is one of n[ative],
Win32 only; set output byte\-ordering, where \fIx\fR is one of n[ative],
l[ittle] or b[ig]. Only resources in source-form can be reorderd. Native
l[ittle] or b[ig]. Only resources in source-form can be reorderd. Native
...
@@ -68,10 +54,6 @@ Preprocess only. The output is written to standard output if no
...
@@ -68,10 +54,6 @@ Preprocess only. The output is written to standard output if no
outputfile was selected. The output is compatible with what gcc would
outputfile was selected. The output is compatible with what gcc would
generate.
generate.
.TP
.TP
.I \-g
Add symbols to the global C namespace. This makes all symbols available
for linking by other modules.
.TP
.I \-h
.I \-h
Prints a summary message and exits.
Prints a summary message and exits.
.TP
.TP
...
@@ -106,29 +88,20 @@ source\-files that contain overlapping type\-IDs, or when the format of the
...
@@ -106,29 +88,20 @@ source\-files that contain overlapping type\-IDs, or when the format of the
resource is not 100% compliant.
resource is not 100% compliant.
.TP
.TP
.I \-o file
.I \-o file
Write output to \fIfile\fR. Default is \fBinputfile.
{res,s,h}
\fR
Write output to \fIfile\fR. Default is \fBinputfile.
res
\fR
with \fB.rc\fR stripped or \fBwrc.tab.
{s,h,res}\fR, depending on the
with \fB.rc\fR stripped or \fBwrc.tab.
res\fR if input is read
compilation mode
.
from standard input
.
.TP
.TP
.I \-O format
.I \-O format
Sets the output format. \fformat\fR can one either 'res' or 'asm'
Sets the output format. The only supported \fformat\fR is 'res', which
to generate a \fB.res\fR or \fB.s\fR file respectively.
is also the default format if this option is not specified. The option
If not specified, \fBwrc\fR assumes 'res'.
exists mainly for compatibility with \fBwindres\fR.
.TP
.I \-p prefix
Prefix all generated names with \fIprefix\fR. This is only relevant for
names in the assembly code and header file. Resource names are not
affected.
.TP
.TP
.I \-P program
.I \-P program
This option may be used to specify the preprocessor to use, including any
This option may be used to specify the preprocessor to use, including any
leading arguments. If not specified, \fBwrc\fR uses its builtin processor.
leading arguments. If not specified, \fBwrc\fR uses its builtin processor.
To disable preprocessing, use \fB-P cat\fR.
To disable preprocessing, use \fB-P cat\fR.
.TP
.TP
.I \-s
Add structure with win32/16 (PE/NE) resource directory to outputfile.
This directory is always in native byteorder.
.TP
.I \-v
.I \-v
Turns on verbose mode (equivalent to -d 1).
Turns on verbose mode (equivalent to -d 1).
.TP
.TP
...
...
tools/wrc/writeres.c
View file @
deaf02a5
This diff is collapsed.
Click to expand it.
tools/wrc/writeres.h
deleted
100644 → 0
View file @
f498d4b8
/*
* Write resource prototypes
*
* Copyright 1998 Bertho A. Stultiens (BS)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WRC_WRITERES_H
#define __WRC_WRITERES_H
#ifndef __WRC_WRCTYPES_H
#include "wrctypes.h"
#endif
void
write_resfile
(
char
*
outname
,
resource_t
*
top
);
void
write_s_file
(
char
*
outname
,
resource_t
*
top
);
#endif
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