[macruby-changes] [4074] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue May 11 16:56:22 PDT 2010


Revision: 4074
          http://trac.macosforge.org/projects/ruby/changeset/4074
Author:   lsansonetti at apple.com
Date:     2010-05-11 16:56:20 -0700 (Tue, 11 May 2010)
Log Message:
-----------
remove the prelude crap

Modified Paths:
--------------
    MacRuby/trunk/rakelib/builder/builder.rb
    MacRuby/trunk/rakelib/builder.rake

Removed Paths:
-------------
    MacRuby/trunk/prelude.rb
    MacRuby/trunk/tool/compile_prelude.rb

Deleted: MacRuby/trunk/prelude.rb
===================================================================
--- MacRuby/trunk/prelude.rb	2010-05-11 23:43:00 UTC (rev 4073)
+++ MacRuby/trunk/prelude.rb	2010-05-11 23:56:20 UTC (rev 4074)
@@ -1,35 +0,0 @@
-
-# Mutex
-
-class Mutex
-  def synchronize
-    self.lock
-    begin
-      yield
-    ensure
-      self.unlock rescue nil
-    end
-  end
-end
-
-# Thread
-
-class Thread
-  MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new
-  def self.exclusive
-    MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
-      yield
-    }
-  end
-end
-
-def require_relative(relative_feature)
-  c = caller.first
-  e = c.rindex(/:\d+:in /)
-  file = $`
-  if /\A\((.*)\)/ =~ file # eval, etc.
-    raise LoadError, "require_relative is called in #{$1}"
-  end
-  absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature))
-  require absolute_feature
-end

Modified: MacRuby/trunk/rakelib/builder/builder.rb
===================================================================
--- MacRuby/trunk/rakelib/builder/builder.rb	2010-05-11 23:43:00 UTC (rev 4073)
+++ MacRuby/trunk/rakelib/builder/builder.rb	2010-05-11 23:56:20 UTC (rev 4074)
@@ -5,9 +5,8 @@
   gc hash env inits io math numeric object pack parse prec dir process
   random range rational re ruby signal sprintf st string struct time
   util variable version thread id objc bs ucnv encoding main dln dmyext marshal
-  gcd vm_eval prelude miniprelude gc-stub bridgesupport compiler dispatcher vm
-  symbol debugger MacRuby MacRubyDebuggerConnector NSArray NSDictionary
-  NSString
+  gcd vm_eval gc-stub bridgesupport compiler dispatcher vm symbol debugger MacRuby
+  MacRubyDebuggerConnector NSArray NSDictionary NSString
 }
 
 EXTENSIONS = %w{

Modified: MacRuby/trunk/rakelib/builder.rake
===================================================================
--- MacRuby/trunk/rakelib/builder.rake	2010-05-11 23:43:00 UTC (rev 4073)
+++ MacRuby/trunk/rakelib/builder.rake	2010-05-11 23:56:20 UTC (rev 4074)
@@ -9,15 +9,6 @@
 
 desc "Build known objects"
 task :objects => [:config_h, :dtrace_h, :revision_h, :mark_gc] do
-  sh "/usr/bin/ruby tool/compile_prelude.rb prelude.rb miniprelude.c.new"
-  if !File.exist?('miniprelude.c') or File.read('miniprelude.c') != File.read('miniprelude.c.new')
-    mv('miniprelude.c.new', 'miniprelude.c')
-  else
-    rm('miniprelude.c.new')
-  end
-  if !File.exist?('prelude.c')
-    touch('prelude.c') # create empty file nevertheless
-  end
   if !File.exist?('parse.c') or File.mtime('parse.y') > File.mtime('parse.c')
     sh("/usr/bin/bison -o y.tab.c parse.y")
     sh("/usr/bin/sed -f ./tool/ytab.sed -e \"/^#/s!y\.tab\.c!parse.c!\" y.tab.c > parse.c.new")
@@ -38,15 +29,15 @@
   $builder.build
   if t == nil or File.mtime('dispatcher.o') > t
     # dispatcher.o must be marked as GC compliant to avoid a linker problem.
-    # We do not build it using -fobjc-gc because gcc generates unnecessary (and slow) write
-    # barriers.
+    # We do not build it using -fobjc-gc because gcc generates unnecessary (and slow)
+    # write barriers.
     sh "./markgc ./dispatcher.o"
   end
 end
 
 desc "Create miniruby"
 task :miniruby => :objects do
-  $builder.link_executable('miniruby', OBJS - ['prelude'])
+  $builder.link_executable('miniruby', OBJS)
 end
 
 desc "Create config file"
@@ -58,18 +49,8 @@
 namespace :macruby do
   desc "Build dynamic libraries for MacRuby"
   task :dylib => [:rbconfig, :miniruby] do
-=begin
-    sh("./miniruby -I. -I./lib -rrbconfig tool/compile_prelude.rb prelude.rb gem_prelude.rb gcd_prelude prelude.c.new")
-    if !File.exist?('prelude.c') or File.read('prelude.c') != File.read('prelude.c.new')
-      mv('prelude.c.new', 'prelude.c')
-      $builder.build(['prelude'])
-    else
-      rm('prelude.c.new')
-    end
-=end
-    cp('miniprelude.c', 'prelude.c')
     dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
-    $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub', 'miniprelude'])
+    $builder.link_dylib(dylib, $builder.objs - ['main', 'gc-stub'])
     major, minor, teeny = NEW_RUBY_VERSION.scan(/\d+/)
     ["lib#{RUBY_SO_NAME}.#{major}.#{minor}.dylib", "lib#{RUBY_SO_NAME}.dylib"].each do |dylib_alias|
       if !File.exist?(dylib_alias) or File.readlink(dylib_alias) != dylib
@@ -81,7 +62,7 @@
 
   desc "Build static libraries for MacRuby"
   task :static => :dylib do
-    $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub', 'miniprelude'])
+    $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub'])
   end
 
   desc "Build MacRuby"

Deleted: MacRuby/trunk/tool/compile_prelude.rb
===================================================================
--- MacRuby/trunk/tool/compile_prelude.rb	2010-05-11 23:43:00 UTC (rev 4073)
+++ MacRuby/trunk/tool/compile_prelude.rb	2010-05-11 23:56:20 UTC (rev 4074)
@@ -1,92 +0,0 @@
-# This file is interpreted by $(BASERUBY) and miniruby.
-# $(BASERUBY) is used for miniprelude.c.
-# miniruby is used for prelude.c.
-# Since $(BASERUBY) may be older than Ruby 1.9,
-# Ruby 1.9 feature should not be used.
-
-$:.unshift(File.expand_path("../..", __FILE__))
-
-preludes = ARGV.dup
-outfile = preludes.pop
-init_name = outfile[/\w+(?=_prelude.c\b)/] || 'prelude'
-
-C_ESC = {
-  "\\" => "\\\\",
-  '"' => '\"',
-  "\n" => '\n',
-}
-
-0x00.upto(0x1f) {|ch| C_ESC[[ch].pack("C")] ||= "\\%03o" % ch }
-0x7f.upto(0xff) {|ch| C_ESC[[ch].pack("C")] = "\\%03o" % ch }
-C_ESC_PAT = Regexp.union(*C_ESC.keys)
-
-def c_esc(str)
-  '"' + str.gsub(C_ESC_PAT) { C_ESC[$&] } + '"'
-end
-
-mkconf = nil
-setup_ruby_prefix = nil
-teardown_ruby_prefix = nil
-lines_list = preludes.map {|filename|
-  lines = []
-  need_ruby_prefix = false
-  File.readlines(filename).each {|line|
-    line.gsub!(/RbConfig::CONFIG\["(\w+)"\]/) {
-      key = $1
-      unless mkconf
-        require 'rbconfig'
-        mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}')
-        setup_ruby_prefix = "TMP_RUBY_PREFIX = $:.reverse.find{|e|e!=\".\"}.sub(%r{(.*)/lib/.*}m, \"\\\\1\")\n"
-        teardown_ruby_prefix = 'Object.class_eval { remove_const "TMP_RUBY_PREFIX" }'
-      end
-      if RbConfig::MAKEFILE_CONFIG.has_key? key
-        val = RbConfig.expand("$(#{key})", mkconf)
-        need_ruby_prefix = true if /\A\#\{TMP_RUBY_PREFIX\}/ =~ val
-        c_esc(val)
-      else
-        "nil"
-      end
-    }
-    lines << c_esc(line)
-  }
-  setup_lines = []
-  if need_ruby_prefix
-    setup_lines << c_esc(setup_ruby_prefix)
-    lines << c_esc(teardown_ruby_prefix)
-  end
-  [setup_lines, lines]
-}
-
-require 'erb'
-
-tmp = ERB.new(<<'EOS', nil, '%').result(binding)
-#include "ruby/ruby.h"
-#include "ruby/node.h"
-#include "vm.h"
-
-% preludes.zip(lines_list).each_with_index {|(prelude, (setup_lines, lines)), i|
-static const char prelude_name<%=i%>[] = <%=c_esc(File.basename(prelude))%>;
-static const char prelude_code<%=i%>[] =
-%   (setup_lines+lines).each {|line|
-<%=line%>
-%   }
-;
-% }
-
-void
-Init_<%=init_name%>(void)
-{
-% lines_list.each_with_index {|(setup_lines, lines), i|
-  rb_vm_run(prelude_name<%=i%>, rb_compile_string(
-    prelude_name<%=i%>,
-    rb_str_new(prelude_code<%=i%>, sizeof(prelude_code<%=i%>) - 1),
-    1), NULL, false);
-
-% }
-}
-EOS
-
-open(outfile, 'w'){|f|
-  f << tmp
-}
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100511/3c5a6066/attachment-0001.html>


More information about the macruby-changes mailing list