/* 16-bit Windows Selection processing for emacs on MS-Windows
- Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+ 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#ifdef MSDOS
#include <config.h>
-#include <string.h>
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
/* Return the WinOldAp support version, or 0x1700 if not supported. */
unsigned
-identify_winoldap_version ()
+identify_winoldap_version (void)
{
__dpmi_regs regs;
/* Open the clipboard, return non-zero if successfull. */
unsigned
-open_clipboard ()
+open_clipboard (void)
{
__dpmi_regs regs;
/* Empty clipboard, return non-zero if successfull. */
unsigned
-empty_clipboard ()
+empty_clipboard (void)
{
__dpmi_regs regs;
/* Ensure we have a buffer in low memory with enough memory for data
of size WANT_SIZE. Return the linear address of the buffer. */
static unsigned long
-alloc_xfer_buf (want_size)
- unsigned want_size;
+alloc_xfer_buf (unsigned want_size)
{
__dpmi_regs regs;
The clipboard buffer tends to be large in size, because for small
clipboard data sizes we use the DJGPP transfer buffer. */
static void
-free_xfer_buf ()
+free_xfer_buf (void)
{
/* If the size is 0, we used DJGPP transfer buffer, so don't free. */
if (clipboard_xfer_buf_info.size)
/* Copy data into the clipboard, return zero if successfull. */
unsigned
-set_clipboard_data (Format, Data, Size, Raw)
- unsigned Format;
- void *Data;
- unsigned Size;
- int Raw;
+set_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
{
__dpmi_regs regs;
unsigned truelen;
/* Return the size of the clipboard data of format FORMAT. */
unsigned
-get_clipboard_data_size (Format)
- unsigned Format;
+get_clipboard_data_size (unsigned Format)
{
__dpmi_regs regs;
Warning: this doesn't check whether DATA has enough space to hold
SIZE bytes. */
unsigned
-get_clipboard_data (Format, Data, Size, Raw)
- unsigned Format;
- void *Data;
- unsigned Size;
- int Raw;
+get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
{
__dpmi_regs regs;
unsigned long xbuf_addr;
/* Close clipboard, return non-zero if successfull. */
unsigned
-close_clipboard ()
+close_clipboard (void)
{
__dpmi_regs regs;
/* Compact clipboard data so that at least SIZE bytes is available. */
unsigned
-clipboard_compact (Size)
- unsigned Size;
+clipboard_compact (unsigned Size)
{
__dpmi_regs regs;
DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_data, 1, 2, 0,
doc: /* This sets the clipboard data to the given text. */)
- (string, frame)
- Lisp_Object string, frame;
+ (Lisp_Object string, Lisp_Object frame)
{
unsigned ok = 1, put_status = 0;
- int nbytes, charset_info, no_crlf_conversion;
+ int nbytes, no_crlf_conversion;
unsigned char *src, *dst = NULL;
CHECK_STRING (string);
{
/* We must encode contents of STRING according to what
clipboard-coding-system specifies. */
- int bufsize;
struct coding_system coding;
- unsigned char *htext2;
Lisp_Object coding_system =
NILP (Vnext_selection_coding_system) ?
Vselection_coding_system : Vnext_selection_coding_system;
DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_data, 0, 1, 0,
doc: /* This gets the clipboard data in text format. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
unsigned data_size, truelen;
unsigned char *htext = NULL;
Lisp_Object ret = Qnil;
- int no_crlf_conversion, require_decoding = 0;
+ int require_decoding = 0;
if (NILP (frame))
frame = Fselected_frame ();
}
if (require_decoding)
{
- int bufsize;
- unsigned char *buf;
struct coding_system coding;
Lisp_Object coding_system = Vnext_selection_coding_system;
\(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'. */)
- (selection)
- Lisp_Object selection;
+ (Lisp_Object selection)
{
CHECK_SYMBOL (selection);
}
void
-syms_of_win16select ()
+syms_of_win16select (void)
{
defsubr (&Sw16_set_clipboard_data);
defsubr (&Sw16_get_clipboard_data);
defsubr (&Sx_selection_exists_p);
DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
- doc: /* Coding system for communicating with other X clients.
-When sending or receiving text via cut_buffer, selection, and clipboard,
-the text is encoded or decoded by this coding system.
-The default value is `iso-latin-1-dos'. */);
+ doc: /* Coding system for communicating with other programs.
+
+For MS-Windows and MS-DOS:
+When sending or receiving text via selection and clipboard, the text
+is encoded or decoded by this coding system. The default value is
+the current system default encoding on 9x/Me, `utf-16le-dos'
+\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
+
+For X Windows:
+When sending text via selection and clipboard, if the target
+data-type matches with the type of this coding system, it is used
+for encoding the text. Otherwise (including the case that this
+variable is nil), a proper coding system is used as below:
+
+data-type coding system
+--------- -------------
+UTF8_STRING utf-8
+COMPOUND_TEXT compound-text-with-extensions
+STRING iso-latin-1
+C_STRING no-conversion
+
+When receiving text, if this coding system is non-nil, it is used
+for decoding regardless of the data-type. If this is nil, a
+proper coding system is used according to the data-type as above.
+
+See also the documentation of the variable `x-select-request-type' how
+to control which data-type to request for receiving text.
+
+The default value is nil. */);
Vselection_coding_system = intern ("iso-latin-1-dos");
DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
- doc: /* Coding system for the next communication with other X clients.
+ doc: /* Coding system for the next communication with other programs.
Usually, `selection-coding-system' is used for communicating with
-other X clients. But, if this variable is set, it is used for the
-next communication only. After the communication, this variable is
-set to nil. */);
+other programs (X Windows clients or MS Windows programs). But, if this
+variable is set, it is used for the next communication only.
+After the communication, this variable is set to nil. */);
Vnext_selection_coding_system = Qnil;
QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY);
#endif /* MSDOS */
-/* arch-tag: 085a22c8-7324-436e-a6da-102464ce95d8
- (do not change this comment) */