[llvm-commits] [PATCH] ANSI colors for clang!
Török Edwin
edwintorok at gmail.com
Mon Jun 1 11:20:55 PDT 2009
On 2009-05-31 22:45, Török Edwin wrote:
> On 2009-05-31 22:13, Chris Lattner wrote:
>
>> +raw_ostream &raw_fd_ostream::changeColor(enum Colors colors, bool bold,
>> + bool bg)
>> +{
>> + if (!oldColors)
>> + oldColors = sys::Process::SaveCurrentColor();
>>
>> Does raw_fd_ostream really need a oldColors member?
>>
>
> For win32 yes. On Unix its an unused field.
>
oldColors is gone in new version.
>
>> Is this to push/
>> pop the current color? If so, could the state be saved outside the
>> stream itself? Maybe an RAII object that installs a new color and
>> saves the old one... restoring it when destroyed would be better?
>> That way raw_ostream could just have "give me your current color" and
>> "change color" interfaces, which would be very simple and nice.
>>
>>
>
>
>
I save the terminal default colors in a static constructor in
win32/process.inc now,
so oldColors and SaveCurrentColors is not needed.
>> A lot of the complexity of the patch looks like it has to do with
>> Windows support. Please find someone with a real VC++ build to verify
>> that it actually works :)
>>
I've tested it myself on VC++2k8 Express, by generating a .sln using
cmake-gui
(Express edition didn't like the .sln in win32/, but worked fine with
the one from cmake).
Apart from a compilation failure in ilist.h (solved by the attached
patch) everything went smoothly,
and my (blindly) written color support for win32 consoles actually
worked the first time I tried:
it printed an error that it can't find string.h in color!
>> Thanks a lot for tackling this Edwin, it looks very useful!
>>
Can I commit the patch(es)?
Best regards,
--Edwin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_win32_ilist.patch
Type: text/x-diff
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090601/afbd11dd/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-diff
Size: 9313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090601/afbd11dd/attachment-0001.patch>
More information about the llvm-commits
mailing list