From 46e6de294243e8dc593551bfe8c0e7090d03a159 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sun, 30 Jun 2024 16:20:34 +0900 Subject: Improve dynamic loading Make loading code cleaner and prefix public function names to allow static compilation. --- src/tui.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/tui.c') diff --git a/src/tui.c b/src/tui.c index 7b49adf..e02429f 100644 --- a/src/tui.c +++ b/src/tui.c @@ -65,7 +65,7 @@ redraw(void) } void -init(void) +tui_init(void) { win = initscr(); noecho(); @@ -74,7 +74,7 @@ init(void) } void -display_calc(int x, int y) +tui_display_calc(int x, int y) { current_idx = next_calc(current_idx); calcs[current_idx].x = x; @@ -92,7 +92,7 @@ display_calc(int x, int y) break; int -read_input(void) +tui_read_input(void) { int c = getch(); while (c != ERR) @@ -136,7 +136,7 @@ read_input(void) } void -display_res(bool right, int ms) +tui_display_res(bool right, int ms) { calcs[current_idx].right = right; calcs[current_idx].ms = ms; @@ -144,14 +144,14 @@ display_res(bool right, int ms) } void -destroy(void) +tui_destroy(void) { endwin(); } #ifndef NDEBUG void * -pre_reload(void) +tui_pre_reload(void) { char *data = malloc(sizeof(calcs) + sizeof(current_idx)); memcpy(data, &calcs, sizeof(calcs)); @@ -161,13 +161,13 @@ pre_reload(void) } void -post_reload(void *state) +tui_post_reload(void *state) { char *data = state; memcpy(&calcs, data, sizeof(calcs)); memcpy(¤t_idx, data + sizeof(calcs), sizeof(current_idx)); free(data); - init(); + tui_init(); redraw(); } #endif -- cgit v1.2.3