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
e25bc79d
Commit
e25bc79d
authored
Jun 22, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Add support for loading multiple input files at once.
parent
6cf96bf9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
79 deletions
+102
-79
parser.h
tools/wrc/parser.h
+1
-0
parser.l
tools/wrc/parser.l
+2
-0
parser.y
tools/wrc/parser.y
+15
-5
wrc.c
tools/wrc/wrc.c
+82
-72
wrc.man.in
tools/wrc/wrc.man.in
+2
-2
No files found.
tools/wrc/parser.h
View file @
e25bc79d
...
...
@@ -34,5 +34,6 @@ extern char *parser_text;
extern
int
yy_flex_debug
;
int
parser_lex
(
void
);
int
parser_lex_destroy
(
void
);
#endif
tools/wrc/parser.l
View file @
e25bc79d
...
...
@@ -121,6 +121,8 @@ cident [a-zA-Z_][0-9a-zA-Z_]*
/* Always update the current character position within a line */
#define YY_USER_ACTION char_number+=yyleng; wanted_id = want_id; want_id = 0;
#define YY_USER_INIT current_codepage = -1;
static void addcchar(char c);
static void addwchar(WCHAR s);
static string_t *get_buffered_cstring(void);
...
...
tools/wrc/parser.y
View file @
e25bc79d
...
...
@@ -169,12 +169,12 @@
int want_nl = 0; /* Signal flex that we need the next newline */
int want_id = 0; /* Signal flex that we need the next identifier */
stringtable_t *tagstt; /* Stringtable tag.
st
atic st
ringtable_t *tagstt; /* Stringtable tag.
* It is set while parsing a stringtable to one of
* the stringtables in the sttres list or a new one
* if the language was not parsed before.
*/
stringtable_t *sttres; /* Stringtable resources. This holds the list of
st
atic st
ringtable_t *sttres; /* Stringtable resources. This holds the list of
* stringtables with different lanuages
*/
static int dont_want_id = 0; /* See language parsing for details */
...
...
@@ -358,7 +358,7 @@ static int rsrcid_to_token(int lookahead);
resource_file
:
resources
{
resource_t
*rsc;
resource_t
*rsc
,
*head
;
/* First add stringtables to the resource-list */
rsc
=
build_stt_resources(sttres);
/* 'build_stt_resources' returns a head and $1 is a tail */
...
...
@@ -384,8 +384,18 @@ resource_file
}
else
$
1
=
rsc
;
/* Final statement before were done */
resource_top
=
get_resource_head
(
$
1
);
/* Final statements before were done */
head
=
get_resource_head
(
$
1
);
if
(
resource_top
)
/* append to existing resources */
{
resource_t
*tail
=
resource_top;
while
(tail->next)
tail
=
tail->next;
tail->next
=
head;
head->prev
=
tail;
}
else
resource_top
=
head
;
sttres
=
NULL
;
}
;
...
...
tools/wrc/wrc.c
View file @
e25bc79d
...
...
@@ -232,6 +232,68 @@ static void exit_on_signal( int sig )
exit
(
1
);
/* this will call the atexit functions */
}
/* load a single input file */
static
int
load_file
(
const
char
*
input_name
,
const
char
*
output_name
)
{
int
ret
;
/* Run the preprocessor on the input */
if
(
!
no_preprocess
)
{
/*
* Preprocess the input to a temp-file, or stdout if
* no output was given.
*/
chat
(
"Starting preprocess
\n
"
);
if
(
!
preprocess_only
)
{
ret
=
wpp_parse_temp
(
input_name
,
output_name
,
&
temp_name
);
}
else
if
(
output_name
)
{
FILE
*
output
;
if
(
!
(
output
=
fopen
(
output_name
,
"w"
)))
fatal_perror
(
"Could not open %s for writing"
,
output_name
);
ret
=
wpp_parse
(
input_name
,
output
);
fclose
(
output
);
}
else
{
ret
=
wpp_parse
(
input_name
,
stdout
);
}
if
(
ret
)
return
ret
;
if
(
preprocess_only
)
{
output_name
=
NULL
;
exit
(
0
);
}
input_name
=
temp_name
;
}
/* Go from .rc to .res */
chat
(
"Starting parse
\n
"
);
if
(
!
(
parser_in
=
fopen
(
input_name
,
"rb"
)))
fatal_perror
(
"Could not open %s for input"
,
input_name
);
ret
=
parser_parse
();
fclose
(
parser_in
);
parser_lex_destroy
();
if
(
temp_name
)
{
unlink
(
temp_name
);
temp_name
=
NULL
;
}
return
ret
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
extern
char
*
optarg
;
...
...
@@ -240,7 +302,6 @@ int main(int argc,char *argv[])
int
opti
=
0
;
int
stdinc
=
1
;
int
lose
=
0
;
int
ret
;
int
i
;
int
cmdlen
;
...
...
@@ -402,20 +463,6 @@ int main(int argc,char *argv[])
wpp_add_include_path
(
INCLUDEDIR
"/msvcrt"
);
wpp_add_include_path
(
INCLUDEDIR
"/windows"
);
}
/* Check for input file on command-line */
if
(
optind
<
argc
)
{
if
(
!
input_name
)
input_name
=
argv
[
optind
++
];
else
error
(
"Too many input files.
\n
"
);
}
/* Check for output file on command-line */
if
(
optind
<
argc
)
{
if
(
!
output_name
)
output_name
=
argv
[
optind
++
];
else
error
(
"Too many output files.
\n
"
);
}
/* Kill io buffering when some kind of debuglevel is enabled */
if
(
debuglevel
)
...
...
@@ -435,65 +482,28 @@ int main(int argc,char *argv[])
if
(
!
currentlanguage
)
currentlanguage
=
new_language
(
0
,
0
);
/* Generate appropriate outfile names */
if
(
!
output_name
&&
!
preprocess_only
)
{
output_name
=
dup_basename
(
input_name
,
".rc"
);
strcat
(
output_name
,
".res"
);
}
atexit
(
cleanup_files
);
/* Run the preprocessor on the input */
if
(
!
no_preprocess
)
{
/*
* Preprocess the input to a temp-file, or stdout if
* no output was given.
*/
chat
(
"Starting preprocess
\n
"
);
if
(
!
preprocess_only
)
{
ret
=
wpp_parse_temp
(
input_name
,
output_name
,
&
temp_name
);
}
else
if
(
output_name
)
{
FILE
*
output
;
if
(
!
(
output
=
fopen
(
output_name
,
"w"
)))
fatal_perror
(
"Could not open %s for writing"
,
output_name
);
ret
=
wpp_parse
(
input_name
,
output
);
fclose
(
output
);
}
else
{
ret
=
wpp_parse
(
input_name
,
stdout
);
}
if
(
ret
)
exit
(
1
);
/* Error during preprocess */
if
(
preprocess_only
)
{
output_name
=
NULL
;
exit
(
0
);
}
input_name
=
temp_name
;
}
/* Go from .rc to .res */
chat
(
"Starting parse
\n
"
);
if
(
!
(
parser_in
=
fopen
(
input_name
,
"rb"
)))
fatal_perror
(
"Could not open %s for input"
,
input_name
);
ret
=
parser_parse
();
if
(
input_name
)
fclose
(
parser_in
);
if
(
ret
)
exit
(
1
);
/* Error during parse */
if
(
input_name
)
/* specified with -i option */
{
if
(
!
output_name
&&
!
preprocess_only
)
{
output_name
=
dup_basename
(
input_name
,
".rc"
);
strcat
(
output_name
,
".res"
);
}
if
(
load_file
(
input_name
,
output_name
))
exit
(
1
);
}
while
(
optind
<
argc
)
{
input_name
=
argv
[
optind
++
];
if
(
!
output_name
&&
!
preprocess_only
)
{
output_name
=
dup_basename
(
input_name
,
".rc"
);
strcat
(
output_name
,
".res"
);
}
if
(
load_file
(
input_name
,
output_name
))
exit
(
1
);
}
if
(
debuglevel
&
DEBUGLEVEL_DUMP
)
dump_resources
(
resource_top
);
...
...
tools/wrc/wrc.man.in
View file @
e25bc79d
...
...
@@ -3,7 +3,7 @@
.SH NAME
wrc \- Wine Resource Compiler
.SH SYNOPSIS
.BI "wrc " "[options] " "[inputfile]"
.BI "wrc " "[options] " "[inputfile
s
]"
.SH DESCRIPTION
.B wrc
compiles resources from \fBinputfile\fR
...
...
@@ -14,7 +14,7 @@ preprocessor before the resources are compiled. See \fBPREPROCESSOR\fR
below.
.PP
.B wrc
takes
only one
\fBinputfile\fR as argument. The resources are read from
takes
a series of
\fBinputfile\fR as argument. The resources are read from
standard input if no inputfile is given. If the output file is not
specified with \fI-o\fR, then \fBwrc\fR will write the output to
\fBinputfile.res\fR with \fB.rc\fR stripped, or to \fBwrc.tab.res\fR if
...
...
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