diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-18 03:10:50 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-18 03:10:50 +0000 |
commit | ba04b6a76c30dc9a046cf92dc0cf96b2284e697b (patch) | |
tree | 8ee9a26f9cfe479f5c87fe70717f7ea5251b8dec | |
parent | 6002fa11c662edd63704ea9f20c69ffd8748f48f (diff) | |
download | ATCD-ba04b6a76c30dc9a046cf92dc0cf96b2284e697b.tar.gz |
ChangeLogTag:Wed May 17 20:02:25 2000 Darrell Brunsch <brunsch@uci.edu>
-rw-r--r-- | ChangeLog | 42 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 42 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 42 | ||||
-rw-r--r-- | ace/Dirent.h | 2 | ||||
-rw-r--r-- | ace/Dirent.i | 20 | ||||
-rw-r--r-- | ace/Makefile | 1 | ||||
-rw-r--r-- | ace/Makefile.am | 1 | ||||
-rw-r--r-- | ace/Makefile.bor | 1 | ||||
-rw-r--r-- | ace/OS.h | 231 | ||||
-rw-r--r-- | ace/OS.i | 239 | ||||
-rw-r--r-- | ace/OS_Dirent.cpp | 60 | ||||
-rw-r--r-- | ace/OS_Dirent.h | 103 | ||||
-rw-r--r-- | ace/OS_Dirent.inl | 195 | ||||
-rw-r--r-- | ace/ace-dll.icc | 2 | ||||
-rw-r--r-- | ace/ace-lib.icc | 1 | ||||
-rwxr-xr-x | ace/ace.icc | 1 | ||||
-rw-r--r-- | ace/ace_dll.dsp | 29 | ||||
-rw-r--r-- | ace/ace_dll_ce.dsp | 6 | ||||
-rw-r--r-- | ace/ace_lib.dsp | 29 | ||||
-rw-r--r-- | ace/config-all.h | 198 |
20 files changed, 769 insertions, 476 deletions
diff --git a/ChangeLog b/ChangeLog index e68504ade56..c47818d7b63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +Wed May 17 20:02:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/Dirent.h: + * ace/Dirent.i: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/OS.h: + * ace/OS.i: + * ace/OS_Dirent.cpp: (added) + * ace/OS_Dirent.h: (added) + * ace/OS_Dirent.inl: (added) + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/ace.icc: + * ace/ace_dll.dsp: + * ace/ace_dll_ce.dsp: + * ace/ace_lib.dsp: + * ace/config-all.h: + + Ladies and Gentlemen, you are witnessing the beginning of the + end of ACE_OS as we know it. That's right, I am taking on the + bazillion lines of stuff in OS.*, and separating it into bite + size pieces. + + So this is the first step, kind of a test of concept. I took + the dirent methods and separated them out into a separate class + (in its own files), ACE_OS_Dirent. So now if one only wishes + to use the dirent static methods, one only has to include + OS_Dirent.h. + + But what about all the code that thinks it is still in ACE_OS? + Glad you asked, since ACE_OS now inherits from ACE_OS_Dirent, + meaning using ACE_OS::opendir () and family still works. + + So eventually everything will be moved out, and ACE_OS will + just be a shell of a class that inherits from the ACE_OS_* + classes (with maybe an ACE_ONLY_LATEST_AND_GREATEST thrown + in here and there). + + Let's just hope that this works.... + Wed May 17 19:01:52 2000 Carlos O'Ryan <coryan@uci.edu> * bin/auto_compile: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index e68504ade56..c47818d7b63 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,45 @@ +Wed May 17 20:02:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/Dirent.h: + * ace/Dirent.i: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/OS.h: + * ace/OS.i: + * ace/OS_Dirent.cpp: (added) + * ace/OS_Dirent.h: (added) + * ace/OS_Dirent.inl: (added) + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/ace.icc: + * ace/ace_dll.dsp: + * ace/ace_dll_ce.dsp: + * ace/ace_lib.dsp: + * ace/config-all.h: + + Ladies and Gentlemen, you are witnessing the beginning of the + end of ACE_OS as we know it. That's right, I am taking on the + bazillion lines of stuff in OS.*, and separating it into bite + size pieces. + + So this is the first step, kind of a test of concept. I took + the dirent methods and separated them out into a separate class + (in its own files), ACE_OS_Dirent. So now if one only wishes + to use the dirent static methods, one only has to include + OS_Dirent.h. + + But what about all the code that thinks it is still in ACE_OS? + Glad you asked, since ACE_OS now inherits from ACE_OS_Dirent, + meaning using ACE_OS::opendir () and family still works. + + So eventually everything will be moved out, and ACE_OS will + just be a shell of a class that inherits from the ACE_OS_* + classes (with maybe an ACE_ONLY_LATEST_AND_GREATEST thrown + in here and there). + + Let's just hope that this works.... + Wed May 17 19:01:52 2000 Carlos O'Ryan <coryan@uci.edu> * bin/auto_compile: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index e68504ade56..c47818d7b63 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,45 @@ +Wed May 17 20:02:25 2000 Darrell Brunsch <brunsch@uci.edu> + + * ace/Dirent.h: + * ace/Dirent.i: + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/OS.h: + * ace/OS.i: + * ace/OS_Dirent.cpp: (added) + * ace/OS_Dirent.h: (added) + * ace/OS_Dirent.inl: (added) + * ace/ace-dll.icc: + * ace/ace-lib.icc: + * ace/ace.icc: + * ace/ace_dll.dsp: + * ace/ace_dll_ce.dsp: + * ace/ace_lib.dsp: + * ace/config-all.h: + + Ladies and Gentlemen, you are witnessing the beginning of the + end of ACE_OS as we know it. That's right, I am taking on the + bazillion lines of stuff in OS.*, and separating it into bite + size pieces. + + So this is the first step, kind of a test of concept. I took + the dirent methods and separated them out into a separate class + (in its own files), ACE_OS_Dirent. So now if one only wishes + to use the dirent static methods, one only has to include + OS_Dirent.h. + + But what about all the code that thinks it is still in ACE_OS? + Glad you asked, since ACE_OS now inherits from ACE_OS_Dirent, + meaning using ACE_OS::opendir () and family still works. + + So eventually everything will be moved out, and ACE_OS will + just be a shell of a class that inherits from the ACE_OS_* + classes (with maybe an ACE_ONLY_LATEST_AND_GREATEST thrown + in here and there). + + Let's just hope that this works.... + Wed May 17 19:01:52 2000 Carlos O'Ryan <coryan@uci.edu> * bin/auto_compile: diff --git a/ace/Dirent.h b/ace/Dirent.h index 651d475c88e..d026c44e7db 100644 --- a/ace/Dirent.h +++ b/ace/Dirent.h @@ -21,7 +21,7 @@ #define ACE_DIRENT_H #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/OS_Dirent.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/ace/Dirent.i b/ace/Dirent.i index a42fcbd3c45..e4ae8960993 100644 --- a/ace/Dirent.i +++ b/ace/Dirent.i @@ -1,6 +1,8 @@ /* -*- C++ -*- */ // $Id$ +#include "ace/Log_Msg.h" + ACE_INLINE int ACE_Dirent::open (const ACE_TCHAR *dirname) { @@ -9,11 +11,11 @@ ACE_Dirent::open (const ACE_TCHAR *dirname) if (this->dirp_ != 0) { - ACE_OS::closedir (this->dirp_); + ACE_OS_Dirent::closedir (this->dirp_); this->dirp_ = 0; } - this->dirp_ = ACE_OS::opendir (dirname); + this->dirp_ = ACE_OS_Dirent::opendir (dirname); if (this->dirp_ == 0) return -1; @@ -41,13 +43,13 @@ ACE_INLINE ACE_Dirent::~ACE_Dirent (void) { if (this->dirp_ != 0) - ACE_OS::closedir (this->dirp_); + ACE_OS_Dirent::closedir (this->dirp_); } ACE_INLINE dirent * ACE_Dirent::read (void) { - return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; + return this->dirp_ ? ACE_OS_Dirent::readdir (this->dirp_) : 0; } ACE_INLINE int @@ -55,7 +57,7 @@ ACE_Dirent::read (struct dirent *entry, struct dirent **result) { return this->dirp_ - ? ACE_OS::readdir_r (this->dirp_, entry, result) + ? ACE_OS_Dirent::readdir_r (this->dirp_, entry, result) : 0; } @@ -64,7 +66,7 @@ ACE_Dirent::close (void) { if (this->dirp_ != 0) { - ACE_OS::closedir (this->dirp_); + ACE_OS_Dirent::closedir (this->dirp_); // Prevent double closure this->dirp_ = 0; @@ -75,19 +77,19 @@ ACE_INLINE void ACE_Dirent::rewind (void) { if (this->dirp_) - ACE_OS::rewinddir (this->dirp_); + ACE_OS_Dirent::rewinddir (this->dirp_); } ACE_INLINE void ACE_Dirent::seek (long loc) { if (this->dirp_) - ACE_OS::seekdir (this->dirp_, loc); + ACE_OS_Dirent::seekdir (this->dirp_, loc); } ACE_INLINE long ACE_Dirent::tell (void) { - return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; + return this->dirp_ ? ACE_OS_Dirent::telldir (this->dirp_) : 0; } diff --git a/ace/Makefile b/ace/Makefile index 650e0747227..3b11b2a8307 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -11,6 +11,7 @@ SHLIB = libACE.$(SOEXT) OS_FILES = \ Basic_Types \ OS \ + OS_Dirent \ Sched_Params UTILS_FILES = \ ACE \ diff --git a/ace/Makefile.am b/ace/Makefile.am index d81cf172fe3..ff0949b090b 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -134,6 +134,7 @@ lib_LTLIBRARIES = \ libACE_OS_la_SOURCES = \ Basic_Types.cpp \ OS.cpp \ + OS_Dirent.cpp \ Sched_Params.cpp libACE_Utils_la_SOURCES = \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 5620d684ae3..b25c580e836 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -92,6 +92,7 @@ OBJFILES = \ $(OBJDIR)\Object_Manager.obj \ $(OBJDIR)\Obstack.obj \ $(OBJDIR)\OS.obj \ + $(OBJDIR)\OS_Dirent.obj \ $(OBJDIR)\Pair.obj \ $(OBJDIR)\Parse_Node.obj \ $(OBJDIR)\Pipe.obj \ @@ -21,9 +21,12 @@ #include "ace/config-all.h" -# if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -# endif /* ACE_LACKS_PRAGMA_ONCE */ +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Include the split up ACE_OS classes +#include "ace/OS_Dirent.h" # if !defined (ACE_MALLOC_ALIGN) # define ACE_MALLOC_ALIGN ((int) sizeof (long)) @@ -124,38 +127,6 @@ enum ACE_Recyclable_State #define ACE_STANDARD_CHARACTER_SET_SIZE 128 #endif /* 'a' < 'A' */ -// Get OS.h to compile on some of the platforms without DIR info yet. -# if !defined (ACE_HAS_DIRENT) -typedef int DIR; -struct dirent { -}; -# endif /* ACE_HAS_DIRENT */ - -#if defined (ACE_WIN32) -struct dirent { - unsigned short d_ino; - unsigned short d_off; - unsigned short d_reclen; - const ACE_TCHAR *d_name; -}; -struct DIR { - ACE_TCHAR *directory_name_; - // The name of the directory we are looking into - - HANDLE current_handle_; - // Remember the handle between calls. - - dirent dirent_; - // The struct for the results - - ACE_TEXT_WIN32_FIND_DATA fdata_; - // The struct for intermediate results. - - int started_reading_; - // A flag to remember if we started reading already. -}; -#endif /* defined (ACE_WIN32) */ - # if defined (ACE_PSOS_TM) typedef long long longlong_t; typedef long id_t; @@ -644,22 +615,6 @@ private: // include the ACE min()/max() functions. # include "ace/Min_Max.h" -// Keep the compiler from complaining about parameters which are not used. -# if defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__KCC) || defined (__rational__) || (__USLC__) -// Some compilers complain about "statement with no effect" with (a). -// This eliminates the warnings, and no code is generated for the null -// conditional statement. NOTE: that may only be true if -O is enabled, -// such as with GreenHills (ghs) 1.8.8. -# define ACE_UNUSED_ARG(a) {if (&a) /* null */ ;} -# else -# define ACE_UNUSED_ARG(a) (a) -# endif /* ghs */ - -# if defined (__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (__KCC) -# define ACE_NOTREACHED(a) -# else /* ! defined . . . */ -# define ACE_NOTREACHED(a) a -# endif /* ! defined . . . */ # if !defined (ACE_ENDLESS_LOOP) # define ACE_ENDLESS_LOOP @@ -889,12 +844,6 @@ typedef u_long ACE_id_t; # define ACE_SELF (0) typedef u_long ACE_pri_t; -// pHILE+ calls the DIR struct XDIR instead -# if !defined (ACE_PSOS_DIAB_PPC) -typedef XDIR DIR; -# endif /* !defined (ACE_PSOS_DIAB_PPC) */ - - // Use pSOS semaphores, wrapped . . . typedef struct { @@ -1717,10 +1666,6 @@ struct sembuf }; # endif /* ACE_LACKS_SEMBUF_T */ -# if defined (ACE_HAS_H_ERRNO) -void herror (const char *str); -# endif /* ACE_HAS_H_ERRNO */ - # if defined (ACE_LACKS_MSGBUF_T) struct msgbuf {}; # endif /* ACE_LACKS_MSGBUF_T */ @@ -2716,8 +2661,6 @@ typedef unsigned int size_t; # undef ACE_DONT_INCLUDE_ACE_SIGNAL_H # endif /* ! ACE_PSOS_DIAB_MIPS && ! VXWORKS */ -# include /**/ <errno.h> - # if ! defined (ACE_PSOS_DIAB_MIPS) # include /**/ <fcntl.h> # endif /* ! ACE_PSOS_DIAB_MIPS */ @@ -3648,7 +3591,6 @@ typedef void (*__sighandler_t)(int); // keep Signal compilation happy # include /**/ <pwd.h> # endif /* ! VXWORKS */ # include /**/ <sys/ioctl.h> -# include /**/ <dirent.h> // IRIX5 defines bzero() in this odd file... # if defined (ACE_HAS_BSTRING) @@ -3713,10 +3655,6 @@ typedef void (*__sighandler_t)(int); // keep Signal compilation happy # endif /* AIX */ # endif /* ACE_HAS_STREAMS */ -# if defined (ACE_LACKS_T_ERRNO) -extern int t_errno; -# endif /* ACE_LACKS_T_ERRNO */ - # if defined (DIGITAL_UNIX) // sigwait is yet another macro on Digital UNIX 4.0, just causing // trouble when introducing member functions with the same name. @@ -4246,10 +4184,6 @@ struct sigaction # define ENFILE EMFILE /* No more socket descriptors are available. */ # endif /* !ENOSYS */ -# if !defined (ENOTSUP) -# define ENOTSUP ENOSYS /* Operation not supported. */ -# endif /* !ENOTSUP */ - # if !defined (ECOMM) // Not the same, but ECONNABORTED is provided on NT. # define ECOMM ECONNABORTED @@ -4449,10 +4383,6 @@ typedef int ucontext_t; # include /**/ <tli/timod.h> # endif /* ACE_HAS_TIMOD_H */ -# if defined rewinddir -# undef rewinddir -# endif /* rewinddir */ - class ACE_Export ACE_Thread_ID { // = TITLE @@ -4581,15 +4511,6 @@ typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) /* throw () */; } # endif /* ACE_HAS_SIG_C_FUNC */ -// Marker for cleanup, used by ACE_Exit_Info. -extern int ace_exit_hook_marker; - -// For use by <ACE_OS::exit>. -extern "C" -{ - typedef void (*ACE_EXIT_HOOK) (void); -} - # if defined (ACE_WIN32) // Default WIN32 structured exception handler. int ACE_SEH_Default_Exception_Selector (void *); @@ -5283,7 +5204,7 @@ private: // (ACT). }; -class ACE_Export ACE_OS +class ACE_Export ACE_OS : public ACE_OS_Dirent { // = TITLE // This class defines an OS independent programming API that @@ -5426,18 +5347,6 @@ public: static void *dlsym (ACE_SHLIB_HANDLE handle, const ACE_TCHAR *symbol); - // = A set of wrappers for the directory iterator. - static DIR *opendir (const ACE_TCHAR *filename); - static void closedir (DIR *); - static struct dirent *readdir (DIR *); - static int readdir_r (DIR *dirp, - struct dirent *entry, - struct dirent **result); - static long telldir (DIR *); - static void seekdir (DIR *, - long loc); - static void rewinddir (DIR *); - // = A set of wrappers for stdio file operations. static int last_error (void); static void last_error (int); @@ -7120,65 +7029,6 @@ private: # define ACE_KEY_INDEX(OBJ,KEY) u_int OBJ = KEY # endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */ -// A useful abstraction for expressions involving operator new since -// we can change memory allocation error handling policies (e.g., -// depending on whether ANSI/ISO exception handling semantics are -// being used). - -# if defined (ACE_NEW_THROWS_EXCEPTIONS) -# if (__SUNPRO_CC) -# if (__SUNPRO_CC < 0x500) || ((__SUNPRO_CC == 0x500 && __SUNPRO_CC_COMPAT == 4)) -# include /**/ <exception.h> - // Note: we catch ::xalloc rather than just xalloc because of - // a name clash with unsafe_ios::xalloc() -# define ACE_bad_alloc ::xalloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc ("no more memory") -# else -# include /**/ <new> -# define ACE_bad_alloc std::bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# endif /* __SUNPRO_CC < 0x500 */ -# else - // I know this works for HP aC++... if <stdexcept> is used, it - // introduces other stuff that breaks things, like <memory>, which - // screws up auto_ptr. -# include /**/ <new> -# if (defined (__HP_aCC) && !defined (RWSTD_NO_NAMESPACE)) \ - || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# define ACE_bad_alloc std::bad_alloc -# else -# define ACE_bad_alloc bad_alloc -# endif /* RWSTD_NO_NAMESPACE */ -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# endif /* __SUNPRO_CC */ - -# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; return RET_VAL; } \ - } while (0) - -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; return; } \ - } while (0) - -# else /* ACE_NEW_THROWS_EXCEPTIONS */ - -# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ - } while (0) -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return; } \ - } while (0) - -# define ACE_throw_bad_alloc \ - void* gcc_will_complain_if_literal_0_is_returned = 0; \ - return gcc_will_complain_if_literal_0_is_returned - -# endif /* ACE_NEW_THROWS_EXCEPTIONS */ - // Some useful abstrations for expressions involving // ACE_Allocator.malloc (). The difference between ACE_NEW_MALLOC* // with ACE_ALLOCATOR* is that they call constructors also. @@ -7461,61 +7311,6 @@ private: # endif /* defined (__Lynx__) && __LYNXOS_SDK_VERSION == 199701L */ # endif /* defined ! ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR */ -# if defined (ACE_HAS_SIGNAL_SAFE_OS_CALLS) -// The following two macros ensure that system calls are properly -// restarted (if necessary) when interrupts occur. -# define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) \ - do \ - RESULT = (TYPE) OP; \ - while (RESULT == FAILVALUE && errno == EINTR && ACE_LOG_MSG->restart ()) -# define ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_; \ - do \ - ace_result_ = (TYPE) OP; \ - while (ace_result_ == FAILVALUE && errno == EINTR && ACE_LOG_MSG->restart ()); \ - return ace_result_; \ - } while (0) -# elif defined (ACE_WIN32) -# define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \ - do \ - return (TYPE) X; \ - while (0) -# define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \ - do \ - RESULT = (TYPE) X; \ - while (0) -# if defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_; \ - TYPE ace_local_result_ = (TYPE) X; \ - ace_result_ = ace_local_result_; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# else -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_; \ - ace_result_ = (TYPE) X; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# endif /* defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) */ -# define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \ - do { \ - RESULT = (TYPE) X; \ - if (RESULT == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - } while (0) -# else -# define ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) do { TYPE ace_result_ = FAILVALUE; ace_result_ = ace_result_; return OP; } while (0) -# define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) do { RESULT = (TYPE) OP; } while (0) -# endif /* ACE_HAS_SIGNAL_SAFE_OS_CALLS */ - # if defined (ACE_HAS_THR_C_FUNC) // This is necessary to work around nasty problems with MVS C++. extern "C" ACE_Export void ace_mutex_lock_cleanup_adapter (void *args); @@ -7789,18 +7584,6 @@ private: int error_; }; -// This is used to indicate that a platform doesn't support a -// particular feature. -# if defined ACE_HAS_VERBOSE_NOTSUP - // Print a console message with the file and line number of the - // unsupported function. -# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return FAILVALUE; } while (0) -# define ACE_NOTSUP do { errno = ENOTSUP; ACE_OS::fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return; } while (0) -# else /* ! ACE_HAS_VERBOSE_NOTSUP */ -# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP ; return FAILVALUE; } while (0) -# define ACE_NOTSUP do { errno = ENOTSUP; return; } while (0) -# endif /* ! ACE_HAS_VERBOSE_NOTSUP */ - # if defined (ACE_WIN32) && ! defined (ACE_HAS_WINCE) \ && ! defined (ACE_HAS_PHARLAP) typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; @@ -12050,245 +12050,6 @@ ACE_Cleanup::ACE_Cleanup (void) { } -ACE_INLINE DIR * -ACE_OS::opendir (const ACE_TCHAR *filename) -{ -#if defined (ACE_HAS_DIRENT) -# if defined (ACE_PSOS) - - // The pointer to the DIR buffer must be passed to ACE_OS::closedir - // in order to free it and avoid a memory leak. - DIR *dir; - u_long result; - ACE_NEW_RETURN (dir, DIR, 0); -#if defined (ACE_PSOS_DIAB_PPC) - result = ::open_dir (ACE_const_cast (char *, filename), &(dir->xdir)); -#else - result = ::open_dir (ACE_const_cast (char *, filename), dir); -#endif /* defined ACE_PSOS_DIAB_PPC */ - if (0 == result) - return dir; - else - { - errno = result; - return 0; - } - -# else /* ! defined (ACE_PSOS) */ -#if defined (ACE_WIN32) - DIR *dir; - ACE_NEW_RETURN (dir, DIR, 0); - ACE_NEW_RETURN (dir->directory_name_, - ACE_TCHAR[ACE_OS::strlen (filename)], - 0); - ACE_OS::strcpy (dir->directory_name_, filename); - dir->current_handle_ = INVALID_HANDLE_VALUE; - dir->started_reading_ = 0; - return dir; -#else - // VxWorks' ::opendir () is declared with a non-const argument. - return ::opendir (ACE_const_cast (char *, filename)); -#endif /* defined (ACE_WIN32) */ -# endif /* ! defined (ACE_PSOS) */ -#else - ACE_UNUSED_ARG (filename); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_HAS_DIRENT */ -} - -ACE_INLINE void -ACE_OS::closedir (DIR *d) -{ -#if defined (ACE_HAS_DIRENT) -# if defined (ACE_PSOS) - u_long result; -#if defined (ACE_PSOS_DIAB_PPC) - result = ::close_dir (&(d->xdir)); -#else - result = ::close_dir (d); -#endif /* defined ACE_PSOS_DIAB_PPC */ - delete d; - if (result != 0) - errno = result; -# else /* ! defined (ACE_PSOS) */ -# if defined (ACE_WIN32) - if (d->current_handle_ != INVALID_HANDLE_VALUE) - ::FindClose (d->current_handle_); - d->current_handle_ = INVALID_HANDLE_VALUE; - d->started_reading_ = 0; -# else /* defined (ACE_WIN32) */ - ::closedir (d); -# endif /* defined (ACE_WIN32) */ -# endif /* ! defined (ACE_PSOS) */ -#else - ACE_UNUSED_ARG (d); -#endif /* ACE_HAS_DIRENT */ -} - -ACE_INLINE struct dirent * -ACE_OS::readdir (DIR *d) -{ -#if defined (ACE_HAS_DIRENT) -# if defined (ACE_PSOS) - // The returned pointer to the dirent struct must be deleted by the - // caller to avoid a memory leak. - struct dirent *dir_ent; - u_long result; - - ACE_NEW_RETURN (dir_ent, - dirent, - 0); -#if defined (ACE_PSOS_DIAB_PPC) - result = ::read_dir (&(d->xdir), dir_ent); -#else - result = ::read_dir (d, dir_ent); -#endif /* defined ACE_PSOS_DIAB_PPC) */ - - if (0 == result) - return dir_ent; - else - { - errno = result; - return 0; - } - -# else /* ! defined (ACE_PSOS) */ -# if defined (ACE_WIN32) - if (!d->started_reading_) - { - d->current_handle_ = ACE_TEXT_FindFirstFile (d->directory_name_, - &(d->fdata_)); - - if (d->current_handle_ != INVALID_HANDLE_VALUE - && d->fdata_.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) - { - ::FindClose (d->current_handle_); - d->current_handle_ = INVALID_HANDLE_VALUE; - } - else // Skip "." and ".." - { - int retval = 1; - while (*(d->fdata_.cFileName) == '.' - && retval - && d->current_handle_ != INVALID_HANDLE_VALUE) - { - retval = ACE_TEXT_FindNextFile (d->current_handle_, - &(d->fdata_)); - } - if (retval == 0) - d->current_handle_ = INVALID_HANDLE_VALUE; - } - - d->started_reading_ = 1; - } - else - { - int retval = ACE_TEXT_FindNextFile (d->current_handle_, - &(d->fdata_)); - if (retval == 0) - d->current_handle_ = INVALID_HANDLE_VALUE; - } - - if (d->current_handle_ != INVALID_HANDLE_VALUE) - { - d->dirent_.d_name = d->fdata_.cFileName; - return &(d->dirent_); - } - else - return 0; -# else /* defined (ACE_WIN32) */ - return ::readdir (d); -# endif /* defined (ACE_WIN32) */ -# endif /* ! defined (ACE_PSOS) */ -#else - ACE_UNUSED_ARG (d); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_HAS_DIRENT */ -} - -ACE_INLINE int -ACE_OS::readdir_r (DIR *dirp, - struct dirent *entry, - struct dirent **result) -{ -# if !defined (ACE_HAS_REENTRANT_FUNCTIONS) - ACE_UNUSED_ARG (entry); - // <result> has better not be 0! - *result = ACE_OS::readdir (dirp); - return 0; -# elif defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_READDIR_R) -# if (defined (sun) && (defined (_POSIX_PTHREAD_SEMANTICS) || \ - (_FILE_OFFSET_BITS == 64))) || \ - (!defined (sun) && (defined (ACE_HAS_PTHREADS_STD) || \ - defined (ACE_HAS_PTHREADS_DRAFT7) || \ - defined (__USE_POSIX))) -# if defined (__GNUG__) && defined (DIGITAL_UNIX) - return readdir_r (dirp, entry, result); -# else - return ::readdir_r (dirp, entry, result); -# endif /* defined (__GNUG__) && defined (DIGITAL_UNIX) */ - return ::readdir_r (dirp, entry, result); -# else /* ! POSIX.1c - this is draft 4 or draft 6 */ -# if defined (HPUX_10) /* But HP 10.x doesn't follow the draft either */ - *result = entry; - return ::readdir_r (dirp, entry); -# else - // <result> had better not be 0! - *result = ::readdir_r (dirp, entry); - return 0; -# endif /* HPUX_10 */ -# endif /* ! POSIX.1c */ -#else /* ! ACE_HAS_DIRENT || ACE_LACKS_READDIR_R */ - ACE_UNUSED_ARG (dirp); - ACE_UNUSED_ARG (entry); - ACE_UNUSED_ARG (result); - ACE_NOTSUP_RETURN (0); - -#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ -} - -ACE_INLINE long -ACE_OS::telldir (DIR *d) -{ -#if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_TELLDIR) - return ::telldir (d); -#else /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */ - ACE_UNUSED_ARG (d); - ACE_NOTSUP_RETURN (-1); -#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */ -} - -ACE_INLINE void -ACE_OS::seekdir (DIR *d, long loc) -{ -#if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_SEEKDIR) - ::seekdir (d, loc); -#else /* ! ACE_HAS_DIRENT || ACE_LACKS_SEEKDIR */ - ACE_UNUSED_ARG (d); - ACE_UNUSED_ARG (loc); -#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_SEEKDIR */ -} - -ACE_INLINE void -ACE_OS::rewinddir (DIR *d) -{ -#if defined (ACE_HAS_DIRENT) -# if defined (ACE_LACKS_SEEKDIR) -# if defined (ACE_LACKS_REWINDDIR) - ACE_UNUSED_ARG (d); -# else /* ! defined (ACE_LACKS_REWINDDIR) */ - ::rewinddir (d); -# endif /* ! defined (ACE_LACKS_REWINDDIR) */ -# else /* ! ACE_LACKS_SEEKDIR */ - // We need to implement <rewinddir> using <seekdir> since it's often - // defined as a macro... - ::seekdir (d, long (0)); -# endif /* ! ACE_LACKS_SEEKDIR */ -#else - ACE_UNUSED_ARG (d); -#endif /* ACE_HAS_DIRENT */ -} - ACE_INLINE void * ACE_OS::bsearch (const void *key, const void *base, diff --git a/ace/OS_Dirent.cpp b/ace/OS_Dirent.cpp new file mode 100644 index 00000000000..b779f96e47e --- /dev/null +++ b/ace/OS_Dirent.cpp @@ -0,0 +1,60 @@ +// $Id$ + +#include "ace/OS_Dirent.h" + +// @@ (brunsch) We have to include OS.h here for the string operations. +// Once the string stuff gets split off, then we can just include that +// instead. +#include "ace/OS.h" + +ACE_RCSID(ace, OS_Dirent, "$Id$") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/OS_Dirent.inl" +#endif /* ACE_HAS_INLINED_OS_CALLS */ + +DIR * +ACE_OS_Dirent::opendir (const ACE_TCHAR *filename) +{ +#if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + + // The pointer to the DIR buffer must be passed to ACE_OS_Dirent::closedir + // in order to free it and avoid a memory leak. + DIR *dir; + u_long result; + ACE_NEW_RETURN (dir, DIR, 0); +#if defined (ACE_PSOS_DIAB_PPC) + result = ::open_dir (ACE_const_cast (char *, filename), &(dir->xdir)); +#else + result = ::open_dir (ACE_const_cast (char *, filename), dir); +#endif /* defined ACE_PSOS_DIAB_PPC */ + if (result == 0) + return dir; + else + { + errno = result; + return 0; + } + +# else /* ! defined (ACE_PSOS) */ +#if defined (ACE_WIN32) + DIR *dir; + ACE_NEW_RETURN (dir, DIR, 0); + ACE_NEW_RETURN (dir->directory_name_, + ACE_TCHAR[ACE_OS::strlen (filename)], + 0); + ACE_OS::strcpy (dir->directory_name_, filename); + dir->current_handle_ = INVALID_HANDLE_VALUE; + dir->started_reading_ = 0; + return dir; +#else + // VxWorks' ::opendir () is declared with a non-const argument. + return ::opendir (ACE_const_cast (char *, filename)); +#endif /* defined (ACE_WIN32) */ +# endif /* ! defined (ACE_PSOS) */ +#else + ACE_UNUSED_ARG (filename); + ACE_NOTSUP_RETURN (0); +#endif /* ACE_HAS_DIRENT */ +} diff --git a/ace/OS_Dirent.h b/ace/OS_Dirent.h new file mode 100644 index 00000000000..d21cc400647 --- /dev/null +++ b/ace/OS_Dirent.h @@ -0,0 +1,103 @@ +// -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// OS_Dirent.h +// +// = AUTHOR +// (Originally in OS.h) +// Doug Schmidt <schmidt@cs.wustl.edu>, Jesper S. M|ller +// <stophph@diku.dk>, and a cast of thousands... +// +// ============================================================================ + +#ifndef ACE_OS_DIRENT_H +#define ACE_OS_DIRENT_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_WIN32) && !defined (ACE_PSOS) +# include /**/ <dirent.h> +#endif /* !ACE_WIN32 && !ACE_PSOS */ + +// At least compile on some of the platforms without DIR info yet. +# if !defined (ACE_HAS_DIRENT) +typedef int DIR; +struct dirent { +}; +# endif /* ACE_HAS_DIRENT */ + +#if defined (ACE_WIN32) +struct dirent { + unsigned short d_ino; + unsigned short d_off; + unsigned short d_reclen; + const ACE_TCHAR *d_name; +}; + +struct DIR { + ACE_TCHAR *directory_name_; + // The name of the directory we are looking into + + HANDLE current_handle_; + // Remember the handle between calls. + + dirent dirent_; + // The struct for the results + + ACE_TEXT_WIN32_FIND_DATA fdata_; + // The struct for intermediate results. + + int started_reading_; + // A flag to remember if we started reading already. +}; +#elif defined (ACE_PSOS) +// pHILE+ calls the DIR struct XDIR instead +# if !defined (ACE_PSOS_DIAB_PPC) +typedef XDIR DIR; +# endif /* !defined (ACE_PSOS_DIAB_PPC) */ +#endif /* ACE_WIN32 && ACE_PSOS */ + +#if defined rewinddir +# undef rewinddir +#endif /* rewinddir */ + +class ACE_Export ACE_OS_Dirent + // = TITLE + // This class is a wrapper for the dirent.h operations + // + // = DESCRIPTION +{ +public: + static DIR *opendir (const ACE_TCHAR *filename); + static void closedir (DIR *); + static struct dirent *readdir (DIR *); + static int readdir_r (DIR *dirp, + struct dirent *entry, + struct dirent **result); + static long telldir (DIR *); + static void seekdir (DIR *, + long loc); + static void rewinddir (DIR *); +}; + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/OS_Dirent.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +#include "ace/post.h" +#endif /* ACE_OS_DIRENT_H */ diff --git a/ace/OS_Dirent.inl b/ace/OS_Dirent.inl new file mode 100644 index 00000000000..a14dc02543e --- /dev/null +++ b/ace/OS_Dirent.inl @@ -0,0 +1,195 @@ +/* -*- C++ -*- */ +// $Id$ + +ACE_INLINE void +ACE_OS_Dirent::closedir (DIR *d) +{ +#if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + u_long result; +#if defined (ACE_PSOS_DIAB_PPC) + result = ::close_dir (&(d->xdir)); +#else + result = ::close_dir (d); +#endif /* defined ACE_PSOS_DIAB_PPC */ + delete d; + if (result != 0) + errno = result; +# else /* ! defined (ACE_PSOS) */ +# if defined (ACE_WIN32) + if (d->current_handle_ != INVALID_HANDLE_VALUE) + ::FindClose (d->current_handle_); + d->current_handle_ = INVALID_HANDLE_VALUE; + d->started_reading_ = 0; +# else /* defined (ACE_WIN32) */ + ::closedir (d); +# endif /* defined (ACE_WIN32) */ +# endif /* ! defined (ACE_PSOS) */ +#else + ACE_UNUSED_ARG (d); +#endif /* ACE_HAS_DIRENT */ +} + +ACE_INLINE struct dirent * +ACE_OS_Dirent::readdir (DIR *d) +{ +#if defined (ACE_HAS_DIRENT) +# if defined (ACE_PSOS) + // The returned pointer to the dirent struct must be deleted by the + // caller to avoid a memory leak. + struct dirent *dir_ent; + u_long result; + + ACE_NEW_RETURN (dir_ent, + dirent, + 0); +#if defined (ACE_PSOS_DIAB_PPC) + result = ::read_dir (&(d->xdir), dir_ent); +#else + result = ::read_dir (d, dir_ent); +#endif /* defined ACE_PSOS_DIAB_PPC) */ + + if (0 == result) + return dir_ent; + else + { + errno = result; + return 0; + } + +# else /* ! defined (ACE_PSOS) */ +# if defined (ACE_WIN32) + if (!d->started_reading_) + { + d->current_handle_ = ACE_TEXT_FindFirstFile (d->directory_name_, + &(d->fdata_)); + + if (d->current_handle_ != INVALID_HANDLE_VALUE + && d->fdata_.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) + { + ::FindClose (d->current_handle_); + d->current_handle_ = INVALID_HANDLE_VALUE; + } + else // Skip "." and ".." + { + int retval = 1; + while (*(d->fdata_.cFileName) == '.' + && retval + && d->current_handle_ != INVALID_HANDLE_VALUE) + { + retval = ACE_TEXT_FindNextFile (d->current_handle_, + &(d->fdata_)); + } + if (retval == 0) + d->current_handle_ = INVALID_HANDLE_VALUE; + } + + d->started_reading_ = 1; + } + else + { + int retval = ACE_TEXT_FindNextFile (d->current_handle_, + &(d->fdata_)); + if (retval == 0) + d->current_handle_ = INVALID_HANDLE_VALUE; + } + + if (d->current_handle_ != INVALID_HANDLE_VALUE) + { + d->dirent_.d_name = d->fdata_.cFileName; + return &(d->dirent_); + } + else + return 0; +# else /* defined (ACE_WIN32) */ + return ::readdir (d); +# endif /* defined (ACE_WIN32) */ +# endif /* ! defined (ACE_PSOS) */ +#else + ACE_UNUSED_ARG (d); + ACE_NOTSUP_RETURN (0); +#endif /* ACE_HAS_DIRENT */ +} + +ACE_INLINE int +ACE_OS_Dirent::readdir_r (DIR *dirp, + struct dirent *entry, + struct dirent **result) +{ +# if !defined (ACE_HAS_REENTRANT_FUNCTIONS) + ACE_UNUSED_ARG (entry); + // <result> has better not be 0! + *result = ACE_OS_Dirent::readdir (dirp); + return 0; +# elif defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_READDIR_R) +# if (defined (sun) && (defined (_POSIX_PTHREAD_SEMANTICS) || \ + (_FILE_OFFSET_BITS == 64))) || \ + (!defined (sun) && (defined (ACE_HAS_PTHREADS_STD) || \ + defined (ACE_HAS_PTHREADS_DRAFT7) || \ + defined (__USE_POSIX))) +# if defined (__GNUG__) && defined (DIGITAL_UNIX) + return readdir_r (dirp, entry, result); +# else + return ::readdir_r (dirp, entry, result); +# endif /* defined (__GNUG__) && defined (DIGITAL_UNIX) */ + return ::readdir_r (dirp, entry, result); +# else /* ! POSIX.1c - this is draft 4 or draft 6 */ +# if defined (HPUX_10) /* But HP 10.x doesn't follow the draft either */ + *result = entry; + return ::readdir_r (dirp, entry); +# else + // <result> had better not be 0! + *result = ::readdir_r (dirp, entry); + return 0; +# endif /* HPUX_10 */ +# endif /* ! POSIX.1c */ +#else /* ! ACE_HAS_DIRENT || ACE_LACKS_READDIR_R */ + ACE_UNUSED_ARG (dirp); + ACE_UNUSED_ARG (entry); + ACE_UNUSED_ARG (result); + ACE_NOTSUP_RETURN (0); + +#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ +} + +ACE_INLINE long +ACE_OS_Dirent::telldir (DIR *d) +{ +#if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_TELLDIR) + return ::telldir (d); +#else /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */ + ACE_UNUSED_ARG (d); + ACE_NOTSUP_RETURN (-1); +#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */ +} + +ACE_INLINE void +ACE_OS_Dirent::seekdir (DIR *d, long loc) +{ +#if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_SEEKDIR) + ::seekdir (d, loc); +#else /* ! ACE_HAS_DIRENT || ACE_LACKS_SEEKDIR */ + ACE_UNUSED_ARG (d); + ACE_UNUSED_ARG (loc); +#endif /* ! ACE_HAS_DIRENT || ACE_LACKS_SEEKDIR */ +} + +ACE_INLINE void +ACE_OS_Dirent::rewinddir (DIR *d) +{ +#if defined (ACE_HAS_DIRENT) +# if defined (ACE_LACKS_SEEKDIR) +# if defined (ACE_LACKS_REWINDDIR) + ACE_UNUSED_ARG (d); +# else /* ! defined (ACE_LACKS_REWINDDIR) */ + ::rewinddir (d); +# endif /* ! defined (ACE_LACKS_REWINDDIR) */ +# else /* ! ACE_LACKS_SEEKDIR */ + // We need to implement <rewinddir> using <seekdir> since it's often + // defined as a macro... + ::seekdir (d, long (0)); +# endif /* ! ACE_LACKS_SEEKDIR */ +#else + ACE_UNUSED_ARG (d); +#endif /* ACE_HAS_DIRENT */ +} diff --git a/ace/ace-dll.icc b/ace/ace-dll.icc index be9a67aff7d..ca866da88a1 100644 --- a/ace/ace-dll.icc +++ b/ace/ace-dll.icc @@ -171,6 +171,7 @@ option 'Object_Manager.h', 'Obstack.h', 'OS.h', + 'OS_Dirent.h', 'Pair.h', 'Pair_T.h', 'Parse_Node.h', @@ -357,6 +358,7 @@ option source type(cpp) "Object_Manager.cpp" source type(cpp) "Obstack.cpp" source type(cpp) "OS.cpp" + source type(cpp) "OS_Dirent.cpp" source type(cpp) "Pair.cpp" source type(cpp) "Parse_Node.cpp" source type(cpp) "Pipe.cpp" diff --git a/ace/ace-lib.icc b/ace/ace-lib.icc index 6911c45e6c1..2ea385283fb 100644 --- a/ace/ace-lib.icc +++ b/ace/ace-lib.icc @@ -97,6 +97,7 @@ option source type(cpp) "Object_Manager.cpp" source type(cpp) "Obstack.cpp" source type(cpp) "OS.cpp" + source type(cpp) "OS_Dirent.cpp" source type(cpp) "Pair.cpp" source type(cpp) "Parse_Node.cpp" source type(cpp) "Pipe.cpp" diff --git a/ace/ace.icc b/ace/ace.icc index fec8f4c4177..e967955170e 100755 --- a/ace/ace.icc +++ b/ace/ace.icc @@ -76,6 +76,7 @@ option source type (cpp) "Object_Manager.cpp" source type (cpp) "Obstack.cpp" source type (cpp) "OS.cpp" + source type (cpp) "OS_Dirent.cpp" source type (cpp) "Parse_Node.cpp" source type (cpp) "Pipe.cpp" source type (cpp) "Proactor.cpp" diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 3c791f678e1..0ab738009d3 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -1893,6 +1893,25 @@ SOURCE=.\OS.cpp # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.cpp
+
+!IF "$(CFG)" == "ACE DLL - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair.cpp
!IF "$(CFG)" == "ACE DLL - Win32 Alpha Release"
@@ -4172,6 +4191,10 @@ SOURCE=.\OS.h # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair.h
# End Source File
# Begin Source File
@@ -4649,7 +4672,7 @@ SOURCE=.\XtReactor.h # End Group
# Begin Group "Inline Files"
-# PROP Default_Filter "i"
+# PROP Default_Filter "i;inl"
# Begin Source File
SOURCE=.\Acceptor.i
@@ -5032,6 +5055,10 @@ SOURCE=.\OS.i # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair_T.i
# End Source File
# Begin Source File
diff --git a/ace/ace_dll_ce.dsp b/ace/ace_dll_ce.dsp index 7d491513503..8e1c0368eeb 100644 --- a/ace/ace_dll_ce.dsp +++ b/ace/ace_dll_ce.dsp @@ -434,6 +434,12 @@ SOURCE=.\OS.cpp # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.cpp
+
+
+# End Source File
+# Begin Source File
+
SOURCE=.\Parse_Node.cpp
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index 4c5a99432e2..2eae774f2ef 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -1849,6 +1849,25 @@ SOURCE=.\OS.cpp # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.cpp
+
+!IF "$(CFG)" == "ACE LIB - Win32 Alpha Static Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Alpha Static Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Pharlap ETS Static Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Static Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair.cpp
!IF "$(CFG)" == "ACE LIB - Win32 Alpha Static Release"
@@ -4128,6 +4147,10 @@ SOURCE=.\OS.h # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair.h
# End Source File
# Begin Source File
@@ -4605,7 +4628,7 @@ SOURCE=.\XtReactor.h # End Group
# Begin Group "Inline Files"
-# PROP Default_Filter "i"
+# PROP Default_Filter "i;inl"
# Begin Source File
SOURCE=.\Acceptor.i
@@ -4992,6 +5015,10 @@ SOURCE=.\OS.i # End Source File
# Begin Source File
+SOURCE=.\OS_Dirent.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Pair_T.i
# End Source File
# Begin Source File
diff --git a/ace/config-all.h b/ace/config-all.h index dc91a9b0bca..306c05cef28 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -290,8 +290,204 @@ # endif /* ! ACE_CAST_CONST */ // ============================================================================ -// Cast macros +// Compiler Silencing macros +// +// Some compilers complain about parameters that are not used. This macro +// should keep them quiet. +// ============================================================================ + +#if defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__KCC) || defined (__rational__) || (__USLC__) +// Some compilers complain about "statement with no effect" with (a). +// This eliminates the warnings, and no code is generated for the null +// conditional statement. NOTE: that may only be true if -O is enabled, +// such as with GreenHills (ghs) 1.8.8. +# define ACE_UNUSED_ARG(a) {if (&a) /* null */ ;} +#else /* ghs || __GNUC__ || ..... */ +# define ACE_UNUSED_ARG(a) (a) +#endif /* ghs || __GNUC__ || ..... */ + +#if defined (__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (__KCC) +# define ACE_NOTREACHED(a) +#else /* __sgi || ghs || ..... */ +# define ACE_NOTREACHED(a) a +#endif /* __sgi || ghs || ..... */ + +// ============================================================================ +// errno stuff +// ============================================================================ + +#if defined (ACE_HAS_H_ERRNO) +void herror (const char *str); +#endif /* ACE_HAS_H_ERRNO */ + +#if !defined (ACE_HAS_WINCE) +# include /**/ <errno.h> +#endif /* ACE_HAS_WINCE */ + +#if !defined (ACE_WIN32) && !defined (ACE_PSOS) && defined (ACE_LACKS_T_ERRNO) +extern int t_errno; +#endif /* ACE_WIN32 && !ACE_PSOS && ACE_LACKS_T_ERRNO */ + +// ============================================================================ +// ACE_NEW macros +// +// A useful abstraction for expressions involving operator new since +// we can change memory allocation error handling policies (e.g., +// depending on whether ANSI/ISO exception handling semantics are +// being used). +// ============================================================================ + +#if defined (ACE_NEW_THROWS_EXCEPTIONS) +# if (__SUNPRO_CC) +# if (__SUNPRO_CC < 0x500) || ((__SUNPRO_CC == 0x500 && __SUNPRO_CC_COMPAT == 4)) +# include /**/ <exception.h> + // Note: we catch ::xalloc rather than just xalloc because of + // a name clash with unsafe_ios::xalloc() +# define ACE_bad_alloc ::xalloc +# define ACE_throw_bad_alloc throw ACE_bad_alloc ("no more memory") +# else +# include /**/ <new> +# define ACE_bad_alloc std::bad_alloc +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# endif /* __SUNPRO_CC < 0x500 */ +# else + // I know this works for HP aC++... if <stdexcept> is used, it + // introduces other stuff that breaks things, like <memory>, which + // screws up auto_ptr. +# include /**/ <new> +# if (defined (__HP_aCC) && !defined (RWSTD_NO_NAMESPACE)) \ + || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_bad_alloc std::bad_alloc +# else +# define ACE_bad_alloc bad_alloc +# endif /* RWSTD_NO_NAMESPACE */ +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# endif /* __SUNPRO_CC */ + +# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; return RET_VAL; } \ + } while (0) + +# define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; return; } \ + } while (0) + +#else /* ACE_NEW_THROWS_EXCEPTIONS */ + +# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \ + } while (0) +# define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return; } \ + } while (0) + +# define ACE_throw_bad_alloc \ + void* gcc_will_complain_if_literal_0_is_returned = 0; \ + return gcc_will_complain_if_literal_0_is_returned + +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + +// ============================================================================ +// ACE_OSCALL_* macros +// +// The following two macros ensure that system calls are properly +// restarted (if necessary) when interrupts occur. +// ============================================================================ + +#if defined (ACE_HAS_SIGNAL_SAFE_OS_CALLS) +# define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) \ + do \ + RESULT = (TYPE) OP; \ + while (RESULT == FAILVALUE && errno == EINTR && ACE_LOG_MSG->restart ()) +# define ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) \ + do { \ + TYPE ace_result_; \ + do \ + ace_result_ = (TYPE) OP; \ + while (ace_result_ == FAILVALUE && errno == EINTR && ACE_LOG_MSG->restart ()); \ + return ace_result_; \ + } while (0) +# elif defined (ACE_WIN32) +# define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \ + do \ + return (TYPE) X; \ + while (0) +# define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \ + do \ + RESULT = (TYPE) X; \ + while (0) +# if defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) +# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ + do { \ + TYPE ace_result_; \ + TYPE ace_local_result_ = (TYPE) X; \ + ace_result_ = ace_local_result_; \ + if (ace_result_ == FAILVALUE) \ + ACE_OS::set_errno_to_last_error (); \ + return ace_result_; \ + } while (0) +# else +# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ + do { \ + TYPE ace_result_; \ + ace_result_ = (TYPE) X; \ + if (ace_result_ == FAILVALUE) \ + ACE_OS::set_errno_to_last_error (); \ + return ace_result_; \ + } while (0) +# endif /* defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) */ +# define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \ + do { \ + RESULT = (TYPE) X; \ + if (RESULT == FAILVALUE) \ + ACE_OS::set_errno_to_last_error (); \ + } while (0) +#else /* ACE_HAS_SIGNAL_SAFE_OS_CALLS */ +# define ACE_OSCALL_RETURN(OP,TYPE,FAILVALUE) do { TYPE ace_result_ = FAILVALUE; ace_result_ = ace_result_; return OP; } while (0) +# define ACE_OSCALL(OP,TYPE,FAILVALUE,RESULT) do { RESULT = (TYPE) OP; } while (0) +#endif /* ACE_HAS_SIGNAL_SAFE_OS_CALLS */ + +// ============================================================================ +// at_exit declarations // ============================================================================ +// Marker for cleanup, used by ACE_Exit_Info. +extern int ace_exit_hook_marker; + +// For use by <ACE_OS::exit>. +extern "C" +{ + typedef void (*ACE_EXIT_HOOK) (void); +} + +// ============================================================================ +// Miscellaneous macros +// ============================================================================ + +#if !defined (ENOTSUP) +# define ENOTSUP ENOSYS /* Operation not supported. */ +#endif /* !ENOTSUP */ + +// This is used to indicate that a platform doesn't support a +// particular feature. +#if defined ACE_HAS_VERBOSE_NOTSUP + // Print a console message with the file and line number of the + // unsupported function. +# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) +# include /**/ <cstdio> +# else +# include /**/ <stdio.h> +# endif +# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP; fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return FAILVALUE; } while (0) +# define ACE_NOTSUP do { errno = ENOTSUP; fprintf (stderr, ACE_TEXT ("ACE_NOTSUP: %s, line %d\n"), __FILE__, __LINE__); return; } while (0) +#else /* ! ACE_HAS_VERBOSE_NOTSUP */ +# define ACE_NOTSUP_RETURN(FAILVALUE) do { errno = ENOTSUP ; return FAILVALUE; } while (0) +# define ACE_NOTSUP do { errno = ENOTSUP; return; } while (0) +#endif /* ! ACE_HAS_VERBOSE_NOTSUP */ + #include "ace/post.h" #endif /* ACE_CONFIG_ALL_H */ |