iPXE
mucurses.h File Reference

MuCurses core implementation specific header file. More...

Go to the source code of this file.

Macros

#define WRAP   0
#define NOWRAP   1

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void _wputch (WINDOW *win, chtype ch, int wrap) __nonnull
 Write a single character rendition to a window.
void _wputc (WINDOW *win, char c, int wrap) __nonnull
 Write a single character to a window.
void _wputchstr (WINDOW *win, const chtype *chstr, int wrap, int n) __nonnull
 Write a chtype string to a window.
void _wputstr (WINDOW *win, const char *str, int wrap, int n) __nonnull
 Write a standard c-style string to a window.
void _wcursback (WINDOW *win) __nonnull
 Retreat the cursor back one position (useful for a whole host of ops)

Variables

SCREEN _ansi_screen

Detailed Description

MuCurses core implementation specific header file.

Definition in file mucurses.h.

Macro Definition Documentation

◆ WRAP

#define WRAP   0

◆ NOWRAP

#define NOWRAP   1

Definition at line 14 of file mucurses.h.

Referenced by _print_label(), slk_restore(), waddchnstr(), wborder(), wdelch(), whline(), and wvline().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ _wputch()

void _wputch ( WINDOW * win,
chtype ch,
int wrap )
extern

Write a single character rendition to a window.

Parameters
*winwindow in which to write
chcharacter rendition to write
wrapwrap "switch"

Definition at line 51 of file mucurses.c.

51 {
52 /* make sure we set the screen cursor to the right position
53 first! */
54 _wupdcurs(win);
55 win->scr->putc(win->scr, ch);
56 if ( ++(win->curs_x) - win->width == 0 ) {
57 if ( wrap == WRAP ) {
58 win->curs_x = 0;
59 /* specification says we should really scroll,
60 but we have no buffer to scroll with, so we
61 can only overwrite back at the beginning of
62 the window */
63 if ( ++(win->curs_y) - win->height == 0 )
64 win->curs_y = 0;
65 } else {
66 (win->curs_x)--;
67 }
68 }
69}
static void _wupdcurs(WINDOW *win) __nonnull
Update cursor position.
Definition mucurses.c:39
#define WRAP
Definition mucurses.h:13
uint8_t ch
Definition registers.h:1
void(* putc)(struct _curses_screen *scr, chtype c)
Write character to current cursor position.
Definition curses.h:64
unsigned int curs_x
window cursor position
Definition curses.h:98
unsigned int width
window dimensions
Definition curses.h:100
unsigned int height
Definition curses.h:100
unsigned int curs_y
Definition curses.h:98
SCREEN * scr
screen with which window associates
Definition curses.h:92

References _wupdcurs(), ch, _curses_window::curs_x, _curses_window::curs_y, _curses_window::height, _curses_screen::putc, _curses_window::scr, _curses_window::width, and WRAP.

Referenced by _printw_handler(), _wgetc(), _wputc(), _wputchstr(), delwin(), slk_restore(), waddch(), wborder(), wgetch(), whline(), and wvline().

◆ _wputc()

void _wputc ( WINDOW * win,
char c,
int wrap )
extern

Write a single character to a window.

Parameters
*winwindow in which to write
ccharacter rendition to write
wrapwrap "switch"

Definition at line 78 of file mucurses.c.

78 {
79 _wputch ( win, ( ( ( unsigned char ) c ) | win->attrs ), wrap );
80}
void _wputch(WINDOW *win, chtype ch, int wrap) __nonnull
Write a single character rendition to a window.
Definition mucurses.c:51
attr_t attrs
window attributes
Definition curses.h:94

References _wputch(), and _curses_window::attrs.

Referenced by _wputstr(), wclrtobot(), wclrtoeol(), and wdelch().

◆ _wputchstr()

void _wputchstr ( WINDOW * win,
const chtype * chstr,
int wrap,
int n )
extern

Write a chtype string to a window.

Parameters
*winwindow in which to write
*chstrchtype string
wrapwrap "switch"
nwrite at most n chtypes

Definition at line 108 of file mucurses.c.

108 {
109 for ( ; *chstr && n-- ; chstr++ ) {
110 _wputch(win,*chstr,wrap);
111 }
112}

References _wputch().

Referenced by waddchnstr().

◆ _wputstr()

void _wputstr ( WINDOW * win,
const char * str,
int wrap,
int n )
extern

Write a standard c-style string to a window.

Parameters
*winwindow in which to write
*strstring
wrapwrap "switch"
nwrite at most n chars from *str

Definition at line 122 of file mucurses.c.

122 {
123 for ( ; *str && n-- ; str++ ) {
124 _wputc ( win, *str, wrap );
125 }
126}
void _wputc(WINDOW *win, char c, int wrap) __nonnull
Write a single character to a window.
Definition mucurses.c:78

References _wputc().

Referenced by _print_label(), and waddnstr().

◆ _wcursback()

void _wcursback ( WINDOW * win)
extern

Retreat the cursor back one position (useful for a whole host of ops)

Parameters
*winwindow in which to retreat

Definition at line 88 of file mucurses.c.

88 {
89 if ( win->curs_x == 0 ) {
90 if ( win->curs_y == 0 )
91 win->curs_y = win->height - 1;
92 win->curs_x = win->width = 1;
93 } else {
94 win->curs_x--;
95 }
96
97 _wupdcurs(win);
98}

References _wupdcurs(), _curses_window::curs_x, _curses_window::curs_y, _curses_window::height, and _curses_window::width.

Referenced by wdelch(), wgetch(), and wgetnstr().

Variable Documentation

◆ _ansi_screen

SCREEN _ansi_screen
extern

Definition at line 94 of file ansi_screen.c.

94 {
95 .init = ansiscr_init,
96 .exit = ansiscr_exit,
97 .erase = ansiscr_erase,
98 .movetoyx = ansiscr_movetoyx,
99 .putc = ansiscr_putc,
100 .getc = ansiscr_getc,
101 .peek = ansiscr_peek,
102 .cursor = ansiscr_cursor,
103};
static void ansiscr_movetoyx(struct _curses_screen *scr, unsigned int y, unsigned int x) __nonnull
Definition ansi_screen.c:54
static int ansiscr_getc(struct _curses_screen *scr __unused)
Definition ansi_screen.c:81
static bool ansiscr_peek(struct _curses_screen *scr __unused)
Definition ansi_screen.c:85
static void ansiscr_exit(struct _curses_screen *scr)
Definition ansi_screen.c:44
static void ansiscr_erase(struct _curses_screen *scr, attr_t attrs)
Definition ansi_screen.c:49
static void ansiscr_putc(struct _curses_screen *scr, chtype c) __nonnull
Definition ansi_screen.c:64
static void ansiscr_cursor(struct _curses_screen *scr __unused, int visibility)
Definition ansi_screen.c:89
static void ansiscr_init(struct _curses_screen *scr)
Definition ansi_screen.c:39