]> code.delx.au - gnu-emacs/blobdiff - src/w16select.c
Merge changes from emacs-23 branch.
[gnu-emacs] / src / w16select.c
index 9498d7adfe8d40743ba0b8040a28b8a9f1a54301..ef1b974752bb9859e0aecd59bd8f2258275d1ab7 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 Free Software Foundation, Inc.
+                 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -23,7 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    menus, and the Windows clipboard.  */
 
 /* Written by Dale P. Smith <dpsm@en.com>  */
-/* Adapted to DJGPP v1 by Eli Zaretskii <eliz@is.elta.co.il>  */
+/* Adapted to DJGPP by Eli Zaretskii <eliz@gnu.org>  */
 
 #ifdef MSDOS
 
@@ -32,6 +32,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #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 */
@@ -93,25 +94,6 @@ static unsigned char *last_clipboard_text;
 /* The size of allocated storage for storing the clipboard data.  */
 static size_t clipboard_storage_size;
 \f
-/* Emulation of `__dpmi_int' and friends for DJGPP v1.x  */
-
-#if __DJGPP__ < 2
-
-typedef _go32_dpmi_registers __dpmi_regs;
-#define __tb      _go32_info_block.linear_address_of_transfer_buffer
-#define _dos_ds          _go32_info_block.selector_for_linear_memory
-
-static int
-__dpmi_int (intno, regs)
-     int intno;
-     __dpmi_regs *regs;
-{
-  regs->x.ss = regs->x.sp = regs->x.flags = 0;
-  return _go32_dpmi_simulate_int (intno, regs);
-}
-
-#endif /* __DJGPP__ < 2 */
-\f
 /* C functions to access the Windows 3.1x clipboard from DOS apps.
 
    The information was obtained from the Microsoft Knowledge Base,
@@ -127,7 +109,7 @@ __dpmi_int (intno, regs)
 
 /* Return the WinOldAp support version, or 0x1700 if not supported.  */
 unsigned
-identify_winoldap_version ()
+identify_winoldap_version (void)
 {
   __dpmi_regs regs;
 
@@ -142,7 +124,7 @@ identify_winoldap_version ()
 
 /* Open the clipboard, return non-zero if successfull.  */
 unsigned
-open_clipboard ()
+open_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -165,7 +147,7 @@ open_clipboard ()
 
 /* Empty clipboard, return non-zero if successfull.  */
 unsigned
-empty_clipboard ()
+empty_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -180,8 +162,7 @@ empty_clipboard ()
 /* 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;
 
@@ -218,7 +199,7 @@ alloc_xfer_buf (want_size)
    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)
@@ -236,11 +217,7 @@ free_xfer_buf ()
 
 /* 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;
@@ -339,8 +316,7 @@ set_clipboard_data (Format, Data, Size, Raw)
 
 /* 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;
 
@@ -360,11 +336,7 @@ get_clipboard_data_size (Format)
    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;
@@ -443,7 +415,7 @@ get_clipboard_data (Format, Data, Size, Raw)
 
 /* Close clipboard, return non-zero if successfull.  */
 unsigned
-close_clipboard ()
+close_clipboard (void)
 {
   __dpmi_regs regs;
 
@@ -457,8 +429,7 @@ close_clipboard ()
 
 /* Compact clipboard data so that at least SIZE bytes is available.  */
 unsigned
-clipboard_compact (Size)
-     unsigned Size;
+clipboard_compact (unsigned Size)
 {
   __dpmi_regs regs;
 
@@ -482,11 +453,10 @@ static char system_error_msg[] =
 
 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);
@@ -524,9 +494,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
     {
       /* 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;
@@ -592,13 +560,12 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
 
 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 ();
@@ -639,8 +606,6 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
   }
   if (require_decoding)
     {
-      int bufsize;
-      unsigned char *buf;
       struct coding_system coding;
       Lisp_Object coding_system = Vnext_selection_coding_system;
 
@@ -687,8 +652,7 @@ 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'.  */)
-     (selection)
-     Lisp_Object selection;
+  (Lisp_Object selection)
 {
   CHECK_SYMBOL (selection);
 
@@ -703,8 +667,8 @@ and t is the same as `SECONDARY'.  */)
      into the clipboard if we run under Windows, so we cannot check
      the clipboard alone.)  */
   if ((EQ (selection, Qnil) || EQ (selection, QPRIMARY))
-      && ! NILP (SYMBOL_VALUE (Fintern_soft (build_string ("kill-ring"),
-                                            Qnil))))
+      && ! NILP (Fsymbol_value (Fintern_soft (build_string ("kill-ring"),
+                                             Qnil))))
     return Qt;
 
   if (EQ (selection, QCLIPBOARD))
@@ -723,7 +687,7 @@ and t is the same as `SECONDARY'.  */)
 }
 
 void
-syms_of_win16select ()
+syms_of_win16select (void)
 {
   defsubr (&Sw16_set_clipboard_data);
   defsubr (&Sw16_get_clipboard_data);