iPXE
Data Structures | Functions
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)
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 ( GPL2_OR_LATER_OR_UBDL  )
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 23 of file print.c.

References _wputch(), OK, and WRAP.

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

                                            {
        _wputch( win, ch, WRAP );
        return OK;
}
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 36 of file print.c.

References _wputstr(), OK, and WRAP.

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

                                                     {
        _wputstr( win, str, WRAP, n );
        return OK;
}
static void _printw_handler ( struct printf_context ctx,
unsigned int  c 
) [static]

Definition at line 46 of file print.c.

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

Referenced by vw_printw().

                                                                           {
        struct printw_context *wctx =
                container_of ( ctx, struct printw_context, ctx );

        _wputch( wctx->win, c | wctx->win->attrs, WRAP );
}
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 61 of file print.c.

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

Referenced by vwprintw(), and wprintw().

                                                                 {
        struct printw_context wctx;

        wctx.win = win;
        wctx.ctx.handler = _printw_handler;
        vcprintf ( &(wctx.ctx), fmt, varglist );
        return OK;
}
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 78 of file print.c.

References va_end, va_start, and vw_printw().

                                                  {
        va_list args;
        int i;

        va_start ( args, fmt );
        i = vw_printw ( win, fmt, args );
        va_end ( args );
        return i;
}