Add 2012 to FSF copyright years for Emacs files (do not merge to trunk)
[bpt/emacs.git] / src / nsselect.m
index 88f8b26..abbce03 100644 (file)
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep / MacOSX Cocoa selection processing for emacs.
-   Copyright (C) 1993, 1994, 2005, 2006, 2008
+   Copyright (C) 1993, 1994, 2005, 2006, 2008, 2009, 2010, 2011, 2012
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -25,7 +25,11 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net)
 GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
+#include <setjmp.h>
+
 #include "lisp.h"
 #include "nsterm.h"
 #include "termhooks.h"
@@ -39,7 +43,6 @@ static Lisp_Object Vns_lost_selection_hooks;
 static Lisp_Object Vselection_alist;
 static Lisp_Object Vselection_converter_alist;
 
-/* 23: new */
 static Lisp_Object Qforeign_selection;
 
 NSString *NXSecondaryPboard;
@@ -60,7 +63,7 @@ symbol_to_nsstring (Lisp_Object sym)
   if (EQ (sym, QPRIMARY))     return NSGeneralPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
   if (EQ (sym, QTEXT))        return NSStringPboardType;
-  return [NSString stringWithUTF8String: XSTRING (XSYMBOL (sym)->xname)->data];
+  return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)];
 }
 
 
@@ -111,7 +114,7 @@ clean_local_selection_data (Lisp_Object obj)
         return clean_local_selection_data (AREF (obj, 0));
       copy = Fmake_vector (make_number (size), Qnil);
       for (i = 0; i < size; i++)
-        AREF (copy, i) = clean_local_selection_data (AREF (obj, i));
+        ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
       return copy;
     }
 
@@ -148,7 +151,7 @@ ns_string_to_pasteboard_internal (id pb, Lisp_Object str, NSString *gtype)
 
       CHECK_STRING (str);
 
-      utfStr = XSTRING (str)->data;
+      utfStr = SDATA (str);
       nsStr = [NSString stringWithUTF8String: utfStr];
 
       if (gtype == nil)
@@ -369,8 +372,8 @@ ns_string_to_pasteboard (id pb, Lisp_Object str)
    ========================================================================== */
 
 
-DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
-       Sns_own_selection_internal, 2, 2, 0,
+DEFUN ("x-own-selection-internal", Fx_own_selection_internal,
+       Sx_own_selection_internal, 2, 2, 0,
        doc: /* Assert a selection.
 SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
 VALUE is typically a string, or a cons of two markers, but may be
@@ -424,7 +427,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
 }
 
 
-DEFUN ("ns-selection-exists-p", Fns_selection_exists_p, Sns_selection_exists_p,
+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 selection.
 The arg should be the name of the selection in question, typically one of
 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
@@ -447,7 +450,7 @@ and t is the same as `SECONDARY'.)  */)
 }
 
 
-DEFUN ("ns-selection-owner-p", Fns_selection_owner_p, Sns_selection_owner_p,
+DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
        0, 1, 0,
        doc: /* Whether the current Emacs process owns the given selection.
 The arg should be the name of the selection in question, typically one of
@@ -554,9 +557,9 @@ syms_of_nsselect (void)
 
   defsubr (&Sx_disown_selection_internal);
   defsubr (&Sx_get_selection_internal);
-  defsubr (&Sns_own_selection_internal);
-  defsubr (&Sns_selection_exists_p);
-  defsubr (&Sns_selection_owner_p);
+  defsubr (&Sx_own_selection_internal);
+  defsubr (&Sx_selection_exists_p);
+  defsubr (&Sx_selection_owner_p);
 #ifdef CUT_BUFFER_SUPPORT
   defsubr (&Sns_get_cut_buffer_internal);
   defsubr (&Sns_rotate_cut_buffers_internal);
@@ -603,11 +606,8 @@ The functions are called with one argument, the selection type\n\
 \(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD').");
   Vns_lost_selection_hooks = Qnil;
 
-/* 23: { */
   Qforeign_selection = intern ("foreign-selection");
   staticpro (&Qforeign_selection);
-/* } */
-
 }
 
 // arch-tag: 39d1dde7-06a6-49ff-95a7-0e7af12d2218