From 9a46002fc01b1b874d768b2e8372b725a9e8b298 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 2 Oct 2000 07:48:42 +0000 Subject: [PATCH] matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 13 +++++++++++++ config.guess | 2 +- configure.in | 16 +++++++++------- lib/find.rb | 35 +++++++++++++++++++---------------- lib/mkmf.rb | 4 +++- main.c | 5 +++++ misc/ruby-mode.el | 4 ++-- regex.c | 2 +- ruby.c | 4 +++- sample/occur2.rb | 2 +- string.c | 2 +- win32/win32.c | 10 +--------- 12 files changed, 59 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1840a7023..63ad0140d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,20 @@ +Mon Oct 2 05:28:58 2000 akira yamada + + * string.c (trnext): minus at the end of pattern. + Sun Oct 1 00:43:34 2000 WATANABE Hirofumi * configure.in: exp-name was wrong on cygwin and mingw32. +Thu Sep 28 14:57:09 2000 Yukihiro Matsumoto + + * regex.c (re_compile_pattern): should try must_string calculation + every time. + +Tue Sep 19 23:47:44 2000 SHIROYAMA Takayuki + + * configure.in, config.guess, config.sub: MacOS X support. + Wed Sep 27 18:40:05 2000 Yukihiro Matsumoto * stable version 1.6.1 released. diff --git a/config.guess b/config.guess index 30e8136c9a..e1fe8d1562 100644 --- a/config.guess +++ b/config.guess @@ -970,7 +970,7 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - echo ${UNAME_MACHINE}-apple-darwin${UNAME_RELEASE} + echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; esac diff --git a/configure.in b/configure.in index e4dbcd166e..806e0869cf 100644 --- a/configure.in +++ b/configure.in @@ -57,9 +57,11 @@ AC_ARG_ENABLE(fat-binary, # to ensure AC_HEADER_SYS_WAIT works AC_DEFINE(_POSIX_SOURCE) ;; - darwin*) + macos*|darwin*) echo -n "MacOS X (Darwin): " - TARGET_ARCHS="ppc" + if test "$TARGET_ARCHS" = "" ; then + TARGET_ARCHS="ppc i386" + fi ;; esac # /usr/lib/arch_tool -archify_list $TARGET_ARCHS @@ -164,7 +166,7 @@ case "$target_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; -darwin*) ;; +darwin*) LIBS="-lobjc $LIBS";; human*) ac_cv_func_getpgrp_void=yes;; beos*) ;; cygwin*) rb_cv_have_daylight=no;; @@ -731,7 +733,7 @@ LIBRUBYARG='$(LIBRUBY_A)' SOLIBS= case "$target_os" in - cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|os2_emx*) + cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|darwin*|os2_emx*) DLDLIBS="" ;; *) @@ -900,7 +902,7 @@ test "$program_suffix" != NONE && RUBY_INSTALL_NAME="${ri_prefix}ruby${ri_suffix}" case "$target_os" in - cygwin*|mingw*|*djgpp*) + cygwin*|mingw*|*djgpp*|os2_emx*) RUBY_LIB_PREFIX="/lib/ruby" ;; *) @@ -913,9 +915,9 @@ AC_ARG_WITH(sitedir, [--with-sitedir=DIR site libraries in DIR [PREFIX/lib/ruby/site_ruby]], [sitedir=$withval], [sitedir='${prefix}/lib/ruby/site_ruby']) -SITE_DIR="`eval "echo ${sitedir}"`" +SITE_DIR="`eval \"echo ${sitedir}\"`" case "$target_os" in - cygwin*|mingw*|*djgpp*) + cygwin*|mingw*|*djgpp*|os2_emx*) RUBY_SITE_LIB_PATH="`expr "$SITE_DIR" : "$prefix\(/.*\)"`" || RUBY_SITE_LIB_PATH="$SITE_DIR";; *) diff --git a/lib/find.rb b/lib/find.rb index e79756a918..80bb5d6f59 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -10,27 +10,30 @@ module Find def find(*path) while file = path.shift - catch(:prune) { + catch(:prune) do yield file - if File.lstat(file).directory? then - d = Dir.open(file) - begin - for f in d - next if f == "." or f == ".." - if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then - f = file + f - elsif file == "/" then - f = "/" + f - else - f = File.join(file, f) + begin + if File.lstat(file).directory? then + d = Dir.open(file) + begin + for f in d + next if f == "." or f == ".." + if File::ALT_SEPARATOR and file =~ /^(?:[\/\\]|[A-Za-z]:[\/\\]?)$/ then + f = file + f + elsif file == "/" then + f = "/" + f + else + f = File.join(file, f) + end + path.unshift f end - path.unshift f + ensure + d.close end - ensure - d.close end + rescue Errno::ENOENT end - } + end end end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 37e06a3a1a..659ecbaa72 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -343,7 +343,7 @@ def create_makefile(target) print "creating Makefile\n" rm_f "conftest*" STDOUT.flush - if target.rindex(%r!/!) + if target.rindex(%r!/!) #/ target = $' target_prefix = "/"+$` else @@ -529,3 +529,5 @@ end $CFLAGS = idir || "" $LDFLAGS = ldir || "" + +$hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32/ diff --git a/main.c b/main.c index bea1f49a82..9e2c05ceae 100644 --- a/main.c +++ b/main.c @@ -28,6 +28,11 @@ int _CRT_glob = 0; #include #endif +/* to link startup code with ObjC support */ +#if defined(__APPLE__) && defined(__MACH__) +static void objcdummyfunction( void ) { objc_msgSend(); } +#endif + int main(argc, argv, envp) int argc; diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index b5d70403e0..787a048b37 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -670,9 +670,9 @@ An end of a defun is found by moving forward from the beginning of one." (setq font-lock-syntactic-keywords '(("\\$\\([#\"'`$\\]\\)" 1 (1 . nil)) ("\\(#\\)[{$@]" 1 (1 . nil)) - ("\\(/\\).*\\(/\\)" + ("\\(/\\)\\([^/]\\|\\\\/\\)*\\(/\\)" (1 (7 . ?')) - (2 (7 . ?'))))) + (3 (7 . ?'))))) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '((ruby-font-lock-keywords) nil nil)) (setq font-lock-keywords ruby-font-lock-keywords))) diff --git a/regex.c b/regex.c index 668773fb49..d4c1c2a915 100644 --- a/regex.c +++ b/regex.c @@ -2395,7 +2395,7 @@ re_compile_pattern(pattern, size, bufp) bufp->must = laststart+1; } } - else { + if (!bufp->must) { bufp->must = calculate_must_string(bufp->buffer, b); } if (current_mbctype == MBCTYPE_SJIS) bufp->options |= RE_OPTIMIZE_NO_BM; diff --git a/ruby.c b/ruby.c index ddff163dbb..52c551c017 100644 --- a/ruby.c +++ b/ruby.c @@ -205,7 +205,7 @@ ruby_incpush(path) void ruby_init_loadpath() { -#if defined(_WIN32) || defined(DJGPP) +#if defined(_WIN32) || defined(DJGPP) || defined(__EMX__) char libpath[FILENAME_MAX+1]; char *p; size_t rest; @@ -214,6 +214,8 @@ ruby_init_loadpath() #elif defined(DJGPP) extern char *__dos_argv0; strncpy(libpath, __dos_argv0, FILENAME_MAX); +#elif defined(__EMX__) + _execname(libpath, FILENAME_MAX); #endif p = strrchr(libpath, '\\'); if (p) { diff --git a/sample/occur2.rb b/sample/occur2.rb index c450c30b0f..b8ecf70904 100644 --- a/sample/occur2.rb +++ b/sample/occur2.rb @@ -5,7 +5,7 @@ while gets() for word in $_.split(/\W+/) begin freq[word] = freq[word] + 1 - rescue + rescue NameError freq[word] = 1 end end diff --git a/string.c b/string.c index 40207e5ba4..ff9e6bd0c2 100644 --- a/string.c +++ b/string.c @@ -1797,7 +1797,7 @@ trnext(t) if (!t->gen) { if (t->p == t->pend) return -1; t->now = *(USTR)t->p++; - if (t->p < t->pend && *t->p == '-') { + if (t->p < t->pend - 1 && *t->p == '-') { t->p++; if (t->p < t->pend) { if (t->now > *(USTR)t->p) { diff --git a/win32/win32.c b/win32/win32.c index 49b781f677..9142c4d94a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1904,7 +1904,6 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, long r; fd_set file_rd; fd_set file_wr; - fd_set trap; int file_nfds; int trap_immediate = rb_trap_immediate; @@ -1925,16 +1924,9 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, if (wr) *wr = file_wr; return file_nfds; } - if (ex) - trap = *ex; - else - trap.fd_count = 0; - if (trap.fd_count < FD_SETSIZE) - trap.fd_array[trap.fd_count++] = rb_InterruptEvent; - // else unable to catch interrupt. if (trap_immediate) TRAP_END; - if ((r = select (nfds, rd, wr, &trap, timeout)) == SOCKET_ERROR) { + if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) { errno = WSAGetLastError(); switch (errno) { case WSAEINTR: