Re: tty.c

Pavel Tsekov wrote:
Hello Roland,

2005-08-29  Roland Illig  <roland illig gmx de>

        * slint.c: The handling of user interrupts has been moved to ...
        * tty.c: ... this newly created file, which contains a simple,
        not yet complete interface to the terminal library. It should be
        used instead of depending directly on ncurses or SLang features.
        * tty.h: Added the new function prototypes from tty.c and some
        legacy definitions.

Why ? Why another wrapper ? The stuff in myslang.h is supposed to emulate
curses calls. Now you introduce another interface.

Because this wrapper tells the reader which functions from the screen library we actually use. It is the set of features that both libraries provide.

The new function names all start with tty_, which is a strong indication where to look for them when you need to know how they are implemented. Instead of the low-level function call sequence acs(), addch(), noacs(), you only need to call tty_print_alt_char(), which is much simpler.

I don't want to depend directly on ncurses or slang, and I don't want one of them to look like the other one (like what myslang.h does now). I prefer having a small interface that provides all that we need in its own namespace. Then we have one point where we can see on which features of the screen library we depend and what the differences are.

Another benefit of the wrapper is that it reduces the number of warnings for SLsmg_printf(), which is still declared as taking a char *, not a const char *, as first argument. Just build mc with gcc -Wwrite-string and see.


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