summaryrefslogtreecommitdiff
path: root/jni/ruby/lib/irb/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'jni/ruby/lib/irb/cmd')
-rw-r--r--jni/ruby/lib/irb/cmd/chws.rb33
-rw-r--r--jni/ruby/lib/irb/cmd/fork.rb38
-rw-r--r--jni/ruby/lib/irb/cmd/help.rb41
-rw-r--r--jni/ruby/lib/irb/cmd/load.rb66
-rw-r--r--jni/ruby/lib/irb/cmd/nop.rb38
-rw-r--r--jni/ruby/lib/irb/cmd/pushws.rb40
-rw-r--r--jni/ruby/lib/irb/cmd/subirb.rb42
7 files changed, 298 insertions, 0 deletions
diff --git a/jni/ruby/lib/irb/cmd/chws.rb b/jni/ruby/lib/irb/cmd/chws.rb
new file mode 100644
index 0000000..bc39fd1
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/chws.rb
@@ -0,0 +1,33 @@
+#
+# change-ws.rb -
+# $Release Version: 0.9.6$
+# $Revision: 47112 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+
+require "irb/cmd/nop.rb"
+require "irb/ext/change-ws.rb"
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+
+ class CurrentWorkingWorkspace<Nop
+ def execute(*obj)
+ irb_context.main
+ end
+ end
+
+ class ChangeWorkspace<Nop
+ def execute(*obj)
+ irb_context.change_workspace(*obj)
+ irb_context.main
+ end
+ end
+ end
+end
+# :startdoc:
diff --git a/jni/ruby/lib/irb/cmd/fork.rb b/jni/ruby/lib/irb/cmd/fork.rb
new file mode 100644
index 0000000..4e80250
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/fork.rb
@@ -0,0 +1,38 @@
+#
+# fork.rb -
+# $Release Version: 0.9.6 $
+# $Revision: 47266 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class Fork<Nop
+ def execute
+ pid = send ExtendCommand.irb_original_method_name("fork")
+ unless pid
+ class << self
+ alias_method :exit, ExtendCommand.irb_original_method_name('exit')
+ end
+ if iterator?
+ begin
+ yield
+ ensure
+ exit
+ end
+ end
+ end
+ pid
+ end
+ end
+ end
+end
+# :startdoc:
+
+
diff --git a/jni/ruby/lib/irb/cmd/help.rb b/jni/ruby/lib/irb/cmd/help.rb
new file mode 100644
index 0000000..028cc35
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/help.rb
@@ -0,0 +1,41 @@
+#
+# help.rb - helper using ri
+# $Release Version: 0.9.6$
+# $Revision: 38358 $
+#
+# --
+#
+#
+#
+
+require 'rdoc/ri/driver'
+
+require "irb/cmd/nop.rb"
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class Help<Nop
+ begin
+ Ri = RDoc::RI::Driver.new
+ rescue SystemExit
+ else
+ def execute(*names)
+ if names.empty?
+ Ri.interactive
+ return
+ end
+ names.each do |name|
+ begin
+ Ri.display_name(name.to_s)
+ rescue RDoc::RI::Error
+ puts $!.message
+ end
+ end
+ nil
+ end
+ end
+ end
+ end
+end
+# :startdoc:
diff --git a/jni/ruby/lib/irb/cmd/load.rb b/jni/ruby/lib/irb/cmd/load.rb
new file mode 100644
index 0000000..a3b1604
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/load.rb
@@ -0,0 +1,66 @@
+#
+# load.rb -
+# $Release Version: 0.9.6$
+# $Revision: 47114 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+
+require "irb/cmd/nop.rb"
+require "irb/ext/loader"
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class Load<Nop
+ include IrbLoader
+
+ def execute(file_name, priv = nil)
+ return irb_load(file_name, priv)
+ end
+ end
+
+ class Require<Nop
+ include IrbLoader
+
+ def execute(file_name)
+
+ rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
+ return false if $".find{|f| f =~ rex}
+
+ case file_name
+ when /\.rb$/
+ begin
+ if irb_load(file_name)
+ $".push file_name
+ return true
+ end
+ rescue LoadError
+ end
+ when /\.(so|o|sl)$/
+ return ruby_require(file_name)
+ end
+
+ begin
+ irb_load(f = file_name + ".rb")
+ $".push f
+ return true
+ rescue LoadError
+ return ruby_require(file_name)
+ end
+ end
+ end
+
+ class Source<Nop
+ include IrbLoader
+ def execute(file_name)
+ source_file(file_name)
+ end
+ end
+ end
+
+end
+# :startdoc:
diff --git a/jni/ruby/lib/irb/cmd/nop.rb b/jni/ruby/lib/irb/cmd/nop.rb
new file mode 100644
index 0000000..3445d79
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/nop.rb
@@ -0,0 +1,38 @@
+#
+# nop.rb -
+# $Release Version: 0.9.6$
+# $Revision: 47266 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class Nop
+
+
+ def self.execute(conf, *opts)
+ command = new(conf)
+ command.execute(*opts)
+ end
+
+ def initialize(conf)
+ @irb_context = conf
+ end
+
+ attr_reader :irb_context
+
+ def irb
+ @irb_context.irb
+ end
+
+ def execute(*opts)
+ #nop
+ end
+ end
+ end
+end
+# :startdoc:
diff --git a/jni/ruby/lib/irb/cmd/pushws.rb b/jni/ruby/lib/irb/cmd/pushws.rb
new file mode 100644
index 0000000..1bda950
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/pushws.rb
@@ -0,0 +1,40 @@
+#
+# change-ws.rb -
+# $Release Version: 0.9.6$
+# $Revision: 47112 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+
+require "irb/cmd/nop.rb"
+require "irb/ext/workspaces.rb"
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class Workspaces<Nop
+ def execute(*obj)
+ irb_context.workspaces.collect{|ws| ws.main}
+ end
+ end
+
+ class PushWorkspace<Workspaces
+ def execute(*obj)
+ irb_context.push_workspace(*obj)
+ super
+ end
+ end
+
+ class PopWorkspace<Workspaces
+ def execute(*obj)
+ irb_context.pop_workspace(*obj)
+ super
+ end
+ end
+ end
+end
+# :startdoc:
+
diff --git a/jni/ruby/lib/irb/cmd/subirb.rb b/jni/ruby/lib/irb/cmd/subirb.rb
new file mode 100644
index 0000000..342828f
--- /dev/null
+++ b/jni/ruby/lib/irb/cmd/subirb.rb
@@ -0,0 +1,42 @@
+# multi.rb -
+# $Release Version: 0.9.6$
+# $Revision: 47112 $
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
+#
+# --
+#
+#
+#
+
+require "irb/cmd/nop.rb"
+require "irb/ext/multi-irb"
+
+# :stopdoc:
+module IRB
+ module ExtendCommand
+ class IrbCommand<Nop
+ def execute(*obj)
+ IRB.irb(nil, *obj)
+ end
+ end
+
+ class Jobs<Nop
+ def execute
+ IRB.JobManager
+ end
+ end
+
+ class Foreground<Nop
+ def execute(key)
+ IRB.JobManager.switch(key)
+ end
+ end
+
+ class Kill<Nop
+ def execute(*keys)
+ IRB.JobManager.kill(*keys)
+ end
+ end
+ end
+end
+# :startdoc: