bindex 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +48 -0
- data/CONTRIBUTING.md +15 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +48 -0
- data/bindex.gemspec +27 -0
- data/ext/bindex/bindex.h +11 -0
- data/ext/bindex/bindings.c +106 -0
- data/ext/bindex/com/gsamokovarov/bindex/BindingBuilder.java.erb +17 -0
- data/ext/bindex/com/gsamokovarov/bindex/CurrentBindingsIterator.java +54 -0
- data/ext/bindex/com/gsamokovarov/bindex/RubyBindingsCollector.java +34 -0
- data/ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java +21 -0
- data/ext/bindex/com/gsamokovarov/bindex/ThreadContextInterfaceException.java +14 -0
- data/ext/bindex/com/gsamokovarov/bindex/ThreadContextInternals.java +54 -0
- data/ext/bindex/cruby.c +34 -0
- data/ext/bindex/extconf.rb +29 -0
- data/ext/bindex/ruby_193.h +101 -0
- data/ext/bindex/ruby_193/addr2line.h +21 -0
- data/ext/bindex/ruby_193/constant.h +34 -0
- data/ext/bindex/ruby_193/debug.h +41 -0
- data/ext/bindex/ruby_193/dln.h +50 -0
- data/ext/bindex/ruby_193/encdb.h +167 -0
- data/ext/bindex/ruby_193/eval_intern.h +234 -0
- data/ext/bindex/ruby_193/gc.h +99 -0
- data/ext/bindex/ruby_193/id.h +177 -0
- data/ext/bindex/ruby_193/internal.h +242 -0
- data/ext/bindex/ruby_193/iseq.h +126 -0
- data/ext/bindex/ruby_193/method.h +105 -0
- data/ext/bindex/ruby_193/node.h +504 -0
- data/ext/bindex/ruby_193/parse.h +302 -0
- data/ext/bindex/ruby_193/probes.h +369 -0
- data/ext/bindex/ruby_193/regenc.h +219 -0
- data/ext/bindex/ruby_193/regint.h +850 -0
- data/ext/bindex/ruby_193/regparse.h +362 -0
- data/ext/bindex/ruby_193/revision.h +1 -0
- data/ext/bindex/ruby_193/ruby_atomic.h +175 -0
- data/ext/bindex/ruby_193/siphash.h +48 -0
- data/ext/bindex/ruby_193/thread_pthread.h +51 -0
- data/ext/bindex/ruby_193/thread_win32.h +40 -0
- data/ext/bindex/ruby_193/timev.h +21 -0
- data/ext/bindex/ruby_193/transcode_data.h +117 -0
- data/ext/bindex/ruby_193/transdb.h +186 -0
- data/ext/bindex/ruby_193/verconf.h +12 -0
- data/ext/bindex/ruby_193/version.h +52 -0
- data/ext/bindex/ruby_193/vm_core.h +763 -0
- data/ext/bindex/ruby_193/vm_exec.h +184 -0
- data/ext/bindex/ruby_193/vm_insnhelper.h +220 -0
- data/ext/bindex/ruby_193/vm_opts.h +51 -0
- data/ext/bindex/ruby_20.h +142 -0
- data/ext/bindex/ruby_20/addr2line.h +21 -0
- data/ext/bindex/ruby_20/constant.h +36 -0
- data/ext/bindex/ruby_20/dln.h +50 -0
- data/ext/bindex/ruby_20/encdb.h +169 -0
- data/ext/bindex/ruby_20/eval_intern.h +241 -0
- data/ext/bindex/ruby_20/gc.h +104 -0
- data/ext/bindex/ruby_20/id.h +135 -0
- data/ext/bindex/ruby_20/internal.h +395 -0
- data/ext/bindex/ruby_20/iseq.h +140 -0
- data/ext/bindex/ruby_20/method.h +138 -0
- data/ext/bindex/ruby_20/node.h +541 -0
- data/ext/bindex/ruby_20/parse.h +292 -0
- data/ext/bindex/ruby_20/probes.h +369 -0
- data/ext/bindex/ruby_20/probes_helper.h +67 -0
- data/ext/bindex/ruby_20/regenc.h +227 -0
- data/ext/bindex/ruby_20/regint.h +915 -0
- data/ext/bindex/ruby_20/regparse.h +367 -0
- data/ext/bindex/ruby_20/revision.h +1 -0
- data/ext/bindex/ruby_20/ruby_atomic.h +170 -0
- data/ext/bindex/ruby_20/siphash.h +48 -0
- data/ext/bindex/ruby_20/thread_pthread.h +56 -0
- data/ext/bindex/ruby_20/thread_win32.h +45 -0
- data/ext/bindex/ruby_20/timev.h +21 -0
- data/ext/bindex/ruby_20/transcode_data.h +127 -0
- data/ext/bindex/ruby_20/transdb.h +190 -0
- data/ext/bindex/ruby_20/verconf.h +12 -0
- data/ext/bindex/ruby_20/version.h +52 -0
- data/ext/bindex/ruby_20/vm_core.h +1018 -0
- data/ext/bindex/ruby_20/vm_debug.h +41 -0
- data/ext/bindex/ruby_20/vm_exec.h +173 -0
- data/ext/bindex/ruby_20/vm_insnhelper.h +274 -0
- data/ext/bindex/ruby_20/vm_opts.h +56 -0
- data/ext/bindex/ruby_21.h +142 -0
- data/ext/bindex/ruby_21/addr2line.h +21 -0
- data/ext/bindex/ruby_21/constant.h +36 -0
- data/ext/bindex/ruby_21/dln.h +51 -0
- data/ext/bindex/ruby_21/encdb.h +170 -0
- data/ext/bindex/ruby_21/eval_intern.h +260 -0
- data/ext/bindex/ruby_21/gc.h +101 -0
- data/ext/bindex/ruby_21/id.h +210 -0
- data/ext/bindex/ruby_21/internal.h +889 -0
- data/ext/bindex/ruby_21/iseq.h +136 -0
- data/ext/bindex/ruby_21/method.h +142 -0
- data/ext/bindex/ruby_21/node.h +543 -0
- data/ext/bindex/ruby_21/parse.h +298 -0
- data/ext/bindex/ruby_21/probes.h +401 -0
- data/ext/bindex/ruby_21/probes_helper.h +67 -0
- data/ext/bindex/ruby_21/regenc.h +223 -0
- data/ext/bindex/ruby_21/regint.h +911 -0
- data/ext/bindex/ruby_21/regparse.h +363 -0
- data/ext/bindex/ruby_21/revision.h +1 -0
- data/ext/bindex/ruby_21/ruby_atomic.h +170 -0
- data/ext/bindex/ruby_21/siphash.h +48 -0
- data/ext/bindex/ruby_21/thread_native.h +23 -0
- data/ext/bindex/ruby_21/thread_pthread.h +56 -0
- data/ext/bindex/ruby_21/thread_win32.h +45 -0
- data/ext/bindex/ruby_21/timev.h +42 -0
- data/ext/bindex/ruby_21/transcode_data.h +123 -0
- data/ext/bindex/ruby_21/transdb.h +190 -0
- data/ext/bindex/ruby_21/verconf.h +13 -0
- data/ext/bindex/ruby_21/version.h +52 -0
- data/ext/bindex/ruby_21/vm_core.h +1043 -0
- data/ext/bindex/ruby_21/vm_debug.h +37 -0
- data/ext/bindex/ruby_21/vm_exec.h +182 -0
- data/ext/bindex/ruby_21/vm_insnhelper.h +273 -0
- data/ext/bindex/ruby_21/vm_opts.h +56 -0
- data/ext/bindex/ruby_21preview.h +146 -0
- data/ext/bindex/ruby_21preview/addr2line.h +21 -0
- data/ext/bindex/ruby_21preview/constant.h +36 -0
- data/ext/bindex/ruby_21preview/dln.h +51 -0
- data/ext/bindex/ruby_21preview/encdb.h +270 -0
- data/ext/bindex/ruby_21preview/eval_intern.h +217 -0
- data/ext/bindex/ruby_21preview/gc.h +100 -0
- data/ext/bindex/ruby_21preview/id.h +169 -0
- data/ext/bindex/ruby_21preview/internal.h +765 -0
- data/ext/bindex/ruby_21preview/iseq.h +136 -0
- data/ext/bindex/ruby_21preview/method.h +141 -0
- data/ext/bindex/ruby_21preview/node.h +543 -0
- data/ext/bindex/ruby_21preview/parse.h +298 -0
- data/ext/bindex/ruby_21preview/probes.h +385 -0
- data/ext/bindex/ruby_21preview/probes_helper.h +67 -0
- data/ext/bindex/ruby_21preview/regenc.h +223 -0
- data/ext/bindex/ruby_21preview/regint.h +911 -0
- data/ext/bindex/ruby_21preview/regparse.h +363 -0
- data/ext/bindex/ruby_21preview/revision.h +1 -0
- data/ext/bindex/ruby_21preview/ruby_atomic.h +130 -0
- data/ext/bindex/ruby_21preview/siphash.h +48 -0
- data/ext/bindex/ruby_21preview/thread_native.h +23 -0
- data/ext/bindex/ruby_21preview/thread_pthread.h +56 -0
- data/ext/bindex/ruby_21preview/thread_win32.h +45 -0
- data/ext/bindex/ruby_21preview/timev.h +42 -0
- data/ext/bindex/ruby_21preview/transcode_data.h +123 -0
- data/ext/bindex/ruby_21preview/transdb.h +190 -0
- data/ext/bindex/ruby_21preview/verconf.h +13 -0
- data/ext/bindex/ruby_21preview/version.h +53 -0
- data/ext/bindex/ruby_21preview/vm_core.h +1017 -0
- data/ext/bindex/ruby_21preview/vm_debug.h +37 -0
- data/ext/bindex/ruby_21preview/vm_exec.h +180 -0
- data/ext/bindex/ruby_21preview/vm_insnhelper.h +272 -0
- data/ext/bindex/ruby_21preview/vm_opts.h +56 -0
- data/lib/bindex.rb +10 -0
- data/lib/bindex/jruby.rb +20 -0
- data/lib/bindex/jruby_internals.jar +0 -0
- data/lib/bindex/jruby_internals_9k.jar +0 -0
- data/lib/bindex/rubinius.rb +56 -0
- data/lib/bindex/version.rb +3 -0
- data/test/exception_test.rb +45 -0
- data/test/fixtures/basic_nested_fixture.rb +13 -0
- data/test/fixtures/custom_error_fixture.rb +9 -0
- data/test/fixtures/eval_nested_fixture.rb +13 -0
- data/test/fixtures/flat_fixture.rb +7 -0
- data/test/test_helper.rb +17 -0
- metadata +270 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
|
2
|
+
#ifndef RUBY_GC_H
|
3
|
+
#define RUBY_GC_H 1
|
4
|
+
|
5
|
+
#if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__)
|
6
|
+
#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p)))
|
7
|
+
#elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__)
|
8
|
+
#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p)))
|
9
|
+
#else
|
10
|
+
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
11
|
+
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
|
12
|
+
#define USE_CONSERVATIVE_STACK_END
|
13
|
+
#endif
|
14
|
+
|
15
|
+
/* for GC debug */
|
16
|
+
|
17
|
+
#ifndef RUBY_MARK_FREE_DEBUG
|
18
|
+
#define RUBY_MARK_FREE_DEBUG 0
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#if RUBY_MARK_FREE_DEBUG
|
22
|
+
extern int ruby_gc_debug_indent;
|
23
|
+
|
24
|
+
static inline void
|
25
|
+
rb_gc_debug_indent(void)
|
26
|
+
{
|
27
|
+
printf("%*s", ruby_gc_debug_indent, "");
|
28
|
+
}
|
29
|
+
|
30
|
+
static inline void
|
31
|
+
rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
|
32
|
+
{
|
33
|
+
if (st == 0) {
|
34
|
+
ruby_gc_debug_indent--;
|
35
|
+
}
|
36
|
+
rb_gc_debug_indent();
|
37
|
+
printf("%s: %s %s (%p)\n", mode, st ? "->" : "<-", msg, ptr);
|
38
|
+
|
39
|
+
if (st) {
|
40
|
+
ruby_gc_debug_indent++;
|
41
|
+
}
|
42
|
+
|
43
|
+
fflush(stdout);
|
44
|
+
}
|
45
|
+
|
46
|
+
#define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", (msg), 1, ptr)
|
47
|
+
#define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", (msg), 0, ptr)
|
48
|
+
#define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", (msg), 1, ptr)
|
49
|
+
#define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", (msg), 0, ptr)
|
50
|
+
#define RUBY_GC_INFO rb_gc_debug_indent(); printf
|
51
|
+
|
52
|
+
#else
|
53
|
+
#define RUBY_MARK_ENTER(msg)
|
54
|
+
#define RUBY_MARK_LEAVE(msg)
|
55
|
+
#define RUBY_FREE_ENTER(msg)
|
56
|
+
#define RUBY_FREE_LEAVE(msg)
|
57
|
+
#define RUBY_GC_INFO if(0)printf
|
58
|
+
#endif
|
59
|
+
|
60
|
+
#define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
|
61
|
+
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
|
62
|
+
|
63
|
+
#if STACK_GROW_DIRECTION > 0
|
64
|
+
# define STACK_UPPER(x, a, b) (a)
|
65
|
+
#elif STACK_GROW_DIRECTION < 0
|
66
|
+
# define STACK_UPPER(x, a, b) (b)
|
67
|
+
#else
|
68
|
+
RUBY_EXTERN int ruby_stack_grow_direction;
|
69
|
+
int ruby_get_stack_grow_direction(volatile VALUE *addr);
|
70
|
+
# define stack_growup_p(x) ( \
|
71
|
+
(ruby_stack_grow_direction ? \
|
72
|
+
ruby_stack_grow_direction : \
|
73
|
+
ruby_get_stack_grow_direction(x)) > 0)
|
74
|
+
# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? (a) : (b))
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#if STACK_GROW_DIRECTION
|
78
|
+
#define STACK_GROW_DIR_DETECTION
|
79
|
+
#define STACK_DIR_UPPER(a,b) STACK_UPPER(0, (a), (b))
|
80
|
+
#else
|
81
|
+
#define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection
|
82
|
+
#define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b))
|
83
|
+
#endif
|
84
|
+
#define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
|
85
|
+
|
86
|
+
#if defined __GNUC__ && __GNUC__ >= 4
|
87
|
+
#pragma GCC visibility push(default)
|
88
|
+
#endif
|
89
|
+
|
90
|
+
/* exports for objspace module */
|
91
|
+
size_t rb_objspace_data_type_memsize(VALUE obj);
|
92
|
+
void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
|
93
|
+
int rb_objspace_markable_object_p(VALUE obj);
|
94
|
+
int rb_objspace_internal_object_p(VALUE obj);
|
95
|
+
|
96
|
+
void rb_objspace_each_objects(
|
97
|
+
int (*callback)(void *start, void *end, size_t stride, void *data),
|
98
|
+
void *data);
|
99
|
+
|
100
|
+
#if defined __GNUC__ && __GNUC__ >= 4
|
101
|
+
#pragma GCC visibility pop
|
102
|
+
#endif
|
103
|
+
|
104
|
+
#endif /* RUBY_GC_H */
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/* DO NOT EDIT THIS FILE DIRECTLY */
|
2
|
+
/**********************************************************************
|
3
|
+
|
4
|
+
id.h -
|
5
|
+
|
6
|
+
$Author$
|
7
|
+
created at: Sun Oct 19 21:12:51 2008
|
8
|
+
|
9
|
+
Copyright (C) 2007 Koichi Sasada
|
10
|
+
|
11
|
+
**********************************************************************/
|
12
|
+
|
13
|
+
#ifndef RUBY_ID_H
|
14
|
+
#define RUBY_ID_H
|
15
|
+
|
16
|
+
#define ID_SCOPE_SHIFT 3
|
17
|
+
#define ID_SCOPE_MASK 0x07
|
18
|
+
#define ID_LOCAL 0x00
|
19
|
+
#define ID_INSTANCE 0x01
|
20
|
+
#define ID_GLOBAL 0x03
|
21
|
+
#define ID_ATTRSET 0x04
|
22
|
+
#define ID_CONST 0x05
|
23
|
+
#define ID_CLASS 0x06
|
24
|
+
#define ID_JUNK 0x07
|
25
|
+
#define ID_INTERNAL ID_JUNK
|
26
|
+
|
27
|
+
#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)
|
28
|
+
|
29
|
+
#define symIFUNC ID2SYM(idIFUNC)
|
30
|
+
#define symCFUNC ID2SYM(idCFUNC)
|
31
|
+
|
32
|
+
#define RUBY_TOKEN_DOT2 128
|
33
|
+
#define RUBY_TOKEN_DOT3 129
|
34
|
+
#define RUBY_TOKEN_UPLUS 130
|
35
|
+
#define RUBY_TOKEN_UMINUS 131
|
36
|
+
#define RUBY_TOKEN_POW 132
|
37
|
+
#define RUBY_TOKEN_DSTAR 133
|
38
|
+
#define RUBY_TOKEN_CMP 134
|
39
|
+
#define RUBY_TOKEN_LSHFT 135
|
40
|
+
#define RUBY_TOKEN_RSHFT 136
|
41
|
+
#define RUBY_TOKEN_LEQ 137
|
42
|
+
#define RUBY_TOKEN_GEQ 138
|
43
|
+
#define RUBY_TOKEN_EQ 139
|
44
|
+
#define RUBY_TOKEN_EQQ 140
|
45
|
+
#define RUBY_TOKEN_NEQ 141
|
46
|
+
#define RUBY_TOKEN_MATCH 142
|
47
|
+
#define RUBY_TOKEN_NMATCH 143
|
48
|
+
#define RUBY_TOKEN_AREF 144
|
49
|
+
#define RUBY_TOKEN_ASET 145
|
50
|
+
#define RUBY_TOKEN_COLON2 146
|
51
|
+
#define RUBY_TOKEN_COLON3 147
|
52
|
+
#define RUBY_TOKEN(t) RUBY_TOKEN_##t
|
53
|
+
|
54
|
+
enum ruby_method_ids {
|
55
|
+
idDot2 = RUBY_TOKEN(DOT2),
|
56
|
+
idDot3 = RUBY_TOKEN(DOT3),
|
57
|
+
idUPlus = RUBY_TOKEN(UPLUS),
|
58
|
+
idUMinus = RUBY_TOKEN(UMINUS),
|
59
|
+
idPow = RUBY_TOKEN(POW),
|
60
|
+
idCmp = RUBY_TOKEN(CMP),
|
61
|
+
idPLUS = '+',
|
62
|
+
idMINUS = '-',
|
63
|
+
idMULT = '*',
|
64
|
+
idDIV = '/',
|
65
|
+
idMOD = '%',
|
66
|
+
idLT = '<',
|
67
|
+
idLTLT = RUBY_TOKEN(LSHFT),
|
68
|
+
idLE = RUBY_TOKEN(LEQ),
|
69
|
+
idGT = '>',
|
70
|
+
idGE = RUBY_TOKEN(GEQ),
|
71
|
+
idEq = RUBY_TOKEN(EQ),
|
72
|
+
idEqq = RUBY_TOKEN(EQQ),
|
73
|
+
idNeq = RUBY_TOKEN(NEQ),
|
74
|
+
idNot = '!',
|
75
|
+
idBackquote = '`',
|
76
|
+
idEqTilde = RUBY_TOKEN(MATCH),
|
77
|
+
idNeqTilde = RUBY_TOKEN(NMATCH),
|
78
|
+
idAREF = RUBY_TOKEN(AREF),
|
79
|
+
idASET = RUBY_TOKEN(ASET),
|
80
|
+
tPRESERVED_ID_BEGIN = 147,
|
81
|
+
idNULL,
|
82
|
+
idEmptyP,
|
83
|
+
idRespond_to,
|
84
|
+
idRespond_to_missing,
|
85
|
+
idIFUNC,
|
86
|
+
idCFUNC,
|
87
|
+
id_core_set_method_alias,
|
88
|
+
id_core_set_variable_alias,
|
89
|
+
id_core_undef_method,
|
90
|
+
id_core_define_method,
|
91
|
+
id_core_define_singleton_method,
|
92
|
+
id_core_set_postexe,
|
93
|
+
id_core_hash_from_ary,
|
94
|
+
id_core_hash_merge_ary,
|
95
|
+
id_core_hash_merge_ptr,
|
96
|
+
id_core_hash_merge_kwd,
|
97
|
+
tPRESERVED_ID_END,
|
98
|
+
tIntern,
|
99
|
+
tMethodMissing,
|
100
|
+
tLength,
|
101
|
+
tSize,
|
102
|
+
tGets,
|
103
|
+
tSucc,
|
104
|
+
tEach,
|
105
|
+
tProc,
|
106
|
+
tLambda,
|
107
|
+
tSend,
|
108
|
+
t__send__,
|
109
|
+
tInitialize,
|
110
|
+
tInitialize_copy,
|
111
|
+
tInitialize_clone,
|
112
|
+
tInitialize_dup,
|
113
|
+
tUScore,
|
114
|
+
#define TOKEN2LOCALID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
115
|
+
TOKEN2LOCALID(Intern),
|
116
|
+
TOKEN2LOCALID(MethodMissing),
|
117
|
+
TOKEN2LOCALID(Length),
|
118
|
+
TOKEN2LOCALID(Size),
|
119
|
+
TOKEN2LOCALID(Gets),
|
120
|
+
TOKEN2LOCALID(Succ),
|
121
|
+
TOKEN2LOCALID(Each),
|
122
|
+
TOKEN2LOCALID(Proc),
|
123
|
+
TOKEN2LOCALID(Lambda),
|
124
|
+
TOKEN2LOCALID(Send),
|
125
|
+
TOKEN2LOCALID(__send__),
|
126
|
+
TOKEN2LOCALID(Initialize),
|
127
|
+
TOKEN2LOCALID(Initialize_copy),
|
128
|
+
TOKEN2LOCALID(Initialize_clone),
|
129
|
+
TOKEN2LOCALID(Initialize_dup),
|
130
|
+
TOKEN2LOCALID(UScore),
|
131
|
+
tLAST_OP_ID = tPRESERVED_ID_END-1,
|
132
|
+
idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
|
133
|
+
};
|
134
|
+
|
135
|
+
#endif /* RUBY_ID_H */
|
@@ -0,0 +1,395 @@
|
|
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
|
+
|
22
|
+
#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
|
23
|
+
(a) == 0 ? 0 : \
|
24
|
+
(a) == -1 ? (b) < -(max) : \
|
25
|
+
(a) > 0 ? \
|
26
|
+
((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
|
27
|
+
((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
|
28
|
+
#define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
|
29
|
+
#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
|
30
|
+
|
31
|
+
struct rb_deprecated_classext_struct {
|
32
|
+
char conflict[sizeof(VALUE) * 3];
|
33
|
+
};
|
34
|
+
|
35
|
+
struct rb_classext_struct {
|
36
|
+
VALUE super;
|
37
|
+
struct st_table *iv_tbl;
|
38
|
+
struct st_table *const_tbl;
|
39
|
+
VALUE origin;
|
40
|
+
VALUE refined_class;
|
41
|
+
rb_alloc_func_t allocator;
|
42
|
+
};
|
43
|
+
|
44
|
+
#undef RCLASS_SUPER
|
45
|
+
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
|
46
|
+
#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super)
|
47
|
+
#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
|
48
|
+
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
|
49
|
+
#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
50
|
+
#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
|
51
|
+
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
|
52
|
+
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
|
53
|
+
|
54
|
+
struct vtm; /* defined by timev.h */
|
55
|
+
|
56
|
+
/* array.c */
|
57
|
+
VALUE rb_ary_last(int, VALUE *, VALUE);
|
58
|
+
void rb_ary_set_len(VALUE, long);
|
59
|
+
VALUE rb_ary_cat(VALUE, const VALUE *, long);
|
60
|
+
void rb_ary_delete_same(VALUE, VALUE);
|
61
|
+
|
62
|
+
/* bignum.c */
|
63
|
+
VALUE rb_big_fdiv(VALUE x, VALUE y);
|
64
|
+
VALUE rb_big_uminus(VALUE x);
|
65
|
+
VALUE rb_integer_float_cmp(VALUE x, VALUE y);
|
66
|
+
VALUE rb_integer_float_eq(VALUE x, VALUE y);
|
67
|
+
|
68
|
+
/* class.c */
|
69
|
+
VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj);
|
70
|
+
VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
|
71
|
+
VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
|
72
|
+
VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
|
73
|
+
int rb_obj_basic_to_s_p(VALUE);
|
74
|
+
VALUE rb_special_singleton_class(VALUE);
|
75
|
+
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
|
76
|
+
void Init_class_hierarchy(void);
|
77
|
+
|
78
|
+
/* compar.c */
|
79
|
+
VALUE rb_invcmp(VALUE, VALUE);
|
80
|
+
|
81
|
+
/* compile.c */
|
82
|
+
int rb_dvar_defined(ID);
|
83
|
+
int rb_local_defined(ID);
|
84
|
+
int rb_parse_in_eval(void);
|
85
|
+
int rb_parse_in_main(void);
|
86
|
+
const char * rb_insns_name(int i);
|
87
|
+
VALUE rb_insns_name_array(void);
|
88
|
+
|
89
|
+
/* cont.c */
|
90
|
+
VALUE rb_obj_is_fiber(VALUE);
|
91
|
+
void rb_fiber_reset_root_local_storage(VALUE);
|
92
|
+
|
93
|
+
/* debug.c */
|
94
|
+
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
|
95
|
+
|
96
|
+
/* dmyext.c */
|
97
|
+
void Init_ext(void);
|
98
|
+
|
99
|
+
/* encoding.c */
|
100
|
+
ID rb_id_encoding(void);
|
101
|
+
|
102
|
+
/* encoding.c */
|
103
|
+
void rb_gc_mark_encodings(void);
|
104
|
+
|
105
|
+
/* error.c */
|
106
|
+
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
|
107
|
+
VALUE rb_check_backtrace(VALUE);
|
108
|
+
NORETURN(void rb_async_bug_errno(const char *,int));
|
109
|
+
const char *rb_builtin_type_name(int t);
|
110
|
+
const char *rb_builtin_class_name(VALUE x);
|
111
|
+
|
112
|
+
/* eval.c */
|
113
|
+
VALUE rb_refinement_module_get_refined_class(VALUE module);
|
114
|
+
|
115
|
+
/* eval_error.c */
|
116
|
+
void ruby_error_print(void);
|
117
|
+
VALUE rb_get_backtrace(VALUE info);
|
118
|
+
|
119
|
+
/* eval_jump.c */
|
120
|
+
void rb_call_end_proc(VALUE data);
|
121
|
+
void rb_mark_end_proc(void);
|
122
|
+
|
123
|
+
/* file.c */
|
124
|
+
VALUE rb_home_dir(const char *user, VALUE result);
|
125
|
+
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
|
126
|
+
void rb_file_const(const char*, VALUE);
|
127
|
+
int rb_file_load_ok(const char *);
|
128
|
+
VALUE rb_file_expand_path_fast(VALUE, VALUE);
|
129
|
+
VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
|
130
|
+
VALUE rb_get_path_check_to_string(VALUE, int);
|
131
|
+
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
|
132
|
+
void Init_File(void);
|
133
|
+
|
134
|
+
#ifdef _WIN32
|
135
|
+
/* file.c, win32/file.c */
|
136
|
+
void rb_w32_init_file(void);
|
137
|
+
#endif
|
138
|
+
|
139
|
+
/* gc.c */
|
140
|
+
void Init_heap(void);
|
141
|
+
void *ruby_mimmalloc(size_t size);
|
142
|
+
|
143
|
+
/* inits.c */
|
144
|
+
void rb_call_inits(void);
|
145
|
+
|
146
|
+
/* io.c */
|
147
|
+
const char *ruby_get_inplace_mode(void);
|
148
|
+
void ruby_set_inplace_mode(const char *);
|
149
|
+
ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
|
150
|
+
void rb_stdio_set_default_encoding(void);
|
151
|
+
void rb_write_error_str(VALUE mesg);
|
152
|
+
|
153
|
+
/* iseq.c */
|
154
|
+
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
|
155
|
+
|
156
|
+
/* load.c */
|
157
|
+
VALUE rb_get_load_path(void);
|
158
|
+
VALUE rb_get_expanded_load_path(void);
|
159
|
+
NORETURN(void rb_load_fail(VALUE, const char*));
|
160
|
+
|
161
|
+
/* math.c */
|
162
|
+
VALUE rb_math_atan2(VALUE, VALUE);
|
163
|
+
VALUE rb_math_cos(VALUE);
|
164
|
+
VALUE rb_math_cosh(VALUE);
|
165
|
+
VALUE rb_math_exp(VALUE);
|
166
|
+
VALUE rb_math_hypot(VALUE, VALUE);
|
167
|
+
VALUE rb_math_log(int argc, VALUE *argv);
|
168
|
+
VALUE rb_math_sin(VALUE);
|
169
|
+
VALUE rb_math_sinh(VALUE);
|
170
|
+
VALUE rb_math_sqrt(VALUE);
|
171
|
+
|
172
|
+
/* newline.c */
|
173
|
+
void Init_newline(void);
|
174
|
+
|
175
|
+
/* numeric.c */
|
176
|
+
int rb_num_to_uint(VALUE val, unsigned int *ret);
|
177
|
+
VALUE num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
|
178
|
+
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
|
179
|
+
double ruby_float_mod(double x, double y);
|
180
|
+
int rb_num_negative_p(VALUE);
|
181
|
+
VALUE rb_int_succ(VALUE num);
|
182
|
+
VALUE rb_int_pred(VALUE num);
|
183
|
+
|
184
|
+
/* object.c */
|
185
|
+
void rb_obj_copy_ivar(VALUE dest, VALUE obj);
|
186
|
+
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
|
187
|
+
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
|
188
|
+
|
189
|
+
/* parse.y */
|
190
|
+
VALUE rb_parser_get_yydebug(VALUE);
|
191
|
+
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
192
|
+
int rb_is_const_name(VALUE name);
|
193
|
+
int rb_is_class_name(VALUE name);
|
194
|
+
int rb_is_global_name(VALUE name);
|
195
|
+
int rb_is_instance_name(VALUE name);
|
196
|
+
int rb_is_attrset_name(VALUE name);
|
197
|
+
int rb_is_local_name(VALUE name);
|
198
|
+
int rb_is_method_name(VALUE name);
|
199
|
+
int rb_is_junk_name(VALUE name);
|
200
|
+
void rb_gc_mark_parser(void);
|
201
|
+
void rb_gc_mark_symbols(void);
|
202
|
+
|
203
|
+
/* proc.c */
|
204
|
+
VALUE rb_proc_location(VALUE self);
|
205
|
+
st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
|
206
|
+
|
207
|
+
/* process.c */
|
208
|
+
#define RB_MAX_GROUPS (65536)
|
209
|
+
|
210
|
+
struct rb_execarg {
|
211
|
+
int use_shell;
|
212
|
+
union {
|
213
|
+
struct {
|
214
|
+
VALUE shell_script;
|
215
|
+
} sh;
|
216
|
+
struct {
|
217
|
+
VALUE command_name;
|
218
|
+
VALUE command_abspath; /* full path string or nil */
|
219
|
+
VALUE argv_str;
|
220
|
+
VALUE argv_buf;
|
221
|
+
} cmd;
|
222
|
+
} invoke;
|
223
|
+
VALUE redirect_fds;
|
224
|
+
VALUE envp_str;
|
225
|
+
VALUE envp_buf;
|
226
|
+
VALUE dup2_tmpbuf;
|
227
|
+
unsigned pgroup_given : 1;
|
228
|
+
unsigned umask_given : 1;
|
229
|
+
unsigned unsetenv_others_given : 1;
|
230
|
+
unsigned unsetenv_others_do : 1;
|
231
|
+
unsigned close_others_given : 1;
|
232
|
+
unsigned close_others_do : 1;
|
233
|
+
unsigned chdir_given : 1;
|
234
|
+
unsigned new_pgroup_given : 1;
|
235
|
+
unsigned new_pgroup_flag : 1;
|
236
|
+
unsigned uid_given : 1;
|
237
|
+
unsigned gid_given : 1;
|
238
|
+
rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
|
239
|
+
VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
|
240
|
+
mode_t umask_mask;
|
241
|
+
rb_uid_t uid;
|
242
|
+
rb_gid_t gid;
|
243
|
+
VALUE fd_dup2;
|
244
|
+
VALUE fd_close;
|
245
|
+
VALUE fd_open;
|
246
|
+
VALUE fd_dup2_child;
|
247
|
+
int close_others_maxhint;
|
248
|
+
VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
|
249
|
+
VALUE chdir_dir;
|
250
|
+
};
|
251
|
+
|
252
|
+
/* argv_str contains extra two elements.
|
253
|
+
* The beginning one is for /bin/sh used by exec_with_sh.
|
254
|
+
* The last one for terminating NULL used by execve.
|
255
|
+
* See rb_exec_fillarg() in process.c. */
|
256
|
+
#define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
|
257
|
+
#define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
|
258
|
+
|
259
|
+
rb_pid_t rb_fork_ruby(int *status);
|
260
|
+
void rb_last_status_clear(void);
|
261
|
+
|
262
|
+
/* rational.c */
|
263
|
+
VALUE rb_lcm(VALUE x, VALUE y);
|
264
|
+
VALUE rb_rational_reciprocal(VALUE x);
|
265
|
+
|
266
|
+
/* re.c */
|
267
|
+
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
|
268
|
+
VALUE rb_reg_check_preprocess(VALUE);
|
269
|
+
|
270
|
+
/* signal.c */
|
271
|
+
int rb_get_next_signal(void);
|
272
|
+
int rb_sigaltstack_size(void);
|
273
|
+
|
274
|
+
/* strftime.c */
|
275
|
+
#ifdef RUBY_ENCODING_H
|
276
|
+
size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
|
277
|
+
const struct vtm *vtm, struct timespec *ts, int gmt);
|
278
|
+
size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
|
279
|
+
const struct vtm *vtm, VALUE timev, int gmt);
|
280
|
+
#endif
|
281
|
+
|
282
|
+
/* string.c */
|
283
|
+
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
|
284
|
+
int rb_str_symname_p(VALUE);
|
285
|
+
VALUE rb_str_quote_unprintable(VALUE);
|
286
|
+
VALUE rb_id_quote_unprintable(ID);
|
287
|
+
#define QUOTE(str) rb_str_quote_unprintable(str)
|
288
|
+
#define QUOTE_ID(id) rb_id_quote_unprintable(id)
|
289
|
+
VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
|
290
|
+
|
291
|
+
/* struct.c */
|
292
|
+
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
|
293
|
+
|
294
|
+
/* time.c */
|
295
|
+
struct timeval rb_time_timeval(VALUE);
|
296
|
+
|
297
|
+
/* thread.c */
|
298
|
+
VALUE rb_obj_is_mutex(VALUE obj);
|
299
|
+
VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
|
300
|
+
void rb_thread_execute_interrupts(VALUE th);
|
301
|
+
void rb_clear_trace_func(void);
|
302
|
+
VALUE rb_get_coverages(void);
|
303
|
+
VALUE rb_thread_shield_new(void);
|
304
|
+
VALUE rb_thread_shield_wait(VALUE self);
|
305
|
+
VALUE rb_thread_shield_release(VALUE self);
|
306
|
+
VALUE rb_thread_shield_destroy(VALUE self);
|
307
|
+
void rb_mutex_allow_trap(VALUE self, int val);
|
308
|
+
VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
|
309
|
+
VALUE rb_mutex_owned_p(VALUE self);
|
310
|
+
|
311
|
+
/* thread_pthread.c, thread_win32.c */
|
312
|
+
void Init_native_thread(void);
|
313
|
+
|
314
|
+
/* vm.c */
|
315
|
+
VALUE rb_obj_is_thread(VALUE obj);
|
316
|
+
void rb_vm_mark(void *ptr);
|
317
|
+
void Init_BareVM(void);
|
318
|
+
VALUE rb_vm_top_self(void);
|
319
|
+
void rb_thread_recycle_stack_release(VALUE *);
|
320
|
+
void rb_vm_change_state(void);
|
321
|
+
void rb_vm_inc_const_missing_count(void);
|
322
|
+
void rb_thread_mark(void *th);
|
323
|
+
const void **rb_vm_get_insns_address_table(void);
|
324
|
+
VALUE rb_sourcefilename(void);
|
325
|
+
void rb_vm_pop_cfunc_frame(void);
|
326
|
+
|
327
|
+
/* vm_dump.c */
|
328
|
+
void rb_vm_bugreport(void);
|
329
|
+
|
330
|
+
/* vm_eval.c */
|
331
|
+
void Init_vm_eval(void);
|
332
|
+
VALUE rb_current_realfilepath(void);
|
333
|
+
VALUE rb_check_block_call(VALUE, ID, int, VALUE *, VALUE (*)(ANYARGS), VALUE);
|
334
|
+
typedef void rb_check_funcall_hook(int, VALUE, ID, int, VALUE *, VALUE);
|
335
|
+
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, VALUE *argv,
|
336
|
+
rb_check_funcall_hook *hook, VALUE arg);
|
337
|
+
|
338
|
+
/* vm_method.c */
|
339
|
+
void Init_eval_method(void);
|
340
|
+
int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
|
341
|
+
|
342
|
+
/* miniprelude.c, prelude.c */
|
343
|
+
void Init_prelude(void);
|
344
|
+
|
345
|
+
/* vm_backtrace.c */
|
346
|
+
void Init_vm_backtrace(void);
|
347
|
+
VALUE vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
|
348
|
+
VALUE vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
|
349
|
+
|
350
|
+
VALUE rb_make_backtrace(void);
|
351
|
+
void rb_backtrace_print_as_bugreport(void);
|
352
|
+
int rb_backtrace_p(VALUE obj);
|
353
|
+
VALUE rb_backtrace_to_str_ary(VALUE obj);
|
354
|
+
VALUE rb_vm_backtrace_object();
|
355
|
+
|
356
|
+
#if defined __GNUC__ && __GNUC__ >= 4
|
357
|
+
#pragma GCC visibility push(default)
|
358
|
+
#endif
|
359
|
+
const char *rb_objspace_data_type_name(VALUE obj);
|
360
|
+
|
361
|
+
/* Temporary. This API will be removed (renamed). */
|
362
|
+
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
|
363
|
+
|
364
|
+
/* io.c */
|
365
|
+
void rb_maygvl_fd_fix_cloexec(int fd);
|
366
|
+
|
367
|
+
/* process.c */
|
368
|
+
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
|
369
|
+
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);
|
370
|
+
VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
|
371
|
+
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
372
|
+
VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
|
373
|
+
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
|
374
|
+
void rb_execarg_fixup(VALUE execarg_obj);
|
375
|
+
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
|
376
|
+
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
|
377
|
+
void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
|
378
|
+
|
379
|
+
/* variable.c */
|
380
|
+
void rb_gc_mark_global_tbl(void);
|
381
|
+
void rb_mark_generic_ivar(VALUE);
|
382
|
+
void rb_mark_generic_ivar_tbl(void);
|
383
|
+
|
384
|
+
#if defined __GNUC__ && __GNUC__ >= 4
|
385
|
+
#pragma GCC visibility pop
|
386
|
+
#endif
|
387
|
+
|
388
|
+
#if defined(__cplusplus)
|
389
|
+
#if 0
|
390
|
+
{ /* satisfy cc-mode */
|
391
|
+
#endif
|
392
|
+
} /* extern "C" { */
|
393
|
+
#endif
|
394
|
+
|
395
|
+
#endif /* RUBY_INTERNAL_H */
|