Imported Debian patch 0.1beta-15
[debian/yforth] / udio.c
1 /* yForth? - Written by Luca Padovani (C) 1996/97
2  * ------------------------------------------------------------------------
3  * This software is FreeWare as long as it comes with this header in each
4  * source file, anyway you can use it or any part of it whatever
5  * you want. It comes without any warranty, so use it at your own risk.
6  * ------------------------------------------------------------------------
7  * Module name: udio.c
8  * Abstract:    User Device Input/Output functions. Here are enclosed all
9  *              non-portable functions.
10  */
11
12 #include "yforth.h"
13 #if HAVE_CONIO
14 #       include <conio.h>
15 #endif
16 #include "udio.h"
17
18 /* d_clrscr: clear the screen */
19 void d_clrscr() {
20 #if HAVE_CONIO
21         clrscr();
22 #endif
23 }
24
25 /* d_clreol: clear to end of line */
26 void d_clreol() {
27 #if HAVE_CONIO
28         clreol();
29 #endif
30 }
31
32 /* d_setattr: set default attributes */
33 void d_setaddr(Cell attr) {
34 #if HAVE_CONIO
35         textattr(attr);
36 #endif
37 }
38
39 /* d_getattr: get default attributes */
40 Cell d_getattr() {
41 #if HAVE_CONIO
42         struct text_info ti;
43         gettextinfo(&ti);
44         return (ti.attribute);
45 #endif
46 }
47
48 /* d_gotoxy: move the cursor to the location (x, y) of the screen */
49 void d_gotoxy(Cell x, Cell y) {
50 #if HAVE_CONIO
51         gotoxy(x, y);
52 #endif
53 }
54
55 /* d_wherex: current column position of the cursor */
56 Cell d_wherex() {
57 #if HAVE_CONIO
58         return (wherex());
59 #endif
60 }
61
62 /* d_wherey: current row position of the cursor */
63 Cell d_wherey() {
64 #if HAVE_CONIO
65         return (wherey());
66 #endif
67 }
68
69 /* d_getch: read a characted from the input device without displaying it and
70  * return as soon as the character is enteres (i.e. no wait for Carriage 
71  * Return
72  */
73 Char d_getch() {
74 #if HAVE_CONIO
75         return (getch());
76 #endif 
77 }
78
79 /* d_kbhit: return True if a character is available */
80 Cell d_kbhit() {
81 #if HAVE_CONIO
82         return (kbhit());
83 #endif
84 }
85
86 /* d_open: Initialize the Input/Output device */
87 void d_open() {
88 }
89
90 /* d_close: make some work when program finish to restore Input/Output device */
91 void d_close() {
92 }
93
94
95
96
97
98
99
100
101