Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 334 lines (272 sloc) 9.479 kb
52f5f41 Nobuyoshi Nakada * internal.h: add for internal use only.
nobu authored
1 /**********************************************************************
2
3 internal.h -
4
5 $Author$
6 created at: Tue May 17 11:42:20 JST 2011
7
8 Copyright (C) 2011 Yukihiro Matsumoto
9
10 **********************************************************************/
11
12 #ifndef RUBY_INTERNAL_H
13 #define RUBY_INTERNAL_H 1
14
15 #if defined(__cplusplus)
16 extern "C" {
17 #if 0
18 } /* satisfy cc-mode */
19 #endif
20 #endif
21
19f3866 Nobuyoshi Nakada * include/ruby/backward/classext.h: for evil gems. fixed #4803
nobu authored
22 struct rb_deprecated_classext_struct {
23 char conflict[sizeof(VALUE) * 3];
24 };
25
52f5f41 Nobuyoshi Nakada * internal.h: add for internal use only.
nobu authored
26 struct rb_classext_struct {
27 VALUE super;
28 struct st_table *iv_tbl;
29 struct st_table *const_tbl;
8ddbbb3 Nobuyoshi Nakada Module#prepend
nobu authored
30 VALUE origin;
52f5f41 Nobuyoshi Nakada * internal.h: add for internal use only.
nobu authored
31 };
32
19f3866 Nobuyoshi Nakada * include/ruby/backward/classext.h: for evil gems. fixed #4803
nobu authored
33 #undef RCLASS_SUPER
34 #define RCLASS_EXT(c) (RCLASS(c)->ptr)
35 #define RCLASS_SUPER(c) (RCLASS_EXT(c)->super)
36 #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
37 #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
38 #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
39 #define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
8ddbbb3 Nobuyoshi Nakada Module#prepend
nobu authored
40 #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
19f3866 Nobuyoshi Nakada * include/ruby/backward/classext.h: for evil gems. fixed #4803
nobu authored
41
afd7e46 akr * internal.h: declare more internal functions.
akr authored
42 struct vtm; /* defined by timev.h */
43
5ed8c08 akr * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
akr authored
44 /* array.c */
45 VALUE rb_ary_last(int, VALUE *, VALUE);
d937464 Nobuyoshi Nakada * array.c (rb_ary_set_len): new function to set array length.
nobu authored
46 void rb_ary_set_len(VALUE, long);
e78ff08 Nobuyoshi Nakada * array.c (rb_ary_cat): new function to concat objects into array.
nobu authored
47 VALUE rb_ary_cat(VALUE, const VALUE *, long);
5ed8c08 akr * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
akr authored
48
e7996eb akr * internal.h: declare internal functions here.
akr authored
49 /* bignum.c */
50 VALUE rb_big_fdiv(VALUE x, VALUE y);
a3ffe96 Nobuyoshi Nakada * numeric.c (flo_round): fix for negative value.
nobu authored
51 VALUE rb_big_uminus(VALUE x);
cf46977 akr * bignum.c (rb_integer_float_cmp): renamed from rb_big_float_cmp.
akr authored
52 VALUE rb_integer_float_cmp(VALUE x, VALUE y);
04f09ef akr * bignum.c (rb_integer_float_eq): new function.
akr authored
53 VALUE rb_integer_float_eq(VALUE x, VALUE y);
a3ffe96 Nobuyoshi Nakada * numeric.c (flo_round): fix for negative value.
nobu authored
54
e7996eb akr * internal.h: declare internal functions here.
akr authored
55 /* class.c */
56 VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj);
57 VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
58 VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
59 VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
60 int rb_obj_basic_to_s_p(VALUE);
bc46292 akr * internal.h: declarations declared in include/ruby/*.h removed.
akr authored
61 void Init_class_hierarchy(void);
e7996eb akr * internal.h: declare internal functions here.
akr authored
62
63 /* compile.c */
64 int rb_dvar_defined(ID);
65 int rb_local_defined(ID);
66 int rb_parse_in_eval(void);
67 int rb_parse_in_main(void);
afd7e46 akr * internal.h: declare more internal functions.
akr authored
68 VALUE rb_insns_name_array(void);
e7996eb akr * internal.h: declare internal functions here.
akr authored
69
2910f67 nagachika * cont.c (rb_fiber_reset_root_local_storage): add a new function to
nagachika authored
70 /* cont.c */
71 VALUE rb_obj_is_fiber(VALUE);
72 void rb_fiber_reset_root_local_storage(VALUE);
73
e7996eb akr * internal.h: declare internal functions here.
akr authored
74 /* debug.c */
75 PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
76
77 /* dmyext.c */
78 void Init_ext(void);
79
80 /* encoding.c */
81 ID rb_id_encoding(void);
82
83 /* encoding.c */
84 void rb_gc_mark_encodings(void);
85
afd7e46 akr * internal.h: declare more internal functions.
akr authored
86 /* error.c */
87 NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
88 VALUE rb_check_backtrace(VALUE);
c221267 Koichi Sasada * error.c (rb_async_bug_errno): async-safe bug report function.
ko1 authored
89 NORETURN(void rb_async_bug_errno(const char *,int));
13bc74f Nobuyoshi Nakada rb_builtin_type_name
nobu authored
90 const char *rb_builtin_type_name(int t);
afd7e46 akr * internal.h: declare more internal functions.
akr authored
91
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
92 /* eval_error.c */
93 void ruby_error_print(void);
94 VALUE rb_get_backtrace(VALUE info);
95
96 /* eval_jump.c */
97 void rb_call_end_proc(VALUE data);
c5617b3 Nobuyoshi Nakada internal.h: move mark functions
nobu authored
98 void rb_mark_end_proc(void);
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
99
e7996eb akr * internal.h: declare internal functions here.
akr authored
100 /* file.c */
101 VALUE rb_home_dir(const char *user, VALUE result);
102 VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
0b89081 Nobuyoshi Nakada * internal.h (rb_file_const, rb_file_load_ok): moved functions for
nobu authored
103 void rb_file_const(const char*, VALUE);
104 int rb_file_load_ok(const char *);
e7996eb akr * internal.h: declare internal functions here.
akr authored
105 void Init_File(void);
106
107 /* gc.c */
108 void Init_heap(void);
56dc6f5 NARUSE, Yui * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
nurse authored
109 void *ruby_mimmalloc(size_t size);
e7996eb akr * internal.h: declare internal functions here.
akr authored
110
111 /* inits.c */
112 void rb_call_inits(void);
113
114 /* io.c */
115 const char *ruby_get_inplace_mode(void);
116 void ruby_set_inplace_mode(const char *);
117 ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
118 void rb_stdio_set_default_encoding(void);
119
120 /* iseq.c */
121 VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
122
123 /* load.c */
124 VALUE rb_get_load_path(void);
075d98c Nobuyoshi Nakada * error.c (rb_load_fail): should honor encoding.
nobu authored
125 NORETURN(void rb_load_fail(VALUE, const char*));
e7996eb akr * internal.h: declare internal functions here.
akr authored
126
127 /* math.c */
bc11aa7 * internal.h: added declarations.
tadf authored
128 VALUE rb_math_atan2(VALUE, VALUE);
129 VALUE rb_math_cos(VALUE);
130 VALUE rb_math_cosh(VALUE);
131 VALUE rb_math_exp(VALUE);
132 VALUE rb_math_hypot(VALUE, VALUE);
e7996eb akr * internal.h: declare internal functions here.
akr authored
133 VALUE rb_math_log(int argc, VALUE *argv);
bc11aa7 * internal.h: added declarations.
tadf authored
134 VALUE rb_math_sin(VALUE);
135 VALUE rb_math_sinh(VALUE);
136 VALUE rb_math_sqrt(VALUE);
e7996eb akr * internal.h: declare internal functions here.
akr authored
137
138 /* newline.c */
139 void Init_newline(void);
140
141 /* numeric.c */
142 int rb_num_to_uint(VALUE val, unsigned int *ret);
afd7e46 akr * internal.h: declare more internal functions.
akr authored
143 int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
4c2e2d8 Marc-André Lafortune * numeric.c: fix flodivmod for cornercases [Bug #6044]
marcandre authored
144 double ruby_float_mod(double x, double y);
1fdbe0f nagachika * gc.c (rb_objspace_call_finalizer): use rb_typeddata_is_kind_of() for
nagachika authored
145
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
146 /* object.c */
147 VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
148
e7996eb akr * internal.h: declare internal functions here.
akr authored
149 /* parse.y */
150 VALUE rb_parser_get_yydebug(VALUE);
151 VALUE rb_parser_set_yydebug(VALUE, VALUE);
34918aa Nobuyoshi Nakada * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
nobu authored
152 int rb_is_const_name(VALUE name);
153 int rb_is_class_name(VALUE name);
154 int rb_is_global_name(VALUE name);
155 int rb_is_instance_name(VALUE name);
156 int rb_is_attrset_name(VALUE name);
157 int rb_is_local_name(VALUE name);
158 int rb_is_method_name(VALUE name);
159 int rb_is_junk_name(VALUE name);
c5617b3 Nobuyoshi Nakada internal.h: move mark functions
nobu authored
160 void rb_gc_mark_parser(void);
161 void rb_gc_mark_symbols(void);
e7996eb akr * internal.h: declare internal functions here.
akr authored
162
5ed8c08 akr * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
akr authored
163 /* proc.c */
164 VALUE rb_proc_location(VALUE self);
f12c14d Marc-André Lafortune * proc.c (method_hash, proc_hash): Fix {Unbound}Method#hash
marcandre authored
165 st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
5ed8c08 akr * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
akr authored
166
41819dc akr * internal.h (ARGVSTR2ARGC): defined.
akr authored
167 /* process.c */
168
b60713d akr * internal.h (struct rb_execarg) moved and renamed from
akr authored
169 struct rb_execarg {
170 int use_shell;
171 union {
172 struct {
173 VALUE shell_script;
174 } sh;
175 struct {
176 VALUE command_name;
177 VALUE command_abspath; /* full path string or nil */
178 VALUE argv_str;
179 VALUE argv_buf;
180 } cmd;
181 } invoke;
182 VALUE redirect_fds;
183 VALUE envp_str;
184 VALUE envp_buf;
185 VALUE dup2_tmpbuf;
bcadfd9 akr * internal.h (rb_execarg): add pgroup_given and pgroup_pgid fields.
akr authored
186 unsigned pgroup_given : 1;
5309af9 akr * internal.h (struct rb_execarg): add umask_given and umask_mask
akr authored
187 unsigned umask_given : 1;
40ae2e0 akr * internal.h (rb_execarg): add unsetenv_others_given and
akr authored
188 unsigned unsetenv_others_given : 1;
189 unsigned unsetenv_others_do : 1;
f527ad6 akr * internal.h (rb_execarg): add close_others_given, close_others_do and
akr authored
190 unsigned close_others_given : 1;
191 unsigned close_others_do : 1;
b25b956 akr * internal.h (rb_execarg): add chdir_given and chdir_dir fields.
akr authored
192 unsigned chdir_given : 1;
f1734b4 akr * internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
akr authored
193 unsigned new_pgroup_given : 1;
194 unsigned new_pgroup_flag : 1;
0e8395d unak * internal.h: use rb_pid_t instead of pid_t because of there is no
unak authored
195 rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
f732c50 akr * internal.h (rb_execarg): add rlimit_limits field.
akr authored
196 VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
5309af9 akr * internal.h (struct rb_execarg): add umask_given and umask_mask
akr authored
197 mode_t umask_mask;
345ecf3 akr * internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,
akr authored
198 VALUE fd_dup2;
199 VALUE fd_close;
200 VALUE fd_open;
201 VALUE fd_dup2_child;
f527ad6 akr * internal.h (rb_execarg): add close_others_given, close_others_do and
akr authored
202 int close_others_maxhint;
26ecb6c akr * internal.h (rb_execarg): add env_modification field.
akr authored
203 VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
b25b956 akr * internal.h (rb_execarg): add chdir_given and chdir_dir fields.
akr authored
204 VALUE chdir_dir;
b60713d akr * internal.h (struct rb_execarg) moved and renamed from
akr authored
205 };
206
71fd73d akr * process.c (rb_exec_fillarg): allocate one more element before
akr authored
207 /* argv_str contains extra two elements.
208 * The beginning one is for /bin/sh used by exec_with_sh.
209 * The last one for terminating NULL used by execve.
41819dc akr * internal.h (ARGVSTR2ARGC): defined.
akr authored
210 * See rb_exec_fillarg() in process.c. */
71fd73d akr * process.c (rb_exec_fillarg): allocate one more element before
akr authored
211 #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
212 #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
41819dc akr * internal.h (ARGVSTR2ARGC): defined.
akr authored
213
4b70fab akr * process.c (rb_fork_ruby): new function.
akr authored
214 rb_pid_t rb_fork_ruby(int *status);
215
e7996eb akr * internal.h: declare internal functions here.
akr authored
216 /* rational.c */
217 VALUE rb_lcm(VALUE x, VALUE y);
aef7007 * internal.h: rb_rational_reciprocal is defined in rational.c.
tadf authored
218 VALUE rb_rational_reciprocal(VALUE x);
e7996eb akr * internal.h: declare internal functions here.
akr authored
219
220 /* re.c */
221 VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
222 VALUE rb_reg_check_preprocess(VALUE);
223
224 /* signal.c */
225 int rb_get_next_signal(void);
226
6bc83a1 NARUSE, Yui * internal.h (rb_strftime_timespec): moved from time.c and define only
nurse authored
227 /* strftime.c */
228 #ifdef RUBY_ENCODING_H
229 size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
230 const struct vtm *vtm, struct timespec *ts, int gmt);
231 size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
232 const struct vtm *vtm, VALUE timev, int gmt);
233 #endif
234
e7996eb akr * internal.h: declare internal functions here.
akr authored
235 /* string.c */
236 int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
f64e7c8 Nobuyoshi Nakada string.c: rb_str_symname_p
nobu authored
237 int rb_str_symname_p(VALUE);
e7996eb akr * internal.h: declare internal functions here.
akr authored
238
239 /* struct.c */
240 VALUE rb_struct_init_copy(VALUE copy, VALUE s);
241
242 /* time.c */
243 struct timeval rb_time_timeval(VALUE);
244
245 /* thread.c */
246 VALUE rb_obj_is_mutex(VALUE obj);
247 VALUE ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always);
87f025d akr * io.c: fix IO.copy_stream interrupt handling.
akr authored
248 void rb_thread_execute_interrupts(VALUE th);
e7996eb akr * internal.h: declare internal functions here.
akr authored
249 void rb_clear_trace_func(void);
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
250 VALUE rb_get_coverages(void);
85bb412 Nobuyoshi Nakada ThreadShield
nobu authored
251 VALUE rb_thread_shield_new(void);
252 VALUE rb_thread_shield_wait(VALUE self);
253 VALUE rb_thread_shield_release(VALUE self);
254 VALUE rb_thread_shield_destroy(VALUE self);
e7996eb akr * internal.h: declare internal functions here.
akr authored
255
256 /* thread_pthread.c, thread_win32.c */
257 void Init_native_thread(void);
258
259 /* vm.c */
260 VALUE rb_obj_is_thread(VALUE obj);
261 void rb_vm_mark(void *ptr);
262 void Init_BareVM(void);
263 VALUE rb_vm_top_self(void);
264 void rb_thread_recycle_stack_release(VALUE *);
265 void rb_vm_change_state(void);
266 void rb_vm_inc_const_missing_count(void);
267 void rb_thread_mark(void *th);
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
268 const void **rb_vm_get_insns_address_table(void);
bc2a1f2 Nobuyoshi Nakada * variable.c (rb_const_set): show the previous definition
nobu authored
269 VALUE rb_sourcefilename(void);
e7996eb akr * internal.h: declare internal functions here.
akr authored
270
271 /* vm_dump.c */
272 void rb_vm_bugreport(void);
273
274 /* vm_eval.c */
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
275 void Init_vm_eval(void);
5ed8c08 akr * eval.c, hash.c, load.c, proc.c, range.c, thread.c, time.c: don't
akr authored
276 VALUE rb_current_realfilepath(void);
7da3ea8 akr * method.h, internal.h iseq.h: declare internal functions.
akr authored
277
278 /* vm_method.c */
279 void Init_eval_method(void);
3dcebce Koichi Sasada * vm.c: add RubyVM::Backtrace object (btobj).
ko1 authored
280 int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
e7996eb akr * internal.h: declare internal functions here.
akr authored
281
282 /* miniprelude.c, prelude.c */
283 void Init_prelude(void);
87f025d akr * io.c: fix IO.copy_stream interrupt handling.
akr authored
284
b57c81a Koichi Sasada * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
ko1 authored
285 /* vm_backtrace.c */
286 void Init_vm_backtrace(void);
287 VALUE rb_thread_backtrace(VALUE thval);
288 VALUE rb_make_backtrace(void);
289 void rb_backtrace_print_as_bugreport(void);
290 int rb_backtrace_p(VALUE obj);
291 VALUE rb_backtrace_to_str_ary(VALUE obj);
292 VALUE rb_vm_backtrace_object();
293
908baef kosaki * internal.h: move rb_thread_io_blocking_region() declaration
kosaki authored
294 #if defined __GNUC__ && __GNUC__ >= 4
295 #pragma GCC visibility push(default)
296 #endif
3b32735 Koichi Sasada * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
ko1 authored
297 const char *rb_objspace_data_type_name(VALUE obj);
919978a Koichi Sasada * internal.h (rb_thread_call_with_gvl, rb_thread_call_without_gvl):
ko1 authored
298
ce698d4 Koichi Sasada * internal.h: add comments (cautions).
ko1 authored
299 /* Temporary. This API will be removed (renamed). */
919978a Koichi Sasada * internal.h (rb_thread_call_with_gvl, rb_thread_call_without_gvl):
ko1 authored
300 VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
301
b7d3973 akr * internal.h (rb_maygvl_fd_fix_cloexec): change the visibility for
akr authored
302 /* io.c */
303 void rb_maygvl_fd_fix_cloexec(int fd);
304
1808846 akr * process.c (rb_exec_async_signal_safe): exported.
akr authored
305 /* process.c */
b60713d akr * internal.h (struct rb_execarg) moved and renamed from
akr authored
306 int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
1808846 akr * process.c (rb_exec_async_signal_safe): exported.
akr authored
307 rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
826f98e akr * internal.h (rb_execarg_new): declared.
akr authored
308 VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
b60713d akr * internal.h (struct rb_execarg) moved and renamed from
akr authored
309 struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
46e23dc akr * process.c (rb_execarg_init): take a VALUE argument instead of
akr authored
310 VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
ed8040a akr * process.c (rb_execarg_addopt): take a VALUE argument instead of
akr authored
311 int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
d73d3a7 akr * process.c (rb_execarg_fixup): take a VALUE argument instead of
akr authored
312 void rb_execarg_fixup(VALUE execarg_obj);
b60713d akr * internal.h (struct rb_execarg) moved and renamed from
akr authored
313 int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
2240eb3 Nobuyoshi Nakada popen: shell commands with envvars and execopts
nobu authored
314 VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
315 void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
1808846 akr * process.c (rb_exec_async_signal_safe): exported.
akr authored
316
c5617b3 Nobuyoshi Nakada internal.h: move mark functions
nobu authored
317 /* variable.c */
318 void rb_gc_mark_global_tbl(void);
319 void rb_mark_generic_ivar(VALUE);
320 void rb_mark_generic_ivar_tbl(void);
321
908baef kosaki * internal.h: move rb_thread_io_blocking_region() declaration
kosaki authored
322 #if defined __GNUC__ && __GNUC__ >= 4
323 #pragma GCC visibility pop
324 #endif
325
52f5f41 Nobuyoshi Nakada * internal.h: add for internal use only.
nobu authored
326 #if defined(__cplusplus)
327 #if 0
328 { /* satisfy cc-mode */
329 #endif
330 } /* extern "C" { */
331 #endif
332
333 #endif /* RUBY_INTERNAL_H */
Something went wrong with that request. Please try again.