Mercurial > emacs
comparison src/w16select.c @ 21709:64adf1f4d54d
(alloc_xfer_buf): If want_size is more than 1MB,
return immediately with failure.
(Fw16_set_clipboard_data, Fw16_get_clipboard_data): Replace win16
with w16.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 22 Apr 1998 13:39:59 +0000 |
parents | 7b76832ac019 |
children | 3537e1563a66 |
comparison
equal
deleted
inserted
replaced
21708:280e4b4cbd2a | 21709:64adf1f4d54d |
---|---|
1 /* Win16 Selection processing for emacs on MS-Windows | 1 /* 16-bit Windows Selection processing for emacs on MS-Windows |
2 Copyright (C) 1996, 1997 Free Software Foundation. | 2 Copyright (C) 1996, 1997 Free Software Foundation. |
3 | 3 |
4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
5 | 5 |
6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
166 __dpmi_regs regs; | 166 __dpmi_regs regs; |
167 | 167 |
168 /* If the usual DJGPP transfer buffer is large enough, use that. */ | 168 /* If the usual DJGPP transfer buffer is large enough, use that. */ |
169 if (want_size <= _go32_info_block.size_of_transfer_buffer) | 169 if (want_size <= _go32_info_block.size_of_transfer_buffer) |
170 return __tb & 0xfffff; | 170 return __tb & 0xfffff; |
171 | |
172 /* Don't even try to allocate more than 1MB of memory: DOS cannot | |
173 possibly handle that (it will overflow the BX register below). */ | |
174 if (want_size > 0xfffff) | |
175 return 0; | |
171 | 176 |
172 /* Need size rounded up to the nearest paragraph, and in | 177 /* Need size rounded up to the nearest paragraph, and in |
173 paragraph units (1 paragraph = 16 bytes). */ | 178 paragraph units (1 paragraph = 16 bytes). */ |
174 clipboard_xfer_buf_info.size = (want_size + 15) >> 4; | 179 clipboard_xfer_buf_info.size = (want_size + 15) >> 4; |
175 | 180 |
387 } | 392 } |
388 | 393 |
389 static char no_mem_msg[] = | 394 static char no_mem_msg[] = |
390 "(Not enough DOS memory to put saved text into clipboard.)"; | 395 "(Not enough DOS memory to put saved text into clipboard.)"; |
391 | 396 |
392 DEFUN ("win16-set-clipboard-data", Fwin16_set_clipboard_data, Swin16_set_clipboard_data, 1, 2, 0, | 397 DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0, |
393 "This sets the clipboard data to the given text.") | 398 "This sets the clipboard data to the given text.") |
394 (string, frame) | 399 (string, frame) |
395 Lisp_Object string, frame; | 400 Lisp_Object string, frame; |
396 { | 401 { |
397 int ok = 1, ok1 = 1; | 402 int ok = 1, ok1 = 1; |
442 done: | 447 done: |
443 | 448 |
444 return (ok ? string : Qnil); | 449 return (ok ? string : Qnil); |
445 } | 450 } |
446 | 451 |
447 DEFUN ("win16-get-clipboard-data", Fwin16_get_clipboard_data, Swin16_get_clipboard_data, 0, 1, 0, | 452 DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0, |
448 "This gets the clipboard data in text format.") | 453 "This gets the clipboard data in text format.") |
449 (frame) | 454 (frame) |
450 Lisp_Object frame; | 455 Lisp_Object frame; |
451 { | 456 { |
452 unsigned data_size, truelen; | 457 unsigned data_size, truelen; |
538 } | 543 } |
539 | 544 |
540 void | 545 void |
541 syms_of_win16select () | 546 syms_of_win16select () |
542 { | 547 { |
543 defsubr (&Swin16_set_clipboard_data); | 548 defsubr (&Sw16_set_clipboard_data); |
544 defsubr (&Swin16_get_clipboard_data); | 549 defsubr (&Sw16_get_clipboard_data); |
545 defsubr (&Sx_selection_exists_p); | 550 defsubr (&Sx_selection_exists_p); |
546 | 551 |
547 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); | 552 QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); |
548 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); | 553 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); |
549 } | 554 } |