mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* x68/_dtos18.c: removed. Ruby no longer supports human68k.
* x68/_round.c: ditto. * x68/fconvert.c: ditto. * x68/select.c: ditto. * ext/Setup.x68: ditto. * missing/x68.c: ditto. * dln.c (dln_find_exe_r): removed human68k supports. (dln_find_1): ditto. * lib/mkmf.rb: ditto. * ext/extmk.rb (Init_ext): ditto. * ext/socket/socket.c (init_sock): ditto. * gc.c (GC_MALLOC_LIMIT): ditto. (rb_setjmp, rb_jmpbuf): ditto. (mark_current_machine_context): ditto. * include/ruby/defines.h (PATH_ENV): ditto. * io.c: ditto. * process.c: ditto. * ruby.c: ditto. * test/ruby/test_env.rb: ditto. * test/ruby/test_path.rb: ditto. * LEGAL git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c0e636b19
commit
bbbd9c0b7b
20 changed files with 67 additions and 697 deletions
41
ChangeLog
41
ChangeLog
|
@ -1,3 +1,44 @@
|
|||
Sat Oct 4 21:59:39 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* x68/_dtos18.c: removed. Ruby no longer supports human68k.
|
||||
|
||||
* x68/_round.c: ditto.
|
||||
|
||||
* x68/fconvert.c: ditto.
|
||||
|
||||
* x68/select.c: ditto.
|
||||
|
||||
* ext/Setup.x68: ditto.
|
||||
|
||||
* missing/x68.c: ditto.
|
||||
|
||||
* dln.c (dln_find_exe_r): removed human68k supports.
|
||||
(dln_find_1): ditto.
|
||||
|
||||
* lib/mkmf.rb: ditto.
|
||||
|
||||
* ext/extmk.rb (Init_ext): ditto.
|
||||
|
||||
* ext/socket/socket.c (init_sock): ditto.
|
||||
|
||||
* gc.c (GC_MALLOC_LIMIT): ditto.
|
||||
(rb_setjmp, rb_jmpbuf): ditto.
|
||||
(mark_current_machine_context): ditto.
|
||||
|
||||
* include/ruby/defines.h (PATH_ENV): ditto.
|
||||
|
||||
* io.c: ditto.
|
||||
|
||||
* process.c: ditto.
|
||||
|
||||
* ruby.c: ditto.
|
||||
|
||||
* test/ruby/test_env.rb: ditto.
|
||||
|
||||
* test/ruby/test_path.rb: ditto.
|
||||
|
||||
* LEGAL
|
||||
|
||||
Sat Oct 4 19:02:36 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/date/format.rb: no need to require the "lib/rational.rb".
|
||||
|
|
1
LEGAL
1
LEGAL
|
@ -171,7 +171,6 @@ random.c
|
|||
email: matumoto@math.keio.ac.jp
|
||||
|
||||
st.[ch]:
|
||||
x68/*:
|
||||
missing/alloca.c:
|
||||
missing/dup2.c:
|
||||
missing/finite.c:
|
||||
|
|
|
@ -424,7 +424,6 @@ strstr.$(OBJEXT): {$(VPATH)}strstr.c
|
|||
strtod.$(OBJEXT): {$(VPATH)}strtod.c
|
||||
strtol.$(OBJEXT): {$(VPATH)}strtol.c
|
||||
nt.$(OBJEXT): {$(VPATH)}nt.c
|
||||
x68.$(OBJEXT): {$(VPATH)}x68.c
|
||||
os2.$(OBJEXT): {$(VPATH)}os2.c
|
||||
dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
|
||||
ia64.$(OBJEXT): {$(VPATH)}ia64.s
|
||||
|
|
7
dln.c
7
dln.c
|
@ -1581,7 +1581,7 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, int size)
|
|||
}
|
||||
|
||||
if (!path) {
|
||||
#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__MACOS__)
|
||||
#if defined(MSDOS) || defined(_WIN32) || defined(__MACOS__)
|
||||
path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
|
||||
#else
|
||||
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
|
||||
|
@ -1721,9 +1721,6 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size,
|
|||
#elif defined(__EMX__) || defined(_WIN32)
|
||||
".exe", ".com", ".cmd", ".bat",
|
||||
/* end of __EMX__ or _WIN32 */
|
||||
#else
|
||||
".r", ".R", ".x", ".X", ".bat", ".BAT",
|
||||
/* __human68k__ */
|
||||
#endif
|
||||
};
|
||||
int j;
|
||||
|
@ -1747,7 +1744,7 @@ dln_find_1(const char *fname, const char *path, char *fbuf, int size,
|
|||
}
|
||||
goto next;
|
||||
}
|
||||
#endif /* MSDOS or _WIN32 or __human68k__ or __EMX__ */
|
||||
#endif /* MSDOS or _WIN32 or __EMX__ */
|
||||
|
||||
#ifndef __MACOS__
|
||||
if (stat(fbuf, &st) == 0) {
|
||||
|
|
|
@ -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
|
|
@ -39,7 +39,7 @@ load File.expand_path("lib/mkmf.rb", srcdir)
|
|||
require 'optparse/shellwords'
|
||||
|
||||
def sysquote(x)
|
||||
@quote ||= /human|os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
||||
@quote ||= /os2|macos/ =~ (CROSS_COMPILING || RUBY_PLATFORM)
|
||||
@quote ? x.quote : x
|
||||
end
|
||||
|
||||
|
@ -507,7 +507,7 @@ void Init_ext _((void))\n{\n#$extinit}
|
|||
end
|
||||
|
||||
$extobjs = "ext/#{extinit.o} #{$extobjs}"
|
||||
if RUBY_PLATFORM =~ /m68k-human|beos/
|
||||
if RUBY_PLATFORM =~ /beos/
|
||||
$extflags.delete("-L/usr/local/lib")
|
||||
end
|
||||
$extpath.delete("$(topdir)")
|
||||
|
|
|
@ -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(__human68k__) || defined(__EMX__)
|
||||
#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__EMX__)
|
||||
fp->mode |= FMODE_BINMODE;
|
||||
#endif
|
||||
if (do_not_reverse_lookup) {
|
||||
|
|
18
gc.c
18
gc.c
|
@ -75,7 +75,7 @@ void *alloca ();
|
|||
#endif /* __GNUC__ */
|
||||
|
||||
#ifndef GC_MALLOC_LIMIT
|
||||
#if defined(MSDOS) || defined(__human68k__)
|
||||
#if defined(MSDOS)
|
||||
#define GC_MALLOC_LIMIT 200000
|
||||
#else
|
||||
#define GC_MALLOC_LIMIT 8000000
|
||||
|
@ -1859,18 +1859,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
|
|||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__human68k__) || defined(DJGPP)
|
||||
#if defined(DJGPP)
|
||||
#undef rb_setjmp
|
||||
#undef rb_jmp_buf
|
||||
#if defined(__human68k__)
|
||||
typedef unsigned long rb_jmp_buf[8];
|
||||
__asm__ (".even\n\
|
||||
_rb_setjmp:\n\
|
||||
move.l 4(sp),a0\n\
|
||||
movem.l d3-d7/a3-a5,(a0)\n\
|
||||
moveq.l #0,d0\n\
|
||||
rts");
|
||||
#else
|
||||
#if defined(DJGPP)
|
||||
typedef unsigned long rb_jmp_buf[6];
|
||||
__asm__ (".align 4\n\
|
||||
|
@ -1888,9 +1879,8 @@ _rb_setjmp:\n\
|
|||
xorl %eax,%eax\n\
|
||||
ret");
|
||||
#endif
|
||||
#endif
|
||||
int rb_setjmp (rb_jmp_buf);
|
||||
#endif /* __human68k__ or DJGPP */
|
||||
#endif /* DJGPP */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define GC_NOTIFY 0
|
||||
|
@ -1932,7 +1922,7 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
|
|||
#ifdef __ia64
|
||||
rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
|
||||
#endif
|
||||
#if defined(__human68k__) || defined(__mc68000__)
|
||||
#if defined(__mc68000__)
|
||||
mark_locations_array((VALUE*)((char*)STACK_END + 2),
|
||||
(STACK_START - STACK_END));
|
||||
#endif
|
||||
|
|
|
@ -103,7 +103,7 @@ void xfree(void*);
|
|||
#undef _WIN32
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__)
|
||||
#if defined(MSDOS) || defined(_WIN32) || defined(__EMX__)
|
||||
#define DOSISH 1
|
||||
#ifndef _WIN32_WCE
|
||||
# define DOSISH_DRIVE_LETTER
|
||||
|
@ -252,13 +252,9 @@ void rb_ia64_flushrs(void);
|
|||
#endif
|
||||
#define PATH_SEP_CHAR PATH_SEP[0]
|
||||
|
||||
#if defined(__human68k__)
|
||||
#define PATH_ENV "path"
|
||||
#else
|
||||
#define PATH_ENV "PATH"
|
||||
#endif
|
||||
|
||||
#if defined(DOSISH) && !defined(__human68k__) && !defined(__EMX__)
|
||||
#if defined(DOSISH) && !defined(__EMX__)
|
||||
#define ENV_IGNORECASE
|
||||
#endif
|
||||
|
||||
|
|
15
io.c
15
io.c
|
@ -29,7 +29,7 @@
|
|||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__human68k__) || defined(__EMX__) || defined(__BEOS__)
|
||||
#if defined(MSDOS) || defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__EMX__) || defined(__BEOS__)
|
||||
# define NO_SAFE_RENAME
|
||||
#endif
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(HAVE_SYS_IOCTL_H) && !defined(DJGPP) && !defined(_WIN32) && !defined(__human68k__)
|
||||
#if defined(HAVE_SYS_IOCTL_H) && !defined(DJGPP) && !defined(_WIN32)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#if defined(HAVE_FCNTL_H) || defined(_WIN32)
|
||||
|
@ -6400,7 +6400,7 @@ rb_f_select(int argc, VALUE *argv, VALUE obj)
|
|||
|
||||
}
|
||||
|
||||
#if !defined(MSDOS) && !defined(__human68k__)
|
||||
#if !defined(MSDOS)
|
||||
static int
|
||||
io_cntl(int fd, int cmd, long narg, int io_p)
|
||||
{
|
||||
|
@ -6425,7 +6425,7 @@ io_cntl(int fd, int cmd, long narg, int io_p)
|
|||
static VALUE
|
||||
rb_io_ctl(VALUE io, VALUE req, VALUE arg, int io_p)
|
||||
{
|
||||
#if !defined(MSDOS) && !defined(__human68k__)
|
||||
#if !defined(MSDOS)
|
||||
int cmd = NUM2ULONG(req);
|
||||
rb_io_t *fptr;
|
||||
long len = 0;
|
||||
|
@ -6768,10 +6768,6 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
|
|||
static VALUE
|
||||
rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
|
||||
{
|
||||
#ifdef __human68k__
|
||||
rb_notimplement();
|
||||
return Qnil; /* not reached */
|
||||
#else
|
||||
int pipes[2], state;
|
||||
VALUE r, w, args[3], v1, v2;
|
||||
VALUE opt;
|
||||
|
@ -6804,7 +6800,6 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
|
|||
rb_io_synchronized(RFILE(w)->fptr);
|
||||
|
||||
return rb_assoc_new(r, w);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct foreach_arg {
|
||||
|
@ -8423,7 +8418,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__) || defined(__human68k__)
|
||||
#if defined (_WIN32) || defined(DJGPP) || defined(__CYGWIN__)
|
||||
atexit(pipe_atexit);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ CONFIG = RbConfig::MAKEFILE_CONFIG
|
|||
ORIG_LIBPATH = ENV['LIB']
|
||||
|
||||
CXX_EXT = %w[cc cxx cpp]
|
||||
if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os']
|
||||
if /mswin|bccwin|mingw|msdosdjgpp|os2/ !~ CONFIG['build_os']
|
||||
CXX_EXT.concat(%w[C])
|
||||
end
|
||||
SRC_EXT = %w[c m] << CXX_EXT
|
||||
|
@ -59,7 +59,6 @@ $mswin = /mswin/ =~ RUBY_PLATFORM
|
|||
$bccwin = /bccwin/ =~ RUBY_PLATFORM
|
||||
$mingw = /mingw/ =~ RUBY_PLATFORM
|
||||
$cygwin = /cygwin/ =~ RUBY_PLATFORM
|
||||
$human = /human/ =~ RUBY_PLATFORM
|
||||
$netbsd = /netbsd/ =~ RUBY_PLATFORM
|
||||
$os2 = /os2/ =~ RUBY_PLATFORM
|
||||
$beos = /beos/ =~ RUBY_PLATFORM
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/* x68 compatibility functions -- follows Ruby's license */
|
||||
|
||||
#include "ruby/config.h"
|
||||
|
||||
#if !HAVE_SELECT
|
||||
#include "x68/select.c"
|
||||
#endif
|
||||
#if MISSING__DTOS18
|
||||
#include "x68/_dtos18.c"
|
||||
#endif
|
||||
#if MISSING_FCONVERT
|
||||
#include "x68/_round.c"
|
||||
#include "x68/fconvert.c"
|
||||
#endif
|
||||
|
||||
/* missing some basic syscalls */
|
||||
int
|
||||
link(const char *src, const char *dst)
|
||||
{
|
||||
return symlink(src, dst);
|
||||
}
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
|
||||
int
|
||||
gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
tv->tv_sec = (long)time((time_t*)0);
|
||||
tv->tv_usec = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
35
process.c
35
process.c
|
@ -1004,11 +1004,8 @@ proc_exec_v(char **argv, const char *prog)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if (defined(MSDOS) && !defined(DJGPP)) || defined(__human68k__) || defined(__EMX__) || defined(OS2)
|
||||
#if (defined(MSDOS) && !defined(DJGPP)) || defined(__EMX__) || defined(OS2)
|
||||
{
|
||||
#if defined(__human68k__)
|
||||
#define COMMAND "command.x"
|
||||
#endif
|
||||
#if defined(__EMX__) || defined(OS2) /* OS/2 emx */
|
||||
#define COMMAND "cmd.exe"
|
||||
#endif
|
||||
|
@ -1040,7 +1037,7 @@ proc_exec_v(char **argv, const char *prog)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* MSDOS or __human68k__ or __EMX__ */
|
||||
#endif /* MSDOS or __EMX__ */
|
||||
before_exec();
|
||||
execv(prog, argv);
|
||||
preserving_errno(after_exec());
|
||||
|
@ -1098,7 +1095,7 @@ rb_proc_exec(const char *str)
|
|||
after_exec();
|
||||
if (status != -1)
|
||||
exit(status);
|
||||
#elif defined(__human68k__) || defined(__CYGWIN32__) || defined(__EMX__)
|
||||
#elif defined(__CYGWIN32__) || defined(__EMX__)
|
||||
char fbuf[MAXPATHLEN];
|
||||
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
|
||||
int status = -1;
|
||||
|
@ -1158,30 +1155,6 @@ proc_spawn_v(char **argv, char *prog)
|
|||
if (!prog)
|
||||
return -1;
|
||||
|
||||
#if defined(__human68k__)
|
||||
if ((extension = strrchr(prog, '.')) != NULL && STRCASECMP(extension, ".bat") == 0) {
|
||||
char **new_argv;
|
||||
char *p;
|
||||
int n;
|
||||
|
||||
for (n = 0; argv[n]; n++)
|
||||
/* no-op */;
|
||||
new_argv = ALLOCA_N(char*, n + 2);
|
||||
for (; n > 0; n--)
|
||||
new_argv[n + 1] = argv[n];
|
||||
new_argv[1] = strcpy(ALLOCA_N(char, strlen(argv[0]) + 1), argv[0]);
|
||||
for (p = new_argv[1]; *p != '\0'; p++)
|
||||
if (*p == '/')
|
||||
*p = '\\';
|
||||
new_argv[0] = COMMAND;
|
||||
argv = new_argv;
|
||||
prog = dln_find_exe_r(argv[0], 0, fbuf, sizeof(fbuf));
|
||||
if (!prog) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
before_exec();
|
||||
status = spawnv(P_WAIT, prog, argv);
|
||||
rb_last_status_set(status == -1 ? 127 : status, 0);
|
||||
|
@ -2694,7 +2667,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(__human68k__) || defined(__DJGPP__)
|
||||
# if defined(__DJGPP__)
|
||||
rb_last_status_set(status == -1 ? 127 : status, 0);
|
||||
# else
|
||||
rb_last_status_set((status & 0xff) << 8, 0);
|
||||
|
|
3
ruby.c
3
ruby.c
|
@ -359,9 +359,6 @@ ruby_init_loadpath(void)
|
|||
#elif defined(DJGPP)
|
||||
extern char *__dos_argv0;
|
||||
strncpy(libpath, __dos_argv0, sizeof(libpath) - 1);
|
||||
#elif defined(__human68k__)
|
||||
extern char **_argv;
|
||||
strncpy(libpath, _argv[0], sizeof(libpath) - 1);
|
||||
#elif defined(__EMX__)
|
||||
_execname(libpath, sizeof(libpath) - 1);
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'test/unit'
|
|||
|
||||
class TestEnv < Test::Unit::TestCase
|
||||
IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM
|
||||
PATH_ENV = /human68k/ =~ RUBY_PLATFORM ? "path" : "PATH"
|
||||
PATH_ENV = "PATH"
|
||||
|
||||
def setup
|
||||
@verbose = $VERBOSE
|
||||
|
|
|
@ -45,7 +45,7 @@ class TestPath < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_dirname
|
||||
if /(bcc|ms)win\d|mingw|cygwin|djgpp|human|emx/ =~ RUBY_PLATFORM
|
||||
if /(bcc|ms)win\d|mingw|cygwin|djgpp|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|human|emx/ =~ RUBY_PLATFORM
|
||||
if /(bcc|ms|cyg)win|mingw|djgpp|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|human|emx/ =~ RUBY_PLATFORM
|
||||
if /(bcc|ms)win\d|mingw|cygwin|djgpp|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|human|emx/ =~ RUBY_PLATFORM
|
||||
if /(bcc|ms|cyg)win|mingw|djgpp|emx/ =~ RUBY_PLATFORM
|
||||
# DOSISH_UNC
|
||||
assert_equal('/', File.basename('//'))
|
||||
assert_equal('/', File.basename('//a'))
|
||||
|
|
250
x68/_dtos18.c
250
x68/_dtos18.c
|
@ -1,250 +0,0 @@
|
|||
/*
|
||||
* PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
|
||||
* --------------------------------------------------------------------
|
||||
* This file is written by the Project C Library Group, and completely
|
||||
* in public domain. You can freely use, copy, modify, and redistribute
|
||||
* the whole contents, without this notice.
|
||||
* --------------------------------------------------------------------
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* System headers */
|
||||
#include <stdlib.h>
|
||||
#include <sys/xstdlib.h>
|
||||
|
||||
/*
|
||||
** 本関数は浮動小数点を倍精度整数に変換してから文字列にするため、精度的には
|
||||
** 倍精度整数に格納できる桁数までしか扱うことができない。したがって最高精度
|
||||
** は18桁である。
|
||||
*/
|
||||
|
||||
/* File scope variables */
|
||||
static double _pos1[32] = {
|
||||
1.0e+17, /* + 0 */
|
||||
1.0e+18, /* + 1 */
|
||||
1.0e+19, /* + 2 */
|
||||
1.0e+20, /* + 3 */
|
||||
1.0e+21, /* + 4 */
|
||||
1.0e+22, /* + 5 */
|
||||
1.0e+23, /* + 6 */
|
||||
1.0e+24, /* + 7 */
|
||||
1.0e+25, /* + 8 */
|
||||
1.0e+26, /* + 9 */
|
||||
1.0e+27, /* +10 */
|
||||
1.0e+28, /* +11 */
|
||||
1.0e+29, /* +12 */
|
||||
1.0e+30, /* +13 */
|
||||
1.0e+31, /* +14 */
|
||||
1.0e+32, /* +15 */
|
||||
1.0e+33, /* +16 */
|
||||
1.0e+34, /* +17 */
|
||||
1.0e+35, /* +18 */
|
||||
1.0e+36, /* +19 */
|
||||
1.0e+37, /* +20 */
|
||||
1.0e+38, /* +21 */
|
||||
1.0e+39, /* +22 */
|
||||
1.0e+40, /* +23 */
|
||||
1.0e+41, /* +24 */
|
||||
1.0e+42, /* +25 */
|
||||
1.0e+43, /* +26 */
|
||||
1.0e+44, /* +27 */
|
||||
1.0e+45, /* +28 */
|
||||
1.0e+46, /* +29 */
|
||||
1.0e+47, /* +30 */
|
||||
1.0e+48, /* +31 */
|
||||
};
|
||||
|
||||
/* File scope variables */
|
||||
static double _neg1[32] = {
|
||||
1.0e+17, /* - 0 */
|
||||
1.0e+16, /* - 1 */
|
||||
1.0e+15, /* - 2 */
|
||||
1.0e+14, /* - 3 */
|
||||
1.0e+13, /* - 4 */
|
||||
1.0e+12, /* - 5 */
|
||||
1.0e+11, /* - 6 */
|
||||
1.0e+10, /* - 7 */
|
||||
1.0e+9, /* - 8 */
|
||||
1.0e+8, /* - 9 */
|
||||
1.0e+7, /* -10 */
|
||||
1.0e+6, /* -11 */
|
||||
1.0e+5, /* -12 */
|
||||
1.0e+4, /* -13 */
|
||||
1.0e+3, /* -14 */
|
||||
1.0e+2, /* -15 */
|
||||
1.0e+1, /* -16 */
|
||||
1.0e+0, /* -17 */
|
||||
1.0e-1, /* -18 */
|
||||
1.0e-2, /* -19 */
|
||||
1.0e-3, /* -20 */
|
||||
1.0e-4, /* -21 */
|
||||
1.0e-5, /* -22 */
|
||||
1.0e-6, /* -23 */
|
||||
1.0e-7, /* -24 */
|
||||
1.0e-8, /* -25 */
|
||||
1.0e-9, /* -26 */
|
||||
1.0e-10, /* -27 */
|
||||
1.0e-11, /* -28 */
|
||||
1.0e-12, /* -29 */
|
||||
1.0e-13, /* -30 */
|
||||
1.0e-14, /* -31 */
|
||||
};
|
||||
|
||||
/* File scope variables */
|
||||
static double _pos2[10] = {
|
||||
1.0e+0, /* 000 */
|
||||
1.0e+32, /* 001 */
|
||||
1.0e+64, /* 010 */
|
||||
1.0e+96, /* 011 */
|
||||
1.0e+128, /* 100 */
|
||||
1.0e+160, /* 101 */
|
||||
1.0e+192, /* 110 */
|
||||
1.0e+224, /* 111 */
|
||||
1.0e+256, /* 1000 */
|
||||
1.0e+288, /* 1001 */
|
||||
};
|
||||
|
||||
/* File scope variables */
|
||||
static double _neg2[10] = {
|
||||
1.0e-0, /* 000 */
|
||||
1.0e-32, /* 001 */
|
||||
1.0e-64, /* 010 */
|
||||
1.0e-96, /* 011 */
|
||||
1.0e-128, /* 100 */
|
||||
1.0e-160, /* 101 */
|
||||
1.0e-192, /* 110 */
|
||||
1.0e-224, /* 111 */
|
||||
1.0e-256, /* 1000 */
|
||||
1.0e-288, /* 1001 */
|
||||
};
|
||||
|
||||
/* File scope functions */
|
||||
static int _cmpd (double x, double y)
|
||||
{
|
||||
unsigned long vx, vy, rc;
|
||||
unsigned long *x_ptr = (unsigned long *) &x;
|
||||
unsigned long *y_ptr = (unsigned long *) &y;
|
||||
|
||||
/* xの指数ビットを取り出す */
|
||||
vx = x_ptr[0] & 0x7FF00000;
|
||||
|
||||
/* yの指数ビットを取り出す */
|
||||
vy = y_ptr[0] & 0x7FF00000;
|
||||
|
||||
/* 指数ビットだけで判断する */
|
||||
if ((rc = vy - vx) != 0)
|
||||
return rc;
|
||||
|
||||
/* xの有効数字の上位ビットを取り出す */
|
||||
vx = x_ptr[0] & 0x000FFFFF;
|
||||
|
||||
/* yの有効数字の上位ビットを取り出す */
|
||||
vy = y_ptr[0] & 0x000FFFFF;
|
||||
|
||||
/* 上位ビットだけで判断する */
|
||||
if ((rc = vy - vx) != 0)
|
||||
return rc;
|
||||
|
||||
/* xの有効数字の下位ビットを取り出す */
|
||||
vx = x_ptr[1];
|
||||
|
||||
/* yの有効数字の下位ビットを取り出す */
|
||||
vy = y_ptr[1];
|
||||
|
||||
/* 最終判断 */
|
||||
return vy - vx;
|
||||
}
|
||||
|
||||
/* Functions */
|
||||
void _dtos18 (double x, int *decpt, int *sign, char *buffer)
|
||||
{
|
||||
short e2;
|
||||
int e, n;
|
||||
|
||||
/* 基数2の指数を求める(バイアスなしの状態) */
|
||||
e2 = (((unsigned short *) &x)[0] & 0x7FF0U) >> 4;
|
||||
|
||||
/* 指数が0の場合は±0.0チェック */
|
||||
if (e2 == 0) {
|
||||
|
||||
unsigned long hi = ((unsigned long *) &x)[0] & 0xFFFFF;
|
||||
unsigned long lo = ((unsigned long *) &x)[1];
|
||||
|
||||
/* 有効数字が全部0かどうか */
|
||||
if (hi == 0 && lo == 0) {
|
||||
|
||||
/* 文字列を設定 */
|
||||
buffer[0] = '0';
|
||||
|
||||
/* NULを設定 */
|
||||
buffer[1] = '\0';
|
||||
|
||||
/* 小数点位置を計算 */
|
||||
*decpt = 1;
|
||||
|
||||
/* 符号を計算 */
|
||||
/* *sign = hi & 0x80000000UL; */
|
||||
*sign = 0;
|
||||
|
||||
/* 確定 */
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* 2の指数にバイアスをかけてから10の指数を概算 (approx. log10(2)) */
|
||||
e = ((int) ((e2 - 1023) * 77)) >> 8;
|
||||
|
||||
/* 指数が正の場合 */
|
||||
if (e >= 0) {
|
||||
|
||||
/* 指数が32より小さい場合はテーブル1から */
|
||||
if (e < 32)
|
||||
x *= _neg1[e];
|
||||
|
||||
/* 指数が32より大きい場合はテーブル1,2から */
|
||||
else
|
||||
x *= _neg1[e & 31] * _neg2[e >> 5];
|
||||
|
||||
}
|
||||
|
||||
/* 指数が負の場合 */
|
||||
else {
|
||||
|
||||
/* 絶対値を計算 */
|
||||
n = -e;
|
||||
|
||||
/* 絶対値が32より小さい場合はテーブル1から */
|
||||
if (n < 32)
|
||||
x *= _pos1[n];
|
||||
|
||||
/* 絶対値が32より大きい場合はテーブル1,2から */
|
||||
else {
|
||||
x *= _pos1[n & 31];
|
||||
x *= _pos2[n >> 5];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* スケーリングしすぎた場合は戻す */
|
||||
if (_cmpd (1.0e+18, x) >= 0) {
|
||||
e++;
|
||||
x *= 1.0e-1;
|
||||
}
|
||||
|
||||
/* スケーリングし足りない場合は追加 */
|
||||
else if (_cmpd (1.0e+17, x) < 0) {
|
||||
e--;
|
||||
x *= 1.0e+1;
|
||||
}
|
||||
|
||||
/* 小数点位置を計算 */
|
||||
*decpt = e + 1;
|
||||
|
||||
/* 符号を計算 */
|
||||
*sign = ((unsigned char *) &x)[0] & 0x80U;
|
||||
|
||||
/* 文字列に変換 */
|
||||
_ulltoa ((unsigned long long) x, buffer);
|
||||
}
|
45
x68/_round.c
45
x68/_round.c
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
|
||||
* --------------------------------------------------------------------
|
||||
* This file is written by the Project C Library Group, and completely
|
||||
* in public domain. You can freely use, copy, modify, and redistribute
|
||||
* the whole contents, without this notice.
|
||||
* --------------------------------------------------------------------
|
||||
* $Id$
|
||||
*/
|
||||
/* changed 1997.2.2 by K.Okabe */
|
||||
|
||||
/* System headers */
|
||||
#include <stdlib.h>
|
||||
#include <sys/xstdlib.h>
|
||||
|
||||
/* Functions */
|
||||
int _round (char *top, char *cur, int undig)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
/* 最後が5未満なら丸めは必要ない */
|
||||
if (undig < '5')
|
||||
return 0;
|
||||
|
||||
/* ポインタ設定 */
|
||||
ptr = cur - 1;
|
||||
|
||||
/* 先頭まで戻りながら丸め処理 */
|
||||
while (ptr >= top) {
|
||||
|
||||
/* 繰り上がらなければそれで終わり */
|
||||
if (++(*ptr) <= '9')
|
||||
return 0;
|
||||
|
||||
/* その桁を0に戻す */
|
||||
*ptr-- = '0';
|
||||
|
||||
}
|
||||
|
||||
/* 先頭を1にする */
|
||||
*++ptr = '1';
|
||||
|
||||
/* 繰り上がりをしらせる */
|
||||
return 1;
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
|
||||
* --------------------------------------------------------------------
|
||||
* This file is written by the Project C Library Group, and completely
|
||||
* in public domain. You can freely use, copy, modify, and redistribute
|
||||
* the whole contents, without this notice.
|
||||
* --------------------------------------------------------------------
|
||||
* $Id$
|
||||
*/
|
||||
/* changed 1997.2.3 by K.Okabe */
|
||||
|
||||
/* System headers */
|
||||
#include <stdlib.h>
|
||||
#include <sys/xstdlib.h>
|
||||
|
||||
/* Functions */
|
||||
char *fconvert (double x, int ndigit, int *decpt, int *sign, char *buffer)
|
||||
{
|
||||
int pos, n;
|
||||
char *src, *dst;
|
||||
char string[24];
|
||||
int figup;
|
||||
|
||||
/* 18桁の文字列に変換 */
|
||||
_dtos18 (x, decpt, sign, string);
|
||||
|
||||
/* コピー元アドレスを設定 */
|
||||
src = string;
|
||||
|
||||
/* コピー先アドレスを設定 */
|
||||
dst = buffer;
|
||||
|
||||
/* 小数点位置を得る */
|
||||
pos = *decpt;
|
||||
|
||||
/* 小数点位置が負なら */
|
||||
if (pos < 0) {
|
||||
|
||||
/* 埋める桁数を計算 */
|
||||
n = min (-pos, ndigit);
|
||||
|
||||
/* 先頭を0で埋める */
|
||||
while (n-- > 0)
|
||||
*dst++ = '0';
|
||||
|
||||
/* 小数点位置は0になる */
|
||||
*decpt = 0;
|
||||
|
||||
}
|
||||
|
||||
/* 残りのコピー桁数 */
|
||||
n = ndigit + pos;
|
||||
|
||||
/* 格納先にコピー */
|
||||
while (n-- > 0) {
|
||||
|
||||
/* 足りない部分は0で埋める */
|
||||
if (*src == '\0') {
|
||||
while (n-- >= 0)
|
||||
*dst++ = '0';
|
||||
break;
|
||||
}
|
||||
|
||||
/* 変換文字列からコピー */
|
||||
*dst++ = *src++;
|
||||
|
||||
}
|
||||
|
||||
/* 丸める */
|
||||
*decpt += (figup = _round (buffer, dst, *src));
|
||||
|
||||
/* 繰り上がりがあれば末尾に0を追加する */
|
||||
if (figup)
|
||||
*dst++ = '0';
|
||||
|
||||
/* 終端に NUL を打つ */
|
||||
*dst = '\0';
|
||||
|
||||
/* アドレスを返す */
|
||||
return buffer;
|
||||
}
|
167
x68/select.c
167
x68/select.c
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
* PROJECT C Library, X68000 PROGRAMMING INTERFACE DEFINITION
|
||||
* --------------------------------------------------------------------
|
||||
* This file is written by the Project C Library Group, and completely
|
||||
* in public domain. You can freely use, copy, modify, and redistribute
|
||||
* the whole contents, without this notice.
|
||||
* --------------------------------------------------------------------
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __IOCS_INLINE__
|
||||
#define __IOCS_INLINE__
|
||||
#define __DOS_INLINE__
|
||||
#define __DOS_DOSCALL__
|
||||
#endif
|
||||
|
||||
/* System headers */
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/dos.h>
|
||||
#include <sys/iocs.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#if 0
|
||||
#include <sys/select.h>
|
||||
#include <sys/xsocket.h>
|
||||
#endif
|
||||
#include <sys/xunistd.h>
|
||||
|
||||
/* Macros */
|
||||
#define XFD_ISSET(fd,fds) ((fds) && FD_ISSET ((fd), (fds)))
|
||||
#define isreadable(mode) ((mode) == O_RDONLY || (mode) == O_RDWR)
|
||||
#define iswritable(mode) ((mode) == O_WRONLY || (mode) == O_RDWR)
|
||||
#ifndef _POSIX_FD_SETSIZE
|
||||
#define _POSIX_FD_SETSIZE OPEN_MAX
|
||||
#endif
|
||||
|
||||
/* Functions */
|
||||
int
|
||||
select (int fds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *timeout)
|
||||
{
|
||||
fd_set oread, owrite, oexcept;
|
||||
int ticks, start;
|
||||
int nfds;
|
||||
|
||||
if (fds > _POSIX_FD_SETSIZE)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
FD_ZERO (&oread);
|
||||
FD_ZERO (&owrite);
|
||||
FD_ZERO (&oexcept);
|
||||
|
||||
nfds = 0;
|
||||
ticks = -1;
|
||||
|
||||
if (timeout)
|
||||
{
|
||||
ticks = timeout->tv_sec * 100 + timeout->tv_usec / 10000;
|
||||
if (ticks < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
start = _iocs_ontime ();
|
||||
for (;;)
|
||||
{
|
||||
{
|
||||
int fd;
|
||||
|
||||
for (fd = 0; fd < fds; fd++)
|
||||
{
|
||||
int accmode;
|
||||
|
||||
if (_fddb[fd].inuse == _FD_NOTUSED)
|
||||
continue;
|
||||
|
||||
accmode = _fddb[fd].oflag & O_ACCMODE;
|
||||
|
||||
if (isatty (fd))
|
||||
{
|
||||
if (XFD_ISSET (fd, rfds) && isreadable (accmode) && _dos_k_keysns ())
|
||||
{
|
||||
FD_SET (fd, &oread);
|
||||
nfds++;
|
||||
}
|
||||
|
||||
if (XFD_ISSET (fd, wfds) && iswritable (accmode))
|
||||
{
|
||||
FD_SET (fd, &owrite);
|
||||
nfds++;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else if (_fddb[fd].sockno >= 0)
|
||||
{
|
||||
if (XFD_ISSET (fd, rfds) && _socklen (_fddb[fd].sockno, 0))
|
||||
{
|
||||
FD_SET (fd, &oread);
|
||||
nfds++;
|
||||
}
|
||||
|
||||
if (XFD_ISSET (fd, wfds) /* && _socklen (_fddb[fd].sockno, 1) == 0 */)
|
||||
{
|
||||
FD_SET (fd, &owrite);
|
||||
nfds++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if (XFD_ISSET (fd, rfds) && isreadable (accmode) && _dos_ioctrlis (fd))
|
||||
{
|
||||
FD_SET (fd, &oread);
|
||||
nfds++;
|
||||
}
|
||||
|
||||
if (XFD_ISSET (fd, wfds) && iswritable (accmode) && _dos_ioctrlos (fd))
|
||||
{
|
||||
FD_SET (fd, &owrite);
|
||||
nfds++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int rest;
|
||||
|
||||
if ((rest = (_iocs_ontime () - start) % 8640000) < 0)
|
||||
rest += 8640000;
|
||||
|
||||
if (nfds != 0)
|
||||
{
|
||||
if (ticks >= 0)
|
||||
{
|
||||
int left;
|
||||
|
||||
if ((left = ticks - rest) < 0)
|
||||
left = 0;
|
||||
|
||||
timeout->tv_sec = left / 100;
|
||||
timeout->tv_usec = (left % 100) * 10000;
|
||||
}
|
||||
|
||||
if (rfds)
|
||||
*rfds = oread;
|
||||
if (wfds)
|
||||
*wfds = owrite;
|
||||
if (efds)
|
||||
*efds = oexcept;
|
||||
|
||||
return nfds;
|
||||
}
|
||||
|
||||
if (ticks >= 0 && rest > ticks)
|
||||
return 0;
|
||||
}
|
||||
|
||||
_dos_change_pr ();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue