Top Level Namespace
- Includes:
- Internal
Defined Under Namespace
Modules: Internal, Kernel, M, Marshal, MethodAsCode, MethodAsExpression, MethodOrigin, MethodSig, Noex, Tag Classes: Bar, Baz, Binding, Foo, Method, Module, ModulePlaceholder, Node, NodeType, NodeVersionRange, Node_Type_Descrip, Nodes, Object, Proc, RubyVM, SetupError, Thread, UnboundMethod, UnboundProc
Constant Summary collapse
- RUBY_SOURCE_DIR =
ruby_source_path
- RUBY_INCLUDE_DIR =
config['ruby-include-path']
- USING_CACHED_FILES =
the user did specify the source path
false
- NODE_H_LOCATION =
"#{RUBY_INCLUDE_DIR}/node.h"
- NODE_H_ALT_LOCATION =
"#{RUBY_SOURCE_DIR}/node.h"
- NODEINFO =
Hash.new
- NODE_TYPE_DESCRIPS =
[]
- NEN_TO_NODE_TYPE =
{}
Instance Method Summary collapse
- #create_ruby_internal_makefile(name) ⇒ Object
-
#foo(foo, bar = [1,2], *args, &block) ⇒ Object
def foo; @@foo = 1; end def foo; a = [2, 3]; foo(1, *a); end def foo; not true; end def foo; catch(:foo) { throw :foo; 42 }; end def foo; a ? b : c; end def foo; loop { a = 1; break }; end def foo; ::BAR; end def foo; a != b; end def foo; 1 - 2; end def foo; +a; end def foo; !a; end def foo; a << b; end def foo; a === b; end def foo; []; end.
- #open_alt(*files, &block) ⇒ Object
Methods included from Internal
Instance Method Details
#create_ruby_internal_makefile(name) ⇒ Object
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 |
# File 'ext/mkmf-ruby-internal.rb', line 29 def create_ruby_internal_makefile(name) rb_files = Dir['*.rb'] rpp_files = Dir['*.rpp'] generated_files = rpp_files.map { |f| f.sub(/\.rpp$/, '') } # Append the generated C files to the list of source files srcs = Dir['*.c'] generated_files.each do |f| if f =~ /\.c$/ then srcs << f end end srcs.uniq! $objs = srcs.map { |f| f.sub(/\.c$/, ".#{$OBJEXT}") } # Turn on warnings and debugging by default on gcc if CONFIG['CC'] == 'gcc' then $CFLAGS << ' -Wall -g' end create_makefile(name) append_to_makefile = '' base_dir = File.dirname(__FILE__) if USING_CACHED_FILES then subdir = File.(File.dirname($0)) subdir = subdir.gsub(File.(base_dir), '') cached_dir = File.join('cached', "ruby-#{RUBY_VERSION}") # -- Using cached files -- rpp_files.each do |rpp_file| dest_file = rpp_file.sub(/\.rpp$/, '') src_file = File.join(base_dir, cached_dir, subdir, File.basename(dest_file)) append_to_makefile << <<END #{dest_file}: #{src_file} \t@$(RUBY) -e 'begin; require "fileutils"; rescue LoadError; require "ftools"; FileUtils = File end; FileUtils.copy("#{src_file}", ".", :verbose => true)' END end else # -- Generating files -- rpp_files.each do |rpp_file| dest_file = rpp_file.sub(/\.rpp$/, '') append_to_makefile << <<END #{dest_file}: #{rpp_file} #{rb_files.join(' ')} \trubypp #{rpp_file} #{dest_file} END end end # Dependencies # TODO: we could be smarter about this generated_headers = generated_files.select { |x| x =~ /\.h$/ } generated_incs = generated_files.select { |x| x =~ /\.inc$/ } append_to_makefile << <<END $(OBJS): #{generated_headers.join(' ')} #{generated_incs.join(' ')} clean: clean_generated_files clean_generated_files: \t@$(RM) #{generated_files.join(' ')} generated_files: #{generated_files.join(' ')} END # Append it all to the makefile File.open('Makefile', 'a') do |makefile| makefile.puts(append_to_makefile) end end |
#foo(foo, bar = [1,2], *args, &block) ⇒ Object
def foo; @@foo = 1; end def foo; a = [2, 3]; foo(1, *a); end def foo; not true; end def foo; catch(:foo) { throw :foo; 42 }; end def foo; a ? b : c; end def foo; loop { a = 1; break }; end def foo; ::BAR; end def foo; a != b; end def foo; 1 - 2; end def foo; +a; end def foo; !a; end def foo; a << b; end def foo; a === b; end def foo; []; end
64 65 66 |
# File 'lib/internal/node/pp.rb', line 64 def foo # :nodoc: 1 + 1 end |
#open_alt(*files, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'ext/internal/node/read_node_h.rb', line 7 def open_alt(*files, &block) last_exc = nil files.each do |file| begin File.open(file, &block) return rescue Errno::ENOENT last_exc = $! end end raise last_exc end |