Subject: Re: wscons termcap entry
To: None <>
From: Alan Barrett <>
List: tech-userlevel
Date: 07/03/2002 09:42:39
On Tue, 02 Jul 2002, Joerg Klemenz wrote:
> > wsvt25-colour|Added colour (note not spelled color to avoid a name collision):\
> > 	:Co#8:pa#64:\
> > 	:op=\E[37;40m:\
> > 	:Sb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m:\
> > 	:Sf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m:\
> > 	:tc=wsvt25-fixedglitches:
> I am not an expert but that looks broken.
> Maybe its an email transmission error?? Why is it so long??

It's not an email transmission error; the Sb and Sf values really are so

The stuff from the %? to the %; in the Sb and Sf values means: if the
arg equals 1 then output "4", else if the arg equals 3 then output
"6", else if the arg equals 4 then output "1", else if the arg equals
6 then output "3", else just output the arg.  I wrote it using the
description of Parameterized Strings in terminfo(5), and it deals with
bits representing RGB colours being specified in a different order
in the arg versus the output.  It would have been better to use bit
twiddling operations, but since there are only 8 cases (3 bits), and
several of them would be unchanged by twiddling, and I didn't feel like
learning more than the minimum about Parameterised Strings, I chose to
use the if/then/else approach.

At the time I did that, I didn't know about the AB and AF capabilities,
which seem to do the same as Sb and Sf, but with no need to twiddle the
RGB bit order.  I now suspect that :AB=\E4%dm:AF=\E[3%dm: will do the
same thing as the long Sb and Sf capabilities above.

--apb (Alan Barrett)