[#26975] [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>

山本です。

56 messages 2005/09/07
[#26976] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/07

まつもと ゆきひろです

[#26977] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/07

山本です。

[#26978] Re: [proposal] ANSI style function — nobu@... 2005/09/07

なかだです。

[#26979] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/07

山本です。

[#26980] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/07

まつもと ゆきひろです

[#26983] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26988] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26989] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26990] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/08

まつもと ゆきひろです

[#26991] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/08

山本です。

[#26995] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/09

山本です。

[#26996] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/09

まつもと ゆきひろです

[#26998] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/09

山本です。

[#27000] Re: [proposal] ANSI style function — Takahiro Kambe <taca@...> 2005/09/09

In message <20050909220539.E1B26BB8.ocean@m2.ccsnet.ne.jp>

[#27001] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27002] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27003] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27004] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27005] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27006] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27007] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27008] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27009] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27011] Re: [proposal] ANSI style function — Yukihiro Matsumoto <matz@...> 2005/09/10

まつもと ゆきひろです

[#27013] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/10

山本です。

[#27016] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/11

山本です。

[#27015] Re: [proposal] ANSI style function — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/11

山本です。

[#26984] elimination of "extern int errno;" — Takahiro Kambe <taca@...>

こんにちは。

48 messages 2005/09/08
[#27023] sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <20050908.120716.71112483.taca@back-street.net>

[#27024] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27025] Re: sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <1126489480.743964.31599.nullmailer@x31.priv.netlab.jp>

[#27027] Re: sizeof(FILE) problem on DragonFly BSD — Takahiro Kambe <taca@...> 2005/09/12

In message <20050912.104954.92585084.taca@back-street.net>

[#27029] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27035] Re: sizeof(FILE) problem on DragonFly BSD — "U.Nakamura" <usa@...> 2005/09/12

こんにちは、なかむら(う)です。

[#27036] Re: sizeof(FILE) problem on DragonFly BSD — Yukihiro Matsumoto <matz@...> 2005/09/12

まつもと ゆきひろです

[#27079] ruby-1.8.3 status for release (Re: Re: sizeof(FILE) problem on DragonFly BSD) — Masayoshi Takahashi <maki@...> 2005/09/15

高橋征義です。

[#27081] Re: ruby-1.8.3 status for release (Re: Re: sizeof(FILE) problem on DragonFly BSD) — Yukihiro Matsumoto <matz@...> 2005/09/15

まつもと ゆきひろです

[#27082] Re: ruby-1.8.3 status for release — Masayoshi Takahashi <maki@...> 2005/09/15

高橋征義です。

[#27083] Re: ruby-1.8.3 status for release — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/09/15

山本です。

[#27099] Re: ruby-1.8.3 status for release — Hidetoshi NAGAI <nagai@...> 2005/09/15

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

[#27531] ruby/tk installation without tcl/tk (for 1.8.4) — "H.Yamamoto" <ocean@...2.ccsnet.ne.jp> 2005/10/26

山本です。

[#27619] Re: ruby/tk installation without tcl/tk (for 1.8.4) — Hidetoshi NAGAI <nagai@...> 2005/11/02

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

[#27139] ruby-1.8.3 status for release — Masayoshi Takahashi <maki@...>

高橋征義です。

66 messages 2005/09/18
[#27193] Re: ruby-1.8.3 status for release — TAKAHASHI Masayoshi <maki@...> 2005/09/20

高橋征義です。

[#27251] 脆弱性レポート翻訳者募集 — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

13 messages 2005/09/21

[#27321] RubyGemsとOS platformとの関係 — Daigo Moriwaki <techml@...>

こんにちは、森脇です。

42 messages 2005/09/26
[#27327] Re: RubyGemsとOS platformとの関係 — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/09/27

なかだです。

[#27330] Re: RubyGemsとOS platformとの関係 — Yukihiro Matsumoto <matz@...> 2005/09/27

まつもと ゆきひろです

[#27337] Re: RubyGems と OS platform との関係 — NISHIO Mizuho <jurader@...> 2005/09/27

西尾瑞穂 と言います。

[#27343] Re: RubyGems と OS platform との関係 — Yukihiro Matsumoto <matz@...> 2005/09/28

まつもと ゆきひろです

[#27347] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/09/28

In article <1127872084.608903.6359.nullmailer@x31.priv.netlab.jp>,

[#27348] Re: RubyGems と OS platform との関係 — Yukihiro Matsumoto <matz@...> 2005/09/28

まつもと ゆきひろです

[#27359] Re: RubyGems と OS platform との関係 — Daigo Moriwaki <techml@...> 2005/09/28

森脇です。

[#27364] Re: RubyGems と OS platform との関係 — akira yamada / やまだあきら <akira@...> 2005/09/30

Daigo Moriwaki wrote:

[#27365] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/09/30

In article <433CC31E.20802@ruby-lang.org>,

[#27367] Re: RubyGems と OS platform との関係 — akira yamada / やまだあきら <akira@...> 2005/09/30

Tanaka Akira wrote:

[#27369] Re: RubyGems と OS platform との関係 — Tanaka Akira <akr@...17n.org> 2005/10/01

In article <433D4CED.9030005@ruby-lang.org>,

[ruby-dev:27105] Dir.glob delimiter

From: nobuyoshi nakada <nobuyoshi.nakada@...>
Date: 2005-09-16 06:06:03 UTC
List: ruby-dev #27105
なかだです。

1.9でDir.globのdelimiterで分ける機能が働いてません。

  $ ls -d d*
  defines.h  djgpp  dln.h      dmydln.c  doc
  dir.c      dln.c  dmyconf.c  dmyext.c

  $ ls *.h
  defines.h  missing.h    regenc.h    ruby.h     util.h
  dln.h      node.h       regex.h     rubyio.h   version.h
  env.h      oniguruma.h  regint.h    rubysig.h
  intern.h   re.h         regparse.h  st.h

  $ ruby -v -e 'p Dir["d*\0*.h"]'
  ruby 1.9.0 (2005-09-16) [i386-cygwin]
  ["defines.h", "dir.c", "djgpp", "dln.c", "dln.h", "dmyconf.c",
  "dmydln.c", "dmyext.c", "doc", "defines.h", "dir.c", "djgpp",
  "dln.c", "dln.h", "dmyconf.c", "dmydln.c", "dmyext.c", "doc"]

また、win32/win32.c:rb_w32_cmdvector()では'{'もglobの対象にしていますが、
rb_glob()(ruby_glob()でも)ではbrace expansionは行っていません。


Index: dir.c
===================================================================
RCS file: /cvs/ruby/src/ruby/dir.c,v
retrieving revision 1.147
diff -U2 -p -r1.147 dir.c
--- dir.c	14 Sep 2005 13:40:43 -0000	1.147
+++ dir.c	16 Sep 2005 05:32:13 -0000
@@ -1111,6 +1111,6 @@ enum answer { YES, NO, UNKNOWN };
 struct glob_args {
     void (*func)(const char *, VALUE);
-    const char *c;
-    VALUE v;
+    const char *path;
+    VALUE value;
 };
 
@@ -1120,5 +1120,5 @@ glob_func_caller(VALUE val)
     struct glob_args *args = (struct glob_args *)val;
 
-    (*args->func)(args->c, args->v);
+    (*args->func)(args->path, args->value);
     return Qnil;
 }
@@ -1135,5 +1135,5 @@ glob_helper(
     struct glob_pattern **end,
     int flags,
-    int (*func)(const char *, VALUE),
+    ruby_glob_func *func,
     VALUE arg)
 {
@@ -1287,5 +1287,5 @@ glob_helper(
 
 static int
-ruby_glob0(const char *path, int flags, int (*func)(const char *, VALUE), VALUE arg)
+ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg)
 {
     struct glob_pattern *list;
@@ -1319,5 +1319,5 @@ ruby_glob0(const char *path, int flags, 
 
 int
-ruby_glob(const char *path, int flags, int (*func)(const char *, VALUE), VALUE arg)
+ruby_glob(const char *path, int flags, ruby_glob_func *func, VALUE arg)
 {
     return ruby_glob0(path, flags & ~GLOB_VERBOSE, func, arg);
@@ -1330,5 +1330,5 @@ rb_glob_caller(const char *path, VALUE a
     struct glob_args *args = (struct glob_args *)a;
 
-    args->c = path;
+    args->path = path;
     rb_protect(glob_func_caller, a, &status);
     return status;
@@ -1341,5 +1341,5 @@ rb_glob2(const char *path, int flags, vo
 
     args.func = func;
-    args.v = arg;
+    args.value = arg;
 
     if (flags & FNM_CASEFOLD) {
@@ -1351,5 +1351,5 @@ rb_glob2(const char *path, int flags, vo
 
 void
-rb_glob(const char *path, void (*func) (const char *, VALUE), VALUE arg)
+rb_glob(const char *path, void (*func)(const char *, VALUE), VALUE arg)
 {
     int status = rb_glob2(path, 0, func, arg);
@@ -1363,6 +1363,6 @@ push_pattern(const char *path, VALUE ary
 }
 
-static int
-push_glob(VALUE ary, const char *str, long offset, int flags)
+int
+ruby_brace_expand(const char *str, int flags, ruby_glob_func *func, VALUE arg)
 {
     const int escape = !(flags & FNM_NOESCAPE);
@@ -1387,9 +1387,7 @@ push_glob(VALUE ary, const char *str, lo
 
     if (lbrace && rbrace) {
-	volatile VALUE buffer = rb_str_new(0, strlen(s));
-	char *buf;
+	char *buf = ALLOC_N(char, strlen(s) + 1);
 	long shift;
 
-	buf = RSTRING(buffer)->ptr;
 	memcpy(buf, s, lbrace-s);
 	shift = (lbrace-s);
@@ -1408,10 +1406,11 @@ push_glob(VALUE ary, const char *str, lo
 	    memcpy(buf+shift, t, p-t);
 	    strcpy(buf+shift+(p-t), rbrace+1);
-	    status = push_glob(ary, buf, offset, flags);
+	    status = ruby_brace_expand(buf, flags, func, arg);
 	    if (status) break;
 	}
+	free(buf);
     }
     else if (!lbrace && !rbrace) {
-	status = rb_glob2(s, flags, push_pattern, ary);
+	status = (*func)(s, arg);
     }
 
@@ -1419,4 +1418,45 @@ push_glob(VALUE ary, const char *str, lo
 }
 
+struct brace_args {
+    ruby_glob_func *func;
+    VALUE value;
+    int flags;
+};
+
+static int
+glob_brace(const char *path, VALUE val)
+{
+    struct brace_args *arg = (struct brace_args *)val;
+
+    return ruby_glob0(path, arg->flags, arg->func, arg->value);
+}
+
+static int
+ruby_brace_glob0(const char *str, int flags, ruby_glob_func *func, VALUE arg)
+{
+    struct brace_args args;
+
+    args.func = func;
+    args.value = arg;
+    args.flags = flags;
+    return ruby_brace_expand(str, flags, glob_brace, (VALUE)&args);
+}
+
+int
+ruby_brace_glob(const char *str, int flags, ruby_glob_func *func, VALUE arg)
+{
+    return ruby_brace_glob0(str, flags & ~GLOB_VERBOSE, func, arg);
+}
+
+static int
+push_glob(VALUE ary, const char *str, int flags)
+{
+    struct glob_args args;
+
+    args.func = push_pattern;
+    args.value = ary;
+    return ruby_brace_glob0(str, flags | GLOB_VERBOSE, rb_glob_caller, (VALUE)&args);
+}
+
 static VALUE
 rb_push_glob(VALUE str, int flags) /* '\0' is delimiter */
@@ -1430,7 +1470,8 @@ rb_push_glob(VALUE str, int flags) /* '\
 
     while (offset < RSTRING(str)->len) {
-	int status = push_glob(ary, RSTRING(str)->ptr, offset, flags);
+	int status = push_glob(ary, RSTRING(str)->ptr + offset, flags);
 	char *p, *pend;
 	if (status) rb_jump_tag(status);
+	if (offset >= RSTRING(str)->len) break;
 	p = RSTRING(str)->ptr + offset;
 	p += strlen(p) + 1;
Index: ruby.h
===================================================================
RCS file: /cvs/ruby/src/ruby/ruby.h,v
retrieving revision 1.122
diff -U2 -p -r1.122 ruby.h
--- ruby.h	14 Sep 2005 13:40:43 -0000	1.122
+++ ruby.h	16 Sep 2005 04:38:33 -0000
@@ -493,6 +493,9 @@ struct RBignum {
 void rb_obj_infect(VALUE,VALUE);
 
+typedef int ruby_glob_func(const char*,VALUE);
 void rb_glob(const char*,void(*)(const char*,VALUE),VALUE);
-int ruby_glob(const char*,int,int(*)(const char*,VALUE),VALUE);
+int ruby_glob(const char*,int,ruby_glob_func*,VALUE);
+int ruby_brace_expand(const char*,int,ruby_glob_func*,VALUE);
+int ruby_brace_glob(const char*,int,ruby_glob_func*,VALUE);
 
 VALUE rb_define_class(const char*,VALUE);
Index: win32/win32.c
===================================================================
RCS file: /cvs/ruby/src/ruby/win32/win32.c,v
retrieving revision 1.169
diff -U2 -p -r1.169 win32.c
--- win32/win32.c	15 Sep 2005 02:03:43 -0000	1.169
+++ win32/win32.c	16 Sep 2005 04:58:33 -0000
@@ -1062,5 +1369,5 @@ cmdglob(NtCmdLineElement *patt, NtCmdLin
 	if (*p == '\\')
 	    *p = '/';
-    ruby_glob(buf, 0, insert, (VALUE)&tail);
+    ruby_brace_glob(buf, 0, insert, (VALUE)&tail);
     if (buf != buffer)
 	free(buf);


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next