]> code.delx.au - gnu-emacs/blobdiff - src/w16select.c
Whitespace changes.
[gnu-emacs] / src / w16select.c
index ef1b974752bb9859e0aecd59bd8f2258275d1ab7..cae7a6f82dd53be64d6b3617a7663b844b5e03e4 100644 (file)
@@ -1,6 +1,6 @@
 /* 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-2011  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,7 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef MSDOS
 
 #include <config.h>
-#include <string.h>
 #include <dpmi.h>
 #include <go32.h>
 #include <sys/farptr.h>
@@ -69,13 +68,6 @@ unsigned clipboard_compact (unsigned);
 
 Lisp_Object QCLIPBOARD, QPRIMARY;
 
-/* Coding system for communicating with other Windows programs via the
-   clipboard.  */
-static Lisp_Object Vselection_coding_system;
-
-/* Coding system for the next communicating with other Windows programs.  */
-static Lisp_Object Vnext_selection_coding_system;
-
 /* The segment address and the size of the buffer in low
    memory used to move data between us and WinOldAp module.  */
 static struct {
@@ -118,7 +110,7 @@ identify_winoldap_version (void)
                         <> 1700H: AL = Major version number
                                  AH = Minor version number */
   regs.x.ax = 0x1700;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return regs.x.ax;
 }
 
@@ -141,7 +133,7 @@ open_clipboard (void)
      Return Values   AX == 0: Clipboard already open
                        <> 0: Clipboard opened */
   regs.x.ax = 0x1701;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return regs.x.ax;
 }
 
@@ -155,7 +147,7 @@ empty_clipboard (void)
      Return Values   AX == 0: Error occurred
                        <> 0: OK, Clipboard emptied */
   regs.x.ax = 0x1702;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return regs.x.ax;
 }
 
@@ -302,7 +294,7 @@ 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, &regs);
+  __dpmi_int (0x2f, &regs);
 
   free_xfer_buf ();
 
@@ -328,7 +320,7 @@ get_clipboard_data_size (unsigned Format)
                           the clipboard.  */
   regs.x.ax = 0x1704;
   regs.x.dx = Format;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return ( (((unsigned)regs.x.dx) << 16) | regs.x.ax);
 }
 
@@ -361,7 +353,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned Size, int Raw)
   regs.x.dx = Format;
   regs.x.es = xbuf_addr >> 4;
   regs.x.bx = xbuf_addr & 15;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   if (regs.x.ax != 0)
     {
       unsigned char null_char = '\0';
@@ -423,7 +415,7 @@ close_clipboard (void)
      Return Values   AX == 0: Error occurred
                         <> 0: OK */
   regs.x.ax = 0x1708;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return regs.x.ax;
 }
 
@@ -440,7 +432,7 @@ clipboard_compact (unsigned Size)
   regs.x.ax = 0x1709;
   regs.x.si = Size >> 16;
   regs.x.cx = Size & 0xffff;
-  __dpmi_int(0x2f, &regs);
+  __dpmi_int (0x2f, &regs);
   return ((unsigned)regs.x.dx << 16) | regs.x.ax;
 }
 \f
@@ -693,19 +685,44 @@ syms_of_win16select (void)
   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'.  */);
+  DEFVAR_LISP ("selection-coding-system", Vselection_coding_system,
+              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.
+  DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system,
+              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);
@@ -714,5 +731,3 @@ set to nil.  */);
 
 #endif /* MSDOS */
 
-/* arch-tag: 085a22c8-7324-436e-a6da-102464ce95d8
-   (do not change this comment) */