fix function declarations

This commit is contained in:
opFez 2021-04-04 13:46:41 +02:00
parent 4633479fe3
commit b87e29da24
2 changed files with 24 additions and 24 deletions

28
tui.c
View File

@ -34,14 +34,14 @@ die(const char *s)
}
static void
disable_raw_mode()
disable_raw_mode(void)
{
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios) == -1)
die("tcsetattr");
}
static void
enable_raw_mode()
enable_raw_mode(void)
{
if (tcgetattr(STDIN_FILENO, &orig_termios) == -1)
die("tcgetattr");
@ -89,13 +89,13 @@ free_cell_buffer(struct cell_buffer *cb)
}
static void
save_cursor()
save_cursor(void)
{
write(STDOUT_FILENO, "\033[s", 3);
}
static void
restore_cursor()
restore_cursor(void)
{
write(STDOUT_FILENO, "\033[u", 3);
}
@ -103,7 +103,7 @@ restore_cursor()
/****************************************************/
void
tui_init()
tui_init(void)
{
enable_raw_mode();
tui_set_cursor(0, 0);
@ -113,7 +113,7 @@ tui_init()
}
void
tui_shutdown()
tui_shutdown(void)
{
free_cell_buffer(&stdscr);
disable_raw_mode();
@ -124,7 +124,7 @@ tui_shutdown()
}
int
tui_width()
tui_width(void)
{
int width;
get_window_size(NULL, &width);
@ -132,7 +132,7 @@ tui_width()
}
int
tui_height()
tui_height(void)
{
int height;
get_window_size(&height, NULL);
@ -187,7 +187,7 @@ tui_clear(struct cell_buffer *cb, struct cell clear_cell)
}
void
tui_clear_screen()
tui_clear_screen(void)
{
write(STDOUT_FILENO, "\033[2J", 4);
}
@ -210,14 +210,14 @@ tui_print(struct cell_buffer *cb, int x, int y, const char *s)
}
void
tui_hide_cursor()
tui_hide_cursor(void)
{
cursor_visible = 0;
write(STDOUT_FILENO, "\033[?25l", 6);
}
void
tui_show_cursor()
tui_show_cursor(void)
{
cursor_visible = 1;
write(STDOUT_FILENO, "\033[?25h", 6);
@ -235,7 +235,7 @@ tui_set_cursor(int x, int y)
/* can probably be simplified, but it works well */
struct event
tui_poll()
tui_poll(void)
{
char c;
@ -270,7 +270,7 @@ tui_poll()
}
struct event
tui_poll_noprefix()
tui_poll_noprefix(void)
{
char c;
@ -291,7 +291,7 @@ tui_poll_noprefix()
}
struct event
tui_peek()
tui_peek(void)
{
char c;

20
tui.h
View File

@ -129,12 +129,12 @@ extern int cursor_visible;
/* tui_init() initializes stdscr and initializes raw mode.
* tui_shutdown() disables raw mode.
*/
void tui_init();
void tui_shutdown();
void tui_init(void);
void tui_shutdown(void);
/* returns the width and height of the current terminal window. */
int tui_width();
int tui_height();
int tui_width(void);
int tui_height(void);
/* tui_refresh() displays the contents of the cell buffer provided as the
* argument.
@ -153,7 +153,7 @@ int tui_height();
void tui_refresh(struct cell_buffer);
void tui_refresh_cell(struct cell_buffer, int, int);
void tui_clear(struct cell_buffer *, struct cell);
void tui_clear_screen();
void tui_clear_screen(void);
/* tui_set_cell() replaces the cell located at index x + y * cb->width in the
* cell buffer provided in the first argument, effectively changing the cell at
@ -170,8 +170,8 @@ void tui_print(struct cell_buffer *, int, int, const char *);
* tui_set_cursor() sets the position of the cursor to those given as arguments.
* The first argument is the x-value and the second value is the y-value.
*/
void tui_hide_cursor();
void tui_show_cursor();
void tui_hide_cursor(void);
void tui_show_cursor(void);
void tui_set_cursor(int, int);
/* tui_poll() waits for input, and returns the event it recieved.
@ -182,9 +182,9 @@ void tui_set_cursor(int, int);
* tui_peek() gets buffered input. The program will not stop and wait for input,
* like tui_poll(), but buffered input will be returned.
*/
struct event tui_poll();
struct event tui_poll_noprefix();
struct event tui_peek();
struct event tui_poll(void);
struct event tui_poll_noprefix(void);
struct event tui_peek(void);
#ifdef __cplusplus