File: runtime.h

package info (click to toggle)
libobjc-lf2 2.95.3r115-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 684 kB
  • ctags: 945
  • sloc: ansic: 6,088; objc: 484; cpp: 375; sh: 257; makefile: 55
file content (123 lines) | stat: -rw-r--r-- 4,225 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* GNU Objective C Runtime internal declarations
   Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
   Contributed by Kresten Krab Thorup

This file is part of GNU CC.

GNU CC 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.

GNU CC 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
GNU CC; see the file COPYING.  If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.  */

#ifndef __objc_runtime_INCLUDE_GNU
#define __objc_runtime_INCLUDE_GNU

/*
  runtime.h is private header file
*/

#include <stdarg.h>		/* for varargs and va_list's */

#include <stdio.h>
#include <ctype.h>

#include <stddef.h>		/* so noone else will get system versions */

#if OBJC_WITH_GC
#  include "gc.h"
#endif

#include "assert.h"

#include "objc.h"	/* core data types */
#include "objc-api.h"	/* runtime api functions */
#include "thr.h"	/* thread and mutex support */
#include "hash.h"	/* hash structures */
#include "objc-list.h"	/* linear lists */
#include "globals.h"

objc_EXPORT void __objc_add_class_to_hash(Class);   /* (objc-class.c) */
objc_EXPORT void __objc_init_selector_tables(void); /* (objc-sel.c) */
objc_EXPORT void __objc_init_class_tables(void);    /* (objc-class.c) */
objc_EXPORT void __objc_init_dispatch_tables(void); /* (objc-dispatch.c) */
objc_EXPORT void __objc_resolve_class_links(void);  /* (objc-class.c) */
objc_EXPORT void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
objc_EXPORT void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */

objc_EXPORT int  __objc_init_thread_system(void);    /* thread.c */
objc_EXPORT int  __objc_fini_thread_system(void);    /* thread.c */
objc_EXPORT void __objc_print_dtable_stats(void);    /* sendmsg.c */

objc_EXPORT void class_add_method_list(Class, MethodList_t);

/* Registering instance methods as class methods for root classes */
objc_EXPORT void __objc_register_instance_methods_to_class(Class);
objc_EXPORT Method_t search_for_method_in_list(MethodList_t list, SEL op);

/* True when class links has been resolved */     
objc_EXPORT BOOL __objc_class_links_resolved;

/* Number of selectors stored in each of the selector  tables */
objc_EXPORT int __objc_selector_max_index;

/* Mutex locking __objc_selector_max_index and its arrays. */
objc_EXPORT objc_mutex_t __objc_runtime_mutex;

/* Number of threads which are alive. */
objc_EXPORT int __objc_runtime_threads_alive;

#ifdef OBJC_DEBUG
#  define DEBUG_PRINTF(format, args...) printf (format, ## args)
#else
#  define DEBUG_PRINTF(format, args...)
#endif 

BOOL __objc_responds_to (id object, SEL sel); /* for internal use only! */
SEL  __sel_register_typed_name (const char*, const char*, 
				struct objc_selector*, BOOL is_const);

/* runtime locking */

#if !defined(OBJC_WITHOUT_THREADING)
#  define RUNTIME_LOCK   objc_mutex_lock(__objc_runtime_mutex)
#  define RUNTIME_UNLOCK objc_mutex_unlock(__objc_runtime_mutex)
#else
#  define RUNTIME_LOCK
#  define RUNTIME_UNLOCK
#endif

/* memory stuff */

static inline void *OBJC_MALLOC_UNCOLLECTABLE(unsigned int size) {
#if OBJC_WITH_GC
  return GC_MALLOC_UNCOLLECTABLE(size);
#else
  return malloc(size);
#endif
}

static inline void *OBJC_CALLOC_UNCOLLECTABLE(unsigned int size) {
#if OBJC_WITH_GC
  register void *result = GC_MALLOC_UNCOLLECTABLE(size);
  memset(result, 0, size);
  return result;
#else
  return calloc(1, size);
#endif
}

#endif /* not __objc_runtime_INCLUDE_GNU */