colorization outside of type

#1
I use a lot of little Unix tools with TCmd and if I want to get ANSI color, I have been piping my output through the TYPE command. E.g.,
Code:
grep --color=always "pattern" file | type
However, is there another way to get ANSI or color support for external utilities other than using TYPE? Or is piping the output through TYPE pretty much the only way?
 
#2
Eric Pement wrote:
| I use a lot of little Unix tools with TCmd and if I want to get ANSI
| color, I have been piping my output through the TYPE command. E.g.,
|
| Code:
| ---------
| grep --color=always "pattern" file | type
| ---------
| However, is there another way to get ANSI or color support for
| external utilities *other* than using TYPE? Or is piping the output
| through TYPE pretty much the only way?

Usefully TYPE only. The support is in the STDOUT handler, which interprets
many (though not all) X3.64 escape sequences. Other methods work as well,
but are really much clumsier. For example:

command | for %x in (@con) echo %x

which is really equivalent to

command | type
--
HTH, Steve
 
#3
On Wed, 16 Jul 2008 10:38:37 -0500, Eric Pement <> wrote:


>However, is there another way to get ANSI or color support for external utilities *other* than using TYPE? Or is piping the output through TYPE pretty much the only way?
TCC can only color what TCC outputs. I doubt even the possibility of
console-wide SNAI color support; that would have to be done by csrss.exe.

It would seem, however, that TCMD could add ANSI color support for anything
running in a tab. Since TCMD has to reproduce what it finds in the console
screen buffer, it could scan for ANSI sequences and colorize what appears in its
window appropriately. How well that might work, and whether the demand would be
worth the effort are still other questions.
 
#4
vefatica wrote:
| On Wed, 16 Jul 2008 10:38:37 -0500, Eric Pement <> wrote:
|
|
|
| ---Quote---
|| However, is there another way to get ANSI or color support for
|| external utilities *other* than using TYPE? Or is piping the output
|| through TYPE pretty much the only way?
| ---End Quote---
| TCC can only color what TCC outputs. I doubt even the possibility of
| console-wide SNAI color support; that would have to be done by
| csrss.exe.
|
| It would seem, however, that TCMD could add ANSI color support for
| anything running in a tab. Since TCMD has to reproduce what it finds
| in the console screen buffer, it could scan for ANSI sequences and
| colorize what appears in its window appropriately. How well that
| might work, and whether the demand would be worth the effort are
| still other questions.

The possibility of copying the X3.64 interpreter code into TCMD, and even of
emulating of a VT-440 is real (only a small subset of that code is now in
TCC). I used the original TCMD16 instead of 4NT because it was the only
available X3.64 on WinNT. The *nix terminal managers do include X3.64
interpreters. The real issue for Rex is its commercial value - if any. If it
does not sell even one more copy of TCMD, why do it?
--
Steve
 
#5
On Wed, 16 Jul 2008 13:40:05 -0500, Steve Fábián <> wrote:


>The possibility of copying the X3.64 interpreter code into TCMD, and even of
>emulating of a VT-440 is real (only a small subset of that code is now in
>TCC). I used the original TCMD16 instead of 4NT because it was the only
>available X3.64 on WinNT. The *nix terminal managers do include X3.64
>interpreters. The real issue for Rex is its commercial value - if any. If it
>does not sell even one more copy of TCMD, why do it?
There's also the question of whether it could be fast enough so that TCMD's
emulation of a console wouldn't suffer.
 
#6
vefatica wrote:
| On Wed, 16 Jul 2008 13:40:05 -0500, Steve Fábián <> wrote:
| ---Quote---
|| The possibility of copying the X3.64 interpreter code into TCMD, and
|| even of emulating of a VT-440 is real (only a small subset of that
|| code is now in TCC). I used the original TCMD16 instead of 4NT
|| because it was the only available X3.64 on WinNT. The *nix terminal
|| managers do include X3.64 interpreters. The real issue for Rex is
|| its commercial value - if any. If it does not sell even one more
|| copy of TCMD, why do it?
| ---End Quote---
| There's also the question of whether it could be fast enough so that
| TCMD's emulation of a console wouldn't suffer.

I doubt speed is an issue. If one wants the feature, one may suffer a minor
degradation of console draring speed.
--
Steve
 
Mar 20, 2009
1
0
#7
However, is there another way to get ANSI or color support for external utilities other than using TYPE? Or is piping the output through TYPE pretty much the only way?
Type doesn't always work, this does:
http://www.geocities.com/jadoxa/ansicon/index.html

It can also act as an intermediary for TCC and interpret the ANSI codes on the fly. Its apparently not as hard to do as previously thought, so I'm kinda disappointed its not supported in TC by default.
 

rconn

Administrator
Staff member
May 14, 2008
10,580
97
#8
> ---Quote (Originally by Eric Pement)---
> However, is there another way to get ANSI or color support for external
> utilities *other* than using TYPE? Or is piping the output through TYPE
> pretty much the only way?
> ---End Quote---
> Type doesn't always work, this does:
> http://www.geocities.com/jadoxa/ansicon/index.html
>
> It can also act as an intermediary for TCC and interpret the ANSI codes on
> the fly. Its apparently not as hard to do as previously thought, so I'm
> kinda disappointed its not supported in TC by default.
It's much more difficult than you apparently think. ANSICON patches other
program's IATs and injects a dll into their address space, which only works
for some programs and some systems. (And, IMO, it's risky behavior that can
cause serious problems.) It also only intercepts two possible console APIs,
so it won't work with programs that use any of the other console APIs. And
it is DEFINITELY not behavior that belongs in a command interpreter.

But it probably doesn't matter, since other than TCC there are almost no
win32 apps that support ANSI sequences anyway.

Rex Conn
JP Software