summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormattn <[email protected]>2013-03-24 00:18:39 +0900
committermattn <[email protected]>2013-03-24 00:18:39 +0900
commite53fa35748284b6f0b9647dee3f970a2a9c95907 (patch)
treee9debad6dadd17f72ff4cb5431d981920dbff8d9
parent5c65fa5dc4e08671c05f753d189233127944cbbc (diff)
downloadmruby-e53fa35748284b6f0b9647dee3f970a2a9c95907.tar.gz
mruby-e53fa35748284b6f0b9647dee3f970a2a9c95907.zip
Remove __printstr__
-rw-r--r--mrblib/print.rb84
-rw-r--r--src/init.c4
-rw-r--r--src/print.c23
3 files changed, 11 insertions, 100 deletions
diff --git a/mrblib/print.rb b/mrblib/print.rb
index 68c7837f3..1ae3ae84b 100644
--- a/mrblib/print.rb
+++ b/mrblib/print.rb
@@ -3,78 +3,16 @@
#
# ISO 15.3.1
module Kernel
- unless Kernel.respond_to?(:__printstr__)
- def print(*a)
- raise NotImplementedError.new('print not available')
- end
- def puts(*a)
- raise NotImplementedError.new('puts not available')
- end
- def p(*a)
- raise NotImplementedError.new('p not available')
- end
- def printf(*args)
- raise NotImplementedError.new('printf not available')
- end
- else
- unless Kernel.respond_to?(:sprintf)
- def printf(*args)
- raise NotImplementedError.new('printf not available')
- end
- def sprintf(*args)
- raise NotImplementedError.new('sprintf not available')
- end
- end
-
-
- ##
- # Invoke method +print+ on STDOUT and passing +*args+
- #
- # ISO 15.3.1.2.10
- def print(*args)
- i = 0
- len = args.size
- while i < len
- __printstr__ args[i].to_s
- i += 1
- end
- end
-
- ##
- # Invoke method +puts+ on STDOUT and passing +*args*+
- #
- # ISO 15.3.1.2.11
- def puts(*args)
- i = 0
- len = args.size
- while i < len
- s = args[i].to_s
- __printstr__ s
- __printstr__ "\n" if (s[-1] != "\n")
- i += 1
- end
- __printstr__ "\n" if len == 0
- nil
- end
-
- ##
- # Print human readable object description
- #
- # ISO 15.3.1.3.34
- def p(*args)
- i = 0
- len = args.size
- while i < len
- __printstr__ args[i].inspect
- __printstr__ "\n"
- i += 1
- end
- args[0]
- end
-
- def printf(*args)
- __printstr__(sprintf(*args))
- nil
- end
+ def print(*a)
+ raise NotImplementedError.new('print not available')
+ end
+ def puts(*a)
+ raise NotImplementedError.new('puts not available')
+ end
+ def p(*a)
+ raise NotImplementedError.new('p not available')
+ end
+ def printf(*args)
+ raise NotImplementedError.new('printf not available')
end
end
diff --git a/src/init.c b/src/init.c
index 0d1a24881..e97c72d68 100644
--- a/src/init.c
+++ b/src/init.c
@@ -21,7 +21,6 @@ void mrb_init_hash(mrb_state*);
void mrb_init_numeric(mrb_state*);
void mrb_init_range(mrb_state*);
void mrb_init_gc(mrb_state*);
-void mrb_init_print(mrb_state*);
void mrb_init_math(mrb_state*);
void mrb_init_mrblib(mrb_state*);
void mrb_init_mrbgems(mrb_state*);
@@ -48,9 +47,6 @@ mrb_init_core(mrb_state *mrb)
mrb_init_numeric(mrb); DONE;
mrb_init_range(mrb); DONE;
mrb_init_gc(mrb); DONE;
-#ifdef ENABLE_STDIO
- mrb_init_print(mrb); DONE;
-#endif
mrb_init_mrblib(mrb); DONE;
#ifndef DISABLE_GEMS
mrb_init_mrbgems(mrb); DONE;
diff --git a/src/print.c b/src/print.c
index 9d8a751f7..5367781f5 100644
--- a/src/print.c
+++ b/src/print.c
@@ -34,29 +34,6 @@ mrb_p(mrb_state *mrb, mrb_value obj)
#endif
}
-/* 15.3.1.2.9 */
-/* 15.3.1.3.34 */
-mrb_value
-mrb_printstr(mrb_state *mrb, mrb_value self)
-{
- mrb_value argv;
-
- mrb_get_args(mrb, "o", &argv);
- printstr(mrb, argv);
-
- return argv;
-}
-
-void
-mrb_init_print(mrb_state *mrb)
-{
- struct RClass *krn;
-
- krn = mrb->kernel_module;
-
- mrb_define_method(mrb, krn, "__printstr__", mrb_printstr, ARGS_REQ(1));
-}
-
void
mrb_show_version(mrb_state *mrb)
{