bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line-drawing constants


From: Thomas Dickey
Subject: Re: Line-drawing constants
Date: Wed, 17 Jul 2002 08:19:15 -0400
User-agent: Mutt/1.2.5i

On Tue, Jul 16, 2002 at 11:46:44PM +0100, Ian Lynagh wrote:
> http://www.opengroup.org/onlinepubs/007908799/xcurses/curses.h.html
> 
> it says
> 
>     Line-drawing Constants
> 
>     The <curses.h> header defines the symbolic constants shown in the
>     leftmost two columns of the following table for use in drawing
>     lines. The symbolic constants that begin with ACS_ are char
>     constants. The symbolic constants that begin with WACS_ are cchar_t
>     constants for use with the wide-character interfaces that take a
>     pointer to a cchar_t.
> 
> However, the ncurses code seems to define ACS_BLOCK etc as elements of
> an array that is overwritten with the appropriate values for the
> terminal in use. My reading of the specification was that this should
> not be allowed, and the obvious acceptable implementation would define
> them as integer constants used to index an array at addch time.

I don't recall noticing that aspect.  (I had noticed a reverse problem:  HPUX's
curses mis-defines things so the ACS_xxx symbols are just like the WACS_xxx
symbols, which makes it hard to use).

ncurses's definitions were based on SVr4 header files, which use an array. 
Checking, I see that Solaris' xpg4 header files do use a constant here as
you've indicated (while the legacy curses doesn't do that).  Perhaps what I'll
do is modify the ncurses headers so that if _XOPEN_SOURCE_EXTENDED is defined,
it would use the constants - but retain the other definitions for legacy apps.
 
> My reason for emailing is that I am writing code in Haskell and your
> interpretation is making the curses interfacing quite inconvenient. Do
> you believe it is a legitimate interpretation of the standard?

I suppose so - but I think you'll find you would have to solve the same issue
with other versions of curses.  Checking Tru64's headers, I see that they're
also using an array (I had also noticed that they passed an address for the
WACS_ symbols, which is still not a constant).  Arguably, to make a better
abstraction, constants are better.

Perhaps the real issue is that the X/Open documentation was written by people
who were not familiar with the interface that they're describing - there's more
than one instance of blunders introduced into their descriptions by sloppy
editing while attempting to improve the terminology (tgetent, for instance). 

What I generally do is read their documentation, compare against the
interpretations given for Solaris and Tru64 (which tend to be recent enough),
and if it's still vague (too often the case), write a simple test program and
run it.  I'm not very interested in interpreting features in ways that are hard
to port to different implementations of curses.
 
> If I am looking at the wrong standard then please direct me to the
> correct one.

( unfortunately, that's it ;-)

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]