Back to index

tetex-bin  3.0
Functions
lib_insch.c File Reference
#include <curses.priv.h>
#include <ctype.h>

Go to the source code of this file.

Functions

void _nc_insert_ch (WINDOW *win, chtype ch)
 winsch (WINDOW *win, chtype c)

Function Documentation

void _nc_insert_ch ( WINDOW win,
chtype  ch 
)

Definition at line 53 of file lib_insch.c.

{
    NCURSES_CH_T wch;
    int count;
    NCURSES_CONST char *s;

    switch (ch) {
    case '\t':
       for (count = (TABSIZE - (win->_curx % TABSIZE)); count > 0; count--)
           _nc_insert_ch(win, ' ');
       break;
    case '\n':
    case '\r':
    case '\b':
       SetChar2(wch, ch);
       _nc_waddch_nosync(win, wch);
       break;
    default:
       if (
#if USE_WIDEC_SUPPORT
              WINDOW_EXT(win, addch_used) == 0 &&
#endif
              is8bits(ChCharOf(ch)) &&
              isprint(ChCharOf(ch))) {
           if (win->_curx <= win->_maxx) {
              struct ldat *line = &(win->_line[win->_cury]);
              NCURSES_CH_T *end = &(line->text[win->_curx]);
              NCURSES_CH_T *temp1 = &(line->text[win->_maxx]);
              NCURSES_CH_T *temp2 = temp1 - 1;

              SetChar2(wch, ch);

              CHANGED_TO_EOL(line, win->_curx, win->_maxx);
              while (temp1 > end)
                  *temp1-- = *temp2--;

              *temp1 = _nc_render(win, wch);

              win->_curx++;
           }
       } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
           s = unctrl(ChCharOf(ch));
           while (*s != '\0') {
              _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
              ++s;
           }
       }
#if USE_WIDEC_SUPPORT
       else {
           /*
            * Handle multibyte characters here
            */
           if (WINDOW_EXT(win, addch_used) == 0) {
              _nc_insert_ch(win, ChAttrOf(ch) | ' ');
           }
           SetChar2(wch, ch);
           _nc_waddch_nosync(win, wch);
       }
#endif
       break;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

winsch ( WINDOW win,
chtype  c 
)

Definition at line 117 of file lib_insch.c.

{
    NCURSES_SIZE_T oy;
    NCURSES_SIZE_T ox;
    int code = ERR;

    T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));

    if (win != 0) {
       oy = win->_cury;
       ox = win->_curx;

       _nc_insert_ch(win, c);

       win->_curx = ox;
       win->_cury = oy;
       _nc_synchook(win);
       code = OK;
    }
    returnCode(code);
}

Here is the call graph for this function: