1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: consoleio.cpp,v 1.1 2000/06/19 02:58:08 kevin Exp $
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License (version 2) as
9 ** published by the Free Software Foundation.
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
16 ** You should have received a copy of the GNU General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ******************************************************************************/
30 * cio_put_c Put a character on screen
34 * char c Character to write
37 * Color of character is determined by the global variable, crtv.text_attr.
40 * Cursor is advanced by one. If necessary, the cursor will wrap around
41 * and maybe the screen will scroll
53 * cio_put_cc Put a char on screen count times
56 * cio_put_cc (c, count)
57 * char c Character to write
58 * int count Number of characters to write
62 cio_put_cc (int c, int count)
64 for (int i = 0; i < count; i++)
70 cio_put_str (const char *str)
78 * kb_getc Get a character from the keyboard
84 * 1. This routine returns an EXTENTED ASCII code,
85 * the extended codes have a low byte of 0 and a distinctive
86 * high byte, such as 0x2D00 and 0x3200
87 * 2. This routine waits until a key has been typed
88 * 2. The keystroke will not be echoed.
91 unsigned int cio_kb_getc(void)
97 cio_kb_ungetc (unsigned int c)
103 * kb_gets Get a string from the keyboard
106 * str = kb_gets (str, maxlen)
107 * char *str Space to store input string
108 * int maxlen Maximum number of characters to read
109 * (Not including EOS)
111 * Backspace - erases character to the right
112 * Escape - erases to beginning of line
113 * Return - ends string (no not cause a linefeed)
117 cio_kb_gets (char *str, int maxlen)
119 return fgets(str, maxlen, stdin);
123 * kb_waitc Wait for a character from the keyboard
126 * key = kb_waitc (astr, estr, beep)
127 * int key Keystroke entered
128 * char *astr String of valid ascii characters
129 * bool beep If TRUE, beep when user hits invalid key
135 cio_kb_waitc (const char *astr, int beep_on_error)
140 if (strchr (astr, c) != NULL)