| 1 |
/* |
| 2 |
* Copyright (c) 2003-2005 RIKEN Japan, All rights reserved. |
| 3 |
* |
| 4 |
* Redistribution and use in source and binary forms, with or without |
| 5 |
* modification, are permitted provided that the following conditions |
| 6 |
* are met: |
| 7 |
* |
| 8 |
* 1. Redistributions of source code must retain the above copyright |
| 9 |
* notice, this list of conditions and the following disclaimer. |
| 10 |
* |
| 11 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 12 |
* notice, this list of conditions and the following disclaimer in the |
| 13 |
* documentation and/or other materials provided with the distribution. |
| 14 |
* |
| 15 |
* THIS SOFTWARE IS PROVIDED BY RIKEN AND CONTRIBUTORS ``AS IS'' AND ANY |
| 16 |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RIKEN OR CONTRIBUTORS BE |
| 19 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 25 |
* THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
*/ |
| 27 |
|
| 28 |
/* $Id: termios_console.h,v 1.1.1.1 2004/03/31 08:15:07 orrisroot Exp $ */ |
| 29 |
|
| 30 |
#ifndef __TERMIOS_TTY_H__ |
| 31 |
#define __TERMIOS_TTY_H__ |
| 32 |
|
| 33 |
#include "terminal.h" |
| 34 |
|
| 35 |
class termios_console : public tty_console { |
| 36 |
private: |
| 37 |
bool term_is_auto_lf(){ return false; } |
| 38 |
void term_move_down(int y){ sl4_term_cursor_down(y); } |
| 39 |
void term_move_up(int y){ sl4_term_cursor_up(y); } |
| 40 |
void term_move_right(int x){ sl4_term_cursor_right(x); } |
| 41 |
void term_move_left(int x){ sl4_term_cursor_left(x); } |
| 42 |
void term_move_bol(){ sl4_term_cursor_bol(); } |
| 43 |
void term_move_newline(){ sl4_term_cursor_newline(); } |
| 44 |
void term_bell(){ sl4_term_bell(); } |
| 45 |
void term_vbell(){ sl4_term_vbell(); } |
| 46 |
void term_clear_screen(){ sl4_term_clear_screen(); } |
| 47 |
void term_clear_eol(int x){ sl4_term_clear_eol(x); } |
| 48 |
void term_set_attr_normal(){ sl4_term_attr_normal(); } |
| 49 |
void term_set_attr_bold(){ sl4_term_attr_bold(); } |
| 50 |
void term_set_attr_reverse(){ sl4_term_attr_reverse(); } |
| 51 |
void term_set_attr_underline(){ sl4_term_attr_underline(); } |
| 52 |
bool term_has_color(); |
| 53 |
void term_putc(int c){ sl4_term_putc(c); } |
| 54 |
void term_print(const char *str){ sl4_term_puts(str); } |
| 55 |
int term_keypad_getc(); |
| 56 |
int term_getc(){ return sl4_term_getc(); } |
| 57 |
char* term_gets(char *buf, int size); |
| 58 |
void term_edit_mode(){ sl4_tty_setmode(TTY_MODE_RAW); } |
| 59 |
void term_normal_mode(){ sl4_tty_setmode(TTY_MODE_NORMAL); } |
| 60 |
public: |
| 61 |
termios_console(); |
| 62 |
~termios_console(){ sl4_term_quit(); } |
| 63 |
void term_flush(sl4_fd_t fd); |
| 64 |
void term_set_fgcolor(SL_TTY::COLOR color){} |
| 65 |
void term_set_bgcolor(SL_TTY::COLOR color){} |
| 66 |
void term_getmaxyx(int *y, int* x){ sl4_term_getmaxyx(y, x); } |
| 67 |
}; |
| 68 |
|
| 69 |
#endif |