CS318 - Pintos
Pintos source browser for JHU CS318 course
Data Structures | Functions
console.c File Reference
#include <stdio.h>
#include <string.h>
#include <syscall.h>
#include <syscall-nr.h>
Include dependency graph for console.c:

Go to the source code of this file.

Data Structures

struct  vhprintf_aux
 Auxiliary data for vhprintf_helper(). More...
 

Functions

int vprintf (const char *format, va_list args)
 The standard vprintf() function, which is like printf() but uses a va_list. More...
 
int hprintf (int handle, const char *format,...)
 Like printf(), but writes output to the given HANDLE. More...
 
int puts (const char *s)
 Writes string S to the console, followed by a new-line character. More...
 
int putchar (int c)
 Writes C to the console. More...
 
static void add_char (char c, void *aux_)
 Adds C to the buffer in AUX, flushing it if the buffer fills up. More...
 
static void flush (struct vhprintf_aux *aux)
 Flushes the buffer in AUX. More...
 
int vhprintf (int handle, const char *format, va_list args)
 Formats the printf() format specification FORMAT with arguments given in ARGS and writes the output to the given HANDLE. More...
 

Function Documentation

◆ add_char()

static void add_char ( char  c,
void *  aux_ 
)
static

Adds C to the buffer in AUX, flushing it if the buffer fills up.

Definition at line 78 of file console.c.

References vhprintf_aux::buf, vhprintf_aux::char_cnt, flush(), and vhprintf_aux::p.

Referenced by vhprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

static void flush ( struct vhprintf_aux aux)
static

Flushes the buffer in AUX.

Definition at line 89 of file console.c.

References vhprintf_aux::buf, vhprintf_aux::handle, vhprintf_aux::p, and write().

Referenced by add_char(), and vhprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hprintf()

int hprintf ( int  handle,
const char *  format,
  ... 
)

Like printf(), but writes output to the given HANDLE.

Definition at line 16 of file console.c.

References va_end, va_start, and vhprintf().

Referenced by expand(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ putchar()

int putchar ( int  c)

Writes C to the console.

Writes C to the vga display and serial port.

Definition at line 41 of file console.c.

References acquire_console(), putchar_have_lock(), release_console(), STDOUT_FILENO, and write().

Here is the call graph for this function:

◆ puts()

int puts ( const char *  s)

Writes string S to the console, followed by a new-line character.

Definition at line 31 of file console.c.

References acquire_console(), putchar(), putchar_have_lock(), release_console(), s, STDOUT_FILENO, strlen(), and write().

Here is the call graph for this function:

◆ vhprintf()

int vhprintf ( int  handle,
const char *  format,
va_list  args 
)

Formats the printf() format specification FORMAT with arguments given in ARGS and writes the output to the given HANDLE.

Definition at line 64 of file console.c.

References __vprintf(), add_char(), vhprintf_aux::buf, vhprintf_aux::char_cnt, flush(), vhprintf_aux::handle, and vhprintf_aux::p.

Referenced by hprintf(), and vprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vprintf()

int vprintf ( const char *  format,
va_list  args 
)

The standard vprintf() function, which is like printf() but uses a va_list.

Definition at line 9 of file console.c.

References STDOUT_FILENO, and vhprintf().

Here is the call graph for this function: