| 1 | /* |
| 2 | * Copyright (C) 1998,1999 Ross Combs ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #ifndef JUST_NEED_TYPES |
| 19 | #ifndef INCLUDED_ANSI_TERM_PROTOS |
| 20 | #define INCLUDED_ANSI_TERM_PROTOS |
| 21 | |
| 22 | #include <cstdio> |
| 23 | |
| 24 | #define ansi_beep()\ |
| 25 | std::printf("\007"); |
| 26 | |
| 27 | #define ansi_screen_clear()\ |
| 28 | std::printf("\033[2J"); |
| 29 | |
| 30 | #define ansi_line_clear()\ |
| 31 | std::printf("\033[K"); |
| 32 | |
| 33 | #define ansi_cursor_move_up(lines)\ |
| 34 | std::printf("\033[%dA", lines); |
| 35 | |
| 36 | #define ansi_cursor_move_down(lines)\ |
| 37 | std::printf("\033[%dB", lines); |
| 38 | |
| 39 | #define ansi_cursor_move_left(chars)\ |
| 40 | std::printf("\033[%dD", chars); |
| 41 | |
| 42 | #define ansi_cursor_move_right(chars)\ |
| 43 | std::printf("\033[%dC", chars); |
| 44 | |
| 45 | #define ansi_cursor_move_home()\ |
| 46 | std::printf("\033[1;0H"); |
| 47 | |
| 48 | #define ansi_cursor_move(y,x)\ |
| 49 | std::printf("\033[%d;%dH", x + 1, y); |
| 50 | |
| 51 | #define ansi_cursor_save()\ |
| 52 | std::printf("\033[u"); |
| 53 | |
| 54 | #define ansi_cursor_load()\ |
| 55 | std::printf("\033[s"); |
| 56 | |
| 57 | #define ansi_text_reset()\ |
| 58 | std::printf("\033[0m"); |
| 59 | |
| 60 | #define ansi_text_style(style)\ |
| 61 | std::printf("\033[%dm", style); |
| 62 | |
| 63 | #define ansi_text_color_fore(color)\ |
| 64 | std::printf("\033[3%dm", color); |
| 65 | |
| 66 | #define ansi_text_color_back(color)\ |
| 67 | std::printf("\033[4%dm", color); |
| 68 | |
| 69 | #define ansi_text_style_bold 1 |
| 70 | #define ansi_text_style_underline 4 |
| 71 | #define ansi_text_style_blink 5 |
| 72 | #define ansi_text_style_inverse 7 |
| 73 | |
| 74 | #define ansi_text_color_black 0 |
| 75 | #define ansi_text_color_red 1 |
| 76 | #define ansi_text_color_green 2 |
| 77 | #define ansi_text_color_yellow 3 |
| 78 | #define ansi_text_color_blue 4 |
| 79 | #define ansi_text_color_magenta 5 |
| 80 | #define ansi_text_color_cyan 6 |
| 81 | #define ansi_text_color_white 7 |
| 82 | |
| 83 | #endif |
| 84 | #endif |