diff options
| author | Juanma Barranquero | 2010-07-06 16:22:29 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2010-07-06 16:22:29 +0200 |
| commit | b56ceb92bf4d470af2e9172d1fcd4d85232c40a6 (patch) | |
| tree | 50ab60b4715be45ed671c386c5b9336b45443539 /src/w32.c | |
| parent | 7af07b967171736a35e0af8b6ecf6feb072184dc (diff) | |
| download | emacs-b56ceb92bf4d470af2e9172d1fcd4d85232c40a6.tar.gz emacs-b56ceb92bf4d470af2e9172d1fcd4d85232c40a6.zip | |
src/w32*.c: Convert function definitions to standard C.
Diffstat (limited to 'src/w32.c')
| -rw-r--r-- | src/w32.c | 77 |
1 files changed, 34 insertions, 43 deletions
| @@ -148,7 +148,7 @@ extern Lisp_Object QCflowcontrol, Qhw, Qsw, QCsummary; | |||
| 148 | typedef HRESULT (WINAPI * ShGetFolderPath_fn) | 148 | typedef HRESULT (WINAPI * ShGetFolderPath_fn) |
| 149 | (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *); | 149 | (IN HWND, IN int, IN HANDLE, IN DWORD, OUT char *); |
| 150 | 150 | ||
| 151 | void globals_of_w32 (); | 151 | void globals_of_w32 (void); |
| 152 | static DWORD get_rid (PSID); | 152 | static DWORD get_rid (PSID); |
| 153 | 153 | ||
| 154 | extern Lisp_Object Vw32_downcase_file_names; | 154 | extern Lisp_Object Vw32_downcase_file_names; |
| @@ -308,7 +308,7 @@ typedef BOOL (WINAPI * GetSystemTimes_Proc) ( | |||
| 308 | 308 | ||
| 309 | /* ** A utility function ** */ | 309 | /* ** A utility function ** */ |
| 310 | static BOOL | 310 | static BOOL |
| 311 | is_windows_9x () | 311 | is_windows_9x (void) |
| 312 | { | 312 | { |
| 313 | static BOOL s_b_ret=0; | 313 | static BOOL s_b_ret=0; |
| 314 | OSVERSIONINFO os_ver; | 314 | OSVERSIONINFO os_ver; |
| @@ -329,7 +329,7 @@ is_windows_9x () | |||
| 329 | Returns a list of three integers if the times are provided by the OS | 329 | Returns a list of three integers if the times are provided by the OS |
| 330 | (NT derivatives), otherwise it returns the result of current-time. */ | 330 | (NT derivatives), otherwise it returns the result of current-time. */ |
| 331 | Lisp_Object | 331 | Lisp_Object |
| 332 | w32_get_internal_run_time () | 332 | w32_get_internal_run_time (void) |
| 333 | { | 333 | { |
| 334 | if (get_process_times_fn) | 334 | if (get_process_times_fn) |
| 335 | { | 335 | { |
| @@ -1035,13 +1035,13 @@ static struct group dflt_group = | |||
| 1035 | }; | 1035 | }; |
| 1036 | 1036 | ||
| 1037 | unsigned | 1037 | unsigned |
| 1038 | getuid () | 1038 | getuid (void) |
| 1039 | { | 1039 | { |
| 1040 | return dflt_passwd.pw_uid; | 1040 | return dflt_passwd.pw_uid; |
| 1041 | } | 1041 | } |
| 1042 | 1042 | ||
| 1043 | unsigned | 1043 | unsigned |
| 1044 | geteuid () | 1044 | geteuid (void) |
| 1045 | { | 1045 | { |
| 1046 | /* I could imagine arguing for checking to see whether the user is | 1046 | /* I could imagine arguing for checking to see whether the user is |
| 1047 | in the Administrators group and returning a UID of 0 for that | 1047 | in the Administrators group and returning a UID of 0 for that |
| @@ -1050,13 +1050,13 @@ geteuid () | |||
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | unsigned | 1052 | unsigned |
| 1053 | getgid () | 1053 | getgid (void) |
| 1054 | { | 1054 | { |
| 1055 | return dflt_passwd.pw_gid; | 1055 | return dflt_passwd.pw_gid; |
| 1056 | } | 1056 | } |
| 1057 | 1057 | ||
| 1058 | unsigned | 1058 | unsigned |
| 1059 | getegid () | 1059 | getegid (void) |
| 1060 | { | 1060 | { |
| 1061 | return getgid (); | 1061 | return getgid (); |
| 1062 | } | 1062 | } |
| @@ -1091,7 +1091,7 @@ getpwnam (char *name) | |||
| 1091 | } | 1091 | } |
| 1092 | 1092 | ||
| 1093 | void | 1093 | void |
| 1094 | init_user_info () | 1094 | init_user_info (void) |
| 1095 | { | 1095 | { |
| 1096 | /* Find the user's real name by opening the process token and | 1096 | /* Find the user's real name by opening the process token and |
| 1097 | looking up the name associated with the user-sid in that token. | 1097 | looking up the name associated with the user-sid in that token. |
| @@ -1207,7 +1207,7 @@ init_user_info () | |||
| 1207 | } | 1207 | } |
| 1208 | 1208 | ||
| 1209 | int | 1209 | int |
| 1210 | random () | 1210 | random (void) |
| 1211 | { | 1211 | { |
| 1212 | /* rand () on NT gives us 15 random bits...hack together 30 bits. */ | 1212 | /* rand () on NT gives us 15 random bits...hack together 30 bits. */ |
| 1213 | return ((rand () << 15) | rand ()); | 1213 | return ((rand () << 15) | rand ()); |
| @@ -1225,9 +1225,7 @@ srandom (int seed) | |||
| 1225 | case path name components to lower case. */ | 1225 | case path name components to lower case. */ |
| 1226 | 1226 | ||
| 1227 | static void | 1227 | static void |
| 1228 | normalize_filename (fp, path_sep) | 1228 | normalize_filename (register char *fp, char path_sep) |
| 1229 | register char *fp; | ||
| 1230 | char path_sep; | ||
| 1231 | { | 1229 | { |
| 1232 | char sep; | 1230 | char sep; |
| 1233 | char *elem; | 1231 | char *elem; |
| @@ -1283,16 +1281,14 @@ normalize_filename (fp, path_sep) | |||
| 1283 | 1281 | ||
| 1284 | /* Destructively turn backslashes into slashes. */ | 1282 | /* Destructively turn backslashes into slashes. */ |
| 1285 | void | 1283 | void |
| 1286 | dostounix_filename (p) | 1284 | dostounix_filename (register char *p) |
| 1287 | register char *p; | ||
| 1288 | { | 1285 | { |
| 1289 | normalize_filename (p, '/'); | 1286 | normalize_filename (p, '/'); |
| 1290 | } | 1287 | } |
| 1291 | 1288 | ||
| 1292 | /* Destructively turn slashes into backslashes. */ | 1289 | /* Destructively turn slashes into backslashes. */ |
| 1293 | void | 1290 | void |
| 1294 | unixtodos_filename (p) | 1291 | unixtodos_filename (register char *p) |
| 1295 | register char *p; | ||
| 1296 | { | 1292 | { |
| 1297 | normalize_filename (p, '\\'); | 1293 | normalize_filename (p, '\\'); |
| 1298 | } | 1294 | } |
| @@ -1301,9 +1297,7 @@ unixtodos_filename (p) | |||
| 1301 | (From msdos.c...probably should figure out a way to share it, | 1297 | (From msdos.c...probably should figure out a way to share it, |
| 1302 | although this code isn't going to ever change.) */ | 1298 | although this code isn't going to ever change.) */ |
| 1303 | int | 1299 | int |
| 1304 | crlf_to_lf (n, buf) | 1300 | crlf_to_lf (register int n, register unsigned char *buf) |
| 1305 | register int n; | ||
| 1306 | register unsigned char *buf; | ||
| 1307 | { | 1301 | { |
| 1308 | unsigned char *np = buf; | 1302 | unsigned char *np = buf; |
| 1309 | unsigned char *startp = buf; | 1303 | unsigned char *startp = buf; |
| @@ -1520,9 +1514,7 @@ alarm (int seconds) | |||
| 1520 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" | 1514 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" |
| 1521 | 1515 | ||
| 1522 | LPBYTE | 1516 | LPBYTE |
| 1523 | w32_get_resource (key, lpdwtype) | 1517 | w32_get_resource (char *key, LPDWORD lpdwtype) |
| 1524 | char *key; | ||
| 1525 | LPDWORD lpdwtype; | ||
| 1526 | { | 1518 | { |
| 1527 | LPBYTE lpvalue; | 1519 | LPBYTE lpvalue; |
| 1528 | HKEY hrootkey = NULL; | 1520 | HKEY hrootkey = NULL; |
| @@ -2691,7 +2683,7 @@ sys_creat (const char * path, int mode) | |||
| 2691 | } | 2683 | } |
| 2692 | 2684 | ||
| 2693 | FILE * | 2685 | FILE * |
| 2694 | sys_fopen(const char * path, const char * mode) | 2686 | sys_fopen (const char * path, const char * mode) |
| 2695 | { | 2687 | { |
| 2696 | int fd; | 2688 | int fd; |
| 2697 | int oflag; | 2689 | int oflag; |
| @@ -2980,7 +2972,7 @@ static int init = 0; | |||
| 2980 | } while (0) | 2972 | } while (0) |
| 2981 | 2973 | ||
| 2982 | static void | 2974 | static void |
| 2983 | initialize_utc_base () | 2975 | initialize_utc_base (void) |
| 2984 | { | 2976 | { |
| 2985 | /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */ | 2977 | /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */ |
| 2986 | SYSTEMTIME st; | 2978 | SYSTEMTIME st; |
| @@ -3904,7 +3896,7 @@ BOOL WINAPI global_memory_status_ex ( | |||
| 3904 | } | 3896 | } |
| 3905 | 3897 | ||
| 3906 | Lisp_Object | 3898 | Lisp_Object |
| 3907 | list_system_processes () | 3899 | list_system_processes (void) |
| 3908 | { | 3900 | { |
| 3909 | struct gcpro gcpro1; | 3901 | struct gcpro gcpro1; |
| 3910 | Lisp_Object proclist = Qnil; | 3902 | Lisp_Object proclist = Qnil; |
| @@ -3995,8 +3987,7 @@ restore_privilege (TOKEN_PRIVILEGES *priv) | |||
| 3995 | } | 3987 | } |
| 3996 | 3988 | ||
| 3997 | static Lisp_Object | 3989 | static Lisp_Object |
| 3998 | ltime (time_sec, time_usec) | 3990 | ltime (long time_sec, long time_usec) |
| 3999 | long time_sec, time_usec; | ||
| 4000 | { | 3991 | { |
| 4001 | return list3 (make_number ((time_sec >> 16) & 0xffff), | 3992 | return list3 (make_number ((time_sec >> 16) & 0xffff), |
| 4002 | make_number (time_sec & 0xffff), | 3993 | make_number (time_sec & 0xffff), |
| @@ -4006,10 +3997,9 @@ ltime (time_sec, time_usec) | |||
| 4006 | #define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L) | 3997 | #define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L) |
| 4007 | 3998 | ||
| 4008 | static int | 3999 | static int |
| 4009 | process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu) | 4000 | process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime, |
| 4010 | HANDLE h_proc; | 4001 | Lisp_Object *stime, Lisp_Object *utime, Lisp_Object *ttime, |
| 4011 | Lisp_Object *ctime, *etime, *stime, *utime, *ttime; | 4002 | double *pcpu) |
| 4012 | double *pcpu; | ||
| 4013 | { | 4003 | { |
| 4014 | FILETIME ft_creation, ft_exit, ft_kernel, ft_user, ft_current; | 4004 | FILETIME ft_creation, ft_exit, ft_kernel, ft_user, ft_current; |
| 4015 | ULONGLONG tem1, tem2, tem3, tem; | 4005 | ULONGLONG tem1, tem2, tem3, tem; |
| @@ -4059,8 +4049,7 @@ process_times (h_proc, ctime, etime, stime, utime, ttime, pcpu) | |||
| 4059 | } | 4049 | } |
| 4060 | 4050 | ||
| 4061 | Lisp_Object | 4051 | Lisp_Object |
| 4062 | system_process_attributes (pid) | 4052 | system_process_attributes (Lisp_Object pid) |
| 4063 | Lisp_Object pid; | ||
| 4064 | { | 4053 | { |
| 4065 | struct gcpro gcpro1, gcpro2, gcpro3; | 4054 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 4066 | Lisp_Object attrs = Qnil; | 4055 | Lisp_Object attrs = Qnil; |
| @@ -4526,7 +4515,7 @@ int h_errno = 0; | |||
| 4526 | normal system codes where they overlap (non-overlapping definitions | 4515 | normal system codes where they overlap (non-overlapping definitions |
| 4527 | are already in <sys/socket.h> */ | 4516 | are already in <sys/socket.h> */ |
| 4528 | static void | 4517 | static void |
| 4529 | set_errno () | 4518 | set_errno (void) |
| 4530 | { | 4519 | { |
| 4531 | if (winsock_lib == NULL) | 4520 | if (winsock_lib == NULL) |
| 4532 | h_errno = EINVAL; | 4521 | h_errno = EINVAL; |
| @@ -4548,7 +4537,7 @@ set_errno () | |||
| 4548 | } | 4537 | } |
| 4549 | 4538 | ||
| 4550 | static void | 4539 | static void |
| 4551 | check_errno () | 4540 | check_errno (void) |
| 4552 | { | 4541 | { |
| 4553 | if (h_errno == 0 && winsock_lib != NULL) | 4542 | if (h_errno == 0 && winsock_lib != NULL) |
| 4554 | pfn_WSASetLastError (0); | 4543 | pfn_WSASetLastError (0); |
| @@ -5038,7 +5027,7 @@ sys_accept (int s, struct sockaddr * addr, int * addrlen) | |||
| 5038 | 5027 | ||
| 5039 | int | 5028 | int |
| 5040 | sys_recvfrom (int s, char * buf, int len, int flags, | 5029 | sys_recvfrom (int s, char * buf, int len, int flags, |
| 5041 | struct sockaddr * from, int * fromlen) | 5030 | struct sockaddr * from, int * fromlen) |
| 5042 | { | 5031 | { |
| 5043 | if (winsock_lib == NULL) | 5032 | if (winsock_lib == NULL) |
| 5044 | { | 5033 | { |
| @@ -5733,7 +5722,7 @@ sys_write (int fd, const void * buffer, unsigned int count) | |||
| 5733 | } | 5722 | } |
| 5734 | 5723 | ||
| 5735 | static void | 5724 | static void |
| 5736 | check_windows_init_file () | 5725 | check_windows_init_file (void) |
| 5737 | { | 5726 | { |
| 5738 | extern int noninteractive, inhibit_window_system; | 5727 | extern int noninteractive, inhibit_window_system; |
| 5739 | 5728 | ||
| @@ -5789,7 +5778,7 @@ check_windows_init_file () | |||
| 5789 | } | 5778 | } |
| 5790 | 5779 | ||
| 5791 | void | 5780 | void |
| 5792 | term_ntproc () | 5781 | term_ntproc (void) |
| 5793 | { | 5782 | { |
| 5794 | #ifdef HAVE_SOCKETS | 5783 | #ifdef HAVE_SOCKETS |
| 5795 | /* shutdown the socket interface if necessary */ | 5784 | /* shutdown the socket interface if necessary */ |
| @@ -5800,7 +5789,7 @@ term_ntproc () | |||
| 5800 | } | 5789 | } |
| 5801 | 5790 | ||
| 5802 | void | 5791 | void |
| 5803 | init_ntproc () | 5792 | init_ntproc (void) |
| 5804 | { | 5793 | { |
| 5805 | #ifdef HAVE_SOCKETS | 5794 | #ifdef HAVE_SOCKETS |
| 5806 | /* Initialise the socket interface now if available and requested by | 5795 | /* Initialise the socket interface now if available and requested by |
| @@ -5908,7 +5897,8 @@ init_ntproc () | |||
| 5908 | shutdown_handler ensures that buffers' autosave files are | 5897 | shutdown_handler ensures that buffers' autosave files are |
| 5909 | up to date when the user logs off, or the system shuts down. | 5898 | up to date when the user logs off, or the system shuts down. |
| 5910 | */ | 5899 | */ |
| 5911 | BOOL WINAPI shutdown_handler(DWORD type) | 5900 | BOOL WINAPI |
| 5901 | shutdown_handler(DWORD type) | ||
| 5912 | { | 5902 | { |
| 5913 | /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ | 5903 | /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ |
| 5914 | if (type == CTRL_CLOSE_EVENT /* User closes console window. */ | 5904 | if (type == CTRL_CLOSE_EVENT /* User closes console window. */ |
| @@ -5929,7 +5919,7 @@ BOOL WINAPI shutdown_handler(DWORD type) | |||
| 5929 | initialized is non zero (see the function main in emacs.c). | 5919 | initialized is non zero (see the function main in emacs.c). |
| 5930 | */ | 5920 | */ |
| 5931 | void | 5921 | void |
| 5932 | globals_of_w32 () | 5922 | globals_of_w32 (void) |
| 5933 | { | 5923 | { |
| 5934 | HMODULE kernel32 = GetModuleHandle ("kernel32.dll"); | 5924 | HMODULE kernel32 = GetModuleHandle ("kernel32.dll"); |
| 5935 | 5925 | ||
| @@ -5974,7 +5964,8 @@ globals_of_w32 () | |||
| 5974 | } | 5964 | } |
| 5975 | 5965 | ||
| 5976 | /* For make-serial-process */ | 5966 | /* For make-serial-process */ |
| 5977 | int serial_open (char *port) | 5967 | int |
| 5968 | serial_open (char *port) | ||
| 5978 | { | 5969 | { |
| 5979 | HANDLE hnd; | 5970 | HANDLE hnd; |
| 5980 | child_process *cp; | 5971 | child_process *cp; |
| @@ -6014,7 +6005,7 @@ int serial_open (char *port) | |||
| 6014 | /* For serial-process-configure */ | 6005 | /* For serial-process-configure */ |
| 6015 | void | 6006 | void |
| 6016 | serial_configure (struct Lisp_Process *p, | 6007 | serial_configure (struct Lisp_Process *p, |
| 6017 | Lisp_Object contact) | 6008 | Lisp_Object contact) |
| 6018 | { | 6009 | { |
| 6019 | Lisp_Object childp2 = Qnil; | 6010 | Lisp_Object childp2 = Qnil; |
| 6020 | Lisp_Object tem = Qnil; | 6011 | Lisp_Object tem = Qnil; |