Mercurial > emacs
comparison src/msdos.c @ 22481:c19803db4a93
(dos_set_keyboard): Call Int 2Fh via the DPMI server, not directly.
(dos_yield_time_slice): New function.
(sys_select): Use it instead of __dpmi_yield.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 14 Jun 1998 16:19:33 +0000 |
parents | d313bff62b93 |
children | 9b39197e9ecd |
comparison
equal
deleted
inserted
replaced
22480:a85ad07a6e4b | 22481:c19803db4a93 |
---|---|
1270 dos_set_keyboard (code, always) | 1270 dos_set_keyboard (code, always) |
1271 int code; | 1271 int code; |
1272 int always; | 1272 int always; |
1273 { | 1273 { |
1274 int i; | 1274 int i; |
1275 union REGS regs; | 1275 _go32_dpmi_registers regs; |
1276 | 1276 |
1277 /* See if Keyb.Com is installed (for international keyboard support). */ | 1277 /* See if Keyb.Com is installed (for international keyboard support). |
1278 Note: calling Int 2Fh via int86 wedges the DOS box on some versions | |
1279 of Windows 9X! So don't do that! */ | |
1278 regs.x.ax = 0xad80; | 1280 regs.x.ax = 0xad80; |
1279 int86 (0x2f, ®s, ®s); | 1281 _go32_dpmi_simulate_int (0x2f, ®s); |
1280 if (regs.h.al == 0xff) | 1282 if (regs.h.al == 0xff) |
1281 international_keyboard = 1; | 1283 international_keyboard = 1; |
1282 | 1284 |
1283 /* Initialize to US settings, for countries that don't have their own. */ | 1285 /* Initialize to US settings, for countries that don't have their own. */ |
1284 keyboard = keyboard_layout_list[0].keyboard_map; | 1286 keyboard = keyboard_layout_list[0].keyboard_map; |
3419 ((long)(time).tv_sec < 0 \ | 3421 ((long)(time).tv_sec < 0 \ |
3420 || ((time).tv_sec == 0 \ | 3422 || ((time).tv_sec == 0 \ |
3421 && (long)(time).tv_usec <= 0)) | 3423 && (long)(time).tv_usec <= 0)) |
3422 #endif | 3424 #endif |
3423 | 3425 |
3426 /* This yields the rest of the current time slice to the task manager. | |
3427 It should be called by any code which knows that it has nothing | |
3428 useful to do except idle. | |
3429 | |
3430 I don't use __dpmi_yield here, since versions of library before 2.02 | |
3431 called Int 2Fh/AX=1680h there in a way that would wedge the DOS box | |
3432 on some versions of Windows 9X. */ | |
3433 | |
3434 void | |
3435 dos_yield_time_slice (void) | |
3436 { | |
3437 _go32_dpmi_registers r; | |
3438 | |
3439 r.x.ax = 0x1680; | |
3440 r.x.ss = r.x.sp = r.x.flags = 0; | |
3441 _go32_dpmi_simulate_int (0x2f, &r); | |
3442 if (r.h.al == 0x80) | |
3443 errno = ENOSYS; | |
3444 } | |
3424 | 3445 |
3425 /* Only event queue is checked. */ | 3446 /* Only event queue is checked. */ |
3426 /* We don't have to call timer_check here | 3447 /* We don't have to call timer_check here |
3427 because wait_reading_process_input takes care of that. */ | 3448 because wait_reading_process_input takes care of that. */ |
3428 int | 3449 int |
3452 just read it and wait -- that's more efficient. */ | 3473 just read it and wait -- that's more efficient. */ |
3453 if (!timeout) | 3474 if (!timeout) |
3454 { | 3475 { |
3455 while (!detect_input_pending ()) | 3476 while (!detect_input_pending ()) |
3456 { | 3477 { |
3457 #if __DJGPP__ >= 2 | 3478 dos_yield_time_slice (); |
3458 __dpmi_yield (); | |
3459 #endif | |
3460 } | 3479 } |
3461 } | 3480 } |
3462 else | 3481 else |
3463 { | 3482 { |
3464 EMACS_TIME clnow, cllast, cldiff; | 3483 EMACS_TIME clnow, cllast, cldiff; |
3480 | 3499 |
3481 /* Stop when timeout value crosses zero. */ | 3500 /* Stop when timeout value crosses zero. */ |
3482 if (EMACS_TIME_ZERO_OR_NEG_P (*timeout)) | 3501 if (EMACS_TIME_ZERO_OR_NEG_P (*timeout)) |
3483 return 0; | 3502 return 0; |
3484 cllast = clnow; | 3503 cllast = clnow; |
3485 #if __DJGPP__ >= 2 | 3504 dos_yield_time_slice (); |
3486 __dpmi_yield (); | |
3487 #endif | |
3488 } | 3505 } |
3489 } | 3506 } |
3490 | 3507 |
3491 FD_SET (0, rfds); | 3508 FD_SET (0, rfds); |
3492 return 1; | 3509 return 1; |