X-Git-Url: https://git.gag.com/?p=debian%2Fyforth;a=blobdiff_plain;f=udio.c;h=4029995f6d3be46e70179c7cb49db055e4547bf9;hp=d3873a244873f337374599cb1203309990d15c2b;hb=1f159338ae285680863150605167fea32aa74aca;hpb=ef65b7aa8aa9801818dfe1de1f4a434719cc62e1
diff --git a/udio.c b/udio.c
index d3873a2..4029995 100644
--- a/udio.c
+++ b/udio.c
@@ -1,8 +1,18 @@
-/* yForth? - Written by Luca Padovani (C) 1996/97
- * ------------------------------------------------------------------------
- * This software is FreeWare as long as it comes with this header in each
- * source file, anyway you can use it or any part of it whatever
- * you want. It comes without any warranty, so use it at your own risk.
+/* yForth? - A Forth interpreter written in ANSI C
+ * Copyright (C) 2012 Luca Padovani
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
* ------------------------------------------------------------------------
* Module name: udio.c
* Abstract: User Device Input/Output functions. Here are enclosed all
@@ -10,77 +20,59 @@
*/
#include "yforth.h"
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
# include
-#elifdef HAVE_CURSES
-# include
#endif
#include "udio.h"
/* d_clrscr: clear the screen */
void d_clrscr() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
clrscr();
-#elifdef HAVE_CURSES
- clear();
#endif
}
/* d_clreol: clear to end of line */
void d_clreol() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
clreol();
-#elifdef HAVE_CURSES
- clrtoeol();
#endif
}
/* d_setattr: set default attributes */
void d_setaddr(Cell attr) {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
textattr(attr);
-#elifdef HAVE_CURSES
#endif
}
/* d_getattr: get default attributes */
Cell d_getattr() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
struct text_info ti;
gettextinfo(&ti);
return (ti.attribute);
-#elifdef HAVE_CURSES
#endif
}
/* d_gotoxy: move the cursor to the location (x, y) of the screen */
void d_gotoxy(Cell x, Cell y) {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
gotoxy(x, y);
-#elifdef HAVE_CURSES
- move(y, x);
#endif
}
/* d_wherex: current column position of the cursor */
Cell d_wherex() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
return (wherex());
-#elifdef HAVE_CURSES
- int x, y;
- getyx(stdscr, y, x);
- return ((Cell) x);
#endif
}
/* d_wherey: current row position of the cursor */
Cell d_wherey() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
return (wherey());
-#elifdef HAVE_CURSES
- int x, y;
- getyx(stdscr, y, x);
- return ((Cell) y);
#endif
}
@@ -89,39 +81,24 @@ Cell d_wherey() {
* Return
*/
Char d_getch() {
-#ifdef HAVE_CONIO
- return (getch());
-#elifdef HAVE_CURSES
+#if HAVE_CONIO
return (getch());
#endif
}
/* d_kbhit: return True if a character is available */
Cell d_kbhit() {
-#ifdef HAVE_CONIO
+#if HAVE_CONIO
return (kbhit());
-#elifdef HAVE_CURSES
- return (1);
-#endif
+#endif
}
/* d_open: Initialize the Input/Output device */
void d_open() {
-#ifdef HAVE_CURSES
- initscr();
- cbreak();
- noecho();
- nonl();
- /* intrflush(stdscr, FALSE); */
- /* keypad(stdscr, TRUE); */
-#endif
-}
+}
/* d_close: make some work when program finish to restore Input/Output device */
void d_close() {
-#ifdef HAVE_CURSES
- endwin();
-#endif
}