ColourTrans_SetGCOL

Tony van der Hoff tony at vanderhoff.org
Mon Oct 30 12:30:32 GMT 2006


On 28 Oct at 3:22 Christian Ludlam <christian at recoil.org> wrote in message
<5ffcab7c4e.christian at venice.lab>

> Hi,
> 
> colourtrans_gcol_flags, as used in R3 in colourtrans_set_gcol() should
> have bit 7 meaning "set background colour" as well as the ECF flag in bit
> 8.
> 

Woo, there's a bug lurking undiscovered since the dawn of time:

TYPE ColourTrans_GCOLFlags = .Bits;
CONST
   //for SetGCOL
   ColourTrans_SetFG   = ColourTrans_GCOLFlags: 0,
   ColourTrans_SetBG   = ColourTrans_GCOLFlags: 0b10000000,
   ColourTrans_UseECFS = ColourTrans_GCOLFlags: 0b100000000,
   ColourTrans_SetText = ColourTrans_GCOLFlags: 0b1000000000;

which is later overwritten by this:

TYPE ColourTrans_TextColourFlags = .Bits;
CONST
   //for SetTextColour
   ColourTrans_SetFG   = ColourTrans_TextColourFlags: 0,
   ColourTrans_SetBG   = ColourTrans_TextColourFlags: 0b10000000;

resulting in C:

#define colourtrans_SET_FG      ((colourtrans_text_colour_flags) 0x0u)
#define colourtrans_SET_BG      ((colourtrans_text_colour_flags) 0x80u)
#define colourtrans_USE_ECFS    ((colourtrans_gcol_flags) 0x100u)
#define colourtrans_SET_TEXT    ((colourtrans_colour_flags) 0x200u)

Seeing as this has never been noticed before, I guess it's safe to rename
the former, even if they are the same thing, thus:
   ColourTrans_SetFGCol   = ColourTrans_GCOLFlags: 0,
   ColourTrans_SetBGCol   = ColourTrans_GCOLFlags: 0b10000000,
   ColourTrans_UseECFS = ColourTrans_GCOLFlags: 0b100000000,
   ColourTrans_SetText = ColourTrans_GCOLFlags: 0b1000000000;

The question is whether to add "Col" to the last two names for consistency,
bearing in mind that DefMod will treat SetTextCol differently to the rest (I
think).

Comments, please?

-- 
Tony van der Hoff        | mailto:tony at vanderhoff.org
Buckinghamshire, England 



More information about the oslib-user mailing list