Commit Graph

20 Commits

Author SHA1 Message Date
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
Martin Storsjo
cec32edcb5 [llvm-rc] Support EXSTYLE statement.
Patch by Jacek Caban!

Differential Revision: https://reviews.llvm.org/D55020

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347858 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-29 12:17:39 +00:00
Martin Storsjo
65de7bd1fe [llvm-rc] Add support for the optional CLASS statement for dialogs
Differential Revision: https://reviews.llvm.org/D46875

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332386 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 19:21:28 +00:00
Martin Storsjo
370633f2f2 [llvm-rc] Add support for parsing memory flags
Most of the handling is pretty straightforward; fetch the default
memory flags for the specific resource type before parsing the flags
and apply them on top of that, except that some flags imply others
and some flags clear more than one flag.

For icons and cursors, the flags set get passed on to all individual
single icon/cursor resources, while only some flags affect the icon/cursor
group resource.

For stringtables, the behaviour is pretty simple; the first stringtable
resource of a bundle sets the flags for the whole bundle.

The output of these tests match rc.exe byte for byte.

The actual use of these memory flags is deprecated and they have no
effect since Win16, but some resource script files may still happen
to have them in place.

Differential Revision: https://reviews.llvm.org/D46818

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332329 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15 06:35:29 +00:00
Roman Lebedev
6441549f05 [llvm-rc] Fix build: missing 'override'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331675 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07 21:06:53 +00:00
Martin Storsjo
31dc80fca0 [llvm-rc] Implement the BITMAP resource type
Differential Revision: https://reviews.llvm.org/D46509

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331670 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-07 20:27:37 +00:00
Martin Storsjo
e99f5b406a [llvm-rc] Add rudimentary support for codepages
Only support UTF-8 (since LLVM contains UTF-8 parsing support
already, and the code even does that already) and Windows-1252
(where most code points has the same value in unicode). Keep the
existing default as only allowing ASCII input.

Using the option type JoinedOrSeparate, since the real rc.exe
handles options in this form, even if llvm-rc uses Separate for
other similar existing options.

Rename the struct SearchParams to WriterParams since it's now used
for more than just include paths.

Add a missing getResourceTypeName method to the BundleResource class,
to fix error printing from within STRINGTABLE resources (used in
tests).

Differential Revision: https://reviews.llvm.org/D46238

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331391 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-02 19:43:44 +00:00
Malcolm Parsons
5fc96281fc Fix typos of occurred and occurrence
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323318 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-24 10:33:39 +00:00
Zachary Turner
e847ec4e7e Don't #include MemoryBuffer.h from Host.h.
It turns out this #include isn't used from Host.h anyway,
but by having it it causes circular include dependencies.
This issues only surfaced while I was working on a separate
patch, so I'm submitting this first so that it's independent
of the other, unrelated patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 01:00:35 +00:00
Zachary Turner
e315d738d1 [llvm-rc] Use proper search algorithm for finding resources.
Previously we would only look in the current directory for a
resource, which might not be the same as the directory of the
rc file.  Furthermore, MSVC rc supports a /I option, and can
also look in the system environment.  This patch adds support
for this search algorithm.

Differential Revision: https://reviews.llvm.org/D38740

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11 20:12:09 +00:00
Zachary Turner
5d1b2d36c7 Fix some C++ value / reference semantics issues.
Some functions were taking Twine's not by const&, these are all
fixed to take by const&.  We also had a case where some functions
were overloaded to accept by const& and &&.  Now there is only
one version which accepts by value and move's the value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315229 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09 18:50:29 +00:00
Zachary Turner
080f10e7ac [llvm-rc] Serialize user-defined resources to .res files.
This allows rc to serialize user-defined resources, as
documented at:

msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx

Escape sequences are yet unavailable, and are to be added in one of
child patches.

Patch by: Marek Sokolowski

Differential Revision: https://reviews.llvm.org/D38423

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06 21:52:15 +00:00
Zachary Turner
84ad96bc3f [llvm-rc] Serialize STRINGTABLE statements to .res file.
This allows llvm-rc to serialize STRINGTABLE resources.

These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315112 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06 21:30:55 +00:00
Zachary Turner
93bb30da3f [llvm-rc] Serialize VERSIONINFO resources to .res files.
This is now able to dump VERSIONINFO resources.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

Differential Revision: https://reviews.llvm.org/D38410
Patch by: Marek Sokolowski

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06 21:26:06 +00:00
Zachary Turner
4c72b95c52 [llvm-rc] Serialize CURSOR and ICON resources to .res
This is part 6 of llvm-rc serialization.

This adds ability to output cursors and icons as resources.

Unfortunately, we can't just copy .cur or .ico files to output - as each
file might contain multiple images, each of them needs to be unpacked
and stored as a separate resource. This forces us to parse cursor and
icon contents. (Fortunately, these formats are pretty similar and can be
processed by mostly common code).

As test files are binary, here is a short explanation of .cur and .ico
files stored:

cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files,
differing in their bit depth.

icon-old.ico, icon-new.ico are sample correct icon files;

icon-png.ico is a sample correct icon file in PNG format (instead of
usual BMP);

cursor-eof.cur is an incorrect cursor file - this is cursor.cur with
some of its final bytes removed.

cursor-bad-offset.cur is an incorrect cursor file - image header states
that image data begins at offset 0xFFFFFFFF.

Sample correct cursors and icons were created by Nico Weber.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315109 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06 21:25:44 +00:00
Zachary Turner
44bde8dadb [llvm-rc] Add optional serialization support for DIALOG(EX) resources.
This is part 5 of llvm-rc serialization support.

This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.

Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/aa381013.aspx). I made
some changes to the parser to reflect this fact.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37864

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06 20:51:20 +00:00
Marek Sokolowski
bbf12f304b [llvm-rc] Serialize DIALOG(EX) to .res files (serialization, pt 4).
This is now able to serialize DIALOG and DIALOGEX resources to .res
files. It still can't parse dialog-specific CAPTION, FONT, and STYLE
optional statement - these will be added in the following patch.

A limited set of controls is included. However, more can be easily added
by extending SupportedCtls map defined in ResourceScriptStmt.cpp.

Differential Revision: https://reviews.llvm.org/D37862

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-30 00:38:52 +00:00
Marek Sokolowski
ea529937ce [llvm-rc] Serialize MENU resources to .res files (serialization, pt 3).
This allows MENU resources to be serialized.

MENU resource statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381025.aspx
POPUP sub-statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381030.aspx
MENUITEM sub-statement doc:
msdn.microsoft.com/en-us/library/windows/desktop/aa381024.aspx
MENUHEADER structure:
msdn.microsoft.com/en-us/library/windows/desktop/ms648018.aspx (and
NORMALMENUITEM, POPUPMENUITEM structs).

Thanks for Nico Weber for his original work in this area.

Differential Revision: https://reviews.llvm.org/D37828

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314562 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 22:25:05 +00:00
Marek Sokolowski
b121e77d2e [llvm-rc] Serialize ACCELERATORS to .res files (serialization, pt 2).
This allows llvm-rc to serialize ACCELERATORS resources.

Additionally, as this is the first type of resource to support basic
optional resource statements (LANGUAGE, CHARACTERISTICS, VERSION),

ACCELERATORS statement documentation:
msdn.microsoft.com/en-us/library/windows/desktop/aa380610.aspx
Accelerator table structure documentation:
msdn.microsoft.com/en-us/library/windows/desktop/ms648010.aspx
Optional resource statement fields are described in:
msdn.microsoft.com/en-us/library/windows/desktop/ms648027.aspx

Thanks for Nico Weber for his original work in this area.

Differential Revision: https://reviews.llvm.org/D37824

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314549 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 19:07:44 +00:00
Marek Sokolowski
e37621ba47 [llvm-rc] Serialize HTML resources to .res files (serialization, pt 1).
This allows to process HTML resources defined in .rc scripts and output
them to resulting .res files. Additionally, some infrastructure allowing
to output these files is created.

This is the first resource type we can operate on.

Thanks to Nico Weber for his original work in this area.

Differential Revision: reviews.llvm.org/D37283

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314538 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29 17:14:09 +00:00