Back to index

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

Go to the source code of this file.

Functions

 waddnstr (WINDOW *win, const char *astr, int n)
 waddchnstr (WINDOW *win, const chtype *astr, int n)

Function Documentation

waddchnstr ( WINDOW win,
const chtype astr,
int  n 
)

Definition at line 80 of file lib_addstr.c.

{
    NCURSES_SIZE_T y = win->_cury;
    NCURSES_SIZE_T x = win->_curx;
    int code = OK;
    struct ldat *line;

    T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n));

    if (!win)
       returnCode(ERR);

    if (n < 0) {
       const chtype *str;
       n = 0;
       for (str = (const chtype *) astr; *str != 0; str++)
           n++;
    }
    if (n > win->_maxx - x + 1)
       n = win->_maxx - x + 1;
    if (n == 0)
       returnCode(code);

    line = &(win->_line[y]);
#if USE_WIDEC_SUPPORT
    {
       int i;
       for (i = 0; i < n; ++i)
           SetChar(line->text[i + x], ChCharOf(astr[i]), ChAttrOf(astr[i]));
    }
#else
    memcpy(line->text + x, astr, n * sizeof(*astr));
#endif
    CHANGED_RANGE(line, x, x + n - 1);

    _nc_synchook(win);
    returnCode(code);
}

Here is the call graph for this function:

waddnstr ( WINDOW win,
const char *  astr,
int  n 
)

Definition at line 50 of file lib_addstr.c.

{
    const char *str = astr;
    int code = ERR;

    T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbufn(astr, n), n));

    if (win && (str != 0)) {
       TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(win->_attrs)));
       code = OK;
       if (n < 0)
           n = (int) strlen(astr);

       TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
       while ((n-- > 0) && (*str != '\0')) {
           NCURSES_CH_T ch;
           TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str)));
           SetChar(ch, UChar(*str++), A_NORMAL);
           if (_nc_waddch_nosync(win, ch) == ERR) {
              code = ERR;
              break;
           }
       }
       _nc_synchook(win);
    }
    TR(TRACE_VIRTPUT, ("waddnstr returns %d", code));
    returnCode(code);
}

Here is the call graph for this function:

Here is the caller graph for this function: