コード例 #1
0
ファイル: winmsg.c プロジェクト: Distrotech/screen
winmsg_esc_ex(TruncPos, uint8_t perc, bool ellip)
{
	/* TODO: encapsulate */
	wmbc->trunc.pos = wmbc_offset(wmbc);
	wmbc->trunc.perc = perc;
	wmbc->trunc.ellip = ellip;
}
コード例 #2
0
ファイル: winmsgbuf.c プロジェクト: jfjhh/screen
/* Attempts buffer expansion and updates context pointers appropriately. The
 * result is true if expansion succeeded, otherwise false. */
static bool _wmbc_expand(WinMsgBufContext *wmbc, size_t size)
{
	size_t offset = wmbc_offset(wmbc);

	if (wmb_expand(wmbc->buf, size) < size) {
		return false;
	}

	/* the buffer address may have changed; re-calculate pointer address */
	wmbc->p = wmbc->buf->buf + offset;
	return true;
}
コード例 #3
0
ファイル: winmsgbuf.c プロジェクト: jfjhh/screen
/* Merges the contents of another null-terminated buffer and its renditions. The
 * return value is a pointer to the first character of WMB's buffer. */
char *wmbc_mergewmb(WinMsgBufContext *wmbc, WinMsgBuf *wmb)
{
	char *p;
	size_t offset = wmbc_offset(wmbc);
	int ri;

	/* import buffer contents into our own at our current position */
	assert(wmb);
	p = wmbc_strcpy(wmbc, wmb->buf);

	/* merge renditions, adjusting them to reflect their new offset */
	for (ri = 0; ri < wmb->numrend; ri++) {
		wmb_rendadd(wmbc->buf, wmb->rend[ri], offset + wmb->rendpos[ri]);
	}

	return p;
}
コード例 #4
0
ファイル: winmsgbuf.c プロジェクト: jfjhh/screen
/* Calculate the number of bytes remaining in the buffer relative to the current
 * position within the buffer */
size_t wmbc_bytesleft(WinMsgBufContext *wmbc)
{
	return wmbc->buf->size - wmbc_offset(wmbc);
}