Go to the documentation of this file.
68 printf(
"failed to open `%s': %s\r\n",
76 printf(
"failed to open `%s': %s\r\n",
152 n =
::read(
input, tmp, size <
sizeof(tmp) ? size :
sizeof(tmp));
184 for (
Size i = 0; i < size; i++)
186 if (bytes[i] ==
'\n')
268 row < rect->tr_end.tp_row; row++)
272 col < rect->tr_end.tp_col; col++)
299 numCols + (numRows * width) *
sizeof(
u16));
void copy(Terminal *term, const teken_rect_t *rect, const teken_pos_t *pos)
Copy bytes to the terminal.
void tf_copy_t(void *, const teken_rect_t *, const teken_pos_t *)
FileSystem::Result writeTerminal(const u8 *bytes, const Size size)
Write bytes to the output device.
teken_pos_t cursorPos
Saved cursor position.
const char * inputFile
Path to the input and output files.
int getInput()
Retrieve file descriptor of the input source.
size_t strlen(const char *str)
Calculate the length of a string.
C int errno
The lvalue errno is used by many functions to return error values.
void tf_cursor_t(void *, const teken_pos_t *)
void setCursor(const teken_pos_t *pos)
Sets the new position of the cursor.
u16 * buffer
Buffer for local Terminal updates.
u16 * getCursorValue()
Saved byte and attribute value at cursor position.
virtual ~Terminal()
Class destructor.
#define VGA_ATTR(front, back)
Encodes VGA attributes.
Abstract device class interface.
teken_t state
Terminal state.
void param(Terminal *term, int key, int value)
Set terminal parameters.
int open(const char *path, int oflag,...)
Open file relative to directory file descriptor.
tf_respond_t * tf_respond
void tf_fill_t(void *, const teken_rect_t *, teken_char_t, const teken_attr_t *)
tf_putchar_t * tf_putchar
void teken_set_winsize(teken_t *t, const teken_pos_t *p)
void showCursor()
Show the VGA cursor.
u16 cursorValue
Saved value at cursor position.
virtual FileSystem::Result initialize()
Initialize the Terminal.
int printf(const char *format,...)
Output a formatted string to standard output.
int close(int fildes)
Close a file descriptor.
teken_funcs_t funcs
Terminal function handlers.
void teken_input(teken_t *t, const void *buf, size_t len)
Size getWidth()
Retrieve the width of the Terminal.
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read bytes from the Terminal.
unsigned short u16
Unsigned 16-bit number.
Abstract Input/Output buffer.
void cursor(Terminal *term, const teken_pos_t *pos)
Sets the Terminal cursor.
char * strerror(int errnum)
The strerror function maps the number in errnum to a message string.
unsigned int u32
Unsigned 32-bit number.
void teken_init(teken_t *t, const teken_funcs_t *tf, void *softc)
unsigned int Size
Any sane size indicator cannot go negative.
void bell(Terminal *term)
Makes a sound (bell).
#define BANNER
Print this banner per default on new Terminals.
void tf_respond_t(void *, const void *, size_t)
#define O_RDWR
Open for reading and writing.
unsigned char teken_char_t
off_t lseek(int fildes, off_t offset, int whence)
Move the read/write file offset.
void tf_putchar_t(void *, const teken_pos_t *, teken_char_t, const teken_attr_t *)
Terminal(const u32 inode, const char *inputFile, const char *outputFile, const Size width=80, const Size height=25)
Class constructor.
String m_identifier
Unique identifier for this Device.
#define SEEK_SET
Seek relative to start-of-file.
Result
Result code for filesystem Actions.
unsigned char u8
Unsigned 8-bit number.
void hideCursor()
Hides the cursor from the VGA screen.
u16 * getBuffer()
Retrieve a pointer to the local buffer.
void * memset(void *dest, int ch, size_t count)
Fill memory with a constant byte.
void tf_param_t(void *, int, unsigned int)
Size getHeight()
Retrieve the height of the Terminal.
const Size width
Width and height of the Terminal.
int getOutput()
Retrieve file descriptor of the output source.
#define VGA_CHAR(ch, front, back)
Encodes a character for VGA output.
void * memcpy(void *dest, const void *src, size_t count)
Copy memory from one place to another.
void respond(Terminal *ctx, const void *buf, size_t size)
Unused.
int input
Input and output file descriptors.
#define O_RDONLY
Open for reading only.
void fill(Terminal *term, const teken_rect_t *rect, teken_char_t ch, const teken_attr_t *attr)
Fills the Terminal buffer with a character.
void putchar(Terminal *term, const teken_pos_t *pos, teken_char_t ch, const teken_attr_t *attr)
Output a new character.
A Terminal enables user to interact with the system.
virtual FileSystem::Result write(IOBuffer &buffer, Size &size, const Size offset)
Write bytes to the Terminal.