[#22109] diffコマンドのオプションは? — Shibukawa Yoshiki <yoshiki@...>
渋川です。
[#22120] invalid parameter to fcntl in drb.rb — siena@... (Siena. / SHINAGAWA, Norihide)
Siena. です。
西山和広です。
Siena. です。
こんにちは、なかむら(う)です。
[#22144] core dump with ObjectSpace.each_object. — Tanaka Akira <akr@...17n.org>
次のように core を吐くことがあります。
まつもと ゆきひろです
なかだです。
[#22167] 1.8.1 preview3 — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
In message <1070645035.747201.27874.nullmailer@picachu.netlab.jp>
まつもと ゆきひろです
In message <1070904807.535101.6285.nullmailer@picachu.netlab.jp>
まつもと ゆきひろです
[#22173] iconv map_charset on Solaris — Tanaka Akira <akr@...17n.org>
Solaris で、config.charset を用意しておいても
[#22190] override private methods — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
[#22195] IO::for_io and TCPServer#bind — GOTOU Yuuzou <gotoyuzo@...>
test_drb が IPv4 射影アドレスが有効な環境でないと動かないこ
まつもと ゆきひろです
なかだです。
まつもと ゆきひろです
まつもと ゆきひろです
なかだです。
なかだです。
なかだです。
まつもと ゆきひろです
[#22205] yet another inconsistency about EOF between StringIO and IO — Tanaka Akira <akr@...17n.org>
StringIO の
なかだです。
In article <200312100725.hBA7P8Ac011112@sharui.nakada.kanuma.tochigi.jp>,
なかだです。
In article <200312100917.hBA9HuAc013516@sharui.nakada.kanuma.tochigi.jp>,
さかいといいます。
In article <20031211.214041.71090239.sakai@tom.sfc.keio.ac.jp>,
In article <87k751dzyf.fsf@serein.a02.aist.go.jp>,
まつもと ゆきひろです
In article <1072167374.096702.13473.nullmailer@picachu.netlab.jp>,
まつもと ゆきひろです
In article <1072187210.052832.16566.nullmailer@picachu.netlab.jp>,
[#22235] block to method by proc — nobu.nakada@...
なかだです。
まつもと ゆきひろです
[#22238] errors in test/fileutils — siena@... (Siena. / SHINAGAWA, Norihide)
Siena. です。
[#22251] lib/fileutils.rb — Kazuhiro NISHIYAMA <zn@...>
西山和広です。
[#22289] mswin32 optimize — Tietew <tietew-ml-ruby-dev@...>
Tietew です。
[#22307] "rdoc -r" causes SEGV — akira yamada <akira@...>
まつもと ゆきひろです
[#22330] core dump with ungetc — Tanaka Akira <akr@...17n.org>
次のように ungetc を使うと core を吐く場合があります。
なかだです。
In article <200312230824.hBN8O5kM005374@sharui.nakada.kanuma.tochigi.jp>,
なかだです。
[#22344] pack('N') broken on 64bit platforms — Minero Aoki <aamine@...>
青木です。
[#22356] (OSX) TCPServer.open(hostname, 0) — Masatoshi SEKI <m_seki@...>
咳といいます。
まつもと ゆきひろです
まつもと ゆきひろです
[#22366] `to_s': method `to_s' overridden (TypeError) — Tanaka Akira <akr@...17n.org>
そういえば、次の `to_s': method `to_s' overridden (TypeError) というの
まつもと ゆきひろです
なかだです。
まつもと ゆきひろです
なかだです。
まつもと ゆきひろです
[#22375] win32 thread — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
[#22385] Tk.callback_break causes seg-fault or hang-up — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
まつもと ゆきひろです
永井@知能.九工大です.
まつもと ゆきひろです
まつもと ゆきひろです
永井@知能.九工大です.
まつもと ゆきひろです
まつもと ゆきひろです
[#22389] patches for i386-os2-emx — siena@... (Siena. / SHINAGAWA, Norihide)
Siena. です。
[#22403] dlfcn.h on NetBSD — Minero Aoki <aamine@...>
青木です。
[#22418] ruby-1.8.1 build failed on HP-UX 11.11 — MIYAMUKO Katsuyuki <k-miyamuko@...>
みやむこです。
まつもと ゆきひろです
まつもと ゆきひろです
みやむこです。
みやむこです。
なかだです。
みやむこです。
なかだです。
みやむこです。
なかだです。
みやむこです。
なかだです。
みやむこです。
[#22433] ARGF.read(nil) — Tanaka Akira <akr@...17n.org>
というわけで気がついたのですが、
まつもと ゆきひろです
In article <1072453715.631656.23109.nullmailer@picachu.netlab.jp>,
まつもと ゆきひろです
[#22435] Re: [ruby-cvs] ruby: * io.c (rb_f_backquote): need not to check nil result. — Tanaka Akira <akr@...17n.org>
In article <20031226153432.0AF6A45A809@helium.ruby-lang.org>,
[#22469] ARGF.each {|x| ARGF.eof? } and number of Ctrl-Ds. — Tanaka Akira <akr@...17n.org>
次のプログラムは、a^D^D と入力すると終了します。この場合終了には ^D は
[ruby-dev:22301] Re: rough / tabs.rb
青木です。
In mail "[ruby-dev:22271] Re: rough / tabs.rb"
take_tk <ggb03124@nifty.ne.jp> wrote:
> たけ(tk)です。
> 次のようになってしまったのですが、仕様でしょうか? rough では
> 直っているのかな?
しまった。メールを出すときに何気なく書き換えたところが
間違ってました。申し訳ない。
あと typo らしきところもあったのでそれも直しときました。
> 自作のものと比べてみたのですが、自作のほう(detab)がexpand よりも速いみ
> たいです。
>
> どういう場合に速くなるのでしょうか?
ぼくの書いたやつは行の先頭にタブが集中してるケースに最適化しま
した。条件を同じにして (detab をモジュールに定義して) 計測すると、
\t が 2 個までは detab の勝ち、3 個だと expand の勝ちって感じです。
ま、でもたけさんの detab のほうが定義がすっきりしているので、
そっちのほうがいいかも。ちょっとだけ変えてとりこんでみました。
ついでにテストも付けておきます。
-------------------------------------------------------------------
青木峰郎
Attachments (2)
#
# Copyright (c) 2001 Akinori MUSHA <knu@iDaemons.org>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Idaemons: /home/cvs/rb/tabs.rb,v 1.2 2001/05/30 09:37:45 knu Exp $
# $Id: tabs.rb,v 1.1 2001/06/01 18:58:29 knu Exp $
module Tabs
DEFAULT_TABSTOP = 8
def expand(text, tabstop = DEFAULT_TABSTOP)
text.gsub(/(.*?)\t/n) { $1 + ' ' * (tabstop - ($1.size % tabstop)) }
end
def unexpand(text, tabstop = DEFAULT_TABSTOP)
text.gsub(/^[ \t]+/) {|sp|
t, s = expand(sp, tabstop).length.divmod(tabstop)
"\t" * t + ' ' * s
}
end
def unexpand_all(text, tabstop = DEFAULT_TABSTOP)
expand(text, tabstop).map {|line|
(line.length - (line.length % tabstop) - tabstop).step(0, -tabstop) {|i|
line[i, tabstop] = line[i, tabstop].sub(/ +\z/, "\t")
}
line
}.join('')
end
module_function :expand, :unexpand, :unexpand_all
end
class String
def expand_tabs(tabstop = Tabs::DEFAULT_TABSTOP)
Tabs.expand(self, tabstop)
end
def expand_tabs!(tabstop = Tabs::DEFAULT_TABSTOP)
replace(Tabs.expand(self, tabstop))
end
def unexpand_tabs(tabstop = Tabs::DEFAULT_TABSTOP)
Tabs.unexpand(self, tabstop)
end
def unexpand_tabs!(tabstop = Tabs::DEFAULT_TABSTOP)
replace(Tabs.unexpand(self, tabstop))
end
def unexpand_tabs_all(tabstop = Tabs::DEFAULT_TABSTOP)
Tabs.unexpand_all(self, tabstop)
end
def unexpand_tabs_all!(tabstop = Tabs::DEFAULT_TABSTOP)
replace(Tabs.unexpand_all(self, tabstop))
end
end
require 'tabs'
require 'test/unit'
class TestTabs < Test::Unit::TestCase
include Tabs
def test_expand
assert_equal '', expand('')
assert_equal ' ', expand("\t", 1)
assert_equal ' ', expand("\t", 2)
assert_equal ' ', expand("\t", 3)
assert_equal ' ', expand("\t", 4)
assert_equal ' ', expand("\t", 5)
assert_equal ' ', expand("\t", 6)
assert_equal ' ', expand("\t", 7)
assert_equal ' ', expand("\t", 8)
#assert_raises(ArgumentError) {
# expand(' ', 0)
#}
assert_equal ' '*9, expand("\t ", 8)
assert_equal ' '*10, expand("\t ", 8)
assert_equal ' '*11, expand("\t ", 8)
assert_equal ' '*12, expand("\t ", 8)
assert_equal ' '*13, expand("\t ", 8)
assert_equal ' '*14, expand("\t ", 8)
assert_equal ' '*15, expand("\t ", 8)
assert_equal ' '*16, expand("\t ", 8)
assert_equal 'aa ', expand("aa\t", 4)
assert_equal 'aa ', expand("aa\t", 5)
assert_equal 'aa ', expand("aa\t", 6)
assert_equal 'aa ', expand("aa\t", 7)
assert_equal 'aa ', expand("aa\t", 8)
assert_equal ' ', expand("\t\t", 1)
assert_equal ' ', expand("\t\t\t", 1)
assert_equal ' ', expand("\t\t\t\t", 1)
assert_equal "\n", expand("\n")
assert_equal "\n\n", expand("\n\n")
assert_equal " \n", expand("\t\n", 2)
assert_equal " \n", expand("\t \n", 2)
assert_equal 'a', expand("a", 2)
assert_equal 'a a', expand("a\ta", 2)
assert_equal 'a a a', expand("a\ta\ta", 2)
assert_equal 'a a a a', expand("a\ta\ta\ta", 2)
assert_equal 'a a a a a', expand("a\ta\ta\ta\ta", 2)
end
def test_unexpand
assert_equal '', unexpand('', 0)
assert_equal '', unexpand('', 1)
assert_equal '', unexpand('', 2)
assert_equal '', unexpand('', 3)
assert_equal '', unexpand('', 4)
assert_equal '', unexpand('', 5)
assert_equal '', unexpand('', 6)
assert_equal '', unexpand('', 7)
assert_equal '', unexpand('', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal ' ', unexpand(' ', 8)
assert_equal "\t", unexpand(' ', 1)
assert_equal "\t", unexpand(' ', 2)
assert_equal "\t", unexpand(' ', 3)
assert_equal "\t", unexpand(' ', 4)
assert_equal "\t", unexpand(' ', 5)
assert_equal "\t", unexpand(' ', 6)
assert_equal "\t", unexpand(' ', 7)
assert_equal "\t", unexpand(' ', 8)
assert_equal "\t", unexpand("\t")
assert_equal "\t\t", unexpand("\t\t")
assert_equal "\t\t\t", unexpand("\t\t\t")
assert_equal "\t\t ", unexpand("\t\t ")
assert_equal "\t\t\t", unexpand("\t\t ", 2)
assert_equal "\t\t\t", unexpand("\t \t", 2)
assert_equal "\t\t\t", unexpand(" \t\t", 2)
assert_equal "\t", unexpand(" \t", 4)
end
def test_unexpand_all
assert_equal "", unexpand_all("")
assert_equal "", unexpand_all("", 1)
assert_equal "", unexpand_all("", 2)
assert_equal "", unexpand_all("", 3)
assert_equal "", unexpand_all("", 4)
assert_equal "", unexpand_all("", 5)
assert_equal "", unexpand_all("", 6)
assert_equal "", unexpand_all("", 7)
assert_equal "", unexpand_all("", 8)
assert_equal "\t", unexpand_all(" ")
assert_equal "\t", unexpand_all(" ", 1)
assert_equal "\t", unexpand_all(" ", 2)
assert_equal "\t", unexpand_all(" ", 3)
assert_equal "\t", unexpand_all(" ", 4)
assert_equal "\t", unexpand_all(" ", 5)
assert_equal "\t", unexpand_all(" ", 6)
assert_equal "\t", unexpand_all(" ", 7)
assert_equal "\t", unexpand_all(" ", 8)
assert_equal "\t", unexpand_all("\t")
assert_equal "\t\t", unexpand_all("\t\t")
assert_equal "\t\t\t", unexpand_all("\t\t\t")
assert_equal "\t\t ", unexpand_all("\t\t ")
assert_equal "\t\t\t", unexpand_all("\t\t ", 2)
assert_equal "\t\t\t", unexpand_all("\t \t", 2)
assert_equal "\t\t\t", unexpand_all(" \t\t", 2)
assert_equal "\t", unexpand_all(" \t", 4)
assert_equal "a\t", unexpand_all("a ", 4)
assert_equal "ab\t", unexpand_all("ab ", 4)
assert_equal "abc\t", unexpand_all("abc ", 4)
assert_equal "abcd", unexpand_all("abcd", 4)
assert_equal "a\ta\ta", unexpand_all("a a a", 4)
assert_equal "ab\tab\tab", unexpand_all("ab ab ab", 4)
assert_equal "abc\tabc\tabc", unexpand_all("abc abc abc", 4)
assert_equal "a\t a", unexpand_all("a a", 4)
assert_equal "a\t a", unexpand_all("a a", 4)
assert_equal "a\t a", unexpand_all("a a", 4)
assert_equal "a\t\ta", unexpand_all("a a", 4)
assert_equal "a\t\t a", unexpand_all("a a", 4)
assert_equal "\t123\t\t567\t\t789", unexpand_all("\t123\t 567 789", 4)
assert_equal "\t123\t\t567\t\t789", unexpand_all(" 123 567 789", 4)
end
end