106 lines
2.9 KiB
C
106 lines
2.9 KiB
C
/*
|
|
* Copyright(c) 2017 Daneil Knuettel
|
|
*/
|
|
|
|
/* This program is free software.
|
|
* Anyways if you think this program is worth it
|
|
* and we meet shout a drink for me.
|
|
*/
|
|
|
|
|
|
/* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
|
|
* der GNU Affero General Public License, wie von der Free Software Foundation,
|
|
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
|
|
* veröffentlichten Version, weiterverbreiten und/oder modifizieren.
|
|
*
|
|
* Dieses Programm wird in der Hoffnung, dass es nützlich sein wird, aber
|
|
* OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
|
|
* Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
|
|
* Siehe die GNU Affero General Public License für weitere Details.
|
|
*
|
|
* Sie sollten eine Kopie der GNU Affero General Public License zusammen mit diesem
|
|
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __input_output_h_
|
|
#define __input_output_h_
|
|
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<unistd.h>
|
|
#include<sys/select.h>
|
|
#include<signal.h>
|
|
|
|
/*
|
|
<doc>
|
|
This file contains all required input/output functions.
|
|
|
|
There is a special global flag variable
|
|
|
|
::
|
|
|
|
static volatile char EOF_received = 0;
|
|
|
|
that will be set to ``1``, if the stdin stream reached ``EOF``.
|
|
This flag will break the mainloop.
|
|
|
|
The following input functions are defined:
|
|
|
|
::
|
|
|
|
char kb_hit(void);
|
|
|
|
returns 1, if there is a character on stdin.
|
|
|
|
::
|
|
|
|
char get_last_key_or_default(void);
|
|
|
|
Returns the last entered character from stdin.
|
|
If there is no character it will return the
|
|
default character defined in ``conf.h``.
|
|
|
|
If stdin reaches ``EOF`` the flag ``EOF_received`` will
|
|
be set.
|
|
|
|
The following output functions are defined:
|
|
|
|
::
|
|
|
|
void put_line(char * line);
|
|
|
|
Puts the given line ``line`` of the horizon or playfield
|
|
on the stdout stream. The line is inside a frame and
|
|
highlights special characters according to ``conf.h``.
|
|
|
|
::
|
|
|
|
void clear_screen(void);
|
|
|
|
Clears the screen. The number of lines and collumns
|
|
are calculated according to ``conf.h``.
|
|
|
|
</doc>
|
|
*/
|
|
|
|
#include "conf.h"
|
|
void put_line(char * line);
|
|
void clear_screen(void);
|
|
char kb_hit(void);
|
|
char get_last_key_or_default(void);
|
|
static volatile char EOF_received = 0;
|
|
|
|
#endif
|