]> code.delx.au - gnu-emacs/blobdiff - src/w32select.c
(syms_of_lread) <load-history>: Doc fix.
[gnu-emacs] / src / w32select.c
index 4f1ca582daf60f952c08979f5a3a11af46c5638e..77f2aea6df79c65fd2ead10c0f30e5f20e89b01e 100644 (file)
@@ -1,6 +1,6 @@
 /* Selection processing for Emacs on the Microsoft W32 API.
    Copyright (C) 1993, 1994 Free Software Foundation.
-   
+
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
@@ -30,6 +30,7 @@ Boston, MA 02111-1307, USA.  */
 #include "buffer.h"
 #include "charset.h"
 #include "coding.h"
+#include "composite.h"
 
 Lisp_Object QCLIPBOARD;
 
@@ -56,16 +57,16 @@ DEFUN ("w32-open-clipboard", Fw32_open_clipboard, Sw32_open_clipboard, 0, 1, 0,
      Lisp_Object frame;
 {
   BOOL ok = FALSE;
-  
+
   if (!NILP (frame))
     CHECK_LIVE_FRAME (frame);
-  
+
   BLOCK_INPUT;
-  
+
   ok = OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL);
-  
+
   UNBLOCK_INPUT;
-  
+
   return (ok ? frame : Qnil);
 }
 
@@ -76,13 +77,13 @@ Assigns ownership of the clipboard to the window which opened it.  */)
      ()
 {
   BOOL ok = FALSE;
-  
+
   BLOCK_INPUT;
-  
+
   ok = EmptyClipboard ();
-  
+
   UNBLOCK_INPUT;
-  
+
   return (ok ? Qt : Qnil);
 }
 
@@ -92,13 +93,13 @@ DEFUN ("w32-close-clipboard", Fw32_close_clipboard,
      ()
 {
   BOOL ok = FALSE;
-  
+
   BLOCK_INPUT;
-  
+
   ok = CloseClipboard ();
-  
+
   UNBLOCK_INPUT;
-  
+
   return (ok ? Qt : Qnil);
 }
 
@@ -118,14 +119,14 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
   unsigned char *dst;
 
   CHECK_STRING (string);
-  
+
   if (!NILP (frame))
     CHECK_LIVE_FRAME (frame);
-  
+
   BLOCK_INPUT;
 
-  nbytes = STRING_BYTES (XSTRING (string)) + 1;
-  src = XSTRING (string)->data;
+  nbytes = SBYTES (string) + 1;
+  src = SDATA (string);
   dst = src;
 
   /* We need to know how many lines there are, since we need CRLF line
@@ -140,7 +141,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
   {
     /* Since we are now handling multilingual text, we must consider
        encoding text for the clipboard.  */
-    int charset_info = find_charset_in_text (src, XSTRING (string)->size,
+    int charset_info = find_charset_in_text (src, SCHARS (string),
                                             nbytes, NULL, Qnil);
 
     if (charset_info == 0)
@@ -158,7 +159,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
 
        if ((dst = (unsigned char *) GlobalLock (htext)) == NULL)
          goto error;
-    
+
        /* convert to CRLF line endings expected by clipboard */
        while (1)
          {
@@ -175,12 +176,12 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
                next[-1] = '\r';
                next[0] = '\n';
                dst = next + 1;
-             }     
+             }
            else
              /* copied remaining partial line -> now finished */
              break;
          }
-    
+
        GlobalUnlock (htext);
 
        Vlast_coding_system_used = Qraw_text;
@@ -201,8 +202,8 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
            && !NILP (Ffboundp (coding.pre_write_conversion)))
          {
            string = run_pre_post_conversion_on_str (string, &coding, 1);
-           src = XSTRING (string)->data;
-           nbytes = STRING_BYTES (XSTRING (string));
+           src = SDATA (string);
+           nbytes = SBYTES (string);
          }
        coding.src_multibyte = 1;
        coding.dst_multibyte = 0;
@@ -236,18 +237,18 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
        if (htext2 != NULL) htext = htext2;
       }
   }
-  
+
   if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
     goto error;
 
   ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
-  
+
   CloseClipboard ();
-  
+
   if (ok) goto done;
 
  error:
-  
+
   ok = FALSE;
   if (htext) GlobalFree (htext);
   if (last_clipboard_text)
@@ -255,7 +256,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
 
  done:
   UNBLOCK_INPUT;
-  
+
   return (ok ? string : Qnil);
 }
 
@@ -267,15 +268,15 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
 {
   HANDLE htext;
   Lisp_Object ret = Qnil;
-  
+
   if (!NILP (frame))
     CHECK_LIVE_FRAME (frame);
-  
+
   BLOCK_INPUT;
-  
+
   if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
     goto done;
-  
+
   if ((htext = GetClipboardData (CF_TEXT)) == NULL)
     goto closeclip;
 
@@ -285,10 +286,10 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
     int nbytes;
     int truelen;
     int require_decoding = 0;
-    
+
     if ((src = (unsigned char *) GlobalLock (htext)) == NULL)
       goto closeclip;
-    
+
     nbytes = strlen (src);
 
     /* If the text in clipboard is identical to what we put there
@@ -367,7 +368,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
        /* Convert CRLF line endings (the standard CF_TEXT clipboard
           format) to LF endings as used internally by Emacs.  */
 
-       dst = XSTRING (ret)->data;
+       dst = SDATA (ret);
        while (1)
          {
            unsigned char *next;
@@ -396,10 +397,10 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
 
  closeclip:
   CloseClipboard ();
-  
+
  done:
   UNBLOCK_INPUT;
-  
+
   return (ret);
 }
 
@@ -441,7 +442,7 @@ and t is the same as `SECONDARY'.  */)
   return Qnil;
 }
 
-void 
+void
 syms_of_w32select ()
 {
 #if 0
@@ -456,14 +457,15 @@ syms_of_w32select ()
   DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
               doc: /* Coding system for communicating with other programs.
 When sending or receiving text via cut_buffer, selection, and clipboard,
-the text is encoded or decoded by this coding system.  */);
-  Vselection_coding_system=intern ("iso-latin-1-dos");
+the text is encoded or decoded by this coding system.
+The default value is `iso-latin-1-dos'.  */);
+  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 programs.
 Usually, `selection-coding-system' is used for communicating with
-other programs.   But, if this variable is set, it is used for the
-next communication only.   After the communication, this variable is
+other 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;