diff --git a/ChangeLog b/ChangeLog index 6aababe744..49f04f291f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2024-06-17 Patrice Dumas + + Use explicit prototype for terminal function hooks + + * info/pcterm.c (pc_goto_xy, pc_put_text, pc_write_chars) + (pc_scroll_terminal, pc_initialize_terminal): use prototypes instead + of old style K&R definitions. + + * info/terminal.c (terminal_*_hook): replace the VFunction untyped + declarations for terminal function hooks by proper prototypes. Remove + VFunction. + 2024-06-17 Patrice Dumas Use explicit prototype for Info command functions diff --git a/info/pcterm.c b/info/pcterm.c index dbb49e1f72..45e87fca23 100644 --- a/info/pcterm.c +++ b/info/pcterm.c @@ -993,7 +993,7 @@ pc_clear_to_eol (void) /* Set the global variables SCREENWIDTH and SCREENHEIGHT. */ static void -pc_get_screen_size(void) +pc_get_screen_size (void) { /* Current screen dimensions are the default. */ if (!outside_info.screenheight) /* paranoia */ @@ -1012,16 +1012,14 @@ pc_get_screen_size(void) /* Move the cursor to the terminal location of X and Y. */ static void -pc_goto_xy (x, y) - int x, y; +pc_goto_xy (int x, int y) { ScreenSetCursor (y, x); /* yes, pc.h says ScreenSetCursor (row, column) !! */ } /* Print STRING to the terminal at the current position. */ static void -pc_put_text (string) - char *string; +pc_put_text (char *string) { if (speech_friendly) fputs (string, stdout); @@ -1038,7 +1036,7 @@ pc_put_text (string) /* Ring the terminal bell. The bell is rung visibly if the terminal is capable of doing that, and if terminal_use_visible_bell_p is non-zero. */ static void -pc_ring_bell(void) +pc_ring_bell (void) { if (terminal_has_visible_bell_p && terminal_use_visible_bell_p) ScreenVisualBell (); @@ -1051,9 +1049,7 @@ pc_ring_bell(void) /* Print NCHARS from STRING to the terminal at the current position. */ static void -pc_write_chars (string, nchars) - char *string; - int nchars; +pc_write_chars (char *string, int nchars) { if (!nchars) return; @@ -1076,8 +1072,7 @@ pc_write_chars (string, nchars) bottom of the screen. The lines of the old region which do not overlap the new region are cleared, to mimic terminal operation. */ static void -pc_scroll_terminal (start, end, amount) - int start, end, amount; +pc_scroll_terminal (int start, int end, int amount) { int line_to_clear = amount > 0 ? start : end + amount; @@ -1169,8 +1164,7 @@ pc_unprep_terminal (void) to the dimensions that this terminal actually has. Finally, the terminal screen is cleared. */ static void -pc_initialize_terminal (term_name) - char *term_name; +pc_initialize_terminal (char *term_name) { char *info_colors; diff --git a/info/terminal.c b/info/terminal.c index 02690b67d3..f87b66cc14 100644 --- a/info/terminal.c +++ b/info/terminal.c @@ -53,32 +53,32 @@ extern int tputs (); function is called when appropriate instead of its namesake. Your function is called with exactly the same arguments that were passed to the namesake function. */ -VFunction *terminal_begin_inverse_hook = NULL; -VFunction *terminal_end_inverse_hook = NULL; -VFunction *terminal_begin_standout_hook = NULL; -VFunction *terminal_end_standout_hook = NULL; -VFunction *terminal_begin_underline_hook = NULL; -VFunction *terminal_end_underline_hook = NULL; -VFunction *terminal_begin_bold_hook = NULL; -VFunction *terminal_begin_blink_hook = NULL; -VFunction *terminal_end_all_modes_hook = NULL; -VFunction *terminal_default_colour_hook = NULL; -VFunction *terminal_set_colour_hook = NULL; -VFunction *terminal_set_bgcolour_hook = NULL; -VFunction *terminal_prep_terminal_hook = NULL; -VFunction *terminal_unprep_terminal_hook = NULL; -VFunction *terminal_up_line_hook = NULL; -VFunction *terminal_down_line_hook = NULL; -VFunction *terminal_clear_screen_hook = NULL; -VFunction *terminal_clear_to_eol_hook = NULL; -VFunction *terminal_get_screen_size_hook = NULL; -VFunction *terminal_goto_xy_hook = NULL; -VFunction *terminal_initialize_terminal_hook = NULL; -VFunction *terminal_new_terminal_hook = NULL; -VFunction *terminal_put_text_hook = NULL; -VFunction *terminal_ring_bell_hook = NULL; -VFunction *terminal_write_chars_hook = NULL; -VFunction *terminal_scroll_terminal_hook = NULL; +void (*terminal_begin_inverse_hook) (void) = NULL; +void (*terminal_end_inverse_hook) (void) = NULL; +void (*terminal_begin_standout_hook) (void) = NULL; +void (*terminal_end_standout_hook) (void) = NULL; +void (*terminal_begin_underline_hook) (void) = NULL; +void (*terminal_end_underline_hook) (void) = NULL; +void (*terminal_begin_bold_hook) (void) = NULL; +void (*terminal_begin_blink_hook) (void) = NULL; +void (*terminal_end_all_modes_hook) (void) = NULL; +void (*terminal_default_colour_hook) (void) = NULL; +void (*terminal_set_colour_hook) (int colour) = NULL; +void (*terminal_set_bgcolour_hook) (int colour) = NULL; +void (*terminal_prep_terminal_hook) (void) = NULL; +void (*terminal_unprep_terminal_hook) (void) = NULL; +void (*terminal_up_line_hook) (void) = NULL; +void (*terminal_down_line_hook) (void) = NULL; +void (*terminal_clear_screen_hook) (void) = NULL; +void (*terminal_clear_to_eol_hook) (void) = NULL; +void (*terminal_get_screen_size_hook) (void) = NULL; +void (*terminal_goto_xy_hook) (int x, int y) = NULL; +void (*terminal_initialize_terminal_hook) (char *terminal_name) = NULL; +void (*terminal_new_terminal_hook) (char *terminal_name) = NULL; +void (*terminal_put_text_hook) (char *string) = NULL; +void (*terminal_ring_bell_hook) (void) = NULL; +void (*terminal_write_chars_hook) (char *string, int nchars) = NULL; +void (*terminal_scroll_terminal_hook) (int start, int end, int amount) = NULL; /* User variable 'mouse'. Values can be MP_* constants in terminal.h. */ int mouse_protocol = MP_NONE; diff --git a/info/terminal.h b/info/terminal.h index 9e37f38889..28a6d07aef 100644 --- a/info/terminal.h +++ b/info/terminal.h @@ -20,8 +20,6 @@ #if !defined (TERMINAL_H) #define TERMINAL_H -typedef void VFunction (); - /* For almost every function externally visible from terminal.c, there is a corresponding "hook" function which can be bound in order to replace the functionality of the one found in terminal.c. This is how we go @@ -50,87 +48,87 @@ extern int terminal_can_scroll_region; The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that this terminal actually has. */ extern void terminal_initialize_terminal (char *terminal_name); -extern VFunction *terminal_initialize_terminal_hook; +extern void (*terminal_initialize_terminal_hook) (char *terminal_name); /* Return the current screen width and height in the variables SCREENWIDTH and SCREENHEIGHT. */ extern void terminal_get_screen_size (void); -extern VFunction *terminal_get_screen_size_hook; +extern void (*terminal_get_screen_size_hook) (void); /* Save and restore tty settings. */ extern int terminal_prep_terminal (void); extern void terminal_unprep_terminal (void); -extern VFunction *terminal_prep_terminal_hook; -extern VFunction *terminal_unprep_terminal_hook; +extern void (*terminal_prep_terminal_hook) (void); +extern void (*terminal_unprep_terminal_hook) (void); /* Re-initialize the terminal to TERMINAL_NAME. */ extern void terminal_new_terminal (char *terminal_name); -extern VFunction *terminal_new_terminal_hook; +extern void (*terminal_new_terminal_hook) (char *terminal_name); /* Move the cursor to the terminal location of X and Y. */ extern void terminal_goto_xy (int x, int y); -extern VFunction *terminal_goto_xy_hook; +extern void (*terminal_goto_xy_hook) (int x, int y); /* Print STRING to the terminal at the current position. */ extern void terminal_put_text (char *string); -extern VFunction *terminal_put_text_hook; +extern void (*terminal_put_text_hook) (char *string); /* Print NCHARS from STRING to the terminal at the current position. */ extern void terminal_write_chars (char *string, int nchars); -extern VFunction *terminal_write_chars_hook; +extern void (*terminal_write_chars_hook) (char *string, int nchars); /* Clear from the current position of the cursor to the end of the line. */ extern void terminal_clear_to_eol (void); -extern VFunction *terminal_clear_to_eol_hook; +extern void (*terminal_clear_to_eol_hook) (void); /* Clear the entire terminal screen. */ extern void terminal_clear_screen (void); -extern VFunction *terminal_clear_screen_hook; +extern void (*terminal_clear_screen_hook) (void); /* Move the cursor up one line. */ extern void terminal_up_line (void); -extern VFunction *terminal_up_line_hook; +extern void (*terminal_up_line_hook) (void); /* Move the cursor down one line. */ extern void terminal_down_line (void); -extern VFunction *terminal_down_line_hook; +extern void (*terminal_down_line_hook) (void); /* Turn on reverse video if possible. */ extern void terminal_begin_inverse (void); -extern VFunction *terminal_begin_inverse_hook; +extern void (*terminal_begin_inverse_hook) (void); /* Turn off reverse video if possible. */ extern void terminal_end_inverse (void); -extern VFunction *terminal_end_inverse_hook; +extern void (*terminal_end_inverse_hook) (void); /* Turn on standout mode if possible. */ extern void terminal_begin_standout (void); -extern VFunction *terminal_begin_standout_hook; +extern void (*terminal_begin_standout_hook) (void); /* Turn off standout mode if possible. */ extern void terminal_end_standout (void); -extern VFunction *terminal_end_standout_hook; +extern void (*terminal_end_standout_hook) (void); /* Turn on and off underline mode if possible. */ void terminal_begin_underline (void); -extern VFunction *terminal_begin_underline_hook; +extern void (*terminal_begin_underline_hook) (void); void terminal_end_underline (void); -extern VFunction *terminal_end_underline_hook; +extern void (*terminal_end_underline_hook) (void); /* Scroll an area of the terminal, starting with the region from START to END, AMOUNT lines. If AMOUNT is negative, the lines are scrolled towards the top of the screen, else they are scrolled towards the bottom of the screen. */ extern void terminal_scroll_terminal (int start, int end, int amount); -extern VFunction *terminal_scroll_terminal_hook; +extern void (*terminal_scroll_terminal_hook) (int start, int end, int amount); extern void terminal_scroll_region (int start, int end, int amount); /* Ring the terminal bell. The bell is run visibly if it both has one and terminal_use_visible_bell_p is non-zero. */ extern void terminal_ring_bell (void); -extern VFunction *terminal_ring_bell_hook; +extern void (*terminal_ring_bell_hook) (void); /* The key sequences output by special keys, if this terminal has any. */ extern char *term_ku, *term_kd, *term_kr, *term_kl;