/* 16-bit Windows Selection processing for emacs on MS-Windows
-Copyright (C) 1996-1997, 2001-2011 Free Software Foundation, Inc.
+Copyright (C) 1996-1997, 2001-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h" /* frame.h seems to want this */
#include "frame.h" /* Need this to get the X window of selected_frame */
#include "blockinput.h"
-#include "buffer.h"
#include "character.h"
+#include "buffer.h"
#include "coding.h"
#include "composite.h"
<> 1700H: AL = Major version number
AH = Minor version number */
regs.x.ax = 0x1700;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return regs.x.ax;
}
-/* Open the clipboard, return non-zero if successfull. */
+/* Open the clipboard, return non-zero if successful. */
unsigned
open_clipboard (void)
{
Return Values AX == 0: Clipboard already open
<> 0: Clipboard opened */
regs.x.ax = 0x1701;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return regs.x.ax;
}
-/* Empty clipboard, return non-zero if successfull. */
+/* Empty clipboard, return non-zero if successful. */
unsigned
empty_clipboard (void)
{
Return Values AX == 0: Error occurred
<> 0: OK, Clipboard emptied */
regs.x.ax = 0x1702;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return regs.x.ax;
}
}
}
-/* Copy data into the clipboard, return zero if successfull. */
+/* Copy data into the clipboard, return zero if successful. */
unsigned
set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
{
regs.x.cx = truelen & 0xffff;
regs.x.es = xbuf_addr >> 4;
regs.x.bx = xbuf_addr & 15;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
free_xfer_buf ();
the clipboard. */
regs.x.ax = 0x1704;
regs.x.dx = Format;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return ( (((unsigned)regs.x.dx) << 16) | regs.x.ax);
}
regs.x.dx = Format;
regs.x.es = xbuf_addr >> 4;
regs.x.bx = xbuf_addr & 15;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
if (regs.x.ax != 0)
{
unsigned char null_char = '\0';
return (unsigned) (dp - (unsigned char *)Data - 1);
}
-/* Close clipboard, return non-zero if successfull. */
+/* Close clipboard, return non-zero if successful. */
unsigned
close_clipboard (void)
{
Return Values AX == 0: Error occurred
<> 0: OK */
regs.x.ax = 0x1708;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return regs.x.ax;
}
regs.x.ax = 0x1709;
regs.x.si = Size >> 16;
regs.x.cx = Size & 0xffff;
- __dpmi_int(0x2f, ®s);
+ __dpmi_int (0x2f, ®s);
return ((unsigned)regs.x.dx << 16) | regs.x.ax;
}
\f
if ( !FRAME_MSDOS_P (XFRAME (frame)))
goto done;
- BLOCK_INPUT;
+ block_input ();
if (!open_clipboard ())
goto error;
setup_coding_system (Fcheck_coding_system (coding_system), &coding);
coding.dst_bytes = nbytes * 4;
- coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
+ coding.destination = xmalloc (coding.dst_bytes);
Vnext_selection_coding_system = Qnil;
coding.mode |= CODING_MODE_LAST_BLOCK;
dst = coding.destination;
unblock:
xfree (dst);
- UNBLOCK_INPUT;
+ unblock_input ();
/* Notify user if the text is too large to fit into DOS memory.
(This will happen somewhere after 600K bytes (470K in DJGPP v1.x),
switch (put_status)
{
case 1:
- message2 (no_mem_msg, sizeof (no_mem_msg) - 1, 0);
+ message3 (make_unibyte_string (no_mem_msg, sizeof (no_mem_msg) - 1));
break;
case 2:
- message2 (binary_msg, sizeof (binary_msg) - 1, 0);
+ message3 (make_unibyte_string (binary_msg, sizeof (binary_msg) - 1));
break;
case 3:
- message2 (system_error_msg, sizeof (system_error_msg) - 1, 0);
+ message3 (make_unibyte_string (system_error_msg, sizeof (system_error_msg) - 1));
break;
}
sit_for (make_number (2), 0, 2);
if ( !FRAME_MSDOS_P (XFRAME (frame)))
goto done;
- BLOCK_INPUT;
+ block_input ();
if (!open_clipboard ())
goto unblock;
if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 ||
- (htext = (unsigned char *)xmalloc (data_size)) == 0)
+ (htext = xmalloc (data_size)) == 0)
goto closeclip;
/* need to know final size after '\r' chars are removed because
close_clipboard ();
unblock:
- UNBLOCK_INPUT;
+ unblock_input ();
done:
/* Support checking for a clipboard selection. */
DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
- 0, 1, 0,
- doc: /* Whether there is an owner for the given X Selection.
-The arg should be the name of the selection in question, typically one of
-the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
-\(Those are literal upper-case symbol names, since that's what X expects.)
-For convenience, the symbol nil is the same as `PRIMARY',
-and t is the same as `SECONDARY'. */)
- (Lisp_Object selection)
+ 0, 2, 0,
+ doc: /* Whether there is an owner for the given X selection.
+SELECTION should be the name of the selection in question, typically
+one of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. (X expects
+these literal upper-case names.) The symbol nil is the same as
+`PRIMARY', and t is the same as `SECONDARY'.
+
+TERMINAL should be a terminal object or a frame specifying the X
+server to query. If omitted or nil, that stands for the selected
+frame's display, or the first available X display. */)
+ (Lisp_Object selection, Lisp_Object terminal)
{
CHECK_SYMBOL (selection);
}
#endif /* MSDOS */
-