示例#1
0
文件: lib_hline.c 项目: aunali1/exopc
int whline(WINDOW *win, chtype ch, int n)
{
int   code = ERR;
short start;
short end;

	T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));

	if (win) {
		struct ldat *line = &(win->_line[win->_cury]);

		start = win->_curx;
		end   = start + n - 1;
		if (end > win->_maxx)
			end   = win->_maxx;

		CHANGED_RANGE(line, start, end);

		if (ch == 0)
			ch = ACS_HLINE;
		ch = _nc_render(win, ch);

		while ( end >= start) {
			line->text[end] = ch;
			end--;
		}
		code = OK;
	}
	returnCode(code);
}
示例#2
0
文件: lib_insch.c 项目: vocho/openqnx
int  winsch(WINDOW *win, chtype c)
{
int code = ERR;
chtype	*temp1, *temp2;
chtype	*end;

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

	if (win) {
	  end = &win->_line[win->_cury].text[win->_curx];
	  temp1 = &win->_line[win->_cury].text[win->_maxx];
	  temp2 = temp1 - 1;

	  while (temp1 > end)
	    *temp1-- = *temp2--;
	  
	  *temp1 = _nc_render(win, c);
	  
	  win->_line[win->_cury].lastchar = win->_maxx;
	  if (win->_line[win->_cury].firstchar == _NOCHANGE
	      ||  win->_line[win->_cury].firstchar > win->_curx)
	    win->_line[win->_cury].firstchar = win->_curx;
	  code = OK;
	}
	returnCode(code);
}
示例#3
0
whline(WINDOW *win, chtype ch, int n)
{
    int code = ERR;
    NCURSES_SIZE_T start;
    NCURSES_SIZE_T end;

    T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));

    if (win) {
	struct ldat *line = &(win->_line[win->_cury]);
	NCURSES_CH_T wch;

	start = win->_curx;
	end = start + n - 1;
	if (end > win->_maxx)
	    end = win->_maxx;

	CHANGED_RANGE(line, start, end);

	if (ch == 0)
	    SetChar(wch, ChCharOf(ACS_HLINE), ChAttrOf(ACS_HLINE));
	else
	    SetChar(wch, ChCharOf(ch), ChAttrOf(ch));
	wch = _nc_render(win, wch);

	while (end >= start) {
	    line->text[end] = wch;
	    end--;
	}

	_nc_synchook(win);
	code = OK;
    }
    returnCode(code);
}
示例#4
0
wvline(WINDOW *win, chtype ch, int n)
{
    int code = ERR;
    NCURSES_SIZE_T row, col;
    NCURSES_SIZE_T end;

    T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n));

    if (win) {
	NCURSES_CH_T wch;
	row = win->_cury;
	col = win->_curx;
	end = row + n - 1;
	if (end > win->_maxy)
	    end = win->_maxy;

	if (ch == 0)
	    SetChar2(wch, ACS_VLINE);
	else
	    SetChar2(wch, ch);
	wch = _nc_render(win, wch);

	while (end >= row) {
	    struct ldat *line = &(win->_line[end]);
	    line->text[col] = wch;
	    CHANGED_CELL(line, col);
	    end--;
	}

	_nc_synchook(win);
	code = OK;
    }
    returnCode(code);
}
示例#5
0
static inline
int waddch_literal(WINDOW *win, chtype ch)
{
	int x;
	struct ldat *line;

	x = win->_curx;

	CHECK_POSITION(win, x, win->_cury);

	/*
	 * If we're trying to add a character at the lower-right corner more
	 * than once, fail.  (Moving the cursor will clear the flag).
	 */
	if (win->_flags & _WRAPPED) {
		if (x >= win->_maxx)
			return (ERR);
		win->_flags &= ~_WRAPPED;
	}

	ch = render_char(win, ch);
	TR(TRACE_VIRTPUT, ("win attr = %s", _traceattr(win->_attrs)));

	line = win->_line+win->_cury;
	
	if (line->firstchar == _NOCHANGE)
		line->firstchar = line->lastchar = x;
	else if (x < line->firstchar)
		line->firstchar = x;
	else if (x > line->lastchar)
		line->lastchar = x;

	line->text[x++] = ch;
	
	TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracechtype(ch)));
	if (x > win->_maxx) {
		/*
		 * The _WRAPPED flag is useful only for telling an application
		 * that we've just wrapped the cursor.  We don't do anything
		 * with this flag except set it when wrapping, and clear it
		 * whenever we move the cursor.  If we try to wrap at the
		 * lower-right corner of a window, we cannot move the cursor
		 * (since that wouldn't be legal).  So we return an error
		 * (which is what SVr4 does).  Unlike SVr4, we can successfully
		 * add a character to the lower-right corner.
		 */
		win->_flags |= _WRAPPED;
		if (++win->_cury > win->_regbottom) {
			win->_cury = win->_regbottom;
			win->_curx = win->_maxx;
			if (!win->_scroll)
				return (ERR);
			scroll(win);
		}
		win->_curx = 0;
		return (OK);
	}
	win->_curx = x;
	return OK;
}
示例#6
0
int waddch(WINDOW *win, const chtype ch)
{
	int code = ERR;

	TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win, _tracechtype(ch)));

	if (win && (waddch_nosync(win, ch) != ERR))
	{
		_nc_synchook(win);
		code = OK;
	}

	TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code));
	return(code);
}
示例#7
0
int wechochar(WINDOW *win, const chtype ch)
{
	int code = ERR;

	TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win, _tracechtype(ch)));

	if (win && (waddch_nosync(win, ch) != ERR))
	{
		bool	save_immed = win->_immed;
		win->_immed = TRUE;
		_nc_synchook(win);
		win->_immed = save_immed;
		code = OK;
	}
	TR(TRACE_VIRTPUT|TRACE_CCALLS, (T_RETURN("%d"), code));
	return(code);
}
示例#8
0
pechochar(WINDOW *pad, const chtype ch)
{
    T((T_CALLED("pechochar(%p, %s)"), (void *) pad, _tracechtype(ch)));

    if (pad == 0)
	returnCode(ERR);

    if (!(pad->_flags & _ISPAD))
	returnCode(wechochar(pad, ch));

    waddch(pad, ch);
    prefresh(pad, pad->_pad._pad_y,
	     pad->_pad._pad_x,
	     pad->_pad._pad_top,
	     pad->_pad._pad_left,
	     pad->_pad._pad_bottom,
	     pad->_pad._pad_right);

    returnCode(OK);
}
示例#9
0
int  winsch(WINDOW *win, chtype c)
{
int code = ERR;

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

	if (win) {
		struct ldat *line = &(win->_line[win->_cury]);
		chtype *end = &(line->text[win->_curx]);
		chtype *temp1 = &(line->text[win->_maxx]);
		chtype *temp2 = temp1 - 1;

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

		*temp1 = _nc_render(win, c);
		code = OK;
	}
	returnCode(code);
}
示例#10
0
_nc_retrace_chtype (chtype code)
{
    T((T_RETURN("%s"), _tracechtype(code)));
    return code;
}