Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 163 lines (137 sloc) 4.739 kb
7a4fd1b start cleaning up the public header files
Laurent Sansonetti authored
1 /*
2 * This file is covered by the Ruby license. See COPYING for more details.
3 *
9595725 update copyrights to 2011
Laurent Sansonetti authored
4 * Copyright (C) 2007-2011, Apple Inc. All rights reserved
7a4fd1b start cleaning up the public header files
Laurent Sansonetti authored
5 */
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
6
d0898dd include/ruby/macruby.h -> macruby_internal.h
Laurent Sansonetti authored
7 #ifndef __MACRUBY_INTERNAL_H
8 #define __MACRUBY_INTERNAL_H 1
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
9
10 #if defined(__cplusplus)
11 extern "C" {
12 #endif
13
14 #include "ruby.h"
15
16 #include <objc/objc.h>
17 #include <objc/runtime.h>
18 #include <objc/message.h>
19 #include <objc/objc-auto.h>
20 #include <assert.h>
21 #include <CoreFoundation/CoreFoundation.h>
22
23 void rb_include_module2(VALUE klass, VALUE orig_klass, VALUE module, bool check,
24 bool add_methods);
25
26 VALUE rb_objc_block_call(VALUE obj, SEL sel, int argc,
27 VALUE *argv, VALUE (*bl_proc) (ANYARGS), VALUE data2);
28
29 #if !defined(__AUTO_ZONE__)
30 boolean_t auto_zone_set_write_barrier(void *zone, const void *dest, const void *new_value);
31 void auto_zone_add_root(void *zone, void *address_of_root_ptr, void *value);
32 void auto_zone_retain(void *zone, void *ptr);
33 unsigned int auto_zone_release(void *zone, void *ptr);
a6b0db5 @Watson1978 add a rb_objc_retain_count() for debug.
Watson1978 authored
34 unsigned int auto_zone_retain_count(void *zone, const void *ptr);
db1e9fc @Watson1978 Performance improvement in rary_concat().
Watson1978 authored
35 void *auto_zone_write_barrier_memmove(void *zone, void *dst, const void *src, size_t size);
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
36 extern void *__auto_zone;
37 #else
38 extern auto_zone_t *__auto_zone;
39 #endif
40
29e274f when compiling write barriers, don't assert that the slot must be in …
Laurent Sansonetti authored
41 #define GC_WB_0(dst, newval, check) \
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
42 do { \
43 void *nv = (void *)newval; \
44 if (!SPECIAL_CONST_P(nv)) { \
45 if (!auto_zone_set_write_barrier(__auto_zone, \
46 (const void *)dst, (const void *)nv)) { \
29e274f when compiling write barriers, don't assert that the slot must be in …
Laurent Sansonetti authored
47 if (check) { \
48 rb_bug("destination %p isn't in the auto zone", dst); \
49 } \
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
50 } \
51 } \
52 *(void **)dst = nv; \
53 } \
54 while (0)
55
29e274f when compiling write barriers, don't assert that the slot must be in …
Laurent Sansonetti authored
56 #define GC_WB(dst, newval) GC_WB_0(dst, newval, true)
57
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
58 static inline void *
59 rb_objc_retain(void *addr)
60 {
61 if (addr != NULL && !SPECIAL_CONST_P(addr)) {
62 auto_zone_retain(__auto_zone, addr);
63 }
64 return addr;
65 }
66 #define GC_RETAIN(obj) (rb_objc_retain((void *)obj))
67
a6b0db5 @Watson1978 add a rb_objc_retain_count() for debug.
Watson1978 authored
68 static inline unsigned int
69 rb_objc_retain_count(const void *addr)
70 {
71 return auto_zone_retain_count(__auto_zone, addr);
72 }
73 #define GC_RETAIN_COUNT(obj) (rb_objc_retain_count((const void *)obj))
74
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
75 static inline void *
db1e9fc @Watson1978 Performance improvement in rary_concat().
Watson1978 authored
76 rb_objc_memmove(void *dst, const void *src, size_t size)
77 {
78 return auto_zone_write_barrier_memmove(__auto_zone, dst, src, size);
79 }
80 #define GC_MEMMOVE(dst, src, size) (rb_objc_memmove(dst, src, size))
81
82 static inline void *
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
83 rb_objc_release(void *addr)
84 {
85 if (addr != NULL && !SPECIAL_CONST_P(addr)) {
86 auto_zone_release(__auto_zone, addr);
87 }
88 return addr;
89 }
90 #define GC_RELEASE(obj) (rb_objc_release((void *)obj))
91
92 // MacRubyIntern.h
93
19514ab @Watson1978 String#dup, Array#dup and Hash#dup should copy instance variables. fi…
Watson1978 authored
94 /* object.c */
95 void rb_obj_invoke_initialize_copy(VALUE dest, VALUE obj);
96
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
97 /* enumerator.c */
98 VALUE rb_enumeratorize(VALUE, SEL, int, VALUE *);
7a4fd1b start cleaning up the public header files
Laurent Sansonetti authored
99 #define RETURN_ENUMERATOR(obj, argc, argv) \
100 do { \
101 if (!rb_block_given_p()) { \
102 return rb_enumeratorize((VALUE)obj, sel, argc, argv); \
103 } \
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
104 } while (0)
105 VALUE rb_f_notimplement(VALUE rcv, SEL sel);
106 VALUE rb_method_call(VALUE, SEL, int, VALUE*);
107 VALUE rb_file_directory_p(VALUE,SEL,VALUE);
108 VALUE rb_obj_id(VALUE obj, SEL sel);
109
110 void rb_objc_gc_register_thread(void);
111 void rb_objc_gc_unregister_thread(void);
112 void rb_objc_set_associative_ref(void *, void *, void *);
113 void *rb_objc_get_associative_ref(void *, void *);
114
115 VALUE rb_io_gets(VALUE, SEL);
116 VALUE rb_io_getbyte(VALUE, SEL);
117 VALUE rb_io_ungetc(VALUE, SEL, VALUE);
118 VALUE rb_io_flush(VALUE, SEL);
119 VALUE rb_io_eof(VALUE, SEL);
120 VALUE rb_io_binmode(VALUE, SEL);
121 VALUE rb_io_addstr(VALUE, SEL, VALUE);
122 VALUE rb_io_printf(VALUE, SEL, int, VALUE *);
123 VALUE rb_io_print(VALUE, SEL, int, VALUE *);
124
125 VALUE rb_objc_num_coerce_bin(VALUE x, VALUE Y, SEL sel);
126 VALUE rb_objc_num_coerce_cmp(VALUE, VALUE, SEL sel);
24f19e3 @Watson1978 rb_num_coerce_relop() was renamed the rb_objc_num_coerce_relop(). And…
Watson1978 authored
127 VALUE rb_objc_num_coerce_relop(VALUE, VALUE, SEL sel);
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
128
129 VALUE rb_f_kill(VALUE, SEL, int, VALUE*);
130 VALUE rb_struct_initialize(VALUE, SEL, VALUE);
131 VALUE rb_class_real(VALUE, bool hide_builtin_foundation_classes);
132 void rb_range_extract(VALUE range, VALUE *begp, VALUE *endp, bool *exclude);
133 VALUE rb_cvar_get2(VALUE klass, ID id, bool check);
134
135 VALUE rb_require_framework(VALUE, SEL, int, VALUE *);
136
6130312 move the macruby-only classes to macruby.h
Laurent Sansonetti authored
137 RUBY_EXTERN VALUE rb_cNSObject;
138 RUBY_EXTERN VALUE rb_cRubyObject;
139 RUBY_EXTERN VALUE rb_cNSString;
140 RUBY_EXTERN VALUE rb_cNSMutableString;
141 RUBY_EXTERN VALUE rb_cRubyString;
142 RUBY_EXTERN VALUE rb_cNSArray;
143 RUBY_EXTERN VALUE rb_cNSMutableArray;
144 RUBY_EXTERN VALUE rb_cRubyArray;
145 RUBY_EXTERN VALUE rb_cNSHash;
146 RUBY_EXTERN VALUE rb_cNSMutableHash;
147 RUBY_EXTERN VALUE rb_cRubyHash;
148 RUBY_EXTERN VALUE rb_cNSNumber;
149 RUBY_EXTERN VALUE rb_cNSDate;
150 RUBY_EXTERN VALUE rb_cBoxed;
151 RUBY_EXTERN VALUE rb_cPointer;
152 RUBY_EXTERN VALUE rb_cTopLevel;
153
7a4fd1b start cleaning up the public header files
Laurent Sansonetti authored
154 long rb_objc_flag_get_mask(const void *);
155 void rb_objc_flag_set(const void *, int, bool);
156 bool rb_objc_flag_check(const void *, int);
157
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
158 #if defined(__cplusplus)
7a4fd1b start cleaning up the public header files
Laurent Sansonetti authored
159 } // extern "C" {
468a2ea Move Obj-C related headers around.
Thibault Martin-Lagardette authored
160 #endif
161
d0898dd include/ruby/macruby.h -> macruby_internal.h
Laurent Sansonetti authored
162 #endif /* __MACRUBY_INTERNAL_H */
Something went wrong with that request. Please try again.