Commit b56ceb92 authored by Juanma Barranquero's avatar Juanma Barranquero

src/w32*.c: Convert function definitions to standard C.

parent 7af07b96
2010-07-06 Juanma Barranquero <lekktu@gmail.com>
* w32.c, w32console.c, w32fns.c, w32font.c, w32heap.c, w32inevt.c
* w32menu.c, w32proc.c, w32reg.c, w32select.c, w32term.c
* w32uniscribe.c, w32xfns.c: Convert function definitions to standard C.
2010-07-06 Andreas Schwab <schwab@linux-m68k.org>
* xterm.c (x_get_keysym_name): Change type of parameter to int.
......
......@@ -148,7 +148,7 @@ extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary;
typedef HRESULT (WINAPI * ShGetFolderPath_fn)
(IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *);
void globals_of_w32 ();
void globals_of_w32 (void);
static DWORD get_rid (PSID);
extern Lisp_Object Vw32_downcase_file_names;
......@@ -308,7 +308,7 @@ typedef BOOL (WINAPI * GetSystemTimes_Proc) (
/* ** A utility function ** */
static BOOL
is_windows_9x ()
is_windows_9x (void)
{
static BOOL s_b_ret=0;
OSVERSIONINFO os_ver;
......@@ -329,7 +329,7 @@ is_windows_9x ()
Returns a list of three integers if the times are provided by the OS
(NT derivatives), otherwise it returns the result of current-time. */
Lisp_Object
w32_get_internal_run_time ()
w32_get_internal_run_time (void)
{
if (get_process_times_fn)
{
......@@ -1035,13 +1035,13 @@ static struct group dflt_group =
};
unsigned
getuid ()
getuid (void)
{
return dflt_passwd.pw_uid;
}
unsigned
geteuid ()
geteuid (void)
{
/* I could imagine arguing for checking to see whether the user is
in the Administrators group and returning a UID of 0 for that
......@@ -1050,13 +1050,13 @@ geteuid ()
}
unsigned
getgid ()
getgid (void)
{
return dflt_passwd.pw_gid;
}
unsigned
getegid ()
getegid (void)
{
return getgid ();
}
......@@ -1091,7 +1091,7 @@ getpwnam (char *name)
}
void
init_user_info ()
init_user_info (void)
{
/* Find the user's real name by opening the process token and
looking up the name associated with the user-sid in that token.
......@@ -1207,7 +1207,7 @@ init_user_info ()
}
int
random ()
random (void)
{
/* rand () on NT gives us 15 random bits...hack together 30 bits. */
return ((rand () << 15) | rand ());
......@@ -1225,9 +1225,7 @@ srandom (int seed)
case path name components to lower case. */
static void
normalize_filename (fp, path_sep)
register char *fp;
char path_sep;
normalize_filename (register char *fp, char path_sep)
{
char sep;
char *elem;
......@@ -1283,16 +1281,14 @@ normalize_filename (fp, path_sep)
/* Destructively turn backslashes into slashes. */
void
dostounix_filename (p)
register char *p;
dostounix_filename (register char *p)
{
normalize_filename (p, '/');
}
/* Destructively turn slashes into backslashes. */
void
unixtodos_filename (p)
register char *p;
unixtodos_filename (register char *p)
{
normalize_filename (p, '\\');
}
......@@ -1301,9 +1297,7 @@ unixtodos_filename (p)
(From msdos.c...probably should figure out a way to share it,
although this code isn't going to ever change.) */
int
crlf_to_lf (n, buf)
register int n;
register unsigned char *buf;
crlf_to_lf (register int n, register unsigned char *buf)
{
unsigned char *np = buf;
unsigned char *startp = buf;
......@@ -1520,9 +1514,7 @@ alarm (int seconds)
#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
LPBYTE
w32_get_resource (key, lpdwtype)
char *key;
LPDWORD lpdwtype;
w32_get_resource (char *key, LPDWORD lpdwtype)
{
LPBYTE lpvalue;
HKEY hrootkey = NULL;
......@@ -2691,7 +2683,7 @@ sys_creat (const char * path, int mode)
}
FILE *
sys_fopen(const char * path, const char * mode)
sys_fopen (const char * path, const char * mode)
{
int fd;
int oflag;
......@@ -2980,7 +2972,7 @@ static int init = 0;
} while (0)
static void
initialize_utc_base ()
initialize_utc_base (void)
{
/* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */
SYSTEMTIME st;
......@@ -3904,7 +3896,7 @@ BOOL WINAPI global_memory_status_ex (
}
Lisp_Object
list_system_processes ()
list_system_processes (void)
{
struct gcpro gcpro1;
Lisp_Object proclist = Qnil;
......@@ -3995,8 +3987,7 @@ restore_privilege (TOKEN_PRIVILEGES *priv)
}
static Lisp_Object
ltime (time_sec, time_usec)
long time_sec, time_usec;
ltime (long time_sec, long time_usec)
{
return list3 (make_number ((time_sec >> 16) & 0xffff),
make_number (time_sec & 0xffff),
......@@ -4006,10 +3997,9 @@ ltime (time_sec, time_usec)
#define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L)
static int
process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu)
HANDLE h_proc;
Lisp_Object *ctime, *etime, *stime, *utime, *ttime;
double *pcpu;
process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime,
Lisp_Object *stime, Lisp_Object *utime, Lisp_Object *ttime,
double *pcpu)
{
FILETIME ft_creation, ft_exit, ft_kernel, ft_user, ft_current;
ULONGLONG tem1, tem2, tem3, tem;
......@@ -4059,8 +4049,7 @@ process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu)
}
Lisp_Object
system_process_attributes (pid)
Lisp_Object pid;
system_process_attributes (Lisp_Object pid)
{
struct gcpro gcpro1, gcpro2, gcpro3;
Lisp_Object attrs = Qnil;
......@@ -4526,7 +4515,7 @@ int h_errno = 0;
normal system codes where they overlap (non-overlapping definitions
are already in <sys/socket.h> */
static void
set_errno ()
set_errno (void)
{
if (winsock_lib == NULL)
h_errno = EINVAL;
......@@ -4548,7 +4537,7 @@ set_errno ()
}
static void
check_errno ()
check_errno (void)
{
if (h_errno == 0 && winsock_lib != NULL)
pfn_WSASetLastError (0);
......@@ -5038,7 +5027,7 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen)
int
sys_recvfrom (int s, char * buf, int len, int flags,
struct sockaddr * from, int * fromlen)
struct sockaddr * from, int * fromlen)
{
if (winsock_lib == NULL)
{
......@@ -5733,7 +5722,7 @@ sys_write (int fd, const void * buffer, unsigned int count)
}
static void
check_windows_init_file ()
check_windows_init_file (void)
{
extern int noninteractive, inhibit_window_system;
......@@ -5789,7 +5778,7 @@ check_windows_init_file ()
}
void
term_ntproc ()
term_ntproc (void)
{
#ifdef HAVE_SOCKETS
/* shutdown the socket interface if necessary */
......@@ -5800,7 +5789,7 @@ term_ntproc ()
}
void
init_ntproc ()
init_ntproc (void)
{
#ifdef HAVE_SOCKETS
/* Initialise the socket interface now if available and requested by
......@@ -5908,7 +5897,8 @@ init_ntproc ()
shutdown_handler ensures that buffers' autosave files are
up to date when the user logs off, or the system shuts down.
*/
BOOL WINAPI shutdown_handler(DWORD type)
BOOL WINAPI
shutdown_handler(DWORD type)
{
/* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */
if (type == CTRL_CLOSE_EVENT /* User closes console window. */
......@@ -5929,7 +5919,7 @@ BOOL WINAPI shutdown_handler(DWORD type)
initialized is non zero (see the function main in emacs.c).
*/
void
globals_of_w32 ()
globals_of_w32 (void)
{
HMODULE kernel32 = GetModuleHandle ("kernel32.dll");
......@@ -5974,7 +5964,8 @@ globals_of_w32 ()
}
/* For make-serial-process */
int serial_open (char *port)
int
serial_open (char *port)
{
HANDLE hnd;
child_process *cp;
......@@ -6014,7 +6005,7 @@ int serial_open (char *port)
/* For serial-process-configure */
void
serial_configure (struct Lisp_Process *p,
Lisp_Object contact)
Lisp_Object contact)
{
Lisp_Object childp2 = Qnil;
Lisp_Object tem = Qnil;
......
......@@ -42,13 +42,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "w32inevt.h"
/* from window.c */
extern Lisp_Object Frecenter ();
extern Lisp_Object Frecenter (Lisp_Object);
/* from keyboard.c */
extern int detect_input_pending ();
extern int detect_input_pending (void);
/* from sysdep.c */
extern int read_input_pending ();
extern int read_input_pending (void);
static void w32con_move_cursor (struct frame *f, int row, int col);
static void w32con_clear_to_end (struct frame *f);
......@@ -68,7 +68,7 @@ static WORD w32_face_attributes (struct frame *f, int face_id);
static COORD cursor_coords;
static HANDLE prev_screen, cur_screen;
static WORD char_attr_normal;
static DWORD prev_console_mode;
static DWORD prev_console_mode;
#ifndef USE_SEPARATE_SCREEN
static CONSOLE_CURSOR_INFO prev_console_cursor;
......@@ -268,7 +268,8 @@ scroll_line (struct frame *f, int dist, int direction)
/* If start is zero insert blanks instead of a string at start ?. */
static void
w32con_insert_glyphs (struct frame *f, register struct glyph *start, register int len)
w32con_insert_glyphs (struct frame *f, register struct glyph *start,
register int len)
{
scroll_line (f, len, RIGHT);
......@@ -286,7 +287,7 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start, register in
}
}
extern unsigned char *encode_terminal_code (struct glyph *, int,
extern unsigned char *encode_terminal_code (struct glyph *, int,
struct coding_system *);
static void
......@@ -438,7 +439,7 @@ w32con_reset_terminal_modes (struct terminal *t)
FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
/* Now that the screen is clear, put the cursor at the top. */
SetConsoleCursorPosition (cur_screen, dest);
#ifdef USE_SEPARATE_SCREEN
SetConsoleActiveScreenBuffer (prev_screen);
#else
......@@ -511,13 +512,13 @@ struct tty_display_info *current_tty = NULL;
int cost = 0;
int
evalcost (char c)
evalcost (int c)
{
return c;
}
int
cmputc (char c)
cmputc (int c)
{
return c;
}
......@@ -551,9 +552,7 @@ Wcm_clear (struct tty_display_info *tty)
/* Turn appearances of face FACE_ID on tty frame F on. */
static WORD
w32_face_attributes (f, face_id)
struct frame *f;
int face_id;
w32_face_attributes (struct frame *f, int face_id)
{
WORD char_attr;
struct face *face = FACE_FROM_ID (f, face_id);
......@@ -609,8 +608,6 @@ vga_stdcolor_name (int idx)
return Qunspecified; /* meaning the default */
}
typedef int (*term_hook) ();
void
initialize_w32_display (struct terminal *term)
{
......@@ -618,19 +615,19 @@ initialize_w32_display (struct terminal *term)
term->rif = 0; /* No window based redisplay on the console. */
term->cursor_to_hook = w32con_move_cursor;
term->raw_cursor_to_hook = w32con_move_cursor;
term->clear_to_end_hook = w32con_clear_to_end;
term->clear_frame_hook = w32con_clear_frame;
term->raw_cursor_to_hook = w32con_move_cursor;
term->clear_to_end_hook = w32con_clear_to_end;
term->clear_frame_hook = w32con_clear_frame;
term->clear_end_of_line_hook = w32con_clear_end_of_line;
term->ins_del_lines_hook = w32con_ins_del_lines;
term->insert_glyphs_hook = w32con_insert_glyphs;
term->write_glyphs_hook = w32con_write_glyphs;
term->delete_glyphs_hook = w32con_delete_glyphs;
term->ins_del_lines_hook = w32con_ins_del_lines;
term->insert_glyphs_hook = w32con_insert_glyphs;
term->write_glyphs_hook = w32con_write_glyphs;
term->delete_glyphs_hook = w32con_delete_glyphs;
term->ring_bell_hook = w32_sys_ring_bell;
term->reset_terminal_modes_hook = w32con_reset_terminal_modes;
term->reset_terminal_modes_hook = w32con_reset_terminal_modes;
term->set_terminal_modes_hook = w32con_set_terminal_modes;
term->set_terminal_window_hook = w32con_set_terminal_window;
term->update_begin_hook = w32con_update_begin;
term->set_terminal_window_hook = w32con_set_terminal_window;
term->update_begin_hook = w32con_update_begin;
term->update_end_hook = w32con_update_end;
term->read_socket_hook = w32_console_read_socket;
......@@ -775,7 +772,7 @@ DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
}
void
syms_of_ntterm ()
syms_of_ntterm (void)
{
DEFVAR_BOOL ("w32-use-full-screen-buffer",
&w32_use_full_screen_buffer,
......
......@@ -69,11 +69,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define FOF_NO_CONNECTED_ELEMENTS 0x2000
#endif
void syms_of_w32fns ();
void globals_of_w32fns ();
void syms_of_w32fns (void);
void globals_of_w32fns (void);
extern void free_frame_menubar ();
extern double atof ();
extern void free_frame_menubar (struct frame *);
extern double atof (const char *);
extern int w32_console_toggle_lock_key (int, Lisp_Object);
extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
extern void w32_free_menu_strings (HWND);
......@@ -316,7 +316,7 @@ extern HMENU current_popup_menu;
static int menubar_in_use = 0;
/* From w32uniscribe.c */
extern void syms_of_w32uniscribe ();
extern void syms_of_w32uniscribe (void);
extern int uniscribe_available;
/* Function prototypes for hourglass support. */
......@@ -327,7 +327,7 @@ static void w32_hide_hourglass (void);
/* Error if we are not connected to MS-Windows. */
void
check_w32 ()
check_w32 (void)
{
if (! w32_in_use)
error ("MS-Windows not in use or not initialized");
......@@ -337,7 +337,7 @@ check_w32 ()
You should not call this unless HAVE_MENUS is defined. */
int
have_menus_p ()
have_menus_p (void)
{
return w32_in_use;
}
......@@ -346,8 +346,7 @@ have_menus_p ()
and checking validity for W32. */
FRAME_PTR
check_x_frame (frame)
Lisp_Object frame;
check_x_frame (Lisp_Object frame)
{
FRAME_PTR f;
......@@ -365,8 +364,7 @@ check_x_frame (frame)
the first display on the list. */
struct w32_display_info *
check_x_display_info (frame)
Lisp_Object frame;
check_x_display_info (Lisp_Object frame)
{
if (NILP (frame))
{
......@@ -397,9 +395,7 @@ check_x_display_info (frame)
/* This function can be called during GC, so use GC_xxx type test macros. */
struct frame *
x_window_to_frame (dpyinfo, wdesc)
struct w32_display_info *dpyinfo;
HWND wdesc;
x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
......@@ -449,9 +445,7 @@ static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
not Emacs's own window. */
void
x_real_positions (f, xptr, yptr)
FRAME_PTR f;
int *xptr, *yptr;
x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
{
POINT pt;
RECT rect;
......@@ -790,8 +784,7 @@ DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
}
static Lisp_Object
w32_to_x_color (rgb)
Lisp_Object rgb;
w32_to_x_color (Lisp_Object rgb)
{
Lisp_Object color;
......@@ -810,8 +803,7 @@ w32_to_x_color (rgb)
}
static Lisp_Object
w32_color_map_lookup (colorname)
char *colorname;
w32_color_map_lookup (char *colorname)
{
Lisp_Object tail, ret = Qnil;
......@@ -843,8 +835,7 @@ w32_color_map_lookup (colorname)
static void
add_system_logical_colors_to_map (system_colors)
Lisp_Object *system_colors;
add_system_logical_colors_to_map (Lisp_Object *system_colors)
{
HKEY colors_key;
......@@ -892,8 +883,7 @@ add_system_logical_colors_to_map (system_colors)
static Lisp_Object
x_to_w32_color (colorname)
char * colorname;
x_to_w32_color (char * colorname)
{
register Lisp_Object ret = Qnil;
......@@ -1204,9 +1194,7 @@ w32_unmap_color (FRAME_PTR f, COLORREF color)
/* Gamma-correct COLOR on frame F. */
void
gamma_correct (f, color)
struct frame *f;
COLORREF *color;
gamma_correct (struct frame *f, COLORREF *color)
{
if (f->gamma)
{
......@@ -1223,11 +1211,7 @@ gamma_correct (f, color)
If ALLOC is nonzero, allocate a new colormap cell. */
int
w32_defined_color (f, color, color_def, alloc)
FRAME_PTR f;
char *color;
XColor *color_def;
int alloc;
w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc)
{
register Lisp_Object tem;
COLORREF w32_color_ref;
......@@ -1299,10 +1283,7 @@ w32_defined_color (f, color, color_def, alloc)
ARG says. */
int
x_decode_color (f, arg, def)
FRAME_PTR f;
Lisp_Object arg;
int def;
x_decode_color (FRAME_PTR f, Lisp_Object arg, int def)
{
XColor cdef;
......@@ -1336,9 +1317,7 @@ x_decode_color (f, arg, def)
in the standard place; do not attempt to change the window. */
void
x_set_foreground_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct w32_output *x = f->output_data.w32;
PIX_TYPE fg, old_fg;
......@@ -1359,9 +1338,7 @@ x_set_foreground_color (f, arg, oldval)
}
void
x_set_background_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
FRAME_BACKGROUND_PIXEL (f)
= x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
......@@ -1379,9 +1356,7 @@ x_set_background_color (f, arg, oldval)
}
void
x_set_mouse_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
int count;
......@@ -1528,9 +1503,7 @@ x_set_mouse_color (f, arg, oldval)
}
void
x_set_cursor_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
unsigned long fore_pixel, pixel;
......@@ -1577,9 +1550,7 @@ x_set_cursor_color (f, arg, oldval)
F has a window. */
void
x_set_border_pixel (f, pix)
struct frame *f;
int pix;
x_set_border_pixel (struct frame *f, int pix)
{
f->output_data.w32->border_pixel = pix;
......@@ -1598,9 +1569,7 @@ x_set_border_pixel (f, pix)
F has a window; it must be redone when the window is created. */
void
x_set_border_color (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int pix;
......@@ -1612,9 +1581,7 @@ x_set_border_color (f, arg, oldval)
void
x_set_cursor_type (f, arg, oldval)
FRAME_PTR f;
Lisp_Object arg, oldval;
x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
set_frame_cursor_types (f, arg);
......@@ -1623,9 +1590,7 @@ x_set_cursor_type (f, arg, oldval)
}
void
x_set_icon_type (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int result;
......@@ -1652,9 +1617,7 @@ x_set_icon_type (f, arg, oldval)
}
void
x_set_icon_name (f, arg, oldval)
struct frame *f;
Lisp_Object arg, oldval;
x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
if (STRINGP (arg))
{
......@@ -1702,9 +1665,7 @@ x_set_icon_name (f, arg, oldval)
void
x_set_menu_bar_lines (f, value, oldval)
struct frame *f;
Lisp_Object value, oldval;
x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int nlines;
int olines = FRAME_MENU_BAR_LINES (f);
......@@ -1747,9 +1708,7 @@ x_set_menu_bar_lines (f, value, oldval)
The frame's height doesn't change. */
void
x_set_tool_bar_lines (f, value, oldval)
struct frame *f;
Lisp_Object value, oldval;
x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int delta, nlines, root_height;
Lisp_Object root_window;
......@@ -1829,10 +1788,7 @@ x_set_tool_bar_lines (f, value, oldval)
F->explicit_name is set, ignore the new name; otherwise, set it. */
void
x_set_name (f, name, explicit)
struct frame *f;
Lisp_Object name;
int explicit;
x_set_name (struct frame *f, Lisp_Object name, int explicit)
{
/* Make sure that requests from lisp code override requests from
Emacs redisplay code. */
......@@ -1887,9 +1843,7 @@ x_set_name (f, name, explicit)
specified a name for the frame; the name will override any set by the
redisplay code. */
void
x_explicitly_set_name (f, arg, oldval)
FRAME_PTR f;
Lisp_Object arg, oldval;
x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
x_set_name (f, arg, 1);
}
......@@ -1898,9 +1852,7 @@ x_explicitly_set_name (f, arg, oldval)
name; names set this way will never override names set by the user's
lisp code. */
void
x_implicitly_set_name (f, arg, oldval)
FRAME_PTR f;
Lisp_Object arg, oldval;
x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
x_set_name (f, arg, 0);
}
......@@ -1909,9 +1861,7 @@ x_implicitly_set_name (f, arg, oldval)