[#40890] windowsでコンテキストメニューの「印刷」を実行するには? — 岩崎 弘孝 <IH000667@...>
岩崎と申します。
7 messages
2005/07/01
[#40891] 配列をシャッフル — Hideo Konami <konami@...>
小波です。
25 messages
2005/07/01
[#40892] Re: 配列をシャッフル
— Hiroyuki Adachi <hiroyuki-a@...>
2005/07/01
array = [1, 2, 3, 4, 5]
[#40899] Re: 配列をシャッフル
— ktokita <ktokita-p@...>
2005/07/01
時田です
[#40904] slice の仕様とマニュアルの記述 — Hideo Konami <konami@...>
小波です。
6 messages
2005/07/02
[#40939] 値の集合内の中から値の大きな数個のみを取得するには? — 岩崎 弘孝 <IH000667@...>
岩崎と申します。
5 messages
2005/07/27
[#40941] オブジェクト配列の単一化は? — 小西 弘将 <konishi@...>
小西です。いつもお世話になります。
6 messages
2005/07/27
[#40955] irb --noreadline — Masatoshi SEKI <m_seki@...>
咳といいます。
10 messages
2005/07/29
[#40966] Solaris9上のREXML — Hirotaka Mizutani <hirotaka@...>
初めて投稿させて頂きます。水谷と申します。
6 messages
2005/07/29
[ruby-list:40917] [PATCH] RDtool with ruby 1.9
From:
nobu@...
Date:
2005-07-07 23:56:26 UTC
List:
ruby-list #40917
なかだです。
MoonWolfさんのところにあるRDtool 0.6.16ですが、1.9では動かない
ことに気づきました。ついでにutf8出力対応。
それと、makerdtool.rbのOptionParserの使い方が間違っていて意味が
ないのと、更新時刻をみてくれないのも。最初はMakefileにしたほう
がいいかと思ったんですが、makeがない環境用にこうしているのかと
思いなおしてそのまま修正してみました。
--- bin/rd2~ 2005-06-03 17:02:21.838500000 +0900
+++ bin/rd2 2005-06-30 12:26:40.161375000 +0900
@@ -42,6 +42,10 @@
'sjis' => 'shift_jis',
'shift-jis' => 'shift_jis',
}
+ if defined?(Kconv::UTF8)
+ NAME2CONST['utf-8'] = Kconv::UTF8
+ NAME_ALIAS['utf8'] = 'utf-8'
+ end
end
include RD
@@ -106,7 +110,7 @@
q.on("--out-code=KCODE",
Kconv::NAME2CONST.keys, Kconv::NAME_ALIAS,
- "character encoding of output.(jis|euc|sjis)") do |out_code|
+ "character encoding of output.(jis|euc|sjis|utf8)") do |out_code|
end
q.on("--output-index",
@@ -240,7 +244,7 @@
out = Kconv.kconv(out, Kconv::NAME2CONST[out_code], Kconv::AUTO) if out_code
if output_file
- filename = output_file + "." + $Visitor.type::OUTPUT_SUFFIX
+ filename = output_file + "." + $Visitor.class::OUTPUT_SUFFIX
file = open(filename, "w")
file.print(out)
file.close
--- makerdtool.rb~ 2004-11-09 01:59:29.000000000 +0900
+++ makerdtool.rb 2005-06-24 16:50:27.379000000 +0900
@@ -1,4 +1,6 @@
-#!/usr/bin/env ruby
+#!/bin/sh
+exec ruby -x ${@+"$@"}
+#!ruby
# Make for rdtool.
# Copyright (C) 2004 MoonWolf <moonwolf@moonwolf.com>
require 'rbconfig'
@@ -7,32 +9,52 @@
bindir = Config::CONFIG['bindir']
sitelibdir = Config::CONFIG['sitelibdir']
racc = nil
+$dryrun = false
+$force = false
+$quiet = false
opt = OptionParser.new
-opt.on('--bindir') {|v| bindir = v }
-opt.on('--sitelibdir') {|v| sitelibdir = v }
-opt.on('--with-racc') {|v| racc = v }
+opt.on('--bindir=DIR') {|v| bindir = v }
+opt.on('--sitelibdir=DIR') {|v| sitelibdir = v }
+opt.on('--with-racc=RACC') {|v| racc = v }
+opt.on('-n', '--dry-run') {$dryrun = true}
+opt.on('--force') {$force = true}
+opt.on('--quiet') {$quiet = true}
opt.parse!(ARGV)
-racc ||= `which racc`.chomp
+racc ||= 'racc'
rd2 = File.join(File.dirname(File.expand_path(__FILE__)),'bin','rd2')
-# Parser make
-STDERR.puts "racc rd/rdblockparser.ry"
-system(racc, 'lib/rd/rdblockparser.ry')
+def uptodate?(new, old_list)
+ if !$force and File.exist?(new)
+ new_time = File.mtime(new)
+ !old_list.any? {|old| File.exist?(old) and File.mtime(old) > new_time}
+ else
+ false
+ end
+end
+
+def run(*args)
+ puts args.join(' ') unless $quiet
+ system(*args) unless $dryrun
+end
+
+def depend(dest, src)
+ uptodate?(dest, src) or yield(src, dest)
+end
-STDERR.puts "racc rd/rdinlineparser.ry"
-system(racc, 'lib/rd/rdinlineparser.ry')
+# Parser make
+Dir.glob('lib/rd/*.ry') do |ry|
+ depend(ry.chomp(".ry") + ".tab.rb", ry) do
+ run(racc, ry)
+ end
+end
# Document make
-STDERR.puts "rd2 README.rd"
-open('README.html','w') {|f|
- f.write `#{rd2} README.rd`
-}
-
-STDERR.puts "rd2 README.rd.ja"
-open('README.ja.html','w') {|f|
- f.write `#{rd2} README.rd.ja`
-}
+Dir.glob('*.rd{,.*}') do |rd|
+ depend(rd.sub(/\.rd(.*)\z/, '\1.html'), rd) do |html, *|
+ run(rd2, "-o", html, rd)
+ end
+end
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦