]> gcc.gnu.org Git - gcc.git/blobdiff - libobjc/selector.c
archive.c: Do not include objc/objc.h.
[gcc.git] / libobjc / selector.c
index 223c7100efa56dcddba58ffda8e79f3cd53602f5..1d4bc7e69d73275f50ebffde80ba3803ef880181 100644 (file)
@@ -1,30 +1,34 @@
 /* GNU Objective C Runtime selector related functions
-   Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004, 2009 Free Software Foundation, Inc.
    Contributed by Kresten Krab Thorup
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under the
 terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2, or (at your option) any later version.
+Foundation; either version 3, or (at your option) any later version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 details.
 
-You should have received a copy of the GNU General Public License along with
-GCC; see the file COPYING.  If not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* As a special exception, if you link this library with files compiled with
-   GCC to produce an executable, this does not cause the resulting executable
-   to be covered by the GNU General Public License. This exception does not
-   however invalidate any other reasons why the executable file might be
-   covered by the GNU General Public License.  */
-
-#include "objc/runtime.h"
-#include "objc/sarray.h"
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#include "objc-private/common.h"
+#include "objc/objc-api.h"
+#include "objc/thr.h"
+#include "objc-private/hash.h"
+#include "objc-private/objc-list.h" 
+#include "objc-private/runtime.h"
+#include "objc-private/sarray.h"
 #include "objc/encoding.h"
 
 /* Initial selector hash table size. Value doesn't matter much */
@@ -158,6 +162,14 @@ void __objc_register_instance_methods_to_class (Class class)
     __objc_update_dispatch_table_for_class (class->class_pointer);
 }
 
+BOOL
+sel_isEqual (SEL s1, SEL s2)
+{
+  if (s1 == 0 || s2 == 0)
+    return s1 == s2;
+  else
+    return s1->sel_id == s2->sel_id;
+}
 
 /* Returns YES iff t1 and t2 have same method types, but we ignore
    the argframe layout */
@@ -282,19 +294,15 @@ sel_get_any_uid (const char *name)
   return (SEL) l->head;
 }
 
-/* return selector representing name */
-SEL
-sel_get_uid (const char *name)
-{
-  return sel_register_typed_name (name, 0);
-}
-
 /* Get name of selector.  If selector is unknown, the empty string "" 
    is returned */ 
-const char *sel_get_name (SEL selector)
+const char *sel_getName (SEL selector)
 {
   const char *ret;
 
+  if (selector == NULL)
+    return "<null selector>";
+
   objc_mutex_lock (__objc_runtime_mutex);
   if ((soffset_decode ((sidx)selector->sel_id) > 0)
       && (soffset_decode ((sidx)selector->sel_id) <= __objc_selector_max_index))
@@ -305,6 +313,15 @@ const char *sel_get_name (SEL selector)
   return ret;
 }
 
+/* Traditional GNU Objective-C Runtime API.  */
+const char *sel_get_name (SEL selector)
+{
+  if (selector == NULL)
+    return 0;
+
+  return sel_getName (selector);
+}
+
 BOOL
 sel_is_mapped (SEL selector)
 {
@@ -312,8 +329,7 @@ sel_is_mapped (SEL selector)
   return ((idx > 0) && (idx <= __objc_selector_max_index));
 }
 
-
-const char *sel_get_type (SEL selector)
+const char *sel_getType (SEL selector)
 {
   if (selector)
     return selector->sel_types;
@@ -321,6 +337,12 @@ const char *sel_get_type (SEL selector)
     return 0;
 }
 
+/* Traditional GNU Objective-C Runtime API.  */
+const char *sel_get_type (SEL selector)
+{
+  return sel_getType (selector);
+}
+
 /* The uninstalled dispatch table */
 extern struct sarray *__objc_uninstalled_dtable;
 
@@ -462,7 +484,7 @@ __sel_register_typed_name (const char *name, const char *types,
 }
 
 SEL
-sel_register_name (const char *name)
+sel_registerName (const char *name)
 {
   SEL ret;
     
@@ -475,8 +497,15 @@ sel_register_name (const char *name)
   return ret;
 }
 
+/* Traditional GNU Objective-C Runtime API.  */
 SEL
-sel_register_typed_name (const char *name, const char *type)
+sel_register_name (const char *name)
+{
+  return sel_registerName (name);
+}
+
+SEL
+sel_registerTypedName (const char *name, const char *type)
 {
   SEL ret;
 
@@ -488,3 +517,23 @@ sel_register_typed_name (const char *name, const char *type)
   
   return ret;
 }
+
+SEL
+sel_register_typed_name (const char *name, const char *type)
+{
+  return sel_registerTypedName (name, type);
+}
+
+/* return selector representing name */
+SEL
+sel_getUid (const char *name)
+{
+  return sel_registerTypedName (name, 0);
+}
+
+/* Traditional GNU Objective-C Runtime API.  */
+SEL
+sel_get_uid (const char *name)
+{
+  return sel_getUid (name);
+}
This page took 0.028325 seconds and 5 git commands to generate.