This is an archive of the discontinued LLVM Phabricator instance.

[llvm-rc] Add support for all missing dialog controls
ClosedPublic

Authored by mstorsjo on May 6 2018, 2:33 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.May 6 2018, 2:33 PM

Looks good. AFAICT we're now only missing PUSHBOX and CONTROL. If these don't present any additional difficulty, maybe better to just add them now for the sake of completeness?

Looks good. AFAICT we're now only missing PUSHBOX and CONTROL. If these don't present any additional difficulty, maybe better to just add them now for the sake of completeness?

Sure, I'll have another look at them.

amccarth accepted this revision.May 7 2018, 11:19 AM

Looks good. AFAICT we're now only missing PUSHBOX and CONTROL. If these don't present any additional difficulty, maybe better to just add them now for the sake of completeness?

CONTROL is important. I'd never heard of PUSHBOX. Interesting.

This revision is now accepted and ready to land.May 7 2018, 11:19 AM
mstorsjo updated this revision to Diff 145632.May 7 2018, 11:51 PM
mstorsjo retitled this revision from [llvm-rc] Add support for most missing dialog controls to [llvm-rc] Add support for all missing dialog controls.

Added PUSHBOX and CONTROL - now this should be complete.

amccarth added inline comments.May 8 2018, 10:35 AM
tools/llvm-rc/ResourceScriptParser.cpp
484 ↗(On Diff #145632)

This is OK for now, but in the future I think you'll need special code for style and exstyle because those are really expressions that don't work exactly like regular C-style bitwise operations.

So I'm not sure how much readIntsWithCommas is buying versus reading the arguments into well-named variables like X, Y, Width, Height, etc., which would then make reading the Control c'tor calls a lot easier and would highlight the difference between the CONTROL syntax versus the syntax for the pre-defined control types.

About a third of this function is special case handling for CONTROL when the only differences are two little tweaks to the syntax (position of style and the explicit class parameter). It feels like a lot of near-duplicate code (e.g., the TakeOptArg lambda has to be defined twice) to handle the tweaks.

amccarth added inline comments.May 8 2018, 11:07 AM
tools/llvm-rc/ResourceScriptStmt.cpp
146 ↗(On Diff #145632)

For CONTROL, where does the 0x2A come from? I know 0x5000000 is WS_CHILD | WS_VISIBLE.

It would be nice to see the styles represented in a way that makes it easier to check the table.

mstorsjo added inline comments.May 8 2018, 11:11 AM
tools/llvm-rc/ResourceScriptStmt.cpp
146 ↗(On Diff #145632)

Oh, that 0x2A must be from the test file itself. Will fix.

mstorsjo added inline comments.May 8 2018, 1:10 PM
tools/llvm-rc/ResourceScriptParser.cpp
484 ↗(On Diff #145632)

I rewrote this, making it just one main function with minor exceptions for CONTROL vs others, making the similarities more visible, hopefully like you wanted.

tools/llvm-rc/ResourceScriptStmt.cpp
146 ↗(On Diff #145632)

I'll leave splitting up the style hardcoded values into symbolic values to a separate patch, since it's already that way.

mstorsjo updated this revision to Diff 145764.May 8 2018, 1:11 PM

Unified handling of CONTROL vs other controls, removed stray extra values in the CONTROL style base value.

amccarth accepted this revision.May 8 2018, 1:13 PM

Thanks!

This revision was automatically updated to reflect the committed changes.