console.c: dead code
* ext/io/console/console.c: remove dead code for old versions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
467830e867
commit
ee4ca1887a
@ -3,17 +3,7 @@
|
|||||||
* console IO module
|
* console IO module
|
||||||
*/
|
*/
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#ifdef HAVE_RUBY_IO_H
|
|
||||||
#include "ruby/io.h"
|
#include "ruby/io.h"
|
||||||
#else
|
|
||||||
#include "rubyio.h"
|
|
||||||
/* assumes rb_io_t doesn't have pathv */
|
|
||||||
#include "util.h" /* for ruby_strdup() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_RB_IO_T
|
|
||||||
typedef OpenFile rb_io_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -25,10 +15,6 @@ typedef OpenFile rb_io_t;
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RB_TYPE_P
|
|
||||||
#define RB_TYPE_P(obj, type) (TYPE(obj) == type)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined HAVE_TERMIOS_H
|
#if defined HAVE_TERMIOS_H
|
||||||
# include <termios.h>
|
# include <termios.h>
|
||||||
typedef struct termios conmode;
|
typedef struct termios conmode;
|
||||||
@ -91,10 +77,6 @@ getattr(int fd, conmode *t)
|
|||||||
#define SET_LAST_ERROR (0)
|
#define SET_LAST_ERROR (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InitVM
|
|
||||||
#define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static ID id_getc, id_console;
|
static ID id_getc, id_console;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -107,23 +89,7 @@ rawmode_opt(int argc, VALUE *argv, rawmode_arg_t *opts)
|
|||||||
{
|
{
|
||||||
rawmode_arg_t *optp = NULL;
|
rawmode_arg_t *optp = NULL;
|
||||||
VALUE vopts;
|
VALUE vopts;
|
||||||
#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
|
|
||||||
rb_scan_args(argc, argv, "0:", &vopts);
|
rb_scan_args(argc, argv, "0:", &vopts);
|
||||||
#else
|
|
||||||
vopts = Qnil;
|
|
||||||
if (argc > 0) {
|
|
||||||
vopts = argv[--argc];
|
|
||||||
if (!NIL_P(vopts)) {
|
|
||||||
# ifdef HAVE_RB_CHECK_HASH_TYPE
|
|
||||||
vopts = rb_check_hash_type(vopts);
|
|
||||||
if (NIL_P(vopts)) ++argc;
|
|
||||||
# else
|
|
||||||
Check_Type(vopts, T_HASH);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rb_scan_args(argc, argv, "0");
|
|
||||||
#endif
|
|
||||||
if (!NIL_P(vopts)) {
|
if (!NIL_P(vopts)) {
|
||||||
VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
|
VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
|
||||||
VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
|
VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
|
||||||
@ -232,15 +198,8 @@ set_ttymode(int fd, conmode *t, void (*setter)(conmode *, void *), void *arg)
|
|||||||
return setattr(fd, &r);
|
return setattr(fd, &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GetReadFile
|
|
||||||
#define GetReadFD(fptr) fileno(GetReadFile(fptr))
|
|
||||||
#else
|
|
||||||
#define GetReadFD(fptr) ((fptr)->fd)
|
#define GetReadFD(fptr) ((fptr)->fd)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GetWriteFile
|
|
||||||
#define GetWriteFD(fptr) fileno(GetWriteFile(fptr))
|
|
||||||
#else
|
|
||||||
static inline int
|
static inline int
|
||||||
get_write_fd(const rb_io_t *fptr)
|
get_write_fd(const rb_io_t *fptr)
|
||||||
{
|
{
|
||||||
@ -251,7 +210,6 @@ get_write_fd(const rb_io_t *fptr)
|
|||||||
return ofptr->fd;
|
return ofptr->fd;
|
||||||
}
|
}
|
||||||
#define GetWriteFD(fptr) get_write_fd(fptr)
|
#define GetWriteFD(fptr) get_write_fd(fptr)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FD_PER_IO 2
|
#define FD_PER_IO 2
|
||||||
|
|
||||||
@ -729,20 +687,11 @@ console_dev(VALUE klass)
|
|||||||
args[0] = INT2NUM(fd);
|
args[0] = INT2NUM(fd);
|
||||||
con = rb_class_new_instance(2, args, klass);
|
con = rb_class_new_instance(2, args, klass);
|
||||||
GetOpenFile(con, fptr);
|
GetOpenFile(con, fptr);
|
||||||
#ifdef HAVE_RUBY_IO_H
|
|
||||||
fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE));
|
fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE));
|
||||||
#else
|
|
||||||
fptr->path = ruby_strdup(CONSOLE_DEVICE);
|
|
||||||
#endif
|
|
||||||
#ifdef CONSOLE_DEVICE_FOR_WRITING
|
#ifdef CONSOLE_DEVICE_FOR_WRITING
|
||||||
GetOpenFile(out, ofptr);
|
GetOpenFile(out, ofptr);
|
||||||
# ifdef HAVE_RB_IO_GET_WRITE_IO
|
|
||||||
ofptr->pathv = fptr->pathv;
|
ofptr->pathv = fptr->pathv;
|
||||||
fptr->tied_io_for_writing = out;
|
fptr->tied_io_for_writing = out;
|
||||||
# else
|
|
||||||
fptr->f2 = ofptr->f;
|
|
||||||
ofptr->f = 0;
|
|
||||||
# endif
|
|
||||||
ofptr->mode |= FMODE_SYNC;
|
ofptr->mode |= FMODE_SYNC;
|
||||||
#endif
|
#endif
|
||||||
fptr->mode |= FMODE_SYNC;
|
fptr->mode |= FMODE_SYNC;
|
||||||
|
@ -12,15 +12,10 @@ when have_header(hdr = "sgtty.h")
|
|||||||
else
|
else
|
||||||
ok = false
|
ok = false
|
||||||
end
|
end
|
||||||
ok &&= enable_config("io-console-force-compatible-with-1.8") ||
|
|
||||||
macro_defined?("HAVE_RUBY_IO_H", cpp_include("ruby.h"))
|
|
||||||
if ok
|
if ok
|
||||||
have_header("sys/ioctl.h")
|
have_header("sys/ioctl.h")
|
||||||
have_func("rb_check_hash_type", "ruby.h")
|
have_func("rb_check_hash_type", "ruby.h")
|
||||||
have_func("rb_io_get_write_io", "ruby/io.h")
|
have_func("rb_io_get_write_io", "ruby/io.h")
|
||||||
have_func("rb_cloexec_open", "ruby/io.h")
|
have_func("rb_cloexec_open", "ruby/io.h")
|
||||||
if enable_config("io-console-rb_scan_args-optional-hash", true)
|
|
||||||
$defs << "-DHAVE_RB_SCAN_ARGS_OPTIONAL_HASH=1"
|
|
||||||
end
|
|
||||||
create_makefile("io/console")
|
create_makefile("io/console")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user