git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2000-05-13 16:13:31 +00:00
Родитель 9da4f78db4
Коммит 6d53b692ab
25 изменённых файлов: 327 добавлений и 228 удалений

Просмотреть файл

@ -1,3 +1,19 @@
Sun May 14 00:54:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* configure.in, ...: suport mingw32.
* defines.h: ditto. undef EXTERN for tcl/tk on cygwin.
* ext/*/extconf.rb: replace PLATFORM with RUBY_PLATFORM.
* ext/socket/sockport.h: define IN_MULTICAST for missing IN_MULTICAST.
* ext/tcltklib/tcltklib.c: remove declaration of rb_argv0.
* file.c: should check S_IXGRP, S_ISGID, not NT.
* io.c: should check _IOBIN, O_BINARY, not PLATFORMs.
Fri May 12 17:33:44 2000 Yukihiro Matsumoto <matz@netlab.co.jp> Fri May 12 17:33:44 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* regex.c (re_compile_pattern): charset_not should not exclude * regex.c (re_compile_pattern): charset_not should not exclude

362
configure поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -87,7 +87,7 @@ AC_CHECK_TOOL(AR, ar)
AC_CHECK_PROGS(AR, ar aal, ar) AC_CHECK_PROGS(AR, ar aal, ar)
case "$target_os" in case "$target_os" in
cygwin*) cygwin*|mingw*)
AC_CHECK_TOOL(NM, nm) AC_CHECK_TOOL(NM, nm)
AC_CHECK_TOOL(DLLWRAP, dllwrap) AC_CHECK_TOOL(DLLWRAP, dllwrap)
AC_CHECK_TOOL(AS, as) AC_CHECK_TOOL(AS, as)
@ -165,6 +165,15 @@ macos*) ;;
human*) ac_cv_func_getpgrp_void=yes;; human*) ac_cv_func_getpgrp_void=yes;;
beos*) ;; beos*) ;;
cygwin*) ;; cygwin*) ;;
mingw*) LIBS="-lwsock32 -lmsvcrt $LIBS"
ac_cv_header_a_out_h=no
ac_cv_header_pwd_h=no
ac_cv_header_utime_h=no
ac_cv_header_sys_ioctl_h=no
ac_cv_header_sys_param_h=no
ac_cv_header_sys_resource_h=no
ac_cv_header_sys_select_h=no
ac_cv_header_sys_times_h=no;;
os2_emx*) LIBS="-lm $LIBS" os2_emx*) LIBS="-lm $LIBS"
ac_cv_lib_xpg4_setlocale=no ac_cv_lib_xpg4_setlocale=no
ac_cv_lib_dir_opendir=no;; ac_cv_lib_dir_opendir=no;;
@ -419,6 +428,7 @@ if test "$with_dln_a_out" != yes; then
human*) ;; human*) ;;
bsdi*) ;; bsdi*) ;;
cygwin*) ;; cygwin*) ;;
mingw*) ;;
netbsd*) CCDLFLAGS=-fpic netbsd*) CCDLFLAGS=-fpic
case "$target_cpu" in case "$target_cpu" in
mips*) CCDLFLAGS=-fPIC ;; mips*) CCDLFLAGS=-fPIC ;;
@ -521,7 +531,7 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o" DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
esac esac
rb_cv_dlopen=yes ;; rb_cv_dlopen=yes ;;
cygwin*) : ${LDSHARED="${DLLWRAP} --as=${AS} --dlltool-name=${DLLTOOL} --driver-name=${CC} --export-all -s"} cygwin*|mingw*) : ${LDSHARED="${DLLWRAP} --target=${target_os} --as=${AS} --dlltool-name=${DLLTOOL} --driver-name=${CC} --export-all -s"}
rb_cv_dlopen=yes ;; rb_cv_dlopen=yes ;;
*) LDSHARED='ld' ;; *) LDSHARED='ld' ;;
esac esac
@ -570,7 +580,7 @@ else
AC_DEFINE(DLEXT, ".bundle");; AC_DEFINE(DLEXT, ".bundle");;
os2_emx*) DLEXT=dll os2_emx*) DLEXT=dll
AC_DEFINE(DLEXT, ".dll");; AC_DEFINE(DLEXT, ".dll");;
cygwin*) DLEXT=so cygwin*|mingw*) DLEXT=so
AC_DEFINE(DLEXT, ".so") AC_DEFINE(DLEXT, ".so")
DLEXT2=dll DLEXT2=dll
AC_DEFINE(DLEXT2, ".dll");; AC_DEFINE(DLEXT2, ".dll");;
@ -662,9 +672,6 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no
LIBOBJS="$LIBOBJS os2.$OBJEXT" LIBOBJS="$LIBOBJS os2.$OBJEXT"
setup=Setup.emx setup=Setup.emx
;; ;;
cygwin*)
setup=Setup
;;
*) *)
setup=Setup setup=Setup
;; ;;
@ -716,7 +723,7 @@ if test "$target_os" = "beos"; then
fi fi
case "$target_os" in case "$target_os" in
cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*) cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*)
DLDLIBS="" DLDLIBS=""
;; ;;
*) *)
@ -777,15 +784,24 @@ if test "$enable_shared" = 'yes'; then
LIBRUBYARG='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_NAME).so' LIBRUBYARG='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_NAME).so'
SOLIBS='-lm -lc' SOLIBS='-lm -lc'
;; ;;
cygwin*) cygwin*|mingw*)
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).a' LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).a'
LIBRUBY_ALIASES='' LIBRUBY_ALIASES=''
LIBRUBY_A='lib$(RUBY_INSTALL_NAME)s.a' LIBRUBY_A='lib$(RUBY_INSTALL_NAME)s.a'
LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)' LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)'
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
LIBOBJS="$LIBOBJS strftime.o" case "$target_os" in
CCDLFLAGS=-DUSEIMPORTLIB cygwin*)
LIBOBJS="$LIBOBJS strftime.o"
CCDLFLAGS=-DUSEIMPORTLIB
;; ;;
mingw*)
LIBOBJS="$LIBOBJS win32.o"
CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
CCDLFLAGS=-DIMPORT
;;
esac
;;
*) *)
;; ;;
esac esac

Просмотреть файл

@ -1,8 +1,17 @@
include Makefile include Makefile
RUBYCWDLL=rubycw.dll ARCH=@arch@
miniruby$(EXEEXT): $(RUBYCWDLL) ifneq (,$(findstring mingw, $(ARCH)))
VPATH = @srcdir@/missing:@srcdir@/win32
DLL = rubymg.dll
DLLWRAP_FLAGS =
else
DLL = rubycw.dll
DLLWRAP_FLAGS = -Wl,-e,__cygwin_noncygwin_dll_entry@12
endif
$(RUBYCWDLL): $(OBJS) dmyext.o miniruby$(EXEEXT): $(DLL)
$(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o
$(DLL): $(OBJS) dmyext.o
$(LDSHARED) $(DLDFLAGS) -o $(DLL) --output-lib=$(LIBRUBY_SO) --dllname=$(DLL) --add-stdcall-alias $(OBJS) dmyext.o $(LIBS)

Просмотреть файл

@ -31,10 +31,13 @@
#endif /* NeXT */ #endif /* NeXT */
#ifdef NT #ifdef NT
#define USHORT _USHORT
#include "win32/win32.h" #include "win32/win32.h"
#undef USHORT
#endif #endif
#if defined __CYGWIN__ #if defined __CYGWIN__
# undef EXTERN
# if defined USEIMPORTLIB # if defined USEIMPORTLIB
# define EXTERN extern __declspec(dllimport) # define EXTERN extern __declspec(dllimport)
# else # else

Просмотреть файл

@ -2,7 +2,7 @@
Win32API - Ruby Win32 API Import Facility Win32API - Ruby Win32 API Import Facility
*/ */
#ifndef _MSC_VER #if !defined _MSC_VER && !defined NT
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>

Просмотреть файл

@ -1,4 +1,4 @@
case PLATFORM case RUBY_PLATFORM
when /cygwin/,/mingw/ when /cygwin/,/mingw/
$CFLAGS = "-fno-defer-pop" $CFLAGS = "-fno-defer-pop"
create_makefile("Win32API") create_makefile("Win32API")

Просмотреть файл

@ -1,7 +1,7 @@
require 'mkmf' require 'mkmf'
make=false make=false
have_library("mytinfo", "tgetent") if /bow/ =~ PLATFORM have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
if have_header("ncurses.h") and have_library("ncurses", "initscr") if have_header("ncurses.h") and have_library("ncurses", "initscr")
make=true make=true
elsif have_header("ncurses/curses.h") and have_library("ncurses", "initscr") elsif have_header("ncurses/curses.h") and have_library("ncurses", "initscr")

Просмотреть файл

@ -53,7 +53,7 @@ end
LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s conftest.c %s %s @LIBS@" LINK = "@CC@ -o conftest -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir @LDFLAGS@ %s %s conftest.c %s %s @LIBS@"
CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s conftest.c" CPP = "@CPP@ @CPPFLAGS@ -I#$topdir -I#$top_srcdir #{CFLAGS} -I#$includedir %s %s conftest.c"
if /cygwin|mswin32|djgpp|mingw32|m68k-human|i386-os2_emx/i =~ RUBY_PLATFORM if /cygwin|mswin32|djgpp|mingw|m68k-human|i386-os2_emx/i =~ RUBY_PLATFORM
$null = open("nul", "w") $null = open("nul", "w")
else else
$null = open("/dev/null", "w") $null = open("/dev/null", "w")
@ -158,7 +158,7 @@ end
def have_library(lib, func="main") def have_library(lib, func="main")
if func && func != "" if func && func != ""
libs = append_library($libs, lib) libs = append_library($libs, lib)
if /mswin32/ =~ RUBY_PLATFORM if /mswin32|mingw/ =~ RUBY_PLATFORM
r = try_link(<<"SRC", libs) r = try_link(<<"SRC", libs)
#include <windows.h> #include <windows.h>
#include <winsock.h> #include <winsock.h>
@ -210,7 +210,7 @@ end
def have_func(func) def have_func(func)
libs = $libs libs = $libs
if /mswin32/ =~ RUBY_PLATFORM if /mswin32|mingw/ =~ RUBY_PLATFORM
r = try_link(<<"SRC", libs) r = try_link(<<"SRC", libs)
#include <windows.h> #include <windows.h>
#include <winsock.h> #include <winsock.h>
@ -253,7 +253,7 @@ def arg_config(config, default=nil)
unless defined? $configure_args unless defined? $configure_args
$configure_args = {} $configure_args = {}
args = "@configure_args@" args = "@configure_args@"
if /mswin32/ =~ RUBY_PLATFORM and ENV["CONFIGURE_ARGS"] if /mswin32|mingw/ =~ RUBY_PLATFORM and ENV["CONFIGURE_ARGS"]
args = args + " " + ENV["CONFIGURE_ARGS"] args = args + " " + ENV["CONFIGURE_ARGS"]
end end
for arg in args.split for arg in args.split
@ -340,7 +340,7 @@ def create_makefile(target)
end end
defflag = '' defflag = ''
if RUBY_PLATFORM =~ /cygwin/ and not $static if RUBY_PLATFORM =~ /cygwin|mingw/ and not $static
if File.exist? target + ".def" if File.exist? target + ".def"
defflag = "--def=" + target + ".def" defflag = "--def=" + target + ".def"
end end

Просмотреть файл

@ -2,7 +2,7 @@ require 'mkmf'
have_header("sys/stropts.h") have_header("sys/stropts.h")
have_func("setresuid") have_func("setresuid")
$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === PLATFORM $CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM
if have_func("openpty") or if have_func("openpty") or
have_func("_getpty") or have_func("_getpty") or
have_func("ioctl") have_func("ioctl")

Просмотреть файл

@ -1,7 +1,7 @@
require "mkmf" require "mkmf"
dir_config("readline") dir_config("readline")
have_library("user32", nil) if /cygwin/ === PLATFORM have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
have_library("termcap", "tgetnum") or have_library("termcap", "tgetnum") or
have_library("curses", "tgetnum") or have_library("curses", "tgetnum") or
have_library("ncurses", "tgetnum") have_library("ncurses", "tgetnum")

Просмотреть файл

@ -2,8 +2,8 @@ require 'mkmf'
$LDFLAGS += " -L/usr/local/lib" if File.directory?("/usr/local/lib") $LDFLAGS += " -L/usr/local/lib" if File.directory?("/usr/local/lib")
$CFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len" $CFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
case PLATFORM case RUBY_PLATFORM
when /mswin32/ when /mswin32|mingw/
test_func = "WSACleanup" test_func = "WSACleanup"
have_library("wsock32", "WSACleanup") have_library("wsock32", "WSACleanup")
have_func("closesocket") have_func("closesocket")

Просмотреть файл

@ -40,4 +40,9 @@
# define SET_SIN_LEN(si,len) # define SET_SIN_LEN(si,len)
#endif #endif
#ifndef IN_MULTICAST
# define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
# define IN_MULTICAST(i) IN_CLASSD(i)
#endif
#endif #endif

Просмотреть файл

@ -2,10 +2,12 @@
require 'mkmf' require 'mkmf'
have_library("nsl", "t_open") if RUBY_PLATFORM !~ /mswin32|mingw/
have_library("socket", "socket") have_library("nsl", "t_open")
have_library("dl", "dlopen") have_library("socket", "socket")
have_library("m", "log") have_library("dl", "dlopen")
have_library("m", "log")
end
dir_config("tk") dir_config("tk")
dir_config("tcl") dir_config("tcl")
@ -41,7 +43,7 @@ def find_tk(tklib)
end end
if have_header("tcl.h") && have_header("tk.h") && if have_header("tcl.h") && have_header("tk.h") &&
(/mswin32/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay", (/mswin32|mingw|cygwin/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay",
"/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) && "/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
find_tcl(tcllib) && find_tcl(tcllib) &&
find_tk(tklib) find_tk(tklib)

Просмотреть файл

@ -34,6 +34,7 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
/* from tkAppInit.c */ /* from tkAppInit.c */
#if !defined __MINGW32__
/* /*
* The following variable is a special hack that is needed in order for * The following variable is a special hack that is needed in order for
* Sun shared libraries to be used for Tcl. * Sun shared libraries to be used for Tcl.
@ -41,6 +42,7 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
extern int matherr(); extern int matherr();
int *tclDummyMathPtr = (int *) matherr; int *tclDummyMathPtr = (int *) matherr;
#endif
/*---- module TclTkLib ----*/ /*---- module TclTkLib ----*/
@ -487,8 +489,6 @@ _macinit()
void void
Init_tcltklib() Init_tcltklib()
{ {
extern VALUE rb_argv0; /* the argv[0] */
VALUE lib = rb_define_module("TclTkLib"); VALUE lib = rb_define_module("TclTkLib");
VALUE ip = rb_define_class("TclTkIp", rb_cObject); VALUE ip = rb_define_class("TclTkIp", rb_cObject);

8
file.c
Просмотреть файл

@ -371,7 +371,7 @@ eaccess(path, mode)
const char *path; const char *path;
int mode; int mode;
{ {
#ifndef NT #ifdef S_IXGRP
struct stat st; struct stat st;
static int euid = -1; static int euid = -1;
@ -699,7 +699,7 @@ static VALUE
test_sgid(obj, fname) test_sgid(obj, fname)
VALUE obj, fname; VALUE obj, fname;
{ {
#ifndef NT #ifdef S_ISGID
Check_SafeStr(fname); Check_SafeStr(fname);
return check3rdbyte(RSTRING(fname)->ptr, S_ISGID); return check3rdbyte(RSTRING(fname)->ptr, S_ISGID);
#else #else
@ -1013,7 +1013,7 @@ rb_file_s_utime(argc, argv)
# else # else
# include <sys/utime.h> # include <sys/utime.h>
# endif # endif
# if defined(_MSC_VER) # if defined(_MSC_VER) || defined __MINGW32__
# define utimbuf _utimbuf # define utimbuf _utimbuf
# endif # endif
# else # else
@ -1917,7 +1917,7 @@ static VALUE
rb_stat_sgid(obj) rb_stat_sgid(obj)
VALUE obj; VALUE obj;
{ {
#ifndef NT #ifdef S_ISGID
if (get_stat(obj)->st_mode & S_ISGID) return Qtrue; if (get_stat(obj)->st_mode & S_ISGID) return Qtrue;
#endif #endif
return Qfalse; return Qfalse;

2
io.c
Просмотреть файл

@ -1133,7 +1133,7 @@ VALUE
rb_io_binmode(io) rb_io_binmode(io)
VALUE io; VALUE io;
{ {
#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__) #if defined _IOBIN || defined O_BINARY
OpenFile *fptr; OpenFile *fptr;
GetOpenFile(io, fptr); GetOpenFile(io, fptr);

Просмотреть файл

@ -143,7 +143,7 @@ def have_library(lib, func="main")
if func && func != "" if func && func != ""
libs = append_library($libs, lib) libs = append_library($libs, lib)
if /mswin32/ =~ RUBY_PLATFORM if /mswin32|mingw/ =~ RUBY_PLATFORM
r = try_link(<<"SRC", libs) r = try_link(<<"SRC", libs)
#include <windows.h> #include <windows.h>
#include <winsock.h> #include <winsock.h>
@ -205,7 +205,7 @@ def have_func(func)
libs = $libs libs = $libs
if /mswin32/ =~ RUBY_PLATFORM if /mswin32|mingw/ =~ RUBY_PLATFORM
r = try_link(<<"SRC", libs) r = try_link(<<"SRC", libs)
#include <windows.h> #include <windows.h>
#include <winsock.h> #include <winsock.h>
@ -339,7 +339,7 @@ def create_makefile(target)
end end
defflag = '' defflag = ''
if RUBY_PLATFORM =~ /cygwin/ if RUBY_PLATFORM =~ /cygwin|mingw/
if File.exist? target + ".def" if File.exist? target + ".def"
defflag = "--def=" + target + ".def" defflag = "--def=" + target + ".def"
end end

Просмотреть файл

@ -28,6 +28,7 @@
#ifndef __DIR_INCLUDED #ifndef __DIR_INCLUDED
#define __DIR_INCLUDED #define __DIR_INCLUDED
#if !defined __MINGW32__
/*Directory entry size */ /*Directory entry size */
#ifdef DIRSIZ #ifdef DIRSIZ
#undef DIRSIZ #undef DIRSIZ
@ -60,4 +61,5 @@ void seekdir(DIR *dirp,long loc);
void rewinddir(DIR *dirp); void rewinddir(DIR *dirp);
void closedir(DIR *dirp); void closedir(DIR *dirp);
#endif
#endif /* __DIR_INCLUDED */ #endif /* __DIR_INCLUDED */

Просмотреть файл

@ -126,7 +126,7 @@ flock(fd, operation)
return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock); return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
} }
#else #elif !defined NT
int int
flock(fd, operation) flock(fd, operation)
int fd; int fd;

Просмотреть файл

@ -101,7 +101,7 @@
#define __const #define __const
#endif /* People who don't like const sys_error */ #endif /* People who don't like const sys_error */
#ifdef NT #if defined NT && !defined __MINGW32__
typedef long size_t; typedef long size_t;
#endif #endif

Просмотреть файл

@ -312,7 +312,7 @@ signal_exec(sig)
case SIGINT: case SIGINT:
rb_thread_interrupt(); rb_thread_interrupt();
break; break;
#if !defined(NT) && !defined(__human68k__) #ifdef SIGHUP
case SIGHUP: case SIGHUP:
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
@ -503,7 +503,7 @@ trap(arg)
if (func == SIG_DFL) { if (func == SIG_DFL) {
switch (sig) { switch (sig) {
case SIGINT: case SIGINT:
#if !defined(NT) && !defined(__human68k__) #ifdef SIGHUP
case SIGHUP: case SIGHUP:
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
@ -622,7 +622,7 @@ Init_signal()
#ifndef MACOS_UNUSE_SIGNAL #ifndef MACOS_UNUSE_SIGNAL
rb_define_global_function("trap", rb_f_trap, -1); rb_define_global_function("trap", rb_f_trap, -1);
ruby_signal(SIGINT, sighandle); ruby_signal(SIGINT, sighandle);
#ifndef NT #ifdef SIGHUP
ruby_signal(SIGHUP, sighandle); ruby_signal(SIGHUP, sighandle);
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.4" #define RUBY_VERSION "1.5.4"
#define RUBY_RELEASE_DATE "2000-05-12" #define RUBY_RELEASE_DATE "2000-05-14"
#define RUBY_VERSION_CODE 154 #define RUBY_VERSION_CODE 154
#define RUBY_RELEASE_CODE 20000512 #define RUBY_RELEASE_CODE 20000514

Просмотреть файл

@ -1169,7 +1169,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
} }
#if 1 #if !defined __MINGW32__
// //
// UNIX compatible directory access functions for NT // UNIX compatible directory access functions for NT
// //
@ -1183,7 +1183,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
// //
DIR * DIR *
opendir(char *filename) opendir(const char *filename)
{ {
DIR *p; DIR *p;
long len; long len;
@ -1524,8 +1524,8 @@ valid_filename(char *s)
// if we can prevent perl from trying to do stdio on sockets. // if we can prevent perl from trying to do stdio on sockets.
// //
EXTERN_C int __cdecl _alloc_osfhnd(void); //EXTERN_C int __cdecl _alloc_osfhnd(void);
EXTERN_C int __cdecl _set_osfhnd(int fh, long value); //EXTERN_C int __cdecl _set_osfhnd(int fh, long value);
EXTERN_C void __cdecl _lock_fhandle(int); EXTERN_C void __cdecl _lock_fhandle(int);
EXTERN_C void __cdecl _unlock_fhandle(int); EXTERN_C void __cdecl _unlock_fhandle(int);
EXTERN_C void __cdecl _unlock(int); EXTERN_C void __cdecl _unlock(int);
@ -1534,18 +1534,23 @@ typedef struct {
long osfhnd; /* underlying OS file HANDLE */ long osfhnd; /* underlying OS file HANDLE */
char osfile; /* attributes of file (e.g., open in text mode?) */ char osfile; /* attributes of file (e.g., open in text mode?) */
char pipech; /* one char buffer for handles opened on pipes */ char pipech; /* one char buffer for handles opened on pipes */
#if defined (_MT) && !defined (DLL_FOR_WIN32S)
int lockinitflag; int lockinitflag;
CRITICAL_SECTION lock; CRITICAL_SECTION lock;
#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */
} ioinfo; } ioinfo;
#if !defined _CRTIMP
#define _CRTIMP __declspec(dllimport)
#endif
EXTERN_C _CRTIMP ioinfo * __pioinfo[]; EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#define IOINFO_L2E 5 #define IOINFO_L2E 5
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) #define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1)))
#define _osfile(i) (_pioinfo(i)->osfile)
#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 FOPEN 0x01 /* file handle open */
#define FNOINHERIT 0x10 /* file handle opened O_NOINHERIT */ #define FNOINHERIT 0x10 /* file handle opened O_NOINHERIT */
@ -1553,6 +1558,20 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#define FDEV 0x40 /* file handle refers to device */ #define FDEV 0x40 /* file handle refers to device */
#define FTEXT 0x80 /* file handle is in text mode */ #define FTEXT 0x80 /* file handle is in text mode */
#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh)
static int
_alloc_osfhnd(void)
{
HANDLE hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
int fh = _open_osfhandle((long)hF, 0);
CloseHandle(hF);
if (fh == -1)
return fh;
EnterCriticalSection(&(_pioinfo(fh)->lock));
return fh;
}
static int static int
my_open_osfhandle(long osfhandle, int flags) my_open_osfhandle(long osfhandle, int flags)
{ {
@ -1622,7 +1641,9 @@ myfdopen (int fd, const char *mode)
void void
myfdclose(FILE *fp) myfdclose(FILE *fp)
{ {
#if !defined __MINGW32__
_free_osfhnd(fileno(fp)); _free_osfhnd(fileno(fp));
#endif
fclose(fp); fclose(fp);
} }
@ -1639,7 +1660,9 @@ char *
mystrerror(int e) mystrerror(int e)
{ {
static char buffer[512]; static char buffer[512];
#if !defined __MINGW32__
extern int sys_nerr; extern int sys_nerr;
#endif
DWORD source = 0; DWORD source = 0;
if (e < 0 || e > sys_nerr) { if (e < 0 || e > sys_nerr) {

Просмотреть файл

@ -9,6 +9,7 @@
* *
*/ */
#undef EXTERN
#if defined(IMPORT) #if defined(IMPORT)
#define EXTERN extern __declspec(dllimport) #define EXTERN extern __declspec(dllimport)
#elif defined(EXPORT) #elif defined(EXPORT)
@ -163,6 +164,12 @@ extern "C++" {
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
/* these are defined in nt.c */ /* these are defined in nt.c */
#ifdef __MINGW32__
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
#endif
extern int NtMakeCmdVector(char *, char ***, int); extern int NtMakeCmdVector(char *, char ***, int);
extern void NtInitialize(int *, char ***); extern void NtInitialize(int *, char ***);
extern char *NtGetLib(void); extern char *NtGetLib(void);