looksee 1.0.0-universal-java-1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +14 -0
- data/LICENSE +22 -0
- data/README.markdown +161 -0
- data/Rakefile +10 -0
- data/ext/extconf.rb +9 -0
- data/ext/mri/1.9.2/debug.h +36 -0
- data/ext/mri/1.9.2/id.h +170 -0
- data/ext/mri/1.9.2/method.h +103 -0
- data/ext/mri/1.9.2/node.h +483 -0
- data/ext/mri/1.9.2/thread_pthread.h +27 -0
- data/ext/mri/1.9.2/vm_core.h +707 -0
- data/ext/mri/1.9.2/vm_opts.h +51 -0
- data/ext/mri/env-1.8.h +27 -0
- data/ext/mri/eval_c-1.8.h +27 -0
- data/ext/mri/mri.c +269 -0
- data/ext/mri/node-1.9.h +35 -0
- data/ext/rbx/rbx.c +13 -0
- data/lib/looksee.rb +5 -0
- data/lib/looksee/adapter.rb +10 -0
- data/lib/looksee/adapter/base.rb +100 -0
- data/lib/looksee/adapter/rubinius.rb +73 -0
- data/lib/looksee/clean.rb +122 -0
- data/lib/looksee/columnizer.rb +73 -0
- data/lib/looksee/core_ext.rb +59 -0
- data/lib/looksee/editor.rb +58 -0
- data/lib/looksee/help.rb +54 -0
- data/lib/looksee/inspector.rb +55 -0
- data/lib/looksee/jruby.jar +0 -0
- data/lib/looksee/lookup_path.rb +95 -0
- data/lib/looksee/rbx.bundle +0 -0
- data/lib/looksee/shortcuts.rb +3 -0
- data/lib/looksee/version.rb +11 -0
- data/lib/looksee/wirble_compatibility.rb +86 -0
- data/spec/adapter_spec.rb +546 -0
- data/spec/columnizer_spec.rb +52 -0
- data/spec/core_ext_spec.rb +41 -0
- data/spec/editor_spec.rb +128 -0
- data/spec/inspector_spec.rb +178 -0
- data/spec/lookup_path_spec.rb +84 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/core_ext.rb +25 -0
- data/spec/support/temporary_classes.rb +102 -0
- data/spec/support/test_adapter.rb +72 -0
- data/spec/wirble_compatibility_spec.rb +116 -0
- metadata +158 -0
data/CHANGELOG
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
== 1.0.0 2011-03-09
|
2
|
+
|
3
|
+
* New API.
|
4
|
+
* old: lp(object, :private => true, :undefined => false).grep(/blah/)
|
5
|
+
* new: object.ls :private, :noundefined, /blah/
|
6
|
+
* Configuration has changed accordingly.
|
7
|
+
* old: Looksee.default_lookup_path_options = {:private => true, :undefined => false}
|
8
|
+
* new: Looksee.default_specifiers = [:private, :noundefined]
|
9
|
+
* Require 'looksee' instead of 'looksee/shortcuts'. For
|
10
|
+
non-pollutiness, use "require 'looksee/clean'".
|
11
|
+
* All methods are now listed by default.
|
12
|
+
* Modules are now listed root class first.
|
13
|
+
* Support for Ruby MRI 1.9, JRuby, and Rubinius.
|
14
|
+
* Add Object#edit(METHOD), to open Object#METHOD in your text editor.
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) George Ogata
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
# Looksee
|
2
|
+
|
3
|
+
A tool for illustrating the ancestry and method lookup path of
|
4
|
+
objects. Great for exploring unfamiliar codebases!
|
5
|
+
|
6
|
+
## How
|
7
|
+
|
8
|
+
Install me:
|
9
|
+
|
10
|
+
gem install looksee
|
11
|
+
|
12
|
+
Pop this in your `.irbrc`:
|
13
|
+
|
14
|
+
require 'looksee'
|
15
|
+
|
16
|
+
Now each object has a method `ls`, which shows you all its methods.
|
17
|
+
|
18
|
+
irb> [].ls
|
19
|
+
=> BasicObject
|
20
|
+
! __send__ instance_eval singleton_method_added
|
21
|
+
!= equal? instance_exec singleton_method_removed
|
22
|
+
== initialize method_missing singleton_method_undefined
|
23
|
+
Kernel
|
24
|
+
!~ freeze puts
|
25
|
+
<=> frozen? raise
|
26
|
+
=== gem rand
|
27
|
+
=~ gem_original_require readline
|
28
|
+
Array gets readlines
|
29
|
+
Complex global_variables remove_instance_variable
|
30
|
+
Float hash require
|
31
|
+
Integer initialize_clone require_relative
|
32
|
+
Rational initialize_copy respond_to?
|
33
|
+
String initialize_dup respond_to_missing?
|
34
|
+
URI inspect select
|
35
|
+
__callee__ instance_of? send
|
36
|
+
__id__ instance_variable_defined? set_trace_func
|
37
|
+
__method__ instance_variable_get singleton_class
|
38
|
+
` instance_variable_set singleton_methods
|
39
|
+
abort instance_variables sleep
|
40
|
+
at_exit is_a? spawn
|
41
|
+
autoload iterator? sprintf
|
42
|
+
autoload? kind_of? srand
|
43
|
+
binding lambda syscall
|
44
|
+
block_given? load system
|
45
|
+
caller local_variables taint
|
46
|
+
catch loop tainted?
|
47
|
+
class method tap
|
48
|
+
clone methods test
|
49
|
+
define_singleton_method nil? throw
|
50
|
+
display object_id to_enum
|
51
|
+
dup open to_s
|
52
|
+
enum_for p trace_var
|
53
|
+
eql? print trap
|
54
|
+
eval printf trust
|
55
|
+
exec private_methods untaint
|
56
|
+
exit proc untrace_var
|
57
|
+
exit! protected_methods untrust
|
58
|
+
extend public_method untrusted?
|
59
|
+
fail public_methods warn
|
60
|
+
fork public_send y
|
61
|
+
format putc
|
62
|
+
Looksee::ObjectMixin
|
63
|
+
edit ls
|
64
|
+
Object
|
65
|
+
default_src_encoding oauth taguri to_yaml_properties
|
66
|
+
in? patch taguri= to_yaml_style
|
67
|
+
irb_binding singleton_class timeout
|
68
|
+
load_if_available syck_to_yaml to_yaml
|
69
|
+
Enumerable
|
70
|
+
all? drop_while first min select
|
71
|
+
any? each_cons flat_map min_by slice_before
|
72
|
+
by each_entry grep minmax sort
|
73
|
+
chunk each_slice group_by minmax_by sort_by
|
74
|
+
collect each_with_index include? none? take
|
75
|
+
collect_concat each_with_object inject one? take_while
|
76
|
+
count entries map partition to_a
|
77
|
+
cycle find max reduce to_set
|
78
|
+
detect find_all max_by reject zip
|
79
|
+
drop find_index member? reverse_each
|
80
|
+
Array
|
81
|
+
& drop_while map! size
|
82
|
+
* each pack slice
|
83
|
+
+ each_index permutation slice!
|
84
|
+
- empty? pop sort
|
85
|
+
<< eql? product sort!
|
86
|
+
<=> fetch push sort_by!
|
87
|
+
== fill rassoc taguri
|
88
|
+
[] find_index reject taguri=
|
89
|
+
[]= first reject! take
|
90
|
+
assoc flatten repeated_combination take_while
|
91
|
+
at flatten! repeated_permutation to_a
|
92
|
+
clear frozen? replace to_ary
|
93
|
+
collect hash reverse to_s
|
94
|
+
collect! include? reverse! to_yaml
|
95
|
+
combination index reverse_each transpose
|
96
|
+
compact initialize rindex uniq
|
97
|
+
compact! initialize_copy rotate uniq!
|
98
|
+
concat insert rotate! unshift
|
99
|
+
count inspect sample values_at
|
100
|
+
cycle join select yaml_initialize
|
101
|
+
delete keep_if select! zip
|
102
|
+
delete_at last shift |
|
103
|
+
delete_if length shuffle
|
104
|
+
drop map shuffle!
|
105
|
+
|
106
|
+
Methods are colored according to whether they're public, protected,
|
107
|
+
private, undefined (using Module#undef_method), or overridden.
|
108
|
+
|
109
|
+
You can hide, say, private methods like this:
|
110
|
+
|
111
|
+
irb> [].ls :noprivate
|
112
|
+
|
113
|
+
Or filter the list by Regexp:
|
114
|
+
|
115
|
+
irb> [].ls /^to_/
|
116
|
+
=> BasicObject
|
117
|
+
Kernel
|
118
|
+
to_enum to_s
|
119
|
+
Looksee::ObjectMixin
|
120
|
+
Object
|
121
|
+
to_yaml to_yaml_properties to_yaml_style
|
122
|
+
Enumerable
|
123
|
+
to_a to_set
|
124
|
+
Array
|
125
|
+
to_a to_ary to_s to_yaml
|
126
|
+
|
127
|
+
And if you want to know more about any of those methods, Looksee can
|
128
|
+
take you straight to the source in your editor:
|
129
|
+
|
130
|
+
> [].edit('to_set')
|
131
|
+
|
132
|
+
By default, this uses `vi`; customize it like this:
|
133
|
+
|
134
|
+
# %f = file, %l = line number
|
135
|
+
Looksee.editor = "mate -l%l %f"
|
136
|
+
|
137
|
+
See more in the quick reference:
|
138
|
+
|
139
|
+
irb> Looksee.help
|
140
|
+
|
141
|
+
Enjoy!
|
142
|
+
|
143
|
+
## Support
|
144
|
+
|
145
|
+
Looksee works with:
|
146
|
+
|
147
|
+
* MRI/REE (>= 1.8.6)
|
148
|
+
* JRuby (>= 1.5.6)
|
149
|
+
* Rubinius (>= 1.2.1)
|
150
|
+
|
151
|
+
## Contributing
|
152
|
+
|
153
|
+
* [Bug reports](https://github.com/oggy/looksee/issues)
|
154
|
+
* [Source](https://github.com/oggy/looksee)
|
155
|
+
* Patches: Fork on Github, send pull request.
|
156
|
+
* Include tests where practical.
|
157
|
+
* Leave the version alone, or bump it in a separate commit.
|
158
|
+
|
159
|
+
## Copyright
|
160
|
+
|
161
|
+
Copyright (c) George Ogata. See LICENSE for details.
|
data/Rakefile
ADDED
data/ext/extconf.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
ruby_engine = Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'mri'
|
2
|
+
extension = ruby_engine == 'ruby' ? 'mri' : ruby_engine
|
3
|
+
|
4
|
+
require 'mkmf'
|
5
|
+
$CPPFLAGS << " -DRUBY_VERSION=#{RUBY_VERSION.tr('.', '')}"
|
6
|
+
if extension == 'mri'
|
7
|
+
$CPPFLAGS << " -Imri/1.9.2" if RUBY_VERSION >= '1.9.2'
|
8
|
+
end
|
9
|
+
create_makefile "looksee/#{extension}", extension
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
debug.h - YARV Debug function interface
|
4
|
+
|
5
|
+
$Author: akr $
|
6
|
+
created at: 04/08/25 02:33:49 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_DEBUG_H
|
13
|
+
#define RUBY_DEBUG_H
|
14
|
+
|
15
|
+
#include "ruby/ruby.h"
|
16
|
+
#include "node.h"
|
17
|
+
|
18
|
+
#define dpv(h,v) ruby_debug_print_value(-1, 0, h, v)
|
19
|
+
#define dp(v) ruby_debug_print_value(-1, 0, "", v)
|
20
|
+
#define dpi(i) ruby_debug_print_id(-1, 0, "", i)
|
21
|
+
#define dpn(n) ruby_debug_print_node(-1, 0, "", n)
|
22
|
+
|
23
|
+
#define bp() ruby_debug_breakpoint()
|
24
|
+
|
25
|
+
VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
|
26
|
+
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
|
27
|
+
NODE *ruby_debug_print_node(int level, int debug_level, const char *header, const NODE *node);
|
28
|
+
int ruby_debug_print_indent(int level, int debug_level, int indent_level);
|
29
|
+
void ruby_debug_breakpoint(void);
|
30
|
+
void ruby_debug_gc_check_func(void);
|
31
|
+
|
32
|
+
#ifdef RUBY_DEBUG_ENV
|
33
|
+
void ruby_set_debug_option(const char *str);
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#endif /* RUBY_DEBUG_H */
|
data/ext/mri/1.9.2/id.h
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
/* DO NOT EDIT THIS FILE DIRECTLY */
|
2
|
+
/**********************************************************************
|
3
|
+
|
4
|
+
id.h -
|
5
|
+
|
6
|
+
$Author: akr $
|
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
|
+
#ifdef USE_PARSE_H
|
28
|
+
#include "parse.h"
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#define symIFUNC ID2SYM(idIFUNC)
|
32
|
+
#define symCFUNC ID2SYM(idCFUNC)
|
33
|
+
|
34
|
+
#if !defined tLAST_TOKEN && defined YYTOKENTYPE
|
35
|
+
#define tLAST_TOKEN tLAST_TOKEN
|
36
|
+
#endif
|
37
|
+
|
38
|
+
enum ruby_method_ids {
|
39
|
+
#ifndef tLAST_TOKEN
|
40
|
+
tUPLUS = 321,
|
41
|
+
tUMINUS = 322,
|
42
|
+
tPOW = 323,
|
43
|
+
tCMP = 324,
|
44
|
+
tEQ = 325,
|
45
|
+
tEQQ = 326,
|
46
|
+
tNEQ = 327,
|
47
|
+
tGEQ = 328,
|
48
|
+
tLEQ = 329,
|
49
|
+
tANDOP = 330,
|
50
|
+
tOROP = 331,
|
51
|
+
tMATCH = 332,
|
52
|
+
tNMATCH = 333,
|
53
|
+
tDOT2 = 334,
|
54
|
+
tDOT3 = 335,
|
55
|
+
tAREF = 336,
|
56
|
+
tASET = 337,
|
57
|
+
tLSHFT = 338,
|
58
|
+
tRSHFT = 339,
|
59
|
+
tLAMBDA = 352,
|
60
|
+
idNULL = 365,
|
61
|
+
idRespond_to = 366,
|
62
|
+
idIFUNC = 367,
|
63
|
+
idCFUNC = 368,
|
64
|
+
id_core_set_method_alias = 369,
|
65
|
+
id_core_set_variable_alias = 370,
|
66
|
+
id_core_undef_method = 371,
|
67
|
+
id_core_define_method = 372,
|
68
|
+
id_core_define_singleton_method = 373,
|
69
|
+
id_core_set_postexe = 374,
|
70
|
+
tLAST_TOKEN = 375,
|
71
|
+
#endif
|
72
|
+
idDot2 = tDOT2,
|
73
|
+
idDot3 = tDOT3,
|
74
|
+
idUPlus = tUPLUS,
|
75
|
+
idUMinus = tUMINUS,
|
76
|
+
idPow = tPOW,
|
77
|
+
idCmp = tCMP,
|
78
|
+
idPLUS = '+',
|
79
|
+
idMINUS = '-',
|
80
|
+
idMULT = '*',
|
81
|
+
idDIV = '/',
|
82
|
+
idMOD = '%',
|
83
|
+
idLT = '<',
|
84
|
+
idLTLT = tLSHFT,
|
85
|
+
idLE = tLEQ,
|
86
|
+
idGT = '>',
|
87
|
+
idGE = tGEQ,
|
88
|
+
idEq = tEQ,
|
89
|
+
idEqq = tEQQ,
|
90
|
+
idNeq = tNEQ,
|
91
|
+
idNot = '!',
|
92
|
+
idBackquote = '`',
|
93
|
+
idEqTilde = tMATCH,
|
94
|
+
idNeqTilde = tNMATCH,
|
95
|
+
idAREF = tAREF,
|
96
|
+
idASET = tASET,
|
97
|
+
idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
|
98
|
+
tIntern,
|
99
|
+
tMethodMissing,
|
100
|
+
tLength,
|
101
|
+
tSize,
|
102
|
+
tGets,
|
103
|
+
tSucc,
|
104
|
+
tEach,
|
105
|
+
tLambda,
|
106
|
+
tSend,
|
107
|
+
t__send__,
|
108
|
+
tInitialize,
|
109
|
+
#if SUPPORT_JOKE
|
110
|
+
tBitblt,
|
111
|
+
tAnswer,
|
112
|
+
#endif
|
113
|
+
tLAST_ID,
|
114
|
+
#define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
115
|
+
#if SUPPORT_JOKE
|
116
|
+
TOKEN2ID(Bitblt),
|
117
|
+
TOKEN2ID(Answer),
|
118
|
+
#endif
|
119
|
+
TOKEN2ID(Intern),
|
120
|
+
TOKEN2ID(MethodMissing),
|
121
|
+
TOKEN2ID(Length),
|
122
|
+
TOKEN2ID(Size),
|
123
|
+
TOKEN2ID(Gets),
|
124
|
+
TOKEN2ID(Succ),
|
125
|
+
TOKEN2ID(Each),
|
126
|
+
TOKEN2ID(Lambda),
|
127
|
+
TOKEN2ID(Send),
|
128
|
+
TOKEN2ID(__send__),
|
129
|
+
TOKEN2ID(Initialize)
|
130
|
+
};
|
131
|
+
|
132
|
+
#ifdef tLAST_TOKEN
|
133
|
+
struct ruby_method_ids_check {
|
134
|
+
#define ruby_method_id_check_for(name, value) \
|
135
|
+
int checking_for_##name[name == value ? 1 : -1]
|
136
|
+
ruby_method_id_check_for(tUPLUS, 321);
|
137
|
+
ruby_method_id_check_for(tUMINUS, 322);
|
138
|
+
ruby_method_id_check_for(tPOW, 323);
|
139
|
+
ruby_method_id_check_for(tCMP, 324);
|
140
|
+
ruby_method_id_check_for(tEQ, 325);
|
141
|
+
ruby_method_id_check_for(tEQQ, 326);
|
142
|
+
ruby_method_id_check_for(tNEQ, 327);
|
143
|
+
ruby_method_id_check_for(tGEQ, 328);
|
144
|
+
ruby_method_id_check_for(tLEQ, 329);
|
145
|
+
ruby_method_id_check_for(tANDOP, 330);
|
146
|
+
ruby_method_id_check_for(tOROP, 331);
|
147
|
+
ruby_method_id_check_for(tMATCH, 332);
|
148
|
+
ruby_method_id_check_for(tNMATCH, 333);
|
149
|
+
ruby_method_id_check_for(tDOT2, 334);
|
150
|
+
ruby_method_id_check_for(tDOT3, 335);
|
151
|
+
ruby_method_id_check_for(tAREF, 336);
|
152
|
+
ruby_method_id_check_for(tASET, 337);
|
153
|
+
ruby_method_id_check_for(tLSHFT, 338);
|
154
|
+
ruby_method_id_check_for(tRSHFT, 339);
|
155
|
+
ruby_method_id_check_for(tLAMBDA, 352);
|
156
|
+
ruby_method_id_check_for(idNULL, 365);
|
157
|
+
ruby_method_id_check_for(idRespond_to, 366);
|
158
|
+
ruby_method_id_check_for(idIFUNC, 367);
|
159
|
+
ruby_method_id_check_for(idCFUNC, 368);
|
160
|
+
ruby_method_id_check_for(id_core_set_method_alias, 369);
|
161
|
+
ruby_method_id_check_for(id_core_set_variable_alias, 370);
|
162
|
+
ruby_method_id_check_for(id_core_undef_method, 371);
|
163
|
+
ruby_method_id_check_for(id_core_define_method, 372);
|
164
|
+
ruby_method_id_check_for(id_core_define_singleton_method, 373);
|
165
|
+
ruby_method_id_check_for(id_core_set_postexe, 374);
|
166
|
+
ruby_method_id_check_for(tLAST_TOKEN, 375);
|
167
|
+
};
|
168
|
+
#endif
|
169
|
+
|
170
|
+
#endif /* RUBY_ID_H */
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
method.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: Wed Jul 15 20:02:33 2009
|
7
|
+
|
8
|
+
Copyright (C) 2009 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
#ifndef METHOD_H
|
12
|
+
#define METHOD_H
|
13
|
+
|
14
|
+
typedef enum {
|
15
|
+
NOEX_PUBLIC = 0x00,
|
16
|
+
NOEX_NOSUPER = 0x01,
|
17
|
+
NOEX_PRIVATE = 0x02,
|
18
|
+
NOEX_PROTECTED = 0x04,
|
19
|
+
NOEX_MASK = 0x06,
|
20
|
+
NOEX_BASIC = 0x08,
|
21
|
+
NOEX_UNDEF = NOEX_NOSUPER,
|
22
|
+
NOEX_MODFUNC = 0x12,
|
23
|
+
NOEX_SUPER = 0x20,
|
24
|
+
NOEX_VCALL = 0x40,
|
25
|
+
NOEX_RESPONDS = 0x80
|
26
|
+
} rb_method_flag_t;
|
27
|
+
|
28
|
+
#define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
|
29
|
+
#define NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
|
30
|
+
#define NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
|
31
|
+
|
32
|
+
/* method data type */
|
33
|
+
|
34
|
+
typedef enum {
|
35
|
+
VM_METHOD_TYPE_ISEQ,
|
36
|
+
VM_METHOD_TYPE_CFUNC,
|
37
|
+
VM_METHOD_TYPE_ATTRSET,
|
38
|
+
VM_METHOD_TYPE_IVAR,
|
39
|
+
VM_METHOD_TYPE_BMETHOD,
|
40
|
+
VM_METHOD_TYPE_ZSUPER,
|
41
|
+
VM_METHOD_TYPE_UNDEF,
|
42
|
+
VM_METHOD_TYPE_NOTIMPLEMENTED,
|
43
|
+
VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
|
44
|
+
VM_METHOD_TYPE_MISSING /* wrapper for method_missing(id) */
|
45
|
+
} rb_method_type_t;
|
46
|
+
|
47
|
+
typedef struct rb_method_cfunc_struct {
|
48
|
+
VALUE (*func)(ANYARGS);
|
49
|
+
int argc;
|
50
|
+
} rb_method_cfunc_t;
|
51
|
+
|
52
|
+
typedef struct rb_method_attr_struct {
|
53
|
+
ID id;
|
54
|
+
VALUE location;
|
55
|
+
} rb_method_attr_t;
|
56
|
+
|
57
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
58
|
+
|
59
|
+
typedef struct rb_method_definition_struct {
|
60
|
+
rb_method_type_t type; /* method type */
|
61
|
+
ID original_id;
|
62
|
+
union {
|
63
|
+
rb_iseq_t *iseq; /* should be mark */
|
64
|
+
rb_method_cfunc_t cfunc;
|
65
|
+
rb_method_attr_t attr;
|
66
|
+
VALUE proc; /* should be mark */
|
67
|
+
enum method_optimized_type {
|
68
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
69
|
+
OPTIMIZED_METHOD_TYPE_CALL
|
70
|
+
} optimize_type;
|
71
|
+
} body;
|
72
|
+
int alias_count;
|
73
|
+
} rb_method_definition_t;
|
74
|
+
|
75
|
+
typedef struct rb_method_entry_struct {
|
76
|
+
rb_method_flag_t flag;
|
77
|
+
char mark;
|
78
|
+
rb_method_definition_t *def;
|
79
|
+
ID called_id;
|
80
|
+
VALUE klass; /* should be mark */
|
81
|
+
} rb_method_entry_t;
|
82
|
+
|
83
|
+
struct unlinked_method_entry_list_entry {
|
84
|
+
struct unlinked_method_entry_list_entry *next;
|
85
|
+
rb_method_entry_t *me;
|
86
|
+
};
|
87
|
+
|
88
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
89
|
+
|
90
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
|
91
|
+
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
|
92
|
+
rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
|
93
|
+
|
94
|
+
rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id);
|
95
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
|
96
|
+
|
97
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
98
|
+
|
99
|
+
void rb_mark_method_entry(const rb_method_entry_t *me);
|
100
|
+
void rb_free_method_entry(rb_method_entry_t *me);
|
101
|
+
void rb_sweep_method_entry(void *vm);
|
102
|
+
|
103
|
+
#endif /* METHOD_H */
|