xref: /netbsd-src/external/gpl3/gcc.old/dist/libobjc/objc-private/selector.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
136ac495dSmrg /* GNU Objective C Runtime selector implementation - Private functions
2*8feb0f0bSmrg    Copyright (C) 2010-2020 Free Software Foundation, Inc.
336ac495dSmrg    Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
436ac495dSmrg 
536ac495dSmrg This file is part of GCC.
636ac495dSmrg 
736ac495dSmrg GCC is free software; you can redistribute it and/or modify it under the
836ac495dSmrg terms of the GNU General Public License as published by the Free Software
936ac495dSmrg Foundation; either version 3, or (at your option) any later version.
1036ac495dSmrg 
1136ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1236ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1336ac495dSmrg FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1436ac495dSmrg details.
1536ac495dSmrg 
1636ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1736ac495dSmrg permissions described in the GCC Runtime Library Exception, version
1836ac495dSmrg 3.1, as published by the Free Software Foundation.
1936ac495dSmrg 
2036ac495dSmrg You should have received a copy of the GNU General Public License and
2136ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2236ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2336ac495dSmrg <http://www.gnu.org/licenses/>.  */
2436ac495dSmrg 
2536ac495dSmrg #ifndef __objc_private_selector_INCLUDE_GNU
2636ac495dSmrg #define __objc_private_selector_INCLUDE_GNU
2736ac495dSmrg 
2836ac495dSmrg /* Private runtime functions that may go away or be rewritten or
2936ac495dSmrg    replaced.  */
3036ac495dSmrg 
3136ac495dSmrg /* Definition of a selector.  Selectors themselves are not unique, but
3236ac495dSmrg    the sel_id is a unique identifier.  */
3336ac495dSmrg struct objc_selector
3436ac495dSmrg {
3536ac495dSmrg   void *sel_id;
3636ac495dSmrg   const char *sel_types;
3736ac495dSmrg };
3836ac495dSmrg 
3936ac495dSmrg /* An inline, fast version of sel_isEqual().  */
4036ac495dSmrg inline static BOOL
sel_eq(SEL s1,SEL s2)4136ac495dSmrg sel_eq (SEL s1, SEL s2)
4236ac495dSmrg {
4336ac495dSmrg   if (s1 == 0 || s2 == 0)
4436ac495dSmrg     return s1 == s2;
4536ac495dSmrg   else
4636ac495dSmrg     return s1->sel_id == s2->sel_id;
4736ac495dSmrg }
4836ac495dSmrg 
4936ac495dSmrg /* Number of selectors stored in each of the selector tables.  */
5036ac495dSmrg extern unsigned int __objc_selector_max_index;
5136ac495dSmrg 
5236ac495dSmrg /* Initialize the selector tables.  This must be called by init.c.  */
5336ac495dSmrg void __objc_init_selector_tables(void);
5436ac495dSmrg 
5536ac495dSmrg /* Various private functions to register selectors.  */
5636ac495dSmrg void __objc_register_selectors_from_class(Class);
5736ac495dSmrg void __objc_register_selectors_from_list (struct objc_method_list *);
5836ac495dSmrg void __objc_register_selectors_from_description_list
5936ac495dSmrg (struct objc_method_description_list *method_list);
6036ac495dSmrg void __objc_register_selectors_from_module (struct objc_selector *selectors);
6136ac495dSmrg 
6236ac495dSmrg /* Return whether a selector is mapped or not ("mapped" meaning that
6336ac495dSmrg    it has been inserted into the selector table).  This is private as
6436ac495dSmrg    only the runtime should ever encounter or need to know about
6536ac495dSmrg    unmapped selectors.  */
6636ac495dSmrg BOOL sel_is_mapped (SEL aSel);
6736ac495dSmrg 
6836ac495dSmrg /* Return selector representing name without registering it if it
6936ac495dSmrg    doesn't exist.  Typically used internally by the runtime when it's
7036ac495dSmrg    looking up methods that may or may not exist (such as +initialize)
7136ac495dSmrg    in the most efficient way.  */
7236ac495dSmrg SEL
7336ac495dSmrg sel_get_any_uid (const char *name);
7436ac495dSmrg 
7536ac495dSmrg #endif /* not __objc_private_selector_INCLUDE_GNU */
76