148fb7bfaSmrg /* GNU Objective C Runtime selector implementation - Private functions
2*b1e83836Smrg Copyright (C) 2010-2022 Free Software Foundation, Inc.
348fb7bfaSmrg Contributed by Nicola Pero <nicola.pero@meta-innovation.com>
448fb7bfaSmrg
548fb7bfaSmrg This file is part of GCC.
648fb7bfaSmrg
748fb7bfaSmrg GCC is free software; you can redistribute it and/or modify it under the
848fb7bfaSmrg terms of the GNU General Public License as published by the Free Software
948fb7bfaSmrg Foundation; either version 3, or (at your option) any later version.
1048fb7bfaSmrg
1148fb7bfaSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1248fb7bfaSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1348fb7bfaSmrg FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1448fb7bfaSmrg details.
1548fb7bfaSmrg
1648fb7bfaSmrg Under Section 7 of GPL version 3, you are granted additional
1748fb7bfaSmrg permissions described in the GCC Runtime Library Exception, version
1848fb7bfaSmrg 3.1, as published by the Free Software Foundation.
1948fb7bfaSmrg
2048fb7bfaSmrg You should have received a copy of the GNU General Public License and
2148fb7bfaSmrg a copy of the GCC Runtime Library Exception along with this program;
2248fb7bfaSmrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2348fb7bfaSmrg <http://www.gnu.org/licenses/>. */
2448fb7bfaSmrg
2548fb7bfaSmrg #ifndef __objc_private_selector_INCLUDE_GNU
2648fb7bfaSmrg #define __objc_private_selector_INCLUDE_GNU
2748fb7bfaSmrg
2848fb7bfaSmrg /* Private runtime functions that may go away or be rewritten or
2948fb7bfaSmrg replaced. */
3048fb7bfaSmrg
3148fb7bfaSmrg /* Definition of a selector. Selectors themselves are not unique, but
3248fb7bfaSmrg the sel_id is a unique identifier. */
3348fb7bfaSmrg struct objc_selector
3448fb7bfaSmrg {
3548fb7bfaSmrg void *sel_id;
3648fb7bfaSmrg const char *sel_types;
3748fb7bfaSmrg };
3848fb7bfaSmrg
3948fb7bfaSmrg /* An inline, fast version of sel_isEqual(). */
4048fb7bfaSmrg inline static BOOL
sel_eq(SEL s1,SEL s2)4148fb7bfaSmrg sel_eq (SEL s1, SEL s2)
4248fb7bfaSmrg {
4348fb7bfaSmrg if (s1 == 0 || s2 == 0)
4448fb7bfaSmrg return s1 == s2;
4548fb7bfaSmrg else
4648fb7bfaSmrg return s1->sel_id == s2->sel_id;
4748fb7bfaSmrg }
4848fb7bfaSmrg
4948fb7bfaSmrg /* Number of selectors stored in each of the selector tables. */
5048fb7bfaSmrg extern unsigned int __objc_selector_max_index;
5148fb7bfaSmrg
5248fb7bfaSmrg /* Initialize the selector tables. This must be called by init.c. */
5348fb7bfaSmrg void __objc_init_selector_tables(void);
5448fb7bfaSmrg
5548fb7bfaSmrg /* Various private functions to register selectors. */
5648fb7bfaSmrg void __objc_register_selectors_from_class(Class);
5748fb7bfaSmrg void __objc_register_selectors_from_list (struct objc_method_list *);
5848fb7bfaSmrg void __objc_register_selectors_from_description_list
5948fb7bfaSmrg (struct objc_method_description_list *method_list);
6048fb7bfaSmrg void __objc_register_selectors_from_module (struct objc_selector *selectors);
6148fb7bfaSmrg
6248fb7bfaSmrg /* Return whether a selector is mapped or not ("mapped" meaning that
6348fb7bfaSmrg it has been inserted into the selector table). This is private as
6448fb7bfaSmrg only the runtime should ever encounter or need to know about
6548fb7bfaSmrg unmapped selectors. */
6648fb7bfaSmrg BOOL sel_is_mapped (SEL aSel);
6748fb7bfaSmrg
6848fb7bfaSmrg /* Return selector representing name without registering it if it
6948fb7bfaSmrg doesn't exist. Typically used internally by the runtime when it's
7048fb7bfaSmrg looking up methods that may or may not exist (such as +initialize)
7148fb7bfaSmrg in the most efficient way. */
7248fb7bfaSmrg SEL
7348fb7bfaSmrg sel_get_any_uid (const char *name);
7448fb7bfaSmrg
7548fb7bfaSmrg #endif /* not __objc_private_selector_INCLUDE_GNU */
76