[#13765] GenerativeHash — TAKAHASHI Masayoshi <maki@...>

高橋征義です。

17 messages 2001/07/08
[#13769] Re: GenerativeHash — matz@... (Yukihiro Matsumoto) 2001/07/09

まつもと ゆきひろです

[#13774] mkmf.rb: cleaning facility — Takaaki Tateishi <ttate@...>

立石です.

14 messages 2001/07/09

[#13800] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — nobu.nakada@...

なかだです。

20 messages 2001/07/10
[#13801] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — WATANABE Hirofumi <eban@...> 2001/07/10

わたなべです。

[#13802] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — matz@... (Yukihiro Matsumoto) 2001/07/10

まつもと ゆきひろです

[#13804] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — WATANABE Hirofumi <eban@...> 2001/07/10

わたなべです。

[#13805] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — matz@... (Yukihiro Matsumoto) 2001/07/10

まつもと ゆきひろです

[#13806] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — WATANABE Hirofumi <eban@...> 2001/07/10

わたなべです。

[#13807] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — matz@... (Yukihiro Matsumoto) 2001/07/10

まつもと ゆきひろです

[#13808] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — "Akinori MUSHA" <knu@...> 2001/07/10

At Tue, 10 Jul 2001 15:23:04 +0900,

[#13809] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — WATANABE Hirofumi <eban@...> 2001/07/10

わたなべです。

[#13810] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — "Akinori MUSHA" <knu@...> 2001/07/10

At Tue, 10 Jul 2001 16:50:52 +0900,

[#13811] Re: [ruby-cvs] ruby: * ruby.h: fix a wrong function name: rb_iglob() -> rb_globi(). — "Akinori MUSHA" <knu@...> 2001/07/10

 もうひとつあった。

[#13828] supported platforms / K&R — "Akinori MUSHA" <knu@...>

 digest モジュールの各プラットフォームでの動作確認をお願いした

39 messages 2001/07/13
[#14389] Re: supported platforms / K&R — Koji Arai <JCA02266@...> 2001/08/08

新井です。

[#14399] Re: supported platforms / K&R — Takashi Shimizu <simtak@...> 2001/08/09

清水@biglobeです。

[#14404] Re: supported platforms / K&R — Koji Arai <JCA02266@...> 2001/08/09

新井です。

[#14461] Re: supported platforms / K&R — Takashi Shimizu <simtak@...> 2001/08/14

清水@biglobe です。

[#14466] Re: supported platforms / K&R — nobu.nakada@... 2001/08/14

なかだです。

[#14468] Re: supported platforms / K&R — Koji Arai <JCA02266@...> 2001/08/14

新井です。

[#14477] recursive malloc (Re: supported platforms / K&R) — Koji Arai <JCA02266@...> 2001/08/15

新井です。

[#14482] Re: recursive malloc (Re: supported platforms / K&R) — nobu.nakada@... 2001/08/15

なかだです。

[#14486] Re: recursive malloc (Re: supported platforms / K&R) — Koji Arai <JCA02266@...> 2001/08/15

新井です。

[#14490] Re: recursive malloc (Re: supported platforms/ K&R) — nobu.nakada@... 2001/08/15

なかだです。

[#14492] Re: recursive malloc (Re: supported platforms/ K&R) — Koji Arai <JCA02266@...> 2001/08/15

新井です。

[#14493] Re: recursive malloc (Re: supportedplatforms/ K&R) — nobu.nakada@... 2001/08/15

なかだです。

[#13878] Prototype for rb_gc_mark / volatile in ruby.h — Tietew <tietew@...>

Tietew です。

18 messages 2001/07/15
[#13880] Re: Prototype for rb_gc_mark / volatile in ruby.h — matz@... (Yukihiro Matsumoto) 2001/07/16

まつもと ゆきひろです

[#13940] IO#read — "Akinori MUSHA" <knu@...>

 IO#read を使って何度もストリームから読み込むような処理をする

20 messages 2001/07/19

[#13959] Re: [ruby-list:30682] Re: overwride method — "Akinori MUSHA" <knu@...>

At Fri, 20 Jul 2001 21:09:36 +0900,

95 messages 2001/07/20
[#13963] Re: [ruby-list:30682] Re: overwride method — GOTO Kentaro <gotoken@...> 2001/07/20

ごとけんです

[#13965] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/21

まつもと ゆきひろです

[#13967] Re: [ruby-list:30682] Re: overwride method — GOTO Kentaro <gotoken@...> 2001/07/21

ごとけんです

[#13969] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/21

まつもと ゆきひろです

[#13980] Re: [ruby-list:30682] Re: overwride method — GOTO Kentaro <gotoken@...> 2001/07/21

[ruby-dev:13969]>

[#13981] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/21

まつもと ゆきひろです

[#13984] Re: [ruby-list:30682] Re: overwride method — GOTO Kentaro <gotoken@...> 2001/07/22

ごとけんです

[#13993] Re: [ruby-list:30682] Re: overwride method — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/07/23

なひです。

[#13994] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/23

まつもと ゆきひろです

[#13995] Re: [ruby-list:30682] Re: overwride method — keiju@... (石塚圭樹) 2001/07/23

けいじゅ@日本ラショナルソフトウェアです.

[#13996] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/23

まつもと ゆきひろです

[#13997] Re: [ruby-list:30682] Re: overwride method — keiju@... (石塚圭樹) 2001/07/23

けいじゅ@日本ラショナルソフトウェアです.

[#13998] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/23

まつもと ゆきひろです

[#14000] Re: [ruby-list:30682] Re: overwride method — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/07/23

なひです。

[#14005] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/23

まつもと ゆきひろです

[#14016] Re: [ruby-list:30682] Re: overwride method — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/07/24

なひです。

[#14021] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14022] Re: [ruby-list:30682] Re: overwride method — "NAKAMURA, Hiroshi" <nakahiro@...> 2001/07/24

なひです。

[#14023] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14037] Re: [ruby-list:30682] Re: overwride method — GOTO Kentaro <gotoken@...> 2001/07/24

ごとけんです

[#14039] Re: [ruby-list:30682] Re: overwride method — Masatoshi SEKI <m_seki@...> 2001/07/24

[#14040] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14043] Re: [ruby-list:30682] Re: overwride method — m_seki@... 2001/07/24

[#14053] Re: [ruby-list:30682] Re: overwride method — matz@... (Yukihiro Matsumoto) 2001/07/25

まつもと ゆきひろです

[#14082] private instance variable と _dump/_load — Masatoshi SEKI <m_seki@...> 2001/07/25

[#14084] Re: private instance variable と _dump/_load — keiju@... (石塚圭樹) 2001/07/25

けいじゅ@日本ラショナルソフトウェアです.

[#14087] Re: private instance variable と _dump/_load — matz@... (Yukihiro Matsumoto) 2001/07/25

まつもと ゆきひろです

[#14089] Re: private instance variable と _dump/_load — keiju@... (石塚圭樹) 2001/07/25

けいじゅ@日本ラショナルソフトウェアです.

[#14094] Re: private instance variable と _dump/_load — matz@... (Yukihiro Matsumoto) 2001/07/26

まつもと ゆきひろです

[#14133] Re: private instance variable と _dump/_load — "Shin'ya Adzumi" <adzumi@...> 2001/07/27

あづみです。

[#14134] Re: private instance variable と _dump/_load — matz@... (Yukihiro Matsumoto) 2001/07/27

まつもと ゆきひろです

[#14140] Re: private instance variable と _dump/_load — Kazuhiro NISHIYAMA <zn@...> 2001/07/27

In <996211878.306635.31396.nullmailer@ev.netlab.jp>

[#14143] Re: private instance variable と _dump/_load — matz@... (Yukihiro Matsumoto) 2001/07/27

まつもと ゆきひろです

[#14144] Re: private instance variable と _dump/_load — Kazuhiro NISHIYAMA <zn@...> 2001/07/27

In <996255758.830993.629.nullmailer@ev.netlab.jp>

[#14066] Re: [ruby-list:30682] Re: overwride method — "Shin'ya Adzumi" <adzumi@...> 2001/07/25

あづみです。

[#14068] private instance variable (Re: Re: overwride method) — matz@... (Yukihiro Matsumoto) 2001/07/25

まつもと ゆきひろです

[#14099] Is private instance variable really needed? — Shugo Maeda <shugo@...> 2001/07/26

前田です。

[#14104] Re: Is private instance variable really needed? — matz@... (Yukihiro Matsumoto) 2001/07/26

まつもと ゆきひろです

[#14026] Exception in coerce — Shin-ichiro HARA <sinara@...>

原です。

21 messages 2001/07/24
[#14027] Re: Exception in coerce — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14028] Re: Exception in coerce — Shin-ichiro HARA <sinara@...> 2001/07/24

原です。

[#14029] Re: Exception in coerce — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14030] Re: Exception in coerce — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[#14031] Re: Exception in coerce — Shin-ichiro HARA <sinara@...> 2001/07/24

原です。

[#14032] Re: Exception in coerce — matz@... (Yukihiro Matsumoto) 2001/07/24

まつもと ゆきひろです

[ruby-dev:13767] Dir::glob()

From: "Akinori MUSHA" <knu@...>
Date: 2001-07-08 15:05:13 UTC
List: ruby-dev #13767
 File::fnmatch の提案のときに切り離した、 Dir::glob の拡張を
再提案します。

 現在の Dir::glob() は、ワイルドカードのマッチを行う際のフラグが
FNM_PERIOD に決め打ちになっていますが、変更できるとうれしいので、
第二引数にフラグを受け付けるようにしたいです。

 Ruby API (Dir::glob) の互換性を考慮し、第二引数の省略時は従来
通り File::FNM_PERIOD でマッチを行います。つまり、

	Dir::glob(pattern, flags = File::FNM_PERIOD)

ということです。flags に指定できるのは、 File::FNM_PERIOD に加え
File::FNM_CASEFOLD と File::FNM_NOESCAPE を加えた三つの組み合わせ
(OR)です。

 また、 C API (rb_glob(), rb_globi()) もそのまま維持し、フラグを
指定できる関数 (rb_glob_with_flags()) は static にしましたので、
変更の影響は dir.c の中だけに止まります。


 一つ懸念されるのは、現在 [] が glob の別名なので、副作用として
Dir::[] も第二引数を受け付けてしまうようになるということです。
Dir["*.bak", File::FNM_CASEFOLD] って、 [] の使い方のポリシーから
すると邪道ですかねえ。もし問題なら、 [] の仕様から考え直す必要が
あるかも。(私はそんなに気にすることではないと思っていますが)


P.S.

 ところで、 dir.c rev.1.49 の変更で Dir.glob("a* b*") が a* と
b* の和ではなく、文字通り空白を含むパターンとして認識されるように
なっているに先ほど気づきました。これは、以前の挙動が意図しない
ものだったということでしょうか?

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

"Freeze this moment a little bit longer, make each impression
  a little bit stronger..  Experience slips away -- Time stand still"

Index: dir.c
===================================================================
RCS file: /mirror/ruby/src/ruby/dir.c,v
retrieving revision 1.49
diff -u -r1.49 dir.c
--- dir.c	2001/07/02 08:46:21	1.49
+++ dir.c	2001/07/08 11:14:26
@@ -751,13 +751,23 @@
     }
 }
 
+static inline void
+rb_glob_with_flags(path, flags, func, arg)
+    char *path;
+    int flags;
+    void (*func) _((const char*, VALUE));
+    VALUE arg;
+{
+    glob_helper(path, flags, func, arg);
+}
+
 void
 rb_glob(path, func, arg)
     char *path;
     void (*func) _((const char*, VALUE));
     VALUE arg;
 {
-    glob_helper(path, FNM_PERIOD, func, arg);
+    rb_glob_with_flags(path, FNM_PERIOD, func, arg);
 }
 
 void
@@ -766,7 +776,7 @@
     void (*func)();
     VALUE arg;
 {
-    glob_helper(path, FNM_PERIOD|FNM_CASEFOLD, func, arg);
+    rb_glob_with_flags(path, FNM_PERIOD|FNM_CASEFOLD, func, arg);
 }
 
 static void push_pattern _((const char *path, VALUE ary));
@@ -787,17 +797,19 @@
 }
 
 static void
-push_globs(ary, s)
+push_globs(ary, s, flags)
     VALUE ary;
     char *s;
+    int flags;
 {
-    rb_glob(s, push_pattern, ary);
+    rb_glob_with_flags(s, flags, push_pattern, ary);
 }
 
 static void
-push_braces(ary, s)
+push_braces(ary, s, flags)
     VALUE ary;
     char *s;
+    int flags;
 {
     char buffer[MAXPATHLEN], *buf = buffer;
     char *p, *t, *b;
@@ -837,28 +849,40 @@
 	    }
 	    memcpy(b, t, p-t);
 	    strcpy(b+(p-t), rbrace+1);
-	    push_braces(ary, buf);
+	    push_braces(ary, buf, flags);
 	}
 	if (buf != buffer)
 	    free(buf);
     }
     else {
-	push_globs(ary, s);
+	push_globs(ary, s, flags);
     }
 }
 
 #define isdelim(c) ((c)=='\0')
 
 static VALUE
-dir_s_glob(dir, str)
-    VALUE dir, str;
+dir_s_glob(argc, argv, obj)
+    int argc;
+    VALUE *argv;
+    VALUE obj;
 {
+    VALUE str, rflags;
     char *p, *pend;
     char buffer[MAXPATHLEN], *buf;
     char *t;
     int nest;
+    int flags;
+    int noescape;
     VALUE ary = 0;
 
+    if (rb_scan_args(argc, argv, "11", &str, &rflags) == 2)
+	flags = NUM2INT(rflags);
+    else
+	flags = FNM_PERIOD;
+
+    noescape = flags & FNM_NOESCAPE;
+
     SafeStringValue(str);
     if (!rb_block_given_p()) {
 	ary = rb_ary_new();
@@ -879,7 +903,7 @@
 	while (p < pend && !isdelim(*p)) {
 	    if (*p == '{') nest+=2;
 	    if (*p == '}') nest+=3;
-	    if (*p == '\\') {
+	    if (!noescape && *p == '\\') {
 		*t++ = *p++;
 		if (p == pend) break;
 	    }
@@ -887,10 +911,10 @@
 	}
 	*t = '\0';
 	if (nest == 0) {
-	    push_globs(ary, buf);
+	    push_globs(ary, buf, flags);
 	}
 	else if (nest % 5 == 0) {
-	    push_braces(ary, buf);
+	    push_braces(ary, buf, flags);
 	}
 	/* else unmatched braces */
     }
@@ -978,8 +1002,8 @@
     rb_define_singleton_method(rb_cDir,"delete", dir_s_rmdir, 1);
     rb_define_singleton_method(rb_cDir,"unlink", dir_s_rmdir, 1);
 
-    rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, 1);
-    rb_define_singleton_method(rb_cDir,"[]", dir_s_glob, 1);
+    rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, -1);
+    rb_define_singleton_method(rb_cDir,"[]", dir_s_glob, -1);
 
     rb_define_singleton_method(rb_cFile,"fnmatch", file_s_fnmatch, -1);
     rb_define_singleton_method(rb_cFile,"fnmatch?", file_s_fnmatch, -1);

In This Thread

Prev Next