зеркало из https://github.com/github/ruby.git
support mingw32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9da4f78db4
Коммит
6d53b692ab
16
ChangeLog
16
ChangeLog
|
@ -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>
|
||||
|
||||
* regex.c (re_compile_pattern): charset_not should not exclude
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
36
configure.in
36
configure.in
|
@ -87,7 +87,7 @@ AC_CHECK_TOOL(AR, ar)
|
|||
AC_CHECK_PROGS(AR, ar aal, ar)
|
||||
|
||||
case "$target_os" in
|
||||
cygwin*)
|
||||
cygwin*|mingw*)
|
||||
AC_CHECK_TOOL(NM, nm)
|
||||
AC_CHECK_TOOL(DLLWRAP, dllwrap)
|
||||
AC_CHECK_TOOL(AS, as)
|
||||
|
@ -165,6 +165,15 @@ macos*) ;;
|
|||
human*) ac_cv_func_getpgrp_void=yes;;
|
||||
beos*) ;;
|
||||
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"
|
||||
ac_cv_lib_xpg4_setlocale=no
|
||||
ac_cv_lib_dir_opendir=no;;
|
||||
|
@ -419,6 +428,7 @@ if test "$with_dln_a_out" != yes; then
|
|||
human*) ;;
|
||||
bsdi*) ;;
|
||||
cygwin*) ;;
|
||||
mingw*) ;;
|
||||
netbsd*) CCDLFLAGS=-fpic
|
||||
case "$target_cpu" in
|
||||
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"
|
||||
esac
|
||||
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 ;;
|
||||
*) LDSHARED='ld' ;;
|
||||
esac
|
||||
|
@ -570,7 +580,7 @@ else
|
|||
AC_DEFINE(DLEXT, ".bundle");;
|
||||
os2_emx*) DLEXT=dll
|
||||
AC_DEFINE(DLEXT, ".dll");;
|
||||
cygwin*) DLEXT=so
|
||||
cygwin*|mingw*) DLEXT=so
|
||||
AC_DEFINE(DLEXT, ".so")
|
||||
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"
|
||||
setup=Setup.emx
|
||||
;;
|
||||
cygwin*)
|
||||
setup=Setup
|
||||
;;
|
||||
*)
|
||||
setup=Setup
|
||||
;;
|
||||
|
@ -716,7 +723,7 @@ if test "$target_os" = "beos"; then
|
|||
fi
|
||||
|
||||
case "$target_os" in
|
||||
cygwin*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*)
|
||||
cygwin*|mingw*|beos*|openstep*|nextstep*|rhapsody*|macos*|os2_emx*)
|
||||
DLDLIBS=""
|
||||
;;
|
||||
*)
|
||||
|
@ -777,15 +784,24 @@ if test "$enable_shared" = 'yes'; then
|
|||
LIBRUBYARG='-L${prefix}/lib -Wl,lib$(RUBY_INSTALL_NAME).so'
|
||||
SOLIBS='-lm -lc'
|
||||
;;
|
||||
cygwin*)
|
||||
cygwin*|mingw*)
|
||||
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).a'
|
||||
LIBRUBY_ALIASES=''
|
||||
LIBRUBY_A='lib$(RUBY_INSTALL_NAME)s.a'
|
||||
LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)'
|
||||
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
|
||||
LIBOBJS="$LIBOBJS strftime.o"
|
||||
CCDLFLAGS=-DUSEIMPORTLIB
|
||||
case "$target_os" in
|
||||
cygwin*)
|
||||
LIBOBJS="$LIBOBJS strftime.o"
|
||||
CCDLFLAGS=-DUSEIMPORTLIB
|
||||
;;
|
||||
mingw*)
|
||||
LIBOBJS="$LIBOBJS win32.o"
|
||||
CFLAGS="-DNT -D__MSVCRT__ $CFLAGS"
|
||||
CCDLFLAGS=-DIMPORT
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
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
|
||||
$(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o
|
||||
miniruby$(EXEEXT): $(DLL)
|
||||
|
||||
$(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 */
|
||||
|
||||
#ifdef NT
|
||||
#define USHORT _USHORT
|
||||
#include "win32/win32.h"
|
||||
#undef USHORT
|
||||
#endif
|
||||
|
||||
#if defined __CYGWIN__
|
||||
# undef EXTERN
|
||||
# if defined USEIMPORTLIB
|
||||
# define EXTERN extern __declspec(dllimport)
|
||||
# else
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Win32API - Ruby Win32 API Import Facility
|
||||
*/
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#if !defined _MSC_VER && !defined NT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
case PLATFORM
|
||||
case RUBY_PLATFORM
|
||||
when /cygwin/,/mingw/
|
||||
$CFLAGS = "-fno-defer-pop"
|
||||
create_makefile("Win32API")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'mkmf'
|
||||
|
||||
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")
|
||||
make=true
|
||||
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@"
|
||||
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")
|
||||
else
|
||||
$null = open("/dev/null", "w")
|
||||
|
@ -158,7 +158,7 @@ end
|
|||
def have_library(lib, func="main")
|
||||
if func && func != ""
|
||||
libs = append_library($libs, lib)
|
||||
if /mswin32/ =~ RUBY_PLATFORM
|
||||
if /mswin32|mingw/ =~ RUBY_PLATFORM
|
||||
r = try_link(<<"SRC", libs)
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
@ -210,7 +210,7 @@ end
|
|||
def have_func(func)
|
||||
libs = $libs
|
||||
|
||||
if /mswin32/ =~ RUBY_PLATFORM
|
||||
if /mswin32|mingw/ =~ RUBY_PLATFORM
|
||||
r = try_link(<<"SRC", libs)
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
@ -253,7 +253,7 @@ def arg_config(config, default=nil)
|
|||
unless defined? $configure_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"]
|
||||
end
|
||||
for arg in args.split
|
||||
|
@ -340,7 +340,7 @@ def create_makefile(target)
|
|||
end
|
||||
|
||||
defflag = ''
|
||||
if RUBY_PLATFORM =~ /cygwin/ and not $static
|
||||
if RUBY_PLATFORM =~ /cygwin|mingw/ and not $static
|
||||
if File.exist? target + ".def"
|
||||
defflag = "--def=" + target + ".def"
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'mkmf'
|
|||
|
||||
have_header("sys/stropts.h")
|
||||
have_func("setresuid")
|
||||
$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === PLATFORM
|
||||
$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === RUBY_PLATFORM
|
||||
if have_func("openpty") or
|
||||
have_func("_getpty") or
|
||||
have_func("ioctl")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "mkmf"
|
||||
|
||||
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("curses", "tgetnum") or
|
||||
have_library("ncurses", "tgetnum")
|
||||
|
|
|
@ -2,8 +2,8 @@ require 'mkmf'
|
|||
$LDFLAGS += " -L/usr/local/lib" if File.directory?("/usr/local/lib")
|
||||
$CFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
|
||||
|
||||
case PLATFORM
|
||||
when /mswin32/
|
||||
case RUBY_PLATFORM
|
||||
when /mswin32|mingw/
|
||||
test_func = "WSACleanup"
|
||||
have_library("wsock32", "WSACleanup")
|
||||
have_func("closesocket")
|
||||
|
|
|
@ -40,4 +40,9 @@
|
|||
# define SET_SIN_LEN(si,len)
|
||||
#endif
|
||||
|
||||
#ifndef IN_MULTICAST
|
||||
# define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
|
||||
# define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
require 'mkmf'
|
||||
|
||||
have_library("nsl", "t_open")
|
||||
have_library("socket", "socket")
|
||||
have_library("dl", "dlopen")
|
||||
have_library("m", "log")
|
||||
if RUBY_PLATFORM !~ /mswin32|mingw/
|
||||
have_library("nsl", "t_open")
|
||||
have_library("socket", "socket")
|
||||
have_library("dl", "dlopen")
|
||||
have_library("m", "log")
|
||||
end
|
||||
|
||||
dir_config("tk")
|
||||
dir_config("tcl")
|
||||
|
@ -41,7 +43,7 @@ def find_tk(tklib)
|
|||
end
|
||||
|
||||
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")) &&
|
||||
find_tcl(tcllib) &&
|
||||
find_tk(tklib)
|
||||
|
|
|
@ -34,6 +34,7 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
|
|||
|
||||
/* from tkAppInit.c */
|
||||
|
||||
#if !defined __MINGW32__
|
||||
/*
|
||||
* The following variable is a special hack that is needed in order for
|
||||
* Sun shared libraries to be used for Tcl.
|
||||
|
@ -41,6 +42,7 @@ static VALUE ip_invoke_real _((int, VALUE*, VALUE));
|
|||
|
||||
extern int matherr();
|
||||
int *tclDummyMathPtr = (int *) matherr;
|
||||
#endif
|
||||
|
||||
/*---- module TclTkLib ----*/
|
||||
|
||||
|
@ -487,8 +489,6 @@ _macinit()
|
|||
void
|
||||
Init_tcltklib()
|
||||
{
|
||||
extern VALUE rb_argv0; /* the argv[0] */
|
||||
|
||||
VALUE lib = rb_define_module("TclTkLib");
|
||||
VALUE ip = rb_define_class("TclTkIp", rb_cObject);
|
||||
|
||||
|
|
8
file.c
8
file.c
|
@ -371,7 +371,7 @@ eaccess(path, mode)
|
|||
const char *path;
|
||||
int mode;
|
||||
{
|
||||
#ifndef NT
|
||||
#ifdef S_IXGRP
|
||||
struct stat st;
|
||||
static int euid = -1;
|
||||
|
||||
|
@ -699,7 +699,7 @@ static VALUE
|
|||
test_sgid(obj, fname)
|
||||
VALUE obj, fname;
|
||||
{
|
||||
#ifndef NT
|
||||
#ifdef S_ISGID
|
||||
Check_SafeStr(fname);
|
||||
return check3rdbyte(RSTRING(fname)->ptr, S_ISGID);
|
||||
#else
|
||||
|
@ -1013,7 +1013,7 @@ rb_file_s_utime(argc, argv)
|
|||
# else
|
||||
# include <sys/utime.h>
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
# if defined(_MSC_VER) || defined __MINGW32__
|
||||
# define utimbuf _utimbuf
|
||||
# endif
|
||||
# else
|
||||
|
@ -1917,7 +1917,7 @@ static VALUE
|
|||
rb_stat_sgid(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
#ifndef NT
|
||||
#ifdef S_ISGID
|
||||
if (get_stat(obj)->st_mode & S_ISGID) return Qtrue;
|
||||
#endif
|
||||
return Qfalse;
|
||||
|
|
2
io.c
2
io.c
|
@ -1133,7 +1133,7 @@ VALUE
|
|||
rb_io_binmode(io)
|
||||
VALUE io;
|
||||
{
|
||||
#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
|
||||
#if defined _IOBIN || defined O_BINARY
|
||||
OpenFile *fptr;
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
|
|
|
@ -143,7 +143,7 @@ def have_library(lib, func="main")
|
|||
|
||||
if func && func != ""
|
||||
libs = append_library($libs, lib)
|
||||
if /mswin32/ =~ RUBY_PLATFORM
|
||||
if /mswin32|mingw/ =~ RUBY_PLATFORM
|
||||
r = try_link(<<"SRC", libs)
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
@ -205,7 +205,7 @@ def have_func(func)
|
|||
|
||||
libs = $libs
|
||||
|
||||
if /mswin32/ =~ RUBY_PLATFORM
|
||||
if /mswin32|mingw/ =~ RUBY_PLATFORM
|
||||
r = try_link(<<"SRC", libs)
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
|
@ -339,7 +339,7 @@ def create_makefile(target)
|
|||
end
|
||||
|
||||
defflag = ''
|
||||
if RUBY_PLATFORM =~ /cygwin/
|
||||
if RUBY_PLATFORM =~ /cygwin|mingw/
|
||||
if File.exist? target + ".def"
|
||||
defflag = "--def=" + target + ".def"
|
||||
end
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#ifndef __DIR_INCLUDED
|
||||
#define __DIR_INCLUDED
|
||||
|
||||
#if !defined __MINGW32__
|
||||
/*Directory entry size */
|
||||
#ifdef DIRSIZ
|
||||
#undef DIRSIZ
|
||||
|
@ -60,4 +61,5 @@ void seekdir(DIR *dirp,long loc);
|
|||
void rewinddir(DIR *dirp);
|
||||
void closedir(DIR *dirp);
|
||||
|
||||
#endif
|
||||
#endif /* __DIR_INCLUDED */
|
||||
|
|
|
@ -126,7 +126,7 @@ flock(fd, operation)
|
|||
|
||||
return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
|
||||
}
|
||||
#else
|
||||
#elif !defined NT
|
||||
int
|
||||
flock(fd, operation)
|
||||
int fd;
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
#define __const
|
||||
#endif /* People who don't like const sys_error */
|
||||
|
||||
#ifdef NT
|
||||
#if defined NT && !defined __MINGW32__
|
||||
typedef long size_t;
|
||||
#endif
|
||||
|
||||
|
|
6
signal.c
6
signal.c
|
@ -312,7 +312,7 @@ signal_exec(sig)
|
|||
case SIGINT:
|
||||
rb_thread_interrupt();
|
||||
break;
|
||||
#if !defined(NT) && !defined(__human68k__)
|
||||
#ifdef SIGHUP
|
||||
case SIGHUP:
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
|
@ -503,7 +503,7 @@ trap(arg)
|
|||
if (func == SIG_DFL) {
|
||||
switch (sig) {
|
||||
case SIGINT:
|
||||
#if !defined(NT) && !defined(__human68k__)
|
||||
#ifdef SIGHUP
|
||||
case SIGHUP:
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
|
@ -622,7 +622,7 @@ Init_signal()
|
|||
#ifndef MACOS_UNUSE_SIGNAL
|
||||
rb_define_global_function("trap", rb_f_trap, -1);
|
||||
ruby_signal(SIGINT, sighandle);
|
||||
#ifndef NT
|
||||
#ifdef SIGHUP
|
||||
ruby_signal(SIGHUP, sighandle);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
|
|
|
@ -1,4 +1,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_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
|
||||
//
|
||||
|
@ -1183,7 +1183,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
|
|||
//
|
||||
|
||||
DIR *
|
||||
opendir(char *filename)
|
||||
opendir(const char *filename)
|
||||
{
|
||||
DIR *p;
|
||||
long len;
|
||||
|
@ -1524,8 +1524,8 @@ valid_filename(char *s)
|
|||
// if we can prevent perl from trying to do stdio on sockets.
|
||||
//
|
||||
|
||||
EXTERN_C int __cdecl _alloc_osfhnd(void);
|
||||
EXTERN_C int __cdecl _set_osfhnd(int fh, long value);
|
||||
//EXTERN_C int __cdecl _alloc_osfhnd(void);
|
||||
//EXTERN_C int __cdecl _set_osfhnd(int fh, long value);
|
||||
EXTERN_C void __cdecl _lock_fhandle(int);
|
||||
EXTERN_C void __cdecl _unlock_fhandle(int);
|
||||
EXTERN_C void __cdecl _unlock(int);
|
||||
|
@ -1534,18 +1534,23 @@ typedef struct {
|
|||
long osfhnd; /* underlying OS file HANDLE */
|
||||
char osfile; /* attributes of file (e.g., open in text mode?) */
|
||||
char pipech; /* one char buffer for handles opened on pipes */
|
||||
#if defined (_MT) && !defined (DLL_FOR_WIN32S)
|
||||
int lockinitflag;
|
||||
CRITICAL_SECTION lock;
|
||||
#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */
|
||||
} ioinfo;
|
||||
|
||||
#if !defined _CRTIMP
|
||||
#define _CRTIMP __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
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 _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 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 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
|
||||
my_open_osfhandle(long osfhandle, int flags)
|
||||
{
|
||||
|
@ -1622,7 +1641,9 @@ myfdopen (int fd, const char *mode)
|
|||
void
|
||||
myfdclose(FILE *fp)
|
||||
{
|
||||
#if !defined __MINGW32__
|
||||
_free_osfhnd(fileno(fp));
|
||||
#endif
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
@ -1639,7 +1660,9 @@ char *
|
|||
mystrerror(int e)
|
||||
{
|
||||
static char buffer[512];
|
||||
#if !defined __MINGW32__
|
||||
extern int sys_nerr;
|
||||
#endif
|
||||
DWORD source = 0;
|
||||
|
||||
if (e < 0 || e > sys_nerr) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(IMPORT)
|
||||
#define EXTERN extern __declspec(dllimport)
|
||||
#elif defined(EXPORT)
|
||||
|
@ -163,6 +164,12 @@ extern "C++" {
|
|||
#define strncasecmp _strnicmp
|
||||
/* these are defined in nt.c */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
#endif
|
||||
extern int NtMakeCmdVector(char *, char ***, int);
|
||||
extern void NtInitialize(int *, char ***);
|
||||
extern char *NtGetLib(void);
|
||||
|
|
Загрузка…
Ссылка в новой задаче