iPXE
print.c File Reference

MuCurses printing functions. More...

#include <curses.h>
#include <stdio.h>
#include <stddef.h>
#include <ipxe/vsprintf.h>
#include "mucurses.h"

Go to the source code of this file.

Data Structures

struct  printw_context

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
int waddch (WINDOW *win, const chtype ch)
 Add a single-byte character and rendition to a window and advance the cursor.
int waddnstr (WINDOW *win, const char *str, int n)
 Add string of single-byte characters to a window.
static void _printw_handler (struct printf_context *ctx, unsigned int c)
int vw_printw (WINDOW *win, const char *fmt, va_list varglist)
 Print formatted output in a window.
int wprintw (WINDOW *win, const char *fmt,...)
 Print formatted output to a window.

Detailed Description

MuCurses printing functions.

Definition in file print.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ waddch()

int waddch ( WINDOW * win,
const chtype ch )

Add a single-byte character and rendition to a window and advance the cursor.

Parameters
*winwindow to be rendered in
chcharacter to be added at cursor
Return values
rcreturn status code

Definition at line 24 of file print.c.

24 {
25 _wputch( win, ch, WRAP );
26 return OK;
27}
#define OK
Definition curses.h:25
void _wputch(WINDOW *win, chtype ch, int wrap) __nonnull
Write a single character rendition to a window.
Definition mucurses.c:51
#define WRAP
Definition mucurses.h:13
uint8_t ch
Definition registers.h:1

References _wputch(), ch, OK, and WRAP.

Referenced by addch(), mvaddch(), and mvwaddch().

◆ waddnstr()

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

Add string of single-byte characters to a window.

Parameters
*winwindow to be rendered in
*strstandard c-style string
nmax number of chars from string to render
Return values
rcreturn status code

Definition at line 37 of file print.c.

37 {
38 _wputstr( win, str, WRAP, n );
39 return OK;
40}
void _wputstr(WINDOW *win, const char *str, int wrap, int n) __nonnull
Write a standard c-style string to a window.
Definition mucurses.c:122

References _wputstr(), OK, and WRAP.

Referenced by addnstr(), addstr(), mvaddnstr(), mvaddstr(), mvwaddnstr(), mvwaddstr(), and waddstr().

◆ _printw_handler()

void _printw_handler ( struct printf_context * ctx,
unsigned int c )
static

Definition at line 47 of file print.c.

47 {
48 struct printw_context *wctx =
50
51 _wputch( wctx->win, c | wctx->win->attrs, WRAP );
52}
struct golan_eq_context ctx
Definition CIB_PRM.h:0
#define container_of(ptr, type, field)
Get containing structure.
Definition stddef.h:36
attr_t attrs
window attributes
Definition curses.h:94
WINDOW * win
Definition print.c:44

References _wputch(), _curses_window::attrs, container_of, ctx, printw_context::win, and WRAP.

Referenced by vw_printw().

◆ vw_printw()

int vw_printw ( WINDOW * win,
const char * fmt,
va_list varglist )

Print formatted output in a window.

Parameters
*winsubject window
*fmtformatted string
varglistargument list
Return values
rcreturn status code

Definition at line 62 of file print.c.

62 {
63 struct printw_context wctx;
64
65 wctx.win = win;
66 wctx.ctx.handler = _printw_handler;
67 vcprintf ( &(wctx.ctx), fmt, varglist );
68 return OK;
69}
static void _printw_handler(struct printf_context *ctx, unsigned int c)
Definition print.c:47
size_t vcprintf(struct printf_context *ctx, const char *fmt, va_list args)
Write a formatted string to a printf context.
Definition vsprintf.c:188
int ssize_t const char * fmt
Definition vsprintf.h:73

References _printw_handler(), printw_context::ctx, fmt, printf_context::handler, OK, vcprintf(), and printw_context::win.

Referenced by vwprintw(), and wprintw().

◆ wprintw()

int wprintw ( WINDOW * win,
const char * fmt,
... )

Print formatted output to a window.

Parameters
*winsubject window
*fmtformatted string
...string arguments
Return values
rcreturn status code

Definition at line 79 of file print.c.

79 {
80 va_list args;
81 int i;
82
83 va_start ( args, fmt );
84 i = vw_printw ( win, fmt, args );
85 va_end ( args );
86 return i;
87}
int vw_printw(WINDOW *win, const char *fmt, va_list varglist)
Print formatted output in a window.
Definition print.c:62
#define va_end(ap)
Definition stdarg.h:10
#define va_start(ap, last)
Definition stdarg.h:8
__builtin_va_list va_list
Definition stdarg.h:7

References fmt, va_end, va_start, vw_printw(), and printw_context::win.