[llvm] r331808 - [llvm-rc] Add support for all missing dialog controls
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Tue May 8 13:55:59 PDT 2018
Author: mstorsjo
Date: Tue May 8 13:55:58 2018
New Revision: 331808
URL: http://llvm.org/viewvc/llvm-project?rev=331808&view=rev
Log:
[llvm-rc] Add support for all missing dialog controls
Differential Revision: https://reviews.llvm.org/D46507
Modified:
llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
llvm/trunk/test/tools/llvm-rc/tag-dialog.test
llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp
llvm/trunk/tools/llvm-rc/ResourceScriptStmt.cpp
llvm/trunk/tools/llvm-rc/ResourceScriptStmt.h
Modified: llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc (original)
+++ llvm/trunk/test/tools/llvm-rc/Inputs/tag-dialog.rc Tue May 8 13:55:58 2018
@@ -28,6 +28,21 @@ Types DIALOGEX 12345, -11215, 0x1234, 0x
EDITTEXT 2001, 2002, 2003, 2004, 2005
LTEXT 65535, 3001, 3002, 3003, 3004, 3005
+
+ AUTO3STATE "A3", 12, 2, 3, 4, 5
+ AUTOCHECKBOX "AC", 13, 2, 3, 4, 5
+ AUTORADIOBUTTON "AR", 14, 2, 3, 4, 5
+ CHECKBOX "C", 15, 2, 3, 4, 5
+ COMBOBOX 16, 2, 3, 4, 5
+ GROUPBOX "G", 17, 2, 3, 4, 5
+ ICON "I", 18, 2, 3, 4, 5
+ LISTBOX 19, 2, 3, 4, 5
+ RADIOBUTTON "R", 20, 2, 3, 4, 5
+ COMBOBOX 21, 2, 3, 4, 5
+ SCROLLBAR 22, 2, 3, 4, 5
+ STATE3 "S", 23, 2, 3, 4, 5
+ PUSHBOX "P", 24, 2, 3, 4, 5
+ CONTROL "C", 25, "Class", 42, 2, 3, 4, 5
}
EmptyOld DIALOG 1, 2, 3, 4 {}
Modified: llvm/trunk/test/tools/llvm-rc/tag-dialog.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-rc/tag-dialog.test?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-rc/tag-dialog.test (original)
+++ llvm/trunk/test/tools/llvm-rc/tag-dialog.test Tue May 8 13:55:58 2018
@@ -70,10 +70,10 @@
; DIALOG-NEXT: Version (major): 0
; DIALOG-NEXT: Version (minor): 0
; DIALOG-NEXT: Characteristics: 0
-; DIALOG-NEXT: Data size: 282
+; DIALOG-NEXT: Data size: 778
; DIALOG-NEXT: Data: (
; DIALOG-NEXT: 0000: 0100FFFF 54535251 00000000 00008880 |....TSRQ........|
-; DIALOG-NEXT: 0010: 07003930 31D43412 ED1E0000 00000000 |..901.4.........|
+; DIALOG-NEXT: 0010: 15003930 31D43412 ED1E0000 00000000 |..901.4.........|
; DIALOG-NEXT: 0020: 00000000 00000000 00000250 02000300 |...........P....|
; DIALOG-NEXT: 0030: 04000500 01000000 FFFF8200 4C000000 |............L...|
; DIALOG-NEXT: 0040: 00000000 00000000 00000000 01000250 |...............P|
@@ -89,7 +89,38 @@
; DIALOG-NEXT: 00E0: 00008150 D207D307 D407D507 D1070000 |...P............|
; DIALOG-NEXT: 00F0: FFFF8100 00000000 00000000 00000000 |................|
; DIALOG-NEXT: 0100: 00000250 BA0BBB0B BC0BBD0B B90B0000 |...P............|
-; DIALOG-NEXT: 0110: FFFF8200 FFFFFFFF 0000 |..........|
+; DIALOG-NEXT: 0110: FFFF8200 FFFFFFFF 00000000 00000000 |................|
+; DIALOG-NEXT: 0120: 00000000 06000150 02000300 04000500 |.......P........|
+; DIALOG-NEXT: 0130: 0C000000 FFFF8000 41003300 00000000 |........A.3.....|
+; DIALOG-NEXT: 0140: 00000000 00000000 03000150 02000300 |...........P....|
+; DIALOG-NEXT: 0150: 04000500 0D000000 FFFF8000 41004300 |............A.C.|
+; DIALOG-NEXT: 0160: 00000000 00000000 00000000 09000050 |...............P|
+; DIALOG-NEXT: 0170: 02000300 04000500 0E000000 FFFF8000 |................|
+; DIALOG-NEXT: 0180: 41005200 00000000 00000000 00000000 |A.R.............|
+; DIALOG-NEXT: 0190: 02000150 02000300 04000500 0F000000 |...P............|
+; DIALOG-NEXT: 01A0: FFFF8000 43000000 00000000 00000000 |....C...........|
+; DIALOG-NEXT: 01B0: 00000000 00000050 02000300 04000500 |.......P........|
+; DIALOG-NEXT: 01C0: 10000000 FFFF8500 00000000 00000000 |................|
+; DIALOG-NEXT: 01D0: 00000000 07000050 02000300 04000500 |.......P........|
+; DIALOG-NEXT: 01E0: 11000000 FFFF8000 47000000 00000000 |........G.......|
+; DIALOG-NEXT: 01F0: 00000000 00000000 03000050 02000300 |...........P....|
+; DIALOG-NEXT: 0200: 04000500 12000000 FFFF8200 49000000 |............I...|
+; DIALOG-NEXT: 0210: 00000000 00000000 00000000 01008050 |...............P|
+; DIALOG-NEXT: 0220: 02000300 04000500 13000000 FFFF8300 |................|
+; DIALOG-NEXT: 0230: 00000000 00000000 00000000 04000050 |...............P|
+; DIALOG-NEXT: 0240: 02000300 04000500 14000000 FFFF8000 |................|
+; DIALOG-NEXT: 0250: 52000000 00000000 00000000 00000000 |R...............|
+; DIALOG-NEXT: 0260: 00000050 02000300 04000500 15000000 |...P............|
+; DIALOG-NEXT: 0270: FFFF8500 00000000 00000000 00000000 |................|
+; DIALOG-NEXT: 0280: 00000050 02000300 04000500 16000000 |...P............|
+; DIALOG-NEXT: 0290: FFFF8400 00000000 00000000 00000000 |................|
+; DIALOG-NEXT: 02A0: 05000150 02000300 04000500 17000000 |...P............|
+; DIALOG-NEXT: 02B0: FFFF8000 53000000 00000000 00000000 |....S...........|
+; DIALOG-NEXT: 02C0: 00000000 0A000150 02000300 04000500 |.......P........|
+; DIALOG-NEXT: 02D0: 18000000 FFFF8000 50000000 00000000 |........P.......|
+; DIALOG-NEXT: 02E0: 00000000 00000000 2A000050 02000300 |........*..P....|
+; DIALOG-NEXT: 02F0: 04000500 19000000 43006C00 61007300 |........C.l.a.s.|
+; DIALOG-NEXT: 0300: 73000000 43000000 0000 |s...C.....|
; DIALOG-NEXT: )
; DIALOG-DAG: Resource type (int): 5
Modified: llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceFileWriter.cpp Tue May 8 13:55:58 2018
@@ -1016,7 +1016,7 @@ Error ResourceFileWriter::writeSingleDia
}
// Window class - either 0xFFFF + 16-bit integer or a string.
- RETURN_IF_ERROR(writeIntOrString(IntOrString(TypeInfo.CtlClass)));
+ RETURN_IF_ERROR(writeIntOrString(Ctl.Class));
// Element caption/reference ID. ID is preceded by 0xFFFF.
RETURN_IF_ERROR(checkIntOrString(Ctl.Title, "Control reference ID"));
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptParser.cpp Tue May 8 13:55:58 2018
@@ -486,15 +486,46 @@ Expected<Control> RCParser::parseControl
Caption = *CaptionResult;
}
- ASSIGN_OR_RETURN(Args, readIntsWithCommas(5, 8));
+ ASSIGN_OR_RETURN(ID, readInt());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
- auto TakeOptArg = [&Args](size_t Id) -> Optional<uint32_t> {
- return Args->size() > Id ? (uint32_t)(*Args)[Id] : Optional<uint32_t>();
- };
-
- return Control(*ClassResult, Caption, (*Args)[0], (*Args)[1], (*Args)[2],
- (*Args)[3], (*Args)[4], TakeOptArg(5), TakeOptArg(6),
- TakeOptArg(7));
+ IntOrString Class;
+ Optional<uint32_t> Style;
+ if (ClassUpper == "CONTROL") {
+ // CONTROL text, id, class, style, x, y, width, height [, exstyle] [, helpID]
+ ASSIGN_OR_RETURN(ClassStr, readString());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
+ Class = *ClassStr;
+ ASSIGN_OR_RETURN(StyleVal, readInt());
+ RETURN_IF_ERROR(consumeType(Kind::Comma));
+ Style = *StyleVal;
+ } else {
+ Class = CtlInfo->getValue().CtlClass;
+ }
+
+ // x, y, width, height
+ ASSIGN_OR_RETURN(Args, readIntsWithCommas(4, 4));
+
+ if (ClassUpper != "CONTROL") {
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ Style = *Val;
+ }
+ }
+
+ Optional<uint32_t> ExStyle;
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ ExStyle = *Val;
+ }
+ Optional<uint32_t> HelpID;
+ if (consumeOptionalType(Kind::Comma)) {
+ ASSIGN_OR_RETURN(Val, readInt());
+ HelpID = *Val;
+ }
+
+ return Control(*ClassResult, Caption, *ID, (*Args)[0], (*Args)[1],
+ (*Args)[2], (*Args)[3], Style, ExStyle, HelpID, Class);
}
RCParser::ParseType RCParser::parseBitmapResource() {
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptStmt.cpp?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptStmt.cpp (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptStmt.cpp Tue May 8 13:55:58 2018
@@ -128,9 +128,22 @@ const StringMap<Control::CtlInfo> Contro
{"LTEXT", CtlInfo{0x50020000, ClsStatic, true}},
{"CTEXT", CtlInfo{0x50020001, ClsStatic, true}},
{"RTEXT", CtlInfo{0x50020002, ClsStatic, true}},
+ {"ICON", CtlInfo{0x50000003, ClsStatic, true}},
{"PUSHBUTTON", CtlInfo{0x50010000, ClsButton, true}},
{"DEFPUSHBUTTON", CtlInfo{0x50010001, ClsButton, true}},
+ {"AUTO3STATE", CtlInfo{0x50010006, ClsButton, true}},
+ {"AUTOCHECKBOX", CtlInfo{0x50010003, ClsButton, true}},
+ {"AUTORADIOBUTTON", CtlInfo{0x50000009, ClsButton, true}},
+ {"CHECKBOX", CtlInfo{0x50010002, ClsButton, true}},
+ {"GROUPBOX", CtlInfo{0x50000007, ClsButton, true}},
+ {"RADIOBUTTON", CtlInfo{0x50000004, ClsButton, true}},
+ {"STATE3", CtlInfo{0x50010005, ClsButton, true}},
+ {"PUSHBOX", CtlInfo{0x5001000A, ClsButton, true}},
{"EDITTEXT", CtlInfo{0x50810000, ClsEdit, false}},
+ {"COMBOBOX", CtlInfo{0x50000000, ClsComboBox, false}},
+ {"LISTBOX", CtlInfo{0x50800001, ClsListBox, false}},
+ {"SCROLLBAR", CtlInfo{0x50000000, ClsScrollBar, false}},
+ {"CONTROL", CtlInfo{0x50000000, 0, true}},
};
raw_ostream &Control::log(raw_ostream &OS) const {
Modified: llvm/trunk/tools/llvm-rc/ResourceScriptStmt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rc/ResourceScriptStmt.h?rev=331808&r1=331807&r2=331808&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-rc/ResourceScriptStmt.h (original)
+++ llvm/trunk/tools/llvm-rc/ResourceScriptStmt.h Tue May 8 13:55:58 2018
@@ -542,6 +542,7 @@ public:
IntOrString Title;
uint32_t ID, X, Y, Width, Height;
Optional<uint32_t> Style, ExtStyle, HelpID;
+ IntOrString Class;
// Control classes as described in DLGITEMTEMPLATEEX documentation.
//
@@ -565,10 +566,10 @@ public:
Control(StringRef CtlType, IntOrString CtlTitle, uint32_t CtlID,
uint32_t PosX, uint32_t PosY, uint32_t ItemWidth, uint32_t ItemHeight,
Optional<uint32_t> ItemStyle, Optional<uint32_t> ExtItemStyle,
- Optional<uint32_t> CtlHelpID)
+ Optional<uint32_t> CtlHelpID, IntOrString CtlClass)
: Type(CtlType), Title(CtlTitle), ID(CtlID), X(PosX), Y(PosY),
Width(ItemWidth), Height(ItemHeight), Style(ItemStyle),
- ExtStyle(ExtItemStyle), HelpID(CtlHelpID) {}
+ ExtStyle(ExtItemStyle), HelpID(CtlHelpID), Class(CtlClass) {}
static const StringMap<CtlInfo> SupportedCtls;
More information about the llvm-commits
mailing list