Mercurial > emacs
comparison src/msdos.c @ 109162:8efd6d04c47a
Convert function definitions in MS-DOS sources to ANSI C.
msdos.h:
msdos.c:
dosfns.c:
w16select.c: Convert function definitions to ANSI C.
msdos.h (ctrl_break_func, install_ctrl_break_check): Remove
unused prototypes.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 07 Jul 2010 18:28:47 +0300 |
parents | 254d81c0e750 |
children | 750db9f3e6d8 |
comparison
equal
deleted
inserted
replaced
109161:2f63c33b2618 | 109162:8efd6d04c47a |
---|---|
100 #endif /* GNU_MALLOC */ | 100 #endif /* GNU_MALLOC */ |
101 | 101 |
102 #endif /* not SYSTEM_MALLOC */ | 102 #endif /* not SYSTEM_MALLOC */ |
103 | 103 |
104 static unsigned long | 104 static unsigned long |
105 event_timestamp () | 105 event_timestamp (void) |
106 { | 106 { |
107 struct time t; | 107 struct time t; |
108 unsigned long s; | 108 unsigned long s; |
109 | 109 |
110 gettime (&t); | 110 gettime (&t); |
136 | 136 |
137 static int mouse_button_translate[NUM_MOUSE_BUTTONS]; | 137 static int mouse_button_translate[NUM_MOUSE_BUTTONS]; |
138 static int mouse_button_count; | 138 static int mouse_button_count; |
139 | 139 |
140 void | 140 void |
141 mouse_on () | 141 mouse_on (void) |
142 { | 142 { |
143 union REGS regs; | 143 union REGS regs; |
144 | 144 |
145 if (have_mouse > 0 && !mouse_visible) | 145 if (have_mouse > 0 && !mouse_visible) |
146 { | 146 { |
153 mouse_visible = 1; | 153 mouse_visible = 1; |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void | 157 void |
158 mouse_off () | 158 mouse_off (void) |
159 { | 159 { |
160 union REGS regs; | 160 union REGS regs; |
161 | 161 |
162 if (have_mouse > 0 && mouse_visible) | 162 if (have_mouse > 0 && mouse_visible) |
163 { | 163 { |
220 *x = regs.x.cx / 8; | 220 *x = regs.x.cx / 8; |
221 *y = regs.x.dx / 8; | 221 *y = regs.x.dx / 8; |
222 } | 222 } |
223 | 223 |
224 void | 224 void |
225 mouse_moveto (x, y) | 225 mouse_moveto (int x, int y) |
226 int x, y; | |
227 { | 226 { |
228 union REGS regs; | 227 union REGS regs; |
229 struct tty_display_info *tty = CURTTY (); | 228 struct tty_display_info *tty = CURTTY (); |
230 | 229 |
231 if (tty->termscript) | 230 if (tty->termscript) |
235 mouse_last_y = regs.x.dx = y * 8; | 234 mouse_last_y = regs.x.dx = y * 8; |
236 int86 (0x33, ®s, ®s); | 235 int86 (0x33, ®s, ®s); |
237 } | 236 } |
238 | 237 |
239 static int | 238 static int |
240 mouse_pressed (b, xp, yp) | 239 mouse_pressed (int b, int *xp, int *yp) |
241 int b, *xp, *yp; | |
242 { | 240 { |
243 union REGS regs; | 241 union REGS regs; |
244 | 242 |
245 if (b >= mouse_button_count) | 243 if (b >= mouse_button_count) |
246 return 0; | 244 return 0; |
251 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; | 249 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; |
252 return (regs.x.bx != 0); | 250 return (regs.x.bx != 0); |
253 } | 251 } |
254 | 252 |
255 static int | 253 static int |
256 mouse_released (b, xp, yp) | 254 mouse_released (int b, int *xp, int *yp) |
257 int b, *xp, *yp; | |
258 { | 255 { |
259 union REGS regs; | 256 union REGS regs; |
260 | 257 |
261 if (b >= mouse_button_count) | 258 if (b >= mouse_button_count) |
262 return 0; | 259 return 0; |
267 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; | 264 *xp = regs.x.cx / 8, *yp = regs.x.dx / 8; |
268 return (regs.x.bx != 0); | 265 return (regs.x.bx != 0); |
269 } | 266 } |
270 | 267 |
271 static int | 268 static int |
272 mouse_button_depressed (b, xp, yp) | 269 mouse_button_depressed (int b, int *xp, int *yp) |
273 int b, *xp, *yp; | |
274 { | 270 { |
275 union REGS regs; | 271 union REGS regs; |
276 | 272 |
277 if (b >= mouse_button_count) | 273 if (b >= mouse_button_count) |
278 return 0; | 274 return 0; |
286 } | 282 } |
287 return 0; | 283 return 0; |
288 } | 284 } |
289 | 285 |
290 void | 286 void |
291 mouse_get_pos (f, insist, bar_window, part, x, y, time) | 287 mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, |
292 FRAME_PTR *f; | 288 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
293 int insist; | 289 unsigned long *time) |
294 Lisp_Object *bar_window, *x, *y; | |
295 enum scroll_bar_part *part; | |
296 unsigned long *time; | |
297 { | 290 { |
298 int ix, iy; | 291 int ix, iy; |
299 Lisp_Object frame, tail; | 292 Lisp_Object frame, tail; |
300 | 293 |
301 /* Clear the mouse-moved flag for every frame on this display. */ | 294 /* Clear the mouse-moved flag for every frame on this display. */ |
309 *x = make_number (mouse_last_x = ix); | 302 *x = make_number (mouse_last_x = ix); |
310 *y = make_number (mouse_last_y = iy); | 303 *y = make_number (mouse_last_y = iy); |
311 } | 304 } |
312 | 305 |
313 static void | 306 static void |
314 mouse_check_moved () | 307 mouse_check_moved (void) |
315 { | 308 { |
316 int x, y; | 309 int x, y; |
317 | 310 |
318 mouse_get_xy (&x, &y); | 311 mouse_get_xy (&x, &y); |
319 SELECTED_FRAME()->mouse_moved |= (x != mouse_last_x || y != mouse_last_y); | 312 SELECTED_FRAME()->mouse_moved |= (x != mouse_last_x || y != mouse_last_y); |
336 (void) mouse_released (b, &dummy_x, &dummy_y); | 329 (void) mouse_released (b, &dummy_x, &dummy_y); |
337 } | 330 } |
338 } | 331 } |
339 | 332 |
340 void | 333 void |
341 mouse_init () | 334 mouse_init (void) |
342 { | 335 { |
343 union REGS regs; | 336 union REGS regs; |
344 struct tty_display_info *tty = CURTTY (); | 337 struct tty_display_info *tty = CURTTY (); |
345 | 338 |
346 if (tty->termscript) | 339 if (tty->termscript) |
438 regs.x.cx = count; | 431 regs.x.cx = count; |
439 __dpmi_int (0x10, ®s); | 432 __dpmi_int (0x10, ®s); |
440 } | 433 } |
441 | 434 |
442 static void | 435 static void |
443 dos_direct_output (y, x, buf, len) | 436 dos_direct_output (int y, int x, char *buf, int len) |
444 int x, y; | |
445 char *buf; | |
446 int len; | |
447 { | 437 { |
448 int t0 = 2 * (x + y * screen_size_X); | 438 int t0 = 2 * (x + y * screen_size_X); |
449 int t = t0 + (int) ScreenPrimary; | 439 int t = t0 + (int) ScreenPrimary; |
450 int l0 = len; | 440 int l0 = len; |
451 | 441 |
508 | 498 |
509 /* Set the screen dimensions so that it can show no less than | 499 /* Set the screen dimensions so that it can show no less than |
510 ROWS x COLS frame. */ | 500 ROWS x COLS frame. */ |
511 | 501 |
512 void | 502 void |
513 dos_set_window_size (rows, cols) | 503 dos_set_window_size (int *rows, int *cols) |
514 int *rows, *cols; | |
515 { | 504 { |
516 char video_name[30]; | 505 char video_name[30]; |
517 union REGS regs; | 506 union REGS regs; |
518 Lisp_Object video_mode; | 507 Lisp_Object video_mode; |
519 int video_mode_value, have_vga = 0; | 508 int video_mode_value, have_vga = 0; |
618 | 607 |
619 /* If we write a character in the position where the mouse is, | 608 /* If we write a character in the position where the mouse is, |
620 the mouse cursor may need to be refreshed. */ | 609 the mouse cursor may need to be refreshed. */ |
621 | 610 |
622 static void | 611 static void |
623 mouse_off_maybe () | 612 mouse_off_maybe (void) |
624 { | 613 { |
625 int x, y; | 614 int x, y; |
626 | 615 |
627 if (!mouse_visible) | 616 if (!mouse_visible) |
628 return; | 617 return; |
1862 dosv_refresh_virtual_screen (ypos * screen_size_X * 2, screen_size_X); | 1851 dosv_refresh_virtual_screen (ypos * screen_size_X * 2, screen_size_X); |
1863 } | 1852 } |
1864 | 1853 |
1865 /* Insert and delete glyphs. */ | 1854 /* Insert and delete glyphs. */ |
1866 static void | 1855 static void |
1867 IT_insert_glyphs (f, start, len) | 1856 IT_insert_glyphs (struct frame *f, struct glyph *start, int len) |
1868 struct frame *f; | |
1869 register struct glyph *start; | |
1870 register int len; | |
1871 { | 1857 { |
1872 int shift_by_width = screen_size_X - (new_pos_X + len); | 1858 int shift_by_width = screen_size_X - (new_pos_X + len); |
1873 | 1859 |
1874 /* Shift right the glyphs from the nominal cursor position to the | 1860 /* Shift right the glyphs from the nominal cursor position to the |
1875 end of this line. */ | 1861 end of this line. */ |
1878 /* Now write the glyphs to be inserted. */ | 1864 /* Now write the glyphs to be inserted. */ |
1879 IT_write_glyphs (f, start, len); | 1865 IT_write_glyphs (f, start, len); |
1880 } | 1866 } |
1881 | 1867 |
1882 static void | 1868 static void |
1883 IT_delete_glyphs (f, n) | 1869 IT_delete_glyphs (struct frame *f, int n) |
1884 struct frame *f; | |
1885 register int n; | |
1886 { | 1870 { |
1887 abort (); | 1871 abort (); |
1888 } | 1872 } |
1889 | 1873 |
1890 /* set-window-configuration on window.c needs this. */ | 1874 /* set-window-configuration on window.c needs this. */ |
1891 void | 1875 void |
1892 x_set_menu_bar_lines (f, value, oldval) | 1876 x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) |
1893 struct frame *f; | |
1894 Lisp_Object value, oldval; | |
1895 { | 1877 { |
1896 set_menu_bar_lines (f, value, oldval); | 1878 set_menu_bar_lines (f, value, oldval); |
1897 } | 1879 } |
1898 | 1880 |
1899 /* This was copied from xfaces.c */ | 1881 /* This was copied from xfaces.c */ |
2078 initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); | 2060 initial_screen_colors[0] = FRAME_FOREGROUND_PIXEL (f); |
2079 initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); | 2061 initial_screen_colors[1] = FRAME_BACKGROUND_PIXEL (f); |
2080 } | 2062 } |
2081 | 2063 |
2082 void | 2064 void |
2083 IT_set_frame_parameters (f, alist) | 2065 IT_set_frame_parameters (struct frame *f, Lisp_Object alist) |
2084 struct frame *f; | |
2085 Lisp_Object alist; | |
2086 { | 2066 { |
2087 Lisp_Object tail; | 2067 Lisp_Object tail; |
2088 int i, j, length = XINT (Flength (alist)); | 2068 int i, j, length = XINT (Flength (alist)); |
2089 Lisp_Object *parms | 2069 Lisp_Object *parms |
2090 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 2070 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); |
2287 | 2267 |
2288 | 2268 |
2289 /* Do we need the internal terminal? */ | 2269 /* Do we need the internal terminal? */ |
2290 | 2270 |
2291 void | 2271 void |
2292 internal_terminal_init () | 2272 internal_terminal_init (void) |
2293 { | 2273 { |
2294 static int init_needed = 1; | 2274 static int init_needed = 1; |
2295 char *term = getenv ("TERM"), *colors; | 2275 char *term = getenv ("TERM"), *colors; |
2296 struct frame *sf = SELECTED_FRAME(); | 2276 struct frame *sf = SELECTED_FRAME(); |
2297 struct tty_display_info *tty; | 2277 struct tty_display_info *tty; |
2423 term->redeem_scroll_bar_hook = 0; | 2403 term->redeem_scroll_bar_hook = 0; |
2424 term->judge_scroll_bars_hook = 0; | 2404 term->judge_scroll_bars_hook = 0; |
2425 term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */ | 2405 term->read_socket_hook = &tty_read_avail_input; /* from keyboard.c */ |
2426 } | 2406 } |
2427 | 2407 |
2428 dos_get_saved_screen (screen, rows, cols) | 2408 int |
2429 char **screen; | 2409 dos_get_saved_screen (char **screen, int *rows, int *cols) |
2430 int *rows; | |
2431 int *cols; | |
2432 { | 2410 { |
2433 #ifndef HAVE_X_WINDOWS | 2411 #ifndef HAVE_X_WINDOWS |
2434 *screen = startup_screen_buffer; | 2412 *screen = startup_screen_buffer; |
2435 *cols = startup_screen_size_X; | 2413 *cols = startup_screen_size_X; |
2436 *rows = startup_screen_size_Y; | 2414 *rows = startup_screen_size_Y; |
2585 static struct dos_keyboard_map *keyboard; | 2563 static struct dos_keyboard_map *keyboard; |
2586 static int keyboard_map_all; | 2564 static int keyboard_map_all; |
2587 static int international_keyboard; | 2565 static int international_keyboard; |
2588 | 2566 |
2589 int | 2567 int |
2590 dos_set_keyboard (code, always) | 2568 dos_set_keyboard (int code, int always) |
2591 int code; | |
2592 int always; | |
2593 { | 2569 { |
2594 int i; | 2570 int i; |
2595 _go32_dpmi_registers regs; | 2571 _go32_dpmi_registers regs; |
2596 | 2572 |
2597 /* See if Keyb.Com is installed (for international keyboard support). | 2573 /* See if Keyb.Com is installed (for international keyboard support). |
2854 #define ALT_GR_P 0x0800 | 2830 #define ALT_GR_P 0x0800 |
2855 #define SUPER_P 0x4000 /* pseudo */ | 2831 #define SUPER_P 0x4000 /* pseudo */ |
2856 #define HYPER_P 0x8000 /* pseudo */ | 2832 #define HYPER_P 0x8000 /* pseudo */ |
2857 | 2833 |
2858 static int | 2834 static int |
2859 dos_get_modifiers (keymask) | 2835 dos_get_modifiers (int *keymask) |
2860 int *keymask; | |
2861 { | 2836 { |
2862 union REGS regs; | 2837 union REGS regs; |
2863 int mask, modifiers = 0; | 2838 int mask, modifiers = 0; |
2864 | 2839 |
2865 /* Calculate modifier bits */ | 2840 /* Calculate modifier bits */ |
2937 } | 2912 } |
2938 | 2913 |
2939 #define NUM_RECENT_DOSKEYS (100) | 2914 #define NUM_RECENT_DOSKEYS (100) |
2940 int recent_doskeys_index; /* Index for storing next element into recent_doskeys */ | 2915 int recent_doskeys_index; /* Index for storing next element into recent_doskeys */ |
2941 int total_doskeys; /* Total number of elements stored into recent_doskeys */ | 2916 int total_doskeys; /* Total number of elements stored into recent_doskeys */ |
2942 Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */ | 2917 Lisp_Object recent_doskeys; /* A vector, holding the last 100 keystrokes */ |
2943 | 2918 |
2944 DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0, | 2919 DEFUN ("recent-doskeys", Frecent_doskeys, Srecent_doskeys, 0, 0, 0, |
2945 doc: /* Return vector of last 100 keyboard input values seen in dos_rawgetc. | 2920 doc: /* Return vector of last 100 keyboard input values seen in dos_rawgetc. |
2946 Each input key receives two values in this vector: first the ASCII code, | 2921 Each input key receives two values in this vector: first the ASCII code, |
2947 and then the scan code. */) | 2922 and then the scan code. */) |
2964 } | 2939 } |
2965 } | 2940 } |
2966 | 2941 |
2967 /* Get a char from keyboard. Function keys are put into the event queue. */ | 2942 /* Get a char from keyboard. Function keys are put into the event queue. */ |
2968 static int | 2943 static int |
2969 dos_rawgetc () | 2944 dos_rawgetc (void) |
2970 { | 2945 { |
2971 struct input_event event; | 2946 struct input_event event; |
2972 union REGS regs; | 2947 union REGS regs; |
2973 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); | 2948 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); |
2974 EVENT_INIT (event); | 2949 EVENT_INIT (event); |
3315 } | 3290 } |
3316 | 3291 |
3317 static int prev_get_char = -1; | 3292 static int prev_get_char = -1; |
3318 | 3293 |
3319 /* Return 1 if a key is ready to be read without suspending execution. */ | 3294 /* Return 1 if a key is ready to be read without suspending execution. */ |
3320 | 3295 int |
3321 dos_keysns () | 3296 dos_keysns (void) |
3322 { | 3297 { |
3323 if (prev_get_char != -1) | 3298 if (prev_get_char != -1) |
3324 return 1; | 3299 return 1; |
3325 else | 3300 else |
3326 return ((prev_get_char = dos_rawgetc ()) != -1); | 3301 return ((prev_get_char = dos_rawgetc ()) != -1); |
3327 } | 3302 } |
3328 | 3303 |
3329 /* Read a key. Return -1 if no key is ready. */ | 3304 /* Read a key. Return -1 if no key is ready. */ |
3330 | 3305 int |
3331 dos_keyread () | 3306 dos_keyread (void) |
3332 { | 3307 { |
3333 if (prev_get_char != -1) | 3308 if (prev_get_char != -1) |
3334 { | 3309 { |
3335 int c = prev_get_char; | 3310 int c = prev_get_char; |
3336 prev_get_char = -1; | 3311 prev_get_char = -1; |
3355 /* Pane number and item number of the menu item which generated the | 3330 /* Pane number and item number of the menu item which generated the |
3356 last menu help message. */ | 3331 last menu help message. */ |
3357 static int menu_help_paneno, menu_help_itemno; | 3332 static int menu_help_paneno, menu_help_itemno; |
3358 | 3333 |
3359 static XMenu * | 3334 static XMenu * |
3360 IT_menu_create () | 3335 IT_menu_create (void) |
3361 { | 3336 { |
3362 XMenu *menu; | 3337 XMenu *menu; |
3363 | 3338 |
3364 menu = (XMenu *) xmalloc (sizeof (XMenu)); | 3339 menu = (XMenu *) xmalloc (sizeof (XMenu)); |
3365 menu->allocated = menu->count = menu->panecount = menu->width = 0; | 3340 menu->allocated = menu->count = menu->panecount = menu->width = 0; |
3524 /* --------------------------- X Menu emulation ---------------------- */ | 3499 /* --------------------------- X Menu emulation ---------------------- */ |
3525 | 3500 |
3526 /* Report availability of menus. */ | 3501 /* Report availability of menus. */ |
3527 | 3502 |
3528 int | 3503 int |
3529 have_menus_p () { return 1; } | 3504 have_menus_p (void) { return 1; } |
3530 | 3505 |
3531 /* Create a brand new menu structure. */ | 3506 /* Create a brand new menu structure. */ |
3532 | 3507 |
3533 XMenu * | 3508 XMenu * |
3534 XMenuCreate (Display *foo1, Window foo2, char *foo3) | 3509 XMenuCreate (Display *foo1, Window foo2, char *foo3) |
3882 void msdos_downcase_filename (unsigned char *); | 3857 void msdos_downcase_filename (unsigned char *); |
3883 | 3858 |
3884 /* Destructively turn backslashes into slashes. */ | 3859 /* Destructively turn backslashes into slashes. */ |
3885 | 3860 |
3886 void | 3861 void |
3887 dostounix_filename (p) | 3862 dostounix_filename (char *p) |
3888 register char *p; | |
3889 { | 3863 { |
3890 msdos_downcase_filename (p); | 3864 msdos_downcase_filename (p); |
3891 | 3865 |
3892 while (*p) | 3866 while (*p) |
3893 { | 3867 { |
3898 } | 3872 } |
3899 | 3873 |
3900 /* Destructively turn slashes into backslashes. */ | 3874 /* Destructively turn slashes into backslashes. */ |
3901 | 3875 |
3902 void | 3876 void |
3903 unixtodos_filename (p) | 3877 unixtodos_filename (char *p) |
3904 register char *p; | |
3905 { | 3878 { |
3906 if (p[1] == ':' && *p >= 'A' && *p <= 'Z') | 3879 if (p[1] == ':' && *p >= 'A' && *p <= 'Z') |
3907 { | 3880 { |
3908 *p += 'a' - 'A'; | 3881 *p += 'a' - 'A'; |
3909 p += 2; | 3882 p += 2; |
3918 } | 3891 } |
3919 | 3892 |
3920 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ | 3893 /* Get the default directory for a given drive. 0=def, 1=A, 2=B, ... */ |
3921 | 3894 |
3922 int | 3895 int |
3923 getdefdir (drive, dst) | 3896 getdefdir (int drive, char *dst) |
3924 int drive; | |
3925 char *dst; | |
3926 { | 3897 { |
3927 char in_path[4], *p = in_path, e = errno; | 3898 char in_path[4], *p = in_path, e = errno; |
3928 | 3899 |
3929 /* Generate "X:." (when drive is X) or "." (when drive is 0). */ | 3900 /* Generate "X:." (when drive is X) or "." (when drive is 0). */ |
3930 if (drive != 0) | 3901 if (drive != 0) |
3959 } | 3930 } |
3960 | 3931 |
3961 /* Remove all CR's that are followed by a LF. */ | 3932 /* Remove all CR's that are followed by a LF. */ |
3962 | 3933 |
3963 int | 3934 int |
3964 crlf_to_lf (n, buf) | 3935 crlf_to_lf (int n, unsigned char *buf) |
3965 register int n; | |
3966 register unsigned char *buf; | |
3967 { | 3936 { |
3968 unsigned char *np = buf, *startp = buf, *endp = buf + n; | 3937 unsigned char *np = buf, *startp = buf, *endp = buf + n; |
3969 | 3938 |
3970 if (n == 0) | 3939 if (n == 0) |
3971 return n; | 3940 return n; |
3993 } | 3962 } |
3994 | 3963 |
3995 /* Convert alphabetic characters in a filename to lower-case. */ | 3964 /* Convert alphabetic characters in a filename to lower-case. */ |
3996 | 3965 |
3997 void | 3966 void |
3998 msdos_downcase_filename (p) | 3967 msdos_downcase_filename (unsigned char *p) |
3999 register unsigned char *p; | |
4000 { | 3968 { |
4001 /* Always lower-case drive letters a-z, even if the filesystem | 3969 /* Always lower-case drive letters a-z, even if the filesystem |
4002 preserves case in filenames. | 3970 preserves case in filenames. |
4003 This is so MSDOS filenames could be compared by string comparison | 3971 This is so MSDOS filenames could be compared by string comparison |
4004 functions that are case-sensitive. Even case-preserving filesystems | 3972 functions that are case-sensitive. Even case-preserving filesystems |
4038 /* The Emacs root directory as determined by init_environment. */ | 4006 /* The Emacs root directory as determined by init_environment. */ |
4039 | 4007 |
4040 static char emacsroot[MAXPATHLEN]; | 4008 static char emacsroot[MAXPATHLEN]; |
4041 | 4009 |
4042 char * | 4010 char * |
4043 rootrelativepath (rel) | 4011 rootrelativepath (char *rel) |
4044 char *rel; | |
4045 { | 4012 { |
4046 static char result[MAXPATHLEN + 10]; | 4013 static char result[MAXPATHLEN + 10]; |
4047 | 4014 |
4048 strcpy (result, emacsroot); | 4015 strcpy (result, emacsroot); |
4049 strcat (result, "/"); | 4016 strcat (result, "/"); |
4054 /* Define a lot of environment variables if not already defined. Don't | 4021 /* Define a lot of environment variables if not already defined. Don't |
4055 remove anything unless you know what you're doing -- lots of code will | 4022 remove anything unless you know what you're doing -- lots of code will |
4056 break if one or more of these are missing. */ | 4023 break if one or more of these are missing. */ |
4057 | 4024 |
4058 void | 4025 void |
4059 init_environment (argc, argv, skip_args) | 4026 init_environment (int argc, char **argv, int skip_args) |
4060 int argc; | |
4061 char **argv; | |
4062 int skip_args; | |
4063 { | 4027 { |
4064 char *s, *t, *root; | 4028 char *s, *t, *root; |
4065 int len, i; | 4029 int len, i; |
4066 static const char * const tempdirs[] = { | 4030 static const char * const tempdirs[] = { |
4067 "$TMPDIR", "$TEMP", "$TMP", "c:/" | 4031 "$TMPDIR", "$TEMP", "$TMP", "c:/" |
4291 } | 4255 } |
4292 | 4256 |
4293 /* Restore status of standard input and Ctrl-C checking. */ | 4257 /* Restore status of standard input and Ctrl-C checking. */ |
4294 | 4258 |
4295 int | 4259 int |
4296 dos_ttcooked () | 4260 dos_ttcooked (void) |
4297 { | 4261 { |
4298 union REGS inregs, outregs; | 4262 union REGS inregs, outregs; |
4299 | 4263 |
4300 setcbrk (break_stat); | 4264 setcbrk (break_stat); |
4301 mouse_off (); | 4265 mouse_off (); |
4317 /* Run command as specified by ARGV in directory DIR. | 4281 /* Run command as specified by ARGV in directory DIR. |
4318 The command is run with input from TEMPIN, output to | 4282 The command is run with input from TEMPIN, output to |
4319 file TEMPOUT and stderr to TEMPERR. */ | 4283 file TEMPOUT and stderr to TEMPERR. */ |
4320 | 4284 |
4321 int | 4285 int |
4322 run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv) | 4286 run_msdos_command (unsigned char **argv, const char *working_dir, |
4323 unsigned char **argv; | 4287 int tempin, int tempout, int temperr, char **envv) |
4324 const char *working_dir; | |
4325 int tempin, tempout, temperr; | |
4326 char **envv; | |
4327 { | 4288 { |
4328 char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl; | 4289 char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl; |
4329 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ | 4290 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ |
4330 int msshell, result = -1, inbak, outbak, errbak, x, y; | 4291 int msshell, result = -1, inbak, outbak, errbak, x, y; |
4331 Lisp_Object cmd; | 4292 Lisp_Object cmd; |
4462 } | 4423 } |
4463 return result; | 4424 return result; |
4464 } | 4425 } |
4465 | 4426 |
4466 void | 4427 void |
4467 croak (badfunc) | 4428 croak (char *badfunc) |
4468 char *badfunc; | |
4469 { | 4429 { |
4470 fprintf (stderr, "%s not yet implemented\r\n", badfunc); | 4430 fprintf (stderr, "%s not yet implemented\r\n", badfunc); |
4471 reset_all_sys_modes (); | 4431 reset_all_sys_modes (); |
4472 exit (1); | 4432 exit (1); |
4473 } | 4433 } |
4474 | 4434 |
4475 /* | 4435 /* |
4476 * A few unimplemented functions that we silently ignore. | 4436 * A few unimplemented functions that we silently ignore. |
4477 */ | 4437 */ |
4478 setpgrp () {return 0; } | 4438 int setpgrp (void) {return 0; } |
4479 setpriority (x,y,z) int x,y,z; { return 0; } | 4439 int setpriority (int x, int y, int z) { return 0; } |
4480 | 4440 |
4481 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 | 4441 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 |
4482 | 4442 |
4483 /* Augment DJGPP library POSIX signal functions. This is needed | 4443 /* Augment DJGPP library POSIX signal functions. This is needed |
4484 as of DJGPP v2.01, but might be in the library in later releases. */ | 4444 as of DJGPP v2.01, but might be in the library in later releases. */ |
4499 static sighandler_t prev_handlers[320]; | 4459 static sighandler_t prev_handlers[320]; |
4500 | 4460 |
4501 /* A signal handler which just records that a signal occurred | 4461 /* A signal handler which just records that a signal occurred |
4502 (it will be raised later, if and when the signal is unblocked). */ | 4462 (it will be raised later, if and when the signal is unblocked). */ |
4503 static void | 4463 static void |
4504 sig_suspender (signo) | 4464 sig_suspender (int signo) |
4505 int signo; | |
4506 { | 4465 { |
4507 sigaddset (&msdos_pending_signals, signo); | 4466 sigaddset (&msdos_pending_signals, signo); |
4508 } | 4467 } |
4509 | 4468 |
4510 int | 4469 int |
4511 sigprocmask (how, new_set, old_set) | 4470 sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set) |
4512 int how; | |
4513 const sigset_t *new_set; | |
4514 sigset_t *old_set; | |
4515 { | 4471 { |
4516 int signo; | 4472 int signo; |
4517 sigset_t new_mask; | 4473 sigset_t new_mask; |
4518 | 4474 |
4519 /* If called for the first time, initialize. */ | 4475 /* If called for the first time, initialize. */ |
4611 | 4567 |
4612 /* Only event queue is checked. */ | 4568 /* Only event queue is checked. */ |
4613 /* We don't have to call timer_check here | 4569 /* We don't have to call timer_check here |
4614 because wait_reading_process_output takes care of that. */ | 4570 because wait_reading_process_output takes care of that. */ |
4615 int | 4571 int |
4616 sys_select (nfds, rfds, wfds, efds, timeout) | 4572 sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, |
4617 int nfds; | 4573 EMACS_TIME *timeout) |
4618 SELECT_TYPE *rfds, *wfds, *efds; | |
4619 EMACS_TIME *timeout; | |
4620 { | 4574 { |
4621 int check_input; | 4575 int check_input; |
4622 struct time t; | 4576 struct time t; |
4623 | 4577 |
4624 check_input = 0; | 4578 check_input = 0; |
4684 * abort -> dos_abort | 4638 * abort -> dos_abort |
4685 */ | 4639 */ |
4686 | 4640 |
4687 #ifdef chdir | 4641 #ifdef chdir |
4688 #undef chdir | 4642 #undef chdir |
4689 extern int chdir (); | 4643 extern int chdir (const char *); |
4690 | 4644 |
4691 int | 4645 int |
4692 sys_chdir (path) | 4646 sys_chdir (const char *path) |
4693 const char* path; | |
4694 { | 4647 { |
4695 int len = strlen (path); | 4648 int len = strlen (path); |
4696 char *tmp = (char *)path; | 4649 char *tmp = (char *)path; |
4697 | 4650 |
4698 if (*tmp && tmp[1] == ':') | 4651 if (*tmp && tmp[1] == ':') |
4717 #ifdef tzset | 4670 #ifdef tzset |
4718 #undef tzset | 4671 #undef tzset |
4719 extern void tzset (void); | 4672 extern void tzset (void); |
4720 | 4673 |
4721 void | 4674 void |
4722 init_gettimeofday () | 4675 init_gettimeofday (void) |
4723 { | 4676 { |
4724 time_t ltm, gtm; | 4677 time_t ltm, gtm; |
4725 struct tm *lstm; | 4678 struct tm *lstm; |
4726 | 4679 |
4727 tzset (); | 4680 tzset (); |
4735 #endif | 4688 #endif |
4736 | 4689 |
4737 #ifdef abort | 4690 #ifdef abort |
4738 #undef abort | 4691 #undef abort |
4739 void | 4692 void |
4740 dos_abort (file, line) | 4693 dos_abort (char *file, int line) |
4741 char *file; | |
4742 int line; | |
4743 { | 4694 { |
4744 char buffer1[200], buffer2[400]; | 4695 char buffer1[200], buffer2[400]; |
4745 int i, j; | 4696 int i, j; |
4746 | 4697 |
4747 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line); | 4698 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line); |
4753 ScreenSetCursor (2, 0); | 4704 ScreenSetCursor (2, 0); |
4754 abort (); | 4705 abort (); |
4755 } | 4706 } |
4756 #else | 4707 #else |
4757 void | 4708 void |
4758 abort () | 4709 abort (void) |
4759 { | 4710 { |
4760 dos_ttcooked (); | 4711 dos_ttcooked (); |
4761 ScreenSetCursor (10, 0); | 4712 ScreenSetCursor (10, 0); |
4762 cputs ("\r\n\nEmacs aborted!\r\n"); | 4713 cputs ("\r\n\nEmacs aborted!\r\n"); |
4763 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 | 4714 #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 |
4778 #ifndef subprocesses | 4729 #ifndef subprocesses |
4779 /* Nonzero means delete a process right away if it exits (process.c). */ | 4730 /* Nonzero means delete a process right away if it exits (process.c). */ |
4780 static int delete_exited_processes; | 4731 static int delete_exited_processes; |
4781 #endif | 4732 #endif |
4782 | 4733 |
4783 syms_of_msdos () | 4734 void |
4735 syms_of_msdos (void) | |
4784 { | 4736 { |
4785 recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); | 4737 recent_doskeys = Fmake_vector (make_number (NUM_RECENT_DOSKEYS), Qnil); |
4786 staticpro (&recent_doskeys); | 4738 staticpro (&recent_doskeys); |
4787 | 4739 |
4788 #ifndef HAVE_X_WINDOWS | 4740 #ifndef HAVE_X_WINDOWS |