[RFC] ColorD

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 23 16:39:05 PDT 2012


On Wed, Oct 24, 2012 at 01:16:38AM +0200, Adam D. Ruppe wrote:
> On Tuesday, 23 October 2012 at 23:07:18 UTC, H. S. Teoh wrote:
> >try, esp. if you're dealing with Unix terminals, which are many
> >and varied, and have all sorts of idiosyncrasies that make it a
> >pain to write a generic library that works for everything.
> 
> Does anybody really care about everything? Unix has de-facto
> standardized on vt100 emulators, and among them, there's only a few
> variants I'd care about: xterm, rxvt, gnu screen, putty, and the
> linux console.

Perhaps the right approach then is to make the code modular, so that
terminal-specific stuff is separated off into submodules (which are
imported as needed automatically or otherwise). That way, the initial
Phobos entry can just have the most common terminals supported: windows
command prompt, vt100, and perhaps linux or xterm. I'd say vt100 alone
should be good enough from the *nix perspective, at least for an initial
stab at the module. Xterm, putty, etc., can then be added later more or
less painlessly (if the design is properly done in a modular fashion).

Later on, if people are ambitious, they can try interfacing with
terminfo/termcap (but be prepared for long sleepless nights, this stuff
is way more complicated than one might expect, and arguably, than is
necessary).


> The differences are now brought way down to size, and we can use
> some of the more interesting extensions without worrying about
> lowest common denominator dragging us down.
> 
> And then doing Windows (or DOS) is pretty easy to match and perhaps
> exceed it.

I'm not familiar enough with the new Windows prompt (haha, I'm so dating
myself by calling it new) to say, but at least for DOS, terminal
capabilities are pretty straightforward: color is encoded directly in
the screen buffer, and there are standard system calls to move the
cursor around, set the display mode, etc.. Raw character mode is pretty
much the default (unless you fall back to the BIOS input reading
routines -- if those even exist anymore nowadays). So there's almost no
escape sequences that need special treatment, etc..  None of the
hair-tearing complexities of Unix terminals.

So the windows component of this module should pretty much be a cinch.


T

-- 
"A one-question geek test. If you get the joke, you're a geek: Seen on a
California license plate on a VW Beetle: 'FEATURE'..." -- Joshua D.
Wachs - Natural Intelligence, Inc.


More information about the Digitalmars-d mailing list