1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omit Win9x

support.  remove --enable/disable-win95 option.

* include/ruby/win32.h, file.c, win32/win32.c: ditto.

* win32/README.win32: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-07-09 08:25:06 +00:00
parent 9a8a2fd294
commit 9d2711691e
8 changed files with 20 additions and 159 deletions

View file

@ -1,3 +1,12 @@
Mon Jul 9 17:22:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omit Win9x
support. remove --enable/disable-win95 option.
* include/ruby/win32.h, file.c, win32/win32.c: ditto.
* win32/README.win32: ditto.
Mon Jul 9 13:28:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (DLDFLAGS): use TARGET_ENTRY to specify an entry point

4
file.c
View file

@ -857,8 +857,7 @@ w32_io_info(VALUE *file, BY_HANDLE_FILE_INFORMATION *st)
MultiByteToWideChar(CP_UTF8, 0, RSTRING_PTR(tmp), -1, ptr, len);
f = CreateFileW(ptr, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
rb_w32_iswin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS,
NULL);
FILE_FLAG_BACKUP_SEMANTICS, NULL);
ALLOCV_END(v);
if (f == INVALID_HANDLE_VALUE) return f;
ret = f;
@ -1672,7 +1671,6 @@ rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
st1.nFileIndexLow == st2.nFileIndexLow)
return Qtrue;
if (!f1 || !f2) return Qfalse;
if (rb_w32_iswin95()) return Qfalse;
# else
FilePathValue(fname1);
fname1 = rb_str_new4(fname1);

View file

@ -105,14 +105,9 @@ typedef unsigned int uintptr_t;
# include <unistd.h>
#endif
#ifdef WIN95
extern DWORD rb_w32_osid(void);
#define rb_w32_iswinnt() (rb_w32_osid() == VER_PLATFORM_WIN32_NT)
#define rb_w32_iswin95() (rb_w32_osid() == VER_PLATFORM_WIN32_WINDOWS)
#else
#define rb_w32_iswinnt() TRUE
#define rb_w32_iswin95() FALSE
#endif
#define WNOHANG -1

View file

@ -228,9 +228,6 @@ EXTSOLIBS =
!if !defined(LIBS)
LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib imagehlp.lib $(EXTLIBS)
!endif
!if "$(ENABLE_WIN95)" == "yes"
LIBS = unicows.lib $(LIBS)
!endif
!if !defined(MISSING)
MISSING = acosh.obj cbrt.obj crypt.obj erf.obj ffs.obj langinfo.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32/win32.obj win32/file.obj setproctitle.obj
!endif
@ -477,9 +474,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#if _MSC_VER != $(MSC_VER)
#error MSC version unmatch: _MSC_VER: $(MSC_VER) is expected.
#endif
!if "$(ENABLE_WIN95)" == "yes" && "$(MACHINE)" == "x86"
#define WIN95 1
!endif
#define RUBY_MSVCRT_VERSION $(RT_VER)
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1

View file

@ -4,9 +4,9 @@
== Requirement
(1) Windows 2000 or later (NT based kernel).
(1) Windows XP or later.
(2) Visual C++ 6.0 or later.
(2) Visual C++ 6.0 or later. (strongly recommended VC++ 10)
Note: if you want to build x64 or ia64 version, use native compiler for
x64/ia64.
@ -29,10 +29,6 @@
of cmd.exe. If you want to enable it explicitly, run cmd.exe with /E:ON
option.
(6) If you want built binaries to run on Windows 95 series (including
98 and Me), you need unicows.lib at compile time, and unicows.dll
at run time.
== How to compile and install
(1) Execute win32\configure.bat on your build directory.

View file

@ -23,8 +23,6 @@ if "%1" == "--install-name" goto :installname
if "%1" == "--so-name" goto :soname
if "%1" == "--enable-install-doc" goto :enable-rdoc
if "%1" == "--disable-install-doc" goto :disable-rdoc
if "%1" == "--enable-win95" goto :enable-win95
if "%1" == "--disable-win95" goto :disable-win95
if "%1" == "--enable-debug-env" goto :enable-debug-env
if "%1" == "--disable-debug-env" goto :disable-debug-env
if "%1" == "--enable-rubygems" goto :enable-rubygems
@ -106,16 +104,6 @@ goto :loop
echo>>confargs.tmp %1 \
shift
goto :loop
:enable-win95
echo>> ~tmp~.mak "ENABLE_WIN95=yes" \
echo>>confargs.tmp %1 \
shift
goto :loop
:disable-win95
echo>> ~tmp~.mak "ENABLE_WIN95=no" \
echo>>confargs.tmp %1 \
shift
goto :loop
:enable-debug-env
echo>> ~tmp~.mak "ENABLE_DEBUG_ENV=yes" \
echo>>confargs.tmp %1 \

View file

@ -70,9 +70,9 @@ USE_RUBYGEMS = $(USE_RUBYGEMS)
@echo !endif>> $(MAKEFILE)
!endif
-system-vars-: -runtime- -unicows-
-system-vars-: -runtime-
-system-vars32-: -osname32- -runtime- -unicows-
-system-vars32-: -osname32- -runtime-
-system-vars64-: -osname64- -runtime-
@ -154,21 +154,6 @@ int main(int argc, char **argv)
@.\rtname >>$(MAKEFILE)
@del rtname.*
-unicows-: nul
!if "$(ENABLE_WIN95)" == ""
@echo Checking unicows.lib
@$(CC) -MD <<conftest.c unicows.lib user32.lib > nul && echo>>$(MAKEFILE) ENABLE_WIN95 = yes || rem
#include <windows.h>
int main()
{
return GetEnvironmentVariableW(0, 0, 0) == 0;
}
<<
@del conftest.*
!else if "$(ENABLE_WIN95)" == "yes"
@echo>>$(MAKEFILE) ENABLE_WIN95 = yes
!endif
-version-: nul
@$(APPEND)
@$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(MAKEFILE)" | findstr "=" >>$(MAKEFILE)

View file

@ -271,14 +271,6 @@ rb_w32_osver(void)
return osver.dwMajorVersion;
}
#define IsWinNT() rb_w32_iswinnt()
#define IsWin95() rb_w32_iswin95()
#ifdef WIN95
#define IfWin95(win95, winnt) (IsWin95() ? (win95) : (winnt))
#else
#define IfWin95(win95, winnt) (winnt)
#endif
/* simulate flock by locking a range on the file */
/* License: Artistic or GPL */
@ -335,54 +327,13 @@ flock_winnt(uintptr_t self, int argc, uintptr_t* argv)
return i;
}
#ifdef WIN95
/* License: Artistic or GPL */
static uintptr_t
flock_win95(uintptr_t self, int argc, uintptr_t* argv)
{
int i = -1;
const HANDLE fh = (HANDLE)self;
const int oper = argc;
switch(oper) {
case LOCK_EX:
do {
LK_ERR(LockFile(fh, 0, 0, LK_LEN, LK_LEN), i);
} while (i && errno == EWOULDBLOCK);
break;
case LOCK_EX|LOCK_NB:
LK_ERR(LockFile(fh, 0, 0, LK_LEN, LK_LEN), i);
break;
case LOCK_UN:
case LOCK_UN|LOCK_NB:
LK_ERR(UnlockFile(fh, 0, 0, LK_LEN, LK_LEN), i);
break;
default:
errno = EINVAL;
break;
}
return i;
}
#endif
#undef LK_ERR
/* License: Artistic or GPL */
int
flock(int fd, int oper)
{
#ifdef WIN95
static asynchronous_func_t locker = NULL;
if (!locker) {
if (IsWinNT())
locker = flock_winnt;
else
locker = flock_win95;
}
#else
const asynchronous_func_t locker = flock_winnt;
#endif
return rb_w32_asynchronize(locker,
(VALUE)_get_osfhandle(fd), oper, NULL,
@ -1194,11 +1145,6 @@ CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa,
child->hProcess = aProcessInformation.hProcess;
child->pid = (rb_pid_t)aProcessInformation.dwProcessId;
if (!IsWinNT()) {
/* On Win9x, make pid positive similarly to cygwin and perl */
child->pid = -child->pid;
}
return child;
}
@ -4116,7 +4062,6 @@ kill(int pid, int sig)
return -1;
}
(void)IfWin95(pid = -pid, 0);
if ((unsigned int)pid == GetCurrentProcessId() &&
(sig != 0 && sig != SIGKILL)) {
if ((ret = raise(sig)) != 0) {
@ -4382,20 +4327,8 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath)
switch (GetLastError()) {
case ERROR_ALREADY_EXISTS:
case ERROR_FILE_EXISTS:
if (IsWinNT()) {
if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
res = 0;
}
else {
for (;;) {
if (!DeleteFileW(newpath) && GetLastError() != ERROR_FILE_NOT_FOUND)
break;
else if (MoveFileW(oldpath, newpath)) {
res = 0;
break;
}
}
}
if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING))
res = 0;
}
}
@ -4662,22 +4595,7 @@ winnt_stat(const WCHAR *path, struct stati64 *st)
return 0;
}
#ifdef WIN95
/* License: Ruby's */
static int
win95_stat(const WCHAR *path, struct stati64 *st)
{
int ret = _wstati64(path, st);
if (ret) return ret;
if (st->st_mode & S_IFDIR) {
return check_valid_dir(path);
}
return 0;
}
#else
#define win95_stat(path, st) -1
#endif
/* License: Ruby's */
int
@ -4729,7 +4647,7 @@ wstati64(const WCHAR *path, struct stati64 *st)
else if (*end == L'\\' || (buf1 + 1 == end && *end == L':'))
lstrcatW(buf1, L".");
ret = IsWinNT() ? winnt_stat(buf1, st) : win95_stat(buf1, st);
ret = winnt_stat(buf1, st);
if (ret == 0) {
st->st_mode &= ~(S_IWGRP | S_IWOTH);
}
@ -4832,17 +4750,6 @@ rb_w32_truncate(const char *path, off_t length)
{
HANDLE h;
int ret;
#ifdef WIN95
if (IsWin95()) {
int fd = open(path, O_WRONLY), e = 0;
if (fd == -1) return -1;
ret = chsize(fd, (unsigned long)length);
if (ret == -1) e = errno;
close(fd);
if (ret == -1) errno = e;
return ret;
}
#endif
h = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
if (h == INVALID_HANDLE_VALUE) {
errno = map_errno(GetLastError());
@ -4859,11 +4766,6 @@ rb_w32_ftruncate(int fd, off_t length)
{
HANDLE h;
#ifdef WIN95
if (IsWin95()) {
return chsize(fd, (unsigned long)length);
}
#endif
h = (HANDLE)_get_osfhandle(fd);
if (h == (HANDLE)-1) return -1;
return rb_chsize(h, length);
@ -5177,13 +5079,7 @@ rb_w32_free_environ(char **env)
rb_pid_t
rb_w32_getpid(void)
{
rb_pid_t pid;
pid = GetCurrentProcessId();
(void)IfWin95(pid = -pid, 0);
return pid;
return GetCurrentProcessId();
}
@ -5195,7 +5091,7 @@ rb_w32_getppid(void)
static query_func *pNtQueryInformationProcess = NULL;
rb_pid_t ppid = 0;
if (!IsWin95() && rb_w32_osver() >= 5) {
if (rb_w32_osver() >= 5) {
if (!pNtQueryInformationProcess)
pNtQueryInformationProcess = (query_func *)get_proc_address("ntdll.dll", "NtQueryInformationProcess", NULL);
if (pNtQueryInformationProcess) {
@ -6291,7 +6187,7 @@ wutime(const WCHAR *path, const struct utimbuf *times)
if (attr != (DWORD)-1 && (attr & FILE_ATTRIBUTE_READONLY))
SetFileAttributesW(path, attr & ~FILE_ATTRIBUTE_READONLY);
hFile = CreateFileW(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0);
FILE_FLAG_BACKUP_SEMANTICS, 0);
if (hFile == INVALID_HANDLE_VALUE) {
errno = map_errno(GetLastError());
ret = -1;