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

* djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.

* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-10-04 13:25:12 +00:00
parent bbbd9c0b7b
commit 8dd118c0db
23 changed files with 67 additions and 526 deletions

View file

@ -1,3 +1,49 @@
Sat Oct 4 22:14:15 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.
* djgpp/config.hin: ditto.
* djgpp/config.sed: ditto.
* djgpp/configure.bat: ditto.
* djgpp/mkver.sed: ditto.
* ext/Setup.dj: ditto.
* dln.c: removed djgpp supports.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* process.c: ditto.
* ruby.c: ditto.
* signal.c: ditto.
* util.c: ditto.
* vm_core.h: ditto.
* lib/fileutils.rb: ditto.
* lib/mkmf.rb: ditto.
* ext/socket/socket.c: ditto.
* test/fileutils/test_fileutils.rb: ditto.
* test/ruby/test_env.rb: ditto.
* test/ruby/test_path.rb: ditto.
Sat Oct 4 21:59:39 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* x68/_dtos18.c: removed. Ruby no longer supports human68k.

View file

@ -1,3 +0,0 @@
include Makefile
VPATH = $(srcdir) $(srcdir)/missing
include uncommon.mk

View file

@ -1,21 +0,0 @@
* How to compile and install on djgpp
This is what you need to do to compile and install Ruby:
1. Run configure.bat, which will generate config.h and Makefile
(GNU sed required).
Message like this is normal:
sed.exe: can't read 123456789: No such file or directory (ENOENT)
2. Edit defines.h if you need. Probably this step will not need.
3. Remove comment mark(#) before the module names from ext/Setup.dj (or
add module names if not present).
4. Run make.
5. Optionally, run 'make test' to check whether the compiled Ruby
interpreter works well. If you see the message "test succeeded",
your ruby works as it should (hopefully).
6. Run 'make install'

View file

@ -1,114 +0,0 @@
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define USE_BUILTIN_FRAME_ADDRESS 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LONG_LONG 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 0
#define SIZEOF_OFF_T 4
#define SIZEOF_VOIDP 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define HAVE_PROTOTYPES 1
#define TOKEN_PASTE(x,y) x##y
#define HAVE_STDARG_PROTOTYPES 1
#define NORETURN(x) x __attribute__ ((noreturn))
#define HAVE_DECL_SYS_NERR 1
#define HAVE_DIRENT_H 1
#define STDC_HEADERS 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LIMITS_H 1
#define HAVE_SYS_FILE_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_FCNTL_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_PWD_H 1
#define HAVE_UTIME_H 1
#define HAVE_MEMORY_H 1
#define HAVE_DIRECT_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
#define HAVE_ST_BLKSIZE 1
#define HAVE_STRUCT_STAT_ST_RDEV 1
#define HAVE_ST_RDEV 1
#define GETGROUPS_T gid_t
#define RETSIGTYPE void
#define HAVE_ALLOCA 1
#define HAVE_DUP2 1
#define HAVE_MEMMOVE 1
#define HAVE_MKDIR 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOUL 1
#define HAVE_ISINF 1
#define HAVE_ISNAN 1
#define HAVE_FINITE 1
#define HAVE_HYPOT 1
#define HAVE_ACOSH 1
#define HAVE_FMOD 1
#define HAVE_WAITPID 1
#define HAVE_FSYNC 1
#define HAVE_TRUNCATE 1
#define HAVE_CHSIZE 1
#define HAVE_TIMES 1
#define HAVE_UTIMES 1
#define HAVE_FCNTL 1
#define HAVE_SYMLINK 1
#define HAVE_SETITIMER 1
#define HAVE_PAUSE 1
#define HAVE_GETPGRP 1
#define HAVE_SETPGID 1
#define HAVE_GETGROUPS 1
#define HAVE_GETRLIMIT 1
#define HAVE_SIGPROCMASK 1
#define HAVE_SIGACTION 1
#define HAVE_SETSID 1
#define HAVE_TELLDIR 1
#define HAVE_SEEKDIR 1
#define HAVE_MKTIME 1
#define HAVE_COSH 1
#define HAVE_SINH 1
#define HAVE_TANH 1
#define HAVE_STRUCT_TM_TM_ZONE 1
#define HAVE_TM_ZONE 1
#define HAVE_STRUCT_TM_TM_GMTOFF 1
#define POSIX_SIGNAL 1
#define GETPGRP_VOID 1
#define SETPGRP_VOID 1
#define RSHIFT(x,y) ((x)>>(int)y)
#define FILE_COUNT _cnt
#define FILE_READPTR _ptr
#define NEED_IO_FLUSH_BETWEEN_RW 1
#define DEFAULT_KCODE KCODE_NONE
#define DLEXT ".so"
#define RUBY_LIB "/lib/ruby/@MAJOR@.@MINOR@.@TEENY@"
#define RUBY_SITE_LIB "/lib/ruby/site_ruby"
#define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/@MAJOR@.@MINOR@.@TEENY@"
#define RUBY_PLATFORM "i386-msdosdjgpp"
#define RUBY_ARCHLIB "/lib/ruby/@MAJOR@.@MINOR@.@TEENY@/i386-msdosdjgpp"
#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/@MAJOR@.@MINOR@.@TEENY@/i386-msdosdjgpp"

View file

@ -1,128 +0,0 @@
/^SHELL/s,/bin/sh,$(COMSPEC),
;s%/bin/rm%rm%
;s%|| true%%
;/\/dev\/null/ {
;s,/dev/null 2>&1, nul,
;s,2> /dev/null,,
;}
;/^config.status/ {
; N;N;N;N;N;d
;}
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@srcdir@,.,g;t t
s,@top_srcdir@,..,;t t
s,@PATH_SEPARATOR@,:,;t t
s,@PACKAGE_NAME@,,;t t
s,@PACKAGE_TARNAME@,,;t t
s,@PACKAGE_VERSION@,,;t t
s,@PACKAGE_STRING@,,;t t
s,@PACKAGE_BUGREPORT@,,;t t
s,@exec_prefix@,${prefix},;t t
s,@prefix@,/dev/env/DJDIR,;t t
s%@program_transform_name@%s,^,,%;t t
s,@bindir@,${exec_prefix}/bin,;t t
s,@sbindir@,${exec_prefix}/sbin,;t t
s,@libexecdir@,${exec_prefix}/libexec,;t t
s,@datadir@,${prefix}/share,;t t
s,@sysconfdir@,${prefix}/etc,;t t
s,@sharedstatedir@,${prefix}/com,;t t
s,@localstatedir@,${prefix}/var,;t t
s,@libdir@,${exec_prefix}/lib,;t t
s,@includedir@,${prefix}/include,;t t
s,@oldincludedir@,/usr/include,;t t
s,@infodir@,${prefix}/info,;t t
s,@mandir@,${prefix}/man,;t t
s,@build_alias@,i586-pc-msdosdjgpp,;t t
s,@host_alias@,i586-pc-msdosdjgpp,;t t
s,@target_alias@,i386-msdosdjgpp,;t t
s,@DEFS@,,;t t
s,@ECHO_C@,,;t t
s,@ECHO_N@,-n,;t t
s,@ECHO_T@,,;t t
s,@LIBS@,-lm ,;t t
s,@MAJOR@,1,;t t
s,@MINOR@,7,;t t
s,@TEENY@,3,;t t
s,@build@,i586-pc-msdosdjgpp,;t t
s,@build_cpu@,i586,;t t
s,@build_vendor@,pc,;t t
s,@build_os@,msdosdjgpp,;t t
s,@host@,i586-pc-msdosdjgpp,;t t
s,@host_cpu@,i586,;t t
s,@host_vendor@,pc,;t t
s,@host_os@,msdosdjgpp,;t t
s,@target@,i386-pc-msdosdjgpp,;t t
s,@target_cpu@,i386,;t t
s,@target_vendor@,pc,;t t
s,@target_os@,msdosdjgpp,;t t
s,@CC@,gcc,;t t
s,@ac_ct_CC@,,;t t
s,@CFLAGS@,-Os,;t t
s,@LDFLAGS@,,;t t
s,@CPPFLAGS@,,;t t
s,@EXEEXT@,.exe,;t t
s,@OBJEXT@,o,;t t
s,@CPP@,gcc -E,;t t
s,@EGREP@,grep -E,;t t
s,@GNU_LD@,yes,;t t
s,@CPPOUTFILE@,-o conftest.i,;t t
s,@OUTFLAG@,-o ,;t t
s,@YACC@,bison -y,;t t
s,@RANLIB@,ranlib,;t t
s,@ac_ct_RANLIB@,,;t t
s,@AR@,ar,;t t
s,@ac_ct_AR@,,;t t
s,@NM@,,;t t
s,@ac_ct_NM@,,;t t
s,@WINDRES@,,;t t
s,@ac_ct_WINDRES@,,;t t
s,@DLLWRAP@,,;t t
s,@ac_ct_DLLWRAP@,,;t t
s,@LN_S@,ln -s,;t t
s,@SET_MAKE@,,;t t
s,@LIBOBJS@,crypt.o flock.o vsnprintf.o,;t t
s,@ALLOCA@,,;t t
s,@XCFLAGS@,,;t t
s,@XLDFLAGS@, -L.,;t t
s,@DLDFLAGS@,,;t t
s,@STATIC@,,;t t
s,@CCDLFLAGS@,,;t t
s,@LDSHARED@,ld,;t t
s,@DLEXT@,so,;t t
s,@DLEXT2@,,;t t
s,@LIBEXT@,a,;t t
s,@LINK_SO@,,;t t
s,@LIBPATHFLAG@, -L%s,;t t
s,@STRIP@,strip,;t t
s,@EXTSTATIC@,,;t t
s,@setup@,Setup.dj,;t t
s,@MINIRUBY@,./miniruby,;t t
s,@PREP@,,;t t
s,@ARCHFILE@,,;t t
s,@LIBRUBY_LDSHARED@,ld,;t t
s,@LIBRUBY_DLDFLAGS@,,;t t
s,@RUBY_INSTALL_NAME@,ruby,;t t
s,@rubyw_install_name@,,;t t
s,@RUBYW_INSTALL_NAME@,,;t t
s,@RUBY_SO_NAME@,$(RUBY_INSTALL_NAME),;t t
s,@LIBRUBY_A@,lib$(RUBY_INSTALL_NAME).a,;t t
s,@LIBRUBY_SO@,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR).$(TEENY),;t t
s,@LIBRUBY_ALIASES@,lib$(RUBY_SO_NAME).so,;t t
s,@LIBRUBY@,$(LIBRUBY_A),;t t
s,@LIBRUBYARG@,-l$(RUBY_INSTALL_NAME),;t t
s,@SOLIBS@,,;t t
s,@DLDLIBS@,-lc,;t t
s,@ENABLE_SHARED@,no,;t t
s,@MAINLIBS@,,;t t
s,@COMMON_LIBS@,,;t t
s,@COMMON_MACROS@,,;t t
s,@COMMON_HEADERS@,,;t t
s,@EXPORT_PREFIX@,,;t t
s,@MAKEFILES@,Makefile,;t t
s,@arch@,i386-msdosdjgpp,;t t
s,@sitearch@,i386-msdosdjgpp,;t t
s,@sitedir@,${prefix}/lib/ruby/site_ruby,;t t
s,@configure_args@,,;t t
/^,THIS_IS_DUMMY_PATTERN_/i\
ac_given_srcdir=.

View file

@ -1,20 +0,0 @@
@echo off
if exist configure.bat cd ..
if exist djgpp\version.sed goto exist
sed -n -f djgpp\mkver.sed < version.h > djgpp\version.sed
:exist
set _conv_=-f djgpp\config.sed -f djgpp\version.sed
sed %_conv_% < Makefile.in > Makefile
sed %_conv_% < djgpp\config.hin > config.h
echo LFN check > 12345678
sed -n /LFN/d 123456789 > nul
if errorlevel 2 goto LFN
copy missing\vsnprintf.c missing\vsnprint.c > nul
copy djgpp\config.sed config.sta > nul
goto end
:LFN
copy djgpp\config.sed config.status > nul
:end
set _conv_=
del 12345678
echo Now you must run a make.

View file

@ -1 +0,0 @@
/RUBY_VERSION /s/^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/s,@MAJOR@,\1,;s,@MINOR@,\2,;s,@TEENY@,\3,/p

3
dln.c
View file

@ -1715,9 +1715,6 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size,
static const char extension[][5] = {
#if defined(MSDOS)
".com", ".exe", ".bat",
#if defined(DJGPP)
".btm", ".sh", ".ksh", ".pl", ".sed",
#endif
#elif defined(__EMX__) || defined(_WIN32)
".exe", ".com", ".cmd", ".bat",
/* end of __EMX__ or _WIN32 */

View file

@ -1,33 +0,0 @@
option nodynamic
#Win32API
bigdecimal
curses
dbm
digest
digest/md5
digest/rmd160
digest/sha1
digest/sha2
#dl
etc
enumerator
fcntl
gdbm
#iconv
#io/wait
nkf
#openssl
#pty
racc/cparse
readline
ripper
sdbm
#socket
stringio
strscan
syck
#syslog
#tk
#win32ole
zlib

View file

@ -241,7 +241,7 @@ init_sock(VALUE sock, int fd)
MakeOpenFile(sock, fp);
fp->fd = fd;
fp->mode = FMODE_READWRITE|FMODE_DUPLEX;
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__EMX__)
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__EMX__)
fp->mode |= FMODE_BINMODE;
#endif
if (do_not_reverse_lookup) {

8
file.c
View file

@ -1989,7 +1989,7 @@ rb_file_chown(VALUE obj, VALUE owner, VALUE group)
o = NIL_P(owner) ? -1 : NUM2INT(owner);
g = NIL_P(group) ? -1 : NUM2INT(group);
GetOpenFile(obj, fptr);
#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__)
#if defined(__CYGWIN32__) || defined(_WIN32) || defined(__EMX__)
if (NIL_P(fptr->pathv)) return Qnil;
if (chown(RSTRING_PTR(fptr->pathv), o, g) == -1)
rb_sys_fail_path(fptr->pathv);
@ -2413,11 +2413,7 @@ rb_file_s_umask(int argc, VALUE *argv)
#endif
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
# if defined(DJGPP)
# define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
# else
# define CharNext(p) ((p) + 1)
# endif
# define CharNext(p) ((p) + 1)
#endif
#ifdef DOSISH_DRIVE_LETTER

25
gc.c
View file

@ -1858,31 +1858,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
return 0;
}
#ifdef __GNUC__
#if defined(DJGPP)
#undef rb_setjmp
#undef rb_jmp_buf
#if defined(DJGPP)
typedef unsigned long rb_jmp_buf[6];
__asm__ (".align 4\n\
_rb_setjmp:\n\
pushl %ebp\n\
movl %esp,%ebp\n\
movl 8(%ebp),%ebp\n\
movl %eax,(%ebp)\n\
movl %ebx,4(%ebp)\n\
movl %ecx,8(%ebp)\n\
movl %edx,12(%ebp)\n\
movl %esi,16(%ebp)\n\
movl %edi,20(%ebp)\n\
popl %ebp\n\
xorl %eax,%eax\n\
ret");
#endif
int rb_setjmp (rb_jmp_buf);
#endif /* DJGPP */
#endif /* __GNUC__ */
#define GC_NOTIFY 0
void rb_vm_mark(void *ptr);

7
io.c
View file

@ -46,7 +46,7 @@
#endif
#include <sys/types.h>
#if defined(HAVE_SYS_IOCTL_H) && !defined(DJGPP) && !defined(_WIN32)
#if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32)
#include <sys/ioctl.h>
#endif
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
@ -4195,9 +4195,6 @@ pipe_finalize(rb_io_t *fptr, int noraise)
}
fptr->fd = -1;
fptr->stdio_file = 0;
#if defined DJGPP
status <<= 8;
#endif
rb_last_status_set(status, fptr->pid);
#else
fptr_finalize(fptr, noraise);
@ -8418,7 +8415,7 @@ Init_IO(void)
rb_define_hooked_variable("$-i", &argf, opt_i_get, opt_i_set);
rb_define_hooked_variable("$*", &argf, argf_argv_getter, 0);
#if defined (_WIN32) || defined(DJGPP) || defined(__CYGWIN__)
#if defined (_WIN32) || defined(__CYGWIN__)
atexit(pipe_atexit);
#endif

View file

@ -524,7 +524,7 @@ module FileUtils
OPT_TABLE['move'] = [:force, :noop, :verbose, :secure]
def rename_cannot_overwrite_file? #:nodoc:
/djgpp|cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
end
private_module_function :rename_cannot_overwrite_file?

View file

@ -9,7 +9,7 @@ CONFIG = RbConfig::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB']
CXX_EXT = %w[cc cxx cpp]
if /mswin|bccwin|mingw|msdosdjgpp|os2/ !~ CONFIG['build_os']
if /mswin|bccwin|mingw|os2/ !~ CONFIG['build_os']
CXX_EXT.concat(%w[C])
end
SRC_EXT = %w[c m] << CXX_EXT
@ -1299,7 +1299,7 @@ def configuration(srcdir)
if CONFIG['target_os'] != 'cygwin'
vpath = vpath.map {|p| p.sub(/.*/, '$(shell cygpath -u \&)')}
end
when 'msdosdjgpp', 'mingw32'
when 'mingw32'
CONFIG['PATH_SEPARATOR'] = ';'
end
end

View file

@ -28,9 +28,6 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef __DJGPP__
#include <process.h>
#endif
#include <time.h>
#include <ctype.h>
@ -1004,12 +1001,12 @@ proc_exec_v(char **argv, const char *prog)
return -1;
}
#if (defined(MSDOS) && !defined(DJGPP)) || defined(__EMX__) || defined(OS2)
#if defined(MSDOS) || defined(__EMX__) || defined(OS2)
{
#if defined(__EMX__) || defined(OS2) /* OS/2 emx */
#define COMMAND "cmd.exe"
#endif
#if (defined(MSDOS) && !defined(DJGPP))
#if defined(MSDOS)
#define COMMAND "command.com"
#endif
char *extension;
@ -2667,11 +2664,7 @@ rb_spawn_internal(int argc, VALUE *argv, int default_close_others)
# else
if (argc) prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
status = system(StringValuePtr(prog));
# if defined(__DJGPP__)
rb_last_status_set(status == -1 ? 127 : status, 0);
# else
rb_last_status_set((status & 0xff) << 8, 0);
# endif
# endif
rb_run_exec_options(&sarg, NULL);

5
ruby.c
View file

@ -186,7 +186,7 @@ translate_char(char *p, int from, int to)
}
#endif
#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__
#if defined _WIN32 || defined __CYGWIN__
static VALUE
rubylib_mangled_path(const char *s, unsigned int l)
{
@ -356,9 +356,6 @@ ruby_init_loadpath(void)
#if defined _WIN32 || defined __CYGWIN__
GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(DJGPP)
extern char *__dos_argv0;
strncpy(libpath, __dos_argv0, sizeof(libpath) - 1);
#elif defined(__EMX__)
_execname(libpath, sizeof(libpath) - 1);
#endif

View file

@ -44,11 +44,7 @@ typedef int rb_atomic_t;
#endif
#ifndef NSIG
# ifdef DJGPP
# define NSIG SIGMAX
# else
# define NSIG (_SIGMAX + 1) /* For QNX */
# endif
# define NSIG (_SIGMAX + 1) /* For QNX */
#endif
static const struct signals {

View file

@ -16,11 +16,11 @@ Dir.mkdir tmproot unless File.directory?(tmproot)
Dir.chdir tmproot
def have_drive_letter?
/djgpp|mswin(?!ce)|mingw|bcc|emx/ =~ RUBY_PLATFORM
/mswin(?!ce)|mingw|bcc|emx/ =~ RUBY_PLATFORM
end
def have_file_perm?
/djgpp|mswin|mingw|bcc|wince|emx/ !~ RUBY_PLATFORM
/mswin|mingw|bcc|wince|emx/ !~ RUBY_PLATFORM
end
$fileutils_rb_have_symlink = nil

View file

@ -1,7 +1,7 @@
require 'test/unit'
class TestEnv < Test::Unit::TestCase
IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM
IGNORE_CASE = /bccwin|mswin|mingw/ =~ RUBY_PLATFORM
PATH_ENV = "PATH"
def setup

View file

@ -45,7 +45,7 @@ class TestPath < Test::Unit::TestCase
end
def test_dirname
if /(bcc|ms)win\d|mingw|cygwin|djgpp|emx/ =~ RUBY_PLATFORM
if /(bcc|ms)win\d|mingw|cygwin|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER
assert_equal('C:.', File.dirname('C:'))
assert_equal('C:.', File.dirname('C:a'))
@ -101,7 +101,7 @@ class TestPath < Test::Unit::TestCase
assert_equal('/', File.dirname('/a/'))
assert_equal('/a', File.dirname('/a/b'))
if /(bcc|ms|cyg)win|mingw|djgpp|emx/ =~ RUBY_PLATFORM
if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM
# DOSISH_UNC
assert_equal('//', File.dirname('//'))
assert_equal('//a', File.dirname('//a'))
@ -135,7 +135,7 @@ class TestPath < Test::Unit::TestCase
end
def test_basename
if /(bcc|ms)win\d|mingw|cygwin|djgpp|emx/ =~ RUBY_PLATFORM
if /(bcc|ms)win\d|mingw|cygwin|emx/ =~ RUBY_PLATFORM
# DOSISH_DRIVE_LETTER
assert_equal('', File.basename('C:'))
assert_equal('a', File.basename('C:a'))
@ -189,7 +189,7 @@ class TestPath < Test::Unit::TestCase
assert_equal('a', File.basename('/a/'))
assert_equal('b', File.basename('/a/b'))
if /(bcc|ms|cyg)win|mingw|djgpp|emx/ =~ RUBY_PLATFORM
if /(bcc|ms|cyg)win|mingw|emx/ =~ RUBY_PLATFORM
# DOSISH_UNC
assert_equal('/', File.basename('//'))
assert_equal('/', File.basename('//a'))

136
util.c
View file

@ -283,15 +283,11 @@ ruby_add_suffix(VALUE str, const char *suffix)
rb_fatal("Cannot do inplace edit on long filename (%ld characters)",
RSTRING_LEN(str));
#if defined(DJGPP) || defined(__CYGWIN32__) || defined(_WIN32)
#if defined(__CYGWIN32__) || defined(_WIN32)
/* Style 0 */
slen = RSTRING_LEN(str);
rb_str_cat(str, suffix, extlen);
#if defined(DJGPP)
if (_USE_LFN) return;
#else
if (valid_filename(RSTRING_PTR(str))) return;
#endif
/* Fooey, style 0 failed. Fix str before continuing. */
rb_str_resize(str, slen);
@ -363,136 +359,6 @@ valid_filename(const char *s)
#endif
#endif
#if defined __DJGPP__
#include <dpmi.h>
static char dbcs_table[256];
int
make_dbcs_table()
{
__dpmi_regs r;
struct {
unsigned char start;
unsigned char end;
} vec;
int offset;
memset(&r, 0, sizeof(r));
r.x.ax = 0x6300;
__dpmi_int(0x21, &r);
offset = r.x.ds * 16 + r.x.si;
for (;;) {
int i;
dosmemget(offset, sizeof vec, &vec);
if (!vec.start && !vec.end)
break;
for (i = vec.start; i <= vec.end; i++)
dbcs_table[i] = 1;
offset += 2;
}
}
int
mblen(const char *s, size_t n)
{
static int need_init = 1;
if (need_init) {
make_dbcs_table();
need_init = 0;
}
if (s) {
if (n == 0 || *s == 0)
return 0;
else if (!s[1])
return 1;
return dbcs_table[(unsigned char)*s] + 1;
}
else
return 1;
}
struct PathList {
struct PathList *next;
char *path;
};
struct PathInfo {
struct PathList *head;
int count;
};
static int
push_element(const char *path, VALUE vinfo)
{
struct PathList *p;
struct PathInfo *info = (struct PathInfo *)vinfo;
p = ALLOC(struct PathList);
MEMZERO(p, struct PathList, 1);
p->path = ruby_strdup(path);
p->next = info->head;
info->head = p;
info->count++;
return 0;
}
#include <dirent.h>
int __opendir_flags = __OPENDIR_PRESERVE_CASE;
char **
__crt0_glob_function(char *path)
{
int len = strlen(path);
int i;
char **rv;
char path_buffer[PATH_MAX];
char *buf = path_buffer;
char *p;
struct PathInfo info;
struct PathList *plist;
if (PATH_MAX <= len)
buf = ruby_xmalloc(len + 1);
strncpy(buf, path, len);
buf[len] = '\0';
for (p = buf; *p; p += mblen(p, RUBY_MBCHAR_MAXSIZE))
if (*p == '\\')
*p = '/';
info.count = 0;
info.head = 0;
ruby_glob(buf, 0, push_element, (VALUE)&info);
if (buf != path_buffer)
ruby_xfree(buf);
if (info.count == 0)
return 0;
rv = ruby_xmalloc((info.count + 1) * sizeof (char *));
plist = info.head;
i = 0;
while (plist) {
struct PathList *cur;
rv[i] = plist->path;
cur = plist;
plist = plist->next;
ruby_xfree(cur);
i++;
}
rv[i] = 0;
return rv;
}
#endif
/* mm.c */

View file

@ -35,9 +35,7 @@
#include <signal.h>
#ifndef NSIG
# ifdef DJGPP
# define NSIG SIGMAX
# elif defined MACOS_UNUSE_SIGNAL
# if defined MACOS_UNUSE_SIGNAL
# define NSIG 1
# else
# define NSIG (_SIGMAX + 1) /* For QNX */