Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
regexp,range,squeeze
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed May 10, 1999
1 parent 192463c commit 27e948f
Show file tree
Hide file tree
Showing 19 changed files with 574 additions and 437 deletions.
37 changes: 37 additions & 0 deletions ChangeLog
@@ -1,3 +1,40 @@
Mon May 10 00:59:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>

* lib/jcode.rb: forgot to squeeze on reverse (complement) case.

* string.c (tr_squeeze): should not set modify flag to be honest,
if the string is not modified.

* signal.c (Init_signal): SIGTERM should not be handled.

* regex.c (re_match): seeking for longest match is now optional,
which can be set using RE_OPTION_POSIXMATCH. This satisfies
POSIX longest match as much as Emacs's posix-* functions, which
are known to be incomplete.

Sun May 9 13:04:01 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>

* ext/socket/socket.c (sock_s_getaddrinfo): conversion from
Fixnums to C integers needed.

Sun May 9 11:51:43 1999 Koji Arai <JCA02266@nifty.ne.jp>

* range.c (range_eqq): reverse condition.

* range.c (range_s_new): default should be end inclusive.

Sat May 8 03:27:51 1999 Yukihiro Matsumoto <matz@netlab.co.jp>

* ext/socket/socket.c (thread_connect): replace nasty
rb_thread_fd_writable() with rb_thread_select().

Fri May 7 20:49:00 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>

* ext/socket/getaddrinfo.c (inet_pton): wrong parameter to
inet_aton().

* ext/socket/addrinfo.h (__P): silly cut and paste typo.

Fri May 7 17:03:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>

* dir.c (glob): removed GPL'ed glob.c completely.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -153,6 +153,7 @@ missing/memmove.c
missing/mkdir.c
missing/os2.c
missing/strcasecmp.c
missing/strncasecmp.c
missing/strchr.c
missing/strdup.c
missing/strerror.c
Expand Down
43 changes: 27 additions & 16 deletions dir.c
Expand Up @@ -345,12 +345,6 @@ has_magic(s, send)
return Qfalse;
}

struct glob1_arg {
void (*func)();
char *basename;
VALUE arg;
};

static char*
extract_path(p, pend)
char *p, *pend;
Expand Down Expand Up @@ -412,6 +406,11 @@ glob(path, func, arg)
DIR *dirp;
struct dirent *dp;

struct d_link {
char *path;
struct d_link *next;
} *tmp, *link = 0;

base = extract_path(path, p);
if (path == p) dir = ".";
else dir = base;
Expand All @@ -424,27 +423,39 @@ glob(path, func, arg)
magic = extract_elem(p);
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
if (fnmatch(magic, dp->d_name, FNM_PERIOD|FNM_PATHNAME) == 0) {
char *fix = ALLOC_N(char, strlen(base)+strlen(dp->d_name)+2);
char *fix = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2);

sprintf(fix, "%s%s%s", base, (p==path)?"":"/", dp->d_name);
sprintf(fix, "%s%s%s", base, (*base)?"/":"", dp->d_name);
if (!m) {
(*func)(fix, arg);
free(fix);
continue;
}
stat(fix, &st); /* should success */
if (S_ISDIR(st.st_mode)) {
char *t = ALLOC_N(char, strlen(fix)+strlen(m)+2);
sprintf(t, "%s%s", fix, m);
glob(t, func, arg);
free(t);
}
free(fix);
tmp = ALLOC(struct d_link);
tmp->path = fix;
tmp->next = link;
link = tmp;
}
}
closedir(dirp);
free(base);
free(magic);
while (link) {
stat(link->path, &st); /* should success */
if (S_ISDIR(st.st_mode)) {
int len = strlen(link->path);
int mlen = strlen(m);
char *t = ALLOC_N(char, len+mlen+1);

sprintf(t, "%s%s", link->path, m);
glob(t, func, arg);
free(t);
}
tmp = link;
link = link->next;
free(tmp->path);
free(tmp);
}
}
p = m;
}
Expand Down
25 changes: 13 additions & 12 deletions ext/extmk.rb.in
Expand Up @@ -71,8 +71,8 @@ CFLAGS = "@CFLAGS@".gsub(/-c..-stack=[0-9]+ */, '')
else
CFLAGS = "@CFLAGS@"
end
LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} %s %s conftest.c @LIBS@ %s"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} %s conftest.c"
LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} @LDFLAGS@ %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir -I@includedir@ #{CFLAGS} %s %s conftest.c"

if /cygwin|mswin32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ PLATFORM
$null = open("nul", "w")
Expand All @@ -98,7 +98,7 @@ def try_link0(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt))
xsystem(format(LINK, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS))
end

def try_link(src, opt="")
Expand All @@ -109,23 +109,23 @@ def try_link(src, opt="")
end
end

def try_cpp(src, opt=$CFLAGS)
def try_cpp(src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
begin
xsystem(format(CPP, opt))
xsystem(format(CPP, $CFLAGS, opt))
ensure
system "rm -f conftest*"
end
end

def egrep_cpp(pat, src, opt=$CFLAGS)
def egrep_cpp(pat, src, opt="")
cfile = open("conftest.c", "w")
cfile.print src
cfile.close
begin
xsystem(format(CPP+"|egrep #{pat}", opt))
xsystem(format(CPP+"|egrep #{pat}", $CFLAGS, opt))
ensure
system "rm -f conftest*"
end
Expand Down Expand Up @@ -268,7 +268,7 @@ def arg_config(config, default=nil)
if /=/ =~ arg
$configure_args[$`] = $'
else
$configure_args[arg] = default
$configure_args[arg] = true
end
end
end
Expand All @@ -283,7 +283,7 @@ def with_config(config, default=nil)
end

def enable_config(config, default=nil)
if arg_config("--enable-"+config, true)
if arg_config("--enable-"+config, default)
true
elsif arg_config("--disable-"+config, false)
false
Expand Down Expand Up @@ -335,6 +335,7 @@ srcdir = #{$srcdir}
VPATH = #{$srcdir}
hdrdir = #{$topdir}
DESTDIR =
CC = @CC@
Expand All @@ -360,7 +361,7 @@ ruby_inc = #{$ruby_inc}
#### End of system configuration section. ####
"
mfile.printf "LOCAL_LIBS = %s\n", $local_libs unless $local_libs == ""
mfile.printf "LOCAL_LIBS = %s\n", $LOCAL_LIBS unless $LOCAL_LIBS == ""
mfile.printf "LIBS = %s\n", $libs
mfile.printf "OBJS = "
if !$objs then
Expand Down Expand Up @@ -472,7 +473,7 @@ def extmake(target)

$objs = nil
$libs = PLATFORM =~ /cygwin|beos|openstep|nextstep|rhapsody/ ? nil : "-lc"
$local_libs = "" # to be assigned in extconf.rb
$LOCAL_LIBS = "" # to be assigned in extconf.rb
$CFLAGS = ""
$LDFLAGS = ""

Expand Down Expand Up @@ -509,7 +510,7 @@ def extmake(target)
$extlibs ||= ""
$extlibs += " " + $LDFLAGS unless $LDFLAGS == ""
$extlibs += " " + $libs if $libs
$extlibs += " " + $local_libs unless $local_libs == ""
$extlibs += " " + $LOCAL_LIBS unless $LOCAL_LIBS == ""
end
ensure
system "rm -f conftest*"
Expand Down

0 comments on commit 27e948f

Please sign in to comment.