print.c File Reference

MuCurses printing functions. More...

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

Go to the source code of this file.

Data Structures

struct  printw_context

Functions

 FILE_LICENCE (GPL2_OR_LATER)
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   ) 

int waddch ( WINDOW win,
const chtype  ch 
)

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

Parameters:
*win window to be rendered in
ch character to be added at cursor
Return values:
rc return status code

Definition at line 23 of file print.c.

References _wputch(), OK, and WRAP.

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

00023                                             {
00024         _wputch( win, ch, WRAP );
00025         return OK;
00026 }

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

Add string of single-byte characters to a window.

Parameters:
*win window to be rendered in
*str standard c-style string
n max number of chars from string to render
Return values:
rc return 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().

00036                                                      {
00037         _wputstr( win, str, WRAP, n );
00038         return OK;
00039 }

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().

00046                                                                            {
00047         struct printw_context *wctx =
00048                 container_of ( ctx, struct printw_context, ctx );
00049 
00050         _wputch( wctx->win, c | wctx->win->attrs, WRAP );
00051 }

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

Print formatted output in a window.

Parameters:
*win subject window
*fmt formatted string
varglist argument list
Return values:
rc return 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().

00061                                                                  {
00062         struct printw_context wctx;
00063 
00064         wctx.win = win;
00065         wctx.ctx.handler = _printw_handler;
00066         vcprintf ( &(wctx.ctx), fmt, varglist );
00067         return OK;
00068 }

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

Print formatted output to a window.

Parameters:
*win subject window
*fmt formatted string
... string arguments
Return values:
rc return status code

Definition at line 78 of file print.c.

References va_end, va_start, and vw_printw().

00078                                                   {
00079         va_list args;
00080         int i;
00081 
00082         va_start ( args, fmt );
00083         i = vw_printw ( win, fmt, args );
00084         va_end ( args );
00085         return i;
00086 }


Generated on Tue Apr 6 20:01:46 2010 for gPXE by  doxygen 1.5.7.1