[darcs-users] Re: colour output/libcurses on windows(TM)

David Roundy droundy at abridgegame.org
Mon Apr 4 12:19:40 UTC 2005


On Mon, Apr 04, 2005 at 09:02:23AM +0000, Csaba Henk wrote:
> On 2005-04-03, Peter Hercek <peter at syncad.com> wrote:
> > Does the Window console API use some ANSI encoding for colors?
> 
> Afaik you have to use specific ioctl-like like calls. (They don't call
> it that way, of course).
[...]
> It seems to be tedious but straightforward to use.
> 
> Maybe preprocessor macros could be used in a way such that a macro would
> be defined which either outputs the ansi escape sequence or makes the
> appropriate call to the Windows console api, depending on the platform.
> 
> Is there a standard preprocessor for ghc (I know nothing about it)?

We use the C preprocessor, which isn't ideal for haskell, but is Good
Enough.

It looks like we'd probably be best off (if we seriously want color in
win32) modifying Printer.putDoc (and friends) to intercept the ANSI color
codes and make the appropriate system calls to change colors.  It's a bit
ugly, but I can't see any other choice.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-users mailing list