root/Whitix/trunk/include/console.h
| Revision 1673, 2.0 KB (checked in by mwhitworth, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | /* This file is part of Whitix. |
| 2 | * |
| 3 | * Whitix is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * Whitix is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with Whitix; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 16 | * |
| 17 | */ |
| 18 | |
| 19 | #ifndef CONSOLE_H |
| 20 | #define CONSOLE_H |
| 21 | |
| 22 | #include <devices/device.h> |
| 23 | #include <typedefs.h> |
| 24 | #include <wait.h> |
| 25 | |
| 26 | /* Defines */ |
| 27 | |
| 28 | /* TODO: Make it large, so the user is very unlikely to fill up the buffer. */ |
| 29 | #define CONSOLE_KEYBUF_SIZE 100 |
| 30 | |
| 31 | int ConsoleEarlyInit(); |
| 32 | void ConsoleClearCurrent(); |
| 33 | void ConsoleSwitchToText(); |
| 34 | void putc(int c); |
| 35 | |
| 36 | int ChangeConsole(int index); |
| 37 | void ConsoleAddKey(BYTE n); |
| 38 | void ConsoleAddKeyCode(BYTE n); |
| 39 | |
| 40 | #define MAX_CONSOLES 7 |
| 41 | #define CONSOLE_KEYBUF_SIZE 100 |
| 42 | |
| 43 | extern int currConsole; |
| 44 | |
| 45 | struct Console |
| 46 | { |
| 47 | struct KeDevice device; |
| 48 | int currX, currY, currColor, foreColor, backColor; |
| 49 | WaitQueue waitQueue; |
| 50 | BYTE keyboardBuf[CONSOLE_KEYBUF_SIZE]; |
| 51 | BYTE head, tail; |
| 52 | unsigned int params[16]; /* For ASCII control codes */ |
| 53 | int inCtrl,ctrlParams,cmdLetter,paramIndex; |
| 54 | int flags; |
| 55 | }; |
| 56 | |
| 57 | extern struct Console consoles[MAX_CONSOLES]; |
| 58 | |
| 59 | /* Console ioctls */ |
| 60 | #define CONSOLE_SET_OPTIONS 0x00000001 |
| 61 | #define CONSOLE_GET_OPTIONS 0x00000002 |
| 62 | #define CONSOLE_GET_INFO 0x00000003 |
| 63 | #define CONSOLE_GET_POS 0x00000004 |
| 64 | #define CONSOLE_GET_KEYMAP 0x00000005 |
| 65 | #define CONSOLE_SET_KEYMAP 0x00000006 |
| 66 | |
| 67 | /* Console flags */ |
| 68 | #define CONSOLE_NO_ECHO 0x00000001 |
| 69 | #define CONSOLE_GRAPHICS 0x00000002 |
| 70 | #define CONSOLE_SENDKEYC 0x00000004 |
| 71 | |
| 72 | /* and related structures */ |
| 73 | |
| 74 | struct ConsoleInfo |
| 75 | { |
| 76 | int rows,cols; |
| 77 | }; |
| 78 | |
| 79 | #endif |
Note: See TracBrowser
for help on using the browser.
