[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to avoid ncurses for a small app.
From: |
Thomas Dickey |
Subject: |
Re: how to avoid ncurses for a small app. |
Date: |
Tue, 20 Jun 2006 20:11:21 -0400 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
On Mon, Jun 19, 2006 at 08:39:25PM +0100, chinlu chinawa wrote:
> >ncurses reads a data structure from the file; it's in
>
> >used in the read_entry.c file and (mostly(*))
> >documented in the term (7) manpage.
>
> Hello Thomas,
>
> As you said, this is a bit difficult, but really
> interesting though. I've been looking at this, and
> there are a few things I'd like to ask you.
>
> First, given the terminfo's format described in (5)
> term, and read_entry.c, I don't undestand is why one
> can't see any big-endian/little-endian code-switching
> mechanism.
That's done with these macros in read_entry.c:
#define BYTE(p,n) (unsigned char)((p)[n])
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
Only bytes, shorts (two bytes) and strings are stored.
The first byte (lower address) of a short is always the high-order byte.
> As far as I understand it, I'm supossed to provide
> support for terminfo's database retrieval independent
> of host's target endiannes, no?
>
> Secondly, in term of terminfo/termios, given this
> structure from asm/termbits.h:
>
> #define NCCS 19
> struct termios {
> tcflag_t c_iflag; /* input mode flags */
> tcflag_t c_oflag; /* output mode flags */
> tcflag_t c_cflag; /* control mode flags */
> tcflag_t c_lflag; /* local mode flags */
> cc_t c_line; /* line discipline */
> cc_t c_cc[NCCS]; /* control characters */
> };
>
> Am I supossed to fill c_cc with the respective control
> chars from the terminfo database, and then perform an
> TCSETS ioctl?
no - the ioctl fills in the data.
> If I'm undestanding it ok, doing it so plus setting
> the correct flags on the other structure's members,
> input might be handled as I expect despite of which
> terminfo database the TERM environment variable points
> to.
>
> Kind Regards,
>
>
>
>
>
> ___________________________________________________________
> The all-new Yahoo! Mail goes wherever you go - free your email address from
> your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
>
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net