From 89d83c27f39ce240d9480ae62a6c250246512199 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 14 Jan 2025 13:27:32 +0900 Subject: [PATCH] mruby-print: remove the gem; ref #6466 --- mrbgems/mruby-print/mrbgem.rake | 6 --- mrbgems/mruby-print/mrblib/print.rb | 28 ------------ mrbgems/mruby-print/src/print.c | 71 ----------------------------- 3 files changed, 105 deletions(-) delete mode 100644 mrbgems/mruby-print/mrbgem.rake delete mode 100644 mrbgems/mruby-print/mrblib/print.rb delete mode 100644 mrbgems/mruby-print/src/print.c diff --git a/mrbgems/mruby-print/mrbgem.rake b/mrbgems/mruby-print/mrbgem.rake deleted file mode 100644 index ee89d7dfe..000000000 --- a/mrbgems/mruby-print/mrbgem.rake +++ /dev/null @@ -1,6 +0,0 @@ -MRuby::Gem::Specification.new('mruby-print') do |spec| - spec.license = 'MIT' - spec.author = 'mruby developers' - spec.summary = 'minimal print/puts' - # mruby-io provides full I/O functionality -end diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb deleted file mode 100644 index 1a024c0bd..000000000 --- a/mrbgems/mruby-print/mrblib/print.rb +++ /dev/null @@ -1,28 +0,0 @@ -## -# Kernel -# -# ISO 15.3.1 -module Kernel - # ISO 15.3.1.2.11 Kernel.puts - # ISO 15.3.1.3.39 Kernel#puts - def puts(*args) - i = 0 - len = args.size - while i < len - s = args[i] - if s.kind_of?(Array) - puts(*s) - else - s = s.to_s - print s - print "\n" if (s[-1] != "\n") - end - i += 1 - end - print "\n" if len == 0 - end - - def printf(*args) - print(sprintf(*args)) - end -end diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c deleted file mode 100644 index 1da3e0964..000000000 --- a/mrbgems/mruby-print/src/print.c +++ /dev/null @@ -1,71 +0,0 @@ -#include - -#ifdef MRB_NO_STDIO -# error print conflicts 'MRB_NO_STDIO' in your build configuration -#endif - -#include -#include -#include -#if defined(_WIN32) -# include -# include -#ifdef _MSC_VER -# define isatty(x) _isatty(x) -# define fileno(x) _fileno(x) -#endif -#else -# include -#endif - -static void -printstr(mrb_state *mrb, mrb_value s) -{ - if (mrb_string_p(s)) { - const char *p = RSTRING_PTR(s); - mrb_int len = RSTRING_LEN(s); - -#if defined(_WIN32) - if (isatty(fileno(stdout))) { - DWORD written; - int wlen = MultiByteToWideChar(CP_UTF8, 0, p, (int)len, NULL, 0); - wchar_t* utf16 = (wchar_t*)mrb_malloc(mrb, (wlen+1) * sizeof(wchar_t)); - if (MultiByteToWideChar(CP_UTF8, 0, p, (int)len, utf16, wlen) > 0) { - utf16[wlen] = 0; - WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), - utf16, (DWORD)wlen, &written, NULL); - } - mrb_free(mrb, utf16); - return; - } -#endif - fwrite(p, (size_t)len, 1, stdout); - } -} - -// ISO 15.3.1.2.10 Kernel.print -// ISO 15.3.1.3.35 Kernel#print -static mrb_value -mrb_print(mrb_state *mrb, mrb_value self) -{ - mrb_int argc = mrb_get_argc(mrb); - const mrb_value *argv = mrb_get_argv(mrb); - - for (mrb_int i=0; ikernel_module, MRB_SYM(print), mrb_print, MRB_ARGS_ANY()); /* 15.3.1.3.35 */ -} - -void -mrb_mruby_print_gem_final(mrb_state* mrb) -{ -}