[llvm] r187874 - Add support for linking against a curses library when available and

Richard legalize at xmission.com
Wed Aug 7 14:06:15 PDT 2013


In article <CAGCO0Kih2dW-jPH_-88YP_YzxhbeQScBBMG4oF2c9JU4zcNzqQ at mail.gmail.com>,
    Chandler Carruth <chandlerc at google.com> writes:

> What specific library are you suggesting? I'm unable to find a library/API
> for terminfo directly, and instead find just the specs for its database
> format.

The library is ncurses.  The main difference between terminfo and
termcap is the way the information about the capabilities is stored in
the underlying database.  I'm away from my terminfo/termcap book at the
moment, but IIRC the main differences are hidden from the API.

For what's going on here, I don't think it will make much difference
since you're essentially querying for a boolean ("does the terminal
support color") and then the ESC codes are being issued as hard-coded
sequences (which is the part where the database would come into play).[*]

> Every piece of documentation I could find indicated that the curses
> library was the blessed way of accessing the terminfo data with an API.

They have a very similar API and it's only when you get down to lower
level details that it matters.  There are some functions that differ,
but the majority of the differences are in the capability database.

> Relatedly, I think teaching LLVM to parse the terminfo database directly is
> not likely a worthwhile exercise.

Yeah, you'd just be re-inventing a slice of curses and IMO it's better
to let curses handle that.

[*] The color escape sequences are defined in an ANSI/ECMA standard, which
is what DOS, xterm, etc. implements.  I haven't looked at the clang
code, but I suspect this is what is being used and the use case for
using termcap/terminfo to map this to something funky is pretty weak.
<http://www.ecma-international.org/publications/standards/Ecma-048.htm>

I thought about describing their origins more, but I suspect few in
this audience care :-).
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>



More information about the llvm-commits mailing list