[#30408] Ruby 1.8.6 preview2 has been released — "Akinori MUSHA" <knu@...>

 Ruby 1.8.6 preview2 をリリースしました。

20 messages 2007/02/24
[#30414] fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Hidetoshi NAGAI <nagai@...> 2007/02/25

永井@知能.九工大です.

[#30418] Re: fail to autoload at $SAFE==4 (Re: Ruby 1.8.6 preview2 has been released) — Nobuyoshi Nakada <nobu@...> 2007/02/25

なかだです。

[ruby-dev:30313] Re: [ruby-cvs:18927] Ruby:r11679: * ext/thread: Make style fixes (mostly de-K&R'ism) to match the

From: "Akinori MUSHA" <knu@...>
Date: 2007-02-10 16:35:22 UTC
List: ruby-dev #30313
At Sat, 10 Feb 2007 21:03:08 +0900,
I wrote:
> At Sat, 10 Feb 2007 00:00:44 +0900,
> Nobuyoshi Nakada wrote:
> > なかだです。
> > 
> > At Fri, 9 Feb 2007 20:48:35 +0900 (JST),
> > knu@ruby-lang.org wrote in [ruby-cvs:18927]:
> > >     * ext/thread: Make style fixes (mostly de-K&R'ism) to match the
> > >       rest of the source code.
> > 
> > fastthreadは1.8のcoreに取り込む予定かと思っていたのですが、1.8
> > ではむしろ、(少なくともcoreでは)K&R styleなんですが。
> 
>  そうでしたか。新規のコードは ANSI/ISO が望ましいと思っていました。
> 
>  K&R コンパイラしかないレガシー環境のサポートよりも、64bit環境等
> での宣言漏れによるエンバグのリスクの排除を優先したいんですが、
> 戻した方がいいですか。(digest もすでに de-K&R してしまった)

 core に入れることは考えていませんでしたが、入れるときはこんな
感じで変換します。

print ARGF.read.gsub(/^((?:[^ \n].+\n)+)(\w+)\(([^\n]*)\)\s*/) {
  type  = $1
  func  = $2
  plist = $3

  if plist == 'void'
    sprintf <<-EOS, type, func
%s%s()
    EOS
  else
    params = plist.split(/,\s*/)
    decls = params.map { |s| "    #{s};" }.join("\n")
    stype = type.gsub(/\s+/, " ")
    ptypes = params.map { |s| /\s*\w+$/.match(s); $` }.join(", ")
    pnames = params.map { |s| /(\w+)$/.match(s); $1 }.join(", ")

    sprintf <<-EOS, stype, func, ptypes, type, func, pnames, decls
%s%s _((%s));

%s%s(%s)
%s
    EOS
  end
}

 gcc や Emacs の cc-mode にこういう機能はないんですかねえ。
特に逆方向の変換。

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Different eyes see different things,
    Different hearts beat on different strings --
       But there are times for you and me when all such things agree"

In This Thread