Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ident #696

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
beadf23
lib/cmath.rb: fix indent
spk Aug 8, 2014
2023822
lib/drb/ssl.rb: fix indent
spk Aug 8, 2014
f4c0cda
lib/irb/cmd/chws.rb: fix ident
spk Aug 8, 2014
e438b36
lib/irb/cmd/fork.rb: fix ident
spk Aug 8, 2014
a1f22e3
lib/irb/cmd/load.rb: fix ident
spk Aug 8, 2014
13c2aba
lib/irb/cmd/nop.rb: fix ident
spk Aug 8, 2014
2e4171a
lib/irb/cmd/pushws.rb: fix ident
spk Aug 8, 2014
3a3676b
lib/irb/cmd/subirb.rb: fix ident
spk Aug 8, 2014
7905015
lib/irb/completion.rb: fix ident
spk Aug 8, 2014
bbe3ef4
lib/irb/context.rb: fix ident
spk Aug 8, 2014
355e09c
lib/irb/ext/change-ws.rb: fix ident
spk Aug 8, 2014
572489a
lib/irb/ext/history.rb: fix ident
spk Aug 8, 2014
dad82de
lib/irb/ext/loader.rb: fix ident
spk Aug 8, 2014
8726bf6
lib/irb/ext/math-mode.rb: fix ident
spk Aug 8, 2014
142c259
lib/irb/ext/multi-irb.rb: fix ident
spk Aug 8, 2014
8f30e94
lib/irb/ext/save-history.rb: fix ident
spk Aug 8, 2014
e375d42
lib/irb/ext/tracer.rb: fix ident
spk Aug 8, 2014
0dfc0ae
lib/irb/ext/use-loader.rb: fix indent
spk Aug 8, 2014
cd59db8
lib/irb/ext/workspaces.rb: fix ident
spk Aug 8, 2014
ac42085
lib/irb/extend-command.rb: fix ident
spk Aug 8, 2014
97ead90
lib/irb/frame.rb: fix ident
spk Aug 8, 2014
5a364d4
lib/irb/help.rb: fix ident
spk Aug 8, 2014
6420101
lib/irb/init.rb: fix ident
spk Aug 8, 2014
682e84c
lib/irb/input-method.rb: fix ident
spk Aug 8, 2014
f877039
lib/irb/locale.rb: fix ident
spk Aug 8, 2014
a4a64f8
lib/irb/notifier.rb: fix ident
spk Aug 8, 2014
0428814
lib/irb/ruby-lex.rb: fix ident
spk Aug 8, 2014
6bf1b58
lib/irb/ruby-token.rb: fix ident
spk Aug 8, 2014
7e18d3a
lib/irb/slex.rb: fix ident
spk Aug 8, 2014
a46b8ad
lib/irb/workspace.rb: fix ident
spk Aug 8, 2014
deec205
lib/irb/xmp.rb: fix ident
spk Aug 8, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
112 changes: 56 additions & 56 deletions lib/cmath.rb
Expand Up @@ -50,11 +50,11 @@ module CMath
def exp(z)
begin
if z.real?
exp!(z)
exp!(z)
else
ere = exp!(z.real)
Complex(ere * cos!(z.imag),
ere * sin!(z.imag))
ere = exp!(z.real)
Complex(ere * cos!(z.imag),
ere * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -70,14 +70,14 @@ def log(*args)
begin
z, b = args
unless b.nil? || b.kind_of?(Numeric)
raise TypeError, "Numeric Number required"
raise TypeError, "Numeric Number required"
end
if z.real? and z >= 0 and (b.nil? or b >= 0)
log!(*args)
log!(*args)
else
a = Complex(log!(z.abs), z.arg)
if b
a /= log(b)
a = Complex(log!(z.abs), z.arg)
if b
a /= log(b)
end
a
end
Expand All @@ -91,9 +91,9 @@ def log(*args)
def log2(z)
begin
if z.real? and z >= 0
log2!(z)
log2!(z)
else
log(z) / log!(2)
log(z) / log!(2)
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -105,9 +105,9 @@ def log2(z)
def log10(z)
begin
if z.real? and z >= 0
log10!(z)
log10!(z)
else
log(z) / log!(10)
log(z) / log!(10)
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -122,20 +122,20 @@ def log10(z)
def sqrt(z)
begin
if z.real?
if z < 0
Complex(0, sqrt!(-z))
else
sqrt!(z)
end
if z < 0
Complex(0, sqrt!(-z))
else
sqrt!(z)
end
else
if z.imag < 0 ||
(z.imag == 0 && z.imag.to_s[0] == '-')
sqrt(z.conjugate).conjugate
else
r = z.abs
x = z.real
Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
end
if z.imag < 0 ||
(z.imag == 0 && z.imag.to_s[0] == '-')
sqrt(z.conjugate).conjugate
else
r = z.abs
x = z.real
Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
end
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -153,10 +153,10 @@ def cbrt(z)
def sin(z)
begin
if z.real?
sin!(z)
sin!(z)
else
Complex(sin!(z.real) * cosh!(z.imag),
cos!(z.real) * sinh!(z.imag))
Complex(sin!(z.real) * cosh!(z.imag),
cos!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -168,10 +168,10 @@ def sin(z)
def cos(z)
begin
if z.real?
cos!(z)
cos!(z)
else
Complex(cos!(z.real) * cosh!(z.imag),
-sin!(z.real) * sinh!(z.imag))
Complex(cos!(z.real) * cosh!(z.imag),
-sin!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -183,9 +183,9 @@ def cos(z)
def tan(z)
begin
if z.real?
tan!(z)
tan!(z)
else
sin(z) / cos(z)
sin(z) / cos(z)
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -197,10 +197,10 @@ def tan(z)
def sinh(z)
begin
if z.real?
sinh!(z)
sinh!(z)
else
Complex(sinh!(z.real) * cos!(z.imag),
cosh!(z.real) * sin!(z.imag))
Complex(sinh!(z.real) * cos!(z.imag),
cosh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -212,10 +212,10 @@ def sinh(z)
def cosh(z)
begin
if z.real?
cosh!(z)
cosh!(z)
else
Complex(cosh!(z.real) * cos!(z.imag),
sinh!(z.real) * sin!(z.imag))
Complex(cosh!(z.real) * cos!(z.imag),
sinh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -227,9 +227,9 @@ def cosh(z)
def tanh(z)
begin
if z.real?
tanh!(z)
tanh!(z)
else
sinh(z) / cosh(z)
sinh(z) / cosh(z)
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -241,9 +241,9 @@ def tanh(z)
def asin(z)
begin
if z.real? and z >= -1 and z <= 1
asin!(z)
asin!(z)
else
(-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
(-1.0).i * log(1.0.i * z + sqrt(1.0 - z * z))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -255,9 +255,9 @@ def asin(z)
def acos(z)
begin
if z.real? and z >= -1 and z <= 1
acos!(z)
acos!(z)
else
(-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
(-1.0).i * log(z + 1.0.i * sqrt(1.0 - z * z))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -269,9 +269,9 @@ def acos(z)
def atan(z)
begin
if z.real?
atan!(z)
atan!(z)
else
1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
1.0.i * log((1.0.i + z) / (1.0.i - z)) / 2.0
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -284,9 +284,9 @@ def atan(z)
def atan2(y,x)
begin
if y.real? and x.real?
atan2!(y,x)
atan2!(y,x)
else
(-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
(-1.0).i * log((x + 1.0.i * y) / sqrt(x * x + y * y))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -298,9 +298,9 @@ def atan2(y,x)
def asinh(z)
begin
if z.real?
asinh!(z)
asinh!(z)
else
log(z + sqrt(1.0 + z * z))
log(z + sqrt(1.0 + z * z))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -312,9 +312,9 @@ def asinh(z)
def acosh(z)
begin
if z.real? and z >= 1
acosh!(z)
acosh!(z)
else
log(z + sqrt(z * z - 1.0))
log(z + sqrt(z * z - 1.0))
end
rescue NoMethodError
handle_no_method_error
Expand All @@ -326,9 +326,9 @@ def acosh(z)
def atanh(z)
begin
if z.real? and z >= -1 and z <= 1
atanh!(z)
atanh!(z)
else
log((1.0 + z) / (1.0 - z)) / 2.0
log((1.0 + z) / (1.0 - z)) / 2.0
end
rescue NoMethodError
handle_no_method_error
Expand Down
2 changes: 1 addition & 1 deletion lib/drb/ssl.rb
Expand Up @@ -327,7 +327,7 @@ def accept # :nodoc:
soc.close
end
begin
ssl = @config.accept(soc)
ssl = @config.accept(soc)
rescue Exception
soc.close
raise
Expand Down
6 changes: 3 additions & 3 deletions lib/irb/cmd/chws.rb
Expand Up @@ -18,14 +18,14 @@ module ExtendCommand

class CurrentWorkingWorkspace<Nop
def execute(*obj)
irb_context.main
irb_context.main
end
end

class ChangeWorkspace<Nop
def execute(*obj)
irb_context.change_workspace(*obj)
irb_context.main
irb_context.change_workspace(*obj)
irb_context.main
end
end
end
Expand Down
28 changes: 14 additions & 14 deletions lib/irb/cmd/fork.rb
Expand Up @@ -16,20 +16,20 @@ 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
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
Expand Down
50 changes: 25 additions & 25 deletions lib/irb/cmd/load.rb
Expand Up @@ -19,47 +19,47 @@ class Load<Nop
include IrbLoader

def execute(file_name, priv = nil)
# return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
return irb_load(file_name, priv)
# return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
return irb_load(file_name, priv)
end
end

class Require<Nop
include IrbLoader

def execute(file_name)
# return ruby_require(file_name) unless IRB.conf[:USE_LOADER]
# return ruby_require(file_name) unless IRB.conf[:USE_LOADER]

rex = Regexp.new("#{Regexp.quote(file_name)}(\.o|\.rb)?")
return false if $".find{|f| f =~ rex}
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
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
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)
source_file(file_name)
end
end
end
Expand Down