diff -ur ruby-1.6.5/bignum.c ruby/bignum.c --- ruby-1.6.5/bignum.c Fri Aug 24 15:36:14 2001 +++ ruby/bignum.c Sat Oct 13 23:33:54 2001 @@ -14,6 +14,14 @@ #include #include +#include +#ifndef isinf +#define isinf !_finite +#endif +#ifndef isnan +#define isnan _isnan +#endif + VALUE rb_cBignum; #if defined __MINGW32__ diff -ur ruby-1.6.5/dir.c ruby/dir.c --- ruby-1.6.5/dir.c Thu Sep 6 18:32:10 2001 +++ ruby/dir.c Sat Oct 13 23:40:28 2001 @@ -566,7 +566,7 @@ } #ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +# define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR) #endif void diff -ur ruby-1.6.5/dln.c ruby/dln.c --- ruby-1.6.5/dln.c Fri Aug 24 15:35:24 2001 +++ ruby/dln.c Sat Oct 13 19:17:56 2001 @@ -51,7 +51,7 @@ #include #ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +# define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR) #endif #ifdef HAVE_SYS_PARAM_H diff -ur ruby-1.6.5/error.c ruby/error.c --- ruby-1.6.5/error.c Mon Sep 3 14:20:48 2001 +++ ruby/error.c Sat Oct 13 23:40:56 2001 @@ -23,6 +23,26 @@ #define va_init_list(a,b) va_start(a) #endif +void +#ifdef HAVE_STDARG_PROTOTYPES +dprintf(const char *fmt, ...) +#else +dprintf(fmt, va_alist) + const char *fmt; + va_dcl +#endif +{ + FILE *fp; + va_list args; + + if ((fp = fopen("debug.log", "a")) != NULL) { + va_init_list(args, fmt); + vfprintf(fp, fmt, args); + va_end(args); + fclose(fp); + } +} + #if defined __CYGWIN__ # include # if (CYGWIN_VERSION_API_MAJOR > 0) || (CYGWIN_VERSION_API_MINOR >= 8) @@ -657,6 +677,7 @@ int n = errno; VALUE ee; + if (errno == EPIPE) return; // (*moriq*) err = strerror(errno); if (mesg) { volatile VALUE tmp = rb_str_inspect(rb_str_new2(mesg)); diff -ur ruby-1.6.5/ext/extmk.rb.in ruby/ext/extmk.rb.in --- ruby-1.6.5/ext/extmk.rb.in Fri Jul 27 17:52:20 2001 +++ ruby/ext/extmk.rb.in Mon Oct 15 01:50:12 2001 @@ -28,14 +28,14 @@ $includedir = "@includedir@".gsub(/\$\{prefix\}|\$\(prefix\)/,'@prefix@') $top_srcdir = "@top_srcdir@" -if $top_srcdir !~ "^/" +if $top_srcdir !~ "^" + File::SEPARATOR # get absolute path $top_srcdir = File.expand_path($top_srcdir) end # get absolute path $topdir = File.expand_path("..") -$:.replace [$top_srcdir, $top_srcdir+"/lib", "."] +$:.replace [$top_srcdir, File.join($top_srcdir, "lib"), "."] require 'find' @@ -68,7 +68,7 @@ else CFLAGS = "@CFLAGS@" end -LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@" +LINK = "@CC@ -econftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s %s conftest.c %s %s @LIBS@" CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s %s conftest.c" $log = open('extmk.log', 'w') @@ -94,12 +94,8 @@ cfile.print src cfile.close ldflags = $LDFLAGS - if /mswin32/ =~ RUBY_PLATFORM and !$LIBPATH.empty? - ENV['LIB'] = ($LIBPATH + [ORIG_LIBPATH]).compact.join(';') - else - $LDFLAGS = ldflags.dup - $LIBPATH.each {|d| $LDFLAGS << " -L" + d} - end + $LDFLAGS = ldflags.dup + $LIBPATH.each {|d| $LDFLAGS << " -L" + d} begin xsystem(format(LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS)) ensure @@ -156,7 +152,7 @@ def install_rb(mfile, srcdir = nil) libdir = "lib" - libdir = srcdir + "/" + libdir if srcdir + libdir = File.join(srcdir, libdir) if srcdir path = [] dir = [] if File.directory? libdir @@ -383,14 +379,11 @@ $LIBPATH.unshift $topdir end - defflag = '' - if RUBY_PLATFORM =~ /cygwin|mingw/ and not $static - if not File.exist? target + '.def' - open(target + '.def', 'wb') do |f| - f.print "EXPORTS\n", "Init_", target, "\n" - end + deffile = target + '.def' + if not File.exist? deffile + open(deffile, 'wb') do |f| + f.print "EXPORTS\n", "_Init_", target, "\n" end - defflag = "--def=" + target + ".def" end if RUBY_PLATFORM =~ /mswin32/ @@ -399,7 +392,7 @@ $LIBPATH.each {|d| $DLDFLAGS << " -L" << d} end - $srcdir = $top_srcdir + "/ext/" + $mdir + $srcdir = File.join($top_srcdir, "ext", $mdir) mfile = open("Makefile", "w") mfile.binmode if /mingw/ =~ RUBY_PLATFORM mfile.printf "\ @@ -417,8 +410,8 @@ CFLAGS = %s #{CFLAGS} #$CFLAGS CPPFLAGS = -I$(topdir) -I$(hdrdir) -I@includedir@ %s #$CPPFLAGS -DLDFLAGS = #$DLDFLAGS #$LDFLAGS -LDSHARED = @LDSHARED@ #{defflag} +DLDFLAGS = #$LDFLAGS -L$(topdir:/=\\) +LDSHARED = @LDSHARED@ ", if $static then "" else "@CCDLFLAGS@" end, $defs.join(" ") mfile.puts "LIBPATH = #{libpath}" if libpath @@ -443,26 +436,18 @@ " mfile.printf "LOCAL_LIBS = %s %s\n", $LOCAL_LIBS, $local_flags mfile.printf "LIBS = %s\n", $libs + mfile.printf "OBJS = " - if !$objs then - $objs = [] - for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{#{SRC_EXT.join(%q{,})}}"] - f = File.basename(f) - f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT) - $objs.push f - end - else - for i in $objs - i.sub!(/\.o\z/, ".#{$OBJEXT}") - end + $objs = [] + for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{#{SRC_EXT.join(%q{,})}}"] + f = File.basename(f) + f.sub!(/(#{SRC_EXT.join(%q{|})})$/, $OBJEXT) + $objs.push f end mfile.printf $objs.join(" ") mfile.printf "\n" - ruby_interpreter = "$(topdir)/miniruby@EXEEXT@" - if /nmake/i =~ $make - ruby_interpreter = '$(topdir:/=\)\miniruby@EXEEXT@' - end + ruby_interpreter = '$(topdir:/=\)\miniruby@EXEEXT@' if defined? CROSS_COMPILING ruby_interpreter = "@MINIRUBY@" end @@ -478,7 +463,8 @@ all: $(DLLIB) -clean:; @$(RM) *.#{$OBJEXT} *.so *.sl *.#{$LIBEXT} $(DLLIB) +clean: + @$(RM) *.#{$OBJEXT} *.so *.sl *.#{$LIBEXT} $(DLLIB) @$(RM) *.ilk *.exp *.pdb *.bak $(CLEANFILES) distclean: clean @@ -502,26 +488,6 @@ install_rb(mfile, $srcdir) mfile.printf "\n" - unless /nmake/i =~ $make - unless /mswin32/ =~ RUBY_PLATFORM - src = '$<' - else - src = '$(subst /,\\\\,$<)' - end - mfile.puts " -.cc.@OBJEXT@: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c #{src} -.cpp.@OBJEXT@: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c #{src} -.cxx.@OBJEXT@: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c #{src} -.C.@OBJEXT@: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c #{src} - -.c.@OBJEXT@: - $(CC) $(CFLAGS) $(CPPFLAGS) -c #{src} -" - else mfile.print " {$(srcdir)}.c{}.@OBJEXT@: $(CC) -I. -I$(st_mode); + return UINT2NUM((unsigned short)(get_stat(self)->st_mode)); } static VALUE @@ -461,7 +461,7 @@ VALUE obj, fname; { #ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +# define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR) #endif struct stat st; @@ -477,7 +477,7 @@ { #ifdef S_IFIFO # ifndef S_ISFIFO -# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) +# define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO) # endif struct stat st; @@ -498,10 +498,10 @@ # define S_ISLNK(m) _S_ISLNK(m) # else # ifdef _S_IFLNK -# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK) +# define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == _S_IFLNK) # else # ifdef S_IFLNK -# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK) +# define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == S_IFLNK) # endif # endif # endif @@ -527,10 +527,10 @@ # define S_ISSOCK(m) _S_ISSOCK(m) # else # ifdef _S_IFSOCK -# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK) +# define S_ISSOCK(m) (((unsigned short)(m) & S_IFMT) == _S_IFSOCK) # else # ifdef S_IFSOCK -# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK) +# define S_ISSOCK(m) (((unsigned short)(m) & S_IFMT) == S_IFSOCK) # endif # endif # endif @@ -552,7 +552,7 @@ { #ifndef S_ISBLK # ifdef S_IFBLK -# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK) +# define S_ISBLK(m) (((unsigned short)(m) & S_IFMT) == S_IFBLK) # else # define S_ISBLK(m) (0) /* anytime false */ # endif @@ -573,7 +573,7 @@ VALUE obj, fname; { #ifndef S_ISCHR -# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR) +# define S_ISCHR(m) (((unsigned short)(m) & S_IFMT) == S_IFCHR) #endif struct stat st; @@ -649,7 +649,7 @@ } #ifndef S_ISREG -# define S_ISREG(m) ((m & S_IFMT) == S_IFREG) +# define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG) #endif static VALUE diff -ur ruby-1.6.5/intern.h ruby/intern.h --- ruby-1.6.5/intern.h Thu Sep 6 16:42:22 2001 +++ ruby/intern.h Sat Oct 13 18:49:20 2001 @@ -103,6 +103,7 @@ /* enum.c */ VALUE rb_enum_length _((VALUE)); /* error.c */ +void dprintf __((const char*, ...)); EXTERN int ruby_nerrs; VALUE rb_exc_new _((VALUE, const char*, long)); VALUE rb_exc_new2 _((VALUE, const char*)); diff -ur ruby-1.6.5/io.c ruby/io.c --- ruby-1.6.5/io.c Wed Sep 5 15:53:28 2001 +++ ruby/io.c Sat Oct 13 19:26:08 2001 @@ -476,7 +476,7 @@ if (c == EOF) { if (ferror(f)) { if (errno == EINTR) continue; - rb_sys_fail(0); + if (errno != EPIPE) rb_sys_fail(0); } *ptr = '\0'; break; @@ -488,7 +488,7 @@ } #ifndef S_ISREG -# define S_ISREG(m) ((m & S_IFMT) == S_IFREG) +# define S_ISREG(m) (((unsigned short)(m) & S_IFMT) == S_IFREG) #endif #define SMALLBUF 100 @@ -2644,6 +2644,7 @@ Check_SafeStr(str); port = pipe_open(RSTRING(str)->ptr, "r"); + if (NIL_P(port)) return rb_str_new(0,0); result = read_all(port); diff -ur ruby-1.6.5/lib/mkmf.rb ruby/lib/mkmf.rb --- ruby-1.6.5/lib/mkmf.rb Fri Aug 17 14:04:34 2001 +++ ruby/lib/mkmf.rb Mon Oct 15 02:11:06 2001 @@ -360,6 +360,10 @@ [idir, ldir] end +def winsep(s) + s.tr('/', '\\') +end + def create_makefile(target, srcdir = File.dirname($0)) save_libs = $libs.dup save_libpath = $LIBPATH.dup @@ -385,14 +389,11 @@ $configure_args['--enable-shared'] or $LIBPATH |= [$topdir] $LIBPATH |= [CONFIG["libdir"]] - defflag = '' - if RUBY_PLATFORM =~ /cygwin|mingw/ - if not File.exist? target + '.def' - open(target + '.def', 'wb') do |f| - f.print "EXPORTS\n", "Init_", target, "\n" - end + deffile = target + '.def' + if not File.exist? deffile + open(deffile, 'wb') do |f| + f.print "EXPORTS\n", "_Init_", target, "\n" end - defflag = "--def=" + target + ".def" end if RUBY_PLATFORM =~ /mswin32/ @@ -433,8 +434,8 @@ CFLAGS = #{CONFIG["CCDLFLAGS"]} #{CFLAGS} #{$CFLAGS} CPPFLAGS = -I$(hdrdir) -I$(srcdir) -I#{CONFIG["includedir"]} #{$defs.join(" ")} #{CONFIG["CPPFLAGS"]} #{$CPPFLAGS} CXXFLAGS = $(CFLAGS) -DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS} -LDSHARED = #{CONFIG["LDSHARED"]} #{defflag} +DLDFLAGS = #{$LDFLAGS} -L$(libdir:/=\\) +LDSHARED = #{CONFIG["LDSHARED"]} LIBPATH = #{libpath} RUBY_INSTALL_NAME = #{CONFIG["RUBY_INSTALL_NAME"]} @@ -448,14 +449,14 @@ "" end } -prefix = $(DESTDIR)#{CONFIG["prefix"].sub(drive, '')} -exec_prefix = #{CONFIG["exec_prefix"].sub(drive, '')} -libdir = #{$libdir.sub(drive, '')} -rubylibdir = #{$rubylibdir.sub(drive, '')} -archdir = #{$archdir.sub(drive, '')} -sitedir = #{$sitedir.sub(drive, '')} -sitelibdir = #{$sitelibdir.sub(drive, '')} -sitearchdir = #{$sitearchdir.sub(drive, '')} +prefix = $(DESTDIR)#{CONFIG["prefix"]Section} +exec_prefix = #{CONFIG["exec_prefix"]Section} +libdir = #{$libdirSection} +rubylibdir = #{$rubylibdirSection} +archdir = #{$archdirSection} +sitedir = #{$sitedirSection} +sitelibdir = #{$sitelibdirSection} +sitearchdir = #{$sitearchdirSection} target_prefix = #{target_prefix} #### End of system configuration section. #### @@ -474,7 +475,8 @@ all: $(DLLIB) -clean:; @$(RM) *.#{$OBJEXT} *.so *.sl *.a $(DLLIB) +clean: + @$(RM) *.#{$OBJEXT} *.so *.sl *.a $(DLLIB) @$(RM) $(TARGET).lib $(TARGET).exp $(TARGET).ilk *.pdb $(CLEANFILES) distclean: clean @@ -502,21 +504,6 @@ install_rb(mfile, "$(sitelibdir)$(target_prefix)", srcdir) mfile.printf "\n" - if /mswin32/ !~ RUBY_PLATFORM - mfile.print " -.c.#{$OBJEXT}: - $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< - -.cc.#{$OBJEXT}: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -.cpp.#{$OBJEXT}: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -.cxx.#{$OBJEXT}: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -.C.#{$OBJEXT}: - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -" - elsif /nmake/i =~ $make mfile.print " {$(srcdir)}.c.#{$OBJEXT}: $(CC) $(CFLAGS) -I$( #endif +#include +#ifndef isinf +#define isinf !_finite +#endif +#ifndef isnan +#define isnan _isnan +#endif + static ID coerce; static ID to_i; @@ -212,10 +220,11 @@ double value = RFLOAT(flt)->value; double avalue, d1, d2; - if (isinf(value)) + if (isinf(value)) { return rb_str_new2(value < 0 ? "-Infinity" : "Infinity"); - else if(isnan(value)) + } else if(isnan(value)) { return rb_str_new2("NaN"); + } avalue = fabs(value); if (avalue == 0.0) { diff -ur ruby-1.6.5/parse.c ruby/parse.c --- ruby-1.6.5/parse.c Mon Sep 3 14:38:16 2001 +++ ruby/parse.c Fri Oct 12 23:21:38 2001 @@ -236,7 +236,9 @@ #ifndef __cplusplus #ifndef __STDC__ +#ifndef __BORLANDC__ #define const +#endif #endif #endif diff -ur ruby-1.6.5/ruby.h ruby/ruby.h --- ruby-1.6.5/ruby.h Fri Jul 13 14:48:26 2001 +++ ruby/ruby.h Sat Oct 13 18:45:22 2001 @@ -543,7 +543,7 @@ EXTERN VALUE rb_eLoadError; static inline VALUE -#if defined(__cplusplus) +#if defined(__cplusplus) || defined(HAVE_PROTOTYPES) rb_class_of(VALUE obj) #else rb_class_of(obj) @@ -560,7 +560,7 @@ } static inline int -#if defined(__cplusplus) +#if defined(__cplusplus) || defined(HAVE_PROTOTYPES) rb_type(VALUE obj) #else rb_type(obj) @@ -577,7 +577,7 @@ } static inline int -#if defined(__cplusplus) +#if defined(__cplusplus) || defined(HAVE_PROTOTYPES) rb_special_const_p(VALUE obj) #else rb_special_const_p(obj) diff -ur ruby-1.6.5/sample/test.rb ruby/sample/test.rb --- ruby-1.6.5/sample/test.rb Wed Mar 21 17:04:12 2001 +++ ruby/sample/test.rb Sat Oct 13 22:09:32 2001 @@ -1070,7 +1070,10 @@ ary = [1,-100,127,128,32767,987.654321098 / 100.0,12345,123456,-32767,-123456,"abcdef"] $x = ary.pack($format) ary2 = $x.unpack($format) - +p $format +ary.each{|i|p i} +p $x +p ary2 test_ok(ary.length == ary2.length) test_ok(ary.join(':') == ary2.join(':')) test_ok($x =~ /def/) diff -ur ruby-1.6.5/util.c ruby/util.c --- ruby-1.6.5/util.c Thu Mar 22 17:59:26 2001 +++ ruby/util.c Sat Oct 13 19:17:46 2001 @@ -71,7 +71,7 @@ #endif #ifndef S_ISDIR -# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +# define S_ISDIR(m) (((unsigned short)(m) & S_IFMT) == S_IFDIR) #endif #ifdef NT @@ -253,7 +253,7 @@ // It doesn't exist, so see if we can open it. */ - if ((fd = _open(s, O_CREAT, 0666)) >= 0) { + if ((fd = _sopen(s, O_CREAT, 0666)) >= 0) { _close(fd); _unlink (s); /* don't leave it laying around */ return 1; Only in ruby-1.6.5/win32: Makefile.sub Only in ruby/win32: README.bcc32 Only in ruby-1.6.5/win32: README.win32 diff -ur ruby-1.6.5/win32/config.h.in ruby/win32/config.h.in --- ruby-1.6.5/win32/config.h.in Tue Jul 24 18:01:26 2001 +++ ruby/win32/config.h.in Fri Oct 12 23:21:38 2001 @@ -40,7 +40,7 @@ #define HAVE_SEEKDIR 1 #define RSHIFT(x,y) ((x)>>y) -#define FILE_COUNT _cnt +#define FILE_COUNT level #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" diff -ur ruby-1.6.5/win32/config.status.in ruby/win32/config.status.in --- ruby-1.6.5/win32/config.status.in Tue Jul 24 18:01:26 2001 +++ ruby/win32/config.status.in Mon Oct 15 01:26:36 2001 @@ -1,10 +1,10 @@ s%@SHELL@%%g -s%@CFLAGS@%-nologo -DNT=1 -Zi -MD -O2b2x -G5%g +s%@CFLAGS@%-DNT=1 -O -5 -w-aus -w-pro%g s%@CPPFLAGS@%%g s%@CXXFLAGS@%%g s%@FFLAGS@%%g -s%@LDFLAGS@%-nologo%g -s%@LIBS@%user32.lib advapi32.lib wsock32.lib%g +s%@LDFLAGS@%%g +s%@LIBS@%%g s%@exec_prefix@%${prefix}%g s%@prefix@%%g s%@program_transform_name@%s,x,x,%g @@ -25,11 +25,11 @@ s%@host_cpu@%i586%g s%@host_vendor@%pc%g s%@host_os@%mswin32%g -s%@CC@%cl%g -s%@CPP@%cl -E%g +s%@CC@%bcc32%g +s%@CPP@%bcc32%g s%@YACC@%byacc%g s%@RANLIB@%rem%g -s%@AR@%lib -nologo%g +s%@AR@%tlib%g s%@LN_S@%%g s%@SET_MAKE@%%g s%@LIBOBJS@% crypt.obj win32.obj isinf.obj isnan.obj%g @@ -41,7 +41,7 @@ s%@DLDFLAGS@%$(CFLAGS)%g s%@STATIC@%%g s%@CCDLFLAGS@%-DIMPORT%g -s%@LDSHARED@%cl -LD%g +s%@LDSHARED@%ilink32 -Tpd%g s%@DLEXT@%so%g s%@DLEXT2@%dll%g s%@STRIP@%%g @@ -61,7 +61,7 @@ s%@ENABLE_SHARED@%yes%g s%@arch@%i586-mswin32%g s%@sitedir@%${prefix}/lib/ruby/site_ruby%g -s%@configure_args@%--with-make-prog=nmake --enable-shared%g +s%@configure_args@%--with-make-prog=make --enable-shared%g s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g diff -ur ruby-1.6.5/win32/configure.bat ruby/win32/configure.bat --- ruby-1.6.5/win32/configure.bat Thu Aug 3 18:55:54 2000 +++ ruby/win32/configure.bat Sat Oct 13 17:16:20 2001 @@ -5,9 +5,7 @@ echo> ~tmp~.mak #### echo>> ~tmp~.mak conf = %0 -echo>> ~tmp~.mak $(conf:\=/): nul +echo>> ~tmp~.mak $(conf:\=/): echo>> ~tmp~.mak @del ~tmp~.mak -echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)/setup.mak \ -if not "%1" == "" echo>> ~tmp~.mak srcdir="%1" \ -echo>> ~tmp~.mak WIN32DIR=$(@D) -nmake -alf ~tmp~.mak +echo>> ~tmp~.mak make -fsetup.mak +make -f~tmp~.mak diff -ur ruby-1.6.5/win32/dir.h ruby/win32/dir.h --- ruby-1.6.5/win32/dir.h Sat May 26 00:18:08 2001 +++ ruby/win32/dir.h Sat Oct 13 23:40:20 2001 @@ -1,9 +1,15 @@ +#ifndef WIN32_DIR_H_ +#define WIN32_DIR_H_ + +#include + struct direct { long d_namlen; ino_t d_ino; char d_name[256]; }; + typedef struct { char *start; char *curr; @@ -12,9 +18,41 @@ struct direct dirstr; } DIR; -DIR* opendir(const char*); -struct direct* readdir(DIR *); -long telldir(DIR *); -void seekdir(DIR *, long); -void rewinddir(DIR *); -void closedir(DIR *); +DIR* myopendir(const char*); +struct direct* myreaddir(DIR *); +long mytelldir(DIR *); +void myseekdir(DIR *, long); +void myrewinddir(DIR *); +void myclosedir(DIR *); + +#ifdef opendir +#undef opendir +#endif +#define opendir myopendir + +#ifdef readdir +#undef readdir +#endif +#define readdir myreaddir + +#ifdef telldir +#undef telldir +#endif +#define telldir mytelldir + +#ifdef seekdir +#undef seekdir +#endif +#define seekdir myseekdir + +#ifdef rewinddir +#undef rewinddir +#endif +#define rewinddir myrewinddir + +#ifdef closedir +#undef closedir +#endif +#define closedir myclosedir + +#endif Only in ruby/win32: makefile.sub diff -ur ruby-1.6.5/win32/mkexports.rb ruby/win32/mkexports.rb --- ruby-1.6.5/win32/mkexports.rb Thu Aug 3 18:55:54 2000 +++ ruby/win32/mkexports.rb Sat Oct 13 03:05:04 2001 @@ -1,18 +1,14 @@ #!./miniruby -s -SYM = {} - objs = ARGV.collect {|s| s.tr('/', '\\')} -IO.foreach("|dumpbin -symbols " + objs.join(' ')) do |l| - next if /^[0-9A-F]+ 0+ UNDEF / =~ l - next unless l.sub!(/.*\sExternal\s+\|\s+/, '') - if l.sub!(/^_/, '') - next if /@.*@/ =~ l - elsif !l.sub!(/^(\S+) \([^@?]*\)$/, '\1') - next - end - SYM[l.strip] = true -end +system("tdump -oiPUBDEF #{objs.join(' ')} > pub.def") + +syms = {} +IO.foreach('pub.def'){|l| + next unless /PUBDEF/ =~ l + /'(.*?)'/ =~ l + syms[$1] = true +} exports = [] if $name @@ -21,7 +17,7 @@ exports << "Library " + $library end exports << "Description " + $description.dump if $description -exports << "EXPORTS" << SYM.keys.sort +exports << "EXPORTS" << syms.keys.sort if $output open($output, 'w') {|f| f.puts exports} diff -ur ruby-1.6.5/win32/setup.mak ruby/win32/setup.mak --- ruby-1.6.5/win32/setup.mak Wed Mar 21 17:04:12 2001 +++ ruby/win32/setup.mak Sat Oct 13 17:16:32 2001 @@ -1,27 +1,21 @@ # -*- makefile -*- -!IF "$(WIN32DIR)" == "win32" -srcdir = . -!ELSEIF "$(WIN32DIR)" == "$(WIN32DIR:/win32=)/win32" -srcdir = $(WIN32DIR:/win32=) -!ELSE -srcdir = $(WIN32DIR)/.. -!ENDIF +srcdir = ./.. OS = mswin32 -all: config.h config.status -all: ext -all: Makefile -all:; @echo type `nmake' to make ruby for mswin32. +all: config.h config.status ext makefile + @echo type `make' to make ruby for mswin32. -Makefile: +makefile: @echo ### makefile for ruby $(OS) ###> $@ @echo srcdir = $(srcdir:\=/)>> $@ @echo RUBY_INSTALL_NAME = ruby>> $@ - @echo RUBY_SO_NAME = $(OS)-$$(RUBY_INSTALL_NAME)16>> $@ - @echo !INCLUDE $$(srcdir)/win32/Makefile.sub>> $@ + @echo RUBY_SO_NAME = $(OS)_$$(RUBY_INSTALL_NAME)16>> $@ + @echo !INCLUDE $$(srcdir)\win32\makefile.sub>> $@ -config.h config.status: $(srcdir)/win32/$$@.in +config.h config.status: $(srcdir)\win32\config.h.in @copy $(srcdir:/=\)\win32\$@.in $@ > nul -ext:; @if not exist $@\* mkdir $@ +ext: + -mkdir $@ + diff -ur ruby-1.6.5/win32/win32.c ruby/win32/win32.c --- ruby-1.6.5/win32/win32.c Fri Aug 24 15:35:24 2001 +++ ruby/win32/win32.c Mon Oct 15 02:13:18 2001 @@ -1291,7 +1291,7 @@ // DIR * -opendir(const char *filename) +myopendir(const char *filename) { DIR *p; long len; @@ -1310,7 +1310,7 @@ // if ((win32_stat (filename, &sbuf) < 0 || - sbuf.st_mode & _S_IFDIR == 0) && + (unsigned short)(sbuf.st_mode) & _S_IFDIR == 0) && (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { return NULL; @@ -1391,7 +1391,7 @@ // struct direct * -readdir(DIR *dirp) +myreaddir(DIR *dirp) { int len; static int dummy = 0; @@ -1431,7 +1431,7 @@ // long -telldir(DIR *dirp) +mytelldir(DIR *dirp) { return (long) dirp->curr; /* ouch! pointer to long cast */ } @@ -1441,7 +1441,7 @@ // (Saved by telldir). void -seekdir(DIR *dirp, long loc) +myseekdir(DIR *dirp, long loc) { dirp->curr = (char *) loc; /* ouch! long to pointer cast */ } @@ -1451,7 +1451,7 @@ // void -rewinddir(DIR *dirp) +myrewinddir(DIR *dirp) { dirp->curr = dirp->start; } @@ -1461,7 +1461,7 @@ // void -closedir(DIR *dirp) +myclosedir(DIR *dirp) { free(dirp->start); free(dirp); @@ -1611,7 +1611,7 @@ // It doesn\'t exist, so see if we can open it. // - if ((fd = _open(s, _O_CREAT, 0666)) >= 0) { + if ((fd = _sopen(s, _O_CREAT, 0666)) >= 0) { close(fd); _unlink (s); // don\'t leave it laying around return 1; @@ -1655,15 +1655,15 @@ #define _CRTIMP __declspec(dllimport) #endif -EXTERN_C _CRTIMP ioinfo * __pioinfo[]; +//EXTERN_C _CRTIMP ioinfo * __pioinfo[]; -#define IOINFO_L2E 5 -#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) -#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) - -#define _osfhnd(i) (_pioinfo(i)->osfhnd) -#define _osfile(i) (_pioinfo(i)->osfile) -#define _pipech(i) (_pioinfo(i)->pipech) +//#define IOINFO_L2E 5 +//#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) +//#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) + +//#define _osfhnd(i) (_pioinfo(i)->osfhnd) +//#define _osfile(i) (_pioinfo(i)->osfile) +//#define _pipech(i) (_pioinfo(i)->pipech) #define FOPEN 0x01 /* file handle open */ #define FNOINHERIT 0x10 /* file handle opened O_NOINHERIT */ @@ -1681,9 +1681,9 @@ CloseHandle(hF); if (fh == -1) return fh; -#ifdef MSVCRT_THREADS - EnterCriticalSection(&(_pioinfo(fh)->lock)); -#endif +//#ifdef MSVCRT_THREADS +// EnterCriticalSection(&(_pioinfo(fh)->lock)); +//#endif return fh; } @@ -1713,14 +1713,14 @@ } /* the file is open. now, set the info in _osfhnd array */ - _set_osfhnd(fh, osfhandle); +// _set_osfhnd(fh, osfhandle); - fileflags |= FOPEN; /* mark as open */ +// fileflags |= FOPEN; /* mark as open */ - _osfile(fh) = fileflags; /* set osfile entry */ -#ifdef MSVCRT_THREADS - LeaveCriticalSection(&_pioinfo(fh)->lock); -#endif +// _osfile(fh) = fileflags; /* set osfile entry */ +//#ifdef MSVCRT_THREADS +// LeaveCriticalSection(&_pioinfo(fh)->lock); +//#endif return fh; /* return handle */ } @@ -1759,16 +1759,16 @@ if (s == -1) return -1; - return my_open_osfhandle(s, O_RDWR|O_BINARY); + return /*my*/_open_osfhandle(s, O_RDWR|O_BINARY); } void myfdclose(FILE *fp) { -#if !defined MSVCRT_THREADS - _free_osfhnd(fileno(fp)); -#endif +//#if !defined MSVCRT_THREADS +// _free_osfhnd(fileno(fp)); +//#endif fclose(fp); } @@ -1862,14 +1862,18 @@ // File system stuff // -int -/* ioctl(int i, unsigned int u, char *data) */ -ioctl(int i, unsigned int u, long data) +//#ifdef __IN_IOCTL +//int _RTLENTRY ioctl (); +//#else +//int _RTLENTRY _EXPFUNC ioctl (int __handle, int __func, ...); +// /* optional 3rd and 4th args are: void _FAR * __argdx, int argcx */ +//#endif +//int +ioctl(int i, int u, ...) { return -1; } - #undef FD_SET void @@ -2039,10 +2043,16 @@ atexit((void (*)(void)) WSACleanup); +#ifndef SO_SYNCHRONOUS_NONALERT +#define SO_SYNCHRONOUS_NONALERT 0x20 +#endif iSockOpt = SO_SYNCHRONOUS_NONALERT; /* * Enable the use of sockets as filehandles */ +#ifndef SO_OPENTYPE +#define SO_OPENTYPE 0x7008 +#endif setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&iSockOpt, sizeof(iSockOpt)); @@ -2066,7 +2076,7 @@ } if ((r = accept (TO_SOCKET(s), addr, addrlen)) == INVALID_SOCKET) errno = WSAGetLastError(); - return my_open_osfhandle(r, O_RDWR|O_BINARY); + return /*my*/_open_osfhandle(r, O_RDWR|O_BINARY); } #undef bind @@ -2267,7 +2277,7 @@ errno = WSAGetLastError(); //fprintf(stderr, "socket fail (%d)", WSAGetLastError()); } - return my_open_osfhandle(s, O_RDWR|O_BINARY); + return /*my*/_open_osfhandle(s, O_RDWR|O_BINARY); } #undef gethostbyaddr @@ -2451,8 +2461,8 @@ { int length; char *bp; - - if (_getcwd(buffer, size) == NULL) { +#undef getcwd + if (getcwd(buffer, size) == NULL) { return NULL; } length = strlen(buffer); @@ -2637,10 +2647,13 @@ strcat(buf1, "\\"); } else if (*p == '\\' || *p == ':') strcat(buf1, "."); - if (_fullpath(buf2, buf1, MAXPATHLEN)) - return stat(buf2, st); - else + if (_fullpath(buf2, buf1, MAXPATHLEN)) { + int ret; + ret = stat(buf2, st); + return ret; + } else { return -1; + } } static long diff -ur ruby-1.6.5/win32/win32.h ruby/win32/win32.h --- ruby-1.6.5/win32/win32.h Tue Aug 14 17:09:34 2001 +++ ruby/win32/win32.h Mon Oct 15 00:13:00 2001 @@ -116,28 +116,41 @@ #define pid_t int #define WNOHANG -1 +#ifndef __BORLANDC__ #define access _access +#endif #define chmod _chmod +#ifndef __BORLANDC__ #define chsize _chsize +#endif #define close _close #define creat _creat +#ifndef __BORLANDC__ #define dup _dup #define dup2 _dup2 +#endif #define eof _eof #define filelength _filelength +#ifndef __BORLANDC__ #define isatty _isatty +#endif #define locking _locking #define lseek _lseek #define mktemp _mktemp +#ifndef __BORLANDC__ #define open _open +#endif #define perror _perror #define read _read +#ifndef __BORLANDC__ #define setmode _setmode +#endif #define sopen _sopen #define tell _tell #define umask _umask #define unlink _unlink #define write _write +#ifndef __BORLANDC__ #define execl _execl #define execle _execle #define execlp _execlp @@ -146,8 +159,10 @@ #define execve _execve #define execvp _execvp #define execvpe _execvpe +#endif #define getpid _getpid #define sleep(x) win32_sleep((x)*1000) +#ifndef __BORLANDC__ #define spawnl _spawnl #define spawnle _spawnle #define spawnlp _spawnlp @@ -159,13 +174,19 @@ #if _MSC_VER < 800 #define fileno _fileno #endif +#endif #define utime _utime #define vsnprintf _vsnprintf #define snprintf _snprintf #define popen _popen #define pclose _pclose +#ifdef __BORLANDC__ +#define strcasecmp stricmp +#define strncasecmp strnicmp +#else #define strcasecmp _stricmp #define strncasecmp _strnicmp +#endif #undef rb_sys_stat #define rb_sys_stat win32_stat /* these are defined in nt.c */ @@ -221,9 +242,6 @@ extern pid_t waitpid (pid_t, int *, int); extern int do_spawn(char *); extern int kill(int, int); -extern int isinf(double); -extern int isnan(double); - // // define this so we can do inplace editing