Main Page | File List | Globals | Related Pages

console.h File Reference

Function prototypes for the console driver. More...

#include <video_defines.h>

Go to the source code of this file.

Functions

int putbyte (char ch)
 Prints character ch at the current location of the cursor.

void putbytes (const char *s, int len)
 Prints the string s, starting at the current location of the cursor.

void set_term_color (int color)
 Changes the foreground and background color of future characters printed on the console.

void get_term_color (int *color)
 Writes the current foreground and background color of characters printed on the console into the argument color.

void set_cursor (int row, int col)
 Sets the position of the cursor to the position (row, col).

void get_cursor (int *row, int *col)
 Writes the current position of the cursor into the arguments row and col.

void hide_cursor ()
 Hides the cursor.

void show_cursor ()
 Shows the cursor.

void clear_console ()
 Clears the entire console.

void draw_char (int row, int col, int ch, int color)
 Prints character ch with the specified color at position (row, col).

char get_char (int row, int col)
 Returns the character displayed at position (row, col).


Detailed Description

Function prototypes for the console driver.

This contains the prototypes for the console driver and eventually any macros, constants, or global variables you will need.

Author:
Harry Q. Bovik (hqbovik)

Fred Hacker (fhacker)

Bug:
No known bugs.

Function Documentation

void clear_console  ) 
 

Clears the entire console.

Returns:
Void.

void draw_char int  row,
int  col,
int  ch,
int  color
 

Prints character ch with the specified color at position (row, col).

If any argument is invalid, the function has no effect.

Parameters:
row The row in which to display the character.
col The column in which to display the character.
ch The character to display.
color The color to use to display the character.
Returns:
Void.

char get_char int  row,
int  col
 

Returns the character displayed at position (row, col).

Parameters:
row Row of the character.
col Column of the character.
Returns:
The character at (row, col).

void get_cursor int *  row,
int *  col
 

Writes the current position of the cursor into the arguments row and col.

Parameters:
row The address to which the current cursor row will be written.
col The address to which the current cursor column will be written.
Returns:
Void.

void get_term_color int *  color  ) 
 

Writes the current foreground and background color of characters printed on the console into the argument color.

Parameters:
color The address to which the current color information will be written.
Returns:
Void.

void hide_cursor  ) 
 

Hides the cursor.

Subsequent calls to putbytes must not cause the cursor to show again.

Returns:
Void.

int putbyte char  ch  ) 
 

Prints character ch at the current location of the cursor.

If the character is a newline ('
'), the cursor should be moved to the next line (scrolling if necessary). If the character is a carriage return (''), the cursor should be immediately reset to the beginning of the current line, causing any future output to overwrite any existing output on the line. If backsapce ('') is encountered, the previous character should be erased (write a space over it and move the cursor back one column). It is up to you how you want to handle a backspace occurring at the beginning of a line.

Parameters:
ch the character to print
Returns:
The input character

void putbytes const char *  s,
int  len
 

Prints the string s, starting at the current location of the cursor.

If the string is longer than the current line, the string should fill up the current line and then continue on the next line. If the string exceeds available space on the entire console, the screen should scroll up one line, and then the string should continue on the new line. If '
', '', and '' are encountered within the string, they should be handled as per putbyte. If len is not a positive integer or s is null, the function has no effect.

Parameters:
s The string to be printed.
len The length of the string s.
Returns:
Void.

void set_cursor int  row,
int  col
 

Sets the position of the cursor to the position (row, col).

Subsequent calls to putbytes should cause the console output to begin at the new position. If the cursor is currently hidden, a call to set_cursor() must not show the cursor.

Parameters:
row The new row for the cursor.
col The new column for the cursor.
Returns:
Void.

void set_term_color int  color  ) 
 

Changes the foreground and background color of future characters printed on the console.

If the color code is invalid, the function has no effect.

Parameters:
color The new color code.
Returns:
Void.

void show_cursor  ) 
 

Shows the cursor.

If the cursor is already shown, the function has no effect.

Returns:
Void.


Generated on Fri Aug 29 15:20:26 2003 for 15-410 Project 1 by doxygen 1.3.2