* winsup.h (IMPLEMENT_STATUS_FLAG): New macro to define status flag
accessor methods unambiguously. * fhandler.h: Use IMPLEMENT_STATUS_FLAG throughout where possible. * fhandler_termios.cc (fhandler_termios::tcinit): Call corrected accessor for initialized status flag. * mtinfo.h (class mtinfo_drive): Use IMPLEMENT_STATUS_FLAG throughout. * path.cc (fs_info::update): Remove duplicate call to flags(). * path.h (struct fs_info): Use IMPLEMENT_STATUS_FLAG where possible. (path_conv::is_auto_device): Fix spacing. * tty.h (class tty_min): Use IMPLEMENT_STATUS_FLAG throughout.
This commit is contained in:
parent
f006625d04
commit
825b388289
|
@ -1,3 +1,16 @@
|
|||
2004-04-13 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* winsup.h (IMPLEMENT_STATUS_FLAG): New macro to define status flag
|
||||
accessor methods unambiguously.
|
||||
* fhandler.h: Use IMPLEMENT_STATUS_FLAG throughout where possible.
|
||||
* fhandler_termios.cc (fhandler_termios::tcinit): Call corrected
|
||||
accessor for initialized status flag.
|
||||
* mtinfo.h (class mtinfo_drive): Use IMPLEMENT_STATUS_FLAG throughout.
|
||||
* path.cc (fs_info::update): Remove duplicate call to flags().
|
||||
* path.h (struct fs_info): Use IMPLEMENT_STATUS_FLAG where possible.
|
||||
(path_conv::is_auto_device): Fix spacing.
|
||||
* tty.h (class tty_min): Use IMPLEMENT_STATUS_FLAG throughout.
|
||||
|
||||
2004-04-12 Christopher Faylor <cgf@alum.bu.edu>
|
||||
|
||||
* thread.cc (pthread::thread_init_wrapper): Wait later to get more
|
||||
|
|
|
@ -154,9 +154,6 @@ class fhandler_base
|
|||
bool wbinary () const { return status.wbinset ? status.wbinary : 1; }
|
||||
bool rbinary () const { return status.rbinset ? status.rbinary : 1; }
|
||||
|
||||
bool wbinset () const { return status.wbinset; }
|
||||
bool rbinset () const { return status.rbinset; }
|
||||
|
||||
void wbinary (bool b) {status.wbinary = b; status.wbinset = 1;}
|
||||
void rbinary (bool b) {status.rbinary = b; status.rbinset = 1;}
|
||||
|
||||
|
@ -168,26 +165,15 @@ class fhandler_base
|
|||
? O_BINARY : O_TEXT));
|
||||
}
|
||||
|
||||
bool nohandle () const { return status.nohandle; }
|
||||
void nohandle (bool x) { status.nohandle = x; }
|
||||
|
||||
bool uninterruptible_io () const { return status.uninterruptible_io; }
|
||||
void uninterruptible_io (bool b) { status.uninterruptible_io = b; }
|
||||
|
||||
bool append_mode () const { return status.append_mode; }
|
||||
void append_mode (bool b) { status.append_mode = b; }
|
||||
|
||||
bool did_lseek () const { return status.did_lseek; }
|
||||
void did_lseek (bool b) { status.did_lseek = b; }
|
||||
|
||||
query_state query_open () const { return (query_state) status.query_open; }
|
||||
void query_open (query_state val) { status.query_open = val; }
|
||||
|
||||
bool close_on_exec () const { return status.close_on_exec; }
|
||||
void close_on_exec (bool b) { status.close_on_exec = b; }
|
||||
|
||||
bool need_fork_fixup () const { return status.need_fork_fixup; }
|
||||
void need_fork_fixup (bool b) { status.need_fork_fixup = b; }
|
||||
IMPLEMENT_STATUS_FLAG (bool, wbinset)
|
||||
IMPLEMENT_STATUS_FLAG (bool, rbinset)
|
||||
IMPLEMENT_STATUS_FLAG (bool, nohandle)
|
||||
IMPLEMENT_STATUS_FLAG (bool, uninterruptible_io)
|
||||
IMPLEMENT_STATUS_FLAG (bool, append_mode)
|
||||
IMPLEMENT_STATUS_FLAG (bool, did_lseek)
|
||||
IMPLEMENT_STATUS_FLAG (query_state, query_open)
|
||||
IMPLEMENT_STATUS_FLAG (bool, close_on_exec)
|
||||
IMPLEMENT_STATUS_FLAG (bool, need_fork_fixup)
|
||||
|
||||
int get_default_fmode (int flags);
|
||||
|
||||
|
@ -362,19 +348,10 @@ class fhandler_socket: public fhandler_base
|
|||
int get_socket () { return (int) get_handle(); }
|
||||
fhandler_socket *is_socket () { return this; }
|
||||
|
||||
bool async_io () const { return status.async_io; }
|
||||
void async_io (bool b) { status.async_io = b; }
|
||||
|
||||
bool saw_shutdown_read () const { return status.saw_shutdown_read; }
|
||||
bool saw_shutdown_write () const { return status.saw_shutdown_write; }
|
||||
|
||||
void saw_shutdown_read (bool b) { status.saw_shutdown_read = b;}
|
||||
void saw_shutdown_write (bool b) { status.saw_shutdown_write = b;}
|
||||
|
||||
conn_state connect_state () const
|
||||
{ return (conn_state) status.connect_state; }
|
||||
void connect_state (conn_state newstate)
|
||||
{ status.connect_state = newstate; }
|
||||
IMPLEMENT_STATUS_FLAG (bool, async_io)
|
||||
IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read)
|
||||
IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write)
|
||||
IMPLEMENT_STATUS_FLAG (conn_state, connect_state)
|
||||
|
||||
int bind (const struct sockaddr *name, int namelen);
|
||||
int connect (const struct sockaddr *name, int namelen);
|
||||
|
@ -496,17 +473,10 @@ class fhandler_dev_raw: public fhandler_base
|
|||
{}
|
||||
} status;
|
||||
|
||||
bool eom_detected () const { return status.eom_detected; }
|
||||
void eom_detected (bool b) { status.eom_detected = b; }
|
||||
|
||||
bool eof_detected () const { return status.eof_detected; }
|
||||
void eof_detected (bool b) { status.eof_detected = b; }
|
||||
|
||||
bool lastblk_to_read () const { return status.lastblk_to_read; }
|
||||
void lastblk_to_read (bool b) { status.lastblk_to_read = b; }
|
||||
|
||||
bool is_writing () const { return status.is_writing; }
|
||||
void is_writing (bool b) { status.is_writing = b; }
|
||||
IMPLEMENT_STATUS_FLAG (bool, eom_detected)
|
||||
IMPLEMENT_STATUS_FLAG (bool, eof_detected)
|
||||
IMPLEMENT_STATUS_FLAG (bool, lastblk_to_read)
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_writing)
|
||||
|
||||
virtual BOOL write_file (const void *buf, DWORD to_write,
|
||||
DWORD *written, int *err);
|
||||
|
|
|
@ -58,7 +58,7 @@ fhandler_termios::tcinit (tty_min *this_tc, bool force)
|
|||
|
||||
tc->ti.c_ispeed = tc->ti.c_ospeed = B38400;
|
||||
tc->pgid = myself->pgid;
|
||||
tc->initialize ();
|
||||
tc->initialized (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,18 +113,13 @@ public:
|
|||
int ioctl (HANDLE mt, unsigned int cmd, void *buf);
|
||||
int set_pos (HANDLE mt, int mode, long count, bool sfm_func);
|
||||
|
||||
bool buffer_writes () const { return status.buffer_writes; }
|
||||
void buffer_writes (bool b) { status.buffer_writes = b; }
|
||||
bool two_fm () const { return status.two_fm; }
|
||||
void two_fm (bool b) { status.two_fm = b; }
|
||||
bool fast_eom () const { return status.fast_eom; }
|
||||
void fast_eom (bool b) { status.fast_eom = b; }
|
||||
bool auto_lock () const { return status.auto_lock; }
|
||||
void auto_lock (bool b) { status.auto_lock = b; }
|
||||
bool sysv () const { return status.sysv; }
|
||||
void sysv (bool b) { status.sysv = b; }
|
||||
bool nowait () const { return status.nowait; }
|
||||
void nowait (bool b) { status.nowait = b; }
|
||||
IMPLEMENT_STATUS_FLAG (bool, buffer_writes)
|
||||
IMPLEMENT_STATUS_FLAG (bool, two_fm)
|
||||
IMPLEMENT_STATUS_FLAG (bool, fast_eom)
|
||||
IMPLEMENT_STATUS_FLAG (bool, auto_lock)
|
||||
IMPLEMENT_STATUS_FLAG (bool, sysv)
|
||||
IMPLEMENT_STATUS_FLAG (bool, nowait)
|
||||
|
||||
PTAPE_GET_DRIVE_PARAMETERS dp (void) { return &_dp; }
|
||||
PTAPE_GET_MEDIA_PARAMETERS mp (void) { return &_mp; }
|
||||
mtinfo_part *part (int num) { return &_part[num]; }
|
||||
|
|
|
@ -397,7 +397,6 @@ fs_info::update (const char *win32_path)
|
|||
&status.flags, fsname, sizeof (fsname)))
|
||||
{
|
||||
debug_printf ("Cannot get volume information (%s), %E", root_dir);
|
||||
flags () = 0;
|
||||
has_buggy_open (false);
|
||||
has_ea (false);
|
||||
flags () = serial () = 0;
|
||||
|
|
|
@ -98,18 +98,13 @@ struct fs_info
|
|||
}
|
||||
inline DWORD& flags () {return status.flags;};
|
||||
inline DWORD& serial () {return status.serial;};
|
||||
void is_remote_drive (bool b) { status.is_remote_drive = b; }
|
||||
bool is_remote_drive () const { return status.is_remote_drive; }
|
||||
void has_buggy_open (bool b) { status.has_buggy_open = b; }
|
||||
bool has_buggy_open () const { return status.has_buggy_open; }
|
||||
void is_fat (bool b) { status.is_fat = b; }
|
||||
bool is_fat () const { return status.is_fat; }
|
||||
void has_ea (bool b) { status.has_ea = b; }
|
||||
int has_ea () const { return status.has_ea ? PC_CHECK_EA : 0; }
|
||||
void has_acls (bool b) { status.has_acls = b; }
|
||||
bool has_acls () const { return status.has_acls; }
|
||||
void drive_type (DWORD d) { status.is_remote_drive = d; }
|
||||
DWORD drive_type () const { return status.drive_type; }
|
||||
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_remote_drive)
|
||||
IMPLEMENT_STATUS_FLAG (bool, has_buggy_open)
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_fat)
|
||||
IMPLEMENT_STATUS_FLAG (bool, has_ea)
|
||||
IMPLEMENT_STATUS_FLAG (bool, has_acls)
|
||||
IMPLEMENT_STATUS_FLAG (DWORD, drive_type)
|
||||
|
||||
bool update (const char *);
|
||||
};
|
||||
|
@ -147,7 +142,7 @@ class path_conv
|
|||
int isdevice () const {return dev.devn && dev.devn != FH_FS && dev.devn != FH_FIFO;}
|
||||
int isfifo () const {return dev == FH_FIFO;}
|
||||
int isspecial () const {return dev.devn && dev.devn != FH_FS;}
|
||||
int is_auto_device () const {return isdevice () && !is_fs_special ();}
|
||||
int is_auto_device () const {return isdevice () && !is_fs_special ();}
|
||||
int is_fs_special () const {return isspecial () && dev.isfs ();}
|
||||
int issocket () const {return path_flags & PATH_SOCKET;}
|
||||
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
|
||||
|
|
|
@ -49,10 +49,8 @@ public:
|
|||
int ntty;
|
||||
DWORD last_ctrl_c; // tick count of last ctrl-c
|
||||
|
||||
bool initialized () const { return status.initialized; }
|
||||
void initialize () { status.initialized = 1; }
|
||||
bool rstcons () const { return status.rstcons; }
|
||||
void rstcons (bool b) { status.rstcons = b; }
|
||||
IMPLEMENT_STATUS_FLAG (bool, initialized)
|
||||
IMPLEMENT_STATUS_FLAG (bool, rstcons)
|
||||
|
||||
tty_min (int t = -1, pid_t s = -1) : sid (s), ntty (t) {}
|
||||
void setntty (int n) {ntty = n;}
|
||||
|
|
|
@ -138,6 +138,11 @@ extern HANDLE title_mutex;
|
|||
|
||||
/**************************** Convenience ******************************/
|
||||
|
||||
/* Used to define status flag accessor methods */
|
||||
#define IMPLEMENT_STATUS_FLAG(type,flag) \
|
||||
void flag (type val) { status.flag = (val); } \
|
||||
type flag () const { return (type) status.flag; }
|
||||
|
||||
/* Used when treating / and \ as equivalent. */
|
||||
#define isdirsep(ch) \
|
||||
({ \
|
||||
|
|
Loading…
Reference in New Issue