diff options
Diffstat (limited to 'dep')
608 files changed, 34248 insertions, 16636 deletions
diff --git a/dep/PackageList.txt b/dep/PackageList.txt index e5003ec744a..de08e0a461e 100644 --- a/dep/PackageList.txt +++ b/dep/PackageList.txt @@ -2,19 +2,19 @@ TrinityCore uses (parts of or in whole) the following opensource software : ACE (ADAPTIVE Communication Environment) http://www.cs.wustl.edu/~schmidt/ACE.html - Version: 5.8.3 + Version: 6.1.4 bzip2 (a freely available, patent free, high-quality data compressor) http://www.bzip.org/ - Version: 1.0.5 + Version: 1.0.6 G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License) http://g3d.sourceforge.net/ - Version: 8.0-Release + Version: 8.01-Release jemalloc (a general-purpose scalable concurrent malloc-implementation) http://www.canonware.com/jemalloc/ - Version: 2.2.5 + Version: 2.1.0 libMPQ (a library for reading MPQ files) https://libmpq.org/ @@ -30,12 +30,12 @@ SFMT (SIMD-oriented Fast Mersenne Twister) utf8-cpp (UTF-8 with C++ in a Portable Way) http://utfcpp.sourceforge.net/ - Version: 2.3 + Version: 2.3.2 zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library) http://www.zlib.net/ - Version: 1.2.5 + Version: 1.2.7 gSOAP (a portable development toolkit for C and C++ XML Web services and XML data bindings) http://gsoap2.sourceforge.net/ - Version: 2.8.2 + Version: 2.8.10 diff --git a/dep/acelite/6.1.4_tc_changes.diff b/dep/acelite/6.1.4_tc_changes.diff new file mode 100644 index 00000000000..a0caff7ab7d --- /dev/null +++ b/dep/acelite/6.1.4_tc_changes.diff @@ -0,0 +1,407 @@ +diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt +new file mode 100644 +index 0000000..acd3d5a +--- /dev/null ++++ b/dep/acelite/ace/CMakeLists.txt +@@ -0,0 +1,337 @@ ++# Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> ++# ++# This file is free software; as a special exception the author gives ++# unlimited permission to copy and/or distribute it, with or without ++# modifications, as long as this notice is preserved. ++# ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the ++# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ ++# NOTE: Do not use glob here, it would include files we don't want ++set(ace_STAT_SRCS ++ PrecompiledHeaders/WinAcePCH.cpp ++ ACE.cpp ++ ACE_crc32.cpp ++ ACE_crc_ccitt.cpp ++ ace_wchar.cpp ++ Activation_Queue.cpp ++ Active_Map_Manager.cpp ++ Addr.cpp ++ Argv_Type_Converter.cpp ++ Assert.cpp ++ Asynch_IO.cpp ++ Asynch_IO_Impl.cpp ++ Asynch_Pseudo_Task.cpp ++ ATM_Acceptor.cpp ++ ATM_Addr.cpp ++ ATM_Connector.cpp ++ ATM_Params.cpp ++ ATM_QoS.cpp ++ ATM_Stream.cpp ++ Atomic_Op.cpp ++ Atomic_Op_Sparc.c ++ Auto_Event.cpp ++ Barrier.cpp ++ Base_Thread_Adapter.cpp ++ Based_Pointer_Repository.cpp ++ Basic_Stats.cpp ++ Basic_Types.cpp ++ Capabilities.cpp ++ CDR_Base.cpp ++ CDR_Size.cpp ++ CDR_Stream.cpp ++ Cleanup.cpp ++ Codecs.cpp ++ Codeset_IBM1047.cpp ++ Codeset_Registry.cpp ++ Codeset_Registry_db.cpp ++ Condition_Recursive_Thread_Mutex.cpp ++ Condition_Thread_Mutex.cpp ++ Configuration.cpp ++ Configuration_Import_Export.cpp ++ Connection_Recycling_Strategy.cpp ++ Containers.cpp ++ Copy_Disabled.cpp ++ Date_Time.cpp ++ DEV.cpp ++ DEV_Addr.cpp ++ DEV_Connector.cpp ++ DEV_IO.cpp ++ Dev_Poll_Reactor.cpp ++ Dirent.cpp ++ Dirent_Selector.cpp ++ DLL.cpp ++ DLL_Manager.cpp ++ Dump.cpp ++ Dynamic.cpp ++ Dynamic_Message_Strategy.cpp ++ Dynamic_Service_Base.cpp ++ Dynamic_Service_Dependency.cpp ++ Encoding_Converter.cpp ++ Encoding_Converter_Factory.cpp ++ Event.cpp ++ Event_Handler.cpp ++ Event_Handler_Handle_Timeout_Upcall.cpp ++ FIFO.cpp ++ FIFO_Recv.cpp ++ FIFO_Recv_Msg.cpp ++ FIFO_Send.cpp ++ FIFO_Send_Msg.cpp ++ FILE.cpp ++ FILE_Addr.cpp ++ FILE_Connector.cpp ++ FILE_IO.cpp ++ File_Lock.cpp ++ Filecache.cpp ++ Flag_Manip.cpp ++ Framework_Component.cpp ++ Functor.cpp ++ Functor_String.cpp ++ Get_Opt.cpp ++ Handle_Ops.cpp ++ Handle_Set.cpp ++ Hashable.cpp ++ High_Res_Timer.cpp ++ ICMP_Socket.cpp ++ INET_Addr.cpp ++ Init_ACE.cpp ++ IO_Cntl_Msg.cpp ++ IO_SAP.cpp ++ IOStream.cpp ++ IPC_SAP.cpp ++ Lib_Find.cpp ++ Local_Memory_Pool.cpp ++ Local_Name_Space.cpp ++ Local_Tokens.cpp ++ Lock.cpp ++ Log_Msg.cpp ++ Log_Msg_Backend.cpp ++ Log_Msg_Callback.cpp ++ Log_Msg_IPC.cpp ++ Log_Msg_NT_Event_Log.cpp ++ Log_Msg_UNIX_Syslog.cpp ++ Log_Record.cpp ++ Logging_Strategy.cpp ++ LSOCK.cpp ++ LSOCK_Acceptor.cpp ++ LSOCK_CODgram.cpp ++ LSOCK_Connector.cpp ++ LSOCK_Dgram.cpp ++ LSOCK_Stream.cpp ++ Malloc.cpp ++ Malloc_Allocator.cpp ++ Manual_Event.cpp ++ MEM_Acceptor.cpp ++ MEM_Addr.cpp ++ MEM_Connector.cpp ++ MEM_IO.cpp ++ Mem_Map.cpp ++ MEM_SAP.cpp ++ MEM_Stream.cpp ++ Message_Block.cpp ++ Message_Queue.cpp ++ Message_Queue_NT.cpp ++ Message_Queue_Vx.cpp ++ Method_Request.cpp ++ MMAP_Memory_Pool.cpp ++ Monitor_Admin.cpp ++ Monitor_Admin_Manager.cpp ++ Monitor_Base.cpp ++ Monitor_Control_Action.cpp ++ Monitor_Control_Types.cpp ++ Monitor_Point_Registry.cpp ++ Monitor_Size.cpp ++ Msg_WFMO_Reactor.cpp ++ Multihomed_INET_Addr.cpp ++ Mutex.cpp ++ Name_Proxy.cpp ++ Name_Request_Reply.cpp ++ Name_Space.cpp ++ Naming_Context.cpp ++ Netlink_Addr.cpp ++ Notification_Queue.cpp ++ Notification_Strategy.cpp ++ NT_Service.cpp ++ Obchunk.cpp ++ Object_Manager.cpp ++ Object_Manager_Base.cpp ++ OS_Errno.cpp ++ OS_Log_Msg_Attributes.cpp ++ OS_main.cpp ++ OS_NS_arpa_inet.cpp ++ OS_NS_ctype.cpp ++ OS_NS_dirent.cpp ++ OS_NS_dlfcn.cpp ++ OS_NS_errno.cpp ++ OS_NS_fcntl.cpp ++ OS_NS_math.cpp ++ OS_NS_netdb.cpp ++ OS_NS_poll.cpp ++ OS_NS_pwd.cpp ++ OS_NS_regex.cpp ++ OS_NS_signal.cpp ++ OS_NS_stdio.cpp ++ OS_NS_stdlib.cpp ++ OS_NS_string.cpp ++ OS_NS_strings.cpp ++ OS_NS_stropts.cpp ++ OS_NS_sys_mman.cpp ++ OS_NS_sys_msg.cpp ++ OS_NS_sys_resource.cpp ++ OS_NS_sys_select.cpp ++ OS_NS_sys_sendfile.cpp ++ OS_NS_sys_shm.cpp ++ OS_NS_sys_socket.cpp ++ OS_NS_sys_stat.cpp ++ OS_NS_sys_time.cpp ++ OS_NS_sys_uio.cpp ++ OS_NS_sys_utsname.cpp ++ OS_NS_sys_wait.cpp ++ OS_NS_Thread.cpp ++ OS_NS_time.cpp ++ OS_NS_unistd.cpp ++ OS_NS_wchar.cpp ++ OS_QoS.cpp ++ OS_Thread_Adapter.cpp ++ OS_TLI.cpp ++ Pagefile_Memory_Pool.cpp ++ Parse_Node.cpp ++ PI_Malloc.cpp ++ Ping_Socket.cpp ++ Pipe.cpp ++ POSIX_Asynch_IO.cpp ++ POSIX_CB_Proactor.cpp ++ POSIX_Proactor.cpp ++ Priority_Reactor.cpp ++ Proactor.cpp ++ Proactor_Impl.cpp ++ Process.cpp ++ Process_Manager.cpp ++ Process_Mutex.cpp ++ Process_Semaphore.cpp ++ Profile_Timer.cpp ++ Reactor.cpp ++ Reactor_Impl.cpp ++ Reactor_Notification_Strategy.cpp ++ Reactor_Timer_Interface.cpp ++ Read_Buffer.cpp ++ Recursive_Thread_Mutex.cpp ++ Recyclable.cpp ++ Registry.cpp ++ Registry_Name_Space.cpp ++ Remote_Name_Space.cpp ++ Remote_Tokens.cpp ++ Rtems_init.c ++ RW_Mutex.cpp ++ RW_Process_Mutex.cpp ++ RW_Thread_Mutex.cpp ++ Sample_History.cpp ++ Sbrk_Memory_Pool.cpp ++ Sched_Params.cpp ++ Select_Reactor_Base.cpp ++ Semaphore.cpp ++ Service_Config.cpp ++ Service_Gestalt.cpp ++ Service_Manager.cpp ++ Service_Object.cpp ++ Service_Repository.cpp ++ Service_Types.cpp ++ Shared_Memory.cpp ++ Shared_Memory_MM.cpp ++ Shared_Memory_Pool.cpp ++ Shared_Memory_SV.cpp ++ Shared_Object.cpp ++ Sig_Adapter.cpp ++ Sig_Handler.cpp ++ Signal.cpp ++ SOCK.cpp ++ SOCK_Acceptor.cpp ++ SOCK_CODgram.cpp ++ Sock_Connect.cpp ++ SOCK_Connector.cpp ++ SOCK_Dgram.cpp ++ SOCK_Dgram_Bcast.cpp ++ SOCK_Dgram_Mcast.cpp ++ SOCK_IO.cpp ++ SOCK_Netlink.cpp ++ SOCK_SEQPACK_Acceptor.cpp ++ SOCK_SEQPACK_Association.cpp ++ SOCK_SEQPACK_Connector.cpp ++ SOCK_Stream.cpp ++ SPIPE.cpp ++ SPIPE_Acceptor.cpp ++ SPIPE_Addr.cpp ++ SPIPE_Connector.cpp ++ SPIPE_Stream.cpp ++ SString.cpp ++ Stack_Trace.cpp ++ Stats.cpp ++ String_Base_Const.cpp ++ SUN_Proactor.cpp ++ SV_Message.cpp ++ SV_Message_Queue.cpp ++ SV_Semaphore_Complex.cpp ++ SV_Semaphore_Simple.cpp ++ SV_Shared_Memory.cpp ++ Svc_Conf_Lexer.cpp ++ Svc_Conf_y.cpp ++ Synch_Options.cpp ++ System_Time.cpp ++ Task.cpp ++ Thread.cpp ++ Thread_Adapter.cpp ++ Thread_Control.cpp ++ Thread_Exit.cpp ++ Thread_Hook.cpp ++ Thread_Manager.cpp ++ Thread_Mutex.cpp ++ Thread_Semaphore.cpp ++ Throughput_Stats.cpp ++ Time_Policy.cpp ++ Time_Value.cpp ++ Timeprobe.cpp ++ TLI.cpp ++ TLI_Acceptor.cpp ++ TLI_Connector.cpp ++ TLI_Stream.cpp ++ Token.cpp ++ Token_Collection.cpp ++ Token_Invariants.cpp ++ Token_Manager.cpp ++ Token_Request_Reply.cpp ++ TP_Reactor.cpp ++ Trace.cpp ++ TSS_Adapter.cpp ++ TTY_IO.cpp ++ UNIX_Addr.cpp ++ UPIPE_Acceptor.cpp ++ UPIPE_Connector.cpp ++ UPIPE_Stream.cpp ++ UTF16_Encoding_Converter.cpp ++ UTF32_Encoding_Converter.cpp ++ UTF8_Encoding_Converter.cpp ++ UUID.cpp ++ WFMO_Reactor.cpp ++ WIN32_Asynch_IO.cpp ++ WIN32_Proactor.cpp ++ XML_Svc_Conf.cpp ++ XTI_ATM_Mcast.cpp ++) ++ ++include_directories( ++ ${CMAKE_SOURCE_DIR}/dep/acelite ++ ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders ++ ${CMAKE_SOURCE_DIR}/dep/zlib ++) ++ ++# Needed for PCH support ++set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX) ++ ++add_definitions(-DACE_BUILD_DLL) ++ ++add_library(ace SHARED ${ace_STAT_SRCS}) ++ ++add_native_precompiled_header(ace ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/WinAcePCH) ++ ++install(TARGETS ace RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}") +diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp +new file mode 100644 +index 0000000..139597f +--- /dev/null ++++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.cpp +@@ -0,0 +1,2 @@ ++ ++ +diff --git a/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h +new file mode 100644 +index 0000000..6ff97bf +--- /dev/null ++++ b/dep/acelite/ace/PrecompiledHeaders/WinAcePCH.h +@@ -0,0 +1,17 @@ ++ ++#ifndef WIN_ACE_PCH ++#define WIN_ACE_PCH ++ ++#include "ace/ACE.h" ++ ++#include "ace/Synch_Traits.h" ++#include "ace/Svc_Handler.h" ++#include "ace/SOCK_Stream.h" ++#include "ace/SOCK_Acceptor.h" ++#include "ace/Acceptor.h" ++#include "ace/Thread_Mutex.h" ++#include "ace/Guard_T.h" ++#include "ace/Unbounded_Queue.h" ++#include "ace/Message_Block.h" ++ ++#endif +diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h +index f18c8e0..32e5894 100644 +--- a/dep/acelite/ace/config-macros.h ++++ b/dep/acelite/ace/config-macros.h +@@ -21,7 +21,11 @@ + #ifndef ACE_CONFIG_MACROS_H + #define ACE_CONFIG_MACROS_H + +-#include "ace/config.h" ++#ifdef _WIN32 ++ #include "ace/config-win32.h" ++#else ++ #include "ace/config.h" ++#endif + + #include "ace/Version.h" + #include "ace/Versioned_Namespace.h" +diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h +index 50645a1..098ddbd 100644 +--- a/dep/acelite/ace/config-win32-common.h ++++ b/dep/acelite/ace/config-win32-common.h +@@ -527,9 +527,9 @@ + # else + # pragma comment(lib, "ws2_32.lib") + # pragma comment(lib, "mswsock.lib") +-# if defined (ACE_HAS_IPV6) ++// # if defined (ACE_HAS_IPV6) + # pragma comment(lib, "iphlpapi.lib") +-# endif ++// # endif + # endif /* ACE_HAS_WINCE */ + # endif /* _MSC_VER */ + diff --git a/dep/acelite/COPYING b/dep/acelite/COPYING index 551231de6cf..226708461b9 100644 --- a/dep/acelite/COPYING +++ b/dep/acelite/COPYING @@ -8,7 +8,7 @@ (henceforth referred to as "DOC software") are copyrighted by [5]Douglas C. Schmidt and his [6]research group at [7]Washington University, [8]University of California, Irvine, and [9]Vanderbilt - University, Copyright (c) 1993-2009, all rights reserved. Since DOC + University, Copyright (c) 1993-2012, all rights reserved. Since DOC software is open-source, freely available software, you are free to use, modify, copy, and distribute--perpetually and irrevocably--the DOC software source code and object code produced from the source, as diff --git a/dep/acelite/ChangeLog b/dep/acelite/ChangeLog index ec8c3ded3c5..7381bdcca07 100644 --- a/dep/acelite/ChangeLog +++ b/dep/acelite/ChangeLog @@ -1,3017 +1,2587 @@ -Wed Oct 27 12:01:05 CEST 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Aug 29 08:16:04 CEST 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ACE version 5.8.3 released. + * ACE version 6.1.4 released. -Tue Oct 26 11:21:35 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Aug 27 20:38:00 UTC 2012 Steve Huston <shuston@riverace.com> - * bin/diff-builds-and-group-fixed-tests-only.sh: - Fixed DANCE_ROOT, could cause problems with the test stats email - -Mon Oct 25 21:01:02 UTC 2010 Olli Savia <ops@iki.fi> - - * NEWS: - Updated. - -Mon Oct 25 14:07:15 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + * include/makeinclude/platform_linux.GNU: Make CC and CXX setting + conditional again. Conditional behavior is relied upon by users. + Reverts the following: + Tue Mar 1 11:31:55 UTC 2011 Olli Savia <ops@iki.fi> - * ace/Service_Gestalt.cpp: - Another fix to error processing behavior. If the result of - process_directives() was > 0, that value was replaced by the - result of process_commandline_directives(), which is contrary to - the expected behavior. Now the result is the sum of these to - return values, unless either returns -1, then the result is just - -1. +Mon Aug 27 09:43:43 UTC 2012 johnny <jwillemsen@remedy.nl> -Mon Oct 25 06:30:35 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * apps/JAWS/clients/WebSTONE/src/config.cache: + * apps/JAWS/clients/WebSTONE/src/config.log: + * apps/JAWS/clients/WebSTONE/src/config.status: + Removed these files, generated by configure and + shouldn't be stored in the repository - * ace/Atomic_Op_T.h: - * ace/Auto_IncDec_T.h: - Doxygen changes +Fri Aug 24 10:27:22 UTC 2012 johnny <jwillemsen@remedy.nl> -Sun Oct 24 12:35:28 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * examples/APG/Streams/CommandModule.h: + * tests/Service_Config_Stream_Test.cpp: + Add ACE_System_Time_Policy as second template argument + to ACE_Module, the default template argument doesn't + work with clang which seems to be a bug in that + compiler - * ace/Event_Handler.h: - * ace/Reactor.h: - * ace/Reactor_Notification_Strategy.h: - * ace/Read_Buffer.h: - * ace/Registry_Name_Space.h: - * ace/Remote_Tokens.h: - Doxygen changes +Thu Aug 23 12:33:35 UTC 2012 johnny <johnny@> -Fri Oct 22 11:19:33 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Condition_Attributes.inl: + * ace/config-hpux-11.00.h: + Another fix for hpux ia64 v3 - * ace/Reactor.h: - Doxygen changes +Thu Aug 23 06:35:20 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Thu Oct 21 11:10:56 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Condition_Attributes.inl: + Only check for ACE_LACKS_MONOTONIC_TIME - * ace/ACE.cpp: - * ace/FILE_IO.h: - * ace/Free_List.h: - * ace/Handle_Set.h: - * ace/Log_Msg.h: - * ace/WIN32_Asynch_IO.h: - Doxygen changes + * ace/Monotonic_Time_Policy.inl: + Layout change -Wed Oct 20 18:19:51 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/config-hpux-11.00.h: + Added ACE_LACKS_MONOTONIC_TIME - * bin/fuzz.pl: - If we just see dollarIddollar we trigger an error, svn:keywords is - than lacking +Wed Aug 22 11:50:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Oct 20 16:07:09 UTC 2010 Steve Huston <shuston@riverace.com> + * ace/config-win32-common.h: + Added ACE_LACKS_CLOCK_MONOTONIC and + ACE_LACKS_CLOCK_REALTIME - * ace/Timer_Queue_Adapters.cpp (ACE_Thread_Timer_Queue_Adapter::svc): - * ace/Timer_Queue_T.cpp (expire): - Temporarily release and reacquire the mutex around timer dispatch. - This prevents a deadlock on user code with multiple threads doing - timer-related operations. +Wed Aug 22 06:13:12 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Oct 20 09:22:46 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/os_include/sys/os_time.h: + Fixed incorrect check in this file - * bin/MakeProjectCreator/config/global.features: - Add nddsmonitor as default to 0 +Tue Aug 21 16:55:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Oct 20 09:19:25 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/os_include/sys/os_time.h: + Introduced new ACE_LACKS_CLOCKID_T which is used to determine whether + we need to define clockid_t in ACE. Moved CLOCK_MONOTONIC and + CLOCK_REALTIME to file below - * ace/Log_Msg.h: + * ace/os_include/sys/os_types.h: + Added CLOCK_MONOTONIC and CLOCK_REALTIME here and introduced new + ACE_LACKS_CLOCK_REALTIME and ACE_LACKS_CLOCK_MONOTONIC because on + for example HPUX CLOCK_REALTIME is not a define but part of an enum - * bin/MakeProjectCreator/config/global.features: + * ace/config-win32-common.h: + Added ACE_LACKS_CLOCKID_T - * tests/Time_Value_Test.cpp: +Tue Aug 21 14:38:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> -Tue Oct 19 18:11:57 UTC 2010 Olli Savia <ops@iki.fi> + * protocols/ace/INet/SSL_CallbackManager.h: + Spelling in comment. - * ace/Caching_Utility_T.cpp: - Added missing include. +Tue Aug 21 12:25:45 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> -Tue Oct 19 09:44:45 UTC 2010 Olli Savia <ops@iki.fi> + * ace/SSL/SSL_Context.h: + * ace/SSL/SSL_Context.inl: - * ace/Caching_Utility_T.cpp: - Use ACE::is_equal() to compare floating point values. + Solaris studio compilers amongst others were issuing warnings due to an + incorrect type of function pointer (i.e. not extern "C", but standard + C++ type) being stored/used of the form: -Fri Oct 15 10:18:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Warning (Anachronism): Formal argument callback of type + extern "C" int(*)(int,x509_store_ctx_st*) + in call to + SSL_CTX_set_verify(ssl_ctx_st*, int, extern "C" int(*)(int,x509_store_ctx_st*)) + is being passed + int(*)(int,x509_store_ctx_st*) - * tests/Bug_3911_Regression_Test.cpp: - Fixed warning + when the C++ code was providing callback functions to certain C system SSL + library calls. -Thu Oct 14 18:29:35 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Unfortunatly you cannot specify extern "C" linkage anywhere inside a + class declaration or inside a function prototype for individual + parameters. I.e: - * tests/run_test.lst: - * tests/tests.mpc: - 3911 doesn't work with ace_for_tao + class { extern "C" int (*callback_) (int, void *); }; -Thu Oct 14 13:15:00 UTC 2010 Martin Corino <mcorino@remedy.nl> + to store an extern "C" function pointer as a data member of the + class is illegal, as is: - * ace/Process.h: - * ace/Process.cpp: - Changes to allow to dynamically define the max. number of cmdline args. - The tao_idl compiler was running out of room in certain instances and - the static max was very conservative. + void function (extern "C" int (*callback) (int, void *); -Thu Oct 14 09:38:00 UTC 2010 Martin Corino <mcorino@remedy.nl> + to declare a function (or a class member) that takes a extern "C" + function pointer as a parameter. - * tests/Bug_3911_Regression_Test.cpp: - Wchar build fixes. + Since we need to specify an extern "C" function pointer as a parameter + to be stored in the class and handled by member functions, we are forced + to declare a typedef of that extern "C" function pointer outside of the + class that we can then use. Unfortunatly you also are not allowed to + simply add the extern "C" to the typedef itself, like this: -Wed Oct 13 08:24:00 UTC 2010 Martin Corino <mcorino@remedy.nl> + typedef extern "C" int (*extern_C_callback_t) (int, void *); - * tests/Bug_3911_Regression_Test.cpp: - Wchar build fixes. + instead you have to place the typedef declaration inside an extern "C" + block, thus: -Wed Oct 13 06:15:00 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + extern "C" { + typedef int (*extern_C_callback_t) (int, void *); + } - * ace/Framework_Component.h: - * ace/Framework_Component.inl: - * ace/Framework_Component.cpp: - * ace/Framework_Component_T.h: - Use ACE_Copy_Disabled, change c-style cast to const cast, use - sync macros instead of ACE_MT. Thanks to Ranjit Hande - <hande at avaya dot com> for reporting the c-style cast warnings + This then results in the correct call type associated with the + function pointer which may then be used inside the function and + class declarations to remove these warnings and possiable incorrect + call methods undertaken via the STL C functions. A lot of different + compilers ignore extern "C" where it is not allowed, the only way + I have found to be universally understood is as stated above. - * tests/Framework_Component_Test.h: - Layout change + * protocols/ace/INet/SSL_CallbackManager.h: + * protocols/ace/INet/SSL_CallbackManager.cpp: -Tue Oct 12 21:12:51 UTC 2010 Adam Mitz <mitza@ociweb.com> + Similar problems and interfacing to the changed calling type of the above + extern "C" function pointers. NOTE: just declaring a static function for + the class is NOT sufficient to obtain the correct extern "C" calling type. + We are therefore forced to declare friend functions external to the class + (as again we cannot have a extern "C" declaration inside a class even for + a static method) to do this job. Since these are extern "C" functions they + also of course cannot be overloaded, i.e. they are required to be unique + names. They also cannot be non-class static functions to make them private + to the cpp file as they need to actually be seen by the class declaration + to be made friends and therefore have to be included in the header file. - * bin/DependencyGenerator/GNUObjectGenerator.pm: +Tue Aug 21 12:20:43 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Fixed incorrect Perl regex escaping from my previous commit. + * ace/os_include/sys/os_types.h: + Fixed HPUX problem -Tue Oct 12 11:41:00 UTC 2010 Martin Corino <mcorino@remedy.nl> +Tue Aug 21 02:45:07 UTC 2012 Phil Mesnier <mesnier_p@ociweb.com> - * tests/Bug_3911_Regression_Test.cpp: - Fuzz fixes. + * ace/config-macosx-leopard.h: + setclock not supported on current macs. -Tue Oct 12 08:06:00 UTC 2010 Martin Corino <mcorino@remedy.nl> +Mon Aug 20 18:07:25 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * tests/Bug_3911_Regression_Test.cpp: - * tests/run_test.lst: - * tests/tests.mpc: - Added reproducer test for Bugzilla #3911. - -Mon Oct 11 16:31:12 UTC 2010 Adam Mitz <mitza@ociweb.com> + * ace/Global_Macros.h: + Doxyen fixes - * bin/DependencyGenerator/GNUObjectGenerator.pm: + * bin/valgrind.supp: + Added another needed suppression - If the source file contains '../', remove the directory part from - the name of the object file (see gnu.mpd:383 OBJS make variable). +Mon Aug 20 10:03:23 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Mon Oct 11 11:53:43 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * docs/ACE-monotonic-timer.html: + Fixed fuzz - * ace/Dev_Poll_Reactor.cpp: - * ace/Select_Reactor_T.cpp: - Fixed problems with threads=0, thanks to Elez <elezsh at gmail dot com> - for reporting this and providing a patch +Mon Aug 20 09:03:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Oct 8 11:19:44 UTC 2010 Olli Savia <ops@iki.fi> + * ace/Module.cpp: + Fixed possible memory leak and dead code, uncovered by Coverity scan - * protocols/ace/RMCast/Flow.cpp: - Added missing include. +Mon Aug 20 08:36:46 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Oct 8 08:42:37 UTC 2010 Olli Savia <ops@iki.fi> + * docs/ACE-monotonic-timer.html: + New document describing the ACE monotonic timer support for conditions, + message queues and tasks - * ace/config-linux-common.h: - * ace/os_include/os_unistd.h: - * configure.ac: - * m4/config_h.m4: - Removed references to ACE_LACKS_PREAD_PROTOTYPE. It is no - longer used. + * docs/index.html: + Added new page, removed link to site that doesn't work anymore -Fri Oct 8 08:20:04 UTC 2010 Olli Savia <ops@iki.fi> +Mon Aug 20 08:21:00 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_stdio.inl: - * ace/README: - * tests/OS_Test.cpp: - Removed references to ACE_LACKS_RENAME. It is no - longer used. + * ace/os_include/sys/os_types.h: + Define CLOCK_MONOTONIC to 1 when it is not defined, should fix + hpux problems -Fri Oct 8 07:51:46 UTC 2010 Olli Savia <ops@iki.fi> +Mon Aug 20 07:57:53 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-integritySCA.h: - Removed references to ACE_LACKS_IPC_H. It is no - longer used. + * ace/Condition_Attributes.h: + * ace/Condition_Attributes.inl: + Added accessor for attributes and removed friend declaration, + that hopefully fixes the Sun Studio 11 problems -Fri Oct 8 07:48:38 UTC 2010 Olli Savia <ops@iki.fi> + * ace/Condition_Recursive_Thread_Mutex.cpp: + * ace/Condition_T.cpp: + * ace/Condition_Thread_Mutex.cpp: + Use accessor of the attributes. - * ace/README: - Removed references to ACE_LACKS_IOSTREAMS_TOTALLY. It is no - longer used. +Sat Aug 18 19:25:38 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/os_include/os_stropts.h: - Fixed typo. + * ace/Null_Condition.h: + Fix for single threaded builds -Fri Oct 8 07:42:26 UTC 2010 Olli Savia <ops@iki.fi> +Sat Aug 18 19:23:21 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_stdio.h: - * ace/OS_NS_stdio.inl: - * ace/README: - * ace/Svc_Conf_Lexer.cpp: - Removed references to ACE_LACKS_CLEARERR. It is no - longer used. + * ace/Condition_Attributes.h: + Added forward declaration, maybe this fixes solaris 9 -Fri Oct 8 06:58:56 UTC 2010 Olli Savia <ops@iki.fi> +Fri Aug 17 18:05:54 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/ace/RMCast/Flow.cpp: - * tests/CDR_Array_Test.cpp: - * tests/CDR_File_Test.cpp: - * tests/CDR_Test.cpp: - * tests/Upgradable_RW_Test.cpp: - Use ACE::is_equal() to compare floating point values. + * ace/OS_NS_Thread.inl: + Attempt to fix clang warning -Thu Oct 7 12:34:20 UTC 2010 Olli Savia <ops@iki.fi> +Fri Aug 17 13:38:05 UTC 2012 Martin Corino <mcorino@remedy.nl> - * ASNMP/tests/Counter64_Test.cpp: - * ace/ETCL/ETCL_Constraint.cpp: - * ace/Monitor_Control/CPU_Load_Monitor.cpp: - Use ACE::is_equal() to compare floating point values. + * ace/Condition_Recursive_Thread_Mutex.h: + * ace/Condition_Thread_Mutex.h: + * ace/Null_Condition.h: + * ace/Synch_Traits.h: + Changes to attempt to fix Solaris9 SUNStudio11 problems. -Tue Oct 5 07:23:19 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Aug 17 12:28:32 UTC 2012 Martin Corino <mcorino@remedy.nl> - * ACE-INSTALL.html: - * COPYING: - Small updates + * ace/config-hpux-11.00.h: + * ace/config-linux.h: + Fixes (hopefully) for non-compliant POSIX platforms. - * docs/ACE-porting.html: - Updated links +Fri Aug 17 11:19:01 UTC 2012 Martin Corino <mcorino@remedy.nl> - * include/makeinclude/wrapper_macros.GNU: - Added support for valgrind=1 + * tests/Monotonic_Message_Queue_Test.cpp: + * tests/Monotonic_Task_Test.cpp: + Added include files because of compile errors in certain + builds. -Mon Oct 4 19:55:33 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> +Fri Aug 17 09:04:50 UTC 2012 Martin Corino <mcorino@remedy.nl> - * bin/make_release.py: + * ace/Message_Queue_T.h: + * ace/Message_Queue_T.cpp: + * ace/Stream.h: + * ace/Stream.cpp: + * tests/Bug_4055_Regression_Test.cpp: + * tests/Monotonic_Task_Test.cpp: + Fixed compile errors for a bunch of crappy compilers + like the one on RHEL53 and AIX. - Updates. +Thu Aug 16 18:47:59 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Mon Oct 4 12:32:02 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/ace.mpc: + * ace/ace_for_tao.mpc: + List Time_Value_T files - * ace/LSOCK_Stream.h: - Doxygen changes +Thu Aug 16 13:43:39 UTC 2012 Martin Corino <mcorino@remedy.nl> - * ace/Makefile.am: - Removed zapped file + * ace/Message_Queue_T.cpp: + * ace/Stream.cpp: + * ace/Thread_Manager.cpp: + * tests/Bug_4055_Regression_Test.cpp: + Fixed problems with single threaded builds. - * include/makeinclude/platform_sunos5_sunc++.GNU: - Removed SUN_CC_HAS_PVFC_BUG, this got added 8 years ago and is - used for any SunCC compiler version. If some old SunCC compiler breaks - we can readd this flag for just that compiler version +Thu Aug 16 12:44:05 UTC 2012 Martin Corino <mcorino@remedy.nl> -Fri Oct 1 16:00:51 UTC 2010 William Otte <wotte@zifnab> + * ace/Task_T.inl: + * ace/Time_Policy_T.inl: + Fuzz fixes. - * COPYING: +Thu Aug 16 09:43:00 UTC 2012 Simon Massey <sma at prismtech dot com> - Updated to include DAnCE. + * test/Bug_3943_Regression_Test.cpp: -Fri Oct 1 11:55:23 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Another cast required to remove warning. - * ace/config-g++-common.h: - * ace/config-qnx-neutrino.h: - * ace/config-qnx-rtp-common.h: - Fixed redefinition warnings +Thu Aug 16 09:22:31 UTC 2012 Martin Corino <mcorino@remedy.nl> + * ace/Condition_Attributes.h: + * ace/Condition_Attributes.inl: + * ace/Condition_Attributes.cpp: + * ace/Condition_Recursive_Thread_Mutex.h: + * ace/Condition_Recursive_Thread_Mutex.cpp: + * ace/Condition_T.h: + * ace/Condition_T.cpp: + * ace/Condition_Thread_Mutex.h: + * ace/Condition_Thread_Mutex.inl: + * ace/Condition_Thread_Mutex.cpp: + * ace/Message_Queue.h: + * ace/Message_Queue_T.h: + * ace/Message_Queue_T.cpp: + * ace/Module.h: + * ace/Module.inl: + * ace/Module.cpp: + * ace/Monotonic_Time_Policy.h: + * ace/Monotonic_Time_Policy.inl: + * ace/Monotonic_Time_Policy.cpp: + * ace/Null_Condition.h: + * ace/OS_NS_Thread.h: + * ace/OS_NS_Thread.inl: + * ace/OS_NS_Thread.cpp: + * ace/Stream.h: + * ace/Stream.inl: + * ace/Stream.cpp: + * ace/Stream_Modules.h: + * ace/Stream_Modules.cpp: + * ace/Synch_Traits.h: + * ace/Task_Ex_T.h: + * ace/Task_Ex_T.inl: + * ace/Task_Ex_T.cpp: + * ace/Task_T.h: + * ace/Task_T.inl: + * ace/Task_T.cpp: + * ace/Thread_Manager.h: + * ace/Thread_Manager.cpp: + * ace/Thread_Mutex.h: + * ace/Time_Policy.h: + * ace/Time_Policy.inl: + * ace/Time_Policy.cpp: + * ace/Time_Policy_T.h: + * ace/Time_Policy_T.inl: + * ace/Time_Policy_T.cpp: + * ace/Time_Value.h: + * ace/Time_Value.cpp: + * ace/Time_Value_T.h: + * ace/Time_Value_T.inl: + * ace/Time_Value_T.cpp: + * ace/ace.mpc: * ace/ace_for_tao.mpc: - Zapped some files - - * ace/config-win32-common.h: - * ace/config-win32-msvc.h: - * ace/config-win32.h: - Cleanup - - * ace/config-win32-ghs.h: - Removed this file. - -Thu Sep 30 10:49:38 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * debian/mpc-ace.install: - Improved - - * docs/bczar/bczar.html: - Added DAnCE to doxygen instructions + Added a Monotonic time policy and a Time_Value template + supporting time policies. Refactored OS_NS_Thread time + calculations to use new time policy aware functionality + of time values. Added support for monotonic timers with + condition variables in message queues, tasks and related + classes. See NEWS file and new regression tests for more + details. + Full backward compatibility is maintained. + + * tests/Bug_4055_Regression_Test.cpp: + Updated to fixed state. + + * tests/Monotonic_Message_Queue_Test.cpp: + * tests/Monotonic_Task_Test.cpp: + * tests/run_test.lst: + * tests/tests.mpc: + Added new monotonic timer regression tests. -Thu Sep 30 08:09:34 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * NEWS: + Added detailed update descriptions. - * ace/IOStream.h: - * ace/config-g++-common.h: - * ace/config-hpux-11.00.h: - * ace/config-linux-common.h: - * ace/config-mvs.h: - * ace/config-sunos5.5.h: - * ace/config-win32-borland.h: - * ace/config-win32-cegcc.h: - * ace/config-win32-dmc.h: - * ace/config-win32-ghs.h: - * ace/config-win32-mingw.h: - * ace/config-win32-msvc.h: - Cleanup, move g++ version defines to config-g++-common.h +Thu Aug 16 09:24:00 UTC 2012 Simon Massey <sma at prismtech dot com> -Thu Sep 30 05:45:10 UTC 2010 Marcel Smit <msmit@remedy.nl> + * bin/PerlACE/Process_Win32.pm: + * bin/PerlACE/ProcessVX_Win32.pm: - * NEWS: - * ace/Cache_Map_Manager_T.h: - * ace/Cache_Map_Manager_T.inl: - * ace/Cache_Map_Manager_T.cpp: - * ace/Cached_Connect_Strategy_T.h: - * ace/Cached_Connect_Strategy_T.cpp: - * ace/Caching_Strategies_T.h: - * ace/Caching_Utility_T.cpp: - * ace/Cleanup_Strategies_T.cpp: - * ace/Hash_Cache_Map_Manager_T.h: - * ace/Hash_Cache_Map_Manager_T.cpp: - * ace/Map_T.h: - * ace/Map_T.inl: - * ace/Map_T.cpp: - * ace/Pair_T.h: - * ace/Pair_T.inl: - * examples/Web_Crawler/URL_Visitor.h: - * tests/Cache_Map_Manager_Test.cpp: - * tests/Cached_Accept_Conn_Test.h: - * tests/Cached_Conn_Test.cpp: - * tests/Map_Manager_Test.cpp: - Removed ACE_Pair from the ACE library. + If we wait for a process to exit, and it does, set the RUNNING status to false. -Wed Sep 29 14:06:40 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Aug 16 08:26:12 UTC 2012 Olli Savia <ops@iki.fi> - * ace/Cache_Map_Manager_T.h: - * ace/MEM_SAP.h: - * ace/Metrics_Cache_T.h: - * ace/Metrics_Cache_T.inl: - * ace/Metrics_Cache_T.cpp: - Doxygen changes + * tests/tests.mpc: + Bug_4055_Regression_Test uses threads. -Wed Sep 29 12:19:17 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Aug 15 14:10:00 UTC 2012 Simon Massey <sma at prismtech dot com> - * ace/Caching_Utility_T.h: - * ace/Caching_Utility_T.cpp: - Use bool and ACE_Copy_Disabled + * test/Bug_3911_Regression_Test.cpp: + * test/Bug_3943_Regression_Test.cpp: - * ace/Malloc_Base.h: - * ace/Malloc_T.h: - Typo fixes + Some compilers warning against ordering pointers with integers. -Wed Sep 29 12:08:58 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> +Wed Aug 15 11:42:28 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/config/global.features: - Add ccm_noevent option, default 0, events in CCM are enabled. - If set, events in CCM are disabled. + * include/makeinclude/platform_linux_clang.GNU: + Support for c++0x flag -Tue Sep 28 18:48:58 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Aug 15 11:29:48 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * apps/JAWS3/jaws3-todo: - Removed, todo for years now + * include/makeinclude/platform_clang_common.GNU: + Support for c++0x flag -Tue Sep 28 18:16:52 UTC 2010 Adam Mitz <mitza@ociweb.com> +Tue Aug 14 22:22:05 UTC 2012 Adam Mitz <mitza@ociweb.com> - * performance-tests/TCP/tcp_test.cpp: + * ace/config-vxworks6.8.h: - If the 1st char of the host name is a digit, need to set the IP - address and port as network byte order since that is what's - returned from ACE_OS::inet_addr(). + When building for VxWorks kernel mode, define ACE_LACKS_STD_WSTRING. -Tue Sep 28 11:34:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue Aug 14 06:35:54 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Asynch_Connector.cpp: - * ace/Barrier.h: - * ace/Barrier.cpp: - * ace/Condition_Thread_Mutex.h: - * ace/Condition_Thread_Mutex.inl: - * ace/Containers_T.cpp: - * ace/Functor.h: - * ace/Functor.inl: - * ace/IO_Cntl_Msg.cpp: - * ace/Intrusive_List.cpp: - * ace/Local_Tokens.inl: - * ace/MEM_IO.cpp: - * ace/MEM_Stream.h: - * ace/MEM_Stream.inl: - * ace/Malloc_T.inl: - * ace/OS_NS_Thread.inl: - * ace/OS_NS_string.inl: - * ace/Object_Manager_Base.cpp: - * ace/POSIX_Proactor.cpp: - * ace/Ping_Socket.cpp: - * ace/Signal.inl: - * ace/Throughput_Stats.h: - * ace/Throughput_Stats.cpp: - * ace/Time_Value.cpp: - * ace/Timer_Hash_T.cpp: - * ace/Timer_Heap_T.cpp: - * ace/Vector_T.h: - * ace/Vector_T.cpp: - * ace/config-linux-common.h: - Removed code that was ifdefed out for years now + * bin/valgrind.supp: + Extended suppression list -Tue Sep 28 08:31:37 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> +Thu Aug 9 07:03:10 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * performance-tests/Misc/test_guard.cpp: - * tests/ACE_Test.cpp: - * examples/Reactor/TP_Reactor/client.cpp: - Fixed compilation errors with missing includes. + * docs/bczar/bczar.html: + Added packages -Mon Sep 27 18:04:34 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * include/makeinclude/platform_g++_common.GNU: + Use -Wno-deprecated with C++11 due to the heavy usage of auto_ptr - * ace/ACE.h: - * ace/Thread.h: - * ace/Thread_Adapter.h: - * ace/Thread_Mutex.h: - Doxygen changes + * tests/randomize.h: + Doxygen fix -Mon Sep 27 14:47:47 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Aug 8 22:13:55 UTC 2012 Adam Mitz <mitza@ociweb.com> - * ace/String_Base.h: - Doxygen changes + * ace/ACE.cpp: + * ace/ACE_crc_ccitt.cpp: + * ace/Basic_Types.h: + * ace/Configuration_Import_Export.cpp: + * ace/Handle_Set.inl: + * ace/INET_Addr.inl: + * ace/Message_Queue_Vx.inl: + * ace/Name_Request_Reply.cpp: + * ace/OS_NS_stdlib.cpp: + * ace/OS_NS_unistd.inl: + * ace/Select_Reactor_T.inl: + * ace/Service_Config.cpp: + * ace/Stack_Trace.cpp: + * ace/UUID.cpp: + * ace/config-vxworks6.9.h: + * include/makeinclude/platform_vxworks6.8.GNU: + * include/makeinclude/platform_vxworks6.9.GNU: - * ace/Svc_Conf_Lexer.cpp: - Const changes + Enable compiling for 64-bit VxWorks 6.9 (x86 RTP static). - * bin/msvc_static_order.lst: - Some updates, but this list is very outdated +Wed Aug 8 15:30:00 UTC 2012 Simon Massey <sma at prismtech dot com> -Mon Sep 27 14:27:25 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + * ace/config-linux.h: - * THANKS: + According to man pages Linux uses different (compared to UNIX systems) types + for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP + in setsockopt/getsockopt. + In the current (circa 2012) kernel source however there is an explicit check + for IPV6_MULTICAST_LOOP being sizeof(int). Anything else is rejected so it must + not be a passed a bool, irrespective of what the man pages (still) say. + i.e. #define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 is wrong. - Added Matthew Waller <matthewrwaller at gmail dot com> + * ace/SOCK_Dgram_Mcast.h: + * ace/SOCK_Dgram_Mcast.inl: -Mon Sep 27 14:08:11 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + Override read/write acessor for the constructor options + This class is typically default instantiated in a connection handler templated + framework so these cannot be specified on construction. - * ace/Log_Msg.h: - * ace/Log_Msg.cpp: - Fixed compilation with ACE_HAS_DUMP. The later happens because - ACE_Log_Msg depends on ACE_Atomic_Op and ACE_Atomic_Op needs - ACE_DEBUG when ACE_HAS_DUMP is defined. This change moves - include of ace/Atomic_Op.h from header to CPP file and adds - forward declaration for ACE_Atomic_Op. +Mon Aug 6 20:54:17 UTC 2012 Adam Mitz <mitza@ociweb.com> - * ace/Atomic_Op_T.cpp: - * ace/Guard_T.cpp: - Removed unnecessary this paramater when doing ACE_END_DUMP. + * bin/PerlACE/TestTarget.pm: - * examples/Misc/test_dump.h: - * examples/Threads/thread_specific.cpp: - Fixed logging in these tests. + Updated fix from Fri Jul 20 17:37:27 UTC 2012 to work when + one of source or destination is a relative path and other is not. -Mon Sep 27 11:24:02 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> +Sat Jul 28 19:22:06 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * examples/C++NPv2/AIO_Client_Logging_Daemon.h: - Another attempt to fix compile error. + * bin/make_release.py: + Fixed exclude -Mon Sep 27 09:42:29 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Jul 27 10:55:51 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/fuzz.pl: - Enable export file check, use TAO_IDL to generate export files or - remove the generated by line from the export file itself. Currently - only for CIAO and DAnCE + * etc/ace.doxygen: + * etc/ace_inet.doxygen: + * etc/ace_qos.doxygen: + * etc/ace_rmcast.doxygen: + * etc/ace_ssl.doxygen: + * etc/acexml.doxygen: + Generate UML diagrams, assume stl is buildin -Sat Sep 25 06:41:39 UTC 2010 Olli Savia <ops@iki.fi> +Fri Jul 27 08:57:07 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ACE.h: - Modified ACE::is_equal() comment once again to make fuzz happy. + * etc/ace.doxygen: + * etc/ace_inet.doxygen: + * etc/ace_qos.doxygen: + * etc/ace_rmcast.doxygen: + * etc/ace_ssl.doxygen: + * etc/acexml.doxygen: + Upgraded with doxygen -u -Fri Sep 24 14:52:44 UTC 2010 Steve Huston <shuston@riverace.com> +Thu Jul 26 16:22:35 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Pipe.{h inl cpp}: Added two new methods, close_read() and - close_write() to close individual pipe handles. Refactored the - original close() method to use these and factored out the actual - closing code to a new inlined close_handle() method. + * bin/make_release.py: + * docs/bczar/bczar.html: + Improved instructions - Thanks to John Lilley <jlilley at datalever dot com> for this - addition. +Thu Jul 26 14:40:45 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * NEWS: Added description of the new methods. + * docs/bczar/bczar.html: + Set all environment variables explicitly before running the doxygen + script -Fri Sep 24 12:41:13 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jul 26 10:19:34 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ACE-INSTALL.html: - Updated Remedy platforms - - * ACEXML/parser/parser/Parser.h: - * ace/Containers_T.h: - * ace/Containers_T.cpp: - * ace/OS_NS_string.h: - * ace/OS_NS_wchar.h: - * apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/shexp.h: - Fixed typo + * ace/ARGV.h: + * ace/Arg_Shifter.h: + Doxygen improvements -Fri Sep 24 12:32:44 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * rpmbuild/ace-tao.spec: + Removed ACE_XML_Utils, only compiled when xercesc is enabled - * ace/Containers_T.h: - * ace/Containers_T.cpp: - * ace/OS_NS_string.h: - * ace/OS_NS_wchar.h: - Fixed typo +Thu Jul 26 09:31:19 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Sep 24 12:24:01 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * NEWS: + Updated for next release - * ACE-INSTALL.html: - Documented vc10, thanks to Paul Carter <pcarter at scires dot com> - for reporting this. + * bin/diff-builds-and-group-fixed-tests-only.sh: + * bin/make_release.py: + * docs/Download.html: + * docs/bczar/bczar.html: + Updated for x.1.3 release -Fri Sep 24 11:44:06 UTC 2010 Olli Savia <ops@iki.fi> + * etc/ace.doxygen: + * etc/ace_inet.doxygen: + * etc/ace_qos.doxygen: + * etc/ace_rmcast.doxygen: + * etc/ace_ssl.doxygen: + * etc/acexml.doxygen: + * etc/index.html: + Removed deprecated tag - * ace/ACE.h: - Adjusted ACE::is_equal() comment to make fuzz happy. +Thu Jul 26 09:12:26 CEST 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Sep 24 09:35:00 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * ACE version 6.1.3 released. - * examples/C++NPv2/AIO_Client_Logging_Daemon.h: - Removed code that is problematic for GCC 2.95.3 in a crossbuild - for LynxOS 4.0. +Fri Jul 20 17:37:27 UTC 2012 Adam Mitz <mitza@ociweb.com> -Fri Sep 24 07:35:27 UTC 2010 Olli Savia <ops@iki.fi> + * ace/config-vxworks6.8.h: + * ace/config-vxworks6.9.h: - * ace/ACE.h: - Added a simple helper ACE::is_equal() which compares equality of two - objects without using operator==. This is useful for comparing floating - point values. + Changes to build for VxWorks 6.8 kernel mode. - * tests/OS_Test.cpp: - Use ACE::is_equal() instead of local copy. + * bin/PerlACE/ProcessVX_Win32.pm: + * tests/run_test.lst: -Thu Sep 23 16:14:12 UTC 2010 Adam Mitz <mitza@ociweb.com> + Changes for VxWorks testing. - * ace/SSL/ssl.mpc: - * bin/MakeProjectCreator/config/pkgconfig.mpb: - * bin/MakeProjectCreator/templates/gnu.mpd: - * bin/ace_install_pkgconfig.pl: - * include/makeinclude/rules.lib.GNU: - * include/makeinclude/wrapper_macros.GNU: + * bin/PerlACE/TestTarget.pm - Added support for installing pkg-config (.pc) files as part of the - gnuace "make install". This includes a refactoring of how the - shared library version numbers are set internally in the makefiles. + Fixed a Perl bug (ne vs. !=). -Thu Sep 23 12:32:05 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> +Wed Jul 18 15:40:05 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * ace/Service_Gestalt.cpp: - Fixed memory leak. Previously it could happen that svc_queue_ was - allocated during processing of arguments but was not freed if - application didn't call process_commandline_directives(). + * Happy 50th Birthday to me! - * tests/Network_Adapters_Test.cpp: - Removed non-ASCII character from the comments. +Tue Jun 26 21:47:18 UTC 2012 Adam Mitz <mitza@ociweb.com> -Wed Sep 22 18:42:25 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> + * bin/valgrind.supp: - * bin/msvc_mpc_auto_compile.pl: + Made the suppression for dlopen more generic, so that it + can work for different linux/glibc versions. - Updates for DAnCE. +Tue Jun 26 13:18:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Sep 22 14:17:11 UTC 2010 Marcel Smit <msmit@remedy.nl> + * tests/Bug_4055_Regression_Test.cpp: + Added commented out way to get the hr time - * debian/Basic_Logging_Service.sgml: - * debian/Event_Logging_Service.sgml: - * debian/Notify_Logging_Service.sgml: - * debian/RTEvent_Logging_Service.sgml: - Renamed TAO orb services. See $TAO_ROOT/NEWS for details. +Mon Jun 25 17:40:35 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Sep 22 14:06:25 UTC 2010 Marcel Smit <msmit@remedy.nl> + * tests/Bug_4055_Regression_Test.cpp: + * tests/run_test.lst: + * tests/tests.mpc: + Added new unit test which currently fails. The ACE condition + variables use an absolute timeout. If we for example wait for a + timeout 3 seconds in the future and the system time is changed 10 + seconds back we are really waiting 13 seconds now. The ACE timer + queues have support for using a monotonic time source using the + time policies but this support is not available for conditions at + this moment. When that is added, than in the ACE threading code + the monotonic time source can be set on the pthread condition + to control that we want to use a monotonic time source. + +Mon Jun 25 09:31:34 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/Condition_Attributes.h: + * ace/Condition_Attributes.inl: + * ace/Condition_Attributes.cpp: + * ace/Condition_Recursive_Thread_Mutex.h: + * ace/Condition_Thread_Mutex.h: + * ace/Condition_Thread_Mutex.inl: + * ace/ace.mpc: + * ace/ace_for_tao.mpc: + Moved condition attributes to its own file - * debian/libtao-orbsvcs-1.8.2.install: - * debian/libtao-orbsvcs-dev.install: - * debian/tao-imr.install: - * debian/tao-naming.install: - * debian/tao-notify.install: - * debian/tao-rtevent.install: - Renamed TAO orb services. See $TAO_ROOT/NEWS for details. +Fri Jun 22 00:30:11 UTC 2012 James H. Hill <hillj at cs dot iupui dot edu> -Wed Sep 22 13:58:46 UTC 2010 Marcel Smit <msmit@remedy.nl> + * tests/CDR_Test.cpp: - * debian/tao-concurrency.install: - * debian/tao-event.install: - * debian/tao-ft.install: - * debian/tao-ifr.install: - * debian/tao-lifecycle.install: - * debian/tao-load.install: - * debian/tao-log.install: - * debian/tao-scheduling.install: - * debian/tao-time.install: - * debian/tao-trading.install: - Renamed TAO orb services. See $TAO_ROOT/NEWS for details. + Fixed compilation warnings on CentOS 3.9 and vc9 -Tue Sep 21 08:27:47 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jun 21 17:08:55 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ASNMP/agent/main.cpp: - Fixed compile error + * ace/DLL.h: + * ace/DLL_Manager.h: + * ace/DLL_Manager.cpp: + Changed the order that the ACE_DLL_Manager attempts to open a library + Foo so that it will try <prefix>Foo<decorator>.<suffix> before + Foo<decorator>.<suffix>. This makes library loading using ACE succeed + on the first try instead of the fourth on any platform requiring a + library prefix, like Linux. For platforms that don't have a prefix + it will also succeed on the first time. Thanks to Trent Nadeau + <Trent dot Nadeau at ngc dot com> for providing this improvement -Mon Sep 20 13:24:56 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Jun 20 12:54:29 UTC 2012 James H. Hill <hillj at cs dot iupui dot edu> - * ASNMP/agent/agent.mpc: - * ASNMP/agent/main.cpp: - Enable for wchar, thanks to Christian Freund <freund at wrz dot de> - for reporting this and providing a patch, fixes bugzilla 3889 + * tests/CDR_Test.cpp: - * ace/String_Base.h: - * apps/JAWS3/http/HTTP_Service_Handler.h: - * apps/JAWS3/small/SS_Service_Handler.h: - Fixed typo in comment + Fixed error in test execution. - * ace/config-win32-borland.h: - Some updates based on QC emails +Mon Jun 18 20:40:29 UTC 2012 James H. Hill <hillj at cs dot iupui dot edu> - * debian/libtao-dev.install: - * debian/mpc-ace.install: - Fixed paths + * ace/CDR_Stream.h: + * ace/CDR_Stream.cpp: + * tests/CDR_Test.cpp: -Fri Sep 17 20:14:33 UTC 2010 Adam Mitz <mitza@ociweb.com> + Extended ACE_OutputCDR placeholders to support all ACE_CDR + simple types. - * ace/FlReactor/ace_flreactor.mpc: - * ace/FoxReactor/ace_foxreactor.mpc: - * ace/QtReactor/ace_qt3reactor.mpc: - * ace/QtReactor/ace_qt4reactor.mpc: - * ace/TkReactor/ace_tkreactor.mpc: - * ace/XtReactor/ace_xtreactor.mpc: +Mon Jun 18 13:20:32 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Since these have been moved, the default install_dir isn't what we - want. Set the install_dir to ace/*Reactor. + * bin/auto_run_tests.pl: + Use -z for debug mode -Fri Sep 17 07:51:06 UTC 2010 Marcel Smit <msmit@remedy.nl> +Mon Jun 18 06:44:11 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/fuzz.pl: - Added Id check for cdp files. + * debian/*: + Updated with latest files from debian packaging -Fri Sep 17 07:16:16 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jun 14 14:05:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Log_Msg.h: - * ace/OS_Errno.cpp: - Layout changes + * ace/XML_Utils/XML_Error_Handler.cpp: + Only print errors on cerr when we have ACE::debug enabled - * ace/Malloc_T.h: - * ace/Malloc_T.cpp: - * ace/Map_Manager.inl: - * ace/Map_Manager.cpp: - Moved some methods inline +Wed Jun 13 05:57:16 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_signal.cpp: - Fixed problem with versioned macros + * docs/bczar/bczar.html: + Added another package -Thu Sep 16 13:36:51 UTC 2010 Martin Corino <mcorino@remedy.nl> +Tue Jun 12 17:30:47 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/ace/INet/ClientRequestHandler.h: - * protocols/ace/INet/URLBase.h: - * protocols/ace/INet/HTTP_ClientRequestHandler.h: - Changes to fix export problems with nested classes with MSVC 9. + * bin/make_release.py: + Exclude CIAO_*_OpenDDS workspaces for the moment -Thu Sep 16 09:25:51 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Jun 11 21:45:19 UTC 2012 Adam Mitz <mitza@ociweb.com> - * ace/ace.mpc: - Removed Service_Templates.h + * NEWS: + * ace/config-lite.h: + * include/makeinclude/platform_sunos5_sunc++.GNU: -Thu Sep 16 09:08:39 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Added support for Oracle Solaris Studio 12 Update 3 (SunCC 5.12). - * protocols/tests/HTBP/Send_Large_Msg/server.cpp: - * protocols/tests/HTBP/ping/client.cpp: - Added missing includes +Mon Jun 11 17:05:36 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Sep 15 12:45:13 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/auto_run_tests.pl: + Added option -d to run OpenDDS tests also - * ace/Auto_Event.h: - * ace/OS_NS_arpa_inet.inl: - * ace/OS_NS_arpa_inet.cpp: - * ace/OS_NS_errno.cpp: - * ace/OS_NS_fcntl.cpp: - * ace/OS_NS_math.cpp: - * ace/OS_NS_pwd.inl: - * ace/OS_NS_pwd.cpp: - * ace/OS_NS_regex.inl: - * ace/OS_NS_regex.cpp: - * ace/OS_NS_signal.cpp: - * ace/OS_NS_sys_resource.cpp: - * ace/OS_NS_sys_wait.inl: - * ace/OS_NS_wctype.inl: - * ace/OS_NS_wctype.cpp: - * ace/config-tandem.h: - * ace/os_include/os_pthread.h: - * ace/os_include/os_signal.h: - * ace/os_include/sys/os_resource.h: - * ace/os_include/sys/os_socket.h: - Small cleanup and layout changes + * bin/diff-builds-and-group-fixed-tests-only.sh: + Also check OpenDDS lst files -Wed Sep 15 12:31:07 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Jun 7 10:13:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/tests/HTBP/Reactor_Tests/server.cpp: - * protocols/tests/HTBP/Send_Recv_Tests/server.cpp: - * protocols/tests/HTBP/ping/server.cpp: - Fixed solaris compile problems + * ace/Condition_Thread_Mutex.h: + * ace/Dynamic_Message_Strategy.h: + * ace/Message_Queue.h: + * ace/Metrics_Cache_T.h: + Doxygen fixes -Wed Sep 15 09:33:38 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Jun 6 14:46:53 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/XML_Utils/XSCRT/Traversal.hpp: + * ace/XML_Utils/XSCRT/Traversal.tpp: + Readded tpp file, shouldn't have been deleted + +Wed Jun 6 13:09:02 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/XML_Utils/XMLSchema/Traversal.hpp: + * ace/XML_Utils/XMLSchema/Types.hpp: + * ace/XML_Utils/XMLSchema/Writer.hpp: + * ace/XML_Utils/XSCRT/Elements.hpp: + * ace/XML_Utils/XSCRT/Parser.hpp: + * ace/XML_Utils/XSCRT/Traversal.hpp: + * ace/XML_Utils/XSCRT/Writer.hpp: + * ace/XML_Utils/XSCRT/XML.hpp: + Removed includes + + * ace/XML_Utils/XMLSchema/Traversal.tpp: + * ace/XML_Utils/XMLSchema/Types.tpp: + * ace/XML_Utils/XMLSchema/Writer.tpp: + * ace/XML_Utils/XSCRT/Elements.tpp: + * ace/XML_Utils/XSCRT/Parser.tpp: + * ace/XML_Utils/XSCRT/Traversal.tpp: + * ace/XML_Utils/XSCRT/Writer.tpp: + * ace/XML_Utils/XSCRT/XML.tpp: + Removed these files. - * ace/ace.mpc: - * ace/ace_for_tao.mpc: - Zapped removed files +Wed Jun 6 10:27:33 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * docs/svn/config: - Added another file type + * ace/XML_Utils/XML.mpc: + Install fixes -Wed Sep 15 07:51:33 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Jun 6 08:12:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/templates/gnu.mpd: - Removed invalid comma, thanks to Frank Preischl - <Frank dot Preischl at ids dot de> for reporting this and Olli Savia - for correcting my initial patch - -Tue Sep 14 18:18:36 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * ace/ace.mwc: - No need for a workspace with all projects in it - - * ace/ace_ce_dll.cfg: - Removed this file, ancient and not used - -Tue Sep 14 16:42:26 UTC 2010 Adam Mitz <mitza@ociweb.com> - - * bin/make_release.py (update_latest_tag): - - Fixed a bug with the new DAnCE changes and changed the way it does - the svn properties edits. This function is still not called, but - the calls are ready to be un-commented whenever the buildczar or - release manager can re-enable this. - -Tue Sep 14 13:00:44 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * ace/Log_Record.h: - * ace/Log_Record.inl: - * ace/Log_Record.cpp: - Removed deprecated encode/decode methods - -Tue Sep 14 12:05:19 UTC 2010 Steve Huston <shuston@riverace.com> - - * examples/APG/Logging/Callback-3.h: Replaced use of deprecated - ACE_Log_Record::encode() with CDR converter. - -Tue Sep 14 12:01:01 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * ace/FlReactor/ace_flreactor.mpc: - * ace/FoxReactor/ace_foxreactor.mpc: - * ace/QtReactor/ace_qt3reactor.mpc: - * ace/QtReactor/ace_qt4reactor.mpc: - * ace/TkReactor/ace_tkreactor.mpc: - * ace/XtReactor/ace_xtreactor.mpc: - * ace/ace_flreactor.mpc: - * ace/ace_foxreactor.mpc: - * ace/ace_qt3reactor.mpc: - * ace/ace_qt4reactor.mpc: - * ace/ace_tkreactor.mpc: - * ace/ace_xtreactor.mpc: - Moved these files to the subdirectory they need to be in - -Tue Sep 14 11:40:39 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * bin/Array.pl: - * bin/Array_Helper: - * bin/Hash_Map_Manager.pl: - * bin/Hash_Map_Manager_Helper: - * bin/vxworks_modify.pl: - Removed these files, very old and will not work at all - - * bin/PythonACE: - * bin/PythonACE/__init__.py: - * bin/PythonACE/fuzz: - * bin/PythonACE/fuzz/__init__.py: - * bin/PythonACE/fuzz/_fuzz.py: - * bin/PythonACE/fuzz/_generic_handler.py: - * bin/PythonACE/fuzz/_mailer.py: - * bin/PythonACE/fuzz/_path.py: - * bin/PythonACE/fuzz/_singleton.py: - * bin/PythonACE/fuzz/_types.py: - * bin/PythonACE/fuzz/_warning_handler.py: - * bin/PythonACE/fuzz/check_includes.py: - * bin/PythonACE/fuzz/check_no_tabs.py: - * bin/PythonACE/fuzz/cpp_inline.py: - * bin/PythonACE/fuzz/inline.py: - * bin/PythonACE/fuzz/math_include.py: - * bin/PythonACE/fuzz/max_filename.py: - * bin/PythonACE/fuzz/max_project_len.py: - * bin/PythonACE/fuzz/newline.py: - * bin/PythonACE/fuzz/no_conflict_markers.py: - * bin/PythonACE/fuzz/noncvs.py: - * bin/PythonACE/fuzz/ptr_arith_t.py: - * bin/PythonACE/fuzz/refcountservantbase.py: - * bin/PythonACE/fuzz/streams_include.py: - * bin/PythonACE/fuzz/verify_changelog.py: - * bin/fuzz.py: - Deleted, fuzz is still perl, if we need a PythonACE later we can - easily get this again from svn - -Tue Sep 14 11:31:42 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * bin/generate_doxygen.pl: - * html/index.html: - Removed ciao config handlers - -Tue Sep 14 11:30:18 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * bin/generate_doxygen.pl: - * html/index.html: - Removed pss - -Tue Sep 14 09:41:06 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * debian/mpc-ace.install: - Don't use environment variables - - * protocols/ace/HTBP/HTBP_Filter.h: - Added missing includes - -Tue Sep 14 09:36:06 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/XML_Utils/XML.mpc: + Install fixes - * bin/make_release.py: - Updated generation of dsc file +Fri Jun 1 12:43:48 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/examples/RMCast/Send_Msg/Sender.cpp: - * protocols/tests/RMCast/Sender.cpp: - * tests/Based_Pointer_Test.cpp: - * tests/SSL/Bug_2912_Regression_Test.cpp: - Added missing includes + * ace/Condition_Thread_Mutex.cpp: + * ace/Message_Queue_T.h: + * ace/Message_Queue_T.cpp: + * ace/Thread_Semaphore.h: + * ace/Time_Policy.h: + * ace/Timer_Hash_T.h: + Doxygen fixes -Mon Sep 13 18:15:27 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu May 31 14:05:51 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - *: - Zapped trailing whitespaces using - find -name \*.h -o -name \*.cpp -name \*.inl | xargs perl -i -pe's/\s+\n/\n/' + * rpmbuild/ace-tao.spec: + Added new library + +Thu May 31 12:31:38 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/XML_Utils/XMLSchema: + * ace/XML_Utils/XMLSchema/Traversal.hpp: + * ace/XML_Utils/XMLSchema/TypeInfo.hpp: + * ace/XML_Utils/XMLSchema/Types.hpp: + * ace/XML_Utils/XMLSchema/Writer.hpp: + * ace/XML_Utils/XMLSchema/id_map.hpp: + * ace/XML_Utils/XSCRT: + * ace/XML_Utils/XSCRT/Elements.hpp: + * ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp: + * ace/XML_Utils/XSCRT/Parser.hpp: + * ace/XML_Utils/XSCRT/Traversal.hpp: + * ace/XML_Utils/XSCRT/Writer.hpp: + * ace/XML_Utils/XSCRT/XML.hpp: + * ace/XML_Utils/XSCRT/XMLSchema.hpp: + Moved these files from DAnCE to ACE + + * ace/XML_Utils/XSCRT/Elements.ipp: + * ace/XML_Utils/XSCRT/Parser.ipp: + * ace/XML_Utils/XSCRT/Traversal.ipp: + * ace/XML_Utils/XSCRT/Writer.ipp: + * ace/XML_Utils/XSCRT/XML.ipp: + Removed these files. -Mon Sep 13 14:04:48 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu May 31 09:12:07 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Reverted change below, not correct given new info from Adam + * ace/XML_Utils: + * ace/XML_Utils/XML.mpc: + * ace/XML_Utils/XML_Error_Handler.h: + * ace/XML_Utils/XML_Helper.h: + * ace/XML_Utils/XML_Schema_Resolver.h: + * bin/MakeProjectCreator/config/ace_xml_utils.mpb: + New ACE_XML_Utils library. This is coming from DAnCe and had to + move to ACE because it is now used in more places and soon will + also be used by OpenDDS - Thu Sep 9 11:49:30 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu May 31 07:57:59 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/templates/gnu.mpd: - Removed invalid comma, thanks to Frank Preischl - <Frank dot Preischl at ids dot de> for reporting this + * ace/High_Res_Timer.h: + * ace/Message_Block.h: + Doxygen improvements - * debian/debian.rules: - * debian/mpc-ace.install: - Improved + * ace/High_Res_Timer.inl: + Use gsf type to prevent overflow -Mon Sep 13 09:25:22 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * docs/bczar/bczar.html: + Added some more packages - * bin/generate_doxygen.pl: - Updated for DAnCE move +Thu May 24 14:35:04 UTC 2012 Steve Huston <shuston@riverace.com> - * ace/ETCL/ETCL_Constraint.cpp: - * ace/ETCL/ETCL_l.cpp.diff: - * ace/ETCL/ETCL_l.cpp: - * ace/Makefile.am: - * ace/Thread_Control.inl: - * ace/ace.mpc: - * ace/ace_for_tao.mpc: - * apps/JAWS3/bench/average.cpp: - * apps/JAWS3/bench/mkfiles.cpp: - * apps/JAWS3/bench/rqfiles.cpp: - * apps/JAWS3/http/HTTP_Data.h: - * apps/JAWS3/http/HTTP_Service_Handler.h: - * apps/JAWS3/http/HTTP_Service_Handler.cpp: - * apps/JAWS3/http/HTTP_States.h: - * apps/JAWS3/jaws3-todo/Reactive_Socket.h: - * apps/JAWS3/jaws3-todo/Reactive_Socket_Helpers.h: - * apps/JAWS3/jaws3-todo/Reactive_Socket_Helpers.cpp: - * apps/JAWS3/jaws3-todo/Socket.h: - * apps/JAWS3/jaws3/Concurrency_T.h: - * apps/JAWS3/small/SS_Data.h: - * apps/JAWS3/small/SS_Service_Handler.h: - * apps/JAWS3/small/SS_Service_Handler.cpp: - * apps/JAWS3/small/SS_State_DONE.h: - * apps/JAWS3/small/SS_State_DONE.cpp: - * apps/JAWS3/small/SS_State_ERROR.h: - * apps/JAWS3/small/SS_State_ERROR.cpp: - * apps/JAWS3/small/SS_State_PARSE.h: - * apps/JAWS3/small/SS_State_PARSE.cpp: - * apps/JAWS3/small/SS_State_READ.h: - * apps/JAWS3/small/SS_State_READ.cpp: - * apps/JAWS3/small/SS_State_WRITE.h: - * apps/JAWS3/small/SS_State_WRITE.cpp: - * apps/JAWS3/small/SS_Templates.cpp: - * contrib/FaCE/FaCE.h: - * examples/APG/Svc_Config/HA_Status_Dynamic.h: - * examples/APG/Svc_Config/HA_Status_Static.h: - * examples/Reactor/TP_Reactor/client.cpp: - * examples/Reactor/TP_Reactor/server.cpp: - * protocols/ace/HTBP/HTBP_Channel.cpp: - * protocols/ace/HTBP/HTBP_Filter.h: - * protocols/ace/HTBP/HTBP_Inside_Squid_Filter.cpp: - * protocols/ace/HTBP/HTBP_Session.cpp: - * protocols/ace/TMCast/Group.cpp: - * protocols/examples/RMCast/Send_Msg/Sender.cpp: - * protocols/tests/HTBP/Reactor_Tests/client.cpp: - * protocols/tests/HTBP/Reactor_Tests/server.cpp: - * protocols/tests/HTBP/Reactor_Tests/test_config.h: - * protocols/tests/HTBP/Send_Large_Msg/client.cpp: - * protocols/tests/HTBP/Send_Large_Msg/server.cpp: - * protocols/tests/HTBP/Send_Recv_Tests/client.cpp: - * protocols/tests/HTBP/Send_Recv_Tests/server.cpp: - * protocols/tests/HTBP/ping/client.cpp: - * protocols/tests/HTBP/ping/server.cpp: - * protocols/tests/RMCast/Sender.cpp: - * tests/Based_Pointer_Test.cpp: - * tests/Bug_2980_Regression_Dll.cpp: - * tests/SSL/Bug_2912_Regression_Test.cpp: - Removed include of ace/OS.h, only in a few files we really had - to add an include of OS_NS_*.h + * ace/Cache_Map_Manager_T.cpp (find): Remove extraneous () from + 'second' - leftover from ACE_Pair days. - * ace/OS.h: - * ace/OS.inl: - * ace/OS.cpp: - Removed these files, replaced with OS_NS_* files a long time ago + * tests/Cache_Map_Manager_Test.cpp: Add call to the above method. -Sun Sep 12 19:27:58 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> + * THANKS: Thanks to Milind Pangarkar for the above test, and fix. - * bin/make_release.py: +Thu May 24 07:58:53 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Some updates to handle moved DAnCE package. + * ace/High_Res_Timer.h: + * ace/config-win32-msvc.h: + Documentation updates -Sun Sep 12 19:22:21 UTC 2010 William Otte <wotte@zifnab> + * ace/High_Res_Timer.inl: + Layout changes - * bin/MakeProjectCreator/modules/GNUACEProjectCreator.pm: - * bin/MakeProjectCreator/templates/: + * ace/High_Res_Timer.cpp: + Use this - Added rules to pullin rules.dance.GNU. +Thu May 24 05:56:27 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Sep 10 16:43:39 UTC 2010 Steve Huston <shuston@riverace.com> + * bin/MakeProjectCreator/config/MPC.cfg: + Added XSC_ROOT - * ace/Makefile.am: Removed references to files removed at - Thu Sep 9 11:14:45 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/valgrind.supp: + Simplified this file -Fri Sep 10 11:07:56 UTC 2010 Marcel Smit <msmit@remedy.nl> +Mon May 21 18:05:32 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/TSS_T.h: - Resolved compile issue regarding ACE_Copy_Disabled class. + * tests/INTEGRITY.ld: + Removed this file. -Fri Sep 10 07:36:39 UTC 2010 Marcel Smit <msmit@remedy.nl> +Mon May 21 07:15:10 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Thread_Control.inl: - Include before versioning macros. + * NEWS: + * bin/diff-builds-and-group-fixed-tests-only.sh: + * docs/Download.html: + * docs/bczar/bczar.html: + * etc/index.html: + Updated for new release -Fri Sep 10 07:05:45 UTC 2010 Marcel Smit <msmit@remedy.nl> +Sat May 19 14:28:57 CEST 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Thread_Control.inl: - Resolved compile error (ACE_OS_TRACE could not be found). + * ACE version 6.1.2 released. -Thu Sep 9 12:53:39 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu May 17 16:16:09 UTC 2012 Adam Mitz <mitza@ociweb.com> - * ace/Asynch_Acceptor.h: - * ace/Asynch_Acceptor.cpp: - * ace/Hash_Multi_Map_Manager_T.h: - * ace/OS_NS_Thread.h: - * ace/OS_NS_Thread.cpp: - * ace/Service_Config.cpp: - * ace/TSS_T.cpp: - * ace/Thread.h: - * ace/Thread.inl: - * ace/config-macosx-snowleopard.h: - * ace/config-macosx-tiger.h: - * ace/config-macosx.h: - * tests/Hash_Multi_Map_Manager_Test.cpp: - Removed deprecated methods and arguments - - * docs/FAQ: - * FAQ: - Moved to docs - -Thu Sep 9 11:54:10 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> - - * apps/soreduce/Signature.cpp: - * tests/TkReactor_Test.cpp: - Fixed fuzz + * ACE-INSTALL.html: -Thu Sep 9 11:49:30 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Replaced the make flag static_libs with static_libs_only. + Using static_libs implies that both static and shared can + be built at the same time, which is not true in general. - * bin/MakeProjectCreator/templates/gnu.mpd: - Removed invalid comma, thanks to Frank Preischl - <Frank dot Preischl at ids dot de> for reporting this +Thu May 17 15:42:36 UTC 2012 Steve Huston <shuston@riverace.com> -Thu Sep 9 11:14:45 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Reactor.h: Clarified the timeout conditions on + run_reactor_event_loop(). Thank you to Mohsin Zaidi for this + clarification. - * Kokyu/Dispatch_Deferrer.h: + * THANKS: Added Mohsin Zaidi to the Hall of Fame. - * ace/Atomic_Op_T.h: - * ace/Atomic_Op_T.inl: - * ace/Configuration.h: - * ace/Configuration.cpp: - * ace/Default_Constants.h: - * ace/Hash_Multi_Map_Manager_T.h: - * ace/Hash_Multi_Map_Manager_T.cpp: - * ace/Intrusive_List.h: - * ace/Intrusive_List.inl: - * ace/Local_Name_Space_T.h: - * ace/Log_Msg.h: - * ace/Log_Msg.cpp: - * ace/MEM_Acceptor.h: - * ace/MEM_Acceptor.inl: - * ace/MEM_Connector.h: - * ace/MEM_Connector.inl: - * ace/Message_Queue.h: - * ace/OS.h: - * ace/OS_Memory.h: - * ace/OS_TLI.h: - * ace/Obstack_T.h: - * ace/Obstack_T.inl: - * ace/POSIX_Asynch_IO.h: - * ace/Process_Manager.h: - * ace/Process_Manager.cpp: - * ace/Recursive_Thread_Mutex.h: - * ace/Recursive_Thread_Mutex.cpp: - * ace/Refcountable_T.h: - * ace/Strategies_T.h: - * ace/Strategies_T.inl: - * ace/Synch.h: - * ace/Task.h: - * ace/Task_Ex_T.h: - * ace/Task_Ex_T.inl: - * ace/Task_T.h: - * ace/Task_T.inl: - * ace/Thread_Control.cpp: - * ace/Token_Collection.h: - * ace/Token_Invariants.h: - * ace/Token_Manager.h: - * ace/ace_wchar.h: - * ace/config-macosx-leopard.h: - * ace/os_include/net/os_if.h: - * ace/os_include/sys/os_mman.h: - * apps/Gateway/Gateway/Concrete_Connection_Handlers.cpp: - * netsvcs/lib/Time_Request_Reply.h: - * netsvcs/lib/Time_Request_Reply.cpp: - * tests/Conn_Test.cpp: - * tests/Dirent_Test.cpp: - * tests/Svc_Handler_Test.cpp: - Removed several methods, files, and macros that are marked deprecated - for several years now. - - * ace/Map.h: - * ace/Method_Object.h: - * ace/OS_Dirent.h: - * ace/OS_String.h: - * ace/Pair.h: - * ace/Refcountable.h: - * ace/Service_Templates.h: - Removed these files. +Wed May 16 17:41:21 UTC 2012 Steve Huston <shuston@riverace.com> -Thu Sep 9 09:37:22 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/OS_NS_Thread.cpp (ACE_Thread_ID::to_string): Use string literals + for the sprintf formats rather than build them up. Things have + simplified to the point we don't need that any longer. Thanks to + Rick Ohnemus for providing the patch. Fixes Bugzilla #4021. - * bin/generate_doxygen.pl: - Fixed errors +Wed May 16 06:44:23 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * debian/debian.rules: - Moving forward with OBS + * tests/run_test.lst: + * tests/tests.mpc: + * tests/Bug_4008_Regression_Test.cpp: + Removed bug 4008 test, it was testing incorrect assumptions -Thu Sep 9 09:29:30 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed May 16 06:42:45 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/CDR_Base.h: - * ace/CDR_Base.cpp: - * ace/DEV.h: - * ace/FILE.h: - * ace/Global_Macros.h: - * ace/INET_Addr.inl: - * ace/Malloc_T.h: - * ace/Malloc_T.inl: - * ace/Malloc_T.cpp: - * ace/SOCK_Dgram_Bcast.cpp: - * ace/SSL/SSL_SOCK.h: - * ace/Shared_Memory_Pool.cpp: - * ace/Sock_Connect.cpp: - * ace/config-aix-5.x.h: - * ace/config-doxygen.h: - * ace/config-g++-common.h: - * ace/config-hpux-11.00.h: - * ace/config-icc-common.h: - * ace/config-integritySCA.h: - * ace/config-linux-common.h: - * ace/config-macros.h: - * ace/config-mvs.h: - * ace/config-openvms.h: - * ace/config-suncc-common.h: - * ace/config-sunos5.5.h: - * ace/config-sunos5.6.h: - * ace/config-tandem-nsk-mips-v2.h: - * ace/config-tandem-nsk-mips-v3.h: - * ace/config-win32-borland.h: - * ace/config-win32-dmc.h: - * ace/config-win32-ghs.h: - * ace/config-win32-msvc-10.h: - * ace/config-win32-msvc-7.h: - * ace/config-win32-msvc-8.h: - * ace/config-win32-msvc-9.h: - * examples/IOStream/server/iostream_server.h: - * examples/IPC_SAP/SOCK_SAP/C-inserver.cpp: - * examples/IPC_SAP/SSL_SAP/SSL-server-fancy.cpp: - * examples/Reactor/Misc/test_event_handler_t.cpp: + * ace/Basic_Types.h: + * ace/Basic_Types.cpp: + * ace/Functor.inl: + * ace/High_Res_Timer.inl: + * ace/OS_NS_time.h: + * ace/OS_NS_time.inl: * tests/Basic_Types_Test.cpp: - * tests/Conn_Test.cpp: - * tests/Message_Queue_Test.cpp: - * tests/SSL/Thread_Pool_Reactor_SSL_Test.h: - * tests/SSL/Thread_Pool_Reactor_SSL_Test.cpp: - Cleanup, all compilers support templated typedefs + * tests/Bug_2434_Regression_Test.cpp: + * tests/Time_Value_Test.cpp: + More cleanup due to removal of NSK - * ace/config-cray.h: - * ace/config-cxx-common.h: - Removed these files, obsolete + * ace/Basic_Types.inl: + Removed this file. -Thu Sep 9 09:01:10 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue May 15 18:16:09 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ACE.cpp: - * ace/ACE_export.h: - * ace/ETCL/ETCL_y.cpp: - * ace/INET_Addr.cpp: + * ace/ACE.inl: + * ace/Atomic_Op_T.h: + * ace/Basic_Types.h: + * ace/Basic_Types.inl: + * ace/Basic_Types.cpp: + * ace/CDR_Base.h: + * ace/Functor.h: + * ace/Functor.inl: + * ace/Handle_Set.cpp: + * ace/High_Res_Timer.cpp: * ace/Log_Msg.cpp: - * ace/OS.inl: - * ace/OS_NS_Thread.h: + * ace/Numeric_Limits.h: * ace/OS_NS_Thread.inl: * ace/OS_NS_Thread.cpp: - * ace/OS_NS_ctype.cpp: - * ace/OS_NS_netdb.inl: - * ace/OS_NS_pwd.inl: * ace/OS_NS_stdlib.inl: + * ace/OS_NS_sys_select.inl: + * ace/OS_NS_sys_wait.inl: + * ace/OS_NS_time.h: * ace/OS_NS_time.inl: - * ace/OS_NS_time.cpp: - * ace/POSIX_CB_Proactor.cpp: - * ace/POSIX_Proactor.cpp: - * ace/config-cxx-common.h: - * ace/config-doxygen.h: - * ace/config-integritySCA.h: - * ace/config-lynxos.h: - * ace/config-macros.h: - * ace/config-openvms.h: - * ace/config-tandem-nsk-mips-v2.h: - * ace/config-tandem-nsk-mips-v3.h: - * ace/config-vxworks6.4.h: - * ace/config-win32-common.h: + * ace/OS_NS_unistd.inl: + * ace/Profile_Timer.cpp: + * ace/Sched_Params.cpp: + * ace/Stats.cpp: + * ace/Task.cpp: + * ace/Throughput_Stats.cpp: + * ace/Time_Value.h: + * ace/Time_Value.inl: + * ace/Truncate.h: + * ace/UUID.cpp: * ace/os_include/os_pthread.h: - * ace/os_include/os_pwd.h: - * ace/os_include/os_signal.h: - * ace/os_include/os_stdlib.h: - * ace/os_include/os_time.h: - * ace/os_include/sys/os_types.h: - Removed Tru64, Irix, Unixware, and SCO support - - * debian/debian.rules: - Improved - - * examples/QOS/Change_Receiver_FlowSpec/Receiver_QoS_Event_Handler.h: - * examples/QOS/Change_Receiver_FlowSpec/Sender_QoS_Event_Handler.h: - * examples/QOS/Change_Sender_TSpec/Receiver_QoS_Event_Handler.h: - * examples/QOS/Change_Sender_TSpec/Sender_QoS_Event_Handler.h: - * examples/QOS/Simple/Receiver_QoS_Event_Handler.h: - * examples/QOS/Simple/Sender_QoS_Event_Handler.h: - Zapped ACE_RCSID - - * ace/config-irix6.5.x-sgic++.h: - * ace/config-irix6.x-common.h: - * ace/config-irix6.x-g++.h: - * ace/config-irix6.x-sgic++.h: - * ace/config-sco-5.0.0-nothread.h: - * ace/config-sco-5.0.0.h: - * ace/config-unixware-7.1.0.h: - * ace/config-unixware-7.1.0.udk.h: - * include/makeinclude/platform_irix6.x_common.GNU: - * include/makeinclude/platform_irix6.x_g++.GNU: - * include/makeinclude/platform_irix6.x_sgic++.GNU: - * include/makeinclude/platform_tru64_cxx.GNU: - * include/makeinclude/platform_tru64_g++.GNU: - * include/makeinclude/platform_tru64_post.GNU: - * include/makeinclude/platform_tru64_pre.GNU: - * include/makeinclude/platform_unixware_g++.GNU: - Removed the files because Tru64, Irix, Unixware, and SCO support are - removed now - -Wed Sep 8 14:54:45 UTC 2010 William Otte <wotte@zifnab> - - * docs/bczar/bczar.html: + * performance-tests/Server_Concurrency/Latency_Stats.h: + * performance-tests/Server_Concurrency/Leader_Follower/leader_follower.cpp: + * performance-tests/Server_Concurrency/Queue_Based_Workers/workers.cpp: + * performance-tests/UDP/udp_test.cpp: + * tests/Atomic_Op_Test.cpp: + * tests/Basic_Types_Test.cpp: + * tests/CDR_Array_Test.cpp: + Removed support for Tandem NSK. That was the last platform that + needed the emulated versions of ACE_INT64 and ACE_UINT64, that + emulation has now been removed - Updated documentation for removal of Release makefile. + * ace/config-tandem-nsk-mips-v2.h: + * ace/config-tandem-nsk-mips-v3.h: + Removed these files. -Wed Sep 8 14:40:57 UTC 2010 William Otte <wotte@zifnab> +Mon May 14 18:48:14 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * Release: + * performance-tests/Server_Concurrency/Latency_Stats.h: + Fixed conversion warnings - Removing obsolete release makefile. +Sun May 13 17:13:31 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Sep 8 10:57:12 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Sample_History.h: + * ace/Sample_History.inl: + * ace/Sample_History.cpp: + Introduced scale_factor_type traits to handle the fact that the + ACE HighResTimer scale factor is now ACE_UINT64 - * debian/ace.dsc: - * debian/debian.changelog: - * debian/debian.control: - * debian/debian.rules: - * debian/changelog: - * debian/control: - * debian/dsc: - * debian/rules: - Renamed to the names we use on OBS +Sun May 13 12:27:03 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Sep 8 09:11:03 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/High_Res_Timer.h: + Fixed typo - * tests/SSL/Bug_2912_Regression_Test.cpp: - Fixed compile error + * ace/Basic_Stats.h: + * ace/Basic_Stats.cpp: + * ace/Throughput_Stats.h: + * ace/Throughput_Stats.cpp: + Introduced scale_factor_type traits to handle the fact that the + ACE HighResTimer scale factor is now ACE_UINT64 -Wed Sep 8 05:53:24 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Timeprobe_T.cpp: + Use correct trait for the scale factor - * examples/APG/ThreadPools/Futures.cpp: - Added missing include + * performance-tests/RPC/client.cpp: + * performance-tests/SCTP/SOCK_SEQPACK_clt.cpp: + * performance-tests/SCTP/SOCK_STREAM_clt.cpp: + * performance-tests/Server_Concurrency/Latency_Stats.h: + * performance-tests/TCP/tcp_test.cpp: + Use ACE_High_Res_Timer::global_scale_factor_type -Tue Sep 7 17:07:58 UTC 2010 Steve Huston <shuston@riverace.com> +Sat May 12 11:11:45 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Process.h: Noted the affects of handle_inheritance() on Windows. + * ace/Time_Value.h: + * ace/Time_Value.cpp: + None of the windows compilers define ACE_LACKS_LONGLONG_T -Tue Sep 7 14:23:13 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/High_Res_Timer.h: + * ace/High_Res_Timer.inl: + * ace/High_Res_Timer.cpp: + Integrated patches from bugzilla 3703 increasing the precision + of the high resolution timers on windows - * ace/Message_Queue_T.cpp: - * examples/APG/ThreadPools/LF_ThreadPool.cpp: - * examples/APG/ThreadPools/ThreadPool.cpp: - * examples/APG/ThreadSafety/Mutex.cpp: - * examples/APG/Threads/Condition_Variables.cpp: - * protocols/ace/HTBP/HTBP_ID_Requestor.h: - * protocols/ace/TMCast/Group.cpp: - * protocols/ace/TMCast/MTQueue.hpp: - * tests/Bug_3878_Regression_Test.cpp: - * tests/Upgradable_RW_Test.cpp: - Fixed compile problems - -Tue Sep 7 11:35:04 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sat May 12 11:03:57 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/fuzz.pl: - Fix fuzz problem + * ASNMP/asnmp/transaction.cpp: + * Kokyu/Dispatch_Deferrer.cpp: + Compare return value of schedule_timer with -1 -Tue Sep 7 10:52:59 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/OS_NS_time.h: + None of the windows compilers define ACE_LACKS_LONGLONG_T - * Kokyu/DSRT_Direct_Dispatcher_Impl_T.cpp: - Use ACE_GUARD + * bin/PerlACE/TestTarget_WinCE.pm: + Typo fix - * Kokyu/Dispatcher_Task.cpp: - Initialise pointer with 0 +Sat May 12 11:01:50 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * PROBLEM-REPORT-FORM: - * VERSION: - Updated support email addresses + * ace/config-win32-common.h: + None of the windows compilers define ACE_LACKS_LONGLONG_T - * ace/ACE.inl: - Layout changes +Sat May 12 10:54:24 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ACE.cpp: - Layout changes, simplified some ifdef checks + * ace/Numeric_Limits.h: + Fixed typo - * ace/Auto_IncDec_T.h: - * ace/Env_Value_T.h: - Use ACE_Copy_Disabled +Fri May 11 17:42:08 UTC 2012 Steve Huston <shuston@riverace.com> - * ace/Bound_Ptr.inl: - Documentation updates + * ace/Dev_Poll_Reactor.cpp (mask_ops_i): Return -1 if epoll_ctl + fails and we don't recover from it. Fixes Bugzilla #4019. Thanks + to David Simmonds for this fix. - * ace/CORBA_macros.h: - Removed all deprecated macros +Fri May 4 17:25:53 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Dynamic_Service_Base.cpp: - Use ACE_GUARD_RETURN + * ace/Acceptor.cpp: + Fixed incorrect check of the return value of schedule_timer, + an error is indicated with -1, not 0. Thanks to Deux deVille + <dev2 at weitling dot net> for reporting this - * ace/Event_Handler_T.h: - * ace/Event_Handler_T.inl: - * ace/Event_Handler_T.cpp: - Removed checks for ACE_HAS_TEMPLATE_TYPEDEFS, I think all compilers - have this now, let us see if nothing breaks +Thu May 3 07:15:54 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/FILE.h: - Doxygen updates + * tests/Bug_3673_Regression_Test.cpp: + Fixed typo - * ace/Future.h: - * ace/Future.cpp: - Use mutex defines +Wed May 2 18:36:25 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Future_Set.h: - Use ACE_Copy_Disabled + * ace/OS_NS_math.h: + Fixed compile warning with WinCE - * ace/Future_Set.cpp: - Initialise pointer with 0 +Wed May 2 17:08:28 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu> - * ace/Global_Macros.h: - Removed checks for ACE_HAS_TEMPLATE_TYPEDEFS, doxygen changes, make it - possible for users to redefine ACE_GUARD macros + * THANKS: - * ace/Guard_T.h: - * ace/Guard_T.inl: - * ace/Guard_T.cpp: - Doxygen changes, disable ACE_Guard checks for this file + Added Markus Manck <Markus dot Manck at Philotech dot de> - * ace/Hash_Map_Manager_T.h: - * ace/Hash_Multi_Map_Manager_T.h: - * ace/Map_Manager.h: - Update to indicate the usage of ACE_GUARD +Tue May 1 17:38:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/INET_Addr.h: - Doxygen changes + * bin/msvc_mpc_auto_compile.pl: + Added -project_root to override $ACE_ROOT as root to search for + solutions. This is needed when using this script in a flat directory + layout - * ace/Local_Tokens.h: - Disable part of this file for ACE_Guard fuzz check +Tue May 1 12:52:45 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Log_Msg.cpp: - Use ACE_OS::thr_self + * ace/OS_NS_sys_time.cpp: + * ace/config-win32-msvc-10.h: + * ace/config-win32-msvc-8.h: + * ace/config-win32-msvc-9.h: + WinCE also has non conformant timeval. When _USE_32BIT_TIME_T is not + defined we have to use our workaround in all cases - * ace/Malloc_T.h: - Disable part of this file for ACE_Guard fuzz check, doxygen changes +Tue May 1 11:42:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Message_Queue_T.h: - * ace/Message_Queue_T.cpp: - * ace/Message_Queue_Vx.h: - * ace/Message_Queue_Vx.cpp: - Removed ACE_Guard argument to some methods, not used and now cause - fuzz to fail + * ace/os_include/sys/os_stat.h: + Fixed compile error - * ace/Mutex.h: - * ace/Mutex.inl: - Added non const lock(), this fixes bugzilla 3878. Thanks to - Susan Finster <sfinster at daetwyler-rd dot com> for reporting this +Tue May 1 10:25:37 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Null_Barrier.h: - * ace/Null_Condition.h: - * ace/Null_Mutex.h: - * ace/Null_Semaphore.h: - Removed old comments, disable part for ACE_Guard, removed - ACE_Null_Mutex_Guard + * ace/os_include/sys/os_stat.h: + Compile fix for WinCE 7 - * ace/OS_NS_Thread.cpp: - Layout changes, use ACE_Guard +Tue May 1 07:48:30 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_poll.cpp: - * ace/OS_NS_sys_select.cpp: + * ace/Mem_Map.cpp: Layout changes - * ace/OS_NS_sys_socket.inl: - Comment change - - * ace/Read_Buffer.h: - * ace/Remote_Tokens.h: - * ace/SOCK.h: - Doxygen changes - - * ace/SOCK_Connector.h: - * ace/SOCK_Dgram_Mcast.h: - Doxygen changes + * ace/config-win32-msvc-9.h: + Removed wince comment - * ace/SOCK_Connector.cpp: - Layout and const changes +Sun Apr 29 19:17:29 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Select_Reactor.h: - Disable part of this file for ACE_Guard fuzz check + * bin/msvc_mpc_auto_compile.pl: + More improvements to this script - * ace/Service_Gestalt.h: - Use ACE_Copy_Disabled +Sun Apr 29 19:01:08 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Sig_Handler.cpp: - Use ACE_GUARD macros + * bin/msvc_mpc_auto_compile.pl: + Support flat layout - * ace/Synch_Traits.h: - Removed ACE_HAS_TEMPLATE_TYPEDEFS checks +Fri Apr 27 18:43:31 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/TSS_T.h: - * ace/TSS_T.cpp: - Use ACE_Copy_Disabled, reworked some code to fix ACE_Guard fuzz - checks + * bin/msvc_mpc_auto_compile.pl: + Corrected output messages - * ace/Task_Ex_T.h: - Use ACE_Copy_Disabled - - * apps/Gateway/Peer/Peer.cpp: - * apps/JAWS/server/HTTP_Server.cpp: - * apps/JAWS/server/JAWS_IO.cpp: - Initialise pointers with 0 - - * apps/JAWS/server/HTTP_Helpers.cpp: - Use ACE_GUARD macros - - * apps/JAWS2/JAWS/Cache_Hash_T.cpp: - * apps/JAWS2/JAWS/Cache_Manager_T.cpp: - * apps/JAWS2/JAWS/Cache_Object.cpp: - * apps/JAWS2/JAWS/Concurrency.cpp: - * apps/JAWS2/JAWS/FILE.cpp: - * apps/JAWS2/JAWS/Jaws_IO.cpp: - * apps/JAWS2/JAWS/Reaper.cpp: - * apps/JAWS3/jaws3/FILE.cpp: - Use ACE_GUARD macros - - * apps/gperf/src/Options.cpp: - Rename of local variable so that we don't need to disable ACE_OS - fuzz check +Fri Apr 27 18:40:51 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/fuzz.pl: - Improved ACE_Guard checks and enable this one by default + * ace/OS_NS_time.h: + * ace/config-win32-msvc-9.h: + First fixes for WinCE 7 - * bin/generate_doxygen.pl: - Let DANCE use the CIAO version file for the moment +Wed Apr 25 07:02:16 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/make_release.py: - Don't create static and wince solutions as part of the release anymore, - if you use these, generate them by hand in the future. Added vc10 - project files - - * examples/APG/Proactor/HA_Proactive_Status.cpp: - * examples/APG/Reactor/Client.cpp: - * examples/APG/Reactor/HAStatus.cpp: - * examples/APG/Streams/Answerer.cpp: - * examples/APG/Streams/CommandStream.cpp: - * examples/APG/ThreadManagement/Pool.cpp: - * examples/APG/ThreadPools/LF_ThreadPool.cpp: - * examples/APG/ThreadPools/Task_ThreadPool.cpp: - * examples/APG/ThreadSafety/Semaphore.cpp: - * examples/APG/Threads/Message_Blocks.cpp: - * examples/APG/Threads/Message_Queue.cpp: - * examples/ASX/Message_Queue/bounded_buffer.cpp: - * examples/ASX/Message_Queue/priority_buffer.cpp: - * examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp: - * examples/C++NPv2/AIO_Client_Logging_Daemon.cpp: - * examples/C++NPv2/display_logfile.cpp: - * examples/IPC_SAP/UPIPE_SAP/ex1.cpp: - * examples/Reactor/Misc/test_demuxing.cpp: - * examples/Reactor/WFMO_Reactor/Talker.cpp: - * examples/Threads/barrier2.cpp: - * examples/Threads/thread_pool.cpp: - Initialise pointers with 0 + * ace/Get_Opt.cpp: + Reverted Wed Apr 18 08:51:31 UTC 2012 Martin Corino <mcorino@remedy.nl> - * examples/APG/ThreadPools/ThreadPool.cpp: - Use ACE_Thread_ID to store a print a thread id using ACE_DEBUG, that - is the only way that is 100% portable +Tue Apr 24 01:18:27 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * examples/APG/Threads/Guards.cpp: - Disable ACE_Guard fuzz + * ace/String_Base.h (template): Zapped the 'explicit' keywords + introduced by the change in - * examples/Threads/reader_writer.cpp: - * examples/Threads/recursive_mutex.cpp: - Use ACE_GUARD macros + Tue Apr 17 19:09:30 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * examples/Threads/thread_specific.cpp: - * examples/Threads/tss1.cpp: - Removed code not used + since it was breaking too much code. - * include/makeinclude/platform_g++_common.GNU: - Added CROSS_COMPILE support to this file +Wed Apr 18 08:51:31 UTC 2012 Martin Corino <mcorino@remedy.nl> - * include/makeinclude/platform_linux.GNU: - * include/makeinclude/platform_linux_common.GNU: - Moved some bits to platform_g++_common.GNU, works with G++ in - general + * ace/String_Base.h: + Reverted 'explicit' declaration for single arg constructor for + const ACE_TCHAR* as implicit conversion of this arg type to + ACE string class is the expected behaviour (similar to the + STL std::string). - * include/makeinclude/platform_qnx_neutrino.GNU: - * include/makeinclude/platform_qnx_rtp_gcc.GNU: - Cleanup + * ace/Get_Opt.cpp: + Introduced explicit ACE_CString constructor call for single + arg ACE_TCHAR (not pointer) constructor. - * netsvcs/lib/Log_Message_Receiver.h: - * netsvcs/lib/Log_Message_Receiver.cpp: - Use ACE_GUARD macros +Wed Apr 18 06:31:56 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * performance-tests/Misc/Misc.mpc: - Enable test_guard + * ace/Future.cpp: + Fixed commented out guard. Thanks to Andreas Dröscher + <ace at anticat dot ch> for reporting this. - * performance-tests/Misc/test_guard.cpp: - Made this compiling again +Tue Apr 17 19:09:30 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * performance-tests/Synch-Benchmarks/Base_Test/Baseline_Test.cpp: - * performance-tests/TCP/tcp_test.cpp: - Renamed variable to not need ACE_OS fuzz disable code - - * protocols/ace/HTBP/HTBP_ID_Requestor.cpp: - * protocols/ace/HTBP/HTBP_Session.cpp: - Use ACE_GUARD macros - - * protocols/ace/RMCast/Acknowledge.h: - * protocols/ace/RMCast/Acknowledge.cpp: - * protocols/ace/RMCast/Bits.h: - * protocols/ace/RMCast/Flow.h: - * protocols/ace/RMCast/Flow.cpp: - * protocols/ace/RMCast/Fragment.h: - * protocols/ace/RMCast/Fragment.cpp: - * protocols/ace/RMCast/Link.h: - * protocols/ace/RMCast/Link.cpp: - * protocols/ace/RMCast/Parameters.h: - * protocols/ace/RMCast/Protocol.h: - * protocols/ace/RMCast/Protocol.cpp: - * protocols/ace/RMCast/Reassemble.h: - * protocols/ace/RMCast/Reassemble.cpp: - * protocols/ace/RMCast/Retransmit.h: - * protocols/ace/RMCast/Retransmit.cpp: - * protocols/ace/RMCast/Simulator.h: - * protocols/ace/RMCast/Simulator.cpp: - * protocols/ace/RMCast/Socket.h: - * protocols/ace/RMCast/Socket.cpp: - * protocols/ace/RMCast/Stack.h: - * protocols/ace/RMCast/Stack.cpp: - * protocols/ace/TMCast/FaultDetector.hpp: - * protocols/ace/TMCast/Group.cpp: - * protocols/ace/TMCast/Group.hpp: - * protocols/ace/TMCast/GroupFwd.hpp: - * protocols/ace/TMCast/LinkListener.hpp: - * protocols/ace/TMCast/MTQueue.hpp: - * protocols/ace/TMCast/MTQueue.cpp: - * protocols/ace/TMCast/Messaging.hpp: - * protocols/ace/TMCast/Protocol.hpp: - * protocols/ace/TMCast/Protocol.cpp: - * protocols/ace/TMCast/TransactionController.hpp: - Removed commented out code, Id changes, disable ACE_Guard check - for this project + * ace/String_Base.h: Made the single parameter constructors + explicit to avoid problems with implict conversions. Thanks to + Adam Rymarczuk <adam dot rymarczuk at suntradingllc dot com> for + reporting this. - * rpmbuild/ace-tao.spec: - Fixed some problems in this spec file +Thu Apr 12 11:25:25 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * tests/Aio_Platform_Test.cpp: - * tests/Basic_Types_Test.cpp: - * tests/Bug_1576_Regression_Test.cpp: - * tests/Bug_3532_Regression_Test.cpp: - * tests/Bug_3673_Regression_Test.cpp: - * tests/Bug_3709_Regression_Test.cpp: - * tests/Bug_3744_Regression_Test.cpp: - * tests/Compiler_Features_03_Test.cpp: - * tests/Compiler_Features_09_Test.cpp: - * tests/Compiler_Features_13_Test.cpp: - * tests/Compiler_Features_14_Test.cpp: - * tests/Env_Value_Test.cpp: - * tests/Hash_Map_Bucket_Iterator_Test.cpp: - * tests/Logging_Strategy_Test.cpp: - * tests/MT_SOCK_Test.cpp: - * tests/Pipe_Test.cpp: - * tests/Priority_Task_Test.cpp: - * tests/Proactor_UDP_Test.cpp: - * tests/QtReactor_Test.cpp: - * tests/Reactor_Notification_Queue_Test.cpp: - * tests/Reactor_Registration_Test.cpp: - * tests/Reference_Counted_Event_Handler_Test.cpp: - * tests/Time_Service_Test.cpp: - Zapped ACE_RCSID + * include/makeinclude/platform_linux_icc.GNU: + Added support for c++0x - * tests/Message_Block_Test.cpp: - * tests/Multicast_Test_IPV6.cpp: - Initialise pointer with 0 +Tue Apr 10 20:09:23 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * tests/Reader_Writer_Test.cpp: - Use ACE_GUARD + * ace/Dev_Poll_Reactor.cpp (ACE_Dev_Poll_Reactor::resumable_handler): + Changed this method to return 1 instead of 0. Thanks to David + Simmonds <david dot simmonds at iggroup dot com> for providing + this fix. This fixes bugid 4015. - * tests/Recursive_Mutex_Test.cpp: - Disable ACE_Guard fuzz for part of this file + Added David to the ACE hall of fame. - * tests/Bug_3878_Regression_Test.cpp: - New test for bugzilla 3878 +Tue Apr 10 20:10:06 UTC 2012 Adam Mitz <mitza@ociweb.com> - * tests/SSL/Bug_2912_Regression_Test.cpp: - * tests/TP_Reactor_Test.cpp: - Use ACE_GUARD + * bin/MakeProjectCreator/templates/gnu.mpd: - * tests/Simple_Message_Block_Test.cpp: - * tests/Svc_Handler_Test.cpp: - * tests/Thread_Pool_Test.cpp: - * tests/UPIPE_SAP_Test.cpp: - Initialise pointers with 0 + Install the Inline_Files even with inline=0. Many of these files + are still needed, especially *_T.inl. This resolves bug #4002. - * tests/Thread_Mutex_Test.cpp: - Disable ACE_Guard fuzz +Mon Apr 9 21:57:39 UTC 2012 Steve Huston <shuston@riverace.com> - * tests/Upgradable_RW_Test.cpp: - Use ACE_GUARD + * ace/Timer_Queue_T.cpp (calculate_timeout): Lock the mutex before + accessing timer queue elements to calculate the timeout. Thanks to + Kannan Ramaswamy for this fix. - * tests/run_test.lst: - * tests/tests.mpc: - Added 3878 +Sun Apr 8 14:25:23 UTC 2012 Phil Mesnier <mesnier_p@ociweb.com> -Mon Sep 6 09:30:00 UTC 2010 Simon Massey <buildczar at prismtech dot com> + * ace/ace.mpc: - * ace/Acceptor.cpp: - Due to the way the code was formatted, I mistook a do {} while loop for - a while loop with my change. I have corrected this. + Move ace_wchar.inl to the header section so that it is always + installed even when the library is built with inline=0. This is + required because ace_wchar is always inlined. -Mon Sep 6 08:10:00 UTC 2010 Simon Massey <buildczar at prismtech dot com> +Fri Apr 6 11:58:40 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ACE.cpp: - * ace/Acceptor.cpp: - * ace/SOCK_IO.cpp: - * ace/SOCK_Dgram.cpp: - * tests/SOCK_Test.cpp: - * tests/MT_SOCK_Test.cpp: - * NEWS: - Now that release x.8.3. is out, we are attempting to provide the correct - fix to the original commit by Steve Huston related to handle_ready() - (Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com>) - and added back the corresponding NEWS entry. + * docs/Download.html: + Added another rpm -Sat Sep 04 18:08:03 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Apr 6 10:48:03 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> * NEWS: * bin/diff-builds-and-group-fixed-tests-only.sh: - * bin/make_release.py: * docs/Download.html: + * docs/bczar/bczar.html: * etc/index.html: - Updated because of release + Updated for next release -Sat Sep 04 11:30:18 CEST 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Apr 06 09:03:19 CEST 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ACE version 5.8.2 released. + * ACE version 6.1.1 released. -Thu Sep 2 14:46:56 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> +Tue Apr 3 22:49:11 UTC 2012 Steve Huston <shuston@riverace.com> - * ace/Acceptor.cpp: - * ace/SOCK_IO.cpp: - * ace/SOCK_Dgram.cpp: - * ace/ACE.cpp: - * tests/SOCK_Test.cpp: - * tests/MT_SOCK_Test.cpp: - * NEWS: - Reverted both commits by Steve Huston related to handle_ready() - and a NEWS entry. - Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com> - Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com> - This is necessary for a quick release of 1.8.2. + * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): Set the error code when + a Windows API call fails. Also, when calling GetAdaptersAddresses() + to both check size and get the info, supply GAA_FLAG_SKIP_MULTICAST + as the flag value. This avoids obtaining info for joined multicast + addresses, not multicastable interfaces. Without the flag, and if + some other process does a join between the size-check call and the + info-gathering call, the size will be wrong. -Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com> +Tue Apr 3 17:01:33 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu> - * ace/ACE.cpp (handle_ready): Changed the timeout behavior to just - return 0, no errno, as ACE_OS::poll() and ACE_OS::select() both do. - This restores historic behavior changed inadvertently at - Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com> + * THANKS: - * ace/SOCK_Dgram.cpp: - * ace/SOCK_IO.cpp: - * tests/MT_SOCK_Test.cpp: - * tests/SOCK_Test.cpp: Re-added the if/switch on return value from - ACE::handle_read|write_ready() to detect timeout and set errno - here. + Added Thomas Stegemann <Thomas dot Stegemann at materna dot de>. - These changes were necessary to fix the TAO faults test. Thanks - to Johnny and Simon for narrowing down the cause and testing - the fix. +Tue Apr 3 16:18:35 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> -Wed Sep 1 15:58:47 UTC 2010 Adam Mitz <mitza@ociweb.com> + * ace/ACE.cpp (ACE::timestamp): Fixed an "off-by-one" error that + caused corruption of timestamps when using + ACE_LOG_TIMESTAMP="TIME" env var. Thanks to Andrea Sormanni + <andrea dot sormanni at gmail dot com> for reporting this and + providing a fix. - * bin/MakeProjectCreator/templates/gnu.mpd: + Added Andrea to the Hall of Fame! - Changed the short-circuit logic for the .NOTPARALLEL checks to || - instead of &&. If any one file is newer, we will have to rebuild. - Also added a missing foreach for the output files with dependent libs. +Fri Mar 30 14:33:58 UTC 2012 Steve Huston <shuston@riverace.com> -Wed Sep 1 09:59:42 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * examples/C++NPv1/Process_Per_Connection_Logging_Server.cpp: Changed + use of ::sscanf_s() to only those platforms with the setting + ACE_HAS_TR24731_2005_CRT (VC8 and up). - * tests/Time_Value_Test.cpp: - Fixed compile warning on QNX. time_t on QNX is defined as unsigned - int. +Fri Mar 30 13:39:25 UTC 2012 Adam Mitz <mitza@ociweb.com> -Tue Aug 31 16:53:07 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + * include/makeinclude/platform_win32_msvc.GNU: - * THANKS: + Added iphlpapi to the list of system libraries. - Added Catherine L. Paquin <catherine dot paquin at ngc dot com>. +Thu Mar 29 21:50:17 UTC 2012 Adam Mitz <mitza@ociweb.com> -Tue Aug 31 14:40:17 UTC 2010 Adam Mitz <mitza@ociweb.com> + * bin/MakeProjectCreator/templates/gnu.mpd: - * NEWS: + Postbuild steps need a dependency on the executable or library + so that parallel make will run them at the right time. - Updated to proper name of Visual Studio 2010, which may assist - those searching for it in the NEWS file. +Wed Mar 28 22:03:45 UTC 2012 Steve Huston <shuston@riverace.com> -Tue Aug 31 12:56:36 UTC 2010 Steve Huston <shuston@riverace.com> + * examples/C++NPv1/Process_Per_Connection_Logging_Server.cpp: Changed + the +H handle value scan to know this is a hex value on Windows, but + a decimal value on everything else. Thanks to Andy Gokhale for this. - * NEWS: Added an entry for the change at - Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com> +Wed Mar 28 21:44:20 UTC 2012 Steve Huston <shuston@riverace.com> - * ace/README: - * ace/config-sunos5.6.h: - * ace/config-sunos5.7.h: Removed all mention of ACE_HAS_LIMITED_SELECT. + * tests/Multicast_Test.cpp: Removed the forced set_nic to "lo" for + Linux. It's not needed with the changes from: + Wed Mar 21 21:57:40 UTC 2012 Steve Huston <shuston@riverace.com> -Mon Aug 30 18:41:24 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Mar 26 11:27:11 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ace.mpc: - Added Obstack.h + * include/makeinclude/platform_mingw32.GNU: + Added iphlpapi -Mon Aug 30 16:48:34 UTC 2010 Steve Huston <shuston@riverace.com> +Sat Mar 24 21:53:13 UTC 2012 Steve Huston <shuston@riverace.com> - * ace/FIFO.h: - * ace/FIFO_Recv.h: - * ace/FIFO_Send.h: Clarified initialization and open behavior. + * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): For Windows, handle IPv6 + and IPv4 differently. The make_multicast_ifaddr() call that will end + up being made for IPv4 wants the interface's IP address, not name. -Mon Aug 30 15:33:57 UTC 2010 Steve Huston <shuston@riverace.com> + * bin/MakeProjectCreator/config/acedefaults.mpb: + * bin/MakeProjectCreator/config/ipv6.mpb: Moved the lit_lib for iphlpapi + on Windows from the IPv6 base to acedefaults. SOCK_Dgram_Mcast.cpp + uses it for both IPv4 and IPv6 now. - * ace/Process.h (set_handles): Add a note that passing a socket handle - with this mechanism does not work on Windows. +Fri Mar 23 22:06:11 UTC 2012 Steve Huston <shuston@riverace.com> -Mon Aug 30 10:06:24 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/WIN32_Asynch_IO.cpp: Fixed possible heap corruption in + ACE_SOCK_Dgram_Read_Dgram::recv(). Thank you to + Dmytro Ovdiienko <dmitriy.ovdienko@gmail.com> for unconvering this. - * examples/Reactor/Proactor/test_proactor2.cpp: - * examples/Reactor/Proactor/test_proactor3.cpp: - * tests/Proactor_Test.cpp: - * tests/Proactor_Test_IPV6.cpp: - * tests/Proactor_UDP_Test.cpp: - ACE_Guard changes - -Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com> - - * ace/ACE.cpp (handle_ready, handle_timed_complete, - handle_timed_accept): On platforms where poll() is - available, prefer that to using select() for checking a single - handle's state and/or waiting for a condition. This preference - was previously only used if ACE_HAS_LIMITED_SELECT was set. The - ACE_HAS_LIMITED_SELECT choice is removed, making ACE_HAS_POLL the - setting that switches this preference. The driving reason for this - is that if select() is called to detect changes on a handle whose - values falls outside that which can safely be stored in an fdset, - the handle-setting macros/functions will set/clear bits outside - of the fdset. This results in very weird memory changes, often in - the stack, which are very hard to diagnose. poll()'s operation - does not suffer from this affect. With the growing use of large - numbers of handles and use of ACE_Dev_Poll_Reactor on Linux, - the rate at which this problem was cropping up was increasing. - Thanks to Olivier Langlois for diagnosing this problem and - proposing the patch. - - (handle_ready): Properly set the poll condition for read and/or - write. Thanks to kumaran.prem@gmail.com for this fix. + * THANKS: Added Dmytro to the Hall of Fame. - * ace/Acceptor.cpp: - * ace/SOCK_IO.cpp: - * ace/SOCK_Dgram.cpp: - * tests/MT_SOCK_Test.cpp: - * tests/SOCK_Test.cpp: Replaced use of ACE_OS::select() with - ACE::handle_ready() and friends. +Thu Mar 22 16:23:14 UTC 2012 Steve Huston <shuston@riverace.com> - This all resolves Bugzilla #3606. + * ace/SOCK_Dgram_Mcast.h: Corrected the description of conditions + under which using OPT_NULLIFACE_ALL works and neatened things up. -Fri Aug 27 19:10:16 UTC 2010 Brian Johnson <johnsonb@ociweb.com> + * tests/Multicast_Test.cpp: Turn on IP_MULTICAST_LOOP all the time. + This test requires it and it's not universally the default. - * bin/MakeProjectCreator/templates/gnu.mpd: +Thu Mar 22 13:03:46 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Merging dependent_libs support for gnuace from TAO 1.5a. - (Bugzilla #3281) + * ace/ARGV.cpp: + * ace/Acceptor.cpp: + * ace/Asynch_Acceptor.cpp: + * ace/Cached_Connect_Strategy_T.cpp: + * ace/Lib_Find.cpp: + * ace/Strategies_T.cpp: + * ace/Timer_Heap_T.cpp: + Fixed coverity errors + +Wed Mar 21 21:57:40 UTC 2012 Steve Huston <shuston@riverace.com> + + * ace/SOCK_Dgram_Mcast.cpp (subscribe_ifs): Expanded the use of + code to scan interfaces to be always, not just for IPv6, when + subscribing with OPT_NULLIFACE_ALL and no specific interface. + Also replaced use of ACE_OS::if_nameindex with getifaddr() when + it's available (which was only on Linux anyway) so checks + for interface up and multicastable can be made before joining. + The code now works for systems with ACE_HAS_GETIFDADDR (incl. + Linux, which was my main issue driving this) and Win32. The others + end up in the old get_ip_interfaces code which will never work + anywhere as far as I can tell because it tries to subscribe to an + interface named with the IP address in string form. + + * tests/Multicast_Test.cpp: Removed hack force of interface "lo0" + on join(). No need for that with the fix above. For background, this + was added at: + Thu Jan 21 15:25:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + + * ace/Sock_Connect.cpp (get_ip_interfaces_getifaddr): Will no longer + return an interface marked 'down'. Partially fixes Bugzilla #1990 + but other platform-specific changes are needed to resolve it + completely. + +Sat Mar 17 12:16:15 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Aug 27 18:36:37 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * docs/Download.html: + Added link to the mailing lists with an advice for people to subscribe - * ace/OS_NS_Thread.h: - * ace/OS_NS_Thread.inl: - Added assignment operator for ACE_Thread_Id +Sat Mar 17 12:11:15 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Aug 27 15:01:41 UTC 2010 Steve Huston <shuston@riverace.com> + * bin/cleanbuilds.sh: + * bin/diff-builds.pl: + Updated teststat links - * Connector.{h cpp} (ACE_NonBlocking_Connect_Handler): Add a - handle_close() which calls handle_input() if called by the - ACE_Dev_Poll_Reactor to remove a failed connect. Apparently, - Linux epoll, at least sometimes, signals EPOLLERR on a failed - nonblocking connect, unlike the select() case which selects the - failed fd for read. Thanks to Kannan Ramaswamy <kannan dot - ramaswamy at cogcap dot com> for this information and fix. +Wed Mar 14 10:04:06 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * THANKS: Added Kannan to the Hall of Fame. + * docs/Download.html: + Added link to ORBZone as community site for CORBA/CCM -Fri Aug 27 14:17:56 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * tests/run_test.lst: + Mark 4008 as not fixed - * ace/Atomic_Op.h: - Doxygen changes +Tue Mar 13 11:24:33 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_Thread.cpp: - Use ACE_GUARD + * ace/Service_Gestalt.cpp: + Reverted change below, breaks Missing_Svc_Conf_Test test - * bin/fuzz.pl: - Added check for ACE_Guard +Tue Mar 13 09:36:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Aug 27 06:56:11 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Service_Gestalt.cpp: + Fixed bugzilla 4008, thanks to Derek Dominish + <derek dot dominish at dsto dot defence dot gov dot au> for + creating the fix - * etc/ace.doxygen: - * etc/acexml.doxygen: - Fuzz fixes +Tue Mar 13 09:29:56 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Thu Aug 26 13:20:48 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * tests/Bug_4008_Regression_Test.cpp: + * tests/run_test.lst: + * tests/tests.mpc: + New test for bugzilla 4008. Thanks to Derek Dominish + <derek dot dominish at dsto dot defence dot gov dot au> for + creating this test - * bin/diff-builds-and-group-fixed-tests-only.sh: - Added DANCE_ROOT +Mon Mar 12 20:22:17 UTC 2012 Adam Mitz <mitza@ociweb.com> -Thu Aug 26 13:08:56 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * include/makeinclude/rules.local.GNU: - * netsvcs/servers/servers.mpc: - Use ace_netsvcs as executable name, this makes more sense when - we install this file in a target directory + Revert this part of Friday's change, with a comment added + to describe why this use of 'pwd' is different. -Thu Aug 26 13:04:06 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Mar 9 20:38:22 UTC 2012 Adam Mitz <mitza@ociweb.com> - * bin/fuzz.pl: - Check doxygen files for tabs + * include/makeinclude/rules.lib.GNU: - * etc/ace.doxygen: - * etc/ace_inet.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - * html/index.html: - Changed documentation subdirectories to make debian packaging easier + When creating an archive library, use all object files instead of + just modified object files. This fixes a bug that can occur when + two different subdirectories have objects files with the same name. + The archive dosn't track directory names so "replacing" one changed + object could actually be clobbering another one. -Thu Aug 26 12:30:33 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * include/makeinclude/rules.local.GNU: - * debian/control: - Made some fixes for x.8.1 + Use the $(PWD) make variable for current directory. -Thu Aug 26 11:54:15 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Mar 7 14:58:07 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/auto_run_tests.pl: - Extended script to also check for $DANCE_ROOT/bin/dance_tests.lst + * docs/Download.html: + Added new download link for latest minor with versioned namespaces -Thu Aug 26 10:20:41 UTC 2010 Martin Corino <mcorino@remedy.nl> +Wed Mar 7 14:37:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/OS_NS_Thread.cpp: - Changes implementing the patches from Bugzilla #3653 (with - changes and some rejects; *no* asserts allowed in ACE). + * rpmbuild/ace-tao.spec: + Fix for ppc64 -Wed Aug 25 19:58:19 UTC 2010 Steve Huston <shuston@riverace.com> +Wed Mar 7 13:31:58 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Dev_Poll_Reactor.{h cpp}: Regarding change number 2 at - Fri Mar 26 14:07:55 UTC 2010 Steve Huston <shuston@riverace.com> - dispatching notifies in only one thread at a time was 1) wrong - (TP_Reactor doesn't do this), 2) broke important existing - applications at a customer site. This has been fixed so that the - notify dispatch behavior is like ACE_TP_Reactor: when the - notify handle is signaled, extract one notification, release - the token, dispatch the notification. Thus, each thread will - dispatch one notification, and multiple threads can dispatch - them at the same time if there are multiples. + * ace/Base_Thread_Adapter.h: + * ace/Base_Thread_Adapter.cpp: + * ace/ETCL/ETCL_Constraint.inl: + * ace/Module.cpp: + * ace/Stream.cpp: + * ace/Thread_Manager.h: + * ace/Timer_Hash_T.cpp: + Fixed coverity errors - Also fixed an error where it was possible to lose notice of a - notification. Resolves Bugzilla #3328. +Wed Mar 7 10:55:28 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Aug 25 09:49:41 UTC 2010 Martin Corino <mcorino@remedy.nl> + * rpmbuild/ace-tao.spec: + Added new libraries - * ace/Arg_Shifter.h: - * ace/config-macosx-leopard.h: - * ace/Guard_T.h: - * ace/Global_Macros.h: - Selected changes from patches in Bugzilla 3652. +Wed Mar 7 10:02:49 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Aug 24 14:21:01 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * NEWS: + * bin/diff-builds-and-group-fixed-tests-only.sh: + * docs/Download.html: + * docs/bczar/bczar.html: + * etc/index.html: + Updated for release - * ace/OS_NS_Thread.h: - Layout changes +Wed Mar 07 09:04:40 CET 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-win32-common.h: - Improved MinGW GCC 4.4 support. Thanks to - Jani Hakala <jani dot j dot hakala at jyu dot fi> for creating the - patch + * ACE version 6.1.0 released. -Tue Aug 24 14:15:45 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> +Sat Mar 3 20:48:15 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Log_Msg.cpp - * ace/Log_Msg.h - * tests/Log_Msg_Test.cpp - Revert changes for logging thread id as argument. + * ace/Thread_Manager.cpp: + Coverity fix -Tue Aug 24 12:59:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Sat Mar 3 20:45:30 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/ace/INet/ClientRequestHandler.h: - * protocols/ace/INet/URLBase.h: - * protocols/ace/INet/HTTP_ClientRequestHandler.h: - Changes to fix export problems with nested classes with MSVC 7/8. + * ace/Event_Handler_Handle_Timeout_Upcall.cpp: + Coverity fix -Tue Aug 24 11:29:45 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> +Sat Mar 3 20:22:09 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Log_Msg.h: - * ace/Log_Msg.cpp: - * tests/Log_Msg_Test.cpp: - * ChangeLog: - Add %#t to log a thread id that is coming from user code, as argument . + * ace/Compression/rle/RLECompressor.h: + Fixed export macro -Mon Aug 23 19:51:59 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> +Fri Mar 2 12:41:21 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * tests/Missing_Svc_Conf_Test.cpp: + * ace/Compression/rle/RLECompressor.h: + Fixed export macro - Fix some scoreboard problems. +Wed Feb 29 16:30:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> -Mon Aug 23 15:05:56 UTC 2010 Adam Mitz <mitza@ociweb.com> + * ace/CDR_Stream.cpp: + Allow strings to be indirected (required for ValueType RepoIDs). - * ace/Select_Reactor.h: +Wed Feb 29 07:25:21 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - vc10 needs an "ACE_Export" declaration on the explicit template - instantiation of ACE_Select_Reactor. + * ace/Handle_Set.cpp: + * ace/Select_Reactor_Base.cpp: + * ace/Service_Types.cpp: + Fixed coverity errors -Mon Aug 23 13:23:03 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue Feb 28 14:35:36 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-kfreebsd.h: - New config file for kfreebsd + * ace/Process.cpp: + Fixed coverity error - * ace/config-win32-common.h: - Removed commented out defines +Tue Feb 28 03:27:28 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> -Mon Aug 23 11:57:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * + apps/JAWS3/jaws3/Reactive_IO.cpp (JAWS_IO_Reactive_Transmit::handle_output_source): + Check mb == 0 before using it. Thanks to Andrey Karpov <karpov + at viva64 dot com> for reporting this. - * protocols/ace/INet/INet_SSL_Export.h: - * protocols/ace/INet/HTTPS_Context.h: - * protocols/ace/INet/HTTPS_SessionFactory.h: - * protocols/ace/INet/HTTPS_URL.h: - * protocols/ace/INet/SSL_CallbackManager.h: - * protocols/ace/INet/SSL_CertificateCallback.h: - * protocols/ace/INet/SSL_PasswordCallback.h: - * protocols/ace/INet/SSL_X509Cert.h: - * protocols/ace/INet/inet_ssl.mpc: - Changes to fix MSVC 7/8 link errors. +Tue Feb 28 03:18:56 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> -Mon Aug 23 11:34:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/Throughput_Stats.cpp (ACE_Throughput_Stats::sample): Zapped + a redundant else statement. Thanks to Andrey Karpov <karpov at + viva64 dot com> for reporting this. - * protocols/ace/INet/HTTPS_URL.h: - Fixed GCC41 error concerning comma at end of enum list. +Tue Feb 28 03:15:37 UTC 2012 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> -Sat Aug 21 12:53:05 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + * protocols/ace/INet/URLBase.cpp (ACE): Changed - * tests/Missing_Svc_Conf_Test.cpp: + if (pos > 0 && url_string[pos+1] == '/' && url_string[pos+1] == '/') - Added a descriptive comment block to the source. + to -Fri Aug 20 13:29:22 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + if (pos > 0 && url_string[pos+1] == '/' && url_string[pos+2] == '/') - * ace/Service_Gestalt.cpp: + Thanks to Andrey Karpov <karpov at viva64 dot com> for reporting + this. - One more shot at fixing the behavior of the service configurator - in the face of missing defaulted svc.conf file. +Mon Feb 27 08:11:06 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * tests/Missing_Svc_Conf_Test.cpp: - * tests/run_test.lst: - * tests/tests.mpc: + * ace/Compression/rle/RLECompressor.h: + Doxygen fix - Added a proper test to ensure changes to this behavior are caught - in the future. + * ace/Compression/rle/RLECompressor.cpp: + Fixed gcc warning -Fri Aug 20 11:58:20 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Feb 24 09:19:40 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/TSS_T.cpp: - Updated comment + * ace/Compression/Compressor.h: + Fixed compile warning - * include/makeinclude/platform_g++_common.GNU: - If minimaltoc is set to 1, add -mminimal-toc to compiler flags +Fri Feb 24 09:14:22 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * include/makeinclude/platform_linux.GNU: - Removed check for ppc64, if you build for ppc64 and need -mminimal-toc - add minimaltoc=1 to your platform_macros.GNU file + * ace/Compression/Compressor.h: + * ace/Compression/Compressor.cpp: + * ace/Compression/rle/RLECompressor.h: + * ace/Compression/rle/RLECompressor.cpp: + Added virtual destructors -Fri Aug 20 09:52:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Fri Feb 24 08:45:08 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * protocols/ace/INet/inet_ssl.mpb: - Removed feature subproject config. + * ace/Compression/ACE_Compression.mpc: + * ace/Compression/rle/ACE_RLECompression.mpc: + Fixed id and install problems - * protocols/ace/INet/inet_ssl.mpc: - Added sublibrary project I forgot yesterday. + * bin/fuzz.pl: + Extended check for incorrect id tags -Thu Aug 19 12:37:14 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Thu Feb 23 08:20:56 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Functor_T.h: - Doxygen changes + * ace/Compression/Compressor.h: + * ace/Compression/rle/RLECompressor.h: + * bin/MakeProjectCreator/config/ace_compressionlib.mpb: + * bin/MakeProjectCreator/config/ace_rlecompressionlib.mpb: + Fuzz fixes - * include/makeinclude/platform_linux.GNU: - Make it possible to control -mminimal-toc through the - platform_macros.GNU file using minimaltoc +Thu Feb 23 07:52:58 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/Compression: + * ace/Compression/ACE_Compression.mpc: + * ace/Compression/ACE_Compression_export.h: + * ace/Compression/Compressor.h: + * ace/Compression/Compressor.inl: + * ace/Compression/Compressor.cpp: + * ace/Compression/rle: + * ace/Compression/rle/ACE_RLECompression.mpc: + * ace/Compression/rle/ACE_RLECompression_export.h: + * ace/Compression/rle/RLECompressor.h: + * ace/Compression/rle/RLECompressor.cpp: + * bin/MakeProjectCreator/config/ace_compressionlib.mpb: + * bin/MakeProjectCreator/config/ace_rlecompressionlib.mpb: + Added new ACE compression and rle compressor libraries. This code + was first part of TAO, but now moved to ACE because it provides + a basic run length encoding compressor that makes it possible to + compress data without depending on any external library -Thu Aug 19 12:09:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * docs/bczar/bczar.html: + Added package - * bin/MakeProjectCreator/config/inet.mpb: - * bin/MakeProjectCreator/config/inetssl.mpb: - * protocols/ace/INet/inet.mpc: - * protocols/ace/INet/inet_ssl.mpb: - Changes to split INet into 2 libraries; regular and SSL. - Fixes dependencies of DAnCE tools on SSL. +Tue Feb 21 14:52:02 UTC 2012 Adam Mitz <mitza@ociweb.com> -Wed Aug 18 09:26:04 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * ace/OS_NS_Thread.inl: + * ace/config-vxworks6.9.h: - * netsvcs/lib/Client_Logging_Handler.cpp: - Fixed a compile warning. + Fixed errors from fuzz script. -Tue Aug 17 07:34:31 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> +Tue Feb 21 14:37:47 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/CDR_Stream.cpp - Add Id + * PROBLEM-REPORT-FORM: + Removed build method question -Mon Aug 16 22:00:06 UTC 2010 Adam Mitz <mitza@ociweb.com> +Fri Feb 17 23:10:37 UTC 2012 Adam Mitz <mitza@ociweb.com> - * examples/Reactor/Misc/Reactor_Misc.mpc: + * NEWS: + * ace/Message_Queue_T.cpp: + * ace/Message_Queue_Vx.cpp: + * ace/OS_NS_Thread.inl: + * ace/OS_NS_arpa_inet.cpp: + * ace/OS_NS_unistd.inl: + * ace/Stack_Trace.cpp: + * ace/config-vxworks.h: + * ace/config-vxworks6.9.h: + * ace/os_include/sys/os_types.h: + * include/makeinclude/platform_vxworks.GNU: + * include/makeinclude/platform_vxworks6.9.GNU: + * tests/Bug_3943_Regression_Test.cpp: - Explicitly list an empty Template_Files so that the *_t.cpp doesn't - get added to Template_Files. + Added support for VxWorks version 6.9. -Mon Aug 16 12:58:31 UTC 2010 Marijke Hengstmengel <mhengstmengel@remedy.nl> +Tue Feb 14 22:57:00 UTC 2012 William R. Otte <wotte@dre.vanderbilt.edu> - * ace/Auto_Event.cpp: - * ace/CDR_Stream.cpp: - * ace/Cleanup.cpp: - * ace/Codecs.cpp: - * ace/DEV_Addr.cpp: - * ace/Dynamic_Service_Base.cpp: - * ace/Filecache.cpp: - * ace/Flag_Manip.cpp: - * ace/FlReactor/FlReactor.cpp: - * ace/FoxReactor/FoxReactor.cpp: - * ace/Handle_Ops.cpp: - * ace/Hashable.cpp: + * ace/ACE.cpp: + * ace/Dev_Poll_Reactor.cpp: + * ace/Handle_Set.cpp: + * ace/High_Res_Timer.h: + * ace/High_Res_Timer.cpp: + * ace/INET_Addr.h: * ace/INET_Addr.cpp: - * ace/Init_ACE.cpp: - * ace/Local_Tokens.cpp: - * ace/Logging_Strategy.cpp: - * ace/Malloc.cpp: - * ace/MEM_Addr.cpp: - * ace/Message_Block.cpp: - * ace/Method_Request.cpp: - * ace/Multihomed_INET_Addr.cpp: - * ace/Name_Request_Reply.cpp: - * ace/OS_NS_string.cpp: - * ace/OS_Thread_Adapter.cpp: - * ace/Parse_Node.cpp: - * ace/Ping_Socket.cpp: - * ace/POSIX_Asynch_IO.cpp: - * ace/POSIX_CB_Proactor.cpp: - * ace/Proactor.cpp: - * ace/Proactor_Impl.cpp: - * ace/Process_Manager.cpp: - * ace/QoS/QoS_Decorator.cpp: - * ace/QoS/QoS_Manager.cpp: - * ace/QoS/QoS_Session_Factory.cpp: - * ace/QoS/QoS_Session_Impl.cpp: - * ace/QoS/SOCK_Dgram_Mcast_QoS.cpp: - * ace/Reactor.cpp: - * ace/Refcountable_T.cpp: - * ace/Remote_Name_Space.cpp: - * ace/Select_Reactor_Base.cpp: - * ace/Service_Config.cpp: - * ace/Service_Gestalt.cpp: - * ace/Shared_Memory_SV.cpp: - * ace/Singleton.cpp: - * ace/Sock_Connect.cpp: - * ace/SSL/SSL_Asynch_BIO.cpp: - * ace/SSL/SSL_Asynch_Stream.cpp: - * ace/SSL/SSL_Context.cpp: - * ace/SSL/SSL_SOCK.cpp: - * ace/SSL/SSL_SOCK_Acceptor.cpp: - * ace/SSL/SSL_SOCK_Connector.cpp: - * ace/SSL/SSL_SOCK_Stream.cpp: - * ace/SString.cpp: - * ace/Svc_Conf.y - * ace/Svc_Conf_y.cpp: - * ace/Task.cpp: - * ace/Thread_Manager.cpp: - * ace/Timer_Hash_T.cpp: - * ace/TkReactor/TkReactor.cpp: - * ace/Token_Collection.cpp: - * ace/WIN32_Asynch_IO.cpp: + * ace/Monitor_Control/Bytes_Received_Monitor.h: + * ace/Monitor_Control/Bytes_Received_Monitor.cpp: + * ace/Monitor_Control/Bytes_Sent_Monitor.h: + * ace/Monitor_Control/Bytes_Sent_Monitor.cpp: + * ace/Monitor_Control/CPU_Load_Monitor.h: + * ace/Monitor_Control/CPU_Load_Monitor.cpp: + * ace/Monitor_Control/Linux_Network_Interface_Monitor.h: + * ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp: + * ace/Monitor_Control/Num_Threads_Monitor.h: + * ace/Monitor_Control/Num_Threads_Monitor.cpp: + * ace/Monitor_Control/Packets_Received_Monitor.h: + * ace/Monitor_Control/Packets_Received_Monitor.cpp: + * ace/Monitor_Control/Packets_Sent_Monitor.h: + * ace/Monitor_Control/Packets_Sent_Monitor.cpp: + * ace/OS_NS_netdb.cpp: + * ace/OS_NS_sys_socket.h: + * ace/OS_NS_sys_socket.inl: + * ace/OS_NS_time.inl: + * ace/OS_NS_unistd.inl: + * ace/SOCK_Dgram.cpp: + * ace/SOCK_Dgram_Mcast.cpp: + * ace/Select_Reactor_T.cpp: + * ace/config-linux.h: + * ace/os_include/os_pthread.h: + * apps/JAWS/clients/WebSTONE/src/nsapi-includes/base/systems.h: + * examples/APG/Signals/SigInfo.cpp: + * tests/INET_Addr_Test_IPV6.cpp: + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + * tests/Malloc_Test.cpp: + * tests/Multicast_Test.cpp: + * tests/Naming_Test.cpp: + * tests/Proactor_Test.cpp: + * tests/Proactor_Test_IPV6.cpp: + * tests/Proactor_UDP_Test.cpp: + * tests/Process_Test.cpp: + * tests/SSL/Bug_2912_Regression_Test.cpp: + + Created a new macro, ACE_LINUX, which replaces all non-standard + tests for linux, __linux, and __linux__. + +Mon Feb 13 16:38:15 UTC 2012 Adam Mitz <mitza@ociweb.com> + + * include/makeinclude/platform_gnuwin32_common.GNU: + + Set DCCFLAGS and OCCFLAGS to get debug=X and optimize=X to work. + +Tue Feb 7 12:56:41 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/XtReactor/XtReactor.cpp: - Removed ACE_RCSID + Use C++ cast to silence warning -Thu Aug 12 16:07:55 UTC 2010 Steve Huston <shuston@riverace.com> +Tue Jan 31 20:19:16 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * configure.ac: Added feature test for ACE_LACKS_STRUCT_LIFNUM. + * examples/Web_Crawler/Iterators.cpp: + * performance-tests/Misc/context_switch_time.cpp: + Fixed gcc 4.7 warning -Thu Aug 12 08:39:31 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue Jan 31 20:17:35 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * rpmbuild/ace-tao.spec: - Fixed problem compiling FC packages on OSB + * examples/IPC_SAP/SOCK_SAP/CPP-memclient.cpp: + Fixed gcc 4.7 warning -Wed Aug 11 20:50:37 UTC 2010 Adam Mitz <mitza@ociweb.com> +Mon Jan 30 09:48:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> - * bin/MakeProjectCreator/templates/gnu.mpd: + * ace/Default_Constants.h: + Redefined ACE_MAX_UDP_PACKET_SIZE to 65507 bytes. The actual field size + sets a theoretical limit of 65,535 bytes (so 65536 was completly wrong) + which is composed of 8 byte header +65,527 bytes of data for a UDP datagram. + However the practical limit for the data length which is imposed by the + underlying IPv4 protocol is only 65,507 bytes (65507 bytes of data +8 bytes + UDP header +20 bytes IP header). - With ARCH set, we need to create the local ARCH directory for the - executable in case there are no object files that would otherwise - have required it. +Fri Jan 27 09:39:57 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Aug 11 13:45:52 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/FlReactor/FlReactor.cpp: + Const change - * ace/config-g++-common.h: - Only enable GCC builtin atomic op when threads are enabled. Thanks to - Rafi <rafi dot net at gmail dot com> for reporting this + * bin/valgrind.supp: + Added another suppress -Tue Aug 10 17:24:05 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Jan 27 09:01:51 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ACEXML/apps/svcconf/Svcconf.cpp: - Fixed compile problem + * NEWS: + * bin/diff-builds-and-group-fixed-tests-only.sh: + * bin/make_release.py: + * docs/Download.html: + * docs/bczar/bczar.html: + * etc/index.html: + Updated for next release -Tue Aug 10 08:55:17 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Fri Jan 27 08:58:54 CET 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Makefile.am: - Removed zapped file + * ACE version 6.0.8 released. -Mon Aug 9 17:14:27 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> +Thu Jan 26 20:38:47 UTC 2012 Phil Mesnier <mesnier_p@ociweb.com> - * THANKS: + * ace/Condition_T.cpp: - Added Robert Shectman <shectman at llnl dot gov> + In order to allow building with inlining on MacOSX Lion, + Condition_T.cpp needs to explicitly include Time_Value.h. In many + cases, Time_Value.h was being incidentally included, such as + through Atomic_Op_GCC_T.cpp, but that is specifically excluded for + Lion builds using the clang compiler. -Mon Aug 9 16:02:08 UTC 2010 Adam Mitz <mitza@ociweb.com> +Tue Jan 24 16:44:22 UTC 2012 Chip Jones <jonesc@ociweb.com> - * include/makeinclude/platform_vxworks6.3.GNU: - * include/makeinclude/platform_vxworks6.8.GNU: + * NEWS: + Added information about IDL dependency generation. - The location of user-mode (RTP) libraries has changed in 6.8. +Tue Jan 24 15:26:24 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Mon Aug 9 15:14:43 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/MakeProjectCreator/config/conv_lib.mpb: + Fixed cleanup bug - * ACEXML/apps/svcconf/Svcconf_Handler.cpp: - Zap emulated exception macros +Tue Jan 24 14:40:00 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-macros.h: - Only define ACE_HAS_EXCEPTIONS when it is not defined yet + * bin/fuzz.pl: + Can't check mpc files, when they contain gnuace specific stuff they + need tabs -Mon Aug 9 06:38:34 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue Jan 24 14:29:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-sunos5.5.h: - Fixed compile error + * bin/fuzz.pl: + Fixed problem -Mon Aug 9 06:35:14 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Tue Jan 24 13:52:20 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/ace.mpc: - Removed zapped file + * bin/fuzz.pl: + Also check mpc files for tabs + +Tue Jan 24 13:48:49 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * apps/JAWS2/HTTPU/httpu.mpc: + * apps/JAWS2/JAWS/jaws2.mpc: + * apps/JAWS3/jaws3/jaws3.mpc: + * apps/gperf/tests/gperf_test.mpb: + * bin/MakeProjectCreator/config/ace_bzip2.mpb: + * bin/MakeProjectCreator/config/ace_fl.mpb: + * bin/MakeProjectCreator/config/ace_fox.mpb: + * bin/MakeProjectCreator/config/ace_openssl.mpb: + * bin/MakeProjectCreator/config/ace_output.mpb: + * bin/MakeProjectCreator/config/ace_qt.mpb: + * bin/MakeProjectCreator/config/ace_tk.mpb: + * bin/MakeProjectCreator/config/ace_x11.mpb: + * bin/MakeProjectCreator/config/ace_xt.mpb: + * bin/MakeProjectCreator/config/ace_zlib.mpb: + * bin/MakeProjectCreator/config/ace_zzip.mpb: + * bin/MakeProjectCreator/config/acedefaults.mpb: + * bin/MakeProjectCreator/config/conv_lib.mpb: + * bin/MakeProjectCreator/config/wxwindows.mpb: + * netsvcs/servers/servers.mpc: + * performance-tests/Synch-Benchmarks/Base_Test/Synch_Benchmarks_Base_Test.mpc: + * performance-tests/Synch-Benchmarks/Perf_Test/Synch_Benchmarks_Perf_Test.mpc: + * tests/tests.mpc: + Removed left over from automake removal -Sun Aug 8 23:31:32 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> +Tue Jan 24 13:31:49 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/config-macosx-snowleopard.h: + * examples/Reactor/WFMO_Reactor/Network_Events.cpp: + Fixed gcc warning - Clang uses ACE_ANY_OPS_USE_NAMESPACE. +Mon Jan 23 20:21:50 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Aug 6 17:36:45 UTC 2010 Adam Mitz <mitza@ociweb.com> + * bin/MakeProjectCreator/templates/gnu.mpd: + Fixed support for idl3toxmi and idl3toidl2 flags + +Mon Jan 23 12:02:07 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/MakeProjectCreator/templates/gnu.mpd: + Added support for idl3toxmi and idl3toidl2 flags + +Sun Jan 22 19:41:27 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * examples/Reactor/WFMO_Reactor/APC.cpp: + * examples/Reactor/WFMO_Reactor/Abandoned.cpp: + * examples/Reactor/WFMO_Reactor/Directory_Changes.cpp: + * examples/Reactor/WFMO_Reactor/Handle_Close.cpp: + * examples/Reactor/WFMO_Reactor/Network_Events.cpp: + * examples/Reactor/WFMO_Reactor/Prerun_State_Changes.cpp: + * examples/Reactor/WFMO_Reactor/Registration.cpp: + * examples/Reactor/WFMO_Reactor/Registry_Changes.cpp: + * examples/Reactor/WFMO_Reactor/Suspended_Removals.cpp: + * examples/Reactor/WFMO_Reactor/Talker.cpp: + * examples/Reactor/WFMO_Reactor/Window_Messages.cpp: + Fixed GCC 4.6.2 release warnings + +Sun Jan 22 12:35:11 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/make_release.py: + Use the new MPC -workers option to speedup the release process + +Fri Jan 20 19:30:51 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * examples/APG/Processes/Process_Mutex.cpp: + Use ACE_TEST_ASSERT instead of ACE_ASSERT to fix warnings in gcc 4.6 + release builds + +Fri Jan 20 19:06:02 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * examples/APG/Containers/Allocator.cpp: + * examples/Reactor/Misc/test_timer_queue.cpp: + Use ACE_TEST_ASSERT instead of ACE_ASSERT to fix warnings in gcc 4.6 + release builds + +Wed Jan 18 09:02:18 UTC 2012 Martin Corino <mcorino@remedy.nl> * bin/fuzz.pl: + Added suppress option to selectively disable checks. - Added a "trailing whitespace" check (not enabled by default). - Added the ability to pass multiple test names on the command line. - Extend the "too long file name" check to some additional file types. +Tue Jan 17 17:36:31 UTC 2012 Chip Jones <jonesc@ociweb.com> -Fri Aug 6 08:39:38 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * include/makeinclude/rules.local.GNU: + Fixed 'no filename for -include' warning. - * protocols/ace/TMCast/TMCast.mpc: - Removed exceptions as base project +Mon Jan 16 21:58:44 UTC 2012 Chip Jones <jonesc@ociweb.com> -Thu Aug 5 16:56:01 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/DependencyGenerator/GNUIDLDependencyWriter.pm: + * bin/DependencyGenerator/GNUIDLObjectGenerator.pm: + * bin/MakeProjectCreator/config/ace_idl_dependencies.mpb: - * bin/MakeProjectCreator/config/tmcast.mpb: - * protocols/tests/RMCast/RMCast.mpc: - Removed exceptions as base project + Added these files to support generation of IDL dependencies + for gnuace projects. -Thu Aug 5 09:00:49 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/MakeProjectCreator/config/acedefaults.mpb: + * bin/MakeProjectCreator/config/global.features: - * ace/ACE.cpp: - * ace/ACE_crc32.cpp: - * ace/ACE_crc_ccitt.cpp: - * ace/ARGV.cpp: - * ace/ATM_Acceptor.cpp: - * ace/ATM_Addr.cpp: - * ace/ATM_Connector.cpp: - * ace/ATM_Params.cpp: - * ace/ATM_QoS.cpp: - * ace/ATM_Stream.cpp: - * ace/Acceptor.cpp: - * ace/Activation_Queue.cpp: - * ace/Active_Map_Manager.cpp: - * ace/Addr.cpp: - * ace/Arg_Shifter.cpp: - * ace/Argv_Type_Converter.cpp: - * ace/Assert.cpp: - * ace/Asynch_Acceptor.cpp: - * ace/Asynch_IO.cpp: - * ace/Asynch_Pseudo_Task.cpp: - * ace/Atomic_Op.cpp: - * ace/Atomic_Op_GCC_T.cpp: - * ace/Atomic_Op_T.cpp: - * ace/Auto_Ptr.cpp: - * ace/Barrier.cpp: - * ace/Base_Thread_Adapter.cpp: - * ace/Basic_Stats.cpp: - * ace/CDR_Base.cpp: - * ace/Capabilities.cpp: - * ace/Codeset_IBM1047.cpp: - * ace/Codeset_Registry.cpp: - * ace/Condition_Thread_Mutex.cpp: - * ace/Connection_Recycling_Strategy.cpp: - * ace/Containers.cpp: - * ace/Copy_Disabled.cpp: - * ace/Countdown_Time.cpp: - * ace/DEV.cpp: - * ace/DEV_Connector.cpp: - * ace/DEV_IO.cpp: - * ace/DLL.cpp: - * ace/DLL_Manager.cpp: - * ace/Date_Time.cpp: - * ace/Dev_Poll_Reactor.cpp: - * ace/Dirent_Selector.cpp: - * ace/Dump.cpp: - * ace/Dynamic.cpp: - * ace/Dynamic_Message_Strategy.cpp: - * ace/Dynamic_Service_Dependency.cpp: - * ace/Event.cpp: - * ace/Event_Handler.cpp: - * ace/FIFO.cpp: - * ace/FIFO_Recv.cpp: - * ace/FIFO_Recv_Msg.cpp: - * ace/FIFO_Send.cpp: - * ace/FIFO_Send_Msg.cpp: - * ace/FILE.cpp: - * ace/FILE_Addr.cpp: - * ace/FILE_Connector.cpp: - * ace/FILE_IO.cpp: - * ace/File_Lock.cpp: - * ace/Framework_Component.cpp: - * ace/Functor.cpp: - * ace/Functor_String.cpp: - * ace/Future.cpp: - * ace/Get_Opt.cpp: - * ace/Handle_Set.cpp: - * ace/High_Res_Timer.cpp: - * ace/ICMP_Socket.cpp: - * ace/IOStream.cpp: - * ace/IO_Cntl_Msg.cpp: - * ace/IO_SAP.cpp: - * ace/IPC_SAP.cpp: - * ace/LSOCK.cpp: - * ace/LSOCK_Acceptor.cpp: - * ace/LSOCK_CODgram.cpp: - * ace/LSOCK_Connector.cpp: - * ace/LSOCK_Dgram.cpp: - * ace/LSOCK_Stream.cpp: - * ace/Lib_Find.cpp: - * ace/Local_Memory_Pool.cpp: - * ace/Local_Name_Space.cpp: - * ace/Lock.cpp: - * ace/Log_Msg.cpp: - * ace/Log_Msg_Backend.cpp: - * ace/Log_Msg_Callback.cpp: - * ace/Log_Msg_IPC.cpp: - * ace/Log_Msg_NT_Event_Log.cpp: - * ace/Log_Record.cpp: - * ace/MEM_Acceptor.cpp: - * ace/MEM_Connector.cpp: - * ace/MEM_IO.cpp: - * ace/MEM_SAP.cpp: - * ace/MEM_Stream.cpp: - * ace/MMAP_Memory_Pool.cpp: - * ace/Malloc_Allocator.cpp: - * ace/Manual_Event.cpp: - * ace/Mem_Map.cpp: - * ace/Message_Queue.cpp: - * ace/Message_Queue_NT.cpp: - * ace/Message_Queue_Vx.cpp: - * ace/Msg_WFMO_Reactor.cpp: - * ace/Mutex.cpp: - * ace/Name_Proxy.cpp: - * ace/Name_Space.cpp: - * ace/Naming_Context.cpp: - * ace/Notification_Strategy.cpp: - * ace/OS.cpp: - * ace/OS_Errno.cpp: - * ace/OS_Log_Msg_Attributes.cpp: - * ace/OS_NS_Thread.cpp: - * ace/OS_NS_arpa_inet.cpp: - * ace/OS_NS_ctype.cpp: - * ace/OS_NS_dirent.cpp: - * ace/OS_NS_dlfcn.cpp: - * ace/OS_NS_errno.cpp: - * ace/OS_NS_fcntl.cpp: - * ace/OS_NS_math.cpp: - * ace/OS_NS_netdb.cpp: - * ace/OS_NS_poll.cpp: - * ace/OS_NS_pwd.cpp: - * ace/OS_NS_regex.cpp: - * ace/OS_NS_signal.cpp: - * ace/OS_NS_stdio.cpp: - * ace/OS_NS_stdlib.cpp: - * ace/OS_NS_strings.cpp: - * ace/OS_NS_stropts.cpp: - * ace/OS_NS_sys_mman.cpp: - * ace/OS_NS_sys_msg.cpp: - * ace/OS_NS_sys_resource.cpp: - * ace/OS_NS_sys_select.cpp: - * ace/OS_NS_sys_shm.cpp: - * ace/OS_NS_sys_socket.cpp: - * ace/OS_NS_sys_stat.cpp: - * ace/OS_NS_sys_time.cpp: - * ace/OS_NS_sys_uio.cpp: - * ace/OS_NS_sys_utsname.cpp: - * ace/OS_NS_sys_wait.cpp: - * ace/OS_NS_time.cpp: - * ace/OS_NS_unistd.cpp: - * ace/OS_NS_wchar.cpp: - * ace/OS_NS_wctype.cpp: - * ace/OS_TLI.cpp: - * ace/OS_main.cpp: - * ace/Obchunk.cpp: - * ace/Object_Manager.cpp: - * ace/Object_Manager_Base.cpp: - * ace/PI_Malloc.cpp: - * ace/Pagefile_Memory_Pool.cpp: - * ace/Pipe.cpp: - * ace/Priority_Reactor.cpp: - * ace/Process.cpp: - * ace/Process_Mutex.cpp: - * ace/Process_Semaphore.cpp: - * ace/Profile_Timer.cpp: - * ace/RW_Mutex.cpp: - * ace/RW_Process_Mutex.cpp: - * ace/RW_Thread_Mutex.cpp: - * ace/Reactor_Impl.cpp: - * ace/Reactor_Notification_Strategy.cpp: - * ace/Reactor_Timer_Interface.cpp: - * ace/Read_Buffer.cpp: - * ace/Recursive_Thread_Mutex.cpp: - * ace/Recyclable.cpp: - * ace/Registry.cpp: - * ace/Registry_Name_Space.cpp: - * ace/Remote_Tokens.cpp: - * ace/SOCK.cpp: - * ace/SOCK_Acceptor.cpp: - * ace/SOCK_CODgram.cpp: - * ace/SOCK_Connector.cpp: - * ace/SOCK_Dgram.cpp: - * ace/SOCK_Dgram_Bcast.cpp: - * ace/SOCK_Dgram_Mcast.cpp: - * ace/SOCK_IO.cpp: - * ace/SOCK_SEQPACK_Acceptor.cpp: - * ace/SOCK_SEQPACK_Association.cpp: - * ace/SOCK_SEQPACK_Connector.cpp: - * ace/SOCK_Stream.cpp: - * ace/SPIPE.cpp: - * ace/SPIPE_Acceptor.cpp: - * ace/SPIPE_Addr.cpp: - * ace/SPIPE_Connector.cpp: - * ace/SPIPE_Stream.cpp: - * ace/SUN_Proactor.cpp: - * ace/SV_Message.cpp: - * ace/SV_Message_Queue.cpp: - * ace/SV_Semaphore_Complex.cpp: - * ace/SV_Semaphore_Simple.cpp: - * ace/SV_Shared_Memory.cpp: - * ace/Sample_History.cpp: - * ace/Sbrk_Memory_Pool.cpp: - * ace/Sched_Params.cpp: - * ace/Select_Reactor_T.cpp: - * ace/Semaphore.cpp: - * ace/Service_Manager.cpp: - * ace/Service_Object.cpp: - * ace/Service_Repository.cpp: - * ace/Service_Types.cpp: - * ace/Shared_Memory.cpp: - * ace/Shared_Memory_MM.cpp: - * ace/Shared_Memory_Pool.cpp: - * ace/Shared_Object.cpp: - * ace/Sig_Adapter.cpp: - * ace/Sig_Handler.cpp: - * ace/Signal.cpp: - * ace/Stack_Trace.cpp: - * ace/Stats.cpp: - * ace/Synch_Options.cpp: - * ace/System_Time.cpp: - * ace/TLI.cpp: - * ace/TLI_Acceptor.cpp: - * ace/TLI_Connector.cpp: - * ace/TLI_Stream.cpp: - * ace/TP_Reactor.cpp: - * ace/TSS_Adapter.cpp: - * ace/TTY_IO.cpp: - * ace/Thread.cpp: - * ace/Thread_Adapter.cpp: - * ace/Thread_Control.cpp: - * ace/Thread_Exit.cpp: - * ace/Thread_Hook.cpp: - * ace/Thread_Mutex.cpp: - * ace/Thread_Semaphore.cpp: - * ace/Throughput_Stats.cpp: - * ace/Time_Value.cpp: - * ace/Timeprobe.cpp: - * ace/Timer_List_T.cpp: - * ace/Token.cpp: - * ace/Token_Invariants.cpp: - * ace/Token_Manager.cpp: - * ace/Token_Request_Reply.cpp: - * ace/Trace.cpp: - * ace/UNIX_Addr.cpp: - * ace/UPIPE_Acceptor.cpp: - * ace/UPIPE_Connector.cpp: - * ace/UPIPE_Stream.cpp: - * ace/UUID.cpp: - * ace/WFMO_Reactor.cpp: - * ace/WIN32_Proactor.cpp: - * ace/XTI_ATM_Mcast.cpp: - * ace/ace_wchar.cpp: - * ace/gethrtime.cpp: - Removed ACE_RCSID + Added IDL dependency as a feature defaulted to off. -Thu Aug 5 08:13:51 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/MakeProjectCreator/templates/gnu.mpd: - * ace/CORBA_macros.h: - * ace/Global_Macros.h: - * ace/Vector_T.h: - * ace/ace_wchar.h: - * ace/config-cxx-common.h: - * ace/config-doxygen.h: - * ace/config-g++-common.h: - * ace/config-hpux-11.00.h: - * ace/config-icc-common.h: - * ace/config-integritySCA.h: - * ace/config-macros.h: - * ace/config-netbsd.h: - * ace/config-openvms.h: - * ace/config-suncc-common.h: - * ace/config-sunos5.4-sunc++-4.x.h: - * ace/config-sunos5.5.h: - * ace/config-tandem-nsk-mips-v2.h: - * ace/config-tandem-nsk-mips-v3.h: - * ace/config-unixware-7.1.0.h: - * ace/config-unixware-7.1.0.udk.h: - * ace/config-win32-borland.h: - * ace/config-win32-dmc.h: - * ace/config-win32-ghs.h: - * ace/config-win32-interix.h: - * ace/config-win32-msvc-10.h: - * ace/config-win32-msvc-7.h: - * ace/config-win32-msvc-8.h: - * ace/config-win32-msvc-9.h: - * include/makeinclude/platform_aix.GNU: - * include/makeinclude/platform_aix_g++.GNU: - * include/makeinclude/platform_aix_ibm.GNU: - * include/makeinclude/platform_cray.GNU: - * include/makeinclude/platform_freebsd.GNU: - * include/makeinclude/platform_gnuwin32_common.GNU: - * include/makeinclude/platform_hpux_aCC.GNU: - * include/makeinclude/platform_hpux_gcc.GNU: - * include/makeinclude/platform_integrity_ghs.GNU: - * include/makeinclude/platform_irix6.x_common.GNU: - * include/makeinclude/platform_linux_common.GNU: - * include/makeinclude/platform_lynxos.GNU: - * include/makeinclude/platform_macosx.GNU: - * include/makeinclude/platform_macosx_common.GNU: - * include/makeinclude/platform_macosx_icc.GNU: - * include/makeinclude/platform_macosx_panther.GNU: - * include/makeinclude/platform_netbsd.GNU: - * include/makeinclude/platform_openbsd.GNU: - * include/makeinclude/platform_openvms.GNU: - * include/makeinclude/platform_qnx_rtp_gcc.GNU: - * include/makeinclude/platform_rtems.x_g++.GNU: - * include/makeinclude/platform_sunos5_g++.GNU: - * include/makeinclude/platform_sunos5_sunc++.GNU: - * include/makeinclude/platform_tandem.GNU: - * include/makeinclude/platform_tru64_cxx.GNU: - * include/makeinclude/platform_tru64_g++.GNU: - * include/makeinclude/platform_unixware_g++.GNU: - * include/makeinclude/platform_vxworks5.5.x.GNU: - * include/makeinclude/platform_vxworks6.2.GNU: - * include/makeinclude/platform_vxworks6.3.GNU: - * include/makeinclude/platform_win32_dmc.GNU: - * include/makeinclude/platform_win32_icc.GNU: - * include/makeinclude/platform_win32_interix.GNU: + Modified gnuace template to generate IDL dependency rules. + + * include/makeinclude/rules.common.GNU: + * include/makeinclude/rules.local.GNU: * include/makeinclude/wrapper_macros.GNU: - * tests/Bug_3673_Regression_Test.cpp: - * tests/Reactor_Exceptions_Test.cpp: - * tests/tests.mpc: - Removed support for non exception builds, ACE_HAS_EXCEPTIONS is - now always defined - * rpmbuild/ace-tao.spec: - Small updates + Added depend_idl.local rule. - * ace/Exception_Macros.h: - * bin/MakeProjectCreator/config/exceptions.mpb: - Removed these files. + This is a merge of work done in the 'ace-mpc_performance' + branch. -Thu Aug 5 07:40:00 UTC 2010 Build CZar <buildczar at prismtech dot com> +Mon Jan 16 10:33:37 UTC 2012 Martin Corino <mcorino@remedy.nl> - * ace/OS_NS_Thread.cpp: - Add the missing ; to the lines added by the fix below. - Wed Aug 4 14:16:46 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/config-win32-common.h: + * ace/config-win32-mingw.h: + Moved MinGW specific block to common because the macros + it concerns are tested there already. -Wed Aug 4 17:21:17 UTC 2010 Chris Cleeland <cleeland@ociweb.com> +Mon Jan 16 09:01:20 UTC 2012 Martin Corino <mcorino@remedy.nl> - * bin/MakeProjectCreator/config/crosscompile.mpb: - Added specific clause for cdt6. + * ace/config-win32-mingw.h: + Fixed incorrectly placed macro test. -Wed Aug 4 14:16:46 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sun Jan 15 19:15:48 UTC 2012 Martin Corino <mcorino@remedy.nl> - * ace/OS_NS_Thread.cpp: - Check more internal return values + * ace/config-win32-mingw.h: + Add some customizations and corrections to support using + --std=c++0x with MinGW32. - * rpmbuild/ace-tao.spec-bugfixonly.patch: - Removed this file, not needed +Fri Jan 13 23:25:59 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu> -Tue Aug 3 12:14:51 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * THANKS: - * bin/generate_doxygen.pl: - * html/index.html: - DAnCE has its own file now and also some documentation got moved - out of the tao directory + Added Michael Frommberger <michael dot frommberger at gmx dot net> -Sun Aug 1 18:14:03 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Wed Jan 11 20:43:47 UTC 2012 Martin Corino <mcorino@remedy.nl> - * NEWS: - * bin/diff-builds-and-group-fixed-tests-only.sh: - * bin/make_release.py: - * docs/Download.html: - * etc/index.html: - Updated because of release + * ace/config-freebsd.h: + * ace/config-win32-common.h: + * ace/config-win32-mingw.h: + * ace/os_include/os_signal.h: + Added ACE_LACKS_SIGSET_T to be able to distinguish between the + type and the functions being provided or not. - * debian/*: - Did rename actions the release script didn't do, have to sort this - out later +Wed Jan 11 18:43:50 UTC 2012 Martin Corino <mcorino@remedy.nl> -Sun Aug 01 11:30:54 CEST 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/config-win32-mingw.h: + Fixed typo. - * ACE version 5.8.1 released. +Wed Jan 11 15:41:00 UTC 2012 Simon Massey <simon dot massey at prismtech dot com> -Thu Jul 29 14:41:32 UTC 2010 Steve Huston <shuston@riverace.com> + * ace/config-sunos5.10.h: + Is supposed to define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII and ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII + correctly for this platform. The old logic was "If already defined - redefine, but if not + defined don't define" and wrong. The point of providing the definition of these SIZE_T format + specifiers is to provide them if they are not set. - * ace/Process.h (set_handles): Clarify that passing ACE_INVALID_HANDLE - for any of the handle values will cause a duplicate of the - corresponding ACE_STDIN/OUT/ERR to be used in the options. +Wed Jan 11 14:36:43 UTC 2012 Martin Corino <mcorino@remedy.nl> -Thu Jul 29 10:43:32 UTC 2010 Marcel Smit <msmit@remedy.nl> + * ace/config-win32-mingw.h: + * ace/os_include/os_signal.h: + Changes to support MinGW64 compiler. - * bin/MakeProjectCreator/config/global.features: - * bin/MakeProjectCreator/config/inetssl.mpb: - * protocols/ace/INet/inet_ssl.mpb: - Created a new feature, inet_ssl. When set, the INet libary - builds, using SSL. To let the INet libary use SSL, one should - enable the inet_ssl feature in default.features and add ssl=1 to - the platform_macos.GNU. +Mon Jan 9 11:07:54 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Mon Jul 26 20:26:53 UTC 2010 Steve Huston <shuston@riverace.com> + * ace/Netlink_Addr.h: + * ace/Notification_Queue.h: + Doxygen fixes - * ace/OS_NS_Thread.h: Note that the cpu_set_size to the get/set - affinity methods is a byte count. + * tests/run_test.lst: + Removed several old config labels -Mon Jul 26 07:02:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Fri Jan 6 11:16:03 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/config/inet.mpb: - * protocols/ace/INet/inet.mpc: - Added avoids += corba_e_compact. + * html/Stats/configuration.shtml: + * html/Stats/index.shtml: + * html/Stats/simple_footprint.shtml: + Extended data to be shown and updated links -Thu Jul 22 04:35:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Fri Jan 6 10:28:35 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/config/inet.mpb: - * protocols/ace/INet/inet.mpc: - Added avoids += ace_for_tao. + * ace/Stream.cpp: + Fixed coverity errors -Wed Jul 21 18:23:32 UTC 2010 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> +Wed Jan 4 13:02:12 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Basic_Types.h (ACE_INT8_FORMAT_SPECIFIER): Added the missing - "_ASCII" to the ACE_INT8_FORMAT_SPECIFIER macro usage. Thanks - to Andre Kostur <akostur at incognito dot com> for reporting - this. + * bin/generate_compile_stats.sh: + Added link for DAnCE -Wed Jul 21 15:52:32 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> +Wed Jan 4 11:45:43 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Service_Gestalt.h: - * ace/Service_Gestalt.inl: - * ace/Service_Gestalt.cpp: + * html/Stats/index.shtml: + Fixed link - Reverted for_TAO specific change, revised the processing to - ensure default first, then files, then cmdline directives. +Wed Jan 4 11:42:13 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Wed Jul 21 03:07:28 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + * bin/generate_compile_stats.sh: + Work with flat layout and added DAnCE - * ace/Service_Gestalt.h: - * ace/Service_Gestalt.cpp: +Wed Jan 4 11:06:50 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - Fix errors in premature committal. + * bin/generate_compile_stats.sh: + Updated title to include DAnCE -Wed Jul 21 02:30:45 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> +Wed Jan 4 08:50:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Service_Gestalt.h: - * ace/Service_Gestalt.inl: - * ace/Service_Gestalt.cpp: + * bin/cleanbuilds.sh: + * bin/mail_test_stats.sh: + Accept date and email as arguments - Add a specialized open method to be called by TAO. TAO depends - on a modified order of directive evaluation. +Tue Jan 3 18:47:23 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 18:02:03 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * bin/performance_stats.sh: + * bin/topinfo_iorsize_stats.sh: + * bin/topinfo_simple_stats.sh: + * bin/topinfo_stats.sh: + Assume ACE_ROOT is set before running the script, simplified the usage - * docs/Download.html: - Fixed some typos, thanks to Thomas Lockhart - <Thomas dot lockhart at jpl dot nasa dot gov> for reporting this +Tue Jan 3 18:34:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 15:08:49 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> + * bin/valgrind.supp: + Added default suppress file that can be used for valgrind when using + valgrind for ACE/TAO/CIAO/DAnCE - * tests/Bug_3319_Regression_Test.cpp: + * docs/bczar/bczar.html: + Added package - Fix the test to be consistent with revised service config - behavior. The test had assumed that ACE_Service_Config::open() - would return 0 even if svc.conf were not present, but since it - was setting the ignore_default_svc_conf_file to 0, the restore - behavior of the service configurator is to fail with ENOENT in - that case. +Tue Jan 3 13:51:18 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 08:48:00 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * bin/performance_stats.sh: + Create source directory - * ace/TSS_T.cpp: - Fixed a bug in ACE_TSS::ts_get() that only exhibited on - SunOS/Studio builds. The later configutsyion uses ACE_HAS_THR_C_DEST - and with that define ts_get() behaved differently. In particular it - didn't create a ts_obj if tss_adapter was not 0. +Tue Jan 3 12:52:04 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 07:38:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * bin/performance_stats.sh: + * bin/topinfo_iorsize_stats.sh: + * bin/topinfo_simple_stats.sh: + * bin/topinfo_stats.sh: + * bin/footprint_stats.sh: + Converting them to support a flat layout - * protocols/ace/INet/SSL_CallbackManager.h: - Fixed comment typo. +Tue Jan 3 12:40:43 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 05:25:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * html/Stats/detailed_footprint.shtml: + * html/Stats/detailed_performance.shtml: + * html/Stats/footer.html: + * html/Stats/index.shtml: + * html/Stats/navigation.html: + Updated links, docu, status - * protocols/ace/INet/HTTP_BasicAuthentication.cpp: - * protocols/ace/INet/HTTP_BasicAuthentication.h: - * protocols/ace/INet/HTTP_BasicAuthentication.inl: - * protocols/ace/INet/inet.mpc: - Added basic support for HTTP Basic Authentication scheme. + * html/Stats/compilation.shtml: + Removed this file. -Tue Jul 20 03:56:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Sat Dec 31 22:12:53 UTC 2011 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * protocols/ace/INet/HTTP_SessionBase.cpp: - Fixed MSVC 7.1 compile problems. + * ace/Timer_Wheel_T.cpp: Changed the call to "delete root" in the + destructor to "this->free_node (root)" so the ACE_Timer_Wheel_T + will work properly when provided a custom allocator. Thanks to + Koh <k_onishi at mtj dot biglobe dot ne dot jp> for reporting + this bug and providing a fix. - * protocols/ace/INet/HTTP_Simple_exec.cpp: - Fixed compile problems for non-SSL builds. +Fri Dec 30 10:13:59 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> -Tue Jul 20 03:25:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/config-linux.h: + Added support for ulibc, thanks to Chong Wuk Pak + <chong dot pak at lmco dot com> for providing the patch. This fixes + bugzilla 3999 - * bin/MakeProjectCreator/config/inetssl.mpb: - * protocols/ace/INet/inet_ssl.mpb: - Fuzz fixes. +Thu Dec 29 17:29:06 UTC 2011 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> -Mon Jul 19 11:50:59 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): Fixed a missing '('. Thanks to Johnny for reporting this. - * ace/TSS_T.inl: - * ace/TSS_T.h: - * ace/TSS_T.cpp: - Mostly fixed bug 3539. It doesn't fix a case when main thread - doesn't own ACE_TSS but still uses it. Fixing the later is not - straight forward and will require a lot more efforts. - Also rearranged the code so that it has less duplicates. +Thu Dec 29 15:14:45 UTC 2011 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * tests/run_test.lst: - Marked the test as fixed. + * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): Further improved the + error checking. Thanks to JaeSung Lee <berise at gmail dot + com> for suggesting this. -Mon Jul 19 09:15:30 UTC 2010 Martin Corino <mcorino@remedy.nl> +Tue Dec 27 15:19:56 UTC 2011 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> - * bin/MakeProjectCreator/config/inet.mpb: - * bin/MakeProjectCreator/config/global.features: - * protocols/ace/INet/inet.mpc: - Added new feature 'exclude_inet' to allow builds to - explicitly exclude building INet. + * ace/Mem_Map.cpp (ACE_Mem_Map::map_it): mmap through character + device doesn't care about it's size, so map with /dev/* is done + with a special case. Thanks to JaeSung Lee <berise at gmail dot + com> for reporting this and providing a fix. + +Tue Dec 27 11:39:53 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> -Mon Jul 19 08:49:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * NEWS: + * bin/diff-builds-and-group-fixed-tests-only.sh: + * docs/Download.html: + * docs/bczar/bczar.html: + * etc/index.html: + Updated for next release - * protocols/ace/INet/HTTPS_Session.cpp: - * protocols/ace/INet/HTTPS_Session.h: - Fixed compile errors byadding version check to disable - 'relatively' new OpenSSL functionality for builds using - outdated OpenSSL installations (OpenSSL <= 0.9.8e). +Tue Dec 27 10:06:28 CET 2011 Johnny Willemsen <jwillemsen@remedy.nl> -Sat Jul 17 14:06:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ACE version 6.0.7 released. - * protocols/ace/INet/ClientRequestHandler.h: - * protocols/ace/INet/URLBase.h: - Some include shuffling to fix an incomplete type warning - with MSVC. +Wed Dec 21 11:25:49 UTC 2011 Marcel Smit <msmit@remedy.nl> -Sat Jul 17 11:39:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * tests/Task_Wait_Test.cpp: + Fixed compile issue on Solaris 10. - * protocols/ace/INet/inet_ssl.mpb: - Replaced ace_openssl base project by ssl. Fixes missing - ACE_SSL lib link errors. +Wed Dec 21 09:41:54 UTC 2011 Martin Corino <mcorino@remedy.nl> - * protocols/ace/INet/SSL_CallbackManager.cpp: - Fixed MSVC compile errors. - -Sat Jul 17 10:26:30 UTC 2010 Martin Corino <mcorino@remedy.nl> - - * bin/MakeProjectCreator/config/inetssl.mpb: - * bin/MakeProjectCreator/config/inet.mpb: - Added feature project for SSL based parts of INet. - Setting feature ssl=1 will automatically cause correct - dependencies for SSL to be generated in INet based projects. - - * protocols/ace/INet/HTTPS_Context.cpp: - * protocols/ace/INet/HTTPS_Context.h: - * protocols/ace/INet/HTTPS_Context.inl: - * protocols/ace/INet/HTTP_SessionBase.cpp: - * protocols/ace/INet/HTTP_SessionBase.h: - * protocols/ace/INet/HTTP_SessionBase.inl: - * protocols/ace/INet/HTTPS_Session.cpp: - * protocols/ace/INet/HTTPS_SessionFactory.cpp: - * protocols/ace/INet/HTTPS_SessionFactory.h: - * protocols/ace/INet/HTTPS_Session.h: - * protocols/ace/INet/HTTPS_URL.cpp: - * protocols/ace/INet/HTTPS_URL.h: - * protocols/ace/INet/HTTPS_URL.inl: - * protocols/ace/INet/SSL_CallbackManager.cpp: - * protocols/ace/INet/SSL_CallbackManager.h: - * protocols/ace/INet/SSL_CallbackManager.inl: - * protocols/ace/INet/SSL_CertificateCallback.cpp: - * protocols/ace/INet/SSL_CertificateCallback.h: - * protocols/ace/INet/SSL_CertificateCallback.inl: - * protocols/ace/INet/SSL_PasswordCallback.cpp: - * protocols/ace/INet/SSL_PasswordCallback.h: - * protocols/ace/INet/SSL_Proxy_Connector.cpp: - * protocols/ace/INet/SSL_Proxy_Connector.h: - * protocols/ace/INet/SSLSock_IOStream.cpp: - * protocols/ace/INet/SSLSock_IOStream.h: - * protocols/ace/INet/SSL_X509Cert.cpp: - * protocols/ace/INet/SSL_X509Cert.h: - * protocols/ace/INet/SSL_X509Cert.inl: - New files implementing SSL/HTTPS support. - Includes support for proxy CONNECT tunneling. - - * protocols/ace/INet/inet_ssl.mpb: - Feature project which will include SSL/HTTPS support - into INet when MPC feature ssl=1 is set. - - * protocols/ace/INet/ClientRequestHandler.cpp: - * protocols/ace/INet/ClientRequestHandler.h: - * protocols/ace/INet/ConnectionCache.cpp: - * protocols/ace/INet/ConnectionCache.h: - * protocols/ace/INet/FTP_ClientRequestHandler.cpp: - * protocols/ace/INet/FTP_URL.cpp: - * protocols/ace/INet/FTP_URL.h: - * protocols/ace/INet/FTP_URL.inl: - * protocols/ace/INet/HeaderBase.h: - * protocols/ace/INet/HTTP_ClientRequestHandler.cpp: - * protocols/ace/INet/HTTP_ClientRequestHandler.h: - * protocols/ace/INet/HTTP_ClientRequestHandler.inl: - * protocols/ace/INet/HTTP_Session.cpp: - * protocols/ace/INet/HTTP_Session.h: - * protocols/ace/INet/HTTP_StreamPolicyBase.h: - * protocols/ace/INet/HTTP_StreamPolicy.h: - * protocols/ace/INet/HTTP_URL.cpp: - * protocols/ace/INet/HTTP_URL.h: - * protocols/ace/INet/HTTP_URL.inl: - * protocols/ace/INet/inet.mpc: - * protocols/ace/INet/RequestHandler.h: - * protocols/ace/INet/StreamHandler.cpp: - * protocols/ace/INet/StreamInterceptor.h: - * protocols/ace/INet/URLBase.h: - Some redesign to accomodate addition of HTTPS. - Some additional logging. - Some additional documentation. - - * protocols/ace/INet/HTTP_Simple_exec.cpp: - Extended to include HTTPS support. - - * protocols/tests/INet/MT_Get/Main.cpp: - Added some traces. - -Fri Jul 16 22:08:05 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> - - * ace/Service_Gestalt.h: - * ace/Service_Gestalt.cpp: + * examples/Timer_Queue/Reactor_Timer_Queue_Test.cpp: - Further refinement of service initialization process. This - restores the order of processing, and is more explicit about - handling a defaulted svc.conf. + Added timer queue reset on global reactor instance. -Thu Jul 15 17:53:47 UTC 2010 Phil Mesnier <mesnier_p@ociweb.com> +Tue Dec 20 15:43:39 UTC 2011 Steve Huston <shuston@riverace.com> - * ace/Service_Gestalt.cpp: - * THANKS: + * tests/Task_Wait_Test.cpp: + * tests/tests.mpc: + * tests/run_test.lst: + New test program that tests the ACE_Thread_Manager::wait() from a + called-back ACE_Task::close() on thread exit. - Restore pre-gestalt behavior of returning -1 if svc.conf does - not exist and an ACE_Service_Config::open() is expecting to use - the default file. +Tue Dec 20 15:36:24 UTC 2011 Steve Huston <shuston@riverace.com> - Thanks to Daynesh Mangal (daynesh@gmail.com) for reporting the - errant behavior. + * ace/Thread.inl (disablecancel): Correct size pased to memset. + * ace/Thread_Manager.cpp (ACE_Thread_Descriptor::terminate): Don't + dereference potentially invalid pointer. -Thu Jul 15 12:53:53 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Resolves Coverity warnings. - * etc/ace.doxygen: - * etc/ace_inet.doxygen: - * etc/ace_man.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Generate deprecated/todo pages +Mon Dec 19 19:00:07 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> -Thu Jul 15 12:35:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * docs/bczar/bczar.html: + Added another package - * ace/SSL/SSL_SOCK_Stream.h: - * ace/SSL/SSL_SOCK_Stream.inl: - Added two method overloads available in ACE_SOCK_Stream but - missing from ACE_SSL_SOCK_Stream. +Mon Dec 19 13:28:16 UTC 2011 Martin Corino <mcorino@remedy.nl> -Thu Jul 15 09:49:28 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Abstract_Timer_Queue.h: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Queue_Adapters.inl: + * ace/Timer_Queue_Adapters.cpp: + * ace/Timer_Wheel_T.h: + * ace/Timer_Wheel_T.cpp: - * ace/config-doxygen.h: - Added ACE_HAS_POSITION_INDEPENDENT_POINTERS + Added close() method. -Thu Jul 15 09:29:58 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Dev_Poll_Reactor.cpp: + * ace/Proactor.cpp: + * ace/Select_Reactor_T.cpp: + * ace/WFMO_Reactor.cpp: - * bin/generate_doxygen.pl: - * etc/ace_inet.doxygen: - * html/index.html: - Added ACE INet library + Implemented support for timer queue close (). -Thu Jul 15 09:11:51 UTC 2010 William R. Otte <wotte@dre.vanderbilt.edu> + The rationale for these changes is that when using reactors with + user defined timer queues the reactor does not delete the timer queue + when being deleted itself. Without any other cleanup this created the + possibility (as encountered in TAO/tests/Bug_3837_Regression after + introduction of the TIME_POLICY changes) of outstanding timer handlers + in the queue being triggered and attempting to access the reactor after + the reactor has been destroyed. + Calling close () for timer queues the reactor does not delete solves + this potential problem. - * ace/config-macosx-snowleopard.h: - * include/makeinclude/platform_clang_common.GNU: - * include/makeinclude/platform_macosx_common.GNU: +Mon Dec 19 12:12:37 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - Preliminary support for clang compiler. + * bin/fuzz.pl: + Simplified check -Tue Jul 13 14:39:55 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Dec 19 09:17:33 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * NEWS: - Updated + * ace/ace_for_tao.mpc: + Added missing files -Tue Jul 13 14:33:23 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sun Dec 18 11:56:00 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/Cached_Connect_Strategy_T.h: - * ace/Capabilities.h: - Doxygen fixes + * ace/Timer_Queue_T.h: + Fixed CentOS warning -Tue Jul 13 14:20:09 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sun Dec 18 11:41:56 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * ace/os_include/os_errno.h: - Fixed problems with msvc 10, , thanks to Max Zhou - <earthdog at 126.com> for supplying these changes, this fixes - bugzilla 3873 + * ace/ace_for_tao.mpc: + Removed obsolete file -Tue Jul 13 11:08:38 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sun Dec 18 11:35:18 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/MakeProjectCreator/config/vc10nmake.mpb: - * netsvcs/lib/lib.mpc: - vc10 support, thanks to Max Zhou <earthdog at 126.com> for - supplying these changes + * bin/generate_compile_stats.sh: + Fixed incorrect command -Mon Jul 12 11:04:58 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Sun Dec 18 10:29:12 UTC 2011 Martin Corino <mcorino@remedy.nl> - * ace/ACE.cpp: - * ace/Activation_Queue.h: - * ace/Active_Map_Manager.h: - * ace/Dev_Poll_Reactor.h: - * ace/Dev_Poll_Reactor.inl: - * ace/Event_Handler.h: - * ace/Filecache.h: - * ace/Manual_Event.h: - * ace/Map_Manager.h: - * ace/Mem_Map.h: - * ace/Message_Block.h: - * ace/OS_Log_Msg_Attributes.h: - * ace/OS_NS_unistd.h: - * ace/Object_Manager.h: - * ace/Recursive_Thread_Mutex.h: - Layout, const, and doxygen fixes + * ace/Abstract_Timer_Queue.h: -Mon Jul 12 10:11:24 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Added missing abstract method dump(). - * ace/DLL.h: - * ace/DLL_Manager.h: - * ace/Dirent.h: - * ace/Dump_T.h: - * ace/Event_Handler.h: - * ace/File_Lock.h: - * ace/INET_Addr.h: - * ace/Log_Msg_Callback.h: - * ace/Log_Record.h: - * ace/Logging_Strategy.h: - Fixed set of doxygen warnings +Fri Dec 16 08:03:07 UTC 2011 Marcel Smit <msmit@remedy.nl> -Mon Jul 12 08:19:58 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Time_Policy_T.h: + No dllimport/export in template classes. - * ace/Connector.h: - * ace/Malloc_Base.h: - * ace/SString.h: - * ace/Stream.h: - * ace/Task.h: - Fixed set of doxygen warnings +Thu Dec 15 19:45:30 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> -Fri Jul 09 09:35:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/Countdown_Time_T.h: + No need for an export macro with a C++ template - * bin/PerlACE/Process_Unix.pm: - Fix killall() valgrind handling. +Thu Dec 15 13:22:07 UTC 2011 Marcel Smit <msmit@remedy.nl> -Thu Jul 08 14:41:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/Event_Handler_Handle_Timeout_Upcall.inl: + * tests/Timer_Queue_Test.cpp: + Fuzz. Removed tab character - * bin/PerlACE/Process_Unix.pm: - Fix killall() valgrind handling. +Thu Dec 15 13:12:39 UTC 2011 Marcel Smit <msmit@remedy.nl> -Thu Jul 08 07:56:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/Event_Handler_Handle_Timeout_Upcall.inl: + * ace/Event_Handler_Handle_Timeout_Upcall.cpp: + * ace/Proactor.cpp: + * ace/Timer_Hash.h: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap.h: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + * ace/Timer_List.h: + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Queue_Adapters.cpp: + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.cpp: + * ace/Timer_Wheel.h: + * ace/Timer_Wheel_T.h: + Fuzz. Removed tab character - * bin/PerlACE/Process_Unix.pm: - Make killall() recognize and handle valgrind runs correctly. +Thu Dec 15 12:52:18 UTC 2011 Marcel Smit <msmit@remedy.nl> -Wed Jul 7 14:53:12 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com> + * ace/Abstract_Timer_Queue.h: + * ace/Abstract_Timer_Queue.cpp: + * ace/Event_Handler_Handle_Timeout_Upcall.h: + * ace/Timer_Queue_Iterator.h: + * ace/Timer_Queue_Iterator.cpp: + Fuzz. Added Id-tags. - * tests/run_test.lst: - * tests/Bug_3539_Regression_Test.cpp: - * tests/tests.mpc: - Added a test for bug 3539 as non-fixed. +Thu Dec 15 11:00:00 UTC 2011 Martin Corino <mcorino@remedy.nl> -Wed Jul 7 11:43:16 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Merged timer_policy branch. - * docs/bczar/bczar.html: - Extended instructions + === start changelog === -Tue Jul 6 12:28:43 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Thu Dec 15 09:45:00 UTC 2011 Martin Corino <mcorino@remedy.nl> - * docs/Download.html: - CIAO is also online available + * NEWS: -Tue Jul 6 11:29:41 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Added description of new TIME_POLICY features. - * ace/Message_Queue_T.cpp: - * ace/Service_Repository.h: - * ace/Task_T.h: - Fixed doxygen warnings + * tests/Timer_Queue_Test.cpp: -Tue Jul 6 11:22:08 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Added explicit test of specific TIME_POLICY feature. - * etc/ace.doxygen: - Improved doxygen configuration + Mon Dec 12 21:28:00 UTC 2011 Martin Corino <mcorino@remedy.nl> -Tue Jul 6 11:11:06 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Abstract_Timer_Queue.h: + * ace/Time_Policy.h: + * ace/Time_Policy.inl: + * ace/Time_Policy_T.h: + * ace/Time_Policy_T.inl: + * ace/Timer_Queue_T.cpp: + * ace/Timer_Queue_T.h: + * tests/Timer_Queue_Test.cpp: - * etc/ace.doxygen: - * etc/ace_man.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Reduced the size of the colloboration graphs + Added backwards compatibility support. -Mon Jul 5 15:20:14 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Mon Dec 05 10:26:00 UTC 2011 Martin Corino <mcorino@remedy.nl> - * rpmbuild/ace-tao.spec: - Removed some test code + * ace/Time_Policy.inl -Mon Jul 5 14:59:25 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Prevent setting delegate to null pointer. - * rpmbuild/ace-tao.spec: - Added missing file, thanks to Anatoli Sakhnik - <sakhnik at gmail dot com> for reporting this, this should fix - bugzilla 3870 + Sun Dec 04 15:40:00 UTC 2011 Martin Corino <mcorino@remedy.nl> -Mon Jul 05 14:32:30 UTC 2010 Martin Corino <mcorino@remedy.nl> + * ace/Countdown_Time.cpp: + * ace/Countdown_Time.inl: - * bin/PerlACE/Process_Unix.pm: - Fixes problem with killall() function being not selective enough. + Renamed to *_T.* -Mon Jul 5 13:56:57 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Countdown_Time.h + * ace/Countdown_Time_T.cpp + * ace/Countdown_Time_T.h + * ace/Countdown_Time_T.inl - * etc/ace.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Disable include and included graphs, this should reduce the size - of the documentation a lot + Changed ACE_Countdown_Time to TIME_POLICY based + template class ACE_Countdown_Time_T, + Created typedef for default template instantiation + as ACE_Countdown_Time. -Mon Jul 5 13:29:23 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Time_Policy.cpp + * ace/Time_Policy.h + * ace/Time_Policy.inl + * ace/Time_Policy_T.cpp + * ace/Time_Policy_T.h + * ace/Time_Policy_T.inl - * bin/generate_doxygen.pl: - Some preparations to move the DAnCE doxygen files to DAnCE + Added support for dynamically loadable/shared time + policies. - * docs/bczar/bczar.html: - Updated release notes, made it possible to generate doxygen on - a regular system instead of on naboo, the side effect is that the - doxygen packages on naboo are 350Mb, on FC13 with all latest tools - they are 1.4GB + * ace/ace.mpc -Mon Jul 5 11:22:09 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Updated for file changes. - * ace/Select_Reactor_Base.cpp: - Fixed doxygen warning + Fri Dec 02 11:48:00 UTC 2011 Martin Corino <mcorino@remedy.nl> - * etc/ace.doxygen: - * etc/ace_man.doxygen: - * etc/ace_qos.doxygen: - * etc/ace_rmcast.doxygen: - * etc/ace_ssl.doxygen: - * etc/acexml.doxygen: - Define ACE_INLINE as inline and not as 1 + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: -Mon Jul 5 10:56:15 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Reverting set_time_policy() change. Interpretation error. - * rpmbuild/ace-tao.spec-release.patch: - Removed this file. + Thu Dec 01 17:52:00 UTC 2011 Martin Corino <mcorino@remedy.nl> -Mon Jul 5 09:11:21 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + * ace/Time_Policy.h: + * ace/Time_Policy.inl: - * docs/Download.html: - Removed link to very old patches and fixed typo + Added ACE_HR_Time_Policy. + + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: -Mon Jul 5 09:05:43 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> + Replaced set_time_policy() by get_time_policy() since setting + the policy is not possible but configuring might be. + + Thu Dec 01 14:05:00 UTC 2011 Martin Corino <mcorino@remedy.nl> + + * ace/Proactor.cpp: + * ace/Timer_Queue_T.cpp: + * ace/Timer_Queue_T.h: + + Fixed compile errors. + + Thu Dec 01 13:34:00 UTC 2011 Martin Corino <mcorino@remedy.nl> + + * ace/Timer_Hash_T.cpp: + * ace/Timer_Hash_T.h: + * ace/Timer_Heap_T.h: + * ace/Timer_Wheel_T.h: + + Small cleanup to prevent potential compiler warnings. + + Mon Aug 24 02:27:36 UTC 2009 Carlos O'Ryan <coryan@glamdring> + + * ace/Timer_Queue_T.cpp: + Need to release the internal timer queue lock before dispatching + calls in expire_single(), otherwise we get nasty deadlocks in + the TP_Reactor implementation. + + Thu Jul 2 02:55:09 UTC 2009 Carlos O'Ryan <coryan@glamdring> + + * ace/Abstract_Timer_Queue.h: + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: + * ace/Timer_Queue_T.cpp: + I wanted to use gettimeofday() for the pure virtual function and + some other name for the inline function used in the timer queue + internals. + This is the second and final pass to get that change in. This + time, I renamed the internal function to gettimeofday_static(), + used the compiler (and grep) to find all uses. Once that + compiled I renamed the virtual function from + gettimeofday_abstract() to the gettimeofday() function. + I know it is convoluted, but it gets the job done without me + having to think too much. + + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Select_Reactor_T.cpp: + * ace/Dev_Poll_Reactor.cpp: + * ace/Proactor.cpp: + * ace/Timer_Queue_Adapters.cpp: + * tests/Timer_Queue_Reference_Counting_Test.cpp: + * tests/Timer_Queue_Test.cpp: + * examples/APG/Timers/Timers.cpp: + * examples/APG/Timers/TimerDispatcher.cpp: + * examples/C++NPv2/Logging_Event_Handler_Ex.cpp: + Fixed users and tests to use the real name for gettimeofday() in + ACE_Abstract_Timer_Queue<> + + Wed Jul 1 02:09:44 UTC 2009 Carlos O'Ryan <coryan@glamdring> + + * ace/ace.mpc: + * ace/Makefile.am: + * ace/Event_Handler_Handle_Timeout_Upcall.h: + * ace/Event_Handler_Handle_Timeout_Upcall.inl: + * ace/Event_Handler_Handle_Timeout_Upcall.cpp: + First I noticed that this class did not depend on the lock type + at all, this was fortunate because I wanted to use it in a + generic way. So, change the class from a template class to a + regular class. That required moving the class to its own file too. + + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Wheel_T.h: + * ace/Timer_Wheel_T.cpp: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + Fixed several inconsistencies across these classes, for example, + most of them had typedef as a shorthand for the base class, but + the name of this typedef was not consistent. + Likewise, not all of the classes made the TIME_POLICY parameter + a default template parameter. + + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: + * ace/Timer_Queue_T.cpp: + Introduced an intermediate class between Abstract_Timer_Queue<> + and Timer_Queue_T<>. This is ugly, but the Proactor "needs" to + set a back-pointer from the FUNCTOR to the Proacter instance + whenever a timer queue is assigned to the Proactor. + This code smells funny. Either the API is wrong (the Proactor + should always create the functor with the backpointer,) or the + need for the back pointer is suspicious (I think there is a + thread in the Proactor that signals timers, but maybe it should + be contained in the Upcall object itself?) + The more I look here, the uglier the smell. + + * ace/Select_Reactor_T.cpp: + * ace/Timer_Queue_Adapters.cpp: + * tests/Timer_Queue_Reference_Counting_Test.cpp: + * tests/Timer_Queue_Test.cpp: + As a temporary measure, I appended "_abstract" to the + gettimeofday() function name in Abstract_Timer_Queue<>. + Shortly, I will change the Timer_Queue_T<> class to use + gettimeofday_non_virtual() or _static() or something similar. + Had to make the change in two steps to find all the uses of the + original function. + There was probably an easier/cleaner way to do this. + + * tests/Timer_Queue_Test.cpp: + Take advantage of the new ACE_Abstract_Timer_Queue<> to make the + different types of queues more compatible in ths test, including + queues with different time source policies. + + * ace/Proactor.h: + As with the Reactive version, I noticed that + ACE_Proactor_Handle_Timeout_Upcall did not depend on its + template parameter, so I changed the class to a non-template + version. + + * ace/Proactor.cpp: + Instead of making the Proactor a friend of the Timer_Handler + task, expose a safe interface to do what the proactor wants to + do. + The proactor needed access to timer queue internal details to + implement schedule(), but the reactor did not... hmmm... well, + turns out the Reactor had nicely refactor that work to the + upcall functor. So I did the same in the Proactor case. + + + * ace/Timer_List.h: + * ace/Timer_Wheel.h: + * ace/Timer_Hash.h: + * ace/Timer_Heap.h: + Use Event_Handler_Handle_Timeout_Upcall without the template + parameter. + + * ace/Abstract_Timer_Queue.h: + Remove the setter for getimeofday(), this is implemented by the + TIME_POLICY template parameter in Timer_Queue_T<> + + * tests/Reactor_Timer_Test.cpp: + * tests/Network_Adapters_Test.cpp: + * tests/Proactor_Timer_Test.cpp: + Use a different idiom to set the time policy for this test. + + * examples/Timer_Queue/Thread_Timer_Queue_Test.h: + * examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h: + * examples/APG/Timers/Timers.cpp: + * examples/APG/Timers/TimerDispatcher.cpp: + * examples/Reactor/Misc/test_timer_queue.cpp: + * examples/C++NPv2/Logging_Event_Handler_Ex.cpp: + Need an additional #include for ACE_Event_Handler_Handle_Timeout + Said class class is no longer a template class, so use it + correctly. + Changed name of gettimeofday() in timer queue to + gettimeofday_abstract() This is a temporary change to find all + the uses, will revert again soon. + + * Merged in changes from bug-3607 branch. + + * ace/ace.mpc: + * ace/Abstract_Timer_Queue.h: + * ace/Abstract_Timer_Queue.cpp: + * ace/Timer_Queue_Iterator.h: + * ace/Timer_Queue_Iterator.inl: + * ace/Timer_Queue_Iterator.cpp: + * ace/Timer_Queuefwd.h: + * ace/Timer_Queue.h: + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: + * ace/Timer_Queue_T.cpp: + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Wheel_T.h: + * ace/Timer_Wheel_T.cpp: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + Heavy refactoring in ACE_Timer_Queue_T class and friends. + First, created a template base class (ACE_Abstract_Timer_Queue) that: + 1) Only depends on the type held by the timer queue, not to lock + or upcall strategy. + 2) It is a pure abstract class, i.e., none of its member + functions have any implementation. + 3) Provides new pure virtual functions to encapsulates some + logic that was spread between tests, TP_Reactor and + Dev_Poll_Reactor. + Then I re-wrote all the standard timer queue objects in terms of + this class. In particular, the reactors use only the abstract + interface. + I also re-factored the Timer_Queue_Iterator to only depend on + the type of objects held by the timer queue. The rest of the + parameters where not used either. + Implement functionality that was spread in Dev_Poll_Reactor, + TP_Reactor and a test into expire_single. + + * ace/Proactor.h: + * ace/TP_Reactor.cpp: + * ace/Dev_Poll_Reactor.cpp: + Both classes implemented the logic to dispatch a single timer + but release a mutex before the upcall. This was confusing as + well as required exposing too much detail about the Timer_Queue + classes. + The new mechanism is a single function in (expire_single) + ACE_Abstract_Timer_Queue<> (implemented in ACE_Timer_Queue_T<>) + which receives a command object to encapsulate the mutex release. + + * ace/Functor.h: + * ace/Functor.cpp: + * ace/Functor_T.h: + * ace/Functor_T.inl: + Add helper ACE_Command_* objects. One is a no-op, for the test + below. The other is a callback that ignores the silly void* + argument in the ACE_Command_Base::execute() member function. + + * tests/Timer_Queue_Reference_Counting_Test.cpp: + Re-factored test in terms of expire_single() + + Tue Jun 30 01:10:04 UTC 2009 Carlos O'Ryan <coryan@glamdring> + + * This is a temporary commit into the 3707 branch. I realized too + late that the changes from 3706 will be needed to make this work. + + * ace/ace.mpc: + * ace/Time_Policy.h: + * ace/Time_Policy.inl: + * ace/Time_Policy.cpp: + New classes to encapsulate how "now" is computed in the Timer + Queues. This will be an additional template parameter, so the + default configuration has zero overhead. + + * ace/Timer_Queuefwd.h: + * ace/Timer_List.h: + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: + * ace/Timer_Queue_T.cpp: + * ace/Timer_Wheel.h: + * ace/Timer_Wheel_T.h: + * ace/Timer_Wheel_T.cpp: + * ace/Timer_Hash.h: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap.h: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + Re-factor timer queue classes to use new TIMER_POLICY + parameter. + + * tests/Timer_Queue_Test.cpp: + Modify test to use TIMER_POLICY. But here is the rub, the test + does not compile because all timer queue types are "different" + to each other. I need to introduce the base class from the + bug-3706 branch to make things work. + + Sun Jun 28 22:15:47 UTC 2009 Carlos O'Ryan <coryan@glamdring> + + * ace/ace.mpc: + * ace/Abstract_Timer_Queue.h: + * ace/Abstract_Timer_Queue.cpp: + * ace/Timer_Queue_Iterator.h: + * ace/Timer_Queue_Iterator.inl: + * ace/Timer_Queue_Iterator.cpp: + * ace/Timer_Queuefwd.h: + * ace/Timer_Queue.h: + * ace/Timer_Queue_T.h: + * ace/Timer_Queue_T.inl: + * ace/Timer_Queue_T.cpp: + * ace/Timer_List_T.h: + * ace/Timer_List_T.cpp: + * ace/Timer_Wheel_T.h: + * ace/Timer_Wheel_T.cpp: + * ace/Timer_Hash_T.h: + * ace/Timer_Hash_T.cpp: + * ace/Timer_Heap_T.h: + * ace/Timer_Heap_T.cpp: + Heavy refactoring in ACE_Timer_Queue_T class and friends. + First, created a template base class (ACE_Abstract_Timer_Queue) that: + 1) Only depends on the type held by the timer queue, not to lock + or upcall strategy. + 2) It is a pure abstract class, i.e., none of its member + functions have any implementation. + 3) Provides new pure virtual functions to encapsulates some + logic that was spread between tests, TP_Reactor and + Dev_Poll_Reactor. + Then I re-wrote all the standard timer queue objects in terms of + this class. In particular, the reactors use only the abstract + interface. + I also re-factored the Timer_Queue_Iterator to only depend on + the type of objects held by the timer queue. The rest of the + parameters where not used either. + Implement functionality that was spread in Dev_Poll_Reactor, + TP_Reactor and a test into expire_single. + + * ace/Proactor.h: + * ace/TP_Reactor.cpp: + * ace/Dev_Poll_Reactor.cpp: + Both classes implemented the logic to dispatch a single timer + but release a mutex before the upcall. This was confusing as + well as required exposing too much detail about the Timer_Queue + classes. + The new mechanism is a single function in (expire_single) + ACE_Abstract_Timer_Queue<> (implemented in ACE_Timer_Queue_T<>) + which receives a command object to encapsulate the mutex release. + + * ace/Functor.h: + * ace/Functor.cpp: + * ace/Functor_T.h: + * ace/Functor_T.inl: + Add helper ACE_Command_* objects. One is a no-op, for the test + below. The other is a callback that ignores the silly void* + argument in the ACE_Command_Base::execute() member function. + + * tests/Timer_Queue_Reference_Counting_Test.cpp: + Re-factored test in terms of expire_single() + + === end changelog === + +Wed Dec 14 16:09:22 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * docs/Download.html: - Updated filenames in text + * bin/auto_run_tests.pl: + Fixed DANCE_ROOT -Mon Jul 5 08:57:09 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Dec 12 19:04:55 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * docs/Download.html: - Update latest minor release to x.8.0 + * bin/MakeProjectCreator/config/vc11.features: + * bin/MakeProjectCreator/config/vc11nmake.mpb: + New files for vc11 -Mon Jul 5 08:19:17 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Dec 12 07:33:25 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * bin/diff-builds-and-group-fixed-tests-only.sh: - Updated for x.8.0 + === start changelog === - * bin/generate_rel_manpages: - Remove restriction to run on naboo, removed doxygen check, updated - error message + Fri Dec 9 10:41:02 UTC 2011 Marcel Smit <msmit@remedy.nl> - * docs/Download.html: - Updated to x.8.0 + * docs/svn/config: + Subversion should ignore *_svnt_T.*. - * etc/ace.doxygen: + === end changelog === + +Mon Dec 5 22:23:25 UTC 2011 Steve Huston <shuston@riverace.com> + + * ace/DLL.h: + * ace/DLL_Manager.h: Corrected and expanded the descriptions of how + DLL/library names are handled, decorated, and located. + +Mon Dec 5 20:16:51 UTC 2011 Steve Huston <shuston@riverace.com> + + * ace/Atomic_Op.{h inl}: + * ace/Atomic_Op_T.{h inl}: + * ace/Atomic_Op_GCC_T.{h inl}: + Added new method TYPE exchange (TYPE newval) which exchanges the + ACE_Atomic_Op's value with the specified new value. Thanks to John + Lilley for contributing this addition. + + * tests/Atomic_Op_Test.cpp: Added test for exchange(). + + * NEWS: Added description of the new exchange() method. + +Mon Dec 5 12:27:54 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/TTY_IO.h: + Doxygen fix + + * ace/config-linux.h: Layout changes - * etc/index.html: - Added 5.8 + * tests/Cached_Accept_Conn_Test.h: + * tests/Cached_Accept_Conn_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/QtReactor_Test.cpp: + Layout changes and removed some ACE_UNUSED_ARG usage - * rpmbuild/ace-tao.spec: - Changed version numbers to x.8.0 and added new ACE INet library +Mon Dec 5 11:25:31 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * bin/cleanbuilds.sh: + * bin/mail_test_stats.sh: + Extended our daily test stats with another email, the failing tests + for today excluding the not fixed ones + +Mon Dec 5 08:35:54 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> + + * docs/Download.html: + Release has vc9/vc10 -Sun Jul 04 18:57:33 CEST 2010 Johnny Willemsen <jwillemsen@remedy.nl> +Mon Dec 5 08:22:11 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl> - * ACE version 5.8 released. + * bin/diff-builds-and-group-fixed-tests-only.sh: + * docs/Download.html: + * etc/index.html: + Made 6.0.6 publicly available + + * docs/bczar/bczar.html: + Updated for next release and added wget step to get subversion config + file to make sure we checkout using commit timestamps Local Variables: mode: change-log diff --git a/dep/acelite/NEWS b/dep/acelite/NEWS index d648b09c237..cf60110b536 100644 --- a/dep/acelite/NEWS +++ b/dep/acelite/NEWS @@ -1,3 +1,186 @@ +USER VISIBLE CHANGES BETWEEN ACE-6.1.3 and ACE-6.1.4 +==================================================== + +. Added a new ACE_Time_Value derived template class (Time_Value_T.h): + + template <class TIME_POLICY> class ACE_Time_Value_T + + This template class overloads 4 new virtual methods from + the ACE_Time_Value base class to provide time policy aware + time values: + to_relative_time () + to_absolute_time () + now () + duplicate () + +. Updated time policy classes to return ACE_Time_Value_T<> instantiations + for the corresponding time policy instead of 'common' time values. + +. Added new ACE_Monotonic_Time_Policy (Monotonic_Time_Policy.h). + This class provides a monotonic time source for supported + platforms (Windows and POSIX platforms providing the required + clock_gettime() time source; currently verified for Windows and + Linux) + +. Updated OS_NS_Thread to use the new time policy support in ACE_Time_Value + for (relative) time calculations and added new ACE_OS::condattr_setclock () + method. + +. Added TIME_POLICY support to ACE_Condition_Attributes to allow for + monotonic timer support for ACE_Condition. + +. Added TIME_POLICY support to ACE_Message_Queue-s, ACE_Task-s and + related classes to enable support for monotonic timers in the timed + wait methods (ACE_Condition based). See docs/ACE-monotonic-timer.html + for how to use this. + +. Added two new regression tests: + Monotonic_Task_Test + Monotonic_Message_Queue_Test + and updated the Bug_4055_Regression_Test to a fixed state. + +USER VISIBLE CHANGES BETWEEN ACE-6.1.2 and ACE-6.1.3 +==================================================== + +. Added support for Oracle Solaris Studio 12 Update 3 (SunCC 5.12) + +. Added new XML_Utils library which comes from DAnCE but is now also used + by OpenDDS + +USER VISIBLE CHANGES BETWEEN ACE-6.1.1 and ACE-6.1.2 +==================================================== + +. Added compile time support for Windows CE 7, no runtime testing has + been performed + +. The High Res Timer global scale factor on Windows is now 64bit, see bugzilla + 3703 for the background of this. If you use the gsf in your code, use the + new ACE_High_Res_Timer::global_scale_factor_type type trait to not get + any conversion warnings + +. Removed Tandem NSK v2/v3 support which resulted in cleanup throughout all + code. The emulations for ACE_INT64/ACE_UINT64 have been removed because no + platform is using them anymore + +USER VISIBLE CHANGES BETWEEN ACE-6.1.0 and ACE-6.1.1 +==================================================== + +. Minor bug fixes + +USER VISIBLE CHANGES BETWEEN ACE-6.0.8 and ACE-6.1.0 +==================================================== + +. Added compilation support for VxWorks 6.9, no runtime + testing has been performed + +. Added ACE Run-length encoding compressor + +. Fixed several Coverity reported issues + +USER VISIBLE CHANGES BETWEEN ACE-6.0.7 and ACE-6.0.8 +==================================================== + +. Added support for MPC's new feature that creates dependency files for IDL + files when generating '-type gnuace' projects. Turned off by default, it + can be enabled in a features file or on the command line with + '-features ace_idl_dependencies=1'. + +USER VISIBLE CHANGES BETWEEN ACE-6.0.6 and ACE-6.0.7 +==================================================== + +. Added a new method to ACE_Atomic_Op<LOCK, TYPE>, TYPE exchange (TYPE newval) + which does an atomic exchange of the new value with ACE_Atomic_Op's value + and returns the old value. The tests/Atomic_Op_Test.cpp test program has a + test case that exemplifies its usage; see the Exchange_Tester class. + +. Added a new feature to timer queue templates classes: TIME_POLICY. + This feature is specified through a new template argument and provides the + timer queue with a policy for a timer (time of day) value. This feature is + intended to replace (in time) the gettimeofday setter method which has been + marked @deprecated. For now backwards compatibility is guaranteed. + The TIME_POLICY feature provides flexibility with regards to providing a timer + source to the timer queues as well as the possibility for a fully optimized + calling path. + A number of standard time policies are provided in ace/Time_Policy.h. + The tests/Timer_Queue_Test.cpp has been updated to reflect and exemplify these + changes. + +. Added the TIME_POLICY feature also to countdown time class which has now + become a template (ace/Countdown_Time_T.h) + +. Initial support for Microsoft Visual Studio 11 + +. Increased overall code quality by using Coverity and Klocwork + +USER VISIBLE CHANGES BETWEEN ACE-6.0.5 and ACE-6.0.6 +==================================================== + +. Removed autoconf support, only traditional way of + compilation is shipped from now + +. Add support for RHEL 6.1 64bit + +USER VISIBLE CHANGES BETWEEN ACE-6.0.4 and ACE-6.0.5 +==================================================== + +. Improved support for Android and added the ability to run all ACE/TAO tests + automatically using the Android emulator + +USER VISIBLE CHANGES BETWEEN ACE-6.0.3 and ACE-6.0.4 +==================================================== + +. Removed support for C++ Builder + +. Added support for building with the Android NDK, at least r5c. This + is currently available for linux host platforms. + +USER VISIBLE CHANGES BETWEEN ACE-6.0.2 and ACE-6.0.3 +==================================================== + +. Added support for GCC 4.6 + +USER VISIBLE CHANGES BETWEEN ACE-6.0.1 and ACE-6.0.2 +==================================================== + +. The ACE_wrappers/ace/OS.h file has been restored in order to ensure + build-time compatibility with older ACE versions. Its use will still + cause your build to incur more processing time than using the needed + ace/OS_NS_*.h files; however, you should be able to build OS.h-including + code without needing to replace it with OS_NS_* includes. + +. Improved and simplified QNX support + +. Changed rand_r() and getpwnam_r() to conform Single UNIX Specification. + +. Fixed performance of send_v on windows when individual iovec elements + are particularly large. + +USER VISIBLE CHANGES BETWEEN ACE-6.0.0 and ACE-6.0.1 +==================================================== + +. Added support for MinGW with GCC 4.5 + +USER VISIBLE CHANGES BETWEEN ACE-5.8.3 and ACE-6.0.0 +==================================================== + +. Changed the string format produced by ACE::timestamp() from the ctime + format "Day Mon dd hh:mm:ss yyyy" to ISO-8601 yyyy-mm-dd hh:mm:ss.mmmmmm. + This makes the time easier to collate and removes any dependence on locale. + The change affects the output from ACE_Log_Msg's %D format and both VERBOSE + and VERBOSE_LIGHT timestamps in addition to application-made direct calls + to ACE::timestamp(). + +. Removed GCC < 3 support + +. A new build system hook was added for users to include site-private rules + in a build. If a file named "rules.private.GNU" in located in any build + directory it will get included from + $ACE_ROOT/include/makeinclude/rules.local.GNU. The "private_rules_file" + make variable can be set to override the name and/or location of the file. + If no such rules file exists, its absence is silently ignored. This + facility can be used, for example, to integrate a specialized code checker + into the build process. + USER VISIBLE CHANGES BETWEEN ACE-5.8.2 and ACE-5.8.3 ==================================================== diff --git a/dep/acelite/README b/dep/acelite/README index 1b46d7fd6f4..35198116bf5 100644 --- a/dep/acelite/README +++ b/dep/acelite/README @@ -1,3 +1,5 @@ +$Id: README 94611 2011-10-06 11:54:28Z msmit $ + This document is also available at the following URL: http://www.cs.wustl.edu/~schmidt/ACE.html diff --git a/dep/acelite/THANKS b/dep/acelite/THANKS index a23b239e6b2..dd9480b47f8 100644 --- a/dep/acelite/THANKS +++ b/dep/acelite/THANKS @@ -1,8 +1,8 @@ ACKNOWLEDGEMENTS -ACE and TAO have been deeply influenced and improved by the following -members of my research group at Washington University in St. Louis, the -University of California at Irvine, and Vanderbilt University in Nashville. +ACE, TAO, CIAO, and DAnCE have been deeply influenced and improved by the +following members of my research group at Washington University in St. Louis, +the University of California at Irvine, and Vanderbilt University in Nashville. Everett Anderson <eea1 at cec dot wustl dot edu> Alexander Babu Arulanthu <alex at cs dot wustl dot edu> @@ -75,7 +75,7 @@ Torben Worm <tworm at cs dot wustl dot edu> Ming Xiong <xiongm at isis dot vanderbilt dot edu> I would also like to thank all the following people who have also -contributed to ACE and TAO over the years: +contributed to ACE, TAO, CIAO, and DAnCE over the years: Paul Stephenson <pstephenson at objectspace dot com> Olaf Kruger <okruger at cssc-melb dot tansu dot com dot au> @@ -411,7 +411,7 @@ Andrew Harbick <aharbick at opentext dot com> Pavel Motuzenko <p_motuzenko at hotmail dot com> Ross J. Lillie <lillie at rsch dot comm dot mot dot com> Sam Hauer <shauer at nmo dot gtegsc dot com> -Frank J. Hodum <fhodum at dctd dot saic dot com> +Frank J. Hodum <FRANK.J.HODUM at saic dot com> David Miron <dxm at crapper dot dsto dot defence dot gov dot au> Anton van Straaten <anton at appsolutions dot com> Joe Covalesky <joe at nowsol dot com> @@ -2339,6 +2339,36 @@ Matthew Waller <matthewrwaller at gmail dot com> Elez <elezsh at gmail dot com> Ranjit Hande <hande at avaya dot com> Van Vuong <vanvuong1 at us dot ibm dot com> +Mark <markg85 at gmail dot com> +Wendsomde Yameogo <wendsomde at yameogo dot com> +Shi John <John dot Shi at acxiom dot com> +Helmut Böing +Andrew Hill <lists at thefrog dot net> +Henk Jan Priester <hjpriester at gmail dot com> +Glenn Zickert <gzickert at comcast dot net> +Chris Galli <christian dot galli at gmail dot com> +Laura Autón García <darklulu+ace at gmail dot com> +Jonathan Saxton <jsaxton at appsecinc dot com> +Remko Duppen <remko dot duppen at syntel dot nl> +Paul Fitzpatrick <paul at robotrebuilt dot com> +Chad Beaulac <chad dot beaulac at objectivesolutions dot com> +Jochen Meier <gesammeltimusenet2009 at arcor dot de> +Thomas Pauli <thomas dot pauli at tu-dortmund dot de> +Qiao Zhiqiang <qiaozhiqiang at leadcoretech dot com> +JaeSung Lee <berise at gmail dot com> +Chong Wuk Pak <chong dot pak at lmco dot com> +Michael Frommberger <michael dot frommberger at gmx dot net> +Andrey Karpov <karpov at viva64 dot com> +Dmytro Ovdiienko <dmitriy dot ovdienko at gmail.com> +Andrea Sormanni <andrea dot sormanni at gmail dot com> +Thomas Stegemann <Thomas dot Stegemann at materna dot de> +David Simmonds <david dot simmonds at iggroup dot com> +Andreas Dröscher <ace at anticat dot ch> +Markus Manck <Markus dot Manck at Philotech dot de> +Deux deVille <dev2 at weitling dot net> +Mohsin Zaidi <mohsinrzaidi at gmail dot com> +Milind Pangarkar <Milind dot Pangarkar at amdocs dot com> +Ali Akbar Zarezadeh <akzare at cs dot uni-potsdam dot de> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/dep/acelite/VERSION b/dep/acelite/VERSION index 594af04e592..144300e4267 100644 --- a/dep/acelite/VERSION +++ b/dep/acelite/VERSION @@ -1,4 +1,4 @@ -This is ACE version 5.8.3, released Wed Oct 27 12:01:05 CEST 2010 +This is ACE version 6.1.4, released Wed Aug 29 08:16:04 CEST 2012 If you have any problems with or questions about ACE, please send e-mail to the ACE mailing list (ace-bugs@list.isis.vanderbilt.edu), diff --git a/dep/acelite/ace/ACE.cpp b/dep/acelite/ace/ACE.cpp index 433b5e3e788..a965eff09f6 100644 --- a/dep/acelite/ace/ACE.cpp +++ b/dep/acelite/ace/ACE.cpp @@ -1,4 +1,4 @@ -// $Id: ACE.cpp 92298 2010-10-21 11:15:17Z johnnyw $ +// $Id: ACE.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/ACE.h" @@ -25,10 +25,6 @@ #include "ace/OS_TLI.h" #include "ace/Truncate.h" -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -extern "C" int maxFiles; -#endif /* ACE_VXWORKS */ - #if !defined (__ACE_INLINE__) #include "ace/ACE.inl" #endif /* __ACE_INLINE__ */ @@ -68,7 +64,7 @@ ACE::out_of_handles (int error) #elif defined (HPUX) // On HPUX, we need to check for EADDRNOTAVAIL also. error == EADDRNOTAVAIL || -#elif defined (linux) +#elif defined (ACE_LINUX) // On linux, we need to check for ENOENT also. error == ENOENT || // For RedHat5.2, need to check for EINVAL too. @@ -2308,7 +2304,7 @@ ACE::format_hexdump (const char *buffer, ACE_TEXT (" ")); ++obuf; } - textver[j] = ACE_OS::ace_isprint (c) ? c : '.'; + textver[j] = ACE_OS::ace_isprint (c) ? c : u_char ('.'); } textver[j] = 0; @@ -2340,7 +2336,7 @@ ACE::format_hexdump (const char *buffer, ACE_TEXT (" ")); ++obuf; } - textver[i] = ACE_OS::ace_isprint (c) ? c : '.'; + textver[i] = ACE_OS::ace_isprint (c) ? c : u_char ('.'); } for (i = size % 16; i < 16; i++) @@ -2371,7 +2367,8 @@ ACE::format_hexdump (const char *buffer, // Returns the current timestamp in the form // "hour:minute:second:microsecond." The month, day, and year are -// also stored in the beginning of the date_and_time array. +// also stored in the beginning of the date_and_time array +// using ISO-8601 format. ACE_TCHAR * ACE::timestamp (ACE_TCHAR date_and_time[], @@ -2386,7 +2383,10 @@ ACE::timestamp (ACE_TCHAR date_and_time[], // Returns the given timestamp in the form // "hour:minute:second:microsecond." The month, day, and year are -// also stored in the beginning of the date_and_time array. +// also stored in the beginning of the date_and_time array +// using ISO-8601 format. +// 012345678901234567890123456 +// 2010-12-02 12:56:00.123456<nul> ACE_TCHAR * ACE::timestamp (const ACE_Time_Value& time_value, @@ -2396,92 +2396,32 @@ ACE::timestamp (const ACE_Time_Value& time_value, { //ACE_TRACE ("ACE::timestamp"); - if (date_and_timelen < 35) + // This magic number is from the formatting statement + // farther down this routine. + if (date_and_timelen < 27) { errno = EINVAL; return 0; } -#if defined (WIN32) - if (time_value == ACE_Time_Value::zero) - { - // Emulate Unix. Win32 does NOT support all the UNIX versions - // below, so DO we need this ifdef. - static const ACE_TCHAR *day_of_week_name[] = - { - ACE_TEXT ("Sun"), - ACE_TEXT ("Mon"), - ACE_TEXT ("Tue"), - ACE_TEXT ("Wed"), - ACE_TEXT ("Thu"), - ACE_TEXT ("Fri"), - ACE_TEXT ("Sat") - }; - - static const ACE_TCHAR *month_name[] = - { - ACE_TEXT ("Jan"), - ACE_TEXT ("Feb"), - ACE_TEXT ("Mar"), - ACE_TEXT ("Apr"), - ACE_TEXT ("May"), - ACE_TEXT ("Jun"), - ACE_TEXT ("Jul"), - ACE_TEXT ("Aug"), - ACE_TEXT ("Sep"), - ACE_TEXT ("Oct"), - ACE_TEXT ("Nov"), - ACE_TEXT ("Dec") - }; - - SYSTEMTIME local; - ::GetLocalTime (&local); - - ACE_OS::sprintf (date_and_time, - ACE_TEXT ("%3s %3s %2d %04d %02d:%02d:%02d.%06d"), - day_of_week_name[local.wDayOfWeek], - month_name[local.wMonth - 1], - (int) local.wDay, - (int) local.wYear, - (int) local.wHour, - (int) local.wMinute, - (int) local.wSecond, - (int) (local.wMilliseconds * 1000)); - return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; - } -#endif /* WIN32 */ - ACE_TCHAR timebuf[26]; // This magic number is based on the ctime(3c) man page. ACE_Time_Value cur_time = (time_value == ACE_Time_Value::zero) ? ACE_Time_Value (ACE_OS::gettimeofday ()) : time_value; time_t secs = cur_time.sec (); - - ACE_OS::ctime_r (&secs, - timebuf, - sizeof timebuf / sizeof (ACE_TCHAR)); - // date_and_timelen > sizeof timebuf! - ACE_OS::strsncpy (date_and_time, - timebuf, - date_and_timelen); - ACE_TCHAR yeartmp[5]; - ACE_OS::strsncpy (yeartmp, - &date_and_time[20], - 5); - ACE_TCHAR timetmp[9]; - ACE_OS::strsncpy (timetmp, - &date_and_time[11], - 9); - ACE_OS::sprintf (&date_and_time[11], -# if defined (ACE_USES_WCHAR) - ACE_TEXT ("%ls %ls.%06ld"), -# else - ACE_TEXT ("%s %s.%06ld"), -# endif /* ACE_USES_WCHAR */ - yeartmp, - timetmp, - cur_time.usec ()); - date_and_time[33] = '\0'; - return &date_and_time[15 + (return_pointer_to_first_digit != 0)]; + struct tm tms; + ACE_OS::localtime_r (&secs, &tms); + ACE_OS::snprintf (date_and_time, + date_and_timelen, + ACE_TEXT ("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d.%06ld"), + tms.tm_year + 1900, + tms.tm_mon + 1, + tms.tm_mday, + tms.tm_hour, + tms.tm_min, + tms.tm_sec, + static_cast<long> (cur_time.usec())); + date_and_time[date_and_timelen - 1] = '\0'; + return &date_and_time[10 + (return_pointer_to_first_digit != 0)]; } // This function rounds the request to a multiple of the page size. @@ -2866,9 +2806,7 @@ ACE::max_handles (void) #endif /* RLIMIT_NOFILE && !ACE_LACKS_RLIMIT */ #if defined (_SC_OPEN_MAX) - return ACE_OS::sysconf (_SC_OPEN_MAX); -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) - return maxFiles; + return static_cast<int> (ACE_OS::sysconf (_SC_OPEN_MAX)); #elif defined (FD_SETSIZE) return FD_SETSIZE; #else @@ -2915,7 +2853,7 @@ ACE::set_handle_limit (int new_limit, #if !defined (ACE_LACKS_RLIMIT) && defined (RLIMIT_NOFILE) rl.rlim_cur = new_limit; return ACE_OS::setrlimit (RLIMIT_NOFILE, &rl); -#elif defined (ACE_LACKS_RLIMIT_NOFILE) +#elif !defined (RLIMIT_NOFILE) return 0; #else // Must return EINVAL errno. @@ -3342,10 +3280,7 @@ ACE::strnew (const char *s) ACE_NEW_RETURN (t, char [ACE_OS::strlen (s) + 1], 0); - if (t == 0) - return 0; - else - return ACE_OS::strcpy (t, s); + return ACE_OS::strcpy (t, s); } #if defined (ACE_HAS_WCHAR) @@ -3358,10 +3293,7 @@ ACE::strnew (const wchar_t *s) ACE_NEW_RETURN (t, wchar_t[ACE_OS::strlen (s) + 1], 0); - if (t == 0) - return 0; - else - return ACE_OS::strcpy (t, s); + return ACE_OS::strcpy (t, s); } #endif /* ACE_HAS_WCHAR */ @@ -3400,7 +3332,7 @@ namespace // characters are allowed as the range endpoints. These characters // are the same values in both signed and unsigned chars so we // don't have to account for any "pathological cases." - for (char range = p[-1] + 1; range <= p[1]; ++range) + for (char range = static_cast<char> (p[-1] + 1); range <= p[1]; ++range) { if (equal_char (s, range, case_sensitive)) { diff --git a/dep/acelite/ace/ACE.h b/dep/acelite/ace/ACE.h index 04b39a85652..58eb1f68947 100644 --- a/dep/acelite/ace/ACE.h +++ b/dep/acelite/ace/ACE.h @@ -4,7 +4,7 @@ /** * @file ACE.h * - * $Id: ACE.h 92060 2010-09-27 18:08:48Z johnnyw $ + * $Id: ACE.h 93276 2011-02-04 20:03:53Z olli $ * * This file contains value added ACE functions that extend the * behavior of the UNIX and Win32 OS calls. @@ -474,15 +474,23 @@ namespace ACE ACE_DIRECTORY_SEPARATOR_CHAR); /** - * Returns the given timestamp in the form - * "hour:minute:second:microsecond." The month, day, and year are - * also stored in the beginning of the @a date_and_time array, which - * is a user-supplied array of size @a time_len> @c ACE_TCHARs. - * Returns 0 if unsuccessful, else returns pointer to beginning of the - * "time" portion of @a date_and_time. If @a - * return_pointer_to_first_digit is 0 then return a pointer to the - * space before the time, else return a pointer to the beginning of - * the time portion. + * Translate the given timestamp to ISO-8601 format. + * + * @param time_value ACE_Time_Value to format. This is assumed to be + * an absolute time value. + * @param date_and_time Array to hold the timestamp. + * @param time_len Size of @a date_and_time in ACE_TCHARs. + * Must be greater than or equal to 27. + * @param return_pointer_to_first_digit If true, returned pointer value + * is to the first time digit, else to the space + * prior to the first time digit. See Return Values. + * + * @retval 0 if unsuccessful, with errno set. If @a time_len is less than + * 27 errno will be EINVAL. + * @retval If successful, pointer to beginning of the "time" portion of + * @a date_and_time. If @a return_pointer_to_first_digit is false + * the pointer is actually to the space before the time, else + * the pointer is to the first time digit. */ extern ACE_Export ACE_TCHAR *timestamp (const ACE_Time_Value& time_value, ACE_TCHAR date_and_time[], @@ -490,15 +498,21 @@ namespace ACE bool return_pointer_to_first_digit = false); /** - * Returns the current timestamp in the form - * "hour:minute:second:microsecond." The month, day, and year are - * also stored in the beginning of the @a date_and_time array, which - * is a user-supplied array of size @a time_len> @c ACE_TCHARs. - * Returns 0 if unsuccessful, else returns pointer to beginning of the - * "time" portion of @a date_and_time. If @a - * return_pointer_to_first_digit is 0 then return a pointer to the - * space before the time, else return a pointer to the beginning of - * the time portion. + * Translate the current time to ISO-8601 timestamp format. + * + * @param date_and_time Array to hold the timestamp. + * @param time_len Size of @a date_and_time in ACE_TCHARs. + * Must be greater than or equal to 27. + * @param return_pointer_to_first_digit If true, returned pointer value + * is to the first time digit, else to the space + * prior to the first time digit. See Return Values. + * + * @retval 0 if unsuccessful, with errno set. If @a time_len is less than + * 27 errno will be EINVAL. + * @retval If successful, pointer to beginning of the "time" portion of + * @a date_and_time. If @a return_pointer_to_first_digit is false + * the pointer is actually to the space before the time, else + * the pointer is to the first time digit. */ extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], size_t time_len, @@ -650,6 +664,14 @@ namespace ACE return !((a < b) || (a > b)); } + /// Helper to avoid comparing floating point values with != + /// (uses < and > operators). + template <typename T> + bool is_inequal (const T& a, const T& b) + { + return !is_equal (a, b); + } + /// Hex conversion utility. extern ACE_Export ACE_TCHAR nibble2hex (u_int n); diff --git a/dep/acelite/ace/ACE.inl b/dep/acelite/ace/ACE.inl index e36e4f01f7b..95f45ee99d3 100644 --- a/dep/acelite/ace/ACE.inl +++ b/dep/acelite/ace/ACE.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: ACE.inl 91813 2010-09-17 07:52:52Z johnnyw $ +// $Id: ACE.inl 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_Thread.h" @@ -230,7 +230,7 @@ ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) ACE_INLINE ssize_t ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len) { -#if defined (ACE_WIN32) || defined (ACE_OPENVMS) || defined (ACE_TANDEM_T1248_PTHREADS) +#if defined (ACE_WIN32) || defined (ACE_OPENVMS) return ACE_OS::recv (handle, (char *) buf, len); #else return ACE_OS::read (handle, (char *) buf, len); diff --git a/dep/acelite/ace/ACE_crc_ccitt.cpp b/dep/acelite/ace/ACE_crc_ccitt.cpp index 7dfefa5c69d..c1455d79171 100644 --- a/dep/acelite/ace/ACE_crc_ccitt.cpp +++ b/dep/acelite/ace/ACE_crc_ccitt.cpp @@ -1,4 +1,4 @@ -// $Id: ACE_crc_ccitt.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: ACE_crc_ccitt.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/ACE.h" @@ -65,7 +65,7 @@ namespace /*****************************************************************/ } -#define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) +#define COMPUTE(var, ch) (var) = static_cast<ACE_UINT16> (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) // Open versioned namespace, if enabled by the user. ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -82,13 +82,13 @@ ACE::crc_ccitt (const char *string) COMPUTE (crc, *p); } - return ~crc; + return static_cast<ACE_UINT16> (~crc); } ACE_UINT16 ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc) { - crc = ~crc; + crc = static_cast<ACE_UINT16> (~crc); for (const char *p = (const char *) buffer, *e = (const char *) buffer + len; @@ -98,13 +98,13 @@ ACE::crc_ccitt (const void *buffer, size_t len, ACE_UINT16 crc) COMPUTE (crc, *p); } - return ~crc; + return static_cast<ACE_UINT16> (~crc); } ACE_UINT16 ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) { - crc = ~crc; + crc = static_cast<ACE_UINT16> (~crc); for (int i = 0; i < len; ++i) { @@ -115,7 +115,7 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) COMPUTE (crc, *p); } - return ~crc; + return static_cast<ACE_UINT16> (~crc); } // Close versioned namespace, if enabled by the user. diff --git a/dep/acelite/ace/ARGV.cpp b/dep/acelite/ace/ARGV.cpp index 3b46459fe5b..e64c5d8696f 100644 --- a/dep/acelite/ace/ARGV.cpp +++ b/dep/acelite/ace/ARGV.cpp @@ -1,4 +1,4 @@ -// $Id: ARGV.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: ARGV.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #ifndef ACE_ARGV_CPP #define ACE_ARGV_CPP @@ -167,6 +167,7 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[], CHAR_TYPE *first_buf = 0; CHAR_TYPE *second_buf = 0; + size_t buf_len = 1; // convert the first argv to a string if (first_argv != 0 && first_argv[0] != 0) @@ -175,6 +176,7 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[], first_buf, substitute_env_args, quote_args); + buf_len += ACE_OS::strlen (first_buf); } // convert the second argv to a string @@ -184,14 +186,12 @@ ACE_ARGV_T<CHAR_TYPE>::ACE_ARGV_T (CHAR_TYPE *first_argv[], second_buf, substitute_env_args, quote_args); + buf_len += ACE_OS::strlen (second_buf); } // Add the number of arguments in both the argvs. this->argc_ = first_argc + second_argc; - size_t buf_len = - ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; - // Allocate memory to the lenght of the combined argv string. ACE_NEW (this->buf_, CHAR_TYPE[buf_len + 1]); diff --git a/dep/acelite/ace/ARGV.h b/dep/acelite/ace/ARGV.h index 66e71810a95..1c291bd6eda 100644 --- a/dep/acelite/ace/ARGV.h +++ b/dep/acelite/ace/ARGV.h @@ -4,7 +4,7 @@ /** * @file ARGV.h * - * $Id: ARGV.h 81156 2008-03-30 20:56:47Z iliyan $ + * $Id: ARGV.h 95972 2012-07-26 10:20:42Z johnnyw $ * * @author Doug Schmidt <schmidt@cs.wustl.edu> * @author Everett Anderson <eea1@cs.wustl.edu> @@ -206,8 +206,8 @@ public: * * @param index Index to the desired element. * - * @retval Pointer to the indexed string. - * @retval 0 if @a index is out of bounds. + * @retval Pointer to the indexed string. + * @retval 0 if @a index is out of bounds. */ const CHAR_TYPE *operator[] (size_t index); diff --git a/dep/acelite/ace/ATM_Stream.inl b/dep/acelite/ace/ATM_Stream.inl index 007e25832a5..94de09004d4 100644 --- a/dep/acelite/ace/ATM_Stream.inl +++ b/dep/acelite/ace/ATM_Stream.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: ATM_Stream.inl 84262 2009-01-29 10:34:33Z johnnyw $ +// $Id: ATM_Stream.inl 92474 2010-11-02 13:29:39Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Abstract_Timer_Queue.cpp b/dep/acelite/ace/Abstract_Timer_Queue.cpp new file mode 100644 index 00000000000..3207733b24e --- /dev/null +++ b/dep/acelite/ace/Abstract_Timer_Queue.cpp @@ -0,0 +1,26 @@ +//$Id: Abstract_Timer_Queue.cpp 95334 2011-12-15 12:52:50Z msmit $ + +#ifndef ACE_ABSTRACT_TIMER_QUEUE_CPP +#define ACE_ABSTRACT_TIMER_QUEUE_CPP +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Abstract_Timer_Queue.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Even though the destructor is pure virtual you must provide an +// implementation. Most people know this, but sometimes we all +// forget, and we might be tempted to remove this code. +template<typename TYPE> +ACE_Abstract_Timer_Queue<TYPE>:: +~ACE_Abstract_Timer_Queue () +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ABSTRACT_TIMER_QUEUE_CPP */ diff --git a/dep/acelite/ace/Abstract_Timer_Queue.h b/dep/acelite/ace/Abstract_Timer_Queue.h new file mode 100644 index 00000000000..ddb8abf7f15 --- /dev/null +++ b/dep/acelite/ace/Abstract_Timer_Queue.h @@ -0,0 +1,230 @@ +//$Id: Abstract_Timer_Queue.h 95368 2011-12-19 13:38:49Z mcorino $ + +#ifndef ACE_ABSTRACT_TIMER_QUEUE_H +#define ACE_ABSTRACT_TIMER_QUEUE_H + +#include /**/ "ace/pre.h" +/** + * @file Abstract_Timer_Queue.h + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * + * Based on classes and files developed by Doug Schmidt, Darrell + * Brunsch, Irfan Pyarali and a cast of thousands. + */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declares +class ACE_Time_Value; +class ACE_Command_Base; +template<typename TYPE> class ACE_Timer_Queue_Iterator_T; +template<typename TYPE> class ACE_Timer_Node_T; + +/** + * @class ACE_Abstract_Timer_Queue + * + * @brief Base class for all timer queues of a single type. + * + * This is a base class for all the timer queues, regardless of + * locking strategy, upcall mechanism, internal implementation, etc. + * The class was motivated by bug 3706: + * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3706 + * In short, the Reactor (and potentially other classes) want to refer + * to timer queues regardless of the implementation internals. + */ +template<typename TYPE> +class ACE_Abstract_Timer_Queue +{ +public: + /// Destructor + virtual ~ACE_Abstract_Timer_Queue (void) = 0; + + /// True if queue is empty, else false. + virtual bool is_empty (void) const = 0; + + /// Returns the time of the earlier node in the Timer_Queue. Must + /// be called on a non-empty queue. + virtual const ACE_Time_Value &earliest_time (void) const = 0; + + /** + * Schedule @a type that will expire at @a future_time, which is + * specified in absolute time. If it expires then @a act is passed + * in as the value to the <functor>. If @a interval is != to + * ACE_Time_Value::zero then it is used to reschedule the @a type + * automatically, using relative time to the current <gettimeofday>. + * This method returns a <timer_id> that uniquely identifies the the + * @a type entry in an internal list. This <timer_id> can be used to + * cancel the timer before it expires. The cancellation ensures + * that <timer_ids> are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid <timer_id>). + */ + virtual long schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; + + /** + * Run the <functor> for all timers whose values are <= @a current_time. + * This does not account for <timer_skew>. Returns the number of + * timers canceled. + */ + virtual int expire (const ACE_Time_Value ¤t_time) = 0; + + /** + * Run the <functor> for all timers whose values are <= + * <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. + * + * Depending on the resolution of the underlying OS the system calls + * like select()/poll() might return at time different than that is + * specified in the timeout. Suppose the OS guarantees a resolution of t ms. + * The timeline will look like + * + * A B + * | | + * V V + * |-------------|-------------|-------------|-------------| + * t t t t t + * + * + * If you specify a timeout value of A, then the timeout will not occur + * at A but at the next interval of the timer, which is later than + * that is expected. Similarly, if your timeout value is equal to B, + * then the timeout will occur at interval after B. Now depending upon the + * resolution of your timeouts and the accuracy of the timeouts + * needed for your application, you should set the value of + * <timer_skew>. In the above case, if you want the timeout A to fire + * no later than A, then you should specify your <timer_skew> to be + * A % t. + * + * The timeout value should be specified via the macro ACE_TIMER_SKEW + * in your config.h file. The default value is zero. + * + * Things get interesting if the t before the timeout value B is zero + * i.e your timeout is less than the interval. In that case, you are + * almost sure of not getting the desired timeout behaviour. Maybe you + * should look for a better OS :-) + * + * Returns the number of timers canceled. + */ + virtual int expire (void) = 0; + + /** + * A couple of classes using Timer_Queues need to dispatch a single + * event at a time. But before they dispatch the event they need to + * release a lock, signal other threads, etc. + * + * This member function should be used in that case. The additional + * operations to be called just before dispatching the event, and + * only if an event will be dispatched, are encapsulated in the + * ACE_Command_Base object. + */ + virtual int expire_single(ACE_Command_Base & pre_dispatch_command) = 0; + + /** + * Resets the interval of the timer represented by @a timer_id to + * @a interval, which is specified in relative time to the current + * <gettimeofday>. If @a interval is equal to + * ACE_Time_Value::zero, the timer will become a non-rescheduling + * timer. Returns 0 if successful, -1 if not. + */ + virtual int reset_interval (long timer_id, + const ACE_Time_Value &interval) = 0; + + /** + * Cancel all timer associated with @a type. If + * @a dont_call_handle_close is 0 then the <functor> will be invoked, + * which typically invokes the <handle_close> hook. Returns number + * of timers cancelled. + */ + virtual int cancel (const TYPE &type, + int dont_call_handle_close = 1) = 0; + + /** + * Cancel the single timer that matches the @a timer_id value (which + * was returned from the <schedule> method). If act is non-NULL + * then it will be set to point to the ``magic cookie'' argument + * passed in when the timer was registered. This makes it possible + * to free up the memory and avoid memory leaks. If + * @a dont_call_handle_close is 0 then the <functor> will be invoked, + * which typically calls the <handle_close> hook. Returns 1 if + * cancellation succeeded and 0 if the @a timer_id wasn't found. + */ + virtual int cancel (long timer_id, + const void **act = 0, + int dont_call_handle_close = 1) = 0; + + /** + * Close timer queue. Cancels all timers. + */ + virtual int close (void) = 0; + + /** + * Returns the current time of day. This method allows different + * implementations of the timer queue to use special high resolution + * timers. + */ + virtual ACE_Time_Value gettimeofday (void) = 0; + + /** + * Allows applications to control how the timer queue gets the time + * of day. + * @deprecated Use TIME_POLICY support instead. See Timer_Queue_T.h + */ + virtual void gettimeofday (ACE_Time_Value (*gettimeofday)(void)) = 0; + + /// Determine the next event to timeout. Returns @a max if there are + /// no pending timers or if all pending timers are longer than max. + /// This method acquires a lock internally since it modifies internal state. + virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max) = 0; + + /** + * Determine the next event to timeout. Returns @a max if there are + * no pending timers or if all pending timers are longer than max. + * <the_timeout> should be a pointer to storage for the timeout value, + * and this value is also returned. This method does not acquire a + * lock internally since it doesn't modify internal state. If you + * need to call this method when the queue is being modified + * concurrently, however, you should make sure to acquire the <mutex()> + * externally before making the call. + */ + virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max, + ACE_Time_Value *the_timeout) = 0; + + /** + * Return the current time, using the right time policy and any + * timer skew defined in derived classes. + */ + virtual ACE_Time_Value current_time() = 0; + + /// Type of Iterator. + typedef ACE_Timer_Queue_Iterator_T<TYPE> ITERATOR; + + /// Returns a pointer to this ACE_Timer_Queue's iterator. + virtual ITERATOR & iter (void) = 0; + + /// Removes the earliest node from the queue and returns it + virtual ACE_Timer_Node_T<TYPE> *remove_first (void) = 0; + + /// Reads the earliest node from the queue and returns it. + virtual ACE_Timer_Node_T<TYPE> *get_first (void) = 0; + + /// Dump the state of a object. + virtual void dump (void) const = 0; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Abstract_Timer_Queue.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Abstract_Timer_Queue.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_ABSTRACT_TIMER_QUEUE_H */ diff --git a/dep/acelite/ace/Acceptor.cpp b/dep/acelite/ace/Acceptor.cpp index 236a35ba803..72bebfd78c4 100644 --- a/dep/acelite/ace/Acceptor.cpp +++ b/dep/acelite/ace/Acceptor.cpp @@ -1,4 +1,4 @@ -// $Id: Acceptor.cpp 91623 2010-09-06 09:30:59Z sma $ +// $Id: Acceptor.cpp 95730 2012-05-04 17:28:19Z johnnyw $ #ifndef ACE_ACCEPTOR_CPP #define ACE_ACCEPTOR_CPP @@ -900,7 +900,10 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor (void) - : delete_concurrency_strategy_ (false) + : svc_handler_ (0), + restart_ (false), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (false) { ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor"); this->reactor (0); @@ -911,7 +914,10 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor *reactor, ACE_Concurrency_Strategy<SVC_HANDLER> *cs) - : delete_concurrency_strategy_ (false) + : svc_handler_ (0), + restart_ (false), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (false) { ACE_TRACE ("ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Oneshot_Acceptor"); if (this->open (local_addr, reactor, cs) == -1) @@ -1010,7 +1016,7 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::register_handler if (tv != 0 && this->reactor ()->schedule_timer (this, synch_options.arg (), - *tv) == 0) + *tv) == -1) return -1; else return this->reactor ()->register_handler diff --git a/dep/acelite/ace/Acceptor.h b/dep/acelite/ace/Acceptor.h index 64cf488b9d4..fdd00d5a04d 100644 --- a/dep/acelite/ace/Acceptor.h +++ b/dep/acelite/ace/Acceptor.h @@ -4,7 +4,7 @@ /** * @file Acceptor.h * - * $Id: Acceptor.h 88800 2010-02-01 23:18:34Z shuston $ + * $Id: Acceptor.h 93624 2011-03-22 21:14:05Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -193,9 +193,9 @@ protected: virtual int accept_svc_handler (SVC_HANDLER *svc_handler); /** - * Bridge method for activating a {svc_handler} with the appropriate + * Bridge method for activating a @a svc_handler with the appropriate * concurrency strategy. The default behavior of this method is to - * activate the SVC_HANDLER by calling its {open} method (which + * activate the SVC_HANDLER by calling its open() method (which * allows the SVC_HANDLER to define its own concurrency strategy). * However, subclasses can override this strategy to do more * sophisticated concurrency activations (such as making the diff --git a/dep/acelite/ace/Active_Map_Manager.h b/dep/acelite/ace/Active_Map_Manager.h index a6c167e5f88..7bade46aa5b 100644 --- a/dep/acelite/ace/Active_Map_Manager.h +++ b/dep/acelite/ace/Active_Map_Manager.h @@ -4,7 +4,7 @@ /** * @file Active_Map_Manager.h * - * $Id: Active_Map_Manager.h 91066 2010-07-12 11:05:04Z johnnyw $ + * $Id: Active_Map_Manager.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Irfan Pyarali */ @@ -68,7 +68,7 @@ public: void decode (const void *data); /// Encode state of the active key into @a data. @a data must be as - /// big as the value returned from <size>. + /// big as the value returned from size(). void encode (void *data) const; /// Compare keys. diff --git a/dep/acelite/ace/Arg_Shifter.h b/dep/acelite/ace/Arg_Shifter.h index 57cd2b0f56c..123a70560cf 100644 --- a/dep/acelite/ace/Arg_Shifter.h +++ b/dep/acelite/ace/Arg_Shifter.h @@ -4,7 +4,7 @@ /** * @file Arg_Shifter.h * - * $Id: Arg_Shifter.h 91459 2010-08-25 09:51:01Z mcorino $ + * $Id: Arg_Shifter.h 95972 2012-07-26 10:20:42Z johnnyw $ * * @author Seth Widoff */ @@ -211,10 +211,10 @@ private: /// The index of <argv_> in which we'll stick the next known /// argument. - int front_; - /* This is not really the "front" at all. It's the point after + /** This is not really the "front" at all. It's the point after * which the unknown arguments end and at which the known arguments begin. */ + int front_; }; typedef ACE_Arg_Shifter_T<ACE_TCHAR> ACE_Arg_Shifter; diff --git a/dep/acelite/ace/Argv_Type_Converter.h b/dep/acelite/ace/Argv_Type_Converter.h index d41d839b671..0cf62fa089e 100644 --- a/dep/acelite/ace/Argv_Type_Converter.h +++ b/dep/acelite/ace/Argv_Type_Converter.h @@ -4,7 +4,7 @@ /** * @file Argv_Type_Converter.h * - * $Id: Argv_Type_Converter.h 83891 2008-11-28 11:01:50Z johnnyw $ + * $Id: Argv_Type_Converter.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Si Mong Park <spark@ociweb.com> */ @@ -78,7 +78,7 @@ private: /// argv list. void align_wchar_with_char (void); - /// Clean up removed (comsumed) argv entries and reset the pass flags. + /// Clean up removed (consumed) argv entries and reset the pass flags. void cleanup (void); #endif // ACE_USES_WCHAR diff --git a/dep/acelite/ace/Array_Base.h b/dep/acelite/ace/Array_Base.h index 0d6620a6ca6..9276bf6ee38 100644 --- a/dep/acelite/ace/Array_Base.h +++ b/dep/acelite/ace/Array_Base.h @@ -4,7 +4,7 @@ /** * @file Array_Base.h * - * $Id: Array_Base.h 84477 2009-02-16 13:30:38Z johnnyw $ + * $Id: Array_Base.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -67,21 +67,21 @@ public: ACE_Array_Base (size_type size = 0, ACE_Allocator * the_allocator = 0); - /// Dynamically initialize the entire array to the <default_value>. + /// Dynamically initialize the entire array to the @a default_value. ACE_Array_Base (size_type size, T const & default_value, ACE_Allocator * the_allocator = 0); /** * The copy constructor performs initialization by making an exact - * copy of the contents of parameter <s>, i.e., *this == s will + * copy of the contents of parameter @a s, i.e., *this == s will * return true. */ ACE_Array_Base (ACE_Array_Base<T> const & s); /** * Assignment operator performs an assignment by making an exact - * copy of the contents of parameter <s>, i.e., *this == s will + * copy of the contents of parameter @a s, i.e., *this == s will * return true. Note that if the <max_size_> of <array_> is >= than * <s.max_size_> we can copy it without reallocating. However, if * <max_size_> is < <s.max_size_> we must delete the <array_>, diff --git a/dep/acelite/ace/Array_Map.cpp b/dep/acelite/ace/Array_Map.cpp index 5530a8b54b6..25b4e24579c 100644 --- a/dep/acelite/ace/Array_Map.cpp +++ b/dep/acelite/ace/Array_Map.cpp @@ -1,4 +1,4 @@ -// $Id: Array_Map.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Array_Map.cpp 92386 2010-10-28 07:44:37Z johnnyw $ #ifndef ACE_ARRAY_MAP_CPP #define ACE_ARRAY_MAP_CPP @@ -15,7 +15,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -#ifndef ACE_LACKS_MEMBER_TEMPLATES template<typename Key, typename Value, class EqualTo> template<typename InputIterator> ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (InputIterator f, @@ -34,26 +33,6 @@ ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map (InputIterator f, // for (InputIterator i = f; i != l; ++i, ++n) // *n = *i; } -#else -template<typename Key, typename Value, class EqualTo> -ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map ( - typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator f, - typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator l) - : size_ (l - f) - , capacity_ (size_) - , nodes_ (size_ == 0 ? 0 : new value_type[size_]) -{ - (void) std::copy (f, - l, - ACE_make_checked_array_iterator (this->begin (), - this->size_)); - -// iterator n = this->begin (); - -// for (const_iterator i = f; i != l; ++i, ++n) -// *n = *i; -} -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ template<typename Key, typename Value, class EqualTo> ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map ( @@ -119,7 +98,6 @@ ACE_Array_Map<Key, Value, EqualTo>::insert ( return std::make_pair (i, inserted); } -#ifndef ACE_LACKS_MEMBER_TEMPLATES template<typename Key, typename Value, class EqualTo> template<typename InputIterator> void @@ -132,21 +110,6 @@ ACE_Array_Map<Key, Value, EqualTo>::insert (InputIterator f, InputIterator l) (void) this->insert (*i); } } -#else -template<typename Key, typename Value, class EqualTo> -void -ACE_Array_Map<Key, Value, EqualTo>::insert ( - typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator f, - typename ACE_Array_Map<Key, Value, EqualTo>::const_iterator l) -{ - this->grow (l - f); // Preallocate storage. - - for (const_iterator i = f; i != l; ++i) - { - (void) this->insert (*i); - } -} -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ template<typename Key, typename Value, class EqualTo> void diff --git a/dep/acelite/ace/Array_Map.h b/dep/acelite/ace/Array_Map.h index 1515ea45529..0bd3b1ffeda 100644 --- a/dep/acelite/ace/Array_Map.h +++ b/dep/acelite/ace/Array_Map.h @@ -4,7 +4,7 @@ /** * @file Array_Map.h * - * $Id: Array_Map.h 84136 2009-01-12 11:01:17Z johnnyw $ + * $Id: Array_Map.h 92386 2010-10-28 07:44:37Z johnnyw $ * * Light weight array-based map with fast iteration but linear * (i.e. O(n)) search times. STL-style interface is exposed. @@ -110,12 +110,8 @@ public: */ ACE_Array_Map (size_type s = 0); -#ifndef ACE_LACKS_MEMBER_TEMPLATES template<typename InputIterator> ACE_Array_Map (InputIterator f, InputIterator l); -#else - ACE_Array_Map (const_iterator f, const_iterator l); -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ ACE_Array_Map (ACE_Array_Map const & map); ACE_Array_Map & operator= (ACE_Array_Map const & map); @@ -181,14 +177,9 @@ public: */ std::pair<iterator, bool> insert (value_type const & x); -#ifndef ACE_LACKS_MEMBER_TEMPLATES /// Insert range of elements into map. template<typename InputIterator> void insert (InputIterator f, InputIterator l); -#else - /// Insert range of elements into map. - void insert (const_iterator f, const_iterator l); -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ /// Remove element at position @a pos from the map. void erase (iterator pos); diff --git a/dep/acelite/ace/Asynch_Acceptor.cpp b/dep/acelite/ace/Asynch_Acceptor.cpp index 56af2f14056..916b250b7af 100644 --- a/dep/acelite/ace/Asynch_Acceptor.cpp +++ b/dep/acelite/ace/Asynch_Acceptor.cpp @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: Asynch_Acceptor.cpp 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: Asynch_Acceptor.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #ifndef ACE_ASYNCH_ACCEPTOR_C #define ACE_ASYNCH_ACCEPTOR_C @@ -30,7 +30,8 @@ ACE_Asynch_Acceptor<HANDLER>::ACE_Asynch_Acceptor (void) pass_addresses_ (false), validate_new_connection_ (false), reissue_accept_ (1), - bytes_to_read_ (0) + bytes_to_read_ (0), + addr_family_ (0) { } @@ -297,8 +298,10 @@ ACE_Asynch_Acceptor<HANDLER>::handle_accept (const ACE_Asynch_Accept::Result &re // If no errors if (!error) { - // Update the Proactor. - new_handler->proactor (this->proactor ()); + // Update the Proactor unless make_handler() or constructed handler + // set up its own. + if (new_handler->proactor () == 0) + new_handler->proactor (this->proactor ()); // Pass the addresses if (this->pass_addresses_) diff --git a/dep/acelite/ace/Asynch_IO_Impl.h b/dep/acelite/ace/Asynch_IO_Impl.h index 06eb5c10a87..e820529dfb5 100644 --- a/dep/acelite/ace/Asynch_IO_Impl.h +++ b/dep/acelite/ace/Asynch_IO_Impl.h @@ -4,7 +4,7 @@ /** * @file Asynch_IO_Impl.h * - * $Id: Asynch_IO_Impl.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Asynch_IO_Impl.h 93359 2011-02-11 11:33:12Z mcorino $ * * * This class contains asbtract base classes for all the concrete @@ -81,7 +81,7 @@ public: /** * POSIX4 real-time signal number to be used for the - * operation. <signal_number> ranges from SIGRTMIN to SIGRTMAX. By + * operation. signal_number ranges from SIGRTMIN to SIGRTMAX. By * default, SIGRTMIN is used to issue <aio_> calls. This is a no-op * on non-POSIX4 systems and returns 0. */ diff --git a/dep/acelite/ace/Atomic_Op.h b/dep/acelite/ace/Atomic_Op.h index 4dee35e6efb..e2f477fbbc7 100644 --- a/dep/acelite/ace/Atomic_Op.h +++ b/dep/acelite/ace/Atomic_Op.h @@ -4,7 +4,7 @@ /** * @file Atomic_Op.h * - * $Id: Atomic_Op.h 91523 2010-08-27 14:18:02Z johnnyw $ + * $Id: Atomic_Op.h 95225 2011-12-05 20:25:15Z shuston $ * * @author Douglas C. Schmidt <schmidt@uci.edu> */ @@ -124,6 +124,9 @@ public: /// Atomically assign <rhs> to @c value_. ACE_Atomic_Op<ACE_Thread_Mutex, long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs); + /// Exchange value with @a newval. + long exchange (long newval); + /// Explicitly return @c value_. long value (void) const; @@ -221,6 +224,9 @@ public: /// Atomically assign <rhs> to @c value_. ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &rhs); + /// Exchange value with @a newval. + unsigned long exchange (unsigned long newval); + /// Explicitly return @c value_. unsigned long value (void) const; diff --git a/dep/acelite/ace/Atomic_Op.inl b/dep/acelite/ace/Atomic_Op.inl index 564017aec62..e1f1ca21143 100644 --- a/dep/acelite/ace/Atomic_Op.inl +++ b/dep/acelite/ace/Atomic_Op.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: Atomic_Op.inl 91813 2010-09-17 07:52:52Z johnnyw $ +// $Id: Atomic_Op.inl 95225 2011-12-05 20:25:15Z shuston $ #if defined (ACE_HAS_INTRINSIC_INTERLOCKED) # include "ace/os_include/os_intrin.h" @@ -190,6 +189,22 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= ( } ACE_INLINE long +ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange (long newval) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedExchange (const_cast<long *> (&this->value_), newval); +#elif defined (WIN32) + return ::InterlockedExchange (const_cast<long *> (&this->value_), newval); +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), newval); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_swap_ulong (reinterpret_cast<volatile unsigned long*>(&this->value_), newval); +#else /* WIN32 */ + return (*exchange_fn_) (&this->value_, newval); +#endif /* WIN32 */ +} + +ACE_INLINE long ACE_Atomic_Op<ACE_Thread_Mutex, long>::value (void) const { return this->value_; @@ -374,6 +389,22 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= ( } ACE_INLINE unsigned long +ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::exchange (unsigned long newval) +{ +#if defined (ACE_HAS_INTRINSIC_INTERLOCKED) + return ::_InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), newval); +#elif defined (WIN32) + return ::InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), newval); +#elif defined (ACE_HAS_VXATOMICLIB) + return ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_))), newval); +#elif defined (ACE_HAS_SOLARIS_ATOMIC_LIB) + return ::atomic_swap_ulong (&this->value_, newval); +#else /* WIN32 */ + return (*exchange_fn_) (reinterpret_cast<volatile long *> (&this->value_), newval); +#endif /* WIN32 */ +} + +ACE_INLINE unsigned long ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value (void) const { return this->value_; diff --git a/dep/acelite/ace/Atomic_Op_GCC_T.h b/dep/acelite/ace/Atomic_Op_GCC_T.h index 92bc771dda6..f980f7f022e 100644 --- a/dep/acelite/ace/Atomic_Op_GCC_T.h +++ b/dep/acelite/ace/Atomic_Op_GCC_T.h @@ -4,7 +4,7 @@ /** * @file Atomic_Op_GCC_T.h * - * $Id: Atomic_Op_GCC_T.h 89339 2010-03-05 12:20:47Z johnnyw $ + * $Id: Atomic_Op_GCC_T.h 95225 2011-12-05 20:25:15Z shuston $ * * @author Johnny Willemsen <jwillemsen@remedy.nl */ @@ -74,6 +74,9 @@ public: /// Atomically check if @c value_ less than rhs. bool operator< (T rhs) const; + /// Exchange value with @a newval. + T exchange (T newval); + /// Explicitly return @c value_. T value (void) const; diff --git a/dep/acelite/ace/Atomic_Op_GCC_T.inl b/dep/acelite/ace/Atomic_Op_GCC_T.inl index c6fe027022b..9559e1ec6e4 100644 --- a/dep/acelite/ace/Atomic_Op_GCC_T.inl +++ b/dep/acelite/ace/Atomic_Op_GCC_T.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: Atomic_Op_GCC_T.inl 89391 2010-03-08 13:53:30Z johnnyw $ +// $Id: Atomic_Op_GCC_T.inl 95225 2011-12-05 20:25:15Z shuston $ #if defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) @@ -131,6 +130,13 @@ ACE_Atomic_Op_GCC<T>::operator= ( template <typename T> ACE_INLINE T +ACE_Atomic_Op_GCC<T>::exchange (T newval) +{ + return __sync_val_compare_and_swap (&this->value_, this->value_, newval); +} + +template <typename T> +ACE_INLINE T ACE_Atomic_Op_GCC<T>::value (void) const { return this->value_; diff --git a/dep/acelite/ace/Atomic_Op_T.h b/dep/acelite/ace/Atomic_Op_T.h index 7a20049ced8..944c0454c38 100644 --- a/dep/acelite/ace/Atomic_Op_T.h +++ b/dep/acelite/ace/Atomic_Op_T.h @@ -4,7 +4,7 @@ /** * @file Atomic_Op_T.h * - * $Id: Atomic_Op_T.h 92353 2010-10-25 06:34:35Z johnnyw $ + * $Id: Atomic_Op_T.h 95761 2012-05-15 18:23:04Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@uci.edu> */ @@ -88,22 +88,17 @@ struct ACE_Type_Traits<unsigned long> typedef unsigned long parameter_type; }; -#ifndef ACE_LACKS_LONGLONG_T template<> struct ACE_Type_Traits<long long> { typedef long long parameter_type; }; -#endif /* !ACE_LACKS_LONGLONG_T */ -#if !defined (ACE_LACKS_LONGLONG_T) \ - && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) template<> struct ACE_Type_Traits<unsigned long long> { typedef unsigned long long parameter_type; }; -#endif /* !ACE_LACKS_LONGLONG_T && !ACE_LACKS_UNSIGNEDLONGLONG_T */ template<> struct ACE_Type_Traits<float> @@ -207,6 +202,9 @@ public: ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &operator= ( ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> const & rhs); + /// Exchange value with @a newval. + TYPE exchange (TYPE newval); + /// Explicitly return @c value_. TYPE value (void) const; @@ -318,6 +316,9 @@ public: /// Atomically check if @c value_ less than @a rhs. bool operator< (arg_type rhs) const; + /// Exchange value with @a newval. + TYPE exchange (TYPE newval); + /// Explicitly return @c value_. TYPE value (void) const; diff --git a/dep/acelite/ace/Atomic_Op_T.inl b/dep/acelite/ace/Atomic_Op_T.inl index 71ce1c1e267..87e6b55d7be 100644 --- a/dep/acelite/ace/Atomic_Op_T.inl +++ b/dep/acelite/ace/Atomic_Op_T.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Atomic_Op_T.inl 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Atomic_Op_T.inl 95225 2011-12-05 20:25:15Z shuston $ #include "ace/Guard_T.h" @@ -154,6 +154,16 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= ( template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::exchange (TYPE newval) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::exchange"); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); + std::swap (this->value_, newval); + return newval; +} + +template <class ACE_LOCK, class TYPE> +ACE_INLINE TYPE ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const { // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value"); @@ -308,6 +318,13 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< ( template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::exchange (TYPE newval) +{ + return this->impl_.exchange (newval); +} + +template <class ACE_LOCK, class TYPE> +ACE_INLINE TYPE ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const { return this->impl_.value (); diff --git a/dep/acelite/ace/Auto_Functor.h b/dep/acelite/ace/Auto_Functor.h index 2c2b81eb265..393a11c73bc 100644 --- a/dep/acelite/ace/Auto_Functor.h +++ b/dep/acelite/ace/Auto_Functor.h @@ -3,7 +3,7 @@ /** * @file Auto_Functor.h * - * $Id: Auto_Functor.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Auto_Functor.h 92386 2010-10-28 07:44:37Z johnnyw $ * * @author Carlos O'Ryan <coryan@atdesk.com> */ @@ -69,13 +69,11 @@ public: Auto_Functor<X,Functor>& operator= (Auto_Functor & rhs); // throw() -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) template<typename Y> Auto_Functor(Auto_Functor<Y,Functor>& rhs); // throw() template<typename Y> Auto_Functor<X,Functor>& operator= (Auto_Functor<Y,Functor>& rhs); // throw() -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ ~Auto_Functor(); // throw() @@ -97,13 +95,9 @@ public: Auto_Functor<X,Functor> & operator=(Auto_Functor_Ref<X,Functor> rhs); // throw() -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) template<typename Y> operator Auto_Functor_Ref<Y,Functor>(); // throw() template<typename Y> operator Auto_Functor<Y,Functor>(); // throw() -#else - operator Auto_Functor_Ref<X,Functor>(); // throw() -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ private: X * p_; diff --git a/dep/acelite/ace/Auto_Functor.inl b/dep/acelite/ace/Auto_Functor.inl index d4cb2cc0473..5e714e01410 100644 --- a/dep/acelite/ace/Auto_Functor.inl +++ b/dep/acelite/ace/Auto_Functor.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Auto_Functor.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Auto_Functor.inl 92386 2010-10-28 07:44:37Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -35,7 +35,6 @@ ACE_Utils::Auto_Functor<X,Functor>:: operator=(Auto_Functor & rhs) return *this; } -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) template<typename X, typename Functor> template<typename Y> ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>::Auto_Functor(Auto_Functor<Y,Functor>& rhs) : p_(rhs.release()) @@ -50,7 +49,6 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor<Y,Functor>& rhs) reset(rhs.release()); return *this; } -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ template<typename X, typename Functor> ACE_INLINE X & ACE_Utils::Auto_Functor<X,Functor>::operator*() const @@ -107,8 +105,6 @@ ACE_Utils::Auto_Functor<X,Functor>::operator=(Auto_Functor_Ref<X,Functor> rhs) return *this; } -#if !defined(ACE_LACKS_MEMBER_TEMPLATES) - template<typename X, typename Functor> template<typename Y> ACE_INLINE ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<Y,Functor>() { @@ -121,14 +117,4 @@ ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor<Y,Functor>( return ACE_Utils::Auto_Functor<Y,Functor>(release(), f_); } -#else - -template<typename X, typename Functor>ACE_INLINE -ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<X,Functor>() -{ - return ACE_Utils::Auto_Functor_Ref<X,Functor>(release(), f_); -} - -#endif /* ACE_LACKS_MEMBER_TEMPLATES */ - ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Auto_Ptr.h b/dep/acelite/ace/Auto_Ptr.h index 3183019aceb..e9468a73bc7 100644 --- a/dep/acelite/ace/Auto_Ptr.h +++ b/dep/acelite/ace/Auto_Ptr.h @@ -4,7 +4,7 @@ /** * @file Auto_Ptr.h * - * $Id: Auto_Ptr.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Auto_Ptr.h 92580 2010-11-15 09:48:02Z johnnyw $ * * @author Doug Schmidt <schmidt@uci.edu> * @author Irfan Pyarali <irfan@cs.wustl.edu> @@ -106,9 +106,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @brief Implements the draft C++ standard auto_ptr abstraction. - * This version can be used instead of auto_ptr<T>, and obviates - * the need for the ACE_AUTO_PTR_RESET macro on platforms like - * VC6 where the auto_ptr<T> is broken. + * This version can be used instead of auto_ptr<T> */ template <typename X> class ACE_Auto_Ptr : public ACE_Auto_Basic_Ptr <X> @@ -209,18 +207,6 @@ ACE_auto_ptr_reset (AUTO_PTR_TYPE & ap, ACE_END_VERSIONED_NAMESPACE_DECL -// Some platforms have an older version of auto_ptr -// support, which lacks reset, and cannot be disabled -// easily. Portability to these platforms requires -// use of the following ACE_AUTO_PTR_RESET macro. -// -// The TYPE macro parameter is no longer necessary but we leave it -// around for backward compatibility. This is also the reason why the -// ACE_auto_ptr_reset function template is not called -// ACE_AUTO_PTR_RESET. -# define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \ - ACE_auto_ptr_reset (AUTOPTR, NEWPTR); - #if defined (__ACE_INLINE__) #include "ace/Auto_Ptr.inl" #endif /* __ACE_INLINE__ */ diff --git a/dep/acelite/ace/Barrier.h b/dep/acelite/ace/Barrier.h index 84d7b6492ff..e1e3815e190 100644 --- a/dep/acelite/ace/Barrier.h +++ b/dep/acelite/ace/Barrier.h @@ -4,7 +4,7 @@ /** * @file Barrier.h * - * $Id: Barrier.h 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: Barrier.h 93359 2011-02-11 11:33:12Z mcorino $ * * Moved from Synch.h. * @@ -101,7 +101,7 @@ public: const ACE_TCHAR *name = 0, void *arg = 0); - /// Default dtor. + /// Default destructor. ~ACE_Barrier (void); /// Block the caller until all @c count threads have called @c wait and @@ -170,7 +170,7 @@ public: /// Create a Thread_Barrier, passing in the optional @a name. ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name = 0); - /// Default dtor. + /// Default destructor. ~ACE_Thread_Barrier (void); /// Dump the state of an object. diff --git a/dep/acelite/ace/Base_Thread_Adapter.cpp b/dep/acelite/ace/Base_Thread_Adapter.cpp index fd2629f1608..4b7b6a84c08 100644 --- a/dep/acelite/ace/Base_Thread_Adapter.cpp +++ b/dep/acelite/ace/Base_Thread_Adapter.cpp @@ -1,4 +1,4 @@ -// $Id: Base_Thread_Adapter.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Base_Thread_Adapter.cpp 95595 2012-03-07 13:33:25Z johnnyw $ #include "ace/Base_Thread_Adapter.h" @@ -29,12 +29,14 @@ ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter ( , ACE_SEH_EXCEPT_HANDLER selector , ACE_SEH_EXCEPT_HANDLER handler #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags ) : user_func_ (user_func) , arg_ (arg) , entry_point_ (entry_point) , thr_desc_ (td) , ctx_ (ACE_Service_Config::current()) + , flags_ (cancel_flags) { ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter"); @@ -83,6 +85,10 @@ ACE_Base_Thread_Adapter::sync_log_msg (const ACE_TCHAR *prg) (*ACE_Base_Thread_Adapter::sync_log_msg_hook_) (prg); } +ACE_OS_Thread_Descriptor::~ACE_OS_Thread_Descriptor (void) +{ +} + ACE_OS_Thread_Descriptor * ACE_Base_Thread_Adapter::thr_desc_log_msg (void) { diff --git a/dep/acelite/ace/Base_Thread_Adapter.h b/dep/acelite/ace/Base_Thread_Adapter.h index b36d18e4f13..2075e9122ad 100644 --- a/dep/acelite/ace/Base_Thread_Adapter.h +++ b/dep/acelite/ace/Base_Thread_Adapter.h @@ -4,7 +4,7 @@ /** * @file Base_Thread_Adapter.h * - * $Id: Base_Thread_Adapter.h 81239 2008-04-04 22:28:48Z iliyan $ + * $Id: Base_Thread_Adapter.h 95595 2012-03-07 13:33:25Z johnnyw $ * * @author Nanbor Wang <nanbor@cs.wustl.edu> */ @@ -33,9 +33,8 @@ # define ACE_THREAD_ADAPTER_NAME ace_thread_adapter #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ -// Run the thread entry point for the ACE_Thread_Adapter. This must -// be an extern "C" to make certain compilers happy... - +/// Run the thread entry point for the ACE_Thread_Adapter. This must +/// be an extern "C" to make certain compilers happy... extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -44,7 +43,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * @class ACE_OS_Thread_Descriptor * * @brief Parent class of all ACE_Thread_Descriptor classes. - * = + * * Container for ACE_Thread_Descriptor members that are * used in ACE_OS. */ @@ -54,6 +53,8 @@ public: /// Get the thread creation flags. long flags (void) const; + virtual ~ACE_OS_Thread_Descriptor (void); + protected: /// For use by ACE_Thread_Descriptor. ACE_OS_Thread_Descriptor (long flags = 0); @@ -61,17 +62,14 @@ protected: /** * Keeps track of whether this thread was created "detached" or not. * If a thread is *not* created detached then if someone calls - * <ACE_Thread_Manager::wait>, we need to join with that thread (and + * ACE_Thread_Manager::wait(), we need to join with that thread (and * close down the handle). */ long flags_; }; - - class ACE_Service_Gestalt; - /** * @class ACE_Base_Thread_Adapter * @@ -126,6 +124,7 @@ protected: , ACE_SEH_EXCEPT_HANDLER selector = 0 , ACE_SEH_EXCEPT_HANDLER handler = 0 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags = 0 ); /// Inherit the logging features if the parent thread has an /// ACE_Log_Msg. @@ -162,8 +161,8 @@ protected: /** * Optional thread descriptor. Passing this pointer in will force - * the spawned thread to cache this location in <Log_Msg> and wait - * until <Thread_Manager> fills in all information in thread + * the spawned thread to cache this location in Log_Msg and wait + * until Thread_Manager fills in all information in thread * descriptor. */ ACE_OS_Thread_Descriptor *thr_desc_; @@ -171,7 +170,7 @@ protected: /// The ACE_Log_Msg attributes. ACE_OS_Log_Msg_Attributes log_msg_attributes_; - /// That is usefull for gprof, define itimerval + /// That is useful for gprof, define itimerval #ifdef ACE_USES_GPROF struct itimerval itimer_; #endif // ACE_USES_GPROF @@ -179,6 +178,11 @@ protected: /// Keep a reference to the configuration context that spawns the /// thread so the child can inherit it. ACE_Service_Gestalt * const ctx_; + + /// Pass through the thread-creation flags that can only be acted on by + /// the spawned thread. Currently this is only the cancellation-related + /// flags. + long flags_; }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Basic_Stats.cpp b/dep/acelite/ace/Basic_Stats.cpp index ae663abe221..93c4c0bdde8 100644 --- a/dep/acelite/ace/Basic_Stats.cpp +++ b/dep/acelite/ace/Basic_Stats.cpp @@ -1,4 +1,4 @@ -// $Id: Basic_Stats.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Basic_Stats.cpp 95743 2012-05-13 12:29:28Z johnnyw $ #include "ace/Basic_Stats.h" #include "ace/Log_Msg.h" @@ -42,7 +42,9 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) } void -ACE_Basic_Stats::dump_results (const ACE_TCHAR *msg, ACE_UINT32 sf) const +ACE_Basic_Stats::dump_results ( + const ACE_TCHAR *msg, + ACE_Basic_Stats::scale_factor_type sf) const { #ifndef ACE_NLOGGING if (this->samples_count () == 0u) diff --git a/dep/acelite/ace/Basic_Stats.h b/dep/acelite/ace/Basic_Stats.h index bff1ff29f65..eb6c393b904 100644 --- a/dep/acelite/ace/Basic_Stats.h +++ b/dep/acelite/ace/Basic_Stats.h @@ -3,13 +3,12 @@ /** * @file Basic_Stats.h * - * $Id: Basic_Stats.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Basic_Stats.h 95743 2012-05-13 12:29:28Z johnnyw $ * * @author Carlos O'Ryan <coryan@uci.edu> */ //============================================================================= - #ifndef ACE_BASIC_STATS_H #define ACE_BASIC_STATS_H #include /**/ "ace/pre.h" @@ -32,6 +31,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Basic_Stats { public: +#if !defined (ACE_WIN32) + typedef ACE_UINT32 scale_factor_type; +#else + typedef ACE_UINT64 scale_factor_type; +#endif + /// Constructor /** * The number of samples is pre-allocated, and cannot changes once @@ -56,7 +61,7 @@ public: * presented in microseconds. */ void dump_results (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const; + scale_factor_type scale_factor) const; /// The number of samples ACE_UINT32 samples_count_; diff --git a/dep/acelite/ace/Basic_Types.cpp b/dep/acelite/ace/Basic_Types.cpp index 6c161098f8d..c915dabee17 100644 --- a/dep/acelite/ace/Basic_Types.cpp +++ b/dep/acelite/ace/Basic_Types.cpp @@ -1,136 +1,3 @@ -// $Id: Basic_Types.cpp 91366 2010-08-16 12:42:35Z mhengstmengel $ +// $Id: Basic_Types.cpp 95763 2012-05-16 06:43:51Z johnnyw $ #include "ace/Basic_Types.h" - -#if !defined (__ACE_INLINE__) -# include "ace/Basic_Types.inl" -#endif /* ! __ACE_INLINE__ */ - - -#if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# include "ace/Log_Msg.h" -# include "ace/OS_NS_stdio.h" -# include "ace/OS_NS_string.h" -# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -void -ACE_U_LongLong::output (FILE *file) const -{ - if (h_ () > 0) - ACE_OS::fprintf (file, "0x%lx%0*lx", h_ (), 2 * sizeof l_ (), l_ ()); - else - ACE_OS::fprintf (file, "0x%lx", l_ ()); -} - - -ACE_TCHAR * -ACE_U_LongLong::as_string (ACE_TCHAR *output, - unsigned int base, - unsigned int uppercase) const -{ - if (*this == 0) - { - ACE_OS::strcpy(output, "0"); - } - else - { - switch(base) - { - case 8: - { - unsigned int index = 0; - int bshift = 31; - while(bshift >= 1) - { - unsigned int sval = (this->h_ () >> bshift) & 7; - if (sval > 0 || index != 0) - { - output[index] = sval + '0'; - ++index; - } - bshift -= 3; - } - bshift = 30; - while(bshift >= 0) - { - unsigned int sval = (this->l_ () >> bshift) & 7; - // Combine the last bit of hi with the first 3-bit digit - if (bshift == 30) - { - sval |= (this->h_ () & 1) << 2; - } - if (sval > 0 || index != 0) - { - output[index] = sval + '0'; - ++index; - } - bshift -= 3; - } - output[index] = '\0'; - break; - } - case 10: - { - ACE_OS::sprintf(output, "%.0f", *this / 1.0); - break; - } - case 16: - { - if (this->h_ () != 0) - { - ACE_OS::sprintf(output, - (uppercase ? "%lX%0*lX" : "%lx%0*lx"), - this->h_ (), 2 * sizeof this->l_ (), - this->l_ ()); - } - else - { - ACE_OS::sprintf(output, - (uppercase ? "%lX" : "%lx"), this->l_ ()); - - } - break; - } - default: - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Unsupported base = %u\n"), base)); - output[0] = '\0'; - } - } - } - - return output; -} - - -# if !defined (ACE_LACKS_IOSTREAM_TOTALLY) -ostream& -operator<< (ostream& os, const ACE_U_LongLong& ll) -{ -#ifdef __TANDEM && (__CPLUSPLUS_VERSION >= 3) - unsigned long flags = os.flags(); -#else - unsigned long flags = os.setf(0); -#endif - char buffer[32]; - - if ((flags & ios::oct) != 0) - os << ll.as_string (buffer, 8); - else if ((flags & ios::hex) != 0) - os << ll.as_string (buffer, 16, (flags & ios::uppercase)); - else - os << ll.as_string (buffer); - return os; -} -# endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_LONGLONG_T */ - diff --git a/dep/acelite/ace/Basic_Types.h b/dep/acelite/ace/Basic_Types.h index bc467fafb5c..fc275ee314b 100644 --- a/dep/acelite/ace/Basic_Types.h +++ b/dep/acelite/ace/Basic_Types.h @@ -4,7 +4,7 @@ /** * @file Basic_Types.h * - * $Id: Basic_Types.h 91161 2010-07-21 18:25:12Z schmidt $ + * $Id: Basic_Types.h 96017 2012-08-08 22:18:09Z mitza $ * * @author David L. Levine * @@ -25,7 +25,6 @@ * - ACE_SIZEOF_LONG_DOUBLE * * Wrappers for built-in types of specific sizes: - * - ACE_USHORT16 (For backward compatibility. Use ACE_UINT16 instead.) * - ACE_INT8 * - ACE_UINT8 * - ACE_INT16 @@ -33,13 +32,10 @@ * - ACE_INT32 * - ACE_UINT32 * - ACE_UINT64 - * (@note ACE_INT64 is partly defined, there is no ACE_LongLong for - * platforms that don't have a native 8-byte integer type.) + * - ACE_INT64 * * Byte-order (endian-ness) determination: * ACE_BYTE_ORDER, to either ACE_BIG_ENDIAN or ACE_LITTLE_ENDIAN - * - * */ //============================================================================= @@ -60,10 +56,6 @@ # include "ace/os_include/os_stdlib.h" // Other types # include "ace/os_include/os_stddef.h" // Get ptrdiff_t - see further comments below -# if defined(ACE_LACKS_LONGLONG_T) -# include "ace/os_include/os_stdio.h" // For long long emulation -# endif /* ACE_LACKS_LONGLONG_T */ - # include "ace/os_include/sys/os_types.h" # if !defined (ACE_LACKS_SYS_PARAM_H) @@ -100,15 +92,11 @@ typedef ACE::If_Then_Else< ACE::If_Then_Else< (sizeof (void*) == sizeof (signed long)), signed long, -#ifdef ACE_LACKS_LONGLONG_T - void /* Unknown. Force an invalid type */ -#else ACE::If_Then_Else< (sizeof (void*) == sizeof (signed long long)), signed long long, void /* Unknown. Force an invalid type */ >::result_type -#endif /* ACE_LACKS_LONGLONG_T */ >::result_type >::result_type intptr_t; @@ -118,15 +106,11 @@ typedef ACE::If_Then_Else< ACE::If_Then_Else< (sizeof (void*) == sizeof (unsigned long)), unsigned long, -#ifdef ACE_LACKS_UNSIGNEDLONGLONG_T - void /* Unknown. Force an invalid type */ -#else ACE::If_Then_Else< (sizeof (void*) == sizeof (unsigned long long)), unsigned long long, void /* Unknown. Force an invalid type */ >::result_type -#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ >::result_type >::result_type uintptr_t; @@ -195,9 +179,7 @@ typedef ACE::If_Then_Else< // The number of bytes in a long long. # if !defined (ACE_SIZEOF_LONG_LONG) -# if defined (ACE_LACKS_LONGLONG_T) -# define ACE_SIZEOF_LONG_LONG 8 -# elif defined (ULLONG_MAX) +# if defined (ULLONG_MAX) # if ((ULLONG_MAX) == 4294967295ULL) # define ACE_SIZEOF_LONG_LONG 4 # elif ((ULLONG_MAX) == 18446744073709551615ULL) @@ -299,7 +281,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef int64_t ACE_INT64; #elif ACE_SIZEOF_LONG == 8 typedef long ACE_INT64; -#elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8 +#elif ACE_SIZEOF_LONG_LONG == 8 # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. @@ -308,29 +290,22 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef long long ACE_INT64; #endif /* defined (ACE_INT64_TYPE) */ -#if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)) -/* See matching #if around ACE_U_LongLong class declaration below */ - -# if defined (ACE_UINT64_TYPE) +#if defined (ACE_UINT64_TYPE) typedef ACE_UINT64_TYPE ACE_UINT64; -# elif defined (ACE_HAS_UINT64_T) +#elif defined (ACE_HAS_UINT64_T) typedef uint64_t ACE_UINT64; -# elif ACE_SIZEOF_LONG == 8 +#elif ACE_SIZEOF_LONG == 8 typedef unsigned long ACE_UINT64; -# elif ACE_SIZEOF_LONG_LONG == 8 +#elif ACE_SIZEOF_LONG_LONG == 8 # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. __extension__ # endif /* __GNUC__ */ typedef unsigned long long ACE_UINT64; -# endif /* defined (ACE_UINT64_TYPE) */ -#endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */ +#endif /* defined (ACE_UINT64_TYPE) */ - -typedef ACE_UINT16 ACE_USHORT16; // @@ Backward compatibility. - -// Define a generic byte for use in codecs +/// Define a generic byte for use in codecs typedef unsigned char ACE_Byte; // Define a pseudo wide character type when wchar is not supported so we @@ -428,240 +403,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL # define ACE_NTOHS(x) x # endif /* ACE_LITTLE_ENDIAN */ -#if defined (ACE_LACKS_LONGLONG_T) - // This throws away the high 32 bits. It's very unlikely that a - // pointer will be more than 32 bits wide if the platform does not - // support 64-bit integers. -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast<PTR_TYPE> (L.lo ()) -#elif defined (ACE_OPENVMS) && (!defined (__INITIAL_POINTER_SIZE) || (__INITIAL_POINTER_SIZE < 64)) # define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast<PTR_TYPE> (static_cast<int> (L)) -#else /* ! ACE_LACKS_LONGLONG_T */ -# define ACE_LONGLONG_TO_PTR(PTR_TYPE, L) \ - reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L)) -#endif /* ! ACE_LACKS_LONGLONG_T */ - -// If the platform lacks an unsigned long long, define one. -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -// Forward declaration for streams -# include "ace/iosfwd.h" - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class ACE_U_LongLong - * - * @brief Unsigned long long for platforms that don't have one. - * - * Provide our own unsigned long long. This is intended to be - * use with ACE_High_Res_Timer, so the division operator assumes - * that the quotient fits into a u_long. - * Please note that the constructor takes (optionally) two values. - * The high one contributes 0x100000000 times its value. So, - * for example, (0, 2) is _not_ 20000000000, but instead - * 0x200000000. To emphasize this, the default values are expressed - * in hex, and output () dumps the value in hex. - */ - class ACE_Export ACE_U_LongLong - { - public: - // = Initialization and termination methods. -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - ACE_U_LongLong (const long long value = 0x0); -#else - ACE_U_LongLong (const ACE_UINT32 lo = 0x0, const ACE_UINT32 hi = 0x0); -#endif - ACE_U_LongLong (const ACE_U_LongLong &); - ACE_U_LongLong &operator= (const ACE_U_LongLong &); - ACE_U_LongLong &operator= (const ACE_INT32 &); - ACE_U_LongLong &operator= (const ACE_UINT32 &); - ~ACE_U_LongLong (void); - - // = Overloaded relation operators. - bool operator== (const ACE_U_LongLong &) const; - bool operator== (const ACE_UINT32) const; - bool operator!= (const ACE_U_LongLong &) const; - bool operator!= (const ACE_UINT32) const; - bool operator< (const ACE_U_LongLong &) const; - bool operator< (const ACE_UINT32) const; - bool operator<= (const ACE_U_LongLong &) const; - bool operator<= (const ACE_UINT32) const; - bool operator> (const ACE_U_LongLong &) const; - bool operator> (const ACE_UINT32) const; - bool operator>= (const ACE_U_LongLong &) const; - bool operator>= (const ACE_UINT32) const; - - ACE_U_LongLong operator+ (const ACE_U_LongLong &) const; - ACE_U_LongLong operator+ (const ACE_UINT32) const; - ACE_U_LongLong operator- (const ACE_U_LongLong &) const; - ACE_U_LongLong operator- (const ACE_UINT32) const; - ACE_U_LongLong operator* (const ACE_UINT32) const; - ACE_U_LongLong &operator*= (const ACE_UINT32); - - ACE_U_LongLong operator<< (const unsigned int) const; - ACE_U_LongLong &operator<<= (const unsigned int); - ACE_U_LongLong operator>> (const unsigned int) const; - ACE_U_LongLong &operator>>= (const unsigned int); - - double operator/ (const double) const; - - ACE_U_LongLong &operator+= (const ACE_U_LongLong &); - ACE_U_LongLong &operator+= (const ACE_UINT32); - ACE_U_LongLong &operator-= (const ACE_U_LongLong &); - ACE_U_LongLong &operator-= (const ACE_UINT32); - ACE_U_LongLong &operator++ (); - ACE_U_LongLong &operator-- (); - const ACE_U_LongLong operator++ (int); - const ACE_U_LongLong operator-- (int); - ACE_U_LongLong &operator|= (const ACE_U_LongLong); - ACE_U_LongLong &operator|= (const ACE_UINT32); - ACE_U_LongLong &operator&= (const ACE_U_LongLong); - ACE_U_LongLong &operator&= (const ACE_UINT32); - - // Note that the following take ACE_UINT32 arguments. These are - // typical use cases, and easy to implement. But, they limit the - // return values to 32 bits as well. There are no checks for - // overflow. - ACE_UINT32 operator/ (const ACE_UINT32) const; - ACE_UINT32 operator% (const ACE_UINT32) const; - - // The following only operate on the lower 32 bits (they take only - // 32 bit arguments). - ACE_UINT32 operator| (const ACE_INT32) const; - ACE_UINT32 operator& (const ACE_INT32) const; - - // The following operators convert their arguments to - // ACE_UINT32. So, there may be information loss if they are - // used. - ACE_U_LongLong operator* (const ACE_INT32) const; - ACE_U_LongLong &operator*= (const ACE_INT32); - ACE_UINT32 operator/ (const ACE_INT32) const; -# if ACE_SIZEOF_INT == 4 - ACE_UINT32 operator/ (const unsigned long) const; - ACE_UINT32 operator/ (const long) const; -# else /* ACE_SIZEOF_INT != 4 */ - ACE_UINT32 operator/ (const unsigned int) const; - ACE_UINT32 operator/ (const int) const; -# endif /* ACE_SIZEOF_INT != 4 */ - - // = Helper methods. - /// Outputs the value to the FILE, in hex. - void output (FILE * = stdout) const; - - ACE_TCHAR *as_string (ACE_TCHAR *string, - unsigned int base = 10, - unsigned int uppercase = 0) const; - - ACE_UINT32 hi (void) const; - ACE_UINT32 lo (void) const; - - void hi (const ACE_UINT32 hi); - void lo (const ACE_UINT32 lo); - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - long long to_int64 (void) const; -# endif - - private: - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - long long data_; -#else - public: - struct ace_hi_lo_correct_endian - { -# if defined (ACE_BIG_ENDIAN) - /// High 32 bits. - ACE_UINT32 hi_; - /// Low 32 bits. - ACE_UINT32 lo_; - -# else - - /// Low 32 bits. - ACE_UINT32 lo_; - /// High 32 bits. - ACE_UINT32 hi_; -# endif /* ! ACE_BIG_ENDIAN */ - }; - private: - union - { - struct ace_hi_lo_correct_endian data_; - - /// To ensure alignment on 8-byte boundary. - double for_alignment_; - }; - - // @note the following four accessors are inlined here in - // order to minimize the extent of the data_ struct. It's - // only used here; the .i and .cpp files use the accessors. - - /// Internal utility function to hide access through struct. - const ACE_UINT32 &h_ () const { return data_.hi_; } - - /// Internal utility function to hide access through struct. - ACE_UINT32 &h_ () { return data_.hi_; } - - /// Internal utility function to hide access through struct. - const ACE_UINT32 &l_ () const { return data_.lo_; } - - /// Internal utility function to hide access through struct. - ACE_UINT32 &l_ () { return data_.lo_; } - - // @note the above four accessors are inlined here in - // order to minimize the extent of the data_ struct. It's - // only used here; the .inl and .cpp files use the accessors. - - /// These functions are used to implement multiplication. - ACE_UINT32 ul_shift (ACE_UINT32 a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const; - ACE_U_LongLong ull_shift (ACE_U_LongLong a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const; - ACE_U_LongLong ull_add (ACE_U_LongLong a, - ACE_U_LongLong b, - ACE_UINT32 *carry) const; - ACE_U_LongLong ull_mult (ACE_U_LongLong a, - ACE_UINT32 b, - ACE_UINT32 *carry) const; -#endif // ACE_LACKS_UNSIGNEDLONGLONG_T - }; - - typedef ACE_U_LongLong ACE_UINT64; - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - ostream &operator<< (ostream &, const ACE_U_LongLong &); -#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -# endif /* ACE_LACKS_LONGLONG_T */ + reinterpret_cast<PTR_TYPE> (static_cast<intptr_t> (L)) ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should -// be used on const ACE_UINT64's. -# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -inline ACE_UINT32 -ACE_U64_TO_U32 (ACE_U_LongLong const & n) -{ - /** - * @note We could add a cast operator to ACE_U_LongLong but that may - * cause more problems than it solves. Force users to perform - * an explicit cast via ACE_{C}U64_TO_{C}U32. - */ - return n.lo (); -} - -inline ACE_UINT32 -ACE_CU64_TO_CU32 (ACE_U_LongLong const & n) -{ - return ACE_U64_TO_U32 (n); -} -# else /* ! ACE_LACKS_LONGLONG_T */ inline ACE_UINT32 ACE_U64_TO_U32 (ACE_UINT64 n) { @@ -673,32 +419,24 @@ ACE_CU64_TO_CU32 (ACE_UINT64 n) { return static_cast<ACE_UINT32> (n); } -# endif /* ! ACE_LACKS_LONGLONG_T */ ACE_END_VERSIONED_NAMESPACE_DECL -// 64-bit literals require special marking on some platforms. -# if defined (ACE_LACKS_LONGLONG_T) - // Can only specify 32-bit arguments. -# define ACE_UINT64_LITERAL(n) n ## UL - // This one won't really work, but it'll keep - // some compilers happy until we have better support -# define ACE_INT64_LITERAL(n) n ## L -# elif defined (ACE_WIN32) -# if defined (__MINGW32__) -# define ACE_UINT64_LITERAL(n) n ## ull -# define ACE_INT64_LITERAL(n) n ## ll -# else -# define ACE_UINT64_LITERAL(n) n ## ui64 -# define ACE_INT64_LITERAL(n) n ## i64 -# endif /* defined (__MINGW32__) */ -# elif defined (__TANDEM) +#if defined (ACE_WIN32) +# if defined (__MINGW32__) +# define ACE_UINT64_LITERAL(n) n ## ull +# define ACE_INT64_LITERAL(n) n ## ll +# else +# define ACE_UINT64_LITERAL(n) n ## ui64 +# define ACE_INT64_LITERAL(n) n ## i64 +# endif /* defined (__MINGW32__) */ +#elif defined (__TANDEM) # define ACE_UINT64_LITERAL(n) n ## LL # define ACE_INT64_LITERAL(n) n ## LL -# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +#else /* ! ACE_WIN32 */ # define ACE_UINT64_LITERAL(n) n ## ull # define ACE_INT64_LITERAL(n) n ## ll -# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +#endif /* ! ACE_WIN32*/ #if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII) # if defined (PRId8) @@ -839,6 +577,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL #if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) # if defined (ACE_WIN64) # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d" +# elif defined (_WRS_CONFIG_LP64) +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" # else # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d" # endif /* ACE_WIN64 */ @@ -851,6 +591,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL #if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) # if defined (ACE_WIN64) # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u" +# elif defined (_WRS_CONFIG_LP64) +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" # else # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u" # endif /* ACE_WIN64 */ @@ -862,16 +604,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL // Cast from UINT64 to a double requires an intermediate cast to INT64 // on some platforms. -# if defined (ACE_LACKS_LONGLONG_T) - // Only use the low 32 bits. -# define ACE_UINT64_DBLCAST_ADAPTER(n) ACE_U64_TO_U32 (n) -# elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# define ACE_UINT64_DBLCAST_ADAPTER(n) ((n).to_int64 ()) -# elif defined (ACE_WIN32) -# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n) -# else /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ -# define ACE_UINT64_DBLCAST_ADAPTER(n) (n) -# endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +#if defined (ACE_WIN32) +# define ACE_UINT64_DBLCAST_ADAPTER(n) static_cast<__int64> (n) +#else /* ! ACE_WIN32 && */ +# define ACE_UINT64_DBLCAST_ADAPTER(n) (n) +#endif /* ! ACE_WIN32 && */ // The number of bytes in a float. @@ -934,19 +671,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL #define ACE_UINT32_MAX 0xFFFFFFFF #define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF) #define ACE_INT64_MIN -(ACE_INT64_MAX)-1 - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -// ACE_U_LongLong's constructor accepts a "long long" in this -// case. Set it to ACE_U_LongLong (-1) since the bit pattern for long -// long (-1) is the same as the maximum unsigned long long value. -# define ACE_UINT64_MAX ACE_U_LongLong (ACE_INT64_LITERAL (0xFFFFFFFFFFFFFFFF)) -#elif defined (ACE_LACKS_LONGLONG_T) -// ACE_U_LongLong's constructor accepts an ACE_UINT32 low and high -// pair of parameters. -# define ACE_UINT64_MAX ACE_U_LongLong (0xFFFFFFFFu, 0xFFFFFFFFu) -#else -# define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF) -#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ +#define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF) // These use ANSI/IEEE format. #define ACE_FLT_MAX 3.402823466e+38F @@ -954,9 +679,5 @@ ACE_END_VERSIONED_NAMESPACE_DECL #define ACE_DBL_MAX 1.7976931348623158e+308 #define ACE_DBL_MIN 2.2250738585072014e-308 -# if defined (__ACE_INLINE__) -# include "ace/Basic_Types.inl" -# endif /* __ACE_INLINE__ */ - # include /**/ "ace/post.h" #endif /* ACE_BASIC_TYPES_H */ diff --git a/dep/acelite/ace/Basic_Types.inl b/dep/acelite/ace/Basic_Types.inl deleted file mode 100644 index c6f0013d45e..00000000000 --- a/dep/acelite/ace/Basic_Types.inl +++ /dev/null @@ -1,954 +0,0 @@ -// -*- C++ -*- -// -// $Id: Basic_Types.inl 80826 2008-03-04 14:51:23Z wotte $ - -# if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -// Implementation for ACE_U_LongLong when we have signed long long -// but no unsigned long long. - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const long long value) - : data_ (value) -{ -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::hi (void) const -{ - return (data_ >> 32) & 0xFFFFFFFF; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::lo (void) const -{ - return data_ & 0xFFFFFFFF; -} - -ACE_INLINE void -ACE_U_LongLong::hi (const ACE_UINT32 hi) -{ - data_ = hi; - data_ <<= 32; -} - -ACE_INLINE void -ACE_U_LongLong::lo (const ACE_UINT32 lo) -{ - data_ = lo; -} - -ACE_INLINE long long -ACE_U_LongLong::to_int64 (void) const -{ - return data_; -} - -ACE_INLINE -ACE_U_LongLong::~ACE_U_LongLong (void) -{ -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const -{ - return data_ == n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_UINT32 n) const -{ - return data_ == n; -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_UINT32 n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const -{ - if (data_ > 0) - if (n.data_ > 0) - return data_ < n.data_; - else - return true; - else - if (n.data_ > 0) - return false; - else - return data_ < n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_UINT32 n) const -{ - return operator< (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const -{ - if (data_ == n.data_) return true; - - return data_ < n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_UINT32 n) const -{ - return operator<= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const -{ - if (data_ > 0) - if (n.data_ > 0) - return data_ > n.data_; - else - return false; - else - if (n.data_ > 0) - return true; - else - return data_ > n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_UINT32 n) const -{ - return operator> (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const -{ - if (data_ == n.data_) return true; - - return data_ > n.data_; -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_UINT32 n) const -{ - return operator>= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) - : data_ (n.data_) -{ -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_U_LongLong &n) -{ - data_ = n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_INT32 &rhs) -{ - if (rhs >= 0) - { - data_ = rhs; - data_ &= 0xFFFFFFFF; - } - else - { - // We do not handle the case where a negative 32 bit integer is - // assigned to this representation of a 64 bit unsigned integer. - // The "undefined behavior" behavior performed by this - // implementation is to simply set all bits to zero. - data_ = 0; - } - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) -{ - data_ = rhs; - - return *this; -} - - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const -{ - return data_ + n.data_; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_UINT32 n) const -{ - return operator+ (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const -{ - return data_ - n.data_; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_UINT32 n) const -{ - return operator- (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator<< (const u_int n) const -{ - return data_ << n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator<<= (const u_int n) -{ - data_ <<= n; - - return *this; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator>> (const u_int n) const -{ - return data_ >> n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator>>= (const u_int n) -{ - data_ >>= n; - - return *this; -} - -ACE_INLINE double -ACE_U_LongLong::operator/ (const double n) const -{ - return data_ / n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) -{ - data_ += n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_UINT32 n) -{ - return operator+= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_UINT32 n) const -{ - return data_ * n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_UINT32 n) -{ - data_ *= n; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) -{ - data_ -= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_UINT32 n) -{ - return operator-= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator++ () -{ - ++data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-- () -{ - --data_; - - return *this; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator++ (int) -{ - // Post-increment operator should always be implemented in terms of - // the pre-increment operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - ++*this; - return temp; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator-- (int) -{ - // Post-decrement operator should always be implemented in terms of - // the pre-decrement operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - --*this; - return temp; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_U_LongLong n) -{ - data_ |= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_UINT32 n) -{ - return operator|= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_U_LongLong n) -{ - data_ &= n.data_; - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_UINT32 n) -{ - return operator&= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_UINT32 n) const -{ - return data_ / n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator% (const ACE_UINT32 n) const -{ - return data_ % n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator| (const ACE_INT32 n) const -{ - return data_ | n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator& (const ACE_INT32 n) const -{ - return data_ & n; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_INT32 n) const -{ - return operator* ((ACE_UINT32) n); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_INT32 n) -{ - return operator*= ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_INT32 n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#if ACE_SIZEOF_INT == 4 -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#else /* ACE_SIZEOF_INT != 4 */ -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_int n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const int n) const -{ - return operator/ ((ACE_UINT32) n); -} -#endif - -ACE_END_VERSIONED_NAMESPACE_DECL - -#elif defined (ACE_LACKS_LONGLONG_T) - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi) -{ - h_ () = hi; - l_ () = lo; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::hi (void) const -{ - return h_ (); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::lo (void) const -{ - return l_ (); -} - -ACE_INLINE void -ACE_U_LongLong::hi (const ACE_UINT32 hi) -{ - h_ () = hi; -} - -ACE_INLINE void -ACE_U_LongLong::lo (const ACE_UINT32 lo) -{ - l_ () = lo; -} - -ACE_INLINE -ACE_U_LongLong::~ACE_U_LongLong (void) -{ -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_U_LongLong &n) const -{ - return h_ () == n.h_ () && l_ () == n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator== (const ACE_UINT32 n) const -{ - return h_ () == 0 && l_ () == n; -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_U_LongLong &n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator!= (const ACE_UINT32 n) const -{ - return ! (*this == n); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_U_LongLong &n) const -{ - return h_ () < n.h_ () ? 1 - : h_ () > n.h_ () ? 0 - : l_ () < n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator< (const ACE_UINT32 n) const -{ - return operator< (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_U_LongLong &n) const -{ - return h_ () < n.h_ () ? 1 - : h_ () > n.h_ () ? 0 - : l_ () <= n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator<= (const ACE_UINT32 n) const -{ - return operator<= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_U_LongLong &n) const -{ - return h_ () > n.h_ () ? 1 - : h_ () < n.h_ () ? 0 - : l_ () > n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator> (const ACE_UINT32 n) const -{ - return operator> (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const -{ - return h_ () > n.h_ () ? 1 - : h_ () < n.h_ () ? 0 - : l_ () >= n.l_ (); -} - -ACE_INLINE bool -ACE_U_LongLong::operator>= (const ACE_UINT32 n) const -{ - return operator>= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE -ACE_U_LongLong::ACE_U_LongLong (const ACE_U_LongLong &n) -{ - h_ () = n.h_ (); - l_ () = n.l_ (); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_U_LongLong &n) -{ - h_ () = n.h_ (); - l_ () = n.l_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_INT32 &rhs) -{ - if (rhs >= 0) - { - l_ () = static_cast<ACE_UINT32> (rhs); - h_ () = 0; - } - else - { - // We do not handle the case where a negative 32 bit integer is - // assigned to this representation of a 64 bit unsigned integer. - // The "undefined behavior" behavior performed by this - // implementation is to simply set all bits to zero. - l_ () = 0; - h_ () = 0; - } - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator= (const ACE_UINT32 &rhs) -{ - l_ () = rhs; - h_ () = 0; - - return *this; -} - - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_U_LongLong &n) const -{ - ACE_U_LongLong ret (l_ () + n.l_ (), h_ () + n.h_ ()); - if (ret.l_ () < n.l_ ()) /* carry */ ++ret.h_ (); - - return ret; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator+ (const ACE_UINT32 n) const -{ - return operator+ (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_U_LongLong &n) const -{ - ACE_U_LongLong ret (l_ () - n.l_ (), h_ () - n.h_ ()); - if (l_ () < n.l_ ()) /* borrow */ --ret.h_ (); - - return ret; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator- (const ACE_UINT32 n) const -{ - return operator- (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator<< (const u_int n) const -{ - const ACE_UINT32 carry_mask = l_ () >> (32 - n); - ACE_U_LongLong ret (n < 32 ? l_ () << n : 0, - n < 32 ? (h_ () << n) | carry_mask : carry_mask); - - return ret; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator<<= (const u_int n) -{ - const ACE_UINT32 carry_mask = l_ () >> (32 - n); - h_ () = n < 32 ? (h_ () << n) | carry_mask : carry_mask; - - // g++ 2.7.2.3/Solaris 2.5.1 doesn't modify l_ () if shifted by 32. - l_ () = n < 32 ? l_ () << n : 0; - - return *this; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator>> (const u_int n) const -{ - const ACE_UINT32 carry_mask = h_ () << (32 - n); - ACE_U_LongLong ret (n < 32 ? (l_ () >> n) | carry_mask : 0, - n < 32 ? h_ () >> n : 0); - - return ret; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator>>= (const u_int n) -{ - const ACE_UINT32 carry_mask = h_ () << (32 - n); - l_ () = n < 32 ? (l_ () >> n) | carry_mask : carry_mask; - h_ () = n < 32 ? h_ () >> n : 0; - - return *this; -} - -ACE_INLINE double -ACE_U_LongLong::operator/ (const double n) const -{ - // See the derivation above in operator/ (const ACE_UINT32). - - return ((double) 0xffffffffu - n + 1.0) / n * h_ () + - (double) h_ () + (double) l_ () / n; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_U_LongLong &n) -{ - h_ () += n.h_ (); - l_ () += n.l_ (); - if (l_ () < n.l_ ()) /* carry */ ++h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator+= (const ACE_UINT32 n) -{ - return operator+= (static_cast<const ACE_U_LongLong> (n)); -} - -#define ACE_HIGHBIT (~(~0UL >> 1)) - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::ul_shift (ACE_UINT32 a, ACE_UINT32 c_in, ACE_UINT32 *c_out) const -{ - const ACE_UINT32 b = (a << 1) | c_in; - *c_out = (*c_out << 1) + ((a & ACE_HIGHBIT) > 0); - - return b; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_shift (ACE_U_LongLong a, - ACE_UINT32 c_in, - ACE_UINT32 *c_out) const -{ - ACE_U_LongLong b; - - b.l_ () = (a.l_ () << 1) | c_in; - c_in = ((a.l_ () & ACE_HIGHBIT) > 0); - b.h_ () = (a.h_ () << 1) | c_in; - *c_out = (*c_out << 1) + ((a.h_ () & ACE_HIGHBIT) > 0); - - return b; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_add (ACE_U_LongLong a, ACE_U_LongLong b, ACE_UINT32 *carry) const -{ - ACE_U_LongLong r (0, 0); - ACE_UINT32 c1, c2, c3, c4; - - c1 = a.l_ () % 2; - c2 = b.l_ () % 2; - c3 = 0; - - r.l_ () = a.l_ ()/2 + b.l_ ()/2 + (c1+c2)/2; - r.l_ () = ul_shift (r.l_ (), (c1+c2)%2, &c3); - - c1 = a.h_ () % 2; - c2 = b.h_ () % 2; - c4 = 0; - - r.h_ () = a.h_ ()/2 + b.h_ ()/2 + (c1+c2+c3)/2; - r.h_ () = ul_shift (r.h_ (), (c1+c2+c3)%2, &c4); - - *carry = c4; - - return r; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::ull_mult (ACE_U_LongLong a, ACE_UINT32 b, ACE_UINT32 *carry) const -{ - register ACE_UINT32 mask = ACE_HIGHBIT; - const ACE_U_LongLong zero (0, 0); - ACE_U_LongLong accum (0, 0); - ACE_UINT32 c; - - *carry = 0; - if (b > 0) - do - { - accum = ull_shift (accum, 0U, carry); - if (b & mask) - accum = ull_add (accum, a, &c); - else - accum = ull_add (accum, zero, &c); - *carry += c; - mask >>= 1; - } - while (mask > 0); - - return accum; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_UINT32 n) const -{ - ACE_UINT32 carry; // will throw the carry away - - return ull_mult (*this, n, &carry); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_UINT32 n) -{ - ACE_UINT32 carry; // will throw the carry away - - return *this = ull_mult (*this, n, &carry); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_U_LongLong &n) -{ - h_ () -= n.h_ (); - if (l_ () < n.l_ ()) /* borrow */ --h_ (); - l_ () -= n.l_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-= (const ACE_UINT32 n) -{ - return operator-= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator++ () -{ - ++l_ (); - if (l_ () == 0) /* carry */ ++h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator-- () -{ - if (l_ () == 0) /* borrow */ --h_ (); - --l_ (); - - return *this; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator++ (int) -{ - // Post-increment operator should always be implemented in terms of - // the pre-increment operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - ++*this; - return temp; -} - -ACE_INLINE const ACE_U_LongLong -ACE_U_LongLong::operator-- (int) -{ - // Post-decrement operator should always be implemented in terms of - // the pre-decrement operator to enforce consistent semantics. - ACE_U_LongLong temp (*this); - --*this; - return temp; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_U_LongLong n) -{ - l_ () |= n.l_ (); - h_ () |= n.h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator|= (const ACE_UINT32 n) -{ - return operator|= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_U_LongLong n) -{ - l_ () &= n.l_ (); - h_ () &= n.h_ (); - - return *this; -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator&= (const ACE_UINT32 n) -{ - return operator&= (static_cast<const ACE_U_LongLong> (n)); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_UINT32 n) const -{ - // This takes advantage of the fact that the return type has only 32 - // bits. Replace 0x100000000 with 0xffffffff + 1 because the former - // has 33 bits. - // Quotient = (0x100000000u * hi_ + lo_) / n - // = ((0x100000000u - n + n) * hi_ + lo_) / n - // = ((0x100000000u - n) / n * hi_ + hi_ * n / n + lo_ / n - // = (0x100000000u - n) / n * hi_ + hi_ + lo_ / n - // = (0xffffffffu - n + 1) / n * hi_ + hi_ + lo_ / n - - return (0xffffffffu - n + 1) / n * h_ () + h_ () + l_ () / n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator% (const ACE_UINT32 n) const -{ - // Because the argument is an ACE_UINT32, the result can never be - // bigger than 32 bits. Replace 0x100000000 with 0xffffffff + 1 - // because the former has 33 bits. - // Mod = (0x100000000u * hi_ + lo_) % n - // = (0x100000000u % n * hi_ + lo_ % n) % n - // = ((0x100000000u - n) % n * hi_ + lo_ % n) % n - // = ((0xffffffffu - n + 1) % n * hi_ + lo_ % n) % n - - return ((0xffffffff - n + 1) % n * h_ () + l_ () % n) % n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator| (const ACE_INT32 n) const -{ - return l_ () | n; -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator& (const ACE_INT32 n) const -{ - return l_ () & n; -} - -ACE_INLINE ACE_U_LongLong -ACE_U_LongLong::operator* (const ACE_INT32 n) const -{ - return operator* ((ACE_UINT32) n); -} - -ACE_INLINE ACE_U_LongLong & -ACE_U_LongLong::operator*= (const ACE_INT32 n) -{ - return operator*= ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const ACE_INT32 n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#if ACE_SIZEOF_INT == 4 -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const long n) const -{ - return operator/ ((ACE_UINT32) n); -} - -#else /* ACE_SIZEOF_INT != 4 */ -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const u_int n) const -{ - return operator/ ((ACE_UINT32) n); -} - -ACE_INLINE ACE_UINT32 -ACE_U_LongLong::operator/ (const int n) const -{ - return operator/ ((ACE_UINT32) n); -} -#endif /* ACE_SIZEOF_INT != 4 */ - -ACE_END_VERSIONED_NAMESPACE_DECL - -#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ diff --git a/dep/acelite/ace/CDR_Base.cpp b/dep/acelite/ace/CDR_Base.cpp index 0acf651d4d1..04e87f65c94 100644 --- a/dep/acelite/ace/CDR_Base.cpp +++ b/dep/acelite/ace/CDR_Base.cpp @@ -1,4 +1,4 @@ -// $Id: CDR_Base.cpp 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: CDR_Base.cpp 94251 2011-06-22 18:03:25Z parsons $ #include "ace/CDR_Base.h" diff --git a/dep/acelite/ace/CDR_Base.h b/dep/acelite/ace/CDR_Base.h index 66a6d885710..f324152253f 100644 --- a/dep/acelite/ace/CDR_Base.h +++ b/dep/acelite/ace/CDR_Base.h @@ -4,7 +4,7 @@ /** * @file CDR_Base.h * - * $Id: CDR_Base.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: CDR_Base.h 95761 2012-05-15 18:23:04Z johnnyw $ * * ACE Common Data Representation (CDR) basic types. * @@ -213,7 +213,7 @@ public: typedef long LongLong; # elif defined(__TANDEM) typedef long long LongLong; -# elif ACE_SIZEOF_LONG_LONG == 8 && !defined (ACE_LACKS_LONGLONG_T) +# elif ACE_SIZEOF_LONG_LONG == 8 # if defined (sun) && !defined (ACE_LACKS_U_LONGLONG_T) // sun #defines u_longlong_t, maybe other platforms do also. // Use it, at least with g++, so that its -pedantic doesn't diff --git a/dep/acelite/ace/CDR_Size.h b/dep/acelite/ace/CDR_Size.h index a0b3c462ca8..ccf45324929 100644 --- a/dep/acelite/ace/CDR_Size.h +++ b/dep/acelite/ace/CDR_Size.h @@ -4,7 +4,7 @@ /** * @file CDR_Size.h * - * $Id: CDR_Size.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: CDR_Size.h 93359 2011-02-11 11:33:12Z mcorino $ * * * ACE Common Data Representation (CDR) size-calculating stream. @@ -13,7 +13,7 @@ * The current implementation assumes that the host has 1-byte, * 2-byte and 4-byte integral types, and that it has single * precision and double precision IEEE floats. - * Those assumptions are pretty good these days, with Crays beign + * Those assumptions are pretty good these days, with Crays being * the only known exception. * * diff --git a/dep/acelite/ace/CDR_Stream.cpp b/dep/acelite/ace/CDR_Stream.cpp index cc58132ca82..0d674324f68 100644 --- a/dep/acelite/ace/CDR_Stream.cpp +++ b/dep/acelite/ace/CDR_Stream.cpp @@ -1,4 +1,4 @@ -// $Id: CDR_Stream.cpp 91373 2010-08-17 07:35:27Z mhengstmengel $ +// $Id: CDR_Stream.cpp 95896 2012-06-18 20:42:07Z hillj $ #include "ace/CDR_Stream.h" #include "ace/SString.h" @@ -723,6 +723,72 @@ ACE_OutputCDR::write_short_placeholder (void) return buf; } +char * +ACE_OutputCDR::write_boolean_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::Boolean*> (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_char_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::Char*> (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_octet_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::OCTET_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::Octet*> (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_longlong_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::ULongLong*> (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_float_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::ULong*> (buf) = 0; + else + buf = 0; + return buf; +} + +char * +ACE_OutputCDR::write_double_placeholder (void) +{ + char *buf = 0; + if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) + *reinterpret_cast<ACE_CDR::ULongLong*> (buf) = 0; + else + buf = 0; + return buf; +} + ACE_CDR::Boolean ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) { @@ -745,6 +811,27 @@ ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) return true; } +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::ULong x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::ULong*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::ULong *> (loc) = x; + } + else + { + ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} ACE_CDR::Boolean ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc) @@ -768,6 +855,148 @@ ACE_OutputCDR::replace (ACE_CDR::Short x, char* loc) return true; } +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::UShort x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::UShort*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::UShort *> (loc) = x; + } + else + { + ACE_CDR::swap_2 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Boolean x, char* loc) +{ + if (this->find (loc) == 0) + return false; + + *reinterpret_cast<ACE_CDR::Boolean*> (loc) = x; + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Char x, char* loc) +{ + if (this->find (loc) == 0) + return false; + + *reinterpret_cast<ACE_CDR::Char*> (loc) = x; + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Octet x, char* loc) +{ + if (this->find (loc) == 0) + return false; + + *reinterpret_cast<ACE_CDR::Octet*> (loc) = x; + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::LongLong x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::LongLong*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::LongLong*> (loc) = x; + } + else + { + ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::ULongLong x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::ULongLong*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::ULongLong*> (loc) = x; + } + else + { + ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Float x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::Float*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::Float*> (loc) = x; + } + else + { + ACE_CDR::swap_4 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} + +ACE_CDR::Boolean +ACE_OutputCDR::replace (ACE_CDR::Double x, char* loc) +{ + if (this->find (loc) == 0) + return false; + +#if !defined (ACE_ENABLE_SWAP_ON_WRITE) + *reinterpret_cast<ACE_CDR::Double*> (loc) = x; +#else + if (!this->do_byte_swap_) + { + *reinterpret_cast<ACE_CDR::Double*> (loc) = x; + } + else + { + ACE_CDR::swap_8 (reinterpret_cast<const char*> (&x), loc); + } +#endif /* ACE_ENABLE_SWAP_ON_WRITE */ + + return true; +} int ACE_OutputCDR::consolidate (void) @@ -1682,7 +1911,17 @@ ACE_InputCDR::skip_string (void) ACE_CDR::ULong len = 0; if (this->read_ulong (len)) { - if (this->rd_ptr () + len <= this->wr_ptr ()) + if (static_cast<ACE_CDR::ULong> (~0u) == len) + { + // Indirection, next Long in stream is signed offset to actual + // string location (backwards in same stream from here). + ACE_CDR::Long offset = 0; + if (this->read_long (offset)) + { + return true; + } + } + else if (this->rd_ptr () + len <= this->wr_ptr ()) { this->rd_ptr (len); return true; diff --git a/dep/acelite/ace/CDR_Stream.h b/dep/acelite/ace/CDR_Stream.h index 0a200dc56dd..256560dea7e 100644 --- a/dep/acelite/ace/CDR_Stream.h +++ b/dep/acelite/ace/CDR_Stream.h @@ -4,7 +4,7 @@ /** * @file CDR_Stream.h * - * $Id: CDR_Stream.h 84527 2009-02-19 14:01:42Z johnnyw $ + * $Id: CDR_Stream.h 95896 2012-06-18 20:42:07Z hillj $ * * ACE Common Data Representation (CDR) marshaling and demarshaling * classes. @@ -318,6 +318,12 @@ public: */ char* write_long_placeholder (void); char* write_short_placeholder (void); + char* write_boolean_placeholder (void); + char* write_char_placeholder (void); + char* write_longlong_placeholder (void); + char* write_octet_placeholder (void); + char* write_float_placeholder (void); + char* write_double_placeholder (void); /** * Writes a new value into a specific location. This is commonly @@ -336,7 +342,16 @@ public: * @sa write_long_placeholder(), write_short_placeholder () */ ACE_CDR::Boolean replace (ACE_CDR::Long x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::ULong x, char* loc); ACE_CDR::Boolean replace (ACE_CDR::Short x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::UShort x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Boolean x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Char x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::LongLong x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::ULongLong x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Octet x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Float x, char* loc); + ACE_CDR::Boolean replace (ACE_CDR::Double x, char* loc); //@} /** @@ -1224,7 +1239,7 @@ protected: const ACE_CDR::ULong *x); /// Efficiently read @a length elements of size @a size each from - /// <input> into <x>; the data must be aligned to <align>. + /// @a input into @a x; the data must be aligned to @a align. ACE_CDR::Boolean read_array (ACE_InputCDR& input, void* x, size_t size, @@ -1232,9 +1247,9 @@ protected: ACE_CDR::ULong length); /** - * Efficiently write @a length elements of size @a size from <x> into - * <output>. Before inserting the elements enough padding is added - * to ensure that the elements will be aligned to <align> in the + * Efficiently write @a length elements of size @a size from @a x into + * @a output. Before inserting the elements enough padding is added + * to ensure that the elements will be aligned to @a align in the * stream. */ ACE_CDR::Boolean write_array (ACE_OutputCDR& output, @@ -1244,10 +1259,10 @@ protected: ACE_CDR::ULong length); /** - * Exposes the stream implementation of <adjust>, this is useful in + * Exposes the stream implementation of @a adjust, this is useful in * many cases to minimize memory allocations during marshaling. * On success @a buf will contain a contiguous area in the CDR stream - * that can hold @a size bytes aligned to <align>. + * that can hold @a size bytes aligned to @a align. * Results */ int adjust (ACE_OutputCDR& out, diff --git a/dep/acelite/ace/CE_Screen_Output.h b/dep/acelite/ace/CE_Screen_Output.h index ba2bc7c02b5..62d4deaa042 100644 --- a/dep/acelite/ace/CE_Screen_Output.h +++ b/dep/acelite/ace/CE_Screen_Output.h @@ -4,7 +4,7 @@ /** * @file CE_Screen_Output.h * - * $Id: CE_Screen_Output.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: CE_Screen_Output.h 94271 2011-06-23 14:52:31Z johnnyw $ * * @author Si Mong Park <spark@ociweb.com> */ @@ -39,7 +39,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * * This class allows standard text output to be displayed on * text window for Windows CE. Generally, all ACE output will - * go through under CE if and only if user uses WindozeCE + * go through under CE if and only if user uses Windows CE * implementation by using main_ce instead of main. * Also, for the easier debugging purpose, object pointer of * this class can be gotten from ACE_Log_Msg::msg_callback() diff --git a/dep/acelite/ace/CMakeLists.txt b/dep/acelite/ace/CMakeLists.txt index 6b5d3d84b40..a0a590e0c30 100644 --- a/dep/acelite/ace/CMakeLists.txt +++ b/dep/acelite/ace/CMakeLists.txt @@ -46,6 +46,7 @@ set(ace_STAT_SRCS Codeset_IBM1047.cpp Codeset_Registry.cpp Codeset_Registry_db.cpp + Condition_Attributes.cpp Condition_Recursive_Thread_Mutex.cpp Condition_Thread_Mutex.cpp Configuration.cpp @@ -53,7 +54,6 @@ set(ace_STAT_SRCS Connection_Recycling_Strategy.cpp Containers.cpp Copy_Disabled.cpp - Countdown_Time.cpp Date_Time.cpp DEV.cpp DEV_Addr.cpp @@ -73,6 +73,7 @@ set(ace_STAT_SRCS Encoding_Converter_Factory.cpp Event.cpp Event_Handler.cpp + Event_Handler_Handle_Timeout_Upcall.cpp FIFO.cpp FIFO_Recv.cpp FIFO_Recv_Msg.cpp @@ -89,7 +90,6 @@ set(ace_STAT_SRCS Functor.cpp Functor_String.cpp Get_Opt.cpp - gethrtime.cpp Handle_Ops.cpp Handle_Set.cpp Hashable.cpp @@ -289,6 +289,7 @@ set(ace_STAT_SRCS Thread_Mutex.cpp Thread_Semaphore.cpp Throughput_Stats.cpp + Time_Policy.cpp Time_Value.cpp Timeprobe.cpp TLI.cpp diff --git a/dep/acelite/ace/Cache_Map_Manager_T.cpp b/dep/acelite/ace/Cache_Map_Manager_T.cpp index 4fb5b93cac8..1527bce646b 100644 --- a/dep/acelite/ace/Cache_Map_Manager_T.cpp +++ b/dep/acelite/ace/Cache_Map_Manager_T.cpp @@ -1,4 +1,4 @@ -// $Id: Cache_Map_Manager_T.cpp 92097 2010-09-30 05:41:49Z msmit $ +// $Id: Cache_Map_Manager_T.cpp 95790 2012-05-24 15:06:21Z shuston $ #ifndef ACE_CACHE_MAP_MANAGER_T_CPP #define ACE_CACHE_MAP_MANAGER_T_CPP @@ -24,11 +24,8 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator) ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator) -#define ACE_T1 class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES -#define ACE_T2 KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES - -template <ACE_T1> -ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, size_t size, ACE_Allocator *alloc) : caching_strategy_ (caching_s) @@ -40,28 +37,28 @@ ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_ } -template <ACE_T1> -ACE_Cache_Map_Manager<ACE_T2>::~ACE_Cache_Map_Manager (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Cache_Map_Manager (void) { this->close (); } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::open (size_t length, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::open (size_t length, ACE_Allocator *alloc) { return this->map_.open (length, alloc); } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::close (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::close (void) { return this->map_.close (); } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::bind (const KEY &key, const VALUE &value) { // Insert an entry which has the <key> and the <cache_value> which @@ -96,8 +93,8 @@ ACE_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key, const VALUE &value) { CACHE_VALUE cache_value (value, @@ -133,8 +130,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key, const VALUE &value, VALUE &old_value) { @@ -180,8 +177,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, return rebind_result; } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value) @@ -229,8 +226,8 @@ ACE_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, return rebind_result; } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::trybind (const KEY &key, VALUE &value) { CACHE_VALUE cache_value (value, @@ -271,8 +268,8 @@ ACE_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, return trybind_result; } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key, VALUE &value) { // Lookup the key and populate the <value>. @@ -310,8 +307,8 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key, return find_result; } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key) { // Lookup the key and populate the <value>. CACHE_VALUE cache_value; @@ -323,7 +320,7 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key) { int result = this->caching_strategy_.notify_find (find_result, - cache_value.second ()); + cache_value.second); // Unless the find and notification operations go thru, this // method is not successful. @@ -348,8 +345,8 @@ ACE_Cache_Map_Manager<ACE_T2>::find (const KEY &key) } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key) { // Remove the entry from the cache. CACHE_VALUE cache_value; @@ -371,8 +368,8 @@ ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key) return unbind_result; } -template <ACE_T1> int -ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key, +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key, VALUE &value) { // Remove the entry from the cache. @@ -397,8 +394,8 @@ ACE_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key, return unbind_result; } -template <ACE_T1> void -ACE_Cache_Map_Manager<ACE_T2>::dump (void) const +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> void +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::dump (void) const { #if defined (ACE_HAS_DUMP) this->map_.dump (); @@ -407,9 +404,6 @@ ACE_Cache_Map_Manager<ACE_T2>::dump (void) const #endif /* ACE_HAS_DUMP */ } -#undef ACE_T1 -#undef ACE_T2 - template <class KEY, class VALUE, class IMPLEMENTATION, class CACHING_STRATEGY, class ATTRIBUTES> ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Cache_Map_Iterator (void) { diff --git a/dep/acelite/ace/Cached_Connect_Strategy_T.cpp b/dep/acelite/ace/Cached_Connect_Strategy_T.cpp index 738155a5784..a6f8acc77a0 100644 --- a/dep/acelite/ace/Cached_Connect_Strategy_T.cpp +++ b/dep/acelite/ace/Cached_Connect_Strategy_T.cpp @@ -1,4 +1,4 @@ -//$Id: Cached_Connect_Strategy_T.cpp 92097 2010-09-30 05:41:49Z msmit $ +//$Id: Cached_Connect_Strategy_T.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP #define ACE_CACHED_CONNECT_STRATEGY_T_CPP @@ -15,13 +15,10 @@ #include "ace/Thread_Manager.h" #include "ace/WFMO_Reactor.h" -#define ACE_T1 class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX -#define ACE_T2 SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX - ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_T1> -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::ACE_Cached_Connect_Strategy_Ex +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::ACE_Cached_Connect_Strategy_Ex (CACHING_STRATEGY &caching_s, ACE_Creation_Strategy<SVC_HANDLER> *cre_s, ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, @@ -34,18 +31,18 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::ACE_Cached_Connect_Strategy_Ex if (this->open (cre_s, con_s, rec_s) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex<ACE_T2>\n"))); + ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>\n"))); } -template <ACE_T1> -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::~ACE_Cached_Connect_Strategy_Ex (void) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::~ACE_Cached_Connect_Strategy_Ex (void) { cleanup (); } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::check_hint_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, @@ -134,8 +131,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::check_hint_i return 0; } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find_or_create_svc_handler_i +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, @@ -250,8 +247,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find_or_create_svc_handler_i return 0; } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh, +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cached_connect (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, @@ -312,8 +309,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh, } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::connect_svc_handler_i +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::connect_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, @@ -361,16 +358,19 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::connect_svc_handler_i entry->ext_id_.increment (); } - // For all successful cases: mark the <svc_handler> in the cache - // as being <in_use>. Therefore recyclable is BUSY. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); + if (entry) + { + // For all successful cases: mark the <svc_handler> in the cache + // as being <in_use>. Therefore recyclable is BUSY. + entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); + } return 0; } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cache_i (const void *recycling_act) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cache_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; @@ -382,8 +382,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cache_i (const void *recycling_act) return 0; } -template<ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act, +template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::recycle_state_i (const void *recycling_act, ACE_Recyclable_State new_state) { // The wonders and perils of ACT @@ -396,8 +396,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_a return 0; } -template<ACE_T1> ACE_Recyclable_State -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_act) const +template<class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> ACE_Recyclable_State +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::recycle_state_i (const void *recycling_act) const { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; @@ -407,8 +407,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::recycle_state_i (const void *recycling_a return entry->ext_id_.recycle_state (); } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_i (const void *recycling_act) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::purge_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; @@ -417,8 +417,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_i (const void *recycling_act) } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::mark_as_closed_i (const void *recycling_act) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::mark_as_closed_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; @@ -429,8 +429,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::mark_as_closed_i (const void *recycling_ return 0; } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup_hint_i (const void *recycling_act, +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cleanup_hint_i (const void *recycling_act, void **act_holder) { // Reset the <*act_holder> in the confines and protection of the @@ -457,20 +457,20 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup_hint_i (const void *recycling_ac return 0; } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::purge_connections (void) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::purge_connections (void) { return this->connection_cache_.purge (); } -template <ACE_T1> CACHING_STRATEGY & -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::caching_strategy (void) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> CACHING_STRATEGY & +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::caching_strategy (void) { return this->connection_cache_.caching_strategy (); } -template <ACE_T1> int -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> &search_addr, +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find (ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> &search_addr, ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, std::pair<SVC_HANDLER *, ATTRIBUTES> > *&entry) { typedef ACE_Hash_Map_Bucket_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, @@ -522,8 +522,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::find (ACE_Refcounted_Hash_Recyclable<ACE return -1; } -template <ACE_T1> void -ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup (void) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> void +ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::cleanup (void) { // Excluded other threads from changing the cache while we cleanup ACE_GUARD (MUTEX, ace_mon, *this->lock_); @@ -560,8 +560,8 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cleanup (void) ACE_ALLOC_HOOK_DEFINE(ACE_Cached_Connect_Strategy_Ex) ///////////////////////////////////////////////////////////////////////// -template <ACE_T1> -ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::ACE_Bounded_Cached_Connect_Strategy +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> +ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::ACE_Bounded_Cached_Connect_Strategy (size_t max_size, CACHING_STRATEGY &caching_s, ACE_Creation_Strategy<SVC_HANDLER> *cre_s, @@ -574,14 +574,14 @@ ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::ACE_Bounded_Cached_Connect_Strategy { } -template <ACE_T1> -ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::~ACE_Bounded_Cached_Connect_Strategy(void) +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> +ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::~ACE_Bounded_Cached_Connect_Strategy(void) { } -template <ACE_T1> +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> int -ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::find_or_create_svc_handler_i +ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, @@ -727,7 +727,4 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy) ACE_END_VERSIONED_NAMESPACE_DECL -#undef ACE_T1 -#undef ACE_T2 - #endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ diff --git a/dep/acelite/ace/Codeset_Registry.h b/dep/acelite/ace/Codeset_Registry.h index e72c435f82b..28bd629add0 100644 --- a/dep/acelite/ace/Codeset_Registry.h +++ b/dep/acelite/ace/Codeset_Registry.h @@ -3,7 +3,7 @@ /** * @file Codeset_Registry.h * - * $Id: Codeset_Registry.h 81348 2008-04-14 09:00:32Z johnnyw $ + * $Id: Codeset_Registry.h 93651 2011-03-28 08:49:11Z johnnyw $ * * ACE wrapper around access functions for the OSF's DCE codeset registry * access functions @@ -33,10 +33,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) -#include /**/ <dce/rpc.h> -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Codeset_Registry diff --git a/dep/acelite/ace/Codeset_Registry.inl b/dep/acelite/ace/Codeset_Registry.inl index 4419cf5e7fc..a8348180009 100644 --- a/dep/acelite/ace/Codeset_Registry.inl +++ b/dep/acelite/ace/Codeset_Registry.inl @@ -3,7 +3,7 @@ /** * @file Codeset_Registry.inl * - * $Id: Codeset_Registry.inl 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Codeset_Registry.inl 93651 2011-03-28 08:49:11Z johnnyw $ * * ACE wrapper around access functions for the OSF's DCE codeset registry * access functions - the inline functions either call the system supplied @@ -23,20 +23,10 @@ ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale, ACE_CDR::UShort *num_sets, ACE_CDR::UShort **char_sets) { -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - dce_cs_loc_to_rgy (locale.c_str(), - &codeset_id, - num_sets, - char_sets, - &result); - return (result == dce_cs_c_ok) ? 1 : 0; -#else return ACE_Codeset_Registry::locale_to_registry_i (locale, codeset_id, num_sets, char_sets); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } // based on a registry value, find the locale string and optional codeset @@ -48,23 +38,10 @@ ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id, ACE_CDR::UShort *num_sets, ACE_CDR::UShort **char_sets) { -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - char *buffer; - dce_cs_rgy_to_loc (codeset_id, - &buffer, - num_sets, - char_sets, - &result); - locale.set(buffer); // does a copy :-( - free (buffer); - return (result == dce_cs_c_ok) ? 1 : 0; -#else return ACE_Codeset_Registry::registry_to_locale_i (codeset_id, locale, num_sets, char_sets); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } // Tell if two codesets are compatible. This wraps the @@ -74,13 +51,7 @@ int ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, ACE_CDR::ULong other) { -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - rpc_cs_char_set_compat_check(codeset_id,other,&result); - return (result == rpc_s_ok) ? 1 : 0; -#else return ACE_Codeset_Registry::is_compatible_i (codeset_id,other); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } // Return the max number of bytes required to represent a single character. @@ -89,14 +60,7 @@ ACE_INLINE ACE_CDR::Short ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id) { -#if defined (ACE_HAS_DCE_CODESET_REGISTRY) - error_status_t result; - short max_bytes; - rpc_rgy_get_max_bytes(codeset_id,&max_bytes,&result); - return (result == rpc_s_ok) ? (short)max_bytes : 0; -#else return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); -#endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/ACE_Compression_export.h b/dep/acelite/ace/Compression/ACE_Compression_export.h new file mode 100644 index 00000000000..119e14b16ea --- /dev/null +++ b/dep/acelite/ace/Compression/ACE_Compression_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_Compression_export.h 95545 2012-02-23 07:57:08Z johnnyw $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ACE_Compression +// ------------------------------ +#ifndef ACE_COMPRESSION_EXPORT_H +#define ACE_COMPRESSION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_COMPRESSION_HAS_DLL) +# define ACE_COMPRESSION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_COMPRESSION_HAS_DLL */ + +#if !defined (ACE_COMPRESSION_HAS_DLL) +# define ACE_COMPRESSION_HAS_DLL 1 +#endif /* ! ACE_COMPRESSION_HAS_DLL */ + +#if defined (ACE_COMPRESSION_HAS_DLL) && (ACE_COMPRESSION_HAS_DLL == 1) +# if defined (ACE_COMPRESSION_BUILD_DLL) +# define ACE_Compression_Export ACE_Proper_Export_Flag +# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_COMPRESSION_BUILD_DLL */ +# define ACE_Compression_Export ACE_Proper_Import_Flag +# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_COMPRESSION_BUILD_DLL */ +#else /* ACE_COMPRESSION_HAS_DLL == 1 */ +# define ACE_Compression_Export +# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) +# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_COMPRESSION_HAS_DLL == 1 */ + +// Set ACE_COMPRESSION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_COMPRESSION_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_COMPRESSION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_COMPRESSION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_COMPRESSION_NTRACE */ + +#if (ACE_COMPRESSION_NTRACE == 1) +# define ACE_COMPRESSION_TRACE(X) +#else /* (ACE_COMPRESSION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_COMPRESSION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_COMPRESSION_NTRACE == 1) */ + +#endif /* ACE_COMPRESSION_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/Compression/Compressor.cpp b/dep/acelite/ace/Compression/Compressor.cpp new file mode 100644 index 00000000000..86d1a1f3dd2 --- /dev/null +++ b/dep/acelite/ace/Compression/Compressor.cpp @@ -0,0 +1,63 @@ +// $Id: Compressor.cpp 95556 2012-02-24 09:14:51Z johnnyw $ + +#include "Compressor.h" + +#if !defined (__ACE_INLINE__) +#include "Compressor.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Compressor::ACE_Compressor( ACE_CompressorId compressor_id, + ACE_UINT32 compression_level ) + : compressor_id_ (compressor_id) + , compression_level_ (compression_level) + , compressed_bytes_ (0) + , uncompressed_bytes_ (0) +{} + +ACE_Compressor::~ACE_Compressor () +{ +} + +ACE_UINT64 +ACE_Compressor::compressed_bytes(void) const +{ + ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 ); + return this->compressed_bytes_; +} + +ACE_UINT64 +ACE_Compressor::uncompressed_bytes(void) const +{ + ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 ); + return this->uncompressed_bytes_; +} + +void +ACE_Compressor::reset_stats(void) +{ + ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ ); + this->compressed_bytes_ = 0; + this->uncompressed_bytes_ = 0; +} + +void +ACE_Compressor::update_stats(ACE_UINT64 uncompressed_bytes, ACE_UINT64 compressed_bytes) +{ + ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ ); + this->compressed_bytes_ += compressed_bytes; + this->uncompressed_bytes_ += uncompressed_bytes; +} + +float +ACE_Compressor::compression_ratio(void) const +{ + ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0.0f ); + if (this->uncompressed_bytes_ > 0) { + return static_cast<float>(this->compressed_bytes_) / this->uncompressed_bytes_; + } + return 0.0f; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/Compressor.h b/dep/acelite/ace/Compression/Compressor.h new file mode 100644 index 00000000000..eb71167a5e0 --- /dev/null +++ b/dep/acelite/ace/Compression/Compressor.h @@ -0,0 +1,137 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file Compressor.h + * + * $Id: Compressor.h + * + * @author ACE version by + * @author Derek Dominish <derek.dominish@dsto.defence.gov.au> + */ +//============================================================================= + +#ifndef ACE_COMPRESSOR_H +#define ACE_COMPRESSOR_H + +#include /**/ "ace/pre.h" + +#include /**/ "ACE_Compression_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Guard_T.h" +#include "ace/Thread_Mutex.h" +#include "ace/Synch_Traits.h" +#include "ace/Copy_Disabled.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * CompressorId from OMG Compression::CompressorId + * see $(TAO_ROOT)/tao/Compression.pidl + */ +enum ACE_CompressorId +{ + ACE_COMPRESSORID_NONE = 0, + ACE_COMPRESSORID_GZIP = 1, + ACE_COMPRESSORID_PKZIP = 2, + ACE_COMPRESSORID_BZIP2 = 3, + ACE_COMPRESSORID_ZLIB = 4, + ACE_COMPRESSORID_LZMA = 5, + ACE_COMPRESSORID_LZO = 6, + ACE_COMPRESSORID_RZIP = 7, + ACE_COMPRESSORID_7X = 8, + ACE_COMPRESSORID_XAR = 9, + ACE_COMPRESSORID_RLE = 10 +}; + +class ACE_Compression_Export ACE_Compressor : private ACE_Copy_Disabled +{ +public: + + ACE_CompressorId get_compressor_id(void) const; + + ACE_UINT32 get_compression_level(void) const; + + /** + * Compress the @a in_ptr buffer for @a in_len into the + * @a dest_ptr buffer with a maximum @a max_out_len. If the + * @a max_out_len is exhausted through the compress process + * then a value of -1 will be returned from the function, + * otherwise the return value will indicate the resultant + * @a out_ptr compressed buffer length. + * + * NOTE: it is advisable that the @max_out_len be slightly + * larger of the input @a in_len (i.e. x 1.1F) to cater + * for the possibility that a reduced compressed length + * is not possible. + */ + virtual ACE_UINT64 compress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ) = 0; + + /** + * DeCompress the @a in_ptr buffer for @a in_len into the + * @a out_ptr buffer with a maximum @a max_out_len. If the + * @a max_out_len is exhausted during decompression + * then a value of -1 will be returned from the function, + * otherwise the return value will indicate the resultant + * @a out_ptr decompressed buffer length. + */ + virtual ACE_UINT64 decompress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ) = 0; + + /** + * Return the current compressed bytes statistics counter. + */ + virtual ACE_UINT64 compressed_bytes(void) const; + + /** + * Return the current uncompressed bytes statistics counter. + */ + virtual ACE_UINT64 uncompressed_bytes(void) const; + + /** + * Return the current compression ratio statistics. + */ + virtual float compression_ratio(void) const; + + /** + * Reset the statistics to zero. + */ + virtual void reset_stats(void); + + virtual ~ACE_Compressor (void); + +protected: + ACE_Compressor(ACE_CompressorId compressor_id, + ACE_UINT32 compression_level = 0); // Must be inherited. + + virtual void update_stats( ACE_UINT64 uncompressed_bytes, + ACE_UINT64 compressed_bytes ); + +private: + ACE_CompressorId compressor_id_; + ACE_UINT32 compression_level_; + + // Ensure we can lock with imutability (i.e. const) + mutable ACE_SYNCH_MUTEX mutex_; + + ACE_UINT64 compressed_bytes_; + ACE_UINT64 uncompressed_bytes_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "Compressor.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif // ACE_COMPRESSOR_H diff --git a/dep/acelite/ace/Compression/Compressor.inl b/dep/acelite/ace/Compression/Compressor.inl new file mode 100644 index 00000000000..b9809018e41 --- /dev/null +++ b/dep/acelite/ace/Compression/Compressor.inl @@ -0,0 +1,18 @@ +// -*- C++ -*- +// $Id: Compressor.inl 95545 2012-02-23 07:57:08Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_CompressorId +ACE_Compressor::get_compressor_id(void) const +{ + return this->compressor_id_; +} + +ACE_INLINE ACE_UINT32 +ACE_Compressor::get_compression_level(void) const +{ + return this->compression_level_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h b/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h new file mode 100644 index 00000000000..f0364580879 --- /dev/null +++ b/dep/acelite/ace/Compression/rle/ACE_RLECompression_export.h @@ -0,0 +1,57 @@ +// -*- C++ -*- +// $Id: ACE_RLECompression_export.h 95545 2012-02-23 07:57:08Z johnnyw $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl ACE_RLECompression +// ------------------------------ +#ifndef ACE_RLECOMPRESSION_EXPORT_H +#define ACE_RLECOMPRESSION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_RLECOMPRESSION_HAS_DLL) +# define ACE_RLECOMPRESSION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_RLECOMPRESSION_HAS_DLL */ + +#if !defined (ACE_RLECOMPRESSION_HAS_DLL) +# define ACE_RLECOMPRESSION_HAS_DLL 1 +#endif /* ! ACE_RLECOMPRESSION_HAS_DLL */ + +#if defined (ACE_RLECOMPRESSION_HAS_DLL) && (ACE_RLECOMPRESSION_HAS_DLL == 1) +# if defined (ACE_RLECOMPRESSION_BUILD_DLL) +# define ACE_RLECompression_Export ACE_Proper_Export_Flag +# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_RLECOMPRESSION_BUILD_DLL */ +# define ACE_RLECompression_Export ACE_Proper_Import_Flag +# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_RLECOMPRESSION_BUILD_DLL */ +#else /* ACE_RLECOMPRESSION_HAS_DLL == 1 */ +# define ACE_RLECompression_Export +# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) +# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_RLECOMPRESSION_HAS_DLL == 1 */ + +// Set ACE_RLECOMPRESSION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_RLECOMPRESSION_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_RLECOMPRESSION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_RLECOMPRESSION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_RLECOMPRESSION_NTRACE */ + +#if (ACE_RLECOMPRESSION_NTRACE == 1) +# define ACE_RLECOMPRESSION_TRACE(X) +#else /* (ACE_RLECOMPRESSION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_RLECOMPRESSION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_RLECOMPRESSION_NTRACE == 1) */ + +#endif /* ACE_RLECOMPRESSION_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/Compression/rle/RLECompressor.cpp b/dep/acelite/ace/Compression/rle/RLECompressor.cpp new file mode 100644 index 00000000000..423d8a0f0ac --- /dev/null +++ b/dep/acelite/ace/Compression/rle/RLECompressor.cpp @@ -0,0 +1,158 @@ +// $Id: RLECompressor.cpp 95560 2012-02-27 08:11:54Z johnnyw $ + +#include "RLECompressor.h" +#include "ace/OS_NS_string.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_RLECompressor::ACE_RLECompressor(void) + : ACE_Compressor(ACE_COMPRESSORID_RLE) +{ +} + +ACE_RLECompressor::~ACE_RLECompressor(void) +{ +} + +ACE_UINT64 +ACE_RLECompressor::compress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ) +{ + const ACE_UINT8 *in_p = static_cast<const ACE_UINT8*>(in_ptr); + ACE_UINT8 *out_p = static_cast<ACE_UINT8*>(out_ptr); + + ACE_UINT64 src_len = in_len; // Save for stats + ACE_UINT64 out_len = 0; + ACE_UINT64 out_index = 0; + ACE_UINT64 out_base = 0; + + ACE_UINT32 run_count = 0; + ACE_UINT32 dup_count = 0; + + bool run_code = false; + + ACE_UINT8 nxt_byte, cur_byte; + + if (in_p && out_p) while (in_len-- > 0) { + + if (run_code) switch (run_count) { + + default: + + out_p[out_index = out_base] = ACE_UINT8(run_count++ | 0x80); + out_p[++out_index] = cur_byte = *in_p++; + + if (in_len ? cur_byte == (nxt_byte = *in_p) : true) { + continue; + } + + // Fall Through + + case 128: + + if (++out_index >= max_out_len) { + return ACE_UINT64(-1); // Output Exhausted + } else if (in_len == 0) { + continue; + } + + run_code = false; + out_p[out_base = out_index] = 0; + dup_count = run_count = 0; + continue; + } + + switch (run_count) { + + case 128: + + if (++out_index >= max_out_len) { + return ACE_UINT64(-1); // Output Exhausted + } + out_p[out_base = out_index] = 0; + dup_count = run_count = 0; + + // Fall Through + + default : + + cur_byte = *in_p++; + + if (in_len > 0) { + if (cur_byte == (nxt_byte = *in_p)) { + if (dup_count++ == 1) { + if (run_count >= dup_count) { + out_p[out_base] = static_cast<ACE_UINT8>(run_count - dup_count); + out_base += run_count; + } + run_code = true; + run_count = dup_count - 1; + dup_count = 0; + out_p[out_index = out_base] = static_cast<ACE_UINT8>(run_count++ | 0x80); + break; + } + } else dup_count = 0; + } + out_p[out_base] = char(run_count++); + break; + } + + if (++out_index >= max_out_len) { + return ACE_UINT64(-1); // Output Exhausted + } + + out_p[out_index] = cur_byte; + } + + out_len = ++out_index; // Update our output length + + this->update_stats(src_len, out_len); + + return out_len; +} + +// Decompress using Run Length Encoding (RLE) +ACE_UINT64 +ACE_RLECompressor::decompress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ) +{ + ACE_UINT64 out_len = 0; + + const ACE_UINT8 *in_p = static_cast<const ACE_UINT8*>(in_ptr); + ACE_UINT8 *out_p = static_cast<ACE_UINT8*>(out_ptr); + + if (in_p && out_p) while(in_len-- > 0) { + + ACE_UINT8 cur_byte = *in_p++; + ACE_UINT32 cpy_len = ACE_UINT32((cur_byte & 0x7F) + 1); + + if (cpy_len > max_out_len) { + return ACE_UINT64(-1); // Output Exhausted + } else if ((cur_byte & 0x80) != 0) { // compressed + if (in_len-- > 0) { + ACE_OS::memset(out_p, *in_p++, cpy_len); + } else { + return ACE_UINT64(-1); // Output Exhausted + } + } else if (in_len >= cpy_len) { + ACE_OS::memcpy(out_p, in_p, cpy_len); + in_p += cpy_len; + in_len -= cpy_len; + } else { + return ACE_UINT64(-1); // Output Exhausted + } + + out_p += cpy_len; + max_out_len -= cpy_len; + out_len += cpy_len; + } + + return out_len; +} + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Compression/rle/RLECompressor.h b/dep/acelite/ace/Compression/rle/RLECompressor.h new file mode 100644 index 00000000000..7371d22bf50 --- /dev/null +++ b/dep/acelite/ace/Compression/rle/RLECompressor.h @@ -0,0 +1,108 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file RLECompressor.h + * + * $Id: RLECompressor.h + * + * @author TAO version by + * @author Derek Dominish <derek.dominish@dsto.defence.gov.au> + * @author ACE version by + * @author Derek Dominish <derek.dominish@dsto.defence.gov.au> + * + * Run-length encoding (RLE) is a very simple form of data compression + * in which runs of data (that is, sequences in which the same data value + * occurs in many consecutive data elements) are stored as a single data + * value and count, rather than as the original run. This is most useful + * on data that contains many such runs: for example, simple graphic + * images such as icons, line drawings, and animations. It is not useful + * with files that don't have many runs as it could slightly increase the + * output size. + * ALGORITHM: This algorithm is an optimized version of the traditional + * RLE algorithm in that it behaves better with very few runs. + * + * With a run of a character where that run is >= 3 this is + * replaced with the repeat indicator 0X80 and then the repeat count OR'd + * over this ident. This repeat count is therefore has a maximum value + * of 127 (0x7F) which is to be interpreted as the next character repeated + * another 'repeat count' times (i.e. a maximum of 128 characters can be + * represented in any single dupal). if the repeat ident is not present + * then the count is to be interpreted as a copy of the next repeat count + * characters + 1. + * + * EXAMPLE: the following arbitary string of 67 bytes:- + * WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW + * will produce (as a HEXDUMP) of 14 bytes + * 8B 57 00 42 8B 57 82 42 97 57 00 42 8D 57 .W.B.W.B.W.B.W + */ +//============================================================================= + +#ifndef ACE_RLECOMPRESSOR_H +#define ACE_RLECOMPRESSOR_H + +#include /**/ "ace/pre.h" + +#include "ACE_RLECompression_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Compression/Compressor.h" +#include "ace/Singleton.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_RLECompression_Export ACE_RLECompressor : public ACE_Compressor +{ +public: + /** + * Default constructor. Should use instance() to get global instance. + */ + ACE_RLECompressor(void); + + virtual ~ACE_RLECompressor(void); + + /** + * Compress the @a in_ptr buffer for @a in_len into the + * @a dest_ptr buffer with a maximum @a max_out_len using + * the Run Length Ecoding (RLE) algorithm. If the + * @a max_out_len is exhausted through the compress process + * then a value of -1 will be returned from the function, + * otherwise the return value will indicate the resultant + * @a out_ptr compressed buffer length. + * + * @note It is advisable that the @max_out_len be slightly + * larger of the input @a in_len (i.e. x 1.1F) to cater + * for the possibility that a reduced compressed length + * is not possible. + */ + virtual ACE_UINT64 compress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ); + + /** + * DeCompress the @a in_ptr buffer for @a in_len into the + * @a out_ptr buffer with a maximum @a max_out_len using + * the Run Length Ecoding (RLE) algorithm. If the + * @a max_out_len is exhausted during decompression + * then a value of -1 will be returned from the function, + * otherwise the return value will indicate the resultant + * @a out_ptr decompressed buffer length. + */ + virtual ACE_UINT64 decompress( const void *in_ptr, + ACE_UINT64 in_len, + void *out_ptr, + ACE_UINT64 max_out_len ); +}; + +ACE_RLECOMPRESSION_SINGLETON_DECLARE(ACE_Singleton, ACE_RLECompressor, ACE_SYNCH_MUTEX); + +typedef class ACE_Singleton<ACE_RLECompressor, ACE_SYNCH_MUTEX> ACE_RLECompression; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif // ACE_RLECOMPRESSOR_H diff --git a/dep/acelite/ace/Condition_Attributes.cpp b/dep/acelite/ace/Condition_Attributes.cpp new file mode 100644 index 00000000000..49a02635ba8 --- /dev/null +++ b/dep/acelite/ace/Condition_Attributes.cpp @@ -0,0 +1,21 @@ +/* -*- C++ -*- */ +/** + * @file Condition_Attributes.cpp + * + * $Id: Condition_Attributes.cpp 96061 2012-08-16 09:36:07Z mcorino $ + * + * Originally in Synch.cpp + * + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ + +#include "ace/Condition_Thread_Mutex.h" +#include "ace/Condition_Attributes.h" + +#if defined (ACE_HAS_THREADS) + +#if !defined (__ACE_INLINE__) +#include "ace/Condition_Attributes.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Condition_Attributes.h b/dep/acelite/ace/Condition_Attributes.h new file mode 100644 index 00000000000..0d53b273285 --- /dev/null +++ b/dep/acelite/ace/Condition_Attributes.h @@ -0,0 +1,101 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file Condition_Attributes.h + * + * $Id: Condition_Attributes.h 96077 2012-08-20 08:13:23Z johnnyw $ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//========================================================================== + +#ifndef ACE_CONDITION_ATTRIBUTES_H +#define ACE_CONDITION_ATTRIBUTES_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_NS_Thread.h" + +#if defined (ACE_HAS_THREADS) + +// ACE platform supports some form of threading. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Export ACE_Condition_Attributes +{ +public: + /// Constructor + ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE); + + /// Destructor + ~ACE_Condition_Attributes (void); + + /// Accessor for retrieving the current attributes + const ACE_condattr_t& attributes (void) const; + +protected: + /// The attributes + ACE_condattr_t attributes_; + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Condition_Attributes &); + ACE_Condition_Attributes (const ACE_Condition_Attributes &); +}; + +template <class TIME_POLICY> +class ACE_Condition_Attributes_T : public ACE_Condition_Attributes +{ +public: + /// Constructor + ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE) + : ACE_Condition_Attributes (type) + {} + + /// Destructor + ~ACE_Condition_Attributes_T (void) {} + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Condition_Attributes_T<TIME_POLICY> &); + ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T<TIME_POLICY> &); +}; + +class ACE_Monotonic_Time_Policy; + +template <> +class ACE_Export ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> + : public ACE_Condition_Attributes +{ +public: + /// Constructor + ACE_Condition_Attributes_T (int type = ACE_DEFAULT_SYNCH_TYPE); + + /// Destructor + ~ACE_Condition_Attributes_T (void); + +private: + // = Prevent assignment and initialization. + void operator= (const ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> &); + ACE_Condition_Attributes_T (const ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy> &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Condition_Attributes.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_CONDITION_ATTRIBUTES_H */ diff --git a/dep/acelite/ace/Condition_Attributes.inl b/dep/acelite/ace/Condition_Attributes.inl new file mode 100644 index 00000000000..12afde24c80 --- /dev/null +++ b/dep/acelite/ace/Condition_Attributes.inl @@ -0,0 +1,40 @@ +// -*- C++ -*- +// +// $Id: Condition_Attributes.inl 96096 2012-08-23 12:34:02Z johnnyw $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Condition_Attributes::ACE_Condition_Attributes (int type) +{ + (void) ACE_OS::condattr_init (this->attributes_, type); +} + +ACE_INLINE +ACE_Condition_Attributes::~ACE_Condition_Attributes (void) +{ + ACE_OS::condattr_destroy (this->attributes_); +} + +ACE_INLINE +const ACE_condattr_t& +ACE_Condition_Attributes::attributes (void) const +{ + return this->attributes_; +} + +ACE_INLINE +ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy>::ACE_Condition_Attributes_T (int type) + : ACE_Condition_Attributes (type) +{ +#if (defined (_POSIX_MONOTONIC_CLOCK) && !defined (ACE_LACKS_MONOTONIC_TIME)) || defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) + (void) ACE_OS::condattr_setclock (this->attributes_, CLOCK_MONOTONIC); +#endif +} + +ACE_INLINE +ACE_Condition_Attributes_T<ACE_Monotonic_Time_Policy>::~ACE_Condition_Attributes_T (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp index 1f357589f55..74922b65c5d 100644 --- a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp +++ b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.cpp @@ -3,7 +3,7 @@ /** * @file Condition_Recursive_Thread_Mutex.cpp * - * $Id: Condition_Recursive_Thread_Mutex.cpp 89127 2010-02-22 19:58:18Z schmidt $ + * $Id: Condition_Recursive_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $ * * Originally in Synch.cpp * @@ -14,9 +14,7 @@ #if defined (ACE_HAS_THREADS) -#if defined (ACE_HAS_DUMP) -# include "ace/Log_Msg.h" -#endif /* ACE_HAS_DUMP */ +#include "ace/Log_Msg.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -49,7 +47,19 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::~ACE_Condition (void) ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m) : mutex_ (m) { - ACE_OS::cond_init (&this->cond_); + if (ACE_OS::cond_init (&this->cond_) != 0) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition<ACE_Recursive_Thread_Mutex>"))); +} + +ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition (ACE_Recursive_Thread_Mutex &m, + const ACE_Condition_Attributes &attributes) + : mutex_ (m) +{ + if (ACE_OS::cond_init (&this->cond_, + const_cast<ACE_condattr_t &> (attributes.attributes ())) != 0) + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition<ACE_Recursive_Thread_Mutex>::ACE_Condition<ACE_Recursive_Thread_Mutex>"))); } int @@ -118,12 +128,6 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::mutex (void) return this->mutex_; } -ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex ( - ACE_Recursive_Thread_Mutex &m) : - ACE_Condition<ACE_Recursive_Thread_Mutex> (m) -{ -} - ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ diff --git a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h index ac3177da8c8..a313a7f7b6e 100644 --- a/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h +++ b/dep/acelite/ace/Condition_Recursive_Thread_Mutex.h @@ -4,7 +4,7 @@ /** * @file Condition_Recursive_Thread_Mutex.h * - * $Id: Condition_Recursive_Thread_Mutex.h 86731 2009-09-17 12:23:48Z johnnyw $ + * $Id: Condition_Recursive_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $ * * Moved from Synch.h. * @@ -26,11 +26,11 @@ # include "ace/Null_Condition.h" #else /* ACE_HAS_THREADS */ #include "ace/Recursive_Thread_Mutex.h" +#include "ace/Condition_Attributes.h" +#include "ace/Condition_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class ACE_LOCK> class ACE_Condition; - /** * @brief ACE_Condition template specialization written using * @a ACE_Recursive_Thread_Mutex. This allows threads to block until @@ -43,6 +43,10 @@ public: /// Initialize the condition variable with a recursive mutex. ACE_Condition (ACE_Recursive_Thread_Mutex &m); + /// Initialize the condition variable. + ACE_Condition (ACE_Recursive_Thread_Mutex &m, + const ACE_Condition_Attributes &attributes); + /// Implicitly destroy the condition variable. ~ACE_Condition (void); @@ -65,7 +69,7 @@ public: * Block on condition or until absolute time-of-day has passed. If * abstime == 0 use "blocking" wait() semantics on the recursive @a mutex * passed as a parameter (this is useful if you need to store the - * <Condition> in shared memory). Else, if <abstime> != 0 and the + * <Condition> in shared memory). Else, if @a abstime != 0 and the * call times out before the condition is signaled <wait> returns -1 * and sets errno to ETIME. */ @@ -100,13 +104,7 @@ private: }; -class ACE_Export ACE_Condition_Recursive_Thread_Mutex - : public ACE_Condition<ACE_Recursive_Thread_Mutex> -{ -public: - /// Initialize the condition variable with a recursive mutex. - ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m); -}; +typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Condition_T.cpp b/dep/acelite/ace/Condition_T.cpp index ae75d9ff359..4b5e32d09f9 100644 --- a/dep/acelite/ace/Condition_T.cpp +++ b/dep/acelite/ace/Condition_T.cpp @@ -1,4 +1,4 @@ -// $Id: Condition_T.cpp 89127 2010-02-22 19:58:18Z schmidt $ +// $Id: Condition_T.cpp 96077 2012-08-20 08:13:23Z johnnyw $ #ifndef ACE_CONDITION_T_CPP #define ACE_CONDITION_T_CPP @@ -15,6 +15,7 @@ #if !defined (__ACE_INLINE__) #include "ace/Condition_T.inl" +#include "ace/Time_Value.h" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -72,6 +73,22 @@ ACE_Condition<MUTEX>::ACE_Condition (MUTEX &m, } template <class MUTEX> +ACE_Condition<MUTEX>::ACE_Condition (MUTEX &m, + const ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name, + void *arg) + : mutex_ (m) +{ +// ACE_TRACE ("ACE_Condition<MUTEX>::ACE_Condition<MUTEX>"); + if (ACE_OS::cond_init (&this->cond_, + const_cast<ACE_condattr_t &> (attributes.attributes ()), + name, arg) != 0) + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Condition::ACE_Condition"))); +} + +template <class MUTEX> ACE_Condition<MUTEX>::~ACE_Condition (void) { // ACE_TRACE ("ACE_Condition<MUTEX>::~ACE_Condition"); diff --git a/dep/acelite/ace/Condition_T.h b/dep/acelite/ace/Condition_T.h index 936ce821777..cbae002d7a2 100644 --- a/dep/acelite/ace/Condition_T.h +++ b/dep/acelite/ace/Condition_T.h @@ -4,7 +4,7 @@ /** * @file Condition_T.h * - * $Id: Condition_T.h 81462 2008-04-28 11:39:40Z johnnyw $ + * $Id: Condition_T.h 96061 2012-08-16 09:36:07Z mcorino $ * * Moved from Synch.h. * @@ -18,7 +18,7 @@ #include /**/ "ace/pre.h" #include "ace/OS_NS_Thread.h" -#include "ace/Lock.h" +#include "ace/Condition_Attributes.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -37,8 +37,8 @@ class ACE_Time_Value; * until shared data changes state. * * A condition variable enables threads to atomically block and - * test the condition under the protection of a mutual exclu- - * sion lock (mutex) until the condition is satisfied. That is, + * test the condition under the protection of a mutual exclusion + * lock (mutex) until the condition is satisfied. That is, * the mutex must have been held by the thread before calling * wait or signal on the condition. If the condition is false, * a thread blocks on a condition variable and atomically @@ -54,11 +54,16 @@ template <class MUTEX> class ACE_Condition { public: - // = Initialiation and termination methods. /// Initialize the condition variable. ACE_Condition (MUTEX &m, int type = USYNC_THREAD, const ACE_TCHAR *name = 0, void *arg = 0); + /// Initialize the condition variable. + ACE_Condition (MUTEX &m, + const ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name = 0, + void *arg = 0); + /// Implicitly destroy the condition variable. ~ACE_Condition (void); @@ -67,7 +72,7 @@ public: * Block on condition, or until absolute time-of-day has passed. If * @a abstime == 0 use "blocking" <wait> semantics. Else, if @a abstime * != 0 and the call times out before the condition is signaled - * <wait> returns -1 and sets errno to ETIME. + * wait() returns -1 and sets errno to ETIME. */ int wait (const ACE_Time_Value *abstime); @@ -76,10 +81,10 @@ public: /** * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the <mutex> + * @a abstime == 0 use "blocking" wait() semantics on the @a mutex * passed as a parameter (this is useful if you need to store the - * <Condition> in shared memory). Else, if <abstime> != 0 and the - * call times out before the condition is signaled <wait> returns -1 + * <Condition> in shared memory). Else, if @a abstime != 0 and the + * call times out before the condition is signaled wait() returns -1 * and sets errno to ETIME. */ int wait (MUTEX &mutex, const ACE_Time_Value *abstime = 0); diff --git a/dep/acelite/ace/Condition_Thread_Mutex.cpp b/dep/acelite/ace/Condition_Thread_Mutex.cpp index 88e99702d0f..c3fcd7936b0 100644 --- a/dep/acelite/ace/Condition_Thread_Mutex.cpp +++ b/dep/acelite/ace/Condition_Thread_Mutex.cpp @@ -2,7 +2,7 @@ /** * @file Condition_Thread_Mutex.cpp * - * $Id: Condition_Thread_Mutex.cpp 91286 2010-08-05 09:04:31Z johnnyw $ + * $Id: Condition_Thread_Mutex.cpp 96077 2012-08-20 08:13:23Z johnnyw $ * * Originally in Synch.cpp * @@ -19,17 +19,15 @@ #include "ace/Log_Msg.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex) +ACE_ALLOC_HOOK_DEFINE(ACE_Condition<ACE_Thread_Mutex>) void -ACE_Condition_Thread_Mutex::dump (void) const +ACE_Condition<ACE_Thread_Mutex>::dump (void) const { #if defined (ACE_HAS_DUMP) -// ACE_TRACE ("ACE_Condition_Thread_Mutex::dump"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); @@ -42,40 +40,40 @@ ACE_Condition_Thread_Mutex::dump (void) const #endif /* ACE_HAS_DUMP */ } -ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, - const ACE_TCHAR *name, - void *arg) +ACE_Condition<ACE_Thread_Mutex>::ACE_Condition (ACE_Thread_Mutex &m, + const ACE_TCHAR *name, + void *arg) : mutex_ (m), removed_ (false) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>"); if (ACE_OS::cond_init (&this->cond_, (short) USYNC_THREAD, name, arg) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); + ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>"))); } -ACE_Condition_Thread_Mutex:: -ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, - ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name, - void *arg) +ACE_Condition<ACE_Thread_Mutex>::ACE_Condition (ACE_Thread_Mutex &m, + const ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name, + void *arg) : mutex_ (m), removed_ (false) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"); - if (ACE_OS::cond_init (&this->cond_, attributes.attributes_, +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>"); + if (ACE_OS::cond_init (&this->cond_, + const_cast<ACE_condattr_t &> (attributes.attributes ()), name, arg) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex"))); + ACE_TEXT ("ACE_Condition<ACE_Thread_Mutex>::ACE_Condition<ACE_Thread_Mutex>"))); } -ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void) +ACE_Condition<ACE_Thread_Mutex>::~ACE_Condition (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::~ACE_Condition<ACE_Thread_Mutex>"); this->remove (); } @@ -84,40 +82,40 @@ ACE_Condition_Thread_Mutex::~ACE_Condition_Thread_Mutex (void) // <abstime> using the <cond_timedwait> function. int -ACE_Condition_Thread_Mutex::wait (void) +ACE_Condition<ACE_Thread_Mutex>::wait (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); - return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock_); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait"); + return ACE_OS::cond_wait (&this->cond_, &this->mutex_.lock ()); } int -ACE_Condition_Thread_Mutex::wait (ACE_Thread_Mutex &mutex, +ACE_Condition<ACE_Thread_Mutex>::wait (ACE_Thread_Mutex &mutex, const ACE_Time_Value *abstime) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait"); return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock_, + &mutex.lock (), const_cast <ACE_Time_Value *> (abstime)); } int -ACE_Condition_Thread_Mutex::wait (const ACE_Time_Value *abstime) +ACE_Condition<ACE_Thread_Mutex>::wait (const ACE_Time_Value *abstime) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::wait"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::wait"); return this->wait (this->mutex_, abstime); } int -ACE_Condition_Thread_Mutex::signal (void) +ACE_Condition<ACE_Thread_Mutex>::signal (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::signal"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::signal"); return ACE_OS::cond_signal (&this->cond_); } int -ACE_Condition_Thread_Mutex::broadcast (void) +ACE_Condition<ACE_Thread_Mutex>::broadcast (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::broadcast"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::broadcast"); return ACE_OS::cond_broadcast (&this->cond_); } diff --git a/dep/acelite/ace/Condition_Thread_Mutex.h b/dep/acelite/ace/Condition_Thread_Mutex.h index 1ba866d2eb0..f39829cfe71 100644 --- a/dep/acelite/ace/Condition_Thread_Mutex.h +++ b/dep/acelite/ace/Condition_Thread_Mutex.h @@ -4,7 +4,7 @@ /** * @file Condition_Thread_Mutex.h * - * $Id: Condition_Thread_Mutex.h 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: Condition_Thread_Mutex.h 96073 2012-08-17 13:39:55Z mcorino $ * * Moved from Synch.h. * @@ -28,37 +28,17 @@ // ACE platform supports some form of threading. #include "ace/Thread_Mutex.h" +#include "ace/Condition_Attributes.h" +#include "ace/Condition_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; -class ACE_Export ACE_Condition_Attributes -{ -public: - /// Constructor - ACE_Condition_Attributes (int type = ACE_DEFAULT_SYNCH_TYPE); - - /// Destructor - ~ACE_Condition_Attributes (void); - -private: - friend class ACE_Condition_Thread_Mutex; - - /// The attributes - ACE_condattr_t attributes_; - -private: - // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Attributes &); - ACE_Condition_Attributes (const ACE_Condition_Attributes &); -}; - /** - * @class ACE_Condition_Thread_Mutex - * - * @brief ACE_Condition variable wrapper written using ACE_Mutexes This - * allows threads to block until shared data changes state. + * @brief ACE_Condition template specialization written using + * ACE_Mutexes. This allows threads to block until shared data + * changes state. * A condition variable enables threads to atomically block and * test the condition under the protection of a mutual exclu- * sion lock (mutex) until the condition is satisfied. That is, @@ -70,26 +50,24 @@ private: * up waiting threads by signaling the associated condition * variable. The waiting threads, upon awakening, reacquire the * mutex and re-evaluate the condition. - * - * This should be an instantiation of ACE_Condition but problems - * with compilers precludes this... */ -class ACE_Export ACE_Condition_Thread_Mutex +template <> +class ACE_Export ACE_Condition<ACE_Thread_Mutex> { public: /// Initialize the condition variable. - ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, - const ACE_TCHAR *name = 0, - void *arg = 0); + ACE_Condition (ACE_Thread_Mutex &m, + const ACE_TCHAR *name = 0, + void *arg = 0); /// Initialize the condition variable. - ACE_Condition_Thread_Mutex (ACE_Thread_Mutex &m, - ACE_Condition_Attributes &attributes, - const ACE_TCHAR *name = 0, - void *arg = 0); + ACE_Condition (ACE_Thread_Mutex &m, + const ACE_Condition_Attributes &attributes, + const ACE_TCHAR *name = 0, + void *arg = 0); /// Implicitly destroy the condition variable. - ~ACE_Condition_Thread_Mutex (void); + ~ACE_Condition (void); /** * Explicitly destroy the condition variable. Note that only one @@ -111,7 +89,7 @@ public: /** * Block on condition or until absolute time-of-day has passed. If - * abstime == 0 use "blocking" wait() semantics on the <mutex> + * abstime == 0 use "blocking" wait() semantics on the @a mutex * passed as a parameter (this is useful if you need to store the * <Condition> in shared memory). Else, if @a abstime != 0 and the * call times out before the condition is signaled <wait> returns -1 @@ -150,10 +128,12 @@ protected: private: // = Prevent assignment and initialization. - void operator= (const ACE_Condition_Thread_Mutex &); - ACE_Condition_Thread_Mutex (const ACE_Condition_Thread_Mutex &); + void operator= (const ACE_Condition<ACE_Thread_Mutex> &); + ACE_Condition (const ACE_Condition<ACE_Thread_Mutex> &); }; +typedef ACE_Condition<ACE_Thread_Mutex> ACE_Condition_Thread_Mutex; + ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) diff --git a/dep/acelite/ace/Condition_Thread_Mutex.inl b/dep/acelite/ace/Condition_Thread_Mutex.inl index 712a8be0251..76cbc82ea82 100644 --- a/dep/acelite/ace/Condition_Thread_Mutex.inl +++ b/dep/acelite/ace/Condition_Thread_Mutex.inl @@ -1,25 +1,13 @@ // -*- C++ -*- // -// $Id: Condition_Thread_Mutex.inl 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Condition_Thread_Mutex.inl 96061 2012-08-16 09:36:07Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -ACE_INLINE -ACE_Condition_Attributes::ACE_Condition_Attributes (int type) -{ - (void) ACE_OS::condattr_init (this->attributes_, type); -} - -ACE_INLINE -ACE_Condition_Attributes::~ACE_Condition_Attributes (void) -{ - ACE_OS::condattr_destroy (this->attributes_); -} - ACE_INLINE int -ACE_Condition_Thread_Mutex::remove (void) +ACE_Condition<ACE_Thread_Mutex>::remove (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::remove"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::remove"); // <cond_destroy> is called in a loop if the condition variable is // BUSY. This avoids a condition where a condition is signaled and @@ -44,9 +32,9 @@ ACE_Condition_Thread_Mutex::remove (void) } ACE_INLINE ACE_Thread_Mutex & -ACE_Condition_Thread_Mutex::mutex (void) +ACE_Condition<ACE_Thread_Mutex>::mutex (void) { -// ACE_TRACE ("ACE_Condition_Thread_Mutex::mutex"); +// ACE_TRACE ("ACE_Condition<ACE_Thread_Mutex>::mutex"); return this->mutex_; } diff --git a/dep/acelite/ace/Configuration.cpp b/dep/acelite/ace/Configuration.cpp index 4e0a1749e92..85bbf1ca0c0 100644 --- a/dep/acelite/ace/Configuration.cpp +++ b/dep/acelite/ace/Configuration.cpp @@ -1,4 +1,4 @@ -// $Id: Configuration.cpp 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Configuration.cpp 92828 2010-12-08 09:38:57Z mcorino $ #include "ace/Configuration.h" #include "ace/Auto_Ptr.h" #include "ace/SString.h" @@ -1632,7 +1632,7 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key // Now remove subkey from parent key ACE_Configuration_ExtId SubSExtId (sub_section); - SUBSECTION_HASH::ENTRY* subsection_entry; + SUBSECTION_HASH::ENTRY* subsection_entry = 0; if (((SUBSECTION_HASH*)ParentIntId.section_hash_map_)-> find (SubSExtId, subsection_entry)) return -1; diff --git a/dep/acelite/ace/Configuration_Import_Export.cpp b/dep/acelite/ace/Configuration_Import_Export.cpp index ae489f05dfa..15d869b8a09 100644 --- a/dep/acelite/ace/Configuration_Import_Export.cpp +++ b/dep/acelite/ace/Configuration_Import_Export.cpp @@ -1,4 +1,4 @@ -// $Id: Configuration_Import_Export.cpp 84565 2009-02-23 08:20:39Z johnnyw $ +// $Id: Configuration_Import_Export.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/Configuration_Import_Export.h" #include "ace/OS_Errno.h" @@ -138,7 +138,8 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) // number type ACE_TCHAR* endptr = 0; unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16); - if (config_.set_integer_value (section, name, value)) + if (config_.set_integer_value (section, name, + static_cast<u_int> (value))) { ACE_OS::fclose (in); delete [] buffer; diff --git a/dep/acelite/ace/Configuration_Import_Export.h b/dep/acelite/ace/Configuration_Import_Export.h index e93544bee29..9995d095d83 100644 --- a/dep/acelite/ace/Configuration_Import_Export.h +++ b/dep/acelite/ace/Configuration_Import_Export.h @@ -4,7 +4,7 @@ /** * @file Configuration_Import_Export.h * - * $Id: Configuration_Import_Export.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Configuration_Import_Export.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Jerry D. Odenwelder Jr. <jerry.o@mindspring.com> * Chris Hafey <chris@stentorsoft.com> @@ -83,12 +83,12 @@ private: * using the Win32 Registry file export format. This format looks like * [Section] * "key"="String Data" - * "key"=dword: numeric data in hexidecimal format + * "key"=dword: numeric data in hexadecimal format * "key"=hex: binary data * * @todo * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed ammount (4096 bytes) + * importing of values greater than a fixed amount (4096 bytes) * */ class ACE_Export ACE_Registry_ImpExp : public ACE_Config_ImpExp_Base @@ -101,7 +101,7 @@ public: virtual ~ACE_Registry_ImpExp (void); /** - * Imports the configuration database from filename. + * Imports the configuration database from @a filename. * No existing data is removed. */ virtual int import_config (const ACE_TCHAR* filename); @@ -149,7 +149,7 @@ private: * Justification = left_justified * * The caller can then retrieve the string with the regular - * <get_string_value> function and convert the string to the + * get_string_value() function and convert the string to the * desired data type. * * @todo @@ -157,7 +157,7 @@ private: * - Strings with embedded quotes " cause the import to fail * - Importing/exporting for values in the root section does not work * - Add dynamic buffer when importing. currently it will not allow - * importing of values greater than a fixed ammount (4096 bytes) + * importing of values greater than a fixed amount (4096 bytes) */ class ACE_Export ACE_Ini_ImpExp : public ACE_Config_ImpExp_Base { @@ -173,7 +173,7 @@ public: virtual ~ACE_Ini_ImpExp (void); /** - * Imports the configuration database from filename. + * Imports the configuration database from @a filename. * No existing data is removed. */ virtual int import_config (const ACE_TCHAR* filename); diff --git a/dep/acelite/ace/Connector.cpp b/dep/acelite/ace/Connector.cpp index 3a1edfc881a..a8399608ce5 100644 --- a/dep/acelite/ace/Connector.cpp +++ b/dep/acelite/ace/Connector.cpp @@ -1,4 +1,4 @@ -// $Id: Connector.cpp 91527 2010-08-27 15:03:31Z shuston $ +// $Id: Connector.cpp 93433 2011-02-23 10:34:01Z vzykov $ #ifndef ACE_CONNECTOR_CPP #define ACE_CONNECTOR_CPP @@ -829,7 +829,7 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open else if (this->creation_strategy_ == 0) { ACE_NEW_RETURN (this->creation_strategy_, - CREATION_STRATEGY, + CREATION_STRATEGY (0, r), -1); this->delete_creation_strategy_ = true; } @@ -887,7 +887,8 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connecto ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, int flags) - : creation_strategy_ (0), + : base_type (reactor), + creation_strategy_ (0), delete_creation_strategy_ (false), connect_strategy_ (0), delete_connect_strategy_ (false), diff --git a/dep/acelite/ace/Countdown_Time.cpp b/dep/acelite/ace/Countdown_Time.cpp deleted file mode 100644 index c964ab1138a..00000000000 --- a/dep/acelite/ace/Countdown_Time.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// $Id: Countdown_Time.cpp 91287 2010-08-05 10:30:49Z johnnyw $ - -#include "ace/Countdown_Time.h" -#include "ace/OS_NS_sys_time.h" - -#if !defined (__ACE_INLINE__) -#include "ace/Countdown_Time.inl" -#endif /* __ACE_INLINE__ */ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time) - : max_wait_time_ (max_wait_time), - stopped_ (false) -{ - this->start (); -} - -ACE_Countdown_Time::~ACE_Countdown_Time (void) -{ - this->stop (); -} - -void -ACE_Countdown_Time::start (void) -{ - if (this->max_wait_time_ != 0) - { - this->start_time_ = ACE_OS::gettimeofday (); - this->stopped_ = false; - } -} - -void -ACE_Countdown_Time::stop (void) -{ - if (this->max_wait_time_ != 0 && !this->stopped_) - { - ACE_Time_Value const elapsed_time = - ACE_OS::gettimeofday () - this->start_time_; - - if (elapsed_time >= ACE_Time_Value::zero && - *this->max_wait_time_ > elapsed_time) - { - *this->max_wait_time_ -= elapsed_time; - } - else - { - // Used all of timeout. - *this->max_wait_time_ = ACE_Time_Value::zero; - // errno = ETIME; - } - this->stopped_ = true; - } -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Countdown_Time.h b/dep/acelite/ace/Countdown_Time.h index b9c9a467f62..b63228d606f 100644 --- a/dep/acelite/ace/Countdown_Time.h +++ b/dep/acelite/ace/Countdown_Time.h @@ -4,9 +4,10 @@ /** * @file Countdown_Time.h * - * $Id: Countdown_Time.h 85365 2009-05-18 08:27:42Z johnnyw $ + * $Id: Countdown_Time.h 95332 2011-12-15 11:09:41Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + * @author Irfan Pyarali <irfan@cs.wustl.edu> */ //============================================================================= @@ -15,67 +16,21 @@ #include /**/ "ace/pre.h" -#include /**/ "ace/ACE_export.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Time_Value.h" -#include "ace/Copy_Disabled.h" +#include "ace/Countdown_Time_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL -/** - * @class ACE_Countdown_Time - * - * @brief Keeps track of the amount of elapsed time. - * - * This class has a side-effect on the @c max_wait_time -- every - * time the stop() method is called the @c max_wait_time is - * updated. - */ -class ACE_Export ACE_Countdown_Time : private ACE_Copy_Disabled -{ -public: - /// Cache the @a max_wait_time and call @c start(). - ACE_Countdown_Time (ACE_Time_Value *max_wait_time); - - /// Destructor, makes sure the max_wait_time that got passed as pointer - /// to the constructor is updated with the time elapsed. - ~ACE_Countdown_Time (void); - - /// Cache the current time and enter a start state. - void start (void); - - /// Subtract the elapsed time from max_wait_time_ and enter a stopped - /// state. - void stop (void); - - /// Calls stop and then start. max_wait_time_ is modified by the - /// call to stop. - void update (void); - - /// Returns true if we've already been stopped, else false. - bool stopped (void) const; - -private: - /// Maximum time we were willing to wait. - ACE_Time_Value *max_wait_time_; - - /// Beginning of the start time. - ACE_Time_Value start_time_; - - /// Keeps track of whether we've already been stopped. - bool stopped_; -}; +// The following typedef is here for ease of use and backward +// compatibility. +typedef ACE_Countdown_Time_T<ACE_Default_Time_Policy> + ACE_Countdown_Time; ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" -#if defined (__ACE_INLINE__) -#include "ace/Countdown_Time.inl" -#endif /* __ACE_INLINE__ */ - #endif /* ACE_COUNTDOWN_TIME_H */ diff --git a/dep/acelite/ace/Countdown_Time.inl b/dep/acelite/ace/Countdown_Time.inl deleted file mode 100644 index 4a9eb8e0e43..00000000000 --- a/dep/acelite/ace/Countdown_Time.inl +++ /dev/null @@ -1,20 +0,0 @@ -// -*- C++ -*- -// -// $Id: Countdown_Time.inl 85368 2009-05-18 10:23:19Z johnnyw $ - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE bool -ACE_Countdown_Time::stopped (void) const -{ - return stopped_; -} - -ACE_INLINE void -ACE_Countdown_Time::update (void) -{ - this->stop (); - this->start (); -} - -ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Countdown_Time_T.cpp b/dep/acelite/ace/Countdown_Time_T.cpp new file mode 100644 index 00000000000..fd9a466625f --- /dev/null +++ b/dep/acelite/ace/Countdown_Time_T.cpp @@ -0,0 +1,65 @@ +// $Id: Countdown_Time_T.cpp 95332 2011-12-15 11:09:41Z mcorino $ + +#ifndef ACE_COUNTDOWN_TIME_T_CPP +#define ACE_COUNTDOWN_TIME_T_CPP + +#include "ace/Countdown_Time_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Countdown_Time_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <typename TIME_POLICY> ACE_INLINE +ACE_Countdown_Time_T<TIME_POLICY>::ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time, + TIME_POLICY const & time_policy) + : time_policy_ (time_policy), + max_wait_time_ (max_wait_time), + stopped_ (false) +{ + this->start (); +} + +template <typename TIME_POLICY> ACE_INLINE +ACE_Countdown_Time_T<TIME_POLICY>::~ACE_Countdown_Time_T (void) +{ + this->stop (); +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Countdown_Time_T<TIME_POLICY>::start (void) +{ + if (this->max_wait_time_ != 0) + { + this->start_time_ = this->time_policy_ (); + this->stopped_ = false; + } +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Countdown_Time_T<TIME_POLICY>::stop (void) +{ + if (this->max_wait_time_ != 0 && !this->stopped_) + { + ACE_Time_Value const elapsed_time = + this->time_policy_ () - this->start_time_; + + if (elapsed_time >= ACE_Time_Value::zero && + *this->max_wait_time_ > elapsed_time) + { + *this->max_wait_time_ -= elapsed_time; + } + else + { + // Used all of timeout. + *this->max_wait_time_ = ACE_Time_Value::zero; + // errno = ETIME; + } + this->stopped_ = true; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_COUNTDOWN_TIME_T_CPP */ diff --git a/dep/acelite/ace/Countdown_Time_T.h b/dep/acelite/ace/Countdown_Time_T.h new file mode 100644 index 00000000000..74de8f27e1c --- /dev/null +++ b/dep/acelite/ace/Countdown_Time_T.h @@ -0,0 +1,100 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Countdown_Time_T.h + * + * $Id: Countdown_Time_T.h 95345 2011-12-15 19:46:06Z johnnyw $ + * + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//============================================================================= + +#ifndef ACE_COUNTDOWN_TIME_T_H +#define ACE_COUNTDOWN_TIME_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Time_Value.h" +#include "ace/Time_Policy.h" +#include "ace/Copy_Disabled.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Countdown_Time + * + * @brief Keeps track of the amount of elapsed time. + * + * This class has a side-effect on the @c max_wait_time -- every + * time the stop() method is called the @c max_wait_time is + * updated. + */ +template <typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Countdown_Time_T : private ACE_Copy_Disabled +{ +public: + /// Cache the @a max_wait_time and call @c start(). + ACE_Countdown_Time_T (ACE_Time_Value *max_wait_time, + TIME_POLICY const & time_policy = TIME_POLICY()); + + /// Destructor, makes sure the max_wait_time that got passed as pointer + /// to the constructor is updated with the time elapsed. + ~ACE_Countdown_Time_T (void); + + /// Cache the current time and enter a start state. + void start (void); + + /// Subtract the elapsed time from max_wait_time_ and enter a stopped + /// state. + void stop (void); + + /// Calls stop and then start. max_wait_time_ is modified by the + /// call to stop. + void update (void); + + /// Returns true if we've already been stopped, else false. + bool stopped (void) const; + + /// Allows applications to control how the timer queue gets the time + /// of day. + void set_time_policy(TIME_POLICY const & time_policy); + +private: + /// The policy to return the current time of day + TIME_POLICY time_policy_; + + /// Maximum time we were willing to wait. + ACE_Time_Value *max_wait_time_; + + /// Beginning of the start time. + ACE_Time_Value start_time_; + + /// Keeps track of whether we've already been stopped. + bool stopped_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#if defined (__ACE_INLINE__) +#include "ace/Countdown_Time_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Countdown_Time_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Countdown_Time_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + + +#endif /* ACE_COUNTDOWN_TIME_T_H */ diff --git a/dep/acelite/ace/Countdown_Time_T.inl b/dep/acelite/ace/Countdown_Time_T.inl new file mode 100644 index 00000000000..3d6e7a2f73d --- /dev/null +++ b/dep/acelite/ace/Countdown_Time_T.inl @@ -0,0 +1,26 @@ +// -*- C++ -*- +// +// $Id: Countdown_Time_T.inl 95332 2011-12-15 11:09:41Z mcorino $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <typename TIME_POLICY> ACE_INLINE bool +ACE_Countdown_Time_T<TIME_POLICY>::stopped (void) const +{ + return stopped_; +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Countdown_Time_T<TIME_POLICY>::update (void) +{ + this->stop (); + this->start (); +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Countdown_Time_T<TIME_POLICY>::set_time_policy(TIME_POLICY const & time_policy) +{ + this->time_policy_ = time_policy; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/DLL.h b/dep/acelite/ace/DLL.h index 20d333db81a..4b1251eb704 100644 --- a/dep/acelite/ace/DLL.h +++ b/dep/acelite/ace/DLL.h @@ -4,7 +4,7 @@ /** * @file DLL.h * - * $Id: DLL.h 91064 2010-07-12 10:11:24Z johnnyw $ + * $Id: DLL.h 95913 2012-06-21 17:14:36Z johnnyw $ * * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> */ @@ -88,24 +88,37 @@ public: /** * This method opens and dynamically links a specified DLL. - * @param dll_name The filename or path of the DLL to load. - * If a filename is given to @c open(), the @c ACE::ldfind() is used - * to locate DLLs via the following algorithms: (1) DLL filename - * expansion: @c ACE::ldfind() determines the name of the DLL by - * adding the appropriate prefix and suffix, e.g., it adds the @c lib - * prefix and @c .so suffix for Solaris and the @c .dll suffix for - * Windows and (2) DLL search path: @c ACE::ldfind() will also search - * for the designated DLL using the platform's DLL search path - * environment variable, e.g., it searches for DLLs using @c - * LD_LIBRARY_PATH on many UNIX systems and @c PATH on Windows. + * @param dll_name The filename or path of the DLL to load. ACE will + * attempt to apply the platform's standard library/DLL prefixes + * and suffixes, allowing a simple, unadorned name to be passed + * regardless of platform. The set of name transforms is listed + * below. A @i decorator is a platform's name designator for a debug + * vs release build. For example, on Windows it is usually "d". + * @li Prefix + name + decorator + suffix + * @li Prefix + name + suffix + * @li Name + decorator + suffix + * @li Name + suffix + * @li Name + * Note that the transforms with @i decorator will be avoided if + * ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro. + * + * @Note There is another mode for locating library/DLL files that + * was used in old versions of ACE. The alternate method builds + * more combinations of pathname by combining the names transforms + * above with locations listed in the platform's standard "path" + * locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building + * ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro. + * Use of this option is discouraged since it avoids the standard + * platform search options and security mechanisms. + * * @param open_mode Flags to alter the actions taken when loading the DLL. * The possible values are: * @li @c RTLD_LAZY (this the default): loads identifier symbols but * not the symbols for functions, which are loaded dynamically - * on-demand. + * on demand. * @li @c RTLD_NOW: performs all necessary relocations when * @a dll_name is first loaded - * @li RTLD_GLOBAL: makes symbols available for relocation + * @li @c RTLD_GLOBAL: makes symbols available for relocation * processing of any other DLLs. * @param close_handle_on_destruction Indicates whether or not the * close() method will be called to close an open DLL when this diff --git a/dep/acelite/ace/DLL_Manager.cpp b/dep/acelite/ace/DLL_Manager.cpp index 23e6f85520a..ebba7d64add 100644 --- a/dep/acelite/ace/DLL_Manager.cpp +++ b/dep/acelite/ace/DLL_Manager.cpp @@ -1,4 +1,4 @@ -// $Id: DLL_Manager.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: DLL_Manager.cpp 95913 2012-06-21 17:14:36Z johnnyw $ #include "ace/DLL_Manager.h" @@ -415,10 +415,10 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, // 3. Build the combinations to try for this platform. // Try these combinations: - // - name with decorator and platform's suffix appended (if not supplied) - // - name with platform's suffix appended (if not supplied) // - name with platform's dll prefix (if it has one) and suffix // - name with platform's dll prefix, decorator, and suffix. + // - name with decorator and platform's suffix appended (if not supplied) + // - name with platform's suffix appended (if not supplied) // - name as originally given // We first try to find the file using the decorator so that when a // filename with and without decorator is used, we get the file with @@ -443,10 +443,10 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, size_t const j = try_names.size (); switch (i) { - case 0: // Name + decorator + suffix - case 1: // Name + suffix - case 2: // Prefix + name + decorator + suffix - case 3: // Prefix + name + suffix + case 0: // Prefix + name + decorator + suffix + case 1: // Prefix + name + suffix + case 2: // Name + decorator + suffix + case 3: // Name + suffix if ( base_suffix.length () > 0 #if !(defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) @@ -455,7 +455,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, ) break; try_this = base_dir; - if (i > 1) + if (i < 2) try_this += prefix; try_this += base_file; if (base_suffix.length () > 0) diff --git a/dep/acelite/ace/DLL_Manager.h b/dep/acelite/ace/DLL_Manager.h index 716e3299557..71d8f13c579 100644 --- a/dep/acelite/ace/DLL_Manager.h +++ b/dep/acelite/ace/DLL_Manager.h @@ -4,7 +4,7 @@ /** * @file DLL_Manager.h * - * $Id: DLL_Manager.h 91064 2010-07-12 10:11:24Z johnnyw $ + * $Id: DLL_Manager.h 95913 2012-06-21 17:14:36Z johnnyw $ * * @author Don Hinton <dhinton@ieee.org> */ @@ -68,14 +68,44 @@ public: const ACE_TCHAR *dll_name () const; /** - * This method opens and dynamically links @a dll_name. The default - * mode is @c RTLD_LAZY, which loads identifier symbols but not the - * symbols for functions, which are loaded dynamically on-demand. - * Other supported modes include: @c RTLD_NOW, which performs all - * necessary relocations when @a dll_name is first loaded and - * @c RTLD_GLOBAL, which makes symbols available for relocation - * processing of any other DLLs. Returns -1 on failure and 0 on - * success. + * This method opens and dynamically links a library/DLL. + * @param dll_name The filename or path of the DLL to load. ACE will + * attempt to apply the platform's standard library/DLL prefixes + * and suffixes, allowing a simple, unadorned name to be passed + * regardless of platform. The set of name transforms is listed + * below. A @i decorator is a platform's name designator for a debug + * vs release build. For example, on Windows it is usually "d". + * @li Prefix + name + decorator + suffix + * @li Prefix + name + suffix + * @li Name + decorator + suffix + * @li Name + suffix + * @li Name + * Note that the transforms with @i decorator will be avoided if + * ACE is built with the @c ACE_DISABLE_DEBUG_DLL_CHECK config macro. + * + * @Note There is another mode for locating library/DLL files that + * was used in old versions of ACE. The alternate method builds + * more combinations of pathname by combining the names transforms + * above with locations listed in the platform's standard "path" + * locations (e.g., @c LD_LIBRARY_PATH). It can be enabled by building + * ACE with the @c ACE_MUST_HELP_DLOPEN_SEARCH_PATH config macro. + * Use of this option is discouraged since it avoids the standard + * platform search options and security mechanisms. + * + * @param open_mode Flags to alter the actions taken when loading the DLL. + * The possible values are: + * @li @c RTLD_LAZY (this the default): loads identifier symbols but + * not the symbols for functions, which are loaded dynamically + * on demand. + * @li @c RTLD_NOW: performs all necessary relocations when + * @a dll_name is first loaded + * @li @c RTLD_GLOBAL: makes symbols available for relocation + * processing of any other DLLs. + * @param handle If a value other than @c ACE_INVALID_HANDLE is supplied, + * this object is assigned the specified handle instead of attempting + * to open the specified @a dll_name. + * @retval -1 On failure + * @retval 0 On success. */ int open (const ACE_TCHAR *dll_name, int open_mode, diff --git a/dep/acelite/ace/Default_Constants.h b/dep/acelite/ace/Default_Constants.h index c21c776eaa4..c15b7f9f40b 100644 --- a/dep/acelite/ace/Default_Constants.h +++ b/dep/acelite/ace/Default_Constants.h @@ -4,7 +4,7 @@ /** * @file Default_Constants.h * - * $Id: Default_Constants.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Default_Constants.h 95517 2012-01-30 10:05:01Z sma $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -392,7 +392,7 @@ /// Max udp packet size #if !defined (ACE_MAX_UDP_PACKET_SIZE) -#define ACE_MAX_UDP_PACKET_SIZE 65536 +#define ACE_MAX_UDP_PACKET_SIZE 65507 #endif /** diff --git a/dep/acelite/ace/Dev_Poll_Reactor.cpp b/dep/acelite/ace/Dev_Poll_Reactor.cpp index 5f18064ecbe..011fe7883a2 100644 --- a/dep/acelite/ace/Dev_Poll_Reactor.cpp +++ b/dep/acelite/ace/Dev_Poll_Reactor.cpp @@ -1,4 +1,4 @@ -// $Id: Dev_Poll_Reactor.cpp 92199 2010-10-11 11:58:35Z johnnyw $ +// $Id: Dev_Poll_Reactor.cpp 95738 2012-05-11 19:16:53Z shuston $ #include "ace/OS_NS_errno.h" #include "ace/Dev_Poll_Reactor.h" @@ -12,13 +12,13 @@ # include "ace/OS_NS_stropts.h" # if defined (ACE_HAS_DEV_POLL) -# if defined (linux) +# if defined (ACE_LINUX) # include /**/ <linux/devpoll.h> # elif defined (HPUX_VERS) && HPUX_VERS < 1123 # include /**/ <devpoll.h> # else # include /**/ <sys/devpoll.h> -# endif /* linux */ +# endif /* ACE_LINUX */ # endif /* ACE_HAS_DEV_POLL */ #if !defined (__ACE_INLINE__) @@ -39,6 +39,7 @@ #include "ace/Guard_T.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" +#include "ace/Functor_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -801,12 +802,13 @@ ACE_Dev_Poll_Reactor::timer_queue (ACE_Timer_Queue *tq) { if (this->delete_timer_queue_) delete this->timer_queue_; + else if (this->timer_queue_) + this->timer_queue_->close (); this->timer_queue_ = tq; this->delete_timer_queue_ = false; return 0; - } ACE_Timer_Queue * @@ -858,6 +860,11 @@ ACE_Dev_Poll_Reactor::close (void) this->timer_queue_ = 0; this->delete_timer_queue_ = false; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + this->timer_queue_ = 0; + } if (this->notify_handler_ != 0) this->notify_handler_->close (); @@ -1007,7 +1014,10 @@ ACE_Dev_Poll_Reactor::handle_events (ACE_Time_Value *max_wait_time) return result; if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the mutex. ACE_MT (countdown.update ()); @@ -1087,37 +1097,10 @@ ACE_Dev_Poll_Reactor::dispatch (Token_Guard &guard) int ACE_Dev_Poll_Reactor::dispatch_timer_handler (Token_Guard &guard) { - if (this->timer_queue_->is_empty ()) - return 0; // Empty timer queue so cannot have any expired timers. - - // Get the current time - ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () + - this->timer_queue_->timer_skew ()); - - // Look for a node in the timer queue whose timer <= the present - // time. - ACE_Timer_Node_Dispatch_Info info; - if (this->timer_queue_->dispatch_info (cur_time, info)) - { - const void *upcall_act = 0; + typedef ACE_Member_Function_Command<Token_Guard> Guard_Release; - // Preinvoke (handles refcount if needed, etc.) - this->timer_queue_->preinvoke (info, cur_time, upcall_act); - - // Release the token before expiration upcall. - guard.release_token (); - - // call the functor - this->timer_queue_->upcall (info, cur_time); - - // Postinvoke (undo refcount if needed, etc.) - this->timer_queue_->postinvoke (info, cur_time, upcall_act); - - // We have dispatched a timer - return 1; - } - - return 0; + Guard_Release release(guard, &Token_Guard::release_token); + return this->timer_queue_->expire_single(release); } #if 0 @@ -1950,7 +1933,7 @@ ACE_Dev_Poll_Reactor::resumable_handler (void) { // @@ Is this correct? - return 0; + return 1; } bool @@ -2395,8 +2378,8 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle, // If a handle is closed, epoll removes it from the poll set // automatically - we may not know about it yet. If that's the // case, a mod operation will fail with ENOENT. Retry it as - // an add. - if (op == EPOLL_CTL_MOD && errno == ENOENT && + // an add. If it's any other failure, just fail outright. + if (op != EPOLL_CTL_MOD || errno != ENOENT || ::epoll_ctl (this->poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1) return -1; } diff --git a/dep/acelite/ace/Dev_Poll_Reactor.h b/dep/acelite/ace/Dev_Poll_Reactor.h index 00ae4c21801..b77d8b16a10 100644 --- a/dep/acelite/ace/Dev_Poll_Reactor.h +++ b/dep/acelite/ace/Dev_Poll_Reactor.h @@ -4,7 +4,7 @@ /** * @file Dev_Poll_Reactor.h * - * $Id: Dev_Poll_Reactor.h 91462 2010-08-25 20:29:17Z shuston $ + * $Id: Dev_Poll_Reactor.h 94549 2011-10-03 06:31:27Z johnnyw $ * * @c /dev/poll (or Linux @c sys_epoll) based Reactor implementation. * @@ -563,7 +563,7 @@ public: ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); - /// Register @a event_handler> with all the @a handles> in the @c + /// Register @a event_handler with all the @a handles in the @c /// Handle_Set. virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *event_handler, @@ -815,7 +815,7 @@ public: /// Wake up all threads waiting in the event loop. virtual void wakeup_all_threads (void); - /// Transfers ownership of Reactor_Impl to the new_owner. + /// Transfers ownership of Reactor_Impl to the @a new_owner. /** * @note There is no need to set the owner of the event loop for the * ACE_Dev_Poll_Reactor. Multiple threads may invoke the @@ -828,7 +828,7 @@ public: /** * @note There is no need to set the owner of the event loop for the * ACE_Dev_Poll_Reactor. Multiple threads may invoke the - * event loop simulataneously. As such, this method is a + * event loop simultaneously. As such, this method is a * no-op. */ virtual int owner (ACE_thread_t *owner); @@ -1123,7 +1123,7 @@ protected: /// 2) wait quietly for the token, not waking another thread. This /// is appropriate for cases where a thread wants to wait for and /// dispatch an event, not causing an existing waiter to relinquish the - /// token, and also queueing up behind other threads waiting to modify + /// token, and also queuing up behind other threads waiting to modify /// event records. int acquire_quietly (ACE_Time_Value *max_wait = 0); diff --git a/dep/acelite/ace/Dump.h b/dep/acelite/ace/Dump.h index 4ccd64adb95..fc1eca06dcd 100644 --- a/dep/acelite/ace/Dump.h +++ b/dep/acelite/ace/Dump.h @@ -4,7 +4,7 @@ /** * @file Dump.h * - * $Id: Dump.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Dump.h 94034 2011-05-09 19:11:03Z johnnyw $ * * * A prototype mechanism that allow all ACE objects to be registered @@ -149,7 +149,7 @@ private: /// and we'll have to check for that). const ACE_Dumpable_Ptr dumper_; - Tuple (void) : dumper_(0) {} + Tuple (void) : this_ (0), dumper_(0) {} }; /// Singleton instance of this class. diff --git a/dep/acelite/ace/Dynamic_Message_Strategy.h b/dep/acelite/ace/Dynamic_Message_Strategy.h index 090ad3a8f82..5ff102ef6ce 100644 --- a/dep/acelite/ace/Dynamic_Message_Strategy.h +++ b/dep/acelite/ace/Dynamic_Message_Strategy.h @@ -4,7 +4,7 @@ /** * @file Dynamic_Message_Strategy.h * - * $Id: Dynamic_Message_Strategy.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Dynamic_Message_Strategy.h 95839 2012-06-07 10:13:33Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -43,17 +43,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * priority field of 10 bits. This corresponds to the initial * values of the static class members. To provide a different * partitioning, assign a different set of values to the static - * class memebers before using the static member functions. + * class members before using the static member functions. */ class ACE_Export ACE_Dynamic_Message_Strategy { public: - // = Message priority status - - // Values are defined as bit flags so that status combinations may - // be specified easily. - + /// Message priority status + /// Values are defined as bit flags so that status combinations may + /// be specified easily. enum Priority_Status { /// Message can still make its deadline @@ -154,13 +152,13 @@ protected: class ACE_Export ACE_Deadline_Message_Strategy : public ACE_Dynamic_Message_Strategy { public: - /// Ctor, with all arguments defaulted. + /// Constructor with all arguments defaulted. ACE_Deadline_Message_Strategy (unsigned long static_bit_field_mask = 0x3FFUL, // 2^(10) - 1 unsigned long static_bit_field_shift = 10, // 10 low order bits unsigned long dynamic_priority_max = 0x3FFFFFUL, // 2^(22)-1 unsigned long dynamic_priority_offset = 0x200000UL); // 2^(22-1) - /// Virtual dtor. + /// Virtual destructor. virtual ~ACE_Deadline_Message_Strategy (void); /// Dynamic priority conversion function based on time to deadline. diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.cpp b/dep/acelite/ace/ETCL/ETCL_Constraint.cpp new file mode 100644 index 00000000000..638f7c50984 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Constraint.cpp @@ -0,0 +1,655 @@ +// -*- C++ -*- +// $Id: ETCL_Constraint.cpp 92173 2010-10-07 12:36:17Z olli $ + +#include "ace/ACE.h" + +#include "ace/ETCL/ETCL_Constraint.h" +#include "ace/ETCL/ETCL_Constraint_Visitor.h" + +#if ! defined (__ACE_INLINE__) +#include "ace/ETCL/ETCL_Constraint.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ETCL_Constraint::ETCL_Constraint (void) +{ +} + +ETCL_Constraint::~ETCL_Constraint (void) +{ +} + +int +ETCL_Constraint::accept (ETCL_Constraint_Visitor * /* visitor */) +{ + return 0; +} + +// **************************************************************** + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + const ETCL_Literal_Constraint & lit + ) + : ETCL_Constraint(), + type_ (ACE_ETCL_UNKNOWN) +{ + this->copy (lit); +} + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + ACE_CDR::ULong uinteger) : type_ (ACE_ETCL_UNSIGNED) +{ + this->op_.uinteger_ = uinteger; +} + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + ACE_CDR::Long integer) : type_ (ACE_ETCL_SIGNED) +{ + this->op_.integer_ = integer; +} + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + ACE_CDR::Boolean boolean + ) + : type_ (ACE_ETCL_BOOLEAN) +{ + this->op_.bool_ = boolean; +} + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + ACE_CDR::Double doub) : type_ (ACE_ETCL_DOUBLE) +{ + this->op_.double_ = doub; +} + +ETCL_Literal_Constraint::ETCL_Literal_Constraint ( + const char* str) : type_ (ACE_ETCL_STRING) +{ + this->op_.str_ = ACE::strnew (str); +} + +ETCL_Literal_Constraint::~ETCL_Literal_Constraint (void) +{ + if (this->type_ == ACE_ETCL_STRING) + { + ACE::strdelete (this->op_.str_); + } +} + +int +ETCL_Literal_Constraint::accept (ETCL_Constraint_Visitor* visitor) +{ + return visitor->visit_literal (this); +} + +Literal_Type +ETCL_Literal_Constraint::expr_type (void) const +{ + return this->type_; +} + +void +ETCL_Literal_Constraint::operator= (const ETCL_Literal_Constraint& co) +{ + this->copy (co); +} + +ETCL_Literal_Constraint::operator ACE_CDR::Boolean (void) const +{ + return (this->type_ == ACE_ETCL_BOOLEAN) ? this->op_.bool_ : false; +} + +ETCL_Literal_Constraint::operator ACE_CDR::ULong (void) const +{ + switch (this->type_) + { + case ACE_ETCL_UNSIGNED: + return this->op_.uinteger_; + case ACE_ETCL_SIGNED: + case ACE_ETCL_INTEGER: + return + (this->op_.integer_ > 0) ? (ACE_CDR::ULong) this->op_.integer_ : 0; + case ACE_ETCL_DOUBLE: + return + (this->op_.double_ > 0) ? + ((this->op_.double_ > ACE_UINT32_MAX) ? + ACE_UINT32_MAX : + (ACE_CDR::ULong) this->op_.double_) + : 0; + default: + return 0; + } +} + +ETCL_Literal_Constraint::operator ACE_CDR::Long (void) const +{ + switch (this->type_) + { + case ACE_ETCL_SIGNED: + case ACE_ETCL_INTEGER: + return this->op_.integer_; + case ACE_ETCL_UNSIGNED: + return + (this->op_.uinteger_ > (ACE_CDR::ULong) ACE_INT32_MAX) ? + ACE_INT32_MAX : (ACE_CDR::Long) this->op_.uinteger_; + case ACE_ETCL_DOUBLE: + return + (this->op_.double_ > 0) ? + ((this->op_.double_ > ACE_INT32_MAX) ? + ACE_INT32_MAX : + (ACE_CDR::Long) this->op_.double_) : + ((this->op_.double_ < ACE_INT32_MIN) ? + ACE_INT32_MIN : + (ACE_CDR::Long) this->op_.double_); + default: + return 0; + } +} + +ETCL_Literal_Constraint::operator ACE_CDR::Double (void) const +{ + switch (this->type_) + { + case ACE_ETCL_DOUBLE: + return this->op_.double_; + case ACE_ETCL_SIGNED: + case ACE_ETCL_INTEGER: + return (ACE_CDR::Double) this->op_.integer_; + case ACE_ETCL_UNSIGNED: + return (ACE_CDR::Double) this->op_.uinteger_; + default: + return 0.0; + } +} + +ETCL_Literal_Constraint::operator const char* (void) const +{ + switch (this->type_) + { + case ACE_ETCL_STRING: + return this->op_.str_; + default: + return 0; + } +} + +bool +ETCL_Literal_Constraint::operator== (const ETCL_Literal_Constraint & rhs) +{ + bool return_value = false; + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_STRING: + return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) == 0); + break; + case ACE_ETCL_DOUBLE: + return_value = ACE::is_equal ((ACE_CDR::Double) *this, (ACE_CDR::Double) rhs); + break; + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + return_value = (ACE_CDR::Long) *this == (ACE_CDR::Long) rhs; + break; + case ACE_ETCL_UNSIGNED: + return_value = (ACE_CDR::ULong) *this == (ACE_CDR::ULong) rhs; + break; + case ACE_ETCL_BOOLEAN: + return_value = (ACE_CDR::Boolean) *this == (ACE_CDR::Boolean) rhs; + break; + default: + break; + } + + return return_value; +} + +bool +ETCL_Literal_Constraint::operator< (const ETCL_Literal_Constraint & rhs) +{ + bool return_value = false; + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_STRING: + return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) < 0); + break; + case ACE_ETCL_DOUBLE: + return_value = (ACE_CDR::Double) *this < (ACE_CDR::Double) rhs; + break; + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + return_value = (ACE_CDR::Long) *this < (ACE_CDR::Long) rhs; + break; + case ACE_ETCL_UNSIGNED: + return_value = (ACE_CDR::ULong) *this < (ACE_CDR::ULong) rhs; + break; + case ACE_ETCL_BOOLEAN: + return_value = (ACE_CDR::Boolean) *this < (ACE_CDR::Boolean) rhs; + break; + default: + break; + } + + return return_value; +} + +bool +ETCL_Literal_Constraint::operator> (const ETCL_Literal_Constraint & rhs) +{ + bool return_value = false; + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_STRING: + return_value = (ACE_OS::strcmp ((const char*) *this, (const char*) rhs) > 0); + break; + case ACE_ETCL_DOUBLE: + return_value = (ACE_CDR::Double) *this > (ACE_CDR::Double) rhs; + break; + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + return_value = (ACE_CDR::Long) *this > (ACE_CDR::Long) rhs; + break; + case ACE_ETCL_UNSIGNED: + return_value = (ACE_CDR::ULong) *this > (ACE_CDR::ULong) rhs; + break; + default: + break; + } + + return return_value; +} + +ETCL_Literal_Constraint +ETCL_Literal_Constraint::operator+ (const ETCL_Literal_Constraint & rhs) +{ + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_DOUBLE: + { + ACE_CDR::Double result = (ACE_CDR::Double) *this + (ACE_CDR::Double) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Double) result); + } + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + { + ACE_CDR::Long result = (ACE_CDR::Long) *this + (ACE_CDR::Long) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Long) result); + } + case ACE_ETCL_UNSIGNED: + { + ACE_CDR::ULong result = (ACE_CDR::ULong) *this + (ACE_CDR::ULong) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); + } + default: + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + } +} + +ETCL_Literal_Constraint +ETCL_Literal_Constraint::operator- (const ETCL_Literal_Constraint & rhs) +{ + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_DOUBLE: + { + ACE_CDR::Double result = (ACE_CDR::Double) *this - (ACE_CDR::Double) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Double) result); + } + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + { + ACE_CDR::Long result = (ACE_CDR::Long) *this - (ACE_CDR::Long) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Long) result); + } + case ACE_ETCL_UNSIGNED: + { + ACE_CDR::ULong result = (ACE_CDR::ULong) *this - (ACE_CDR::ULong) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); + } + default: + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + } +} + +ETCL_Literal_Constraint +ETCL_Literal_Constraint::operator* (const ETCL_Literal_Constraint & rhs) +{ + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_DOUBLE: + { + ACE_CDR::Double result = (ACE_CDR::Double) *this * (ACE_CDR::Double) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Double) result); + } + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + { + ACE_CDR::Long result = (ACE_CDR::Long) *this * (ACE_CDR::Long) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Long) result); + } + case ACE_ETCL_UNSIGNED: + { + ACE_CDR::ULong result = (ACE_CDR::ULong) *this * (ACE_CDR::ULong) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); + } + default: + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + } +} + +ETCL_Literal_Constraint +ETCL_Literal_Constraint::operator/ (const ETCL_Literal_Constraint & rhs) +{ + Literal_Type widest_type = this->widest_type (rhs); + + switch (widest_type) + { + case ACE_ETCL_DOUBLE: + { + if (ACE::is_equal ((ACE_CDR::Double) rhs, 0.0)) + return ETCL_Literal_Constraint ((ACE_CDR::Double) 0.0); + + ACE_CDR::Double result = (ACE_CDR::Double) *this / (ACE_CDR::Double) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Double) result); + } + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + { + if ((ACE_CDR::Long) rhs == 0) + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + + ACE_CDR::Long result = (ACE_CDR::Long) *this / (ACE_CDR::Long) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::Long) result); + } + case ACE_ETCL_UNSIGNED: + { + if ((ACE_CDR::ULong) rhs == 0) + return ETCL_Literal_Constraint ((ACE_CDR::ULong) 0); + + ACE_CDR::ULong result = (ACE_CDR::ULong) *this / (ACE_CDR::ULong) rhs; + return ETCL_Literal_Constraint ((ACE_CDR::ULong) result); + } + default: + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + } +} + +ETCL_Literal_Constraint +ETCL_Literal_Constraint::operator- (void) +{ + switch (this->type_) + { + case ACE_ETCL_DOUBLE: + return ETCL_Literal_Constraint (- this->op_.double_); + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + return ETCL_Literal_Constraint (- this->op_.integer_); + case ACE_ETCL_UNSIGNED: + return ETCL_Literal_Constraint (- (ACE_CDR::Long) this->op_.uinteger_); + default: + return ETCL_Literal_Constraint ((ACE_CDR::Long) 0); + } +} + +Literal_Type +ETCL_Literal_Constraint::widest_type (const ETCL_Literal_Constraint & rhs) +{ + Literal_Type rhs_type = rhs.expr_type (); + Literal_Type return_value = rhs_type; + + if (rhs_type != this->type_) + { + if (rhs_type > this->type_) + { + return_value = rhs_type; + } + else + { + return_value = this->type_; + } + } + + return return_value; +} + +void +ETCL_Literal_Constraint::copy (const ETCL_Literal_Constraint &lit) +{ + if (this->type_ == ACE_ETCL_STRING) + { + ACE::strdelete (this->op_.str_); + } + + this->type_ = lit.type_; + + switch (this->type_) + { + case ACE_ETCL_STRING: + this->op_.str_ = ACE::strnew (lit.op_.str_); + break; + case ACE_ETCL_DOUBLE: + this->op_.double_ = lit.op_.double_; + break; + case ACE_ETCL_UNSIGNED: + this->op_.uinteger_ = lit.op_.uinteger_; + break; + case ACE_ETCL_INTEGER: + case ACE_ETCL_SIGNED: + this->op_.integer_ = lit.op_.integer_; + break; + case ACE_ETCL_BOOLEAN: + this->op_.bool_ = lit.op_.bool_; + break; + default: + this->type_ = ACE_ETCL_UNKNOWN; + break; + } +} + +// **************************************************************** + +int +ETCL_Identifier::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_identifier (this); +} + +// **************************************************************** + +ETCL_Union_Value::~ETCL_Union_Value (void) +{ + delete this->string_; + delete this->integer_; +} + +int +ETCL_Union_Value::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_union_value (this); +} + +// **************************************************************** + +ETCL_Union_Pos::~ETCL_Union_Pos (void) +{ + delete this->component_; + delete this->union_value_; +} + +int +ETCL_Union_Pos::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_union_pos (this); +} + +// **************************************************************** + +ETCL_Component_Pos::~ETCL_Component_Pos (void) +{ + delete this->component_; + delete this->integer_; +} + +int +ETCL_Component_Pos::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_component_pos (this); +} + +// **************************************************************** + +ETCL_Component_Assoc::~ETCL_Component_Assoc (void) +{ + delete this->component_; + delete this->identifier_; +} + +int +ETCL_Component_Assoc::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_component_assoc (this); +} + +// **************************************************************** + +ETCL_Component_Array::~ETCL_Component_Array (void) +{ + delete this->component_; + delete this->integer_; +} + +int +ETCL_Component_Array::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_component_array (this); +} + +// **************************************************************** + +ETCL_Special::~ETCL_Special (void) +{} + +int +ETCL_Special::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_special (this); +} + +// **************************************************************** + +ETCL_Component::~ETCL_Component (void) +{ + delete this->component_; + delete this->identifier_; +} + +int +ETCL_Component::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_component (this); +} + +// **************************************************************** + +ETCL_Dot::~ETCL_Dot (void) +{ + delete this->component_; +} + +int +ETCL_Dot::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_dot (this); +} + +// **************************************************************** + +ETCL_Eval::~ETCL_Eval (void) +{ + delete this->component_; +} + +int +ETCL_Eval::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_eval (this); +} + +// **************************************************************** + +ETCL_Default::~ETCL_Default (void) +{ + delete this->component_; +} + +int +ETCL_Default::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_default (this); +} + +// **************************************************************** + +ETCL_Exist::~ETCL_Exist (void) +{ + delete this->component_; +} + +int +ETCL_Exist::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_exist (this); +} + +// **************************************************************** + +ETCL_Unary_Expr::~ETCL_Unary_Expr (void) +{ + delete this->subexpr_; +} + +int +ETCL_Unary_Expr::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_unary_expr (this); +} + +// **************************************************************** + +ETCL_Binary_Expr::~ETCL_Binary_Expr (void) +{ + delete this->lhs_; + delete this->rhs_; +} + +int +ETCL_Binary_Expr::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_binary_expr (this); +} + +// **************************************************************** + +ETCL_Preference::~ETCL_Preference (void) +{ + delete this->subexpr_; +} + +int +ETCL_Preference::accept (ETCL_Constraint_Visitor *visitor) +{ + return visitor->visit_preference (this); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.h b/dep/acelite/ace/ETCL/ETCL_Constraint.h new file mode 100644 index 00000000000..0762d190880 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Constraint.h @@ -0,0 +1,416 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ETCL_Constraint.h + * + * $Id: ETCL_Constraint.h 94030 2011-05-08 17:58:47Z johnnyw $ + * + * @author Carlos O'Ryan (coryan@cs.wustl.edu) + * @author Jeff Parsons (j.parsons@vanderbilt.edu) + */ +//============================================================================= + +#ifndef ACE_ETCL_CONSTRAINT_H +#define ACE_ETCL_CONSTRAINT_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/CDR_Base.h" + +#include "ace/ETCL/ace_etcl_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef unsigned long Literal_Type; + +class ETCL_Constraint_Visitor; + +class ACE_ETCL_Export ETCL_Constraint +{ +public: + /// Constructor and destructor + ETCL_Constraint (void); + virtual ~ETCL_Constraint (void); + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +protected: + enum + { + ACE_ETCL_STRING, + ACE_ETCL_DOUBLE, + ACE_ETCL_UNSIGNED, + ACE_ETCL_SIGNED, + ACE_ETCL_INTEGER, + ACE_ETCL_BOOLEAN, + ACE_ETCL_COMPONENT, + ACE_ETCL_UNKNOWN + }; +}; + +// **************************************************************** + +class ACE_ETCL_Export ETCL_Literal_Constraint + : public ETCL_Constraint +{ +public: + ETCL_Literal_Constraint (void); + + // = Constructors for each of the various types of literals. + + explicit ETCL_Literal_Constraint (ACE_CDR::ULong uinteger); + explicit ETCL_Literal_Constraint (ACE_CDR::Long integer); + explicit ETCL_Literal_Constraint (ACE_CDR::Boolean boolean); + explicit ETCL_Literal_Constraint (ACE_CDR::Double doub); + explicit ETCL_Literal_Constraint (const char* str); + + /// Copy constructor + ETCL_Literal_Constraint (const ETCL_Literal_Constraint& lit); + + /// Destructor. + virtual ~ETCL_Literal_Constraint(void); + + /// Visitor accept method. + virtual int accept (ETCL_Constraint_Visitor* visitor); + + Literal_Type expr_type (void) const; + + /// Assignment operator. + void operator= (const ETCL_Literal_Constraint& co); + + // Conversion routines. + operator ACE_CDR::Boolean (void) const; + operator ACE_CDR::ULong (void) const; + operator ACE_CDR::Long (void) const; + operator ACE_CDR::Double (void) const; + operator const char* (void) const; + + // Return the type represented by this MysteryOperand. + + // = Boolean operators. + + bool + operator< (const ETCL_Literal_Constraint& rhs); + + bool + operator<= (const ETCL_Literal_Constraint& rhs); + + bool + operator> (const ETCL_Literal_Constraint& rhs); + + bool + operator>= (const ETCL_Literal_Constraint& rhs); + + bool + operator== (const ETCL_Literal_Constraint& rhs); + + bool + operator!= (const ETCL_Literal_Constraint& rhs); + + // = Arithmetic operators. + + ETCL_Literal_Constraint + operator+ (const ETCL_Literal_Constraint& rhs); + + ETCL_Literal_Constraint + operator- (const ETCL_Literal_Constraint& rhs); + + ETCL_Literal_Constraint + operator* (const ETCL_Literal_Constraint& rhs); + + ETCL_Literal_Constraint + operator/ (const ETCL_Literal_Constraint& rhs); + + // Unary minus. + ETCL_Literal_Constraint + operator- (void); + + /// Ensure both operands are of the same simple numeric type. + virtual Literal_Type + widest_type (const ETCL_Literal_Constraint& rhs); + +protected: + /// Private copy method. + void copy (const ETCL_Literal_Constraint& co); + + /// Union of the possible literal types. + union + { + char* str_; + ACE_CDR::ULong uinteger_; + ACE_CDR::Long integer_; + ACE_CDR::Boolean bool_; + ACE_CDR::Double double_; + } op_; + + /// The actual types of the ETCL_Literal_Constraint. + Literal_Type type_; +}; + +// **************************************************************** + +class ACE_ETCL_Export ETCL_Identifier : public ETCL_Constraint +{ +public: + ETCL_Identifier (const char *value); + + /// Get the value + const char *value (void) const; + + // = The Constraint methods. + int accept (ETCL_Constraint_Visitor *visitor); + +private: + /// The value + ACE_CString string_; +}; + +// **************************************************************** + +class ACE_ETCL_Export ETCL_Union_Value : public ETCL_Constraint +{ +public: + ETCL_Union_Value (int sign, + ETCL_Constraint *integer); + explicit ETCL_Union_Value (ETCL_Constraint *string = 0); + virtual ~ETCL_Union_Value (void); + + int sign (void) const; + ETCL_Literal_Constraint *integer (void) const; + ETCL_Literal_Constraint *string (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + int sign_; + ETCL_Literal_Constraint *integer_; + ETCL_Literal_Constraint *string_; +}; + +class ACE_ETCL_Export ETCL_Union_Pos : public ETCL_Constraint +{ +public: + ETCL_Union_Pos (ETCL_Constraint *union_value = 0, + ETCL_Constraint *component = 0); + virtual ~ETCL_Union_Pos (void); + + ETCL_Union_Value *union_value (void) const; + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Union_Value *union_value_; + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Component_Pos : public ETCL_Constraint +{ +public: + ETCL_Component_Pos (ETCL_Constraint *integer = 0, + ETCL_Constraint *component = 0); + virtual ~ETCL_Component_Pos (void); + + ETCL_Literal_Constraint *integer (void) const; + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Literal_Constraint *integer_; + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Component_Assoc : public ETCL_Constraint +{ +public: + ETCL_Component_Assoc (ETCL_Constraint *identifier = 0, + ETCL_Constraint *component = 0); + virtual ~ETCL_Component_Assoc (void); + + ETCL_Identifier *identifier (void) const; + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Identifier *identifier_; + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Component_Array : public ETCL_Constraint +{ +public: + ETCL_Component_Array (ETCL_Constraint *integer = 0, + ETCL_Constraint *component = 0); + virtual ~ETCL_Component_Array (void); + + ETCL_Literal_Constraint *integer (void) const; + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Literal_Constraint *integer_; + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Special : public ETCL_Constraint +{ +public: + ETCL_Special (void); + ETCL_Special (int type); + virtual ~ETCL_Special (void); + + int type (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + int type_; +}; + +class ACE_ETCL_Export ETCL_Component : public ETCL_Constraint +{ +public: + ETCL_Component (ETCL_Constraint *identifier = 0, + ETCL_Constraint *component = 0); + virtual ~ETCL_Component (void); + + ETCL_Identifier *identifier (void) const; + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Identifier *identifier_; + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Dot : public ETCL_Constraint +{ +public: + explicit ETCL_Dot (ETCL_Constraint *component = 0); + virtual ~ETCL_Dot (void); + + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Eval : public ETCL_Constraint +{ +public: + explicit ETCL_Eval (ETCL_Constraint *component = 0); + virtual ~ETCL_Eval (void); + + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Default : public ETCL_Constraint +{ +public: + explicit ETCL_Default (ETCL_Constraint *component = 0); + virtual ~ETCL_Default (void); + + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Exist : public ETCL_Constraint +{ +public: + explicit ETCL_Exist (ETCL_Constraint *component = 0); + virtual ~ETCL_Exist (void); + + ETCL_Constraint *component (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + ETCL_Constraint *component_; +}; + +class ACE_ETCL_Export ETCL_Unary_Expr : public ETCL_Constraint +{ +public: + ETCL_Unary_Expr (int type, + ETCL_Constraint *subexpr); + virtual ~ETCL_Unary_Expr (void); + + int type (void) const; + ETCL_Constraint *subexpr (void) const; + + int accept (ETCL_Constraint_Visitor *visitor); + +private: + int type_; + ETCL_Constraint *subexpr_; +}; + +class ACE_ETCL_Export ETCL_Binary_Expr : public ETCL_Constraint +{ +public: + ETCL_Binary_Expr (int type, + ETCL_Constraint *lhs, + ETCL_Constraint *rhs); + virtual ~ETCL_Binary_Expr (void); + + int type (void) const; + ETCL_Constraint *rhs (void) const; + ETCL_Constraint *lhs (void) const; + + int accept (ETCL_Constraint_Visitor *visitor); + +private: + int type_; + ETCL_Constraint *lhs_; + ETCL_Constraint *rhs_; +}; + +class ACE_ETCL_Export ETCL_Preference : public ETCL_Constraint +{ +public: + ETCL_Preference (void); + ETCL_Preference (int type, + ETCL_Constraint *subexpr = 0); + virtual ~ETCL_Preference (void); + + int type (void) const; + ETCL_Constraint *subexpr (void) const; + + virtual int accept (ETCL_Constraint_Visitor *visitor); + +private: + int type_; + ETCL_Constraint *subexpr_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/ETCL/ETCL_Constraint.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" + +#endif // ACE_ETCL_CONSTRAINT_H diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint.inl b/dep/acelite/ace/ETCL/ETCL_Constraint.inl new file mode 100644 index 00000000000..a56cf39aa46 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Constraint.inl @@ -0,0 +1,349 @@ +// -*- C++ -*- +// $Id: ETCL_Constraint.inl 95595 2012-03-07 13:33:25Z johnnyw $ + +// **************************************************************** + +ACE_INLINE +ETCL_Literal_Constraint::ETCL_Literal_Constraint (void) + : type_ (ACE_ETCL_UNKNOWN) +{ +} + +// **************************************************************** + +ACE_INLINE +ETCL_Identifier::ETCL_Identifier (const char *value) + : string_ (value) +{ +} + +ACE_INLINE const char * +ETCL_Identifier::value (void) const +{ + return this->string_.c_str (); +} + + +// **************************************************************** + +ACE_INLINE +ETCL_Union_Value::ETCL_Union_Value (int sign, + ETCL_Constraint *integer) + : sign_ (sign), + string_ (0) +{ + this->integer_ = + dynamic_cast<ETCL_Literal_Constraint*> (integer); +} + +ACE_INLINE +ETCL_Union_Value::ETCL_Union_Value (ETCL_Constraint *string) + : sign_ (0), + integer_ (0) +{ + this->string_ = + dynamic_cast<ETCL_Literal_Constraint*> (string); +} + +ACE_INLINE int +ETCL_Union_Value::sign (void) const +{ + return this->sign_; +} + +ACE_INLINE ETCL_Literal_Constraint * +ETCL_Union_Value::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE ETCL_Literal_Constraint * +ETCL_Union_Value::string (void) const +{ + return this->string_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Union_Pos::ETCL_Union_Pos (ETCL_Constraint *union_value, + ETCL_Constraint *component) + : component_ (component) +{ + this->union_value_ = + dynamic_cast<ETCL_Union_Value*> (union_value); +} + +ACE_INLINE ETCL_Union_Value * +ETCL_Union_Pos::union_value (void) const +{ + return this->union_value_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Union_Pos::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Component_Pos::ETCL_Component_Pos ( + ETCL_Constraint *integer, + ETCL_Constraint *component) + : component_ (component) +{ + this->integer_ = + dynamic_cast<ETCL_Literal_Constraint*> (integer); +} + +ACE_INLINE ETCL_Literal_Constraint * +ETCL_Component_Pos::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Component_Pos::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Component_Assoc::ETCL_Component_Assoc ( + ETCL_Constraint *identifier, + ETCL_Constraint *component) + : component_ (component) +{ + this->identifier_ = + dynamic_cast<ETCL_Identifier*> (identifier); +} + +ACE_INLINE ETCL_Identifier * +ETCL_Component_Assoc::identifier (void) const +{ + return this->identifier_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Component_Assoc::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Component_Array::ETCL_Component_Array ( + ETCL_Constraint *integer, + ETCL_Constraint *component) + : component_ (component) +{ + this->integer_ = + dynamic_cast<ETCL_Literal_Constraint*> (integer); +} + +ACE_INLINE ETCL_Literal_Constraint * +ETCL_Component_Array::integer (void) const +{ + return this->integer_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Component_Array::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Special::ETCL_Special (void) + : type_ (0) +{} + +ACE_INLINE +ETCL_Special::ETCL_Special (int type) + : type_ (type) +{} + +ACE_INLINE int +ETCL_Special::type (void) const +{ + return this->type_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Component::ETCL_Component (ETCL_Constraint *identifier, + ETCL_Constraint *component) + : component_ (component) +{ + this->identifier_ = + dynamic_cast<ETCL_Identifier*> (identifier); +} + +ACE_INLINE ETCL_Identifier * +ETCL_Component::identifier (void) const +{ + return this->identifier_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Component::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Dot::ETCL_Dot (ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE ETCL_Constraint * +ETCL_Dot::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Eval::ETCL_Eval (ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE ETCL_Constraint * +ETCL_Eval::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Default::ETCL_Default (ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE ETCL_Constraint * +ETCL_Default::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Exist::ETCL_Exist (ETCL_Constraint *component) + : component_ (component) +{ +} + +ACE_INLINE ETCL_Constraint * +ETCL_Exist::component (void) const +{ + return this->component_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Unary_Expr::ETCL_Unary_Expr (int type, + ETCL_Constraint *subexpr) + : type_ (type), + subexpr_ (subexpr) +{} + +ACE_INLINE int +ETCL_Unary_Expr::type (void) const +{ + return this->type_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Unary_Expr::subexpr (void) const +{ + return this->subexpr_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Binary_Expr::ETCL_Binary_Expr (int type, + ETCL_Constraint *lhs, + ETCL_Constraint *rhs) + : type_ (type), + lhs_ (lhs), + rhs_ (rhs) +{} + +ACE_INLINE int +ETCL_Binary_Expr::type (void) const +{ + return this->type_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Binary_Expr::rhs (void) const +{ + return this->rhs_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Binary_Expr::lhs (void) const +{ + return this->lhs_; +} + +// **************************************************************** + +ACE_INLINE +ETCL_Preference::ETCL_Preference (void) +{} + +ACE_INLINE +ETCL_Preference::ETCL_Preference (int type, + ETCL_Constraint *subexpr) + : type_ (type), + subexpr_ (subexpr) +{} + +ACE_INLINE int +ETCL_Preference::type (void) const +{ + return this->type_; +} + +ACE_INLINE ETCL_Constraint * +ETCL_Preference::subexpr (void) const +{ + return this->subexpr_; +} + +ACE_INLINE bool +ETCL_Literal_Constraint::operator!= (const ETCL_Literal_Constraint & rhs) +{ + return !(*this == rhs); +} + +ACE_INLINE bool +ETCL_Literal_Constraint::operator<= (const ETCL_Literal_Constraint & rhs) +{ + return !(*this > rhs); +} + +ACE_INLINE bool +ETCL_Literal_Constraint::operator>= (const ETCL_Literal_Constraint & rhs) +{ + return !(*this < rhs); +} diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp new file mode 100644 index 00000000000..66dbd8d09b8 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.cpp @@ -0,0 +1,117 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file ETCL_Constraint_Visitor.cpp + * + * $Id: ETCL_Constraint_Visitor.cpp 81653 2008-05-08 21:08:49Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#include "ace/ETCL/ETCL_Constraint_Visitor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ETCL_Constraint_Visitor::~ETCL_Constraint_Visitor (void) +{ +} + +int +ETCL_Constraint_Visitor::visit_literal (ETCL_Literal_Constraint *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_identifier (ETCL_Identifier *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_union_value (ETCL_Union_Value *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_union_pos (ETCL_Union_Pos *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_component_pos (ETCL_Component_Pos *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_component_assoc (ETCL_Component_Assoc *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_component_array (ETCL_Component_Array *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_special (ETCL_Special *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_component (ETCL_Component *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_dot (ETCL_Dot *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_eval (ETCL_Eval *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_default (ETCL_Default *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_exist (ETCL_Exist *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_unary_expr (ETCL_Unary_Expr *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_binary_expr (ETCL_Binary_Expr *) +{ + return 0; +} + +int +ETCL_Constraint_Visitor::visit_preference (ETCL_Preference *) +{ + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h new file mode 100644 index 00000000000..2337f60e8c4 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Constraint_Visitor.h @@ -0,0 +1,70 @@ +// -*- C++ -*- +//============================================================================= +/** + * @file ETCL_Constraint_Visitor.h + * + * $Id: ETCL_Constraint_Visitor.h 81653 2008-05-08 21:08:49Z parsons $ + * + * @author Carlos O'Ryan <coryan@cs.wustl.edu> + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef ACE_ETCL_CONSTRAINT_VISITOR_H +#define ACE_ETCL_CONSTRAINT_VISITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/ETCL/ace_etcl_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ETCL_Literal_Constraint; +class ETCL_Identifier; +class ETCL_Union_Value; +class ETCL_Union_Pos; +class ETCL_Component_Pos; +class ETCL_Component_Assoc; +class ETCL_Component_Array; +class ETCL_Special; +class ETCL_Component; +class ETCL_Dot; +class ETCL_Eval; +class ETCL_Default; +class ETCL_Exist; +class ETCL_Unary_Expr; +class ETCL_Binary_Expr; +class ETCL_Preference; + +class ACE_ETCL_Export ETCL_Constraint_Visitor +{ +public: + virtual ~ETCL_Constraint_Visitor (void); + + virtual int visit_literal (ETCL_Literal_Constraint *); + virtual int visit_identifier (ETCL_Identifier *); + virtual int visit_union_value (ETCL_Union_Value *); + virtual int visit_union_pos (ETCL_Union_Pos *); + virtual int visit_component_pos (ETCL_Component_Pos *); + virtual int visit_component_assoc (ETCL_Component_Assoc *); + virtual int visit_component_array (ETCL_Component_Array *); + virtual int visit_special (ETCL_Special *); + virtual int visit_component (ETCL_Component *); + virtual int visit_dot (ETCL_Dot *); + virtual int visit_eval (ETCL_Eval *); + virtual int visit_default (ETCL_Default *); + virtual int visit_exist (ETCL_Exist *); + virtual int visit_unary_expr (ETCL_Unary_Expr *); + virtual int visit_binary_expr (ETCL_Binary_Expr *); + virtual int visit_preference (ETCL_Preference *); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif // ACE_ETCL_CONSTRAINT_VISITOR_H diff --git a/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp b/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp new file mode 100644 index 00000000000..727bd264672 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Interpreter.cpp @@ -0,0 +1,113 @@ +// -*- C++ -*- +// $Id: ETCL_Interpreter.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Guard_T.h" +#include "ace/Truncate.h" + +#include "ace/ETCL/ETCL_Interpreter.h" +#include "ace/ETCL/ETCL_Constraint.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__; + +ETCL_Interpreter::ETCL_Interpreter (void) + : root_ (0) +{ +} + +ETCL_Interpreter::~ETCL_Interpreter (void) +{ + delete this->root_; +} + +int +ETCL_Interpreter::build_tree (const char* constraints) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + guard, + ETCL_Interpreter::parserMutex__, + -1); + + Lex_String_Input::reset ((char*)constraints); + + yyval.constraint = 0; + int return_value = ::yyparse (); + + if (return_value == 0 && yyval.constraint != 0) + { + this->root_ = yyval.constraint; + } + else + { + this->root_ = 0; + } + + return return_value; +} + +int +ETCL_Interpreter::is_empty_string (const char* str) +{ + int return_value = 0; + + if (str != 0) + { + int i = 0; + + while (str[i] != '\0') + { + if (str[i] != ' ') + { + break; + } + + ++i; + } + + if (str[i] == '\0') + { + return_value = 1; + } + } + + return return_value; +} + +char* Lex_String_Input::string_ = 0; +char* Lex_String_Input::current_ = 0; +char* Lex_String_Input::end_ = 0; + +// Routine to have Lex read its input from the constraint string. + +int +Lex_String_Input::copy_into (char* buf, + int max_size) +{ + int const chars_left = + ACE_Utils::truncate_cast<int> ( + Lex_String_Input::end_ - Lex_String_Input::current_); + + int const n = max_size > chars_left ? chars_left : max_size; + + if (n > 0) + { + ACE_OS::memcpy (buf, + Lex_String_Input::current_, + n); + Lex_String_Input::current_ += n; + } + + return n; +} + +void +Lex_String_Input::reset (char* input_string) +{ + Lex_String_Input::string_ = input_string; + Lex_String_Input::current_ = input_string; + Lex_String_Input::end_ = + input_string + ACE_OS::strlen (Lex_String_Input::string_); +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_Interpreter.h b/dep/acelite/ace/ETCL/ETCL_Interpreter.h new file mode 100644 index 00000000000..8553c9b3309 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_Interpreter.h @@ -0,0 +1,117 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file ETCL_Interpreter.h + * + * $Id: ETCL_Interpreter.h 82434 2008-07-28 11:40:36Z johnnyw $ + * + * @author Jeff Parsons <parsons@cs.wustl.edu> based on previous work by + * @author Seth Widoff <sbw1@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ETCL_INTERPRETER_H +#define ETCL_INTERPRETER_H + +#include /**/ "ace/pre.h" + +#include "ace/Thread_Mutex.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Synch_Traits.h" + +#include "etcl_parser_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ETCL_Constraint; + +ACE_END_VERSIONED_NAMESPACE_DECL + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ETCL_Interpreter + * + * @brief ETCL_Interpreter is the superclass for all ETCL interpreters. + * Its build tree method invokes the yacc parser to parse a constraint + * or preference string. + */ +class ETCL_Parser_Export ETCL_Interpreter +{ +protected: + // = Initialization and termination methods. + /// Constructor. + ETCL_Interpreter (void); + + /// Destructor. + virtual ~ETCL_Interpreter (void); + + /// Using the Yacc generated parser, construct an expression tree + /// representing @a constraints from the tokens returned by it. + int build_tree (const char* constraints); + + static int is_empty_string (const char* str); + + /// The root of the expression tree, not equal to null if build_tree + /// successfully builds a tree from the constraints. + ETCL_Constraint* root_; +private: + /// This mutex protects the <build_tree> method from reentrance. + static ACE_SYNCH_MUTEX parserMutex__; +}; + + +// Functions we need for parsing. +extern int yyparse (void); +extern void yyrestart (FILE*); +extern int yylex (void); + +// Have yylex read from the constraint string, not from stdin. +#undef YY_INPUT +#define YY_INPUT(b, r, ms) (r = Lex_String_Input::copy_into(b, ms)) + +/** + * @class Lex_String_Input + * + * @brief Have Lex read from a string and not from stdin. Essentially, + * the interpreter needs to call yylex() until EOF, and call + * TAO_Lex_String_Input::reset() with the new string, prior to + * calling yyparse. + */ +class Lex_String_Input +{ +public: + /// Reset the lex input. + static void reset (char* input_string); + + /// Method lex will call to read from the input string. + static int copy_into (char* buf, int max_size); + +private: + + /// Pointers to keep track of the input string. + static char* string_; + static char* current_; + static char* end_; +}; + +/// The union used by lex and bison to build the Abstract Syntax Tree. +typedef union +{ + ACE_VERSIONED_NAMESPACE_NAME::ETCL_Constraint* constraint; +} YYSTYPE; + +extern YYSTYPE yylval; +extern YYSTYPE yyval; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif // ETCL_INTERPRETER_H diff --git a/dep/acelite/ace/ETCL/ETCL_l.cpp b/dep/acelite/ace/ETCL/ETCL_l.cpp new file mode 100644 index 00000000000..ed985de0035 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_l.cpp @@ -0,0 +1,1877 @@ + +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + +#include "ace/ETCL/ETCL_Constraint.h" + +#ifdef __cplusplus + +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_stdio.h" + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include <io.h> +#include <stdlib.h> +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state +{ + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 +}; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 41 +#define YY_END_OF_BUFFER 42 +static yyconst short int yy_accept[118] = + { 0, + 0, 0, 42, 40, 39, 41, 40, 24, 40, 22, + 23, 14, 12, 13, 25, 15, 35, 16, 40, 18, + 38, 38, 38, 31, 40, 32, 40, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 11, 21, 0, + 37, 0, 36, 0, 35, 17, 20, 19, 38, 38, + 38, 38, 27, 0, 0, 0, 38, 38, 38, 38, + 10, 38, 38, 38, 9, 38, 38, 0, 0, 38, + 38, 38, 0, 0, 0, 8, 38, 38, 38, 2, + 1, 7, 38, 38, 0, 36, 38, 33, 0, 0, + 0, 38, 38, 38, 38, 5, 34, 0, 0, 0, + + 38, 6, 3, 38, 0, 0, 0, 38, 4, 30, + 0, 0, 26, 0, 28, 29, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 1, 1, 5, 1, 1, 6, 7, + 8, 9, 10, 1, 11, 12, 13, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 1, 1, 15, + 16, 17, 1, 1, 18, 19, 19, 19, 20, 21, + 19, 19, 19, 19, 19, 22, 19, 19, 19, 19, + 19, 23, 24, 25, 26, 19, 19, 19, 19, 19, + 27, 28, 29, 1, 30, 1, 31, 19, 19, 32, + + 33, 34, 35, 36, 37, 19, 19, 38, 39, 40, + 41, 42, 19, 43, 44, 45, 46, 19, 47, 48, + 49, 19, 1, 1, 1, 50, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[51] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 1, 1, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1 + } ; + +static yyconst short int yy_base[122] = + { 0, + 0, 0, 146, 147, 147, 147, 129, 147, 45, 147, + 147, 147, 147, 147, 130, 147, 40, 127, 126, 125, + 0, 122, 116, 147, 0, 147, 21, 98, 104, 88, + 98, 94, 24, 92, 89, 100, 93, 147, 147, 50, + 147, 51, 48, 115, 46, 147, 147, 147, 0, 106, + 101, 0, 147, 93, 92, 75, 91, 88, 84, 77, + 0, 71, 78, 72, 0, 76, 70, 57, 60, 90, + 93, 0, 72, 69, 68, 0, 78, 64, 63, 0, + 0, 0, 74, 69, 90, 89, 82, 0, 66, 59, + 66, 52, 52, 51, 54, 0, 0, 49, 49, 54, + + 45, 0, 0, 43, 44, 47, 39, 30, 0, 147, + 35, 37, 0, 35, 147, 147, 147, 85, 87, 62, + 89 + } ; + +static yyconst short int yy_def[122] = + { 0, + 117, 1, 117, 117, 117, 117, 117, 117, 118, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 119, 119, 119, 117, 120, 117, 117, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 117, 117, 118, + 117, 117, 117, 117, 117, 117, 117, 117, 119, 119, + 119, 121, 117, 117, 117, 117, 119, 119, 119, 119, + 119, 119, 119, 119, 119, 119, 119, 118, 117, 119, + 119, 121, 117, 117, 117, 119, 119, 119, 119, 119, + 119, 119, 119, 119, 117, 117, 119, 119, 117, 117, + 117, 119, 119, 119, 119, 119, 119, 117, 117, 117, + + 119, 119, 119, 119, 117, 117, 117, 119, 119, 117, + 117, 117, 119, 117, 117, 117, 0, 117, 117, 117, + 117 + } ; + +static yyconst short int yy_nxt[198] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, + 22, 21, 21, 21, 23, 21, 24, 25, 26, 27, + 28, 29, 30, 31, 21, 21, 32, 21, 33, 34, + 35, 21, 36, 21, 21, 21, 37, 21, 21, 38, + 41, 44, 53, 45, 62, 41, 68, 44, 54, 45, + 63, 43, 41, 55, 52, 56, 116, 69, 115, 85, + 85, 114, 42, 86, 113, 112, 111, 42, 68, 110, + 69, 109, 108, 107, 42, 40, 40, 40, 49, 49, + 72, 72, 106, 105, 104, 103, 102, 101, 100, 99, + + 98, 97, 86, 86, 96, 95, 94, 93, 92, 91, + 90, 89, 88, 87, 84, 83, 82, 81, 80, 79, + 78, 77, 76, 75, 74, 73, 71, 70, 43, 67, + 66, 65, 64, 61, 60, 59, 58, 57, 51, 50, + 48, 47, 46, 43, 39, 117, 3, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117 + + } ; + +static yyconst short int yy_chk[198] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 9, 17, 27, 17, 33, 40, 42, 45, 27, 45, + 33, 43, 68, 27, 120, 27, 114, 43, 112, 69, + 69, 111, 9, 69, 108, 107, 106, 40, 42, 105, + 43, 104, 101, 100, 68, 118, 118, 118, 119, 119, + 121, 121, 99, 98, 95, 94, 93, 92, 91, 90, + + 89, 87, 86, 85, 84, 83, 79, 78, 77, 75, + 74, 73, 71, 70, 67, 66, 64, 63, 62, 60, + 59, 58, 57, 56, 55, 54, 51, 50, 44, 37, + 36, 35, 34, 32, 31, 30, 29, 28, 23, 22, + 20, 19, 18, 15, 7, 3, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 117, 117, 117, 117, 117 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#define INITIAL 0 + +ACE_END_VERSIONED_NAMESPACE_DECL + +//============================================================================= +/** + * @file ETCL_l.cpp + * + * $Id: ETCL_l.cpp 93651 2011-03-28 08:49:11Z johnnyw $ + * + * @author Carlos O'Ryan <coryan@uci.edu> based on previous work by Seth Widoff <sbw1@cs.wustl.edu> + */ +//============================================================================= + + +#include "ace/ETCL/ETCL_Interpreter.h" +#include "ace/ETCL/ETCL_y.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +static const char* extract_string(char*); +//static const char * extract_string(char*); + +#define YY_LEX_DEBUG + +#ifdef CONSTRAINT_DEBUG +#define YY_LEX_DEBUG ACE_OS::fprintf(stderr, "%s\n", yytext) +#endif /* CONSTRAINT_DEBUG */ + +//#define YY_DECL int ETCL_yylex (ETCL_YYSTYPE *lvalp, void* state) + +#define YY_BREAK +#define YY_NO_UNPUT + + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +ACE_END_VERSIONED_NAMESPACE_DECL + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include <stdlib.h> +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +//FUZZ: disable check_for_lack_ACE_OS +#ifndef ETCL_ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ETCL_ECHO { size_t __dum_ret = fwrite( yytext, yyleng, 1, yyout ); (void) __dum_ret; } +#endif + //FUZZ: enable check_for_lack_ACE_OS + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = ACE_OS::getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = ACE_OS::fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = 0; + register char *yy_bp = 0; + register int yy_act; + +//#line 50 "ETCL/ETCL.ll" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 147 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +//#line 52 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_MIN; } + YY_BREAK +case 2: +YY_RULE_SETUP +//#line 53 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_MAX; } + YY_BREAK +case 3: +YY_RULE_SETUP +//#line 54 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_FIRST; } + YY_BREAK +case 4: +YY_RULE_SETUP +//#line 55 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_RANDOM; } + YY_BREAK +case 5: +YY_RULE_SETUP +//#line 56 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_WITH; } + YY_BREAK +case 6: +YY_RULE_SETUP +//#line 57 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_EXIST; } + YY_BREAK +case 7: +YY_RULE_SETUP +//#line 58 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_NOT; } + YY_BREAK +case 8: +YY_RULE_SETUP +//#line 59 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_AND; } + YY_BREAK +case 9: +YY_RULE_SETUP +//#line 60 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_OR; } + YY_BREAK +case 10: +YY_RULE_SETUP +//#line 61 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_IN; } + YY_BREAK +case 11: +YY_RULE_SETUP +//#line 62 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_TWIDDLE; } + YY_BREAK +case 12: +YY_RULE_SETUP +//#line 63 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_PLUS; } + YY_BREAK +case 13: +YY_RULE_SETUP +//#line 64 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_MINUS; } + YY_BREAK +case 14: +YY_RULE_SETUP +//#line 65 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_MULT; } + YY_BREAK +case 15: +YY_RULE_SETUP +//#line 66 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_DIV; } + YY_BREAK +case 16: +YY_RULE_SETUP +//#line 67 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_LT; } + YY_BREAK +case 17: +YY_RULE_SETUP +//#line 68 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_LE; } + YY_BREAK +case 18: +YY_RULE_SETUP +//#line 69 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_GT; } + YY_BREAK +case 19: +YY_RULE_SETUP +//#line 70 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_GE; } + YY_BREAK +case 20: +YY_RULE_SETUP +//#line 71 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_EQ; } + YY_BREAK +case 21: +YY_RULE_SETUP +//#line 72 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_NE; } + YY_BREAK +case 22: +YY_RULE_SETUP +//#line 73 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_LPAREN; } + YY_BREAK +case 23: +YY_RULE_SETUP +//#line 74 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_RPAREN; } + YY_BREAK +case 24: +YY_RULE_SETUP +//#line 75 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_DOLLAR; } + YY_BREAK +case 25: +YY_RULE_SETUP +//#line 76 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_DOT; } + YY_BREAK +case 26: +YY_RULE_SETUP +//#line 77 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_DEFAULT; } + YY_BREAK +case 27: +YY_RULE_SETUP +//#line 78 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_DISCRIMINANT; } + YY_BREAK +case 28: +YY_RULE_SETUP +//#line 79 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_TYPE_ID; } + YY_BREAK +case 29: +YY_RULE_SETUP +//#line 80 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_REPOS_ID; } + YY_BREAK +case 30: +YY_RULE_SETUP +//#line 81 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_LENGTH; } + YY_BREAK +case 31: +YY_RULE_SETUP +//#line 82 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_LBRA; } + YY_BREAK +case 32: +YY_RULE_SETUP +//#line 83 "ETCL/ETCL.ll" +{ YY_LEX_DEBUG; return ETCL_RBRA; } + YY_BREAK +case 33: +YY_RULE_SETUP +//#line 84 "ETCL/ETCL.ll" +{ + yylval.constraint = + new ETCL_Literal_Constraint ((ACE_CDR::Boolean) 1); + YY_LEX_DEBUG; return ETCL_BOOLEAN; + } + YY_BREAK +case 34: +YY_RULE_SETUP +//#line 89 "ETCL/ETCL.ll" +{ + yylval.constraint = + new ETCL_Literal_Constraint ((ACE_CDR::Boolean) 0); + YY_LEX_DEBUG; return ETCL_BOOLEAN; + } + YY_BREAK +case 35: +YY_RULE_SETUP +//#line 94 "ETCL/ETCL.ll" +{ + yylval.constraint = + new ETCL_Literal_Constraint (ACE_OS::atoi (yytext)); + YY_LEX_DEBUG; return ETCL_INTEGER; + } + YY_BREAK +case 36: +YY_RULE_SETUP +//#line 99 "ETCL/ETCL.ll" +{ + double v; + sscanf (yytext, "%lf", &v); + yylval.constraint = + new ETCL_Literal_Constraint (v); + YY_LEX_DEBUG; return ETCL_FLOAT; + } + YY_BREAK +case 37: +YY_RULE_SETUP +//#line 106 "ETCL/ETCL.ll" +{ + yylval.constraint = + new ETCL_Literal_Constraint (extract_string(yytext)); + YY_LEX_DEBUG; return ETCL_STRING; + } + YY_BREAK +case 38: +YY_RULE_SETUP +//#line 111 "ETCL/ETCL.ll" +{ + yylval.constraint = + new ETCL_Identifier (yytext); + YY_LEX_DEBUG; return ETCL_IDENT; + } + YY_BREAK +case 39: +YY_RULE_SETUP +//#line 116 "ETCL/ETCL.ll" +{ + YY_LEX_DEBUG; break; // Ignore + } + YY_BREAK +case 40: +YY_RULE_SETUP +//#line 119 "ETCL/ETCL.ll" +{ + YY_LEX_DEBUG; break; // @@ TODO + } + YY_BREAK +case 41: +YY_RULE_SETUP +//#line 122 "ETCL/ETCL.ll" +ETCL_ECHO; + YY_BREAK +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 118 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 117); + + return yy_is_jam ? 0 : yy_current_state; + } + +#if 0 +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ +#endif /* 0 */ + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + +void yyflush_current_buffer (void) +{ + YY_FLUSH_BUFFER; +} + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if defined (ACE_HAS_WINCE) + // Mimic the behavior as WinCE does not have isatty(). + if ((file != 0) && (file == ACE_OS::fileno(file))) { + b->yy_is_interactive = 1; + } + else { + b->yy_is_interactive = 0; + } +#else + b->yy_is_interactive = file ? (ACE_OS::isatty( ACE_OS::fileno(file) ) > 0) : 0; +#endif // ACE_HAS_WINCE + + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) ACE_OS::fprintf( stderr, "%s\n", msg ); + ACE_OS::exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) ACE_OS::malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) ACE_OS::realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + ACE_OS::free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +//#line 122 "ETCL/ETCL.ll" + + +const char* +extract_string(char* str) +{ + char *t = str; + for (char * i = str + 1; *i != '\''; ++i, ++t) + { + if (*i == '\\') + { + ++i; + if (*i == 0) + return 0; + else if (*i == 't') + *t = '\t'; + else if (*i == 'n') + *t = '\n'; + else if (*i == '\\') + *t = '\\'; + else + *t = *i; + continue; + } + + *t = *i; + } + + *t = '\0'; + return str; +} + +int +yywrap (void) +{ + return 1; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_y.cpp b/dep/acelite/ace/ETCL/ETCL_y.cpp new file mode 100644 index 00000000000..880b6300d6a --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_y.cpp @@ -0,0 +1,1288 @@ + +/* A Bison parser, made from ETCL/ETCL.yy + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define ETCL_GT 257 +#define ETCL_GE 258 +#define ETCL_LT 259 +#define ETCL_LE 260 +#define ETCL_EQ 261 +#define ETCL_NE 262 +#define ETCL_EXIST 263 +#define ETCL_DEFAULT 264 +#define ETCL_AND 265 +#define ETCL_OR 266 +#define ETCL_NOT 267 +#define ETCL_IN 268 +#define ETCL_TWIDDLE 269 +#define ETCL_BOOLEAN 270 +#define ETCL_PLUS 271 +#define ETCL_MINUS 272 +#define ETCL_MULT 273 +#define ETCL_DIV 274 +#define ETCL_UMINUS 275 +#define ETCL_INTEGER 276 +#define ETCL_FLOAT 277 +#define ETCL_STRING 278 +#define ETCL_RPAREN 279 +#define ETCL_LPAREN 280 +#define ETCL_RBRA 281 +#define ETCL_LBRA 282 +#define ETCL_IDENT 283 +#define ETCL_UNSIGNED 284 +#define ETCL_SIGNED 285 +#define ETCL_DOUBLE 286 +#define ETCL_CONSTRAINT 287 +#define ETCL_COMPONENT 288 +#define ETCL_WITH 289 +#define ETCL_MAX 290 +#define ETCL_MIN 291 +#define ETCL_FIRST 292 +#define ETCL_RANDOM 293 +#define ETCL_DOLLAR 294 +#define ETCL_DOT 295 +#define ETCL_DISCRIMINANT 296 +#define ETCL_LENGTH 297 +#define ETCL_TYPE_ID 298 +#define ETCL_REPOS_ID 299 + + +//============================================================================= +/** + * @file ETCL_y.cpp + * + * $Id: ETCL_y.cpp 93651 2011-03-28 08:49:11Z johnnyw $ + * + * @author Carlos O'Ryan <coryan@uci.edu> based on previous work by Seth Widoff <sbw1@cs.wustl.edu> + */ +//============================================================================= + + +#include "ace/ETCL/ETCL_y.h" +#include "ace/ETCL/ETCL_Constraint.h" +#include "ace/ETCL/ETCL_Interpreter.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +extern int yylex (void); +extern void yyflush_current_buffer (void); + +static void yyerror (const char *) +{ + // @@ TODO + // Ignore error messages +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include <stdio.h> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 114 +#define YYFLAG -32768 +#define YYNTBASE 46 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 65) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 7, 10, 13, 15, 17, 21, 23, + 27, 29, 33, 37, 41, 45, 49, 53, 55, 59, + 64, 66, 70, 72, 76, 80, 82, 86, 90, 92, + 95, 97, 101, 103, 106, 109, 111, 114, 117, 119, + 121, 124, 128, 132, 135, 137, 138, 141, 144, 146, + 148, 149, 152, 154, 156, 159, 161, 163, 165, 167, + 169, 171, 176, 181, 184, 189, 190, 192, 195, 198 +}; + +static const short yyrhs[] = { 48, + 0, 47, 0, 37, 48, 0, 36, 48, 0, 35, + 48, 0, 38, 0, 39, 0, 48, 12, 49, 0, + 49, 0, 49, 11, 50, 0, 50, 0, 51, 7, + 51, 0, 51, 8, 51, 0, 51, 3, 51, 0, + 51, 4, 51, 0, 51, 5, 51, 0, 51, 6, + 51, 0, 51, 0, 52, 14, 57, 0, 52, 14, + 40, 57, 0, 52, 0, 53, 15, 53, 0, 53, + 0, 53, 17, 54, 0, 53, 18, 54, 0, 54, + 0, 54, 19, 55, 0, 54, 20, 55, 0, 55, + 0, 13, 56, 0, 56, 0, 26, 48, 25, 0, + 22, 0, 17, 22, 0, 18, 22, 0, 23, 0, + 17, 23, 0, 18, 23, 0, 24, 0, 16, 0, + 9, 29, 0, 9, 40, 57, 0, 10, 40, 57, + 0, 40, 57, 0, 29, 0, 0, 41, 59, 0, + 29, 58, 0, 60, 0, 61, 0, 0, 41, 59, + 0, 60, 0, 61, 0, 29, 58, 0, 43, 0, + 42, 0, 44, 0, 45, 0, 62, 0, 63, 0, + 28, 22, 27, 58, 0, 26, 29, 25, 58, 0, + 22, 58, 0, 26, 64, 25, 58, 0, 0, 22, + 0, 17, 22, 0, 18, 22, 0, 24, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 92, 93, 96, 98, 100, 102, 104, 108, 110, 113, + 115, 118, 120, 122, 124, 126, 128, 130, 133, 135, + 137, 140, 142, 145, 147, 149, 152, 154, 156, 159, + 161, 164, 166, 168, 170, 172, 174, 176, 178, 180, + 182, 184, 186, 188, 190, 194, 196, 199, 202, 203, + 206, 208, 211, 212, 215, 217, 219, 221, 223, 225, + 226, 229, 233, 237, 241, 245, 247, 249, 251, 253 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","ETCL_GT", +"ETCL_GE","ETCL_LT","ETCL_LE","ETCL_EQ","ETCL_NE","ETCL_EXIST", +"ETCL_DEFAULT","ETCL_AND","ETCL_OR","ETCL_NOT","ETCL_IN", +"ETCL_TWIDDLE","ETCL_BOOLEAN","ETCL_PLUS","ETCL_MINUS","ETCL_MULT", +"ETCL_DIV","ETCL_UMINUS","ETCL_INTEGER","ETCL_FLOAT","ETCL_STRING", +"ETCL_RPAREN","ETCL_LPAREN","ETCL_RBRA","ETCL_LBRA","ETCL_IDENT", +"ETCL_UNSIGNED","ETCL_SIGNED","ETCL_DOUBLE","ETCL_CONSTRAINT", +"ETCL_COMPONENT","ETCL_WITH","ETCL_MAX","ETCL_MIN","ETCL_FIRST", +"ETCL_RANDOM","ETCL_DOLLAR","ETCL_DOT","ETCL_DISCRIMINANT","ETCL_LENGTH", +"ETCL_TYPE_ID","ETCL_REPOS_ID","constraint","preference","bool_or","bool_and", +"bool_compare","expr_in","expr_twiddle","expr","term","factor_not","factor", +"component","component_ext","component_dot","component_array","component_assoc", +"component_pos","union_pos","union_val", 0 +}; +#endif + +static const short yyr1[] = { 0, + 46, 46, 47, 47, 47, 47, 47, 48, 48, 49, + 49, 50, 50, 50, 50, 50, 50, 50, 51, 51, + 51, 52, 52, 53, 53, 53, 54, 54, 54, 55, + 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, + 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, + 59, 60, 61, 62, 63, 64, 64, 64, 64, 64 +}; + +static const short yyr2[] = { 0, + 1, 1, 2, 2, 2, 1, 1, 3, 1, 3, + 1, 3, 3, 3, 3, 3, 3, 1, 3, 4, + 1, 3, 1, 3, 3, 1, 3, 3, 1, 2, + 1, 3, 1, 2, 2, 1, 2, 2, 1, 1, + 2, 3, 3, 2, 1, 0, 2, 2, 1, 1, + 0, 2, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 4, 4, 2, 4, 0, 1, 2, 2, 1 +}; + +static const short yydefact[] = { 0, + 0, 0, 0, 40, 0, 0, 33, 36, 39, 0, + 45, 0, 0, 0, 6, 7, 46, 2, 1, 9, + 11, 18, 21, 23, 26, 29, 31, 41, 46, 46, + 30, 34, 37, 35, 38, 0, 5, 4, 3, 0, + 0, 51, 0, 44, 49, 50, 0, 0, 0, 0, + 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, + 42, 43, 32, 0, 0, 0, 48, 53, 54, 51, + 66, 51, 57, 56, 58, 59, 47, 60, 61, 8, + 10, 14, 15, 16, 17, 12, 13, 46, 19, 22, + 24, 25, 27, 28, 51, 51, 52, 64, 0, 0, + 67, 70, 0, 55, 20, 63, 62, 68, 69, 51, + 65, 0, 0, 0 +}; + +static const short yydefgoto[] = { 112, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 44, 67, 77, 68, 69, 78, 79, 103 +}; + +static const short yypact[] = { 41, + -13, -39, 94,-32768, 38, 46,-32768,-32768,-32768, 73, +-32768, 73, 73, 73,-32768,-32768, -9,-32768, -6, 7, +-32768, 121, -5, 19, 55,-32768,-32768,-32768, -9, -9, +-32768,-32768,-32768,-32768,-32768, 21, -6, -6, -6, 6, + 25, -2, -1,-32768,-32768,-32768, 73, 73, 73, 73, + 73, 73, 73, 73, -18, 73, 73, 73, 73, 73, +-32768,-32768,-32768, 27, 29, -1,-32768,-32768,-32768, -2, + 31, -2,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 7, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, -9,-32768, 67, + 55, 55,-32768,-32768, -2, -2,-32768,-32768, 44, 50, +-32768,-32768, 69,-32768,-32768,-32768,-32768,-32768,-32768, -2, +-32768, 98, 100,-32768 +}; + +static const short yypgoto[] = {-32768, +-32768, 95, 54, 58, 86,-32768, 59, 30, 33, 111, + -26, -65, 53, -17, -15,-32768,-32768,-32768 +}; + + +#define YYLAST 140 + + +static const short yytable[] = { 45, + 30, 46, 61, 62, 98, 47, 104, 40, 55, 41, + 42, 45, 45, 46, 46, 28, 40, 48, 41, 42, + 70, 88, 43, 40, 71, 41, 29, 72, 89, 106, + 107, 43, 47, 56, 64, 57, 58, 45, 66, 46, + 73, 74, 75, 76, 111, 63, 65, 99, 100, 1, + 2, 95, 101, 3, 102, 96, 4, 5, 6, 32, + 33, 105, 7, 8, 9, 108, 10, 34, 35, 11, + 45, 109, 46, 59, 60, 12, 13, 14, 15, 16, + 17, 1, 2, 57, 58, 3, 91, 92, 4, 5, + 6, 93, 94, 110, 7, 8, 9, 113, 10, 114, + 80, 11, 1, 2, 36, 81, 37, 38, 39, 4, + 5, 6, 17, 31, 90, 7, 8, 9, 97, 10, + 0, 0, 11, 49, 50, 51, 52, 53, 54, 0, + 0, 0, 0, 17, 82, 83, 84, 85, 86, 87 +}; + +static const short yycheck[] = { 17, + 40, 17, 29, 30, 70, 12, 72, 26, 14, 28, + 29, 29, 30, 29, 30, 29, 26, 11, 28, 29, + 22, 40, 41, 26, 26, 28, 40, 29, 55, 95, + 96, 41, 12, 15, 29, 17, 18, 55, 41, 55, + 42, 43, 44, 45, 110, 25, 22, 17, 18, 9, + 10, 25, 22, 13, 24, 27, 16, 17, 18, 22, + 23, 88, 22, 23, 24, 22, 26, 22, 23, 29, + 88, 22, 88, 19, 20, 35, 36, 37, 38, 39, + 40, 9, 10, 17, 18, 13, 57, 58, 16, 17, + 18, 59, 60, 25, 22, 23, 24, 0, 26, 0, + 47, 29, 9, 10, 10, 48, 12, 13, 14, 16, + 17, 18, 40, 3, 56, 22, 23, 24, 66, 26, + -1, -1, 29, 3, 4, 5, 6, 7, 8, -1, + -1, -1, -1, 40, 49, 50, 51, 52, 53, 54 +}; +/* -*-C-*- Note some compilers choke on comments on `//#line' lines. */ +//#line 3 "/pkg/gnu/share/bison.simple" +/* This file comes from bison-1.28. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include <alloca.h> +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include <malloc.h> +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ +YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +//#line 217 "/pkg/gnu/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + ACE_OS::free (yyss); + ACE_OS::free (yyvs); +#ifdef YYLSP_NEEDED + ACE_OS::free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + ACE_OS::fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + ACE_OS::fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + ACE_OS::fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + ACE_OS::fprintf (stderr, "%s ", yytname[yyrhs[i]]); + ACE_OS::fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 3: +//#line 97 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Preference (ETCL_MIN, yyvsp[0].constraint); ; + break;} +case 4: +//#line 99 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Preference (ETCL_MAX, yyvsp[0].constraint); ; + break;} +case 5: +//#line 101 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Preference (ETCL_WITH, yyvsp[0].constraint); ; + break;} +case 6: +//#line 103 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Preference (ETCL_FIRST); ; + break;} +case 7: +//#line 105 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Preference (ETCL_RANDOM); ; + break;} +case 8: +//#line 109 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_OR, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 10: +//#line 114 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_AND, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 12: +//#line 119 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_EQ, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 13: +//#line 121 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_NE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 14: +//#line 123 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_GT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 15: +//#line 125 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_GE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 16: +//#line 127 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_LT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 17: +//#line 129 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_LE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 19: +//#line 134 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_IN, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 20: +//#line 136 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_IN, yyvsp[-3].constraint, yyvsp[0].constraint); ; + break;} +case 22: +//#line 141 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_TWIDDLE, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 24: +//#line 146 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_PLUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 25: +//#line 148 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_MINUS, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 27: +//#line 153 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_MULT, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 28: +//#line 155 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Binary_Expr (ETCL_DIV, yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 30: +//#line 160 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Unary_Expr (ETCL_NOT, yyvsp[0].constraint); ; + break;} +case 32: +//#line 165 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[-1].constraint; ; + break;} +case 33: +//#line 167 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 34: +//#line 169 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Unary_Expr (ETCL_PLUS, yyvsp[0].constraint); ; + break;} +case 35: +//#line 171 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Unary_Expr (ETCL_MINUS, yyvsp[0].constraint); ; + break;} +case 36: +//#line 173 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 37: +//#line 175 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Unary_Expr (ETCL_PLUS, yyvsp[0].constraint); ; + break;} +case 38: +//#line 177 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Unary_Expr (ETCL_MINUS, yyvsp[0].constraint); ; + break;} +case 39: +//#line 179 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 40: +//#line 181 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 41: +//#line 183 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Exist (yyvsp[0].constraint); ; + break;} +case 42: +//#line 185 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Exist (yyvsp[0].constraint); ; + break;} +case 43: +//#line 187 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Default (yyvsp[0].constraint); ; + break;} +case 44: +//#line 189 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Eval (yyvsp[0].constraint); ; + break;} +case 45: +//#line 191 "ETCL/ETCL.yy" +{ yyval.constraint = yyvsp[0].constraint; ; + break;} +case 46: +//#line 195 "ETCL/ETCL.yy" +{ yyval.constraint = 0; ; + break;} +case 47: +//#line 197 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Dot (yyvsp[0].constraint); ; + break;} +case 48: +//#line 200 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 51: +//#line 207 "ETCL/ETCL.yy" +{ yyval.constraint = 0; ; + break;} +case 52: +//#line 209 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Dot (yyvsp[0].constraint); ; + break;} +case 55: +//#line 216 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Component (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 56: +//#line 218 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Special (ETCL_LENGTH); ; + break;} +case 57: +//#line 220 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Special (ETCL_DISCRIMINANT); ; + break;} +case 58: +//#line 222 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Special (ETCL_TYPE_ID); ; + break;} +case 59: +//#line 224 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Special (ETCL_REPOS_ID); ; + break;} +case 62: +//#line 230 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Component_Array (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 63: +//#line 234 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Component_Assoc (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 64: +//#line 238 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Component_Pos (yyvsp[-1].constraint, yyvsp[0].constraint); ; + break;} +case 65: +//#line 242 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Union_Pos (yyvsp[-2].constraint, yyvsp[0].constraint); ; + break;} +case 66: +//#line 246 "ETCL/ETCL.yy" +{ yyval.constraint = 0; ; + break;} +case 67: +//#line 248 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Union_Value (+1, yyvsp[0].constraint); ; + break;} +case 68: +//#line 250 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Union_Value (+1, yyvsp[0].constraint); ; + break;} +case 69: +//#line 252 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Union_Value (-1, yyvsp[0].constraint); ; + break;} +case 70: +//#line 254 "ETCL/ETCL.yy" +{ yyval.constraint = new ETCL_Union_Value (yyvsp[0].constraint); ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +//#line 543 "/pkg/gnu/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + ACE_OS::fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + ACE_OS::fprintf (stderr, " %d", *++ssp1); + ACE_OS::fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += ACE_OS::strlen(yytname[x]) + 15, count++; + msg = (char *) ACE_OS::malloc(size + 15); + if (msg != 0) + { + ACE_OS::strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + ACE_OS::strcat(msg, count == 0 ? ", expecting `" : " or `"); + ACE_OS::strcat(msg, yytname[x]); + ACE_OS::strcat(msg, "'"); + count++; + } + } + yyerror(msg); + ACE_OS::free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + ACE_OS::fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + ACE_OS::fprintf (stderr, " %d", *++ssp1); + ACE_OS::fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + ACE_OS::fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + ACE_OS::free (yyss); + ACE_OS::free (yyvs); +#ifdef YYLSP_NEEDED + ACE_OS::free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + + /* Flush out yy_current_buffer before next parse. Since there is + no error recovery, the buffer could still contain tokens from this + parse. */ + yyflush_current_buffer(); + + if (yyfree_stacks) + { + ACE_OS::free (yyss); + ACE_OS::free (yyvs); +#ifdef YYLSP_NEEDED + ACE_OS::free (yyls); +#endif + } + return 1; +} +//#line 257 "ETCL/ETCL.yy" + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/ETCL/ETCL_y.h b/dep/acelite/ace/ETCL/ETCL_y.h new file mode 100644 index 00000000000..577296e9ee2 --- /dev/null +++ b/dep/acelite/ace/ETCL/ETCL_y.h @@ -0,0 +1,45 @@ +// $Id: ETCL_y.h 81458 2008-04-28 11:31:49Z johnnyw $ +#define ETCL_GT 257 +#define ETCL_GE 258 +#define ETCL_LT 259 +#define ETCL_LE 260 +#define ETCL_EQ 261 +#define ETCL_NE 262 +#define ETCL_EXIST 263 +#define ETCL_DEFAULT 264 +#define ETCL_AND 265 +#define ETCL_OR 266 +#define ETCL_NOT 267 +#define ETCL_IN 268 +#define ETCL_TWIDDLE 269 +#define ETCL_BOOLEAN 270 +#define ETCL_PLUS 271 +#define ETCL_MINUS 272 +#define ETCL_MULT 273 +#define ETCL_DIV 274 +#define ETCL_UMINUS 275 +#define ETCL_INTEGER 276 +#define ETCL_FLOAT 277 +#define ETCL_STRING 278 +#define ETCL_RPAREN 279 +#define ETCL_LPAREN 280 +#define ETCL_RBRA 281 +#define ETCL_LBRA 282 +#define ETCL_IDENT 283 +#define ETCL_UNSIGNED 284 +#define ETCL_SIGNED 285 +#define ETCL_DOUBLE 286 +#define ETCL_CONSTRAINT 287 +#define ETCL_COMPONENT 288 +#define ETCL_WITH 289 +#define ETCL_MAX 290 +#define ETCL_MIN 291 +#define ETCL_FIRST 292 +#define ETCL_RANDOM 293 +#define ETCL_DOLLAR 294 +#define ETCL_DOT 295 +#define ETCL_DISCRIMINANT 296 +#define ETCL_LENGTH 297 +#define ETCL_TYPE_ID 298 +#define ETCL_REPOS_ID 299 + diff --git a/dep/acelite/ace/ETCL/ace_etcl_export.h b/dep/acelite/ace/ETCL/ace_etcl_export.h new file mode 100644 index 00000000000..561d99f85be --- /dev/null +++ b/dep/acelite/ace/ETCL/ace_etcl_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id: ace_etcl_export.h 81458 2008-04-28 11:31:49Z johnnyw $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef ACE_ETCL_EXPORT_H +#define ACE_ETCL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) +# if !defined (ACE_ETCL_HAS_DLL) +# define ACE_ETCL_HAS_DLL 0 +# endif /* ! ACE_ETCL_HAS_DLL */ +#else +# if !defined (ACE_ETCL_HAS_DLL) +# define ACE_ETCL_HAS_DLL 1 +# endif /* ! ACE_ETCL_HAS_DLL */ +#endif + +#if defined (ACE_ETCL_HAS_DLL) && (ACE_ETCL_HAS_DLL == 1) +# if defined (ACE_ETCL_BUILD_DLL) +# define ACE_ETCL_Export ACE_Proper_Export_Flag +# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_ETCL_BUILD_DLL */ +# define ACE_ETCL_Export ACE_Proper_Import_Flag +# define ACE_ETCL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_ETCL_BUILD_DLL */ +#else /* ACE_ETCL_HAS_DLL == 1 */ +# define ACE_ETCL_Export +# define ACE_ETCL_SINGLETON_DECLARATION(T) +# define ACE_ETCL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_ETCL_HAS_DLL == 1 */ + +#endif /* ACE_ETCL_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/ETCL/etcl_parser_export.h b/dep/acelite/ace/ETCL/etcl_parser_export.h new file mode 100644 index 00000000000..678d25b466a --- /dev/null +++ b/dep/acelite/ace/ETCL/etcl_parser_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id: etcl_parser_export.h 81640 2008-05-07 19:04:11Z parsons $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef ETCL_PARSER_EXPORT_H +#define ETCL_PARSER_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) +# if !defined (ETCL_PARSER_HAS_DLL) +# define ETCL_PARSER_HAS_DLL 0 +# endif /* ! ETCL_PARSER_HAS_DLL */ +#else +# if !defined (ETCL_PARSER_HAS_DLL) +# define ETCL_PARSER_HAS_DLL 1 +# endif /* ! ETCL_PARSER_HAS_DLL */ +#endif + +#if defined (ETCL_PARSER_HAS_DLL) && (ETCL_PARSER_HAS_DLL == 1) +# if defined (ETCL_PARSER_BUILD_DLL) +# define ETCL_Parser_Export ACE_Proper_Export_Flag +# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ETCL_PARSER_BUILD_DLL */ +# define ETCL_Parser_Export ACE_Proper_Import_Flag +# define ETCL_PARSER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ETCL_PARSER_BUILD_DLL */ +#else /* ETCL_PARSER_HAS_DLL == 1 */ +# define ETCL_Parser_Export +# define ETCL_PARSER_SINGLETON_DECLARATION(T) +# define ETCL_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ETCL_PARSER_HAS_DLL == 1 */ + +#endif /* ETCL_PARSER_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/Env_Value_T.h b/dep/acelite/ace/Env_Value_T.h index c8b459b26c2..412baf935ed 100644 --- a/dep/acelite/ace/Env_Value_T.h +++ b/dep/acelite/ace/Env_Value_T.h @@ -4,7 +4,7 @@ /** * @file Env_Value_T.h * - * $Id: Env_Value_T.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Env_Value_T.h 92712 2010-11-25 12:22:13Z johnnyw $ * * Template to encapsulate getting a value from an environment variable * and using a supplied default value if not in the environment. @@ -45,7 +45,7 @@ public: /** * Default constructor which isn't bound to a specific environment * variable name or a default value. Before being useful it must - * <open>'d. + * open()'d. */ ACE_Env_Value (void); diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp new file mode 100644 index 00000000000..b16679a11ec --- /dev/null +++ b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.cpp @@ -0,0 +1,99 @@ +// $Id: Event_Handler_Handle_Timeout_Upcall.cpp 95586 2012-03-03 20:45:57Z johnnyw $ + +#include "ace/Event_Handler_Handle_Timeout_Upcall.h" +#include "ace/Reactor_Timer_Interface.h" +#include "ace/Abstract_Timer_Queue.h" + +#if !defined(__ACE_INLINE__) +# include "ace/Event_Handler_Handle_Timeout_Upcall.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Event_Handler_Handle_Timeout_Upcall:: +ACE_Event_Handler_Handle_Timeout_Upcall (void) : + requires_reference_counting_ (0) +{ +} + +ACE_Event_Handler_Handle_Timeout_Upcall:: +~ACE_Event_Handler_Handle_Timeout_Upcall (void) +{ +} + +int +ACE_Event_Handler_Handle_Timeout_Upcall:: +timeout (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *event_handler, + const void *act, + int recurring_timer, + const ACE_Time_Value &cur_time) +{ + int requires_reference_counting = 0; + + if (!recurring_timer) + { + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + } + + // Upcall to the <handler>s handle_timeout method. + if (event_handler->handle_timeout (cur_time, act) == -1) + { + if (event_handler->reactor_timer_interface ()) + event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); + else + timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". + } + + if (!recurring_timer && + requires_reference_counting) + { + event_handler->remove_reference (); + } + + return 0; +} + +int +ACE_Event_Handler_Handle_Timeout_Upcall:: +cancel_type (ACE_Timer_Queue &, + ACE_Event_Handler *event_handler, + int dont_call, + int &requires_reference_counting) +{ + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Upcall to the <handler>s handle_close method + if (dont_call == 0) + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::TIMER_MASK); + + return 0; +} + +int +ACE_Event_Handler_Handle_Timeout_Upcall:: +deletion (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *event_handler, + const void *) +{ + int requires_reference_counting = 0; + + this->cancel_type (timer_queue, + event_handler, + 0, + requires_reference_counting); + + this->cancel_timer (timer_queue, + event_handler, + 0, + requires_reference_counting); + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h new file mode 100644 index 00000000000..0ce4a4dd9ca --- /dev/null +++ b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.h @@ -0,0 +1,103 @@ +//$Id: Event_Handler_Handle_Timeout_Upcall.h 95334 2011-12-15 12:52:50Z msmit $ + +#ifndef ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H +#define ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H + +#include /**/ "ace/pre.h" + +/** + * @file Event_Handler_Handle_Timeout_Upcall.h + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * + * Based on classes and files developed by Doug Schmidt, Darrell + * Brunsch, Irfan Pyarali and a cast of thousands. + */ + +#include "ace/Timer_Queuefwd.h" +#include "ace/Copy_Disabled.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; + +/** + * @class ACE_Event_Handler_Handle_Timeout_Upcall + * + * @brief Functor for Timer_Queues. + * + * This class implements the functor required by the Timer + * Queue to call <handle_timeout> on ACE_Event_Handlers. + */ +class ACE_Export ACE_Event_Handler_Handle_Timeout_Upcall + : private ACE_Copy_Disabled +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Event_Handler_Handle_Timeout_Upcall (void); + + /// Destructor. + ~ACE_Event_Handler_Handle_Timeout_Upcall (void); + + /// This method is called when a timer is registered. + int registration (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method is called when the timer expires. + int timeout (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time); + + /// This method is called after the timer expires. + int postinvoke (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is cancelled + int cancel_type (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int &requires_reference_counting); + + /// This method is called when a timer is cancelled + int cancel_timer (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int requires_reference_counting); + + /// This method is called when the timer queue is destroyed and + /// the timer is still contained in it + int deletion (ACE_Timer_Queue &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + +private: + + /// Flag indicating that reference counting is required for this + /// event handler upcall. + int requires_reference_counting_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined(__ACE_INLINE__) +# include "ace/Event_Handler_Handle_Timeout_Upcall.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_EVENT_HANDLER_HANDLE_TIMEOUT_UPCALL_H */ diff --git a/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl new file mode 100644 index 00000000000..f52a7206c47 --- /dev/null +++ b/dep/acelite/ace/Event_Handler_Handle_Timeout_Upcall.inl @@ -0,0 +1,71 @@ +// $Id: Event_Handler_Handle_Timeout_Upcall.inl 95336 2011-12-15 13:22:33Z msmit $ + +#include "ace/Event_Handler.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE int +ACE_Event_Handler_Handle_Timeout_Upcall:: +registration (ACE_Timer_Queue &, + ACE_Event_Handler *event_handler, + const void *) +{ + event_handler->add_reference (); + return 0; +} + +ACE_INLINE int +ACE_Event_Handler_Handle_Timeout_Upcall:: +preinvoke (ACE_Timer_Queue &, + ACE_Event_Handler *event_handler, + const void *, + int, + const ACE_Time_Value &, + const void * & upcall_act) +{ + bool const requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + + upcall_act = &this->requires_reference_counting_; + } + + return 0; +} + +ACE_INLINE int +ACE_Event_Handler_Handle_Timeout_Upcall:: +postinvoke (ACE_Timer_Queue & /* timer_queue */, + ACE_Event_Handler *event_handler, + const void * /* timer_act */, + int /* recurring_timer */, + const ACE_Time_Value & /* cur_time */, + const void *upcall_act) +{ + if (upcall_act == &this->requires_reference_counting_) + { + event_handler->remove_reference (); + } + + return 0; +} + +ACE_INLINE int +ACE_Event_Handler_Handle_Timeout_Upcall:: +cancel_timer (ACE_Timer_Queue &, + ACE_Event_Handler *event_handler, + int, + int requires_reference_counting) +{ + if (requires_reference_counting) + event_handler->remove_reference (); + + return 0; +} + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FIFO.cpp b/dep/acelite/ace/FIFO.cpp index b564a26c6b6..a4d7ba1d0b9 100644 --- a/dep/acelite/ace/FIFO.cpp +++ b/dep/acelite/ace/FIFO.cpp @@ -1,4 +1,4 @@ -// $Id: FIFO.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: FIFO.cpp 94034 2011-05-09 19:11:03Z johnnyw $ #include "ace/FIFO.h" @@ -12,8 +12,6 @@ #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_fcntl.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_FIFO) diff --git a/dep/acelite/ace/FIFO_Recv_Msg.cpp b/dep/acelite/ace/FIFO_Recv_Msg.cpp index b8580ae317c..9d041d558cc 100644 --- a/dep/acelite/ace/FIFO_Recv_Msg.cpp +++ b/dep/acelite/ace/FIFO_Recv_Msg.cpp @@ -1,4 +1,4 @@ -// $Id: FIFO_Recv_Msg.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: FIFO_Recv_Msg.cpp 93359 2011-02-11 11:33:12Z mcorino $ #include "ace/FIFO_Recv_Msg.h" @@ -8,8 +8,6 @@ #include "ace/FIFO_Recv_Msg.inl" #endif /* __ACE_INLINE__ */ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) diff --git a/dep/acelite/ace/Filecache.cpp b/dep/acelite/ace/Filecache.cpp index 7a9615bb59d..65e548c75ec 100644 --- a/dep/acelite/ace/Filecache.cpp +++ b/dep/acelite/ace/Filecache.cpp @@ -1,4 +1,4 @@ -// $Id: Filecache.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Filecache.cpp 94034 2011-05-09 19:11:03Z johnnyw $ #include "ace/Filecache.h" #include "ace/Object_Manager.h" @@ -164,6 +164,7 @@ template <> ACE_Filecache_Hash_Entry::ACE_Hash_Map_Entry (ACE_Filecache_Hash_Entry *next, ACE_Filecache_Hash_Entry *prev) : ext_id_ (0), + int_id_ (0), next_ (next), prev_ (prev) { diff --git a/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h b/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h new file mode 100644 index 00000000000..282adb6494d --- /dev/null +++ b/dep/acelite/ace/FlReactor/ACE_FlReactor_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_FlReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s ACE_FlReactor +// ------------------------------ +#ifndef ACE_FLREACTOR_EXPORT_H +#define ACE_FLREACTOR_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_FLREACTOR_HAS_DLL) +# define ACE_FLREACTOR_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_FLREACTOR_HAS_DLL */ + +#if !defined (ACE_FLREACTOR_HAS_DLL) +# define ACE_FLREACTOR_HAS_DLL 1 +#endif /* ! ACE_FLREACTOR_HAS_DLL */ + +#if defined (ACE_FLREACTOR_HAS_DLL) && (ACE_FLREACTOR_HAS_DLL == 1) +# if defined (ACE_FLREACTOR_BUILD_DLL) +# define ACE_FlReactor_Export ACE_Proper_Export_Flag +# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_FLREACTOR_BUILD_DLL */ +# define ACE_FlReactor_Export ACE_Proper_Import_Flag +# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_FLREACTOR_BUILD_DLL */ +#else /* ACE_FLREACTOR_HAS_DLL == 1 */ +# define ACE_FlReactor_Export +# define ACE_FLREACTOR_SINGLETON_DECLARATION(T) +# define ACE_FLREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_FLREACTOR_HAS_DLL == 1 */ + +// Set ACE_FLREACTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_FLREACTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_FLREACTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_FLREACTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_FLREACTOR_NTRACE */ + +#if (ACE_FLREACTOR_NTRACE == 1) +# define ACE_FLREACTOR_TRACE(X) +#else /* (ACE_FLREACTOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_FLREACTOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_FLREACTOR_NTRACE == 1) */ + +#endif /* ACE_FLREACTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/FlReactor/FlReactor.cpp b/dep/acelite/ace/FlReactor/FlReactor.cpp new file mode 100644 index 00000000000..4cab9c9df78 --- /dev/null +++ b/dep/acelite/ace/FlReactor/FlReactor.cpp @@ -0,0 +1,328 @@ +// $Id: FlReactor.cpp 95511 2012-01-27 09:40:38Z johnnyw $ + +#include "ace/FlReactor/FlReactor.h" + +#include /**/ <FL/Fl.H> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_FlReactor) + +// Must be called with lock held +ACE_FlReactor::ACE_FlReactor (size_t size, + bool restart, + ACE_Sig_Handler *h) + : ACE_Select_Reactor (size, restart, h) +{ + // When the ACE_Select_Reactor is constructed it creates the notify + // pipe and registers it with the register_handler_i() method. The + // FlReactor overloads this method BUT because the + // register_handler_i occurs when constructing the base class + // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() + // is called not the FlReactor register_handler_i(). This means + // that the notify pipe is registered with the ACE_Select_Reactor + // event handling code not the FlReactor and so notfications don't + // work. To get around this we simply close and re-opened the + // notification handler in the constructor of the FlReactor. + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->notify_handler_->close (); + this->notify_handler_->open (this, 0); +#endif /* ACE_MT_SAFE */ +} + +ACE_FlReactor::~ACE_FlReactor (void) +{ +} + +// This is just the <wait_for_multiple_events> from ace/Reactor.cpp +// but we use the Fl functions to wait for an event, not <select> + +int +ACE_FlReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_FlReactor::wait_for_multiple_events"); + int nfound; + + do + { + max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); + + size_t width = this->handler_rep_.max_handlep1 (); + handle_set.rd_mask_ = this->wait_set_.rd_mask_; + handle_set.wr_mask_ = this->wait_set_.wr_mask_; + handle_set.ex_mask_ = this->wait_set_.ex_mask_; + + // Check to make sure our handle's are all usable. + ACE_Select_Reactor_Handle_Set temp_set = handle_set; + + ACE_Time_Value zero = ACE_Time_Value::zero; + if (ACE_OS::select (width, + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + &zero) == -1) + return -1; // Bad file arguments... + + // Instead of waiting using <select>, just use the Fl mechanism + // to wait for one or more events... + + // Wait for something to happen. + double t = 0; + if (max_wait_time != 0) + t = max_wait_time->sec () + max_wait_time->usec () / 1000000.0F; + + while (t > 0) { + t = Fl::wait (t); + } + + // Reset the width, in case it changed during the upcalls. + width = this->handler_rep_.max_handlep1 (); + + // Now actually read the result needed by the <Select_Reactor> + // using <select>. + zero = ACE_Time_Value::zero; + nfound = ACE_OS::select (width, + handle_set.rd_mask_, + handle_set.wr_mask_, + handle_set.ex_mask_, + &zero); + + } while (nfound == -1 && this->handle_error () > 0); + + if (nfound > 0) + { +#if !defined (ACE_WIN32) + handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + return nfound; // Timed out or input available +} + +void +ACE_FlReactor::fl_io_proc (int fd, void* reactor) +{ + ACE_FlReactor *self = static_cast<ACE_FlReactor *> (reactor); + ACE_HANDLE handle = (ACE_HANDLE)fd; //reinterpret_cast<ACE_HANDLE> (fd); + + // my copy isn't const. + ACE_Time_Value zero = ACE_Time_Value::zero; + + ACE_Select_Reactor_Handle_Set wait_set; + + // Deal with one file event. + + // - read which kind of event + if (self->wait_set_.rd_mask_.is_set (handle)) + wait_set.rd_mask_.set_bit (handle); + if (self->wait_set_.wr_mask_.is_set (handle)) + wait_set.wr_mask_.set_bit (handle); + if (self->wait_set_.ex_mask_.is_set (handle)) + wait_set.ex_mask_.set_bit (handle); + + int result = ACE_OS::select (fd + 1, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); + + ACE_Select_Reactor_Handle_Set dispatch_set; + + // - Use only that one file event (removes events for other files). + if (result > 0) + { + if (wait_set.rd_mask_.is_set (handle)) + dispatch_set.rd_mask_.set_bit (handle); + if (wait_set.wr_mask_.is_set (handle)) + dispatch_set.wr_mask_.set_bit (handle); + if (wait_set.ex_mask_.is_set (handle)) + dispatch_set.ex_mask_.set_bit (handle); + + self->dispatch (1, dispatch_set); + } +} + +void +ACE_FlReactor::fl_timeout_proc (void* reactor) +{ + ACE_FlReactor *self = static_cast<ACE_FlReactor *> (reactor); + + // Deal with any timer events + ACE_Select_Reactor_Handle_Set handle_set; + self->dispatch (0, handle_set); + self->reset_timeout (); +} + + +int +ACE_FlReactor::register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_FlReactor::register_handler_i"); + + int result = ACE_Select_Reactor::register_handler_i (handle, + handler, mask); + if (result == -1) + return -1; + + int condition = 0; + + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, FL_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, FL_WRITE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, FL_EXCEPT); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (condition, FL_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) + { + ACE_SET_BITS (condition, FL_WRITE); // connected, you may write + ACE_SET_BITS (condition, FL_READ); // connected, you have data/err + } + + if (condition != 0) + { + Fl::add_fd ((int)handle, // reinterpret_cast<int> (handle), + ACE_FlReactor::fl_io_proc, + this); + } + return 0; +} + +int +ACE_FlReactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::register_handler_i (handles, + handler, + mask); +} + +int +ACE_FlReactor::remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_FlReactor::remove_handler_i"); + + // In the registration phase we registered first with + // ACE_Select_Reactor and then with X. Now we are now doing things + // in reverse order. + + // First clean up the corresponding X11Input. + Fl::remove_fd ((int)handle); // reinterpret_cast<int> (handle); + + // Now let the reactor do its work. + return ACE_Select_Reactor::remove_handler_i (handle, + mask); +} + +int +ACE_FlReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, + mask); +} + +// The following function ensures there's an Fl timeout for the first +// timeout in the Reactor's Timer_Queue. + +void +ACE_FlReactor::reset_timeout (void) +{ + ACE_Time_Value *max_wait_time = + this->timer_queue_->calculate_timeout (0); + + if (max_wait_time != 0) + { + float t = max_wait_time->sec () + + max_wait_time->usec () / 1000000.0F; + Fl::add_timeout (t, + ACE_FlReactor::fl_timeout_proc, + this); + } +} + +int +ACE_FlReactor::reset_timer_interval + (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_FlReactor::reset_timer_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + int const result = + ACE_Select_Reactor::reset_timer_interval (timer_id, + interval); + + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +long +ACE_FlReactor::schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_FlReactor::schedule_timer"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + long result = ACE_Select_Reactor::schedule_timer (event_handler, + arg, + delay, + interval); + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +int +ACE_FlReactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_FlReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (handler, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +int +ACE_FlReactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_FlReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (timer_id, + arg, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/FlReactor/FlReactor.h b/dep/acelite/ace/FlReactor/FlReactor.h new file mode 100644 index 00000000000..6f67de88cb1 --- /dev/null +++ b/dep/acelite/ace/FlReactor/FlReactor.h @@ -0,0 +1,110 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file FlReactor.h + * + * $Id: FlReactor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Carlos O'Ryan <coryan@cs.wustl.edu> + * @author Based in part in the ACE_XtReactor implementation by + * @author Eric C. Newton's <ecn@clark.net> + * @author Kirill Rybaltchenko <Kirill.Rybaltchenko@cern.ch> + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACE_FLREACTOR_H +#define ACE_FLREACTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/FlReactor/ACE_FlReactor_export.h" +#include "ace/Select_Reactor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_FlReactor + * + * @brief A Reactor implementation that uses the Fast-Light (FL) toolkit + * for event demultiplexing. This will let us integrate the FL + * toolkit with ACE and/or TAO. + * + * As many other GUI toolkits FL supports a minimal set of + * callbacks to handle event demultiplexing, namely simple methods + * to add file descriptors to the event demuxing set or timeout + * events. This class adapts this simple mechanisms so they are + * compatible with ACE's Reactor. + */ +class ACE_FlReactor_Export ACE_FlReactor : public ACE_Select_Reactor +{ + +public: + // = Initialization and termination methods. + ACE_FlReactor (size_t size = DEFAULT_SIZE, + bool restart = false, + ACE_Sig_Handler * = 0); + virtual ~ACE_FlReactor (void); + + // = Timer operations. + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval); + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + virtual int cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close = 1); + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + +protected: + // = Register timers/handles with Fl. + /// Register a single @a handler. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Register a set of <handlers>. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Remove the <handler> associated with this @a handle. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Remove a set of <handles>. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + +private: + /// This method ensures there's an Fl timeout for the first timeout + /// in the Reactor's Timer_Queue. + void reset_timeout (void); + + // = Integrate with the FL callback function mechanism. + static void fl_io_proc (int fd, void*); + static void fl_timeout_proc (void*); + + /// Deny access since member-wise won't work... + ACE_FlReactor (const ACE_FlReactor &); + ACE_FlReactor &operator = (const ACE_FlReactor &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_FLREACTOR_H */ diff --git a/dep/acelite/ace/FoxReactor/ACE_FoxReactor_export.h b/dep/acelite/ace/FoxReactor/ACE_FoxReactor_export.h new file mode 100644 index 00000000000..641be964c46 --- /dev/null +++ b/dep/acelite/ace/FoxReactor/ACE_FoxReactor_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_FoxReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s ACE_FoxReactor +// ------------------------------ +#ifndef ACE_FOXREACTOR_EXPORT_H +#define ACE_FOXREACTOR_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_FOXREACTOR_HAS_DLL) +# define ACE_FOXREACTOR_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_FOXREACTOR_HAS_DLL */ + +#if !defined (ACE_FOXREACTOR_HAS_DLL) +# define ACE_FOXREACTOR_HAS_DLL 1 +#endif /* ! ACE_FOXREACTOR_HAS_DLL */ + +#if defined (ACE_FOXREACTOR_HAS_DLL) && (ACE_FOXREACTOR_HAS_DLL == 1) +# if defined (ACE_FOXREACTOR_BUILD_DLL) +# define ACE_FoxReactor_Export ACE_Proper_Export_Flag +# define ACE_FOXREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_FOXREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_FOXREACTOR_BUILD_DLL */ +# define ACE_FoxReactor_Export ACE_Proper_Import_Flag +# define ACE_FOXREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_FOXREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_FOXREACTOR_BUILD_DLL */ +#else /* ACE_FOXREACTOR_HAS_DLL == 1 */ +# define ACE_FoxReactor_Export +# define ACE_FOXREACTOR_SINGLETON_DECLARATION(T) +# define ACE_FOXREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_FOXREACTOR_HAS_DLL == 1 */ + +// Set ACE_FOXREACTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_FOXREACTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_FOXREACTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_FOXREACTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_FOXREACTOR_NTRACE */ + +#if (ACE_FOXREACTOR_NTRACE == 1) +# define ACE_FOXREACTOR_TRACE(X) +#else /* (ACE_FOXREACTOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_FOXREACTOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_FOXREACTOR_NTRACE == 1) */ + +#endif /* ACE_FOXREACTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/FoxReactor/FoxReactor.cpp b/dep/acelite/ace/FoxReactor/FoxReactor.cpp new file mode 100644 index 00000000000..61b59a16c71 --- /dev/null +++ b/dep/acelite/ace/FoxReactor/FoxReactor.cpp @@ -0,0 +1,327 @@ +// $Id: FoxReactor.cpp 93117 2011-01-20 12:11:28Z mcorino $ + +#include "ace/FoxReactor/FoxReactor.h" + +FXDEFMAP(ACE_FoxReactor) ACE_FoxReactorMap[]={ + FXMAPFUNCS(SEL_IO_READ,0,MAXKEY,ACE_FoxReactor::onFileEvents), + FXMAPFUNCS(SEL_IO_WRITE,0,MAXKEY,ACE_FoxReactor::onFileEvents), + FXMAPFUNCS(SEL_IO_EXCEPT,0,MAXKEY,ACE_FoxReactor::onFileEvents), + FXMAPFUNCS(SEL_TIMEOUT,0,MAXKEY,ACE_FoxReactor::onTimerEvents), +}; + +FXIMPLEMENT(ACE_FoxReactor,FXObject,ACE_FoxReactorMap,ARRAYNUMBER(ACE_FoxReactorMap)) + +ACE_ALLOC_HOOK_DEFINE (ACE_FoxReactor) + +// Must be called with lock held +ACE_FoxReactor::ACE_FoxReactor (FXApp* a, + size_t size, + bool restart, + ACE_Sig_Handler *h) + : ACE_Select_Reactor (size, restart, h), fxapp(a) +{ + // When the ACE_Select_Reactor is constructed it creates the notify + // pipe and registers it with the register_handler_i() method. The + // FoxReactor overloads this method BUT because the + // register_handler_i occurs when constructing the base class + // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() + // is called not the FoxReactor register_handler_i(). This means + // that the notify pipe is registered with the ACE_Select_Reactor + // event handling code not the FoxReactor and so notfications don't + // work. To get around this we simply close and re-opened the + // notification handler in the constructor of the FoxReactor. + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->notify_handler_->close (); + this->notify_handler_->open (this, 0); +#endif /* ACE_MT_SAFE */ +} + +ACE_FoxReactor::~ACE_FoxReactor (void) +{ +} + +void ACE_FoxReactor::fxapplication(FXApp *a) +{ + fxapp=a; +} + +// This is just the <wait_for_multiple_events> from ace/Reactor.cpp +// but we use the Fox functions to wait for an event, not <select> + +int +ACE_FoxReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) +{ + ACE_TRACE( "ACE_FoxReactor::wait_for_multiple_events" ); + + int nfound = 0; + do + { + max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); + size_t width = this->handler_rep_.max_handlep1 (); + handle_set.rd_mask_ = this->wait_set_.rd_mask_; + handle_set.wr_mask_ = this->wait_set_.wr_mask_; + handle_set.ex_mask_ = this->wait_set_.ex_mask_; + + nfound = FoxWaitForMultipleEvents (width, + handle_set, + max_wait_time); + + } while( nfound == -1 && this->handle_error () > 0 ); + + if (nfound > 0) + { +#if !defined (ACE_WIN32) + handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + + return nfound; + // Timed out or input available +} + +int +ACE_FoxReactor::FoxWaitForMultipleEvents (int width, + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value */*max_wait_time*/) +{ + // Check to make sure our handle's are all usable. + ACE_Select_Reactor_Handle_Set temp_set = wait_set; + + if (ACE_OS::select (width, + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero ) == -1) + return -1; // Bad file arguments... + + // Qt processing. + this->fxapp->runOneEvent () ; + + // Reset the width, in case it changed during the upcalls. + width = handler_rep_.max_handlep1 (); + + // Now actually read the result needed by the <Select_Reactor> using + // <select>. + return ACE_OS::select(width, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); +} + + +long ACE_FoxReactor::onFileEvents(FXObject* /* ob */, FXSelector se, void* handle){ + FXSelector sel=FXSELTYPE(se); + ACE_Select_Reactor_Handle_Set dispatch_set; + bool f=false; + if(sel==SEL_IO_READ){ + dispatch_set.rd_mask_.set_bit(ACE_HANDLE(reinterpret_cast<FXival>(handle))); + f=true; + } + else + if(sel==SEL_IO_WRITE){ + dispatch_set.wr_mask_.set_bit(ACE_HANDLE(reinterpret_cast<FXival>(handle))); + f=true; + } + else + if(sel==SEL_IO_EXCEPT){ + dispatch_set.ex_mask_.set_bit(ACE_HANDLE(reinterpret_cast<FXival>(handle))); + f=true; + }; + if(f) dispatch (1, dispatch_set); + + return 1; +} + +long ACE_FoxReactor::onTimerEvents(FXObject* /* ob */, FXSelector /* sel */, void* /* handle */) +{ + // Deal with any timer events + ACE_Select_Reactor_Handle_Set handle_set; + this->dispatch (0, handle_set ); + + // Set next timeout signal + this->reset_timeout (); + + return 0; +} + +int +ACE_FoxReactor::register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_FoxReactor::register_handler_i"); + + int const result = ACE_Select_Reactor::register_handler_i (handle, + handler, mask); + if (result == -1) + return -1; + + unsigned long condition = 0; + + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, FX::INPUT_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, FX::INPUT_WRITE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, FX::INPUT_EXCEPT); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (condition, FX::INPUT_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) + { + ACE_SET_BITS (condition, FX::INPUT_WRITE); // connected, you may write + ACE_SET_BITS (condition, FX::INPUT_READ); // connected, you have data/err + } + + if (condition != 0) + { + fxapp->addInput(handle, condition, this, 0); + } + return 0; +} + +int +ACE_FoxReactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::register_handler_i (handles, handler, mask); +} + +int +ACE_FoxReactor::remove_handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_FoxReactor::remove_handler_i"); + + // In the registration phase we registered first with + // ACE_Select_Reactor and then with X. Now we are now doing things + // in reverse order. + + int condition = 0; + + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, FX::INPUT_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, FX::INPUT_WRITE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, FX::INPUT_EXCEPT); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (condition, FX::INPUT_READ); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)) + { + ACE_SET_BITS (condition, FX::INPUT_WRITE); // connected, you may write + ACE_SET_BITS (condition, FX::INPUT_READ); // connected, you have data/err + } + + // First clean up the corresponding X11Input. + fxapp->removeInput ((int)handle,condition); // ACE_reinterpret_cast(int,handle)); + + // Now let the reactor do its work. + return ACE_Select_Reactor::remove_handler_i (handle, mask); +} + +int +ACE_FoxReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, mask); +} + +// The following function ensures there's an Fox timeout for the first +// timeout in the Reactor's Timer_Queue. + +void +ACE_FoxReactor::reset_timeout (void) +{ + ACE_Time_Value *max_wait_time = + this->timer_queue_->calculate_timeout (0); + + if (max_wait_time != 0) + { + float t = max_wait_time->sec () + + max_wait_time->usec () / 1000000.0F; + fxapp->addTimeout (this, 0, t*1000); + } +} + +int +ACE_FoxReactor::reset_timer_interval + (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_FoxReactor::reset_timer_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + int const result = + ACE_Select_Reactor::reset_timer_interval (timer_id, + interval); + + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +long +ACE_FoxReactor::schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_FoxReactor::schedule_timer"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + long result = ACE_Select_Reactor::schedule_timer (event_handler, + arg, + delay, + interval); + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +int +ACE_FoxReactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_FoxReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (handler, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +int +ACE_FoxReactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_FoxReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (timer_id, + arg, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + diff --git a/dep/acelite/ace/FoxReactor/FoxReactor.h b/dep/acelite/ace/FoxReactor/FoxReactor.h new file mode 100644 index 00000000000..e284441e555 --- /dev/null +++ b/dep/acelite/ace/FoxReactor/FoxReactor.h @@ -0,0 +1,112 @@ +/* -*- C-*- */ + +//============================================================================= +/** + * @file FoxReactor.h + * + * $Id: FoxReactor.h 93117 2011-01-20 12:11:28Z mcorino $ + * + * @author Dmitriy Nikitinskiy <nick@bel.ru> + * @author Based in part in the ACE_XtReactor implementation by + * @author Eric C. Newton's <ecn@clark.net> + * @author Kirill Rybaltchenko <Kirill.Rybaltchenko@cern.ch> + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACE_FOXREACTOR_H +#define ACE_FOXREACTOR_H +#include /**/ "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Select_Reactor.h" +#include "ace/FoxReactor/ACE_FoxReactor_export.h" + +#include <fx.h> + +/** + * @class ACE_FoxReactor + * + * @brief A Reactor implementation that uses the FOX toolkit (www.fox-toolkit.org) + * for event demultiplexing. This will let us integrate the FOX + * toolkit with ACE and/or TAO. + * + */ +class ACE_FoxReactor_Export ACE_FoxReactor : public FXObject, public ACE_Select_Reactor +{ + FXDECLARE(ACE_FoxReactor) +public: + // = Initialization and termination methods. + ACE_FoxReactor (FXApp* a=0, + size_t size = DEFAULT_SIZE, + bool restart = false, + ACE_Sig_Handler * = 0); + virtual ~ACE_FoxReactor (void); + + void fxapplication(FXApp* a); + + // = Timer operations. + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval); + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + virtual int cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close = 1); + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + + // = Integrate with the Fox callback function mechanism. + long onFileEvents (FXObject*, FXSelector, void*); + long onTimerEvents (FXObject*, FXSelector, void*); + + +protected: + // = Register timers/handles with Fox. + /// Register a single @a handler. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Register a set of <handlers>. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Remove the <handler> associated with this @a handle. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Remove a set of <handles>. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + int FoxWaitForMultipleEvents (int,ACE_Select_Reactor_Handle_Set &,ACE_Time_Value *); + +private: + /// This method ensures there's an Fox timeout for the first timeout + /// in the Reactor's Timer_Queue. + void reset_timeout (void); + + FXApp *fxapp; + + /// Deny access since member-wise won't work... + ACE_FoxReactor (const ACE_FoxReactor &); + ACE_FoxReactor &operator = (const ACE_FoxReactor &); +}; + +#include /**/ "ace/post.h" +#endif /* ACE_FOXREACTOR_H */ + diff --git a/dep/acelite/ace/Functor.cpp b/dep/acelite/ace/Functor.cpp index 4f12670e83e..09e80a587a9 100644 --- a/dep/acelite/ace/Functor.cpp +++ b/dep/acelite/ace/Functor.cpp @@ -3,7 +3,7 @@ /** * @file Functor.cpp * - * $Id: Functor.cpp 91286 2010-08-05 09:04:31Z johnnyw $ + * $Id: Functor.cpp 95332 2011-12-15 11:09:41Z mcorino $ * * Non-inlinable method definitions for non-templatized classes * and template specializations implementing the GOF Command Pattern, @@ -40,4 +40,14 @@ ACE_Command_Base::~ACE_Command_Base (void) { } +ACE_Noop_Command::ACE_Noop_Command() +{ +} + +int +ACE_Noop_Command::execute(void*) +{ + return 0; +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Functor.h b/dep/acelite/ace/Functor.h index cb01630e2fc..0241dc7d8fe 100644 --- a/dep/acelite/ace/Functor.h +++ b/dep/acelite/ace/Functor.h @@ -4,7 +4,7 @@ /** * @file Functor.h * - * $Id: Functor.h 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: Functor.h 95761 2012-05-15 18:23:04Z johnnyw $ * * Non-templatized classes and class template specializations for * implementing function objects that are used in various places @@ -77,6 +77,23 @@ public: virtual int execute (void *arg = 0) = 0; }; +/** + * @class ACE_Noop_Command + * + * Implements a ACE_Command_Base with an empty execute() body. + */ + +class ACE_Export ACE_Noop_Command + : public ACE_Command_Base +{ +public: + /// Constructor + ACE_Noop_Command(); + + /// Implement the empty execute() member function + virtual int execute(void*); +}; + //////////////////////////////////////////////////////////// // STL-style Functor Classes and Template Specializations // //////////////////////////////////////////////////////////// @@ -187,7 +204,7 @@ public: unsigned long operator () (unsigned long t) const; }; -#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +#if (ACE_SIZEOF_LONG < 8) /** * @brief Function object for hashing a signed 64-bit number */ @@ -198,10 +215,8 @@ public: /// Simply returns t unsigned long operator () (ACE_INT64 t) const; }; -#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ +#endif /* ACE_SIZEOF_LONG < 8 */ -// We can do this even if ACE_LACKS_UNSIGNEDLONGLONG_T because there's an -// emulation for it in ACE_U_LongLong. #if (ACE_SIZEOF_LONG < 8) /** * @brief Function object for hashing an unsigned 64-bit number diff --git a/dep/acelite/ace/Functor.inl b/dep/acelite/ace/Functor.inl index 46fb002178f..0c4777c48ea 100644 --- a/dep/acelite/ace/Functor.inl +++ b/dep/acelite/ace/Functor.inl @@ -4,7 +4,7 @@ /** * @file Functor.inl * - * $Id: Functor.inl 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: Functor.inl 95763 2012-05-16 06:43:51Z johnnyw $ * * Inlinable method definitions for non-templatized classes * and template specializations implementing the GOF Command Pattern, @@ -108,13 +108,13 @@ ACE_Hash<unsigned long>::operator () (unsigned long t) const } // This #if needs to match the one in Functor.h -#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +#if (ACE_SIZEOF_LONG < 8) ACE_INLINE unsigned long ACE_Hash<ACE_INT64>::operator () (ACE_INT64 t) const { return static_cast<unsigned long> (t); } -#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ +#endif /* ACE_SIZEOF_LONG < 8 */ #if (ACE_SIZEOF_LONG < 8) ACE_INLINE unsigned long @@ -126,7 +126,7 @@ ACE_Hash<ACE_UINT64>::operator () (const ACE_UINT64 &t) const return static_cast<unsigned long> (t); #endif /* ACE_SIZEOF_LONG */ } -#endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */ +#endif /* ACE_SIZEOF_LONG < 8 */ ACE_INLINE unsigned long ACE_Hash<const char *>::operator () (const char *t) const diff --git a/dep/acelite/ace/Functor_String.h b/dep/acelite/ace/Functor_String.h index 2adf561a65f..4a2abb512f0 100644 --- a/dep/acelite/ace/Functor_String.h +++ b/dep/acelite/ace/Functor_String.h @@ -4,7 +4,7 @@ /** * @file Functor_String.h * - * $Id: Functor_String.h 86698 2009-09-13 15:58:17Z johnnyw $ + * $Id: Functor_String.h 93411 2011-02-18 22:21:16Z hillj $ * * Class template specializations for ACE_*String types implementing * function objects that are used in various places in ATC. They @@ -25,6 +25,7 @@ #include /**/ "ace/ACE_export.h" #include "ace/SStringfwd.h" +#include <string> ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -77,6 +78,44 @@ public: const ACE_CString &rhs) const; }; +/** + * @brief Function object for determining whether two std::strings are + * equal. + */ +template<> +class ACE_Export ACE_Equal_To<std::string> +{ +public: + int operator () (const std::string &lhs, + const std::string &rhs) const; +}; + + +/** + * @brief Function object for hashing a std::string + */ +template<> +class ACE_Export ACE_Hash<std::string> +{ +public: + /// Calls ACE::hash_pjw + unsigned long operator () (const std::string &lhs) const; +}; + + +/** + * @brief Function object for determining whether the first const string + * is less than the second const string. + */ +template<> +class ACE_Export ACE_Less_Than<std::string> +{ +public: + /// Simply calls std::string::compare + int operator () (const std::string &lhs, + const std::string &rhs) const; +}; + #if defined (ACE_USES_WCHAR) diff --git a/dep/acelite/ace/Functor_String.inl b/dep/acelite/ace/Functor_String.inl index bdac96386f8..045cd05f780 100644 --- a/dep/acelite/ace/Functor_String.inl +++ b/dep/acelite/ace/Functor_String.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Functor_String.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Functor_String.inl 93411 2011-02-18 22:21:16Z hillj $ #include "ace/ACE.h" #include "ace/String_Base.h" @@ -28,6 +28,26 @@ ACE_Less_Than<ACE_CString>::operator () (const ACE_CString &lhs, return (lhs < rhs); } +ACE_INLINE unsigned long +ACE_Hash<std::string>::operator () (const std::string &t) const +{ + return ACE::hash_pjw (t.c_str (), t.length ()); +} + + +ACE_INLINE int +ACE_Equal_To<std::string>::operator () (const std::string &lhs, + const std::string &rhs) const +{ + return lhs == rhs; +} + +ACE_INLINE int +ACE_Less_Than<std::string>::operator () (const std::string &lhs, + const std::string &rhs) const +{ + return (lhs < rhs); +} #if defined (ACE_USES_WCHAR) ACE_INLINE unsigned long diff --git a/dep/acelite/ace/Functor_T.h b/dep/acelite/ace/Functor_T.h index ff087d2019e..6dfbbcff6b1 100644 --- a/dep/acelite/ace/Functor_T.h +++ b/dep/acelite/ace/Functor_T.h @@ -4,7 +4,7 @@ /** * @file Functor_T.h * - * $Id: Functor_T.h 91396 2010-08-19 12:37:24Z johnnyw $ + * $Id: Functor_T.h 95332 2011-12-15 11:09:41Z mcorino $ * * Templatized classes for implementing function objects that are * used in various places in ACE. There are currently two major @@ -79,6 +79,38 @@ private: ACTION action_; }; +/** + * @class ACE_Member_Function_Command + * + * @brief Defines a class template that allows us to invoke a member + * function using the GoF command style callback. + * + */ +template <class RECEIVER> +class ACE_Member_Function_Command : public ACE_Command_Base +{ +public: + typedef void (RECEIVER::*PTMF)(void); + + /// Con Constructor: sets the <receiver_> of the Command to recvr, and the + /// <action_> of the Command to <action>. + ACE_Member_Function_Command (RECEIVER &recvr, PTMF ptmf); + + /// Virtual destructor. + virtual ~ACE_Member_Function_Command (void); + + /// Invokes the method <action_> from the object <receiver_>. The + /// parameter is ignored + virtual int execute (void *); + +private: + /// Object where the method resides. + RECEIVER &receiver_; + + /// Method that is going to be invoked. + PTMF ptmf_; +}; + ///////////////////////////////// // STL-style Functor Templates // ///////////////////////////////// diff --git a/dep/acelite/ace/Functor_T.inl b/dep/acelite/ace/Functor_T.inl index 35cfed5b798..1b303210cad 100644 --- a/dep/acelite/ace/Functor_T.inl +++ b/dep/acelite/ace/Functor_T.inl @@ -1,9 +1,30 @@ // -*- C++ -*- // -// $Id: Functor_T.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Functor_T.inl 95332 2011-12-15 11:09:41Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL +template<class RECEIVER> ACE_INLINE +ACE_Member_Function_Command<RECEIVER>:: +ACE_Member_Function_Command (RECEIVER &recvr, PTMF ptmf) + : receiver_(recvr) + , ptmf_(ptmf) +{ +} + +template<class RECEIVER> ACE_INLINE +ACE_Member_Function_Command<RECEIVER>:: +~ACE_Member_Function_Command (void) +{ +} + +template<class RECEIVER> ACE_INLINE int +ACE_Member_Function_Command<RECEIVER>::execute (void *) +{ + (this->receiver_.*ptmf_)(); + return 0; +} + template <class TYPE> ACE_INLINE unsigned long ACE_Hash<TYPE>::operator () (const TYPE &t) const { diff --git a/dep/acelite/ace/Future.cpp b/dep/acelite/ace/Future.cpp index 5ebb550a68c..6544c118582 100644 --- a/dep/acelite/ace/Future.cpp +++ b/dep/acelite/ace/Future.cpp @@ -1,4 +1,4 @@ - // $Id: Future.cpp 91626 2010-09-07 10:59:20Z johnnyw $ + // $Id: Future.cpp 95706 2012-04-18 06:42:16Z johnnyw $ #ifndef ACE_FUTURE_CPP #define ACE_FUTURE_CPP @@ -98,7 +98,7 @@ ACE_Future_Rep<T>::attach (ACE_Future_Rep<T>*& rep) { ACE_ASSERT (rep != 0); // Use value_ready_mutex_ for both condition and ref count management -// ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, r_mon, rep->value_ready_mutex_, 0); + ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, r_mon, rep->value_ready_mutex_, 0); ++rep->ref_count_; return rep; } diff --git a/dep/acelite/ace/Future_Set.cpp b/dep/acelite/ace/Future_Set.cpp index 986ce948c34..1ba1fd6be66 100644 --- a/dep/acelite/ace/Future_Set.cpp +++ b/dep/acelite/ace/Future_Set.cpp @@ -1,4 +1,4 @@ -// $Id: Future_Set.cpp 91626 2010-09-07 10:59:20Z johnnyw $ +// $Id: Future_Set.cpp 92900 2010-12-17 14:45:11Z mcorino $ #ifndef ACE_FUTURE_SET_CPP #define ACE_FUTURE_SET_CPP @@ -117,7 +117,7 @@ ACE_Future_Set<T>::next_readable (ACE_Future<T> &future, return 0; // Remove the hash map entry with the specified future rep from our map. - FUTURE_HOLDER *future_holder; + FUTURE_HOLDER *future_holder = 0; if (this->future_map_.find (future_rep, future_holder) != -1) { diff --git a/dep/acelite/ace/Get_Opt.cpp b/dep/acelite/ace/Get_Opt.cpp index 5953abe1810..90355f91a1b 100644 --- a/dep/acelite/ace/Get_Opt.cpp +++ b/dep/acelite/ace/Get_Opt.cpp @@ -1,4 +1,4 @@ -// $Id: Get_Opt.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Get_Opt.cpp 95710 2012-04-25 07:02:50Z johnnyw $ #include "ace/Get_Opt.h" diff --git a/dep/acelite/ace/Get_Opt.inl b/dep/acelite/ace/Get_Opt.inl index e307fb5e400..1f915184716 100644 --- a/dep/acelite/ace/Get_Opt.inl +++ b/dep/acelite/ace/Get_Opt.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: Get_Opt.inl 81840 2008-06-05 13:46:45Z sma $ +// $Id: Get_Opt.inl 93736 2011-04-05 12:38:35Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Global_Macros.h b/dep/acelite/ace/Global_Macros.h index bce0544e1a6..b18a5482e52 100644 --- a/dep/acelite/ace/Global_Macros.h +++ b/dep/acelite/ace/Global_Macros.h @@ -4,7 +4,7 @@ /** * @file Global_Macros.h * - * $Id: Global_Macros.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: Global_Macros.h 96084 2012-08-20 18:07:57Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -166,7 +166,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL /* Using ACE_UNEXPECTED_RETURNS is ill-advised because, in many cases, * it fails to inform callers of the error condition. - * It exists mainly to provide back-compatibility with old, dangerous, + * It exists mainly to provide back-compatibility with old, dangegrous, * incorrect behavior. * Code that previously used ACE_GUARD() or ACE_GUARD_RETURN() to return * upon failure to acquire a lock can now use: @@ -905,7 +905,7 @@ ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (AC } while (0) #endif /* defined ACE_LACKS_ARRAY_PLACEMENT_NEW */ -// This is being placed here temporarily to help stablelize the builds, but will +// This is being placed here temporarily to help stabilize the builds, but will // be moved out along with the above macros as part of the subsetting. dhinton #if !defined (ACE_LACKS_NEW_H) # if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) diff --git a/dep/acelite/ace/Guard_T.cpp b/dep/acelite/ace/Guard_T.cpp index 90321c6ac4e..25c31ce0379 100644 --- a/dep/acelite/ace/Guard_T.cpp +++ b/dep/acelite/ace/Guard_T.cpp @@ -1,10 +1,9 @@ -// $Id: Guard_T.cpp 92052 2010-09-27 14:20:22Z vzykov $ +// $Id: Guard_T.cpp 93736 2011-04-05 12:38:35Z johnnyw $ #ifndef ACE_GUARD_T_CPP #define ACE_GUARD_T_CPP // FUZZ: disable check_for_ACE_Guard - #include "ace/Guard_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/dep/acelite/ace/Guard_T.h b/dep/acelite/ace/Guard_T.h index 5120d3f7a57..da06e1573f4 100644 --- a/dep/acelite/ace/Guard_T.h +++ b/dep/acelite/ace/Guard_T.h @@ -4,7 +4,7 @@ /** * @file Guard_T.h * - * $Id: Guard_T.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Guard_T.h 93792 2011-04-07 11:48:50Z mcorino $ * * Moved from Synch.h. * @@ -36,9 +36,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * function... It performs automatic acquisition and release of * a parameterized synchronization object ACE_LOCK. * - * The <ACE_LOCK> class given as an actual parameter must provide, at - * the very least the <acquire>, <tryacquire>, <release>, and - * <remove> methods. + * The ACE_LOCK class given as an actual parameter must provide, at + * the very least the acquire(), tryacquire(), release(), and + * remove() methods. * * @warning A successfully constructed ACE_Guard does NOT mean that the * lock was acquired! It is the caller's responsibility, after @@ -72,11 +72,11 @@ public: ACE_Guard (ACE_LOCK &l); /// Implicitly and automatically acquire (or try to acquire) the - /// lock. If @a block is non-0 then <acquire> the <ACE_LOCK>, else - /// <tryacquire> it. + /// lock. If @a block is non-0 then acquire() the ACE_LOCK, else + /// tryacquire() it. ACE_Guard (ACE_LOCK &l, bool block); - /// Initialise the guard without implicitly acquiring the lock. The + /// Initialize the guard without implicitly acquiring the lock. The /// @a become_owner parameter indicates whether the guard should release /// the lock implicitly on destruction. The @a block parameter is /// ignored and is used here to disambiguate with the preceding diff --git a/dep/acelite/ace/Guard_T.inl b/dep/acelite/ace/Guard_T.inl index 9c313a0fa2c..34b2b777f66 100644 --- a/dep/acelite/ace/Guard_T.inl +++ b/dep/acelite/ace/Guard_T.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: Guard_T.inl 91626 2010-09-07 10:59:20Z johnnyw $ +// $Id: Guard_T.inl 93736 2011-04-05 12:38:35Z johnnyw $ // FUZZ: disable check_for_ACE_Guard diff --git a/dep/acelite/ace/Handle_Set.cpp b/dep/acelite/ace/Handle_Set.cpp index ba64fb3443f..4c9b6b56017 100644 --- a/dep/acelite/ace/Handle_Set.cpp +++ b/dep/acelite/ace/Handle_Set.cpp @@ -1,5 +1,5 @@ // Handle_Set.cpp -// $Id: Handle_Set.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Handle_Set.cpp 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Handle_Set.h" @@ -9,8 +9,6 @@ #include "ace/OS_NS_string.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set) @@ -24,12 +22,12 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set) # define ACE_MSB_MASK (~((fd_mask) 1 << (NFDBITS - 1))) #endif /* ! ACE_WIN32 */ -#if defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE) +#if defined (ACE_LINUX) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE) // XPG4.2 requires the fds_bits member name, so it is not enabled by // default on Linux/glibc-2.1.x systems. Instead use "__fds_bits." // Ugly, but "what are you going to do?" 8-) #define fds_bits __fds_bits -#endif /* linux && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !_XOPEN_SOURCE */ +#endif /* ACE_LINUX && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !_XOPEN_SOURCE */ void ACE_Handle_Set::dump (void) const @@ -226,24 +224,11 @@ ACE_Handle_Set::set_max (ACE_HANDLE current_max) maskp[i] == 0; i--) continue; -#if defined (ACE_TANDEM_NSK_BIT_ORDER) - // bits are in reverse order, MSB (sign bit) = bit 0. - this->max_handle_ = ACE_MULT_BY_WORDSIZE (i); - for (fd_mask val = maskp[i]; - (val & ACE_MSB_MASK) != 0; - val = (val << 1)) - ++this->max_handle_; -#elif 1 /* !defined(ACE_HAS_BIG_FD_SET) */ this->max_handle_ = ACE_MULT_BY_WORDSIZE (i); for (fd_mask val = maskp[i]; (val & ~1) != 0; // This obscure code is needed since "bit 0" is in location 1... val = (val >> 1) & ACE_MSB_MASK) ++this->max_handle_; -#else - register u_long val = this->mask_.fds_bits[i]; - this->max_handle_ = ACE_MULT_BY_WORDSIZE (i) - + ACE_Handle_Set::bitpos(val & ~(val - 1)); -#endif /* 1 */ } // Do some sanity checking... @@ -312,12 +297,7 @@ ACE_Handle_Set_Iterator::operator () (void) // Increment the iterator and advance to the next bit in this // word. this->handle_index_++; -#if defined (ACE_TANDEM_NSK_BIT_ORDER) - // bits are in reverse order, MSB (sign bit) = bit 0. - this->word_val_ = (this->word_val_ << 1); -# else this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; -# endif /* ACE_TANDEM_NSK_BIT_ORDER */ // If we've examined all the bits in this word, we'll go onto // the next word. @@ -353,19 +333,10 @@ ACE_Handle_Set_Iterator::operator () (void) // bit enabled, keeping track of which <handle_index> this // represents (this information is used by subsequent calls to // <operator()>). - -#if defined (ACE_TANDEM_NSK_BIT_ORDER) - // bits are in reverse order, MSB (sign bit) = bit 0. - for (; - this->word_val_ > 0; - this->word_val_ = (this->word_val_ << 1)) - this->handle_index_++; -# else for (; ACE_BIT_DISABLED (this->word_val_, 1); this->handle_index_++) this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; -# endif /* ACE_TANDEM_NSK_BIT_ORDER */ return result; } @@ -435,6 +406,7 @@ ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs) handle_index_ (0), word_num_ (-1) #elif defined (ACE_HAS_BIG_FD_SET) + handle_index_ (0), oldlsb_ (0), word_max_ (hs.max_handle_ == ACE_INVALID_HANDLE ? 0 @@ -466,19 +438,11 @@ ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs) // Loop until we get <word_val_> to have its least significant bit // enabled, keeping track of which <handle_index> this represents // (this information is used by <operator()>). -#if defined (ACE_TANDEM_NSK_BIT_ORDER) - // bits are in reverse order, MSB (sign bit) = bit 0. - for (this->word_val_ = maskp[this->word_num_]; - this->word_val_ > 0; - this->word_val_ = (this->word_val_ << 1)) - this->handle_index_++; -# else for (this->word_val_ = maskp[this->word_num_]; ACE_BIT_DISABLED (this->word_val_, 1) && this->handle_index_ < maxhandlep1; this->handle_index_++) this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; -# endif /* ACE_TANDEM_NSK_BIT_ORDER */ #elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET) if (this->word_max_==0) { @@ -494,7 +458,6 @@ ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs) #endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ } - void ACE_Handle_Set_Iterator::reset_state (void) { @@ -534,19 +497,11 @@ ACE_Handle_Set_Iterator::reset_state (void) // Loop until we get <word_val_> to have its least significant bit // enabled, keeping track of which <handle_index> this represents // (this information is used by <operator()>). -#if defined (ACE_TANDEM_NSK_BIT_ORDER) - // bits are in reverse order, MSB (sign bit) = bit 0. - for (this->word_val_ = maskp[this->word_num_]; - this->word_val_ > 0; - this->word_val_ = (this->word_val_ << 1)) - this->handle_index_++; -# else for (this->word_val_ = maskp[this->word_num_]; ACE_BIT_DISABLED (this->word_val_, 1) && this->handle_index_ < maxhandlep1; this->handle_index_++) this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK; -# endif /* ACE_TANDEM_NSK_BIT_ORDER */ #elif !defined (ACE_WIN32) && defined (ACE_HAS_BIG_FD_SET) if (this->word_max_==0) { diff --git a/dep/acelite/ace/Handle_Set.h b/dep/acelite/ace/Handle_Set.h index 0de5c98ea4f..97b3042a6a1 100644 --- a/dep/acelite/ace/Handle_Set.h +++ b/dep/acelite/ace/Handle_Set.h @@ -4,7 +4,7 @@ /** * @file Handle_Set.h * - * $Id: Handle_Set.h 92298 2010-10-21 11:15:17Z johnnyw $ + * $Id: Handle_Set.h 93736 2011-04-05 12:38:35Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -58,7 +58,6 @@ public: MAXSIZE = ACE_DEFAULT_SELECT_REACTOR_SIZE }; - // = Initialization methods. /// Constructor, initializes the bitmask to all 0s. ACE_Handle_Set (void); diff --git a/dep/acelite/ace/Handle_Set.inl b/dep/acelite/ace/Handle_Set.inl index 7e669d4fd2d..fd401caa628 100644 --- a/dep/acelite/ace/Handle_Set.inl +++ b/dep/acelite/ace/Handle_Set.inl @@ -1,21 +1,9 @@ // -*- C++ -*- // -// $Id: Handle_Set.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Handle_Set.inl 96017 2012-08-08 22:18:09Z mitza $ #include "ace/Log_Msg.h" -// todo: This should be cleaned up a bit. -// memset for FD_ZERO on OpenBSD and Solaris w/ gcc 2.95.3 -#include "ace/os_include/os_string.h" - -// FreeBSD 4.8-RC? for bzero() used by FD_ZERO -#include "ace/os_include/os_strings.h" - -// IRIX5 defines bzero() in this odd file... used by FD_ZERO -#if defined (ACE_HAS_BSTRING) -# include /**/ <bstring.h> -#endif /* ACE_HAS_BSTRING */ - // AIX defines bzero() in this odd file... used by FD_ZERO #if defined (ACE_HAS_STRINGS) # include "ace/os_include/os_strings.h" @@ -87,6 +75,8 @@ ACE_Handle_Set::is_set (ACE_HANDLE handle) const #elif defined (ACE_HAS_NONCONST_FD_ISSET) return FD_ISSET (handle, const_cast<fd_set*> (&this->mask_)); +#elif defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 + return static_cast<int> (FD_ISSET (handle, &this->mask_)); #else return FD_ISSET (handle, &this->mask_); diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp b/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp index ad333543ade..19478977569 100644 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp +++ b/dep/acelite/ace/Hash_Cache_Map_Manager_T.cpp @@ -1,4 +1,4 @@ -// $Id: Hash_Cache_Map_Manager_T.cpp 92097 2010-09-30 05:41:49Z msmit $ +// $Id: Hash_Cache_Map_Manager_T.cpp 93359 2011-02-11 11:33:12Z mcorino $ #ifndef ACE_HASH_CACHE_MAP_MANAGER_T_CPP #define ACE_HASH_CACHE_MAP_MANAGER_T_CPP @@ -17,11 +17,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Cache_Map_Manager) -#define ACE_T1 class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES -#define ACE_T2 KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES - -template <ACE_T1> -ACE_Hash_Cache_Map_Manager<ACE_T2>::ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY &caching_s, size_t size, ACE_Allocator *alloc) : ACE_HCMM_BASE (caching_s, @@ -30,13 +27,13 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::ACE_Hash_Cache_Map_Manager (CACHING_STRATEGY { } -template <ACE_T1> -ACE_Hash_Cache_Map_Manager<ACE_T2>::~ACE_Hash_Cache_Map_Manager (void) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::~ACE_Hash_Cache_Map_Manager (void) { } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::bind (const KEY &key, const VALUE &value, CACHE_ENTRY *&entry) { @@ -71,8 +68,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, return bind_result; } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::rebind (const KEY &key, const VALUE &value, CACHE_ENTRY *&entry) { @@ -109,8 +106,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, return rebind_result; } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::trybind (const KEY &key, VALUE &value, CACHE_ENTRY *&entry) { @@ -152,8 +149,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, return trybind_result; } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key, CACHE_ENTRY *&entry) { // Lookup the key and populate the <value>. @@ -178,8 +175,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key, return find_result; } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key, VALUE &value) { CACHE_ENTRY *entry = 0; @@ -195,8 +192,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key, return result; } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::find (const KEY &key) { CACHE_ENTRY *entry = 0; @@ -204,8 +201,8 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::find (const KEY &key) entry); } -template <ACE_T1> int -ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (CACHE_ENTRY *entry) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::unbind (CACHE_ENTRY *entry) { // Remove the entry from the cache. int unbind_result = this->map_.unbind (entry); @@ -226,7 +223,4 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (CACHE_ENTRY *entry) ACE_END_VERSIONED_NAMESPACE_DECL -#undef ACE_T1 -#undef ACE_T2 - #endif /* ACE_HASH_CACHE_MAP_MANAGER_T_CPP */ diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.h b/dep/acelite/ace/Hash_Cache_Map_Manager_T.h index 0bc64a5a9ed..e1fc4d77317 100644 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.h +++ b/dep/acelite/ace/Hash_Cache_Map_Manager_T.h @@ -4,7 +4,7 @@ /** * @file Hash_Cache_Map_Manager_T.h * - * $Id: Hash_Cache_Map_Manager_T.h 92097 2010-09-30 05:41:49Z msmit $ + * $Id: Hash_Cache_Map_Manager_T.h 93366 2011-02-11 19:30:35Z johnnyw $ * * @author Kirthika Parameswaran <kirthika@cs.wustl.edu> */ @@ -39,9 +39,6 @@ class ACE_Allocator; CACHING_STRATEGY, \ ATTRIBUTES> -// For linkers that cant grok long names. -#define ACE_Hash_Cache_Map_Manager AHCMM - /** * @class ACE_Hash_Cache_Map_Manager * @@ -58,7 +55,7 @@ class ACE_Allocator; * Hash_Cache_Map_Manager provides extra functionality on top * of the Cache_Map_Manager. * No locking mechanism provided since locking at this level - * isnt efficient. Locking has to be provided by the + * isn't efficient. Locking has to be provided by the * application. */ template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> @@ -189,7 +186,6 @@ class ACE_Hash_Cache_Map_Manager : public ACE_CACHE_MAP_MANAGER int unbind (CACHE_ENTRY *entry); protected: - /// Base class. typedef ACE_CACHE_MAP_MANAGER ACE_HCMM_BASE; }; diff --git a/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl b/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl index f097bb7e073..8c4bb122360 100644 --- a/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl +++ b/dep/acelite/ace/Hash_Cache_Map_Manager_T.inl @@ -1,43 +1,43 @@ // -*- C++ -*- -// -// $Id: Hash_Cache_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $ - -#define ACE_T1 class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES -#define ACE_T2 KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES +// $Id: Hash_Cache_Map_Manager_T.inl 93359 2011-02-11 11:33:12Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, - const VALUE &value) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::bind ( + const KEY &key, + const VALUE &value) { - return ACE_HCMM_BASE::bind (key, - value); + return ACE_HCMM_BASE::bind (key, value); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, - const VALUE &value) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::rebind ( + const KEY &key, + const VALUE &value) { - return ACE_HCMM_BASE::rebind (key, - value); + return ACE_HCMM_BASE::rebind (key, value); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, - const VALUE &value, - VALUE &old_value) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::rebind ( + const KEY &key, + const VALUE &value, + VALUE &old_value) { - return ACE_HCMM_BASE::rebind (key, - value, - old_value); + return ACE_HCMM_BASE::rebind (key, value, old_value); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, - const VALUE &value, - KEY &old_key, - VALUE &old_value) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::rebind ( + const KEY &key, + const VALUE &value, + KEY &old_key, + VALUE &old_value) { return ACE_HCMM_BASE::rebind (key, value, @@ -45,29 +45,28 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::rebind (const KEY &key, old_value); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::trybind (const KEY &key, - VALUE &value) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::trybind ( + const KEY &key, + VALUE &value) { - return ACE_HCMM_BASE::trybind (key, - value); + return ACE_HCMM_BASE::trybind (key, value); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key) +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key) { return ACE_HCMM_BASE::unbind (key); } -template <ACE_T1> ACE_INLINE int -ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key, +template <class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES> +ACE_INLINE int +ACE_Hash_Cache_Map_Manager<KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES>::unbind (const KEY &key, VALUE &value) { - return ACE_HCMM_BASE::unbind (key, - value); + return ACE_HCMM_BASE::unbind (key, value); } ACE_END_VERSIONED_NAMESPACE_DECL - -#undef ACE_T1 -#undef ACE_T2 diff --git a/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp b/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp index db79e018793..195e8ac03c2 100644 --- a/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp +++ b/dep/acelite/ace/Hash_Multi_Map_Manager_T.cpp @@ -3,13 +3,12 @@ /** * @file Hash_Multi_Map_Manager_T.cpp * - * $Id: Hash_Multi_Map_Manager_T.cpp 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Hash_Multi_Map_Manager_T.cpp 93736 2011-04-05 12:38:35Z johnnyw $ * * @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu> */ //============================================================================= - #ifndef ACE_Hash_Multi_Map_Manager_T_CPP #define ACE_Hash_Multi_Map_Manager_T_CPP @@ -27,7 +26,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL - template <class EXT_ID, class INT_ID> ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Multi_Map_Entry (ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *next, ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *prev) diff --git a/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl b/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl index b6c353c2153..5bf8371ec99 100644 --- a/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl +++ b/dep/acelite/ace/Hash_Multi_Map_Manager_T.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Hash_Multi_Map_Manager_T.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Hash_Multi_Map_Manager_T.inl 94520 2011-09-22 14:55:20Z johnnyw $ #include "ace/Guard_T.h" @@ -91,7 +91,7 @@ template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_Hash_Multi_Map_Manager<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::bind_i (const EXT_ID &ext_id, const INT_ID &int_id) { - ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp; + ACE_Hash_Multi_Map_Entry<EXT_ID, INT_ID> *temp = 0; return this->bind_i (ext_id, int_id, temp); } diff --git a/dep/acelite/ace/Hashable.cpp b/dep/acelite/ace/Hashable.cpp index 75dc809dc0d..24b2407242f 100644 --- a/dep/acelite/ace/Hashable.cpp +++ b/dep/acelite/ace/Hashable.cpp @@ -1,4 +1,4 @@ -//$Id: Hashable.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +//$Id: Hashable.cpp 93736 2011-04-05 12:38:35Z johnnyw $ #include "ace/Hashable.h" @@ -6,8 +6,6 @@ #include "ace/Hashable.inl" #endif /* __ACE_INLINE __ */ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Hashable::~ACE_Hashable (void) diff --git a/dep/acelite/ace/Hashable.inl b/dep/acelite/ace/Hashable.inl index 352b7794eb9..1fb6956cfed 100644 --- a/dep/acelite/ace/Hashable.inl +++ b/dep/acelite/ace/Hashable.inl @@ -1,7 +1,5 @@ // -*- C++ -*- -// -// $Id: Hashable.inl 80826 2008-03-04 14:51:23Z wotte $ - +// $Id: Hashable.inl 93736 2011-04-05 12:38:35Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/High_Res_Timer.cpp b/dep/acelite/ace/High_Res_Timer.cpp index 4bc380c591d..81f8415aaa9 100644 --- a/dep/acelite/ace/High_Res_Timer.cpp +++ b/dep/acelite/ace/High_Res_Timer.cpp @@ -1,4 +1,4 @@ -// $Id: High_Res_Timer.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: High_Res_Timer.cpp 95788 2012-05-24 07:59:51Z johnnyw $ // Be very carefull before changing the calculations inside // ACE_High_Res_Timer. The precision matters and we are using integer @@ -22,8 +22,6 @@ #include "ace/OS_NS_stdlib.h" #include "ace/Truncate.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer) @@ -43,11 +41,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL ACE_BEGIN_VERSIONED_NAMESPACE_DECL - // Initialize the global_scale_factor_ to 1. The first - // ACE_High_Res_Timer instance construction will override this - // value. - /* static */ - ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1u; +/// Initialize the global_scale_factor_ to 1. The first +/// ACE_High_Res_Timer instance construction will override this +/// value. +/* static */ +ACE_High_Res_Timer::global_scale_factor_type ACE_High_Res_Timer::global_scale_factor_ = 1u; ACE_END_VERSIONED_NAMESPACE_DECL @@ -69,13 +67,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// This is used to tell if the global_scale_factor_ has been -// set, and if high resolution timers are supported. +/// This is used to tell if the global_scale_factor_ has been +/// set, and if high resolution timers are supported. /* static */ int ACE_High_Res_Timer::global_scale_factor_status_ = 0; - -#if defined (linux) +#if defined (ACE_LINUX) // Determine the apparent CPU clock speed from /proc/cpuinfo ACE_UINT32 ACE_High_Res_Timer::get_cpuinfo (void) @@ -188,9 +185,10 @@ ACE_High_Res_Timer::get_cpuinfo (void) return scale_factor; } -#endif /* linux */ +#endif /* ACE_LINUX */ -ACE_UINT32 + +ACE_High_Res_Timer::global_scale_factor_type ACE_High_Res_Timer::global_scale_factor (void) { #if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \ @@ -211,30 +209,23 @@ ACE_High_Res_Timer::global_scale_factor (void) if (ACE_High_Res_Timer::global_scale_factor_status_ == 0) { # if defined (ACE_WIN32) + // This a higher-precision version, specific for Windows systems LARGE_INTEGER freq; if (::QueryPerformanceFrequency (&freq)) - { - // We have a high-res timer -# if defined (ACE_LACKS_LONGLONG_T) - ACE_UINT64 uint64_freq(freq.u.LowPart, (ACE_UINT32) freq.u.HighPart); - ACE_High_Res_Timer::global_scale_factor - (uint64_freq / (ACE_UINT32) ACE_ONE_SECOND_IN_USECS); -# else - ACE_High_Res_Timer::global_scale_factor - (static_cast<unsigned int> (freq.QuadPart / ACE_HR_SCALE_CONVERSION)); -# endif // (ACE_LACKS_LONGLONG_T) + { + ACE_High_Res_Timer::global_scale_factor(freq.QuadPart); ACE_High_Res_Timer::global_scale_factor_status_ = 1; - } + } else + { // High-Res timers not supported ACE_High_Res_Timer::global_scale_factor_status_ = -1; - + } return ACE_High_Res_Timer::global_scale_factor_; - -# elif defined (linux) +# elif defined (ACE_LINUX) ACE_High_Res_Timer::global_scale_factor (ACE_High_Res_Timer::get_cpuinfo ()); -# endif /* ! ACE_WIN32 && ! (linux && __alpha__) */ +# endif /* ! ACE_WIN32 && ! (ACE_LINUX && __alpha__) */ # if !defined (ACE_WIN32) if (ACE_High_Res_Timer::global_scale_factor_ <= 1u) @@ -314,17 +305,6 @@ ACE_High_Res_Timer::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nglobal_scale_factor_: %u\n"), global_scale_factor ())); -#if defined (ACE_LACKS_LONGLONG_T) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT (":\nstart_.hi (): %8x; start_.lo (): %8x;\n") - ACE_TEXT ("end_.hi (): %8x; end_.lo (): %8x;\n") - ACE_TEXT ("total_.hi (): %8x; total_.lo (): %8x;\n") - ACE_TEXT ("start_incr_.hi () %8x; start_incr_.lo (): %8x;\n"), - start_.hi (), start_.lo (), - end_.hi (), end_.lo (), - total_.hi (), total_.lo (), - start_incr_.hi (), start_incr_.lo ())); -#else /* ! ACE_LACKS_LONGLONG_T */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT (":\nstart_.hi (): %8x; start_.lo (): %8x;\n") ACE_TEXT ("end_.hi (): %8x; end_.lo (): %8x;\n") @@ -338,7 +318,6 @@ ACE_High_Res_Timer::dump (void) const static_cast<ACE_UINT32> (total_ & 0xfffffffful), static_cast<ACE_UINT32> (start_incr_ >> 32), static_cast<ACE_UINT32> (start_incr_ & 0xfffffffful))); -#endif /* ! ACE_LACKS_LONGLONG_T */ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } @@ -357,7 +336,7 @@ ACE_High_Res_Timer::reset (void) void ACE_High_Res_Timer::elapsed_time (ACE_Time_Value &tv) const { - hrtime_to_tv (tv, + this->hrtime_to_tv (tv, ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_)); } @@ -394,12 +373,13 @@ ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) const void ACE_High_Res_Timer::elapsed_time_incr (ACE_Time_Value &tv) const { - hrtime_to_tv (tv, total_); + this->hrtime_to_tv (tv, total_); } void ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const { +#if !defined (ACE_WIN32) // Please do _not_ rearrange this equation. It is carefully // designed and tested to avoid overflow on machines that don't have // native 64-bit ints. In particular, division can be a problem. @@ -410,16 +390,29 @@ ACE_High_Res_Timer::elapsed_time (ACE_hrtime_t &nanoseconds) const nanoseconds = nanoseconds >> 10; // Right shift is implemented for non native 64-bit ints // operator/ only for a 32 bit result ! +#else + // This a higher-precision version, specific for Windows systems + nanoseconds = + (ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) * ACE_HR_SCALE_CONVERSION * 1000u) / + ACE_High_Res_Timer::global_scale_factor (); +#endif } void ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const { +#if !defined (ACE_WIN32) // Same as above. nanoseconds = this->total_ - * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); + * (1024000u / ACE_High_Res_Timer::global_scale_factor ()); // Caution - Borland has a problem with >>=, so resist the temptation. nanoseconds = nanoseconds >> 10; +#else + // This a higher-precision version, specific for Windows systems + nanoseconds = + this->total_ * 1000000000u / + ACE_High_Res_Timer::global_scale_factor (); +#endif } void diff --git a/dep/acelite/ace/High_Res_Timer.h b/dep/acelite/ace/High_Res_Timer.h index 3716597e5cd..d01149bce87 100644 --- a/dep/acelite/ace/High_Res_Timer.h +++ b/dep/acelite/ace/High_Res_Timer.h @@ -4,7 +4,7 @@ /** * @file High_Res_Timer.h * - * $Id: High_Res_Timer.h 89483 2010-03-15 09:48:01Z johnnyw $ + * $Id: High_Res_Timer.h 95798 2012-05-31 07:58:55Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -52,7 +52,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * units/second. Because it's possible that the units/second * changes in the future, it's recommended to use it instead * of a "hard coded" solution. - * Dependend on the platform and used class members, there's a + * Dependent on the platform and used class members, there's a * maximum elapsed period before overflow (which is not checked). * Look at the documentation with some members functions. * On some (most?) implementations it's not recommended to measure @@ -74,8 +74,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * ACE_hrtime_t values. Those methods do _not_ check for overflow! * @note Gabe <begeddov@proaxis.com> raises this issue regarding * <ACE_OS::gethrtime>: on multi-processors, the processor that - * you query for your <timer.stop> value might not be the one - * you queried for <timer.start>. Its not clear how much + * you query for your @c timer.stop() value might not be the one + * you queried for @c timer.start(). Its not clear how much * divergence there would be, if any. * This issue is not mentioned in the Solaris 2.5.1 gethrtime * man page. @@ -100,7 +100,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_High_Res_Timer { public: - // = Initialization method. +#if !defined (ACE_WIN32) + typedef ACE_UINT32 global_scale_factor_type; +#else + typedef ACE_UINT64 global_scale_factor_type; +#endif /** * global_scale_factor_ is set to @a gsf. All High_Res_Timers use @@ -112,13 +116,13 @@ public: * not be set. Careful, a <scale_factor> of 0 will cause division * by zero exceptions. * Depending on the platform its units are 1/microsecond or - * 1/millisecond. Use <ACE_HR_SCALE_CONVERSION> inside calculations + * 1/millisecond. Use @c ACE_HR_SCALE_CONVERSION inside calculations * instead a hardcoded value. */ - static void global_scale_factor (ACE_UINT32 gsf); + static void global_scale_factor (global_scale_factor_type gsf); /// Returns the global_scale_factor. - static ACE_UINT32 global_scale_factor (void); + static global_scale_factor_type global_scale_factor (void); #ifndef ACE_HR_SCALE_CONVERSION # define ACE_HR_SCALE_CONVERSION (ACE_ONE_SECOND_IN_USECS) @@ -164,11 +168,6 @@ public: void stop (const ACE_OS::ACE_HRTimer_Op = ACE_OS::ACE_HRTIMER_GETTIME); /// Set @a tv to the number of microseconds elapsed. - /** - * Could overflow within hours on windows with emulated 64 bit int's - * and a fast counter. VC++ and Borland normaly use __int64 and - * so normaly don't have this problem. - */ void elapsed_time (ACE_Time_Value &tv) const; /// Set @a nanoseconds to the number of nanoseconds elapsed. @@ -200,7 +199,7 @@ public: /// to start_incr and stop_incr. void elapsed_time_incr (ACE_Time_Value &tv) const; - /// Set <nsec> to the number of nanoseconds elapsed between all calls + /// Set @a nanoseconds to the number of nanoseconds elapsed between all calls /// to start_incr and stop_incr. void elapsed_time_incr (ACE_hrtime_t &nanoseconds) const; @@ -249,14 +248,14 @@ public: static void hrtime_to_tv (ACE_Time_Value &tv, const ACE_hrtime_t hrt); -#if defined (linux) +#if defined (ACE_LINUX) /** * This is used to find out the Mhz of the machine for the scale * factor. If there are any problems getting it, we just return 1 * (the default). */ static ACE_UINT32 get_cpuinfo (void); -#endif /* defined (linux) */ +#endif /* defined (ACE_LINUX) */ private: /** @@ -289,7 +288,7 @@ private: /// Converts ticks to microseconds. That is, ticks / /// global_scale_factor_ == microseconds. - static ACE_UINT32 global_scale_factor_; + static global_scale_factor_type global_scale_factor_; /** * Indicates the status of the global scale factor, diff --git a/dep/acelite/ace/High_Res_Timer.inl b/dep/acelite/ace/High_Res_Timer.inl index 06241dc0dfc..c22c47cc3f3 100644 --- a/dep/acelite/ace/High_Res_Timer.inl +++ b/dep/acelite/ace/High_Res_Timer.inl @@ -1,6 +1,5 @@ // -*- C++ -*- */ -// -// $Id: High_Res_Timer.inl 89483 2010-03-15 09:48:01Z johnnyw $ +// $Id: High_Res_Timer.inl 95798 2012-05-31 07:58:55Z johnnyw $ #include "ace/Global_Macros.h" @@ -10,32 +9,40 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// Be very careful before changing the calculations inside -// ACE_High_Res_Timer. The precision matters and we are using integer -// calculations not floating point. Also look closely at the emulated 64 -// bit int class (inside Basic_Types{h,i,cpp} before changing -// anything. It's operator/ only returns 32 bits not 64 bits, among -// other things. - +/// Be very careful before changing the calculations inside +/// ACE_High_Res_Timer. The precision matters and we are using integer +/// calculations not floating point. ACE_INLINE void ACE_High_Res_Timer::hrtime_to_tv (ACE_Time_Value &tv, const ACE_hrtime_t hrt) { - // The following are based on the units of global_scale_factor_ - // being 1/microsecond. Therefore, dividing by it converts - // clock ticks to microseconds. - tv.sec ((long) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION / +#if !defined (ACE_WIN32) + // The following are based on the units of global_scale_factor_ + // being 1/microsecond. Therefore, dividing by it converts + // clock ticks to microseconds. + tv.sec ((time_t) (hrt / (ACE_UINT32) ACE_HR_SCALE_CONVERSION / global_scale_factor ())); - // Calculate usec in a manner that's compatible with ACE_U_LongLong. - // hrt = (tv.sec * ACE_ONE_SECOND_IN_USECS + tv.usec) * global_scale_factor_ - // tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS - // That first term will be lossy, so factor out global_scale_factor_: - // tv.usec = (hrt - tv.sec * ACE_ONE_SECOND_IN_USECS * global_scale_factor_)/ - // global_scale_factor - ACE_hrtime_t tmp = tv.sec (); - tmp *= ((ACE_UINT32) ACE_HR_SCALE_CONVERSION * global_scale_factor ()); - tv.usec ((long) ((hrt - tmp) / global_scale_factor ())); + // hrt = (tv.sec * ACE_ONE_SECOND_IN_USECS + tv.usec) * global_scale_factor_ + // tv.usec = hrt / global_scale_factor_ - tv.sec * ACE_ONE_SECOND_IN_USECS + // That first term will be lossy, so factor out global_scale_factor_: + // tv.usec = (hrt - tv.sec * ACE_ONE_SECOND_IN_USECS * global_scale_factor_)/ + // global_scale_factor + ACE_hrtime_t tmp = tv.sec (); + tmp *= ((ACE_UINT32) ACE_HR_SCALE_CONVERSION * global_scale_factor ()); + tv.usec ((suseconds_t) ((hrt - tmp) / global_scale_factor ())); +#else + // This a higher-precision version, specific for Windows systems + // The following are based on the units of global_scale_factor_ + // being 1/microsecond. Therefore, dividing by it converts + // clock ticks to microseconds. + tv.sec ((time_t) (hrt / global_scale_factor () )); + + // Calculate usec, first calculate the seconds in hrtime + ACE_High_Res_Timer::global_scale_factor_type tmp = tv.sec (); + tmp *= global_scale_factor (); + tv.usec ((suseconds_t) ((hrt - tmp) * ACE_HR_SCALE_CONVERSION / global_scale_factor ())); +#endif } @@ -57,13 +64,12 @@ ACE_High_Res_Timer::gettimeofday (const ACE_OS::ACE_HRTimer_Op op) return tv; } - -// Get the current high res timer as the time of day. This is intended -// to be used for a gettimeofday replacement in ACE_Timer_Queue and -// derived classes so the timers will bebased on high res timers rather -// than wall clock time. It uses the ACE_High_Res_Timer::gettimeofday -// function, which is deprecated. If it gets removed, please move the -// code down here, intact. +/// Get the current high res timer as the time of day. This is intended +/// to be used for a gettimeofday replacement in ACE_Timer_Queue and +/// derived classes so the timers will be based on high res timers rather +/// than wall clock time. It uses the ACE_High_Res_Timer::gettimeofday +/// function, which is deprecated. If it gets removed, please move the +/// code down here, intact. ACE_INLINE ACE_Time_Value ACE_High_Res_Timer::gettimeofday_hr (void) { @@ -139,13 +145,21 @@ ACE_High_Res_Timer::stop_incr (const ACE_OS::ACE_HRTimer_Op op) ACE_INLINE void ACE_High_Res_Timer::elapsed_microseconds (ACE_hrtime_t &usecs) const { + +#if !defined (ACE_WIN32) ACE_hrtime_t elapsed = ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_); usecs = (ACE_hrtime_t) (elapsed / global_scale_factor ()); +#else + usecs = (ACE_High_Res_Timer::elapsed_hrtime (this->end_, this->start_) * + ACE_HR_SCALE_CONVERSION) / + global_scale_factor (); +#endif } ACE_INLINE void -ACE_High_Res_Timer::global_scale_factor (ACE_UINT32 gsf) +ACE_High_Res_Timer::global_scale_factor ( + ACE_High_Res_Timer::global_scale_factor_type gsf) { global_scale_factor_ = gsf; } diff --git a/dep/acelite/ace/ICMP_Socket.cpp b/dep/acelite/ace/ICMP_Socket.cpp index 5247dc4b83a..04ac2611d75 100644 --- a/dep/acelite/ace/ICMP_Socket.cpp +++ b/dep/acelite/ace/ICMP_Socket.cpp @@ -1,4 +1,4 @@ -// $Id: ICMP_Socket.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: ICMP_Socket.cpp 93560 2011-03-16 13:54:49Z johnnyw $ #include "ace/ICMP_Socket.h" @@ -85,9 +85,9 @@ ACE_ICMP_Socket::open (ACE_Addr const & local, // Check if icmp protocol is supported on this host int proto_number = -1; - protoent *proto; + protoent *proto = 0; - if (! (proto = getprotobyname ("icmp"))) + if (! (proto = ACE_OS::getprotobyname ("icmp"))) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/dep/acelite/ace/INET_Addr.cpp b/dep/acelite/ace/INET_Addr.cpp index 6dba7150f93..a41b0e4406f 100644 --- a/dep/acelite/ace/INET_Addr.cpp +++ b/dep/acelite/ace/INET_Addr.cpp @@ -1,4 +1,4 @@ -// $Id: INET_Addr.cpp 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: INET_Addr.cpp 95533 2012-02-14 22:59:17Z wotte $ // Defines the Internet domain address family address format. @@ -334,48 +334,67 @@ ACE_INET_Addr::set (u_short port_number, sizeof this->inet_addr_); #if defined (ACE_HAS_IPV6) - struct addrinfo hints; - struct addrinfo *res = 0; - int error = 0; - ACE_OS::memset (&hints, 0, sizeof (hints)); -# if defined (ACE_USES_IPV4_IPV6_MIGRATION) - if (address_family == AF_UNSPEC && !ACE::ipv6_enabled()) + // Let the IPv4 case fall through to the non-IPv6-capable section. + // We don't need the additional getaddrinfo() capability and the Linux + // getaddrinfo() is substantially slower than gethostbyname() w/ + // large vlans. +# if defined (ACE_USES_IPV4_IPV6_MIGRATION) + if (address_family == AF_UNSPEC && !ACE::ipv6_enabled ()) address_family = AF_INET; -# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ - if (address_family == AF_UNSPEC || address_family == AF_INET6) +# endif /* ACE_USES_IPV4_IPV6_MIGRATION */ + if (address_family != AF_INET) { - hints.ai_family = AF_INET6; - error = ::getaddrinfo (host_name, 0, &hints, &res); - if (error) +# if defined (ACE_HAS_GETHOSTBYNAME2) + hostent hentry; + hostent *hp; + ACE_HOSTENT_DATA buf; + int h_error = 0; // Not the same as errno! + + if (0 == ::gethostbyname2_r (host_name, AF_INET6, &hentry, + buf, sizeof(buf), &hp, &h_error)) { - if (address_family == AF_INET6) + if (hp != 0) { - if (res) - ::freeaddrinfo(res); - errno = error; - return -1; + struct sockaddr_in6 v6; + ACE_OS::memset (&v6, 0, sizeof (v6)); + v6.sin6_family = AF_INET6; + (void) ACE_OS::memcpy ((void *) &v6.sin6_addr, + hp->h_addr, + hp->h_length); + this->set_type (hp->h_addrtype); + this->set_addr (&v6, hp->h_length); + this->set_port_number (port_number, encode); + return 0; } - address_family = AF_INET; } - } - if (address_family == AF_INET) - { - hints.ai_family = AF_INET; - error = ::getaddrinfo (host_name, 0, &hints, &res); - if (error) + errno = h_error; + if (address_family == AF_INET6) + return -1; +# else + struct addrinfo hints; + struct addrinfo *res = 0; + int error = 0; + ACE_OS::memset (&hints, 0, sizeof (hints)); + hints.ai_family = AF_INET6; + if ((error = ::getaddrinfo (host_name, 0, &hints, &res)) == 0) + { + this->set_type (res->ai_family); + this->set_addr (res->ai_addr, res->ai_addrlen); + this->set_port_number (port_number, encode); + ::freeaddrinfo (res); + return 0; + } + if (address_family == AF_INET6) { if (res) ::freeaddrinfo(res); errno = error; return -1; } +# endif /* ACE_HAS_GETHOSTBYNAME2 */ + // Let AF_UNSPEC try again w/ IPv4. } - this->set_type (res->ai_family); - this->set_addr (res->ai_addr, res->ai_addrlen); - this->set_port_number (port_number, encode); - ::freeaddrinfo (res); - return 0; -#else /* ACE_HAS_IPV6 */ +#endif /* ACE_HAS_IPV6 */ // IPv6 not supported... insure the family is set to IPv4 address_family = AF_INET; @@ -392,9 +411,6 @@ ACE_INET_Addr::set (u_short port_number, encode); else { -# if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) - hostent *hp = ACE_OS::gethostbyname (host_name); -# else hostent hentry; ACE_HOSTENT_DATA buf; int h_error = 0; // Not the same as errno! @@ -403,7 +419,6 @@ ACE_INET_Addr::set (u_short port_number, buf, &h_error); if (hp == 0) errno = h_error; -# endif /* ACE_VXWORKS */ if (hp == 0) { @@ -419,7 +434,6 @@ ACE_INET_Addr::set (u_short port_number, encode); } } -#endif /* ACE_HAS_IPV6 */ } // Helper function to get a port number from a port name. @@ -839,19 +853,6 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const } else { -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) - ACE_UNUSED_ARG (len); - int error = - ::hostGetByAddr ((int) this->inet_addr_.in4_.sin_addr.s_addr, - hostname); - if (error == OK) - return 0; - else - { - errno = error; - return -1; - } -#else void* addr = this->ip_addr_pointer (); int size = this->ip_addr_size (); int type = this->get_type (); @@ -901,7 +902,6 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const ACE_OS::strcpy (hostname, hp->h_name); return 0; -#endif /* ACE_VXWORKS */ } } @@ -1008,7 +1008,7 @@ int ACE_INET_Addr::set_address (const char *ip_addr, } -#if (defined (__linux__) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) +#if (defined (ACE_LINUX) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) int ACE_INET_Addr::set_interface (const char *intf_name) { @@ -1016,7 +1016,7 @@ ACE_INET_Addr::set_interface (const char *intf_name) (IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr))) { -#if defined (__linux__) +#if defined (ACE_LINUX) this->inet_addr_.in6_.sin6_scope_id = ACE_OS::if_nametoindex (intf_name); #else @@ -1033,7 +1033,7 @@ ACE_INET_Addr::set_interface (const char *intf_name) return 0; } -#endif /* __linux && ACE_HAS_IPV6 */ +#endif /* ACE_LINUX && ACE_HAS_IPV6 */ const char * ACE_INET_Addr::get_host_addr (char *dst, int size) const @@ -1070,7 +1070,7 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const &this->inet_addr_.in6_.sin6_addr, dst, size); -#if defined (__linux__) +#if defined (ACE_LINUX) if ((IN6_IS_ADDR_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr) || IN6_IS_ADDR_MC_LINKLOCAL (&this->inet_addr_.in6_.sin6_addr)) && this->inet_addr_.in6_.sin6_scope_id != 0) diff --git a/dep/acelite/ace/INET_Addr.h b/dep/acelite/ace/INET_Addr.h index fcd26d0de2f..3272a96a566 100644 --- a/dep/acelite/ace/INET_Addr.h +++ b/dep/acelite/ace/INET_Addr.h @@ -4,7 +4,7 @@ /** * @file INET_Addr.h * - * $Id: INET_Addr.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: INET_Addr.h 95533 2012-02-14 22:59:17Z wotte $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -250,13 +250,13 @@ public: int encode = 1, int map = 0); -#if (defined (__linux__) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) +#if (defined (ACE_LINUX) || defined (ACE_WIN32)) && defined (ACE_HAS_IPV6) /** * Sets the interface that should be used for this address. This only has * an effect when the address is link local, otherwise it does nothing. */ int set_interface (const char *intf_name); -#endif /* (__linux__ || ACE_WIN32) && ACE_HAS_IPV6 */ +#endif /* (ACE_LINUX || ACE_WIN32) && ACE_HAS_IPV6 */ /// Return the port number, converting it into host byte-order. u_short get_port_number (void) const; diff --git a/dep/acelite/ace/INET_Addr.inl b/dep/acelite/ace/INET_Addr.inl index 06460cb7857..eb3923185a2 100644 --- a/dep/acelite/ace/INET_Addr.inl +++ b/dep/acelite/ace/INET_Addr.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: INET_Addr.inl 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: INET_Addr.inl 96017 2012-08-08 22:18:09Z mitza $ #include "ace/OS_NS_string.h" @@ -87,7 +87,11 @@ ACE_INET_Addr::get_port_number (void) const else return ACE_NTOHS (this->inet_addr_.in6_.sin6_port); #else +# if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 + return static_cast<u_short> (ACE_NTOHS (this->inet_addr_.in4_.sin_port)); +# else return ACE_NTOHS (this->inet_addr_.in4_.sin_port); +# endif #endif /* ACE_HAS_IPV6 */ } diff --git a/dep/acelite/ace/IOStream.cpp b/dep/acelite/ace/IOStream.cpp index 99065091a4c..59d0191f49f 100644 --- a/dep/acelite/ace/IOStream.cpp +++ b/dep/acelite/ace/IOStream.cpp @@ -1,12 +1,10 @@ -// $Id: IOStream.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: IOStream.cpp 93359 2011-02-11 11:33:12Z mcorino $ #ifndef ACE_IOSTREAM_CPP #define ACE_IOSTREAM_CPP #include "ace/IOStream.h" - - #if !defined (ACE_LACKS_ACE_IOSTREAM) # include "ace/OS_NS_errno.h" diff --git a/dep/acelite/ace/IOStream.h b/dep/acelite/ace/IOStream.h index de154cd1b10..97bbc23b712 100644 --- a/dep/acelite/ace/IOStream.h +++ b/dep/acelite/ace/IOStream.h @@ -4,7 +4,7 @@ /** * @file IOStream.h * - * $Id: IOStream.h 92102 2010-09-30 08:14:15Z johnnyw $ + * $Id: IOStream.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author James CE Johnson <jcej@lads.com> * @author Jim Crossley <jim@lads.com> @@ -156,7 +156,7 @@ class ACE_Export ACE_Streambuf : public streambuf public: /** - * If the default allocation strategey were used the common buffer + * If the default allocation strategy were used the common buffer * would be deleted when the object destructs. Since we are * providing separate read/write buffers, it is up to us to manage * their memory. @@ -274,11 +274,11 @@ protected: */ int syncin (void); - /// syncout is called when the output needs to be flushed. This is + /// syncout() is called when the output needs to be flushed. This is /// easily done by calling the peer's send_n function. int syncout (void); - /// flushbuf is the worker of syncout. It is a separate function + /// flushbuf() is the worker of syncout. It is a separate function /// because it gets used sometimes in different context. int flushbuf (void); diff --git a/dep/acelite/ace/IOStream_T.h b/dep/acelite/ace/IOStream_T.h index 286f1a714d5..6a6cda5703e 100644 --- a/dep/acelite/ace/IOStream_T.h +++ b/dep/acelite/ace/IOStream_T.h @@ -4,7 +4,7 @@ /** * @file IOStream_T.h * - * $Id: IOStream_T.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: IOStream_T.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author James CE Johnson <jcej@lads.com> * @author Jim Crossley <jim@lads.com> @@ -116,7 +116,7 @@ public: u_int streambuf_size = ACE_STREAMBUF_SIZE); /** - * The default constructor. This will initiailze your STREAM and + * The default constructor. This will initialize your STREAM and * then setup the iostream baseclass to use a custom streambuf based * on STREAM. */ @@ -126,7 +126,7 @@ public: /// to the <iostream> base class; virtual ~ACE_IOStream (void); - /// The only ambituity in the multiple inheritance is the <close> + /// The only ambiguity in the multiple inheritance is the <close> /// function. virtual int close (void); diff --git a/dep/acelite/ace/IO_SAP.cpp b/dep/acelite/ace/IO_SAP.cpp index 139eb50b3c5..d4bca8c88a1 100644 --- a/dep/acelite/ace/IO_SAP.cpp +++ b/dep/acelite/ace/IO_SAP.cpp @@ -1,4 +1,4 @@ -// $Id: IO_SAP.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: IO_SAP.cpp 93736 2011-04-05 12:38:35Z johnnyw $ #include "ace/IO_SAP.h" @@ -12,8 +12,6 @@ #include "ace/IO_SAP.inl" #endif /* __ACE_INLINE__ */ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP) diff --git a/dep/acelite/ace/IO_SAP.inl b/dep/acelite/ace/IO_SAP.inl index 78b2ee31fc0..4c3182fa609 100644 --- a/dep/acelite/ace/IO_SAP.inl +++ b/dep/acelite/ace/IO_SAP.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: IO_SAP.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: IO_SAP.inl 93736 2011-04-05 12:38:35Z johnnyw $ #include "ace/OS_NS_stropts.h" diff --git a/dep/acelite/ace/Lib_Find.cpp b/dep/acelite/ace/Lib_Find.cpp index c5a0610f065..6c63df21b55 100644 --- a/dep/acelite/ace/Lib_Find.cpp +++ b/dep/acelite/ace/Lib_Find.cpp @@ -1,4 +1,4 @@ -// $Id: Lib_Find.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Lib_Find.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #include "ace/Lib_Find.h" #include "ace/Log_Msg.h" @@ -608,7 +608,13 @@ ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) const char *tmpdir = ACE_OS::getenv ("TMPDIR"); if (tmpdir == 0) - tmpdir = "/tmp"; + { +#if defined (ACE_DEFAULT_TEMP_DIR) + tmpdir = ACE_DEFAULT_TEMP_DIR; +#else + tmpdir = "/tmp"; +#endif + } size_t len = ACE_OS::strlen (tmpdir); @@ -653,7 +659,10 @@ ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm) // Unlink it so that the file will be removed automatically when the // process goes away. if (ACE_OS::unlink (name) == -1) - return ACE_INVALID_HANDLE; + { + ACE_OS::close (handle); + return ACE_INVALID_HANDLE; + } else // Return the handle. return handle; diff --git a/dep/acelite/ace/Lib_Find.h b/dep/acelite/ace/Lib_Find.h index 133b83ffb7b..1ed2d8e72bc 100644 --- a/dep/acelite/ace/Lib_Find.h +++ b/dep/acelite/ace/Lib_Find.h @@ -7,7 +7,7 @@ * All the static function calls needed to search and open shared * libraries. * - * $Id: Lib_Find.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Lib_Find.h 93359 2011-02-11 11:33:12Z mcorino $ */ //============================================================================= @@ -101,10 +101,10 @@ namespace ACE extern ACE_Export size_t strrepl (char *s, char search, char replace); /** - * Splits string <s> into pieces separated by the string <token>. - * <next_start> is an opaque cookie handed back by the call to store + * Splits string @a s into pieces separated by the string @a token. + * @a next_start is an opaque cookie handed back by the call to store * its state for the next invocation, thus making it re-entrant. - * This operates very similar to Perl's <split> function except that + * This operates very similar to Perl's @c split function except that * it returns pieces one at a time instead of into an array. */ extern ACE_Export char *strsplit_r (char *s, diff --git a/dep/acelite/ace/Local_Name_Space_T.h b/dep/acelite/ace/Local_Name_Space_T.h index 56b445b4de8..33f9acc7602 100644 --- a/dep/acelite/ace/Local_Name_Space_T.h +++ b/dep/acelite/ace/Local_Name_Space_T.h @@ -4,7 +4,7 @@ /** * @file Local_Name_Space_T.h * - * $Id: Local_Name_Space_T.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Local_Name_Space_T.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Prashant Jain <pjain@cs.wustl.edu> * @author Irfan Pyarali <irfan@wuerl.wustl.edu> and @@ -135,13 +135,13 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Local_Name_Space or bind a new name to the context, if it - * didn't exist yet. (Wide charcter strings interface). + * didn't exist yet. (Wide character strings interface). */ virtual int rebind (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type = ""); - /// Delete a name from a ACE_Local_Name_Space (Wide charcter strings + /// Delete a name from a ACE_Local_Name_Space (Wide character strings /// Interface). virtual int unbind (const ACE_NS_WString &name); virtual int unbind_i (const ACE_NS_WString &name); diff --git a/dep/acelite/ace/Local_Tokens.h b/dep/acelite/ace/Local_Tokens.h index a555370364a..72e528bfd79 100644 --- a/dep/acelite/ace/Local_Tokens.h +++ b/dep/acelite/ace/Local_Tokens.h @@ -4,7 +4,7 @@ /** * @file Local_Tokens.h * - * $Id: Local_Tokens.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Local_Tokens.h 93792 2011-04-07 11:48:50Z mcorino $ * * @author Karl-Heinz Dorn <kdorn@erlh.siemens.de> * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> @@ -408,13 +408,13 @@ public: typedef ACE_Unbounded_Stack<ACE_TPQ_Entry *> OWNER_STACK; /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If <id> is non-zero, returns 1 if id is an owner. + /// success. If @a id is non-zero, returns 1 if id is an owner. virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id) = 0; - /// Returns 1 if <id> is waiting for this token. 0 otherwise. + /// Returns 1 if @a id is waiting for this token. 0 otherwise. virtual int is_waiting_for (const ACE_TCHAR *id) = 0; - /// Returns 1 if <id> is an owner of this token. 0 otherwise. + /// Returns 1 if @a id is an owner of this token. 0 otherwise. virtual int is_owner (const ACE_TCHAR *id) = 0; /// Return the queue of waiters. @@ -562,13 +562,13 @@ public: virtual int type (void) const; /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If <id> is non-zero, returns 1 if id is an owner. + /// success. If @a id is non-zero, returns 1 if id is an owner. virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id); - /// Returns 1 if <id> is waiting for this token. 0 otherwise. + /// Returns 1 if @a id is waiting for this token. 0 otherwise. virtual int is_waiting_for (const ACE_TCHAR *id); - /// Returns 1 if <id> is an owner of this token. 0 otherwise. + /// Returns 1 if @a id is an owner of this token. 0 otherwise. virtual int is_owner (const ACE_TCHAR *id); private: @@ -660,13 +660,13 @@ public: virtual int type (void) const; /// Returns a stack of the current owners. Returns -1 on error, 0 on - /// success. If <id> is non-zero, returns 1 if id is an owner. + /// success. If @a id is non-zero, returns 1 if id is an owner. virtual int owners (OWNER_STACK &o, const ACE_TCHAR *id); - /// Returns 1 if <id> is waiting for this token. 0 otherwise. + /// Returns 1 if @a id is waiting for this token. 0 otherwise. virtual int is_waiting_for (const ACE_TCHAR *id); - /// Returns 1 if <id> is an owner of this token. 0 otherwise. + /// Returns 1 if @a id is an owner of this token. 0 otherwise. virtual int is_owner (const ACE_TCHAR *id); protected: diff --git a/dep/acelite/ace/Lock.h b/dep/acelite/ace/Lock.h index 36f99939b56..cbf41306df3 100644 --- a/dep/acelite/ace/Lock.h +++ b/dep/acelite/ace/Lock.h @@ -4,7 +4,7 @@ /** * @file Lock.h * - * $Id: Lock.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Lock.h 93792 2011-04-07 11:48:50Z mcorino $ * * Moved from Synch.h. * @@ -43,7 +43,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Lock { public: - /// CE needs a default ctor here. + /// CE needs a default constructor here. ACE_Lock (void); /// Noop virtual destructor @@ -73,20 +73,20 @@ public: /** * Block until the thread acquires a read lock. If the locking * mechanism doesn't support read locks then this just calls - * <acquire>. Returns -1 on failure. + * acquire(). Returns -1 on failure. */ virtual int acquire_read (void) = 0; /** * Block until the thread acquires a write lock. If the locking * mechanism doesn't support read locks then this just calls - * <acquire>. Returns -1 on failure. + * acquire(). Returns -1 on failure. */ virtual int acquire_write (void) = 0; /** * Conditionally acquire a read lock. If the locking mechanism - * doesn't support read locks then this just calls <acquire>. + * doesn't support read locks then this just calls acquire(). * Returns -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. */ @@ -94,7 +94,7 @@ public: /** * Conditionally acquire a write lock. If the locking mechanism - * doesn't support read locks then this just calls <acquire>. + * doesn't support read locks then this just calls acquire(). * Returns -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. */ @@ -103,7 +103,7 @@ public: /** * Conditionally try to upgrade a lock held for read to a write lock. * If the locking mechanism doesn't support read locks then this just - * calls <acquire>. Returns 0 on success, -1 on failure. + * calls acquire(). Returns 0 on success, -1 on failure. */ virtual int tryacquire_write_upgrade (void) = 0; }; @@ -118,13 +118,13 @@ public: * However, it defers our decision of what kind of lock to use * to the run time and delegates all locking operations to the actual * lock. Users must define a constructor in their subclass to - * initialize <lock_>. + * initialize @c lock_. */ class ACE_Export ACE_Adaptive_Lock : public ACE_Lock { public: /// You must also override the destructor function to match with how - /// you construct the underneath <lock_>. + /// you construct the underneath @c lock_. virtual ~ACE_Adaptive_Lock (void); // = Lock/unlock operations. @@ -142,8 +142,8 @@ public: protected: /** - * Create and initialize create the actual lcok used in the class. - * The default constructor simply set the <lock_> to 0 (null). You + * Create and initialize create the actual lock used in the class. + * The default constructor simply set the @c lock_ to 0 (null). You * must overwrite this method for this class to work. */ ACE_Adaptive_Lock (void); diff --git a/dep/acelite/ace/Lock_Adapter_T.cpp b/dep/acelite/ace/Lock_Adapter_T.cpp index fbe43afd217..abe6190866d 100644 --- a/dep/acelite/ace/Lock_Adapter_T.cpp +++ b/dep/acelite/ace/Lock_Adapter_T.cpp @@ -1,4 +1,4 @@ -// $Id: Lock_Adapter_T.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Lock_Adapter_T.cpp 93359 2011-02-11 11:33:12Z mcorino $ #ifndef ACE_LOCK_ADAPTER_T_CPP #define ACE_LOCK_ADAPTER_T_CPP @@ -16,17 +16,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// This constructor isn't inlined, because SunPRO C++ 4.2 + patch -// 104631-07 has trouble compiling TAO with it inline. -template <class ACE_LOCKING_MECHANISM> -ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (void) - : lock_ (0), - delete_lock_ (true) -{ - ACE_NEW (this->lock_, - ACE_LOCKING_MECHANISM); -} - template <class ACE_LOCKING_MECHANISM> ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::~ACE_Lock_Adapter (void) { diff --git a/dep/acelite/ace/Lock_Adapter_T.h b/dep/acelite/ace/Lock_Adapter_T.h index 2fe38302ed4..3785d7a2d39 100644 --- a/dep/acelite/ace/Lock_Adapter_T.h +++ b/dep/acelite/ace/Lock_Adapter_T.h @@ -4,7 +4,7 @@ /** * @file Lock_Adapter_T.h * - * $Id: Lock_Adapter_T.h 84481 2009-02-17 10:58:31Z johnnyw $ + * $Id: Lock_Adapter_T.h 93359 2011-02-11 11:33:12Z mcorino $ * * Moved from Synch.h. * @@ -28,7 +28,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * @class ACE_Lock_Adapter * * @brief This is an adapter that allows applications to transparently - * combine the <ACE_Lock> abstract base class (which contains + * combine the ACE_Lock abstract base class (which contains * pure virtual methods) with any of the other concrete ACE * synchronization classes (e.g., ACE_Mutex, ACE_Semaphore, * ACE_RW_Mutex, etc.). @@ -50,7 +50,7 @@ public: /// created internally. ACE_Lock_Adapter (void); - /// Destructor. If <lock_> was not passed in by the user, it will be + /// Destructor. If @c lock_ was not passed in by the user, it will be /// deleted. virtual ~ACE_Lock_Adapter (void); @@ -67,29 +67,29 @@ public: /** * Block until the thread acquires a read lock. If the locking * mechanism doesn't support read locks then this just calls - * <acquire>. + * acquire(). */ virtual int acquire_read (void); /** * Block until the thread acquires a write lock. If the locking * mechanism doesn't support read locks then this just calls - * <acquire>. + * acquire(). */ virtual int acquire_write (void); /// Conditionally acquire a read lock. If the locking mechanism - /// doesn't support read locks then this just calls <acquire>. + /// doesn't support read locks then this just calls acquire(). virtual int tryacquire_read (void); /// Conditionally acquire a write lock. If the locking mechanism - /// doesn't support read locks then this just calls <acquire>. + /// doesn't support read locks then this just calls acquire(). virtual int tryacquire_write (void); /** * Conditionally try to upgrade a lock held for read to a write lock. * If the locking mechanism doesn't support read locks then this just - * calls <acquire>. Returns 0 on success, -1 on failure. + * calls acquire(). Returns 0 on success, -1 on failure. */ virtual int tryacquire_write_upgrade (void); diff --git a/dep/acelite/ace/Lock_Adapter_T.inl b/dep/acelite/ace/Lock_Adapter_T.inl index ff102b59d4a..4ffaf6cb69b 100644 --- a/dep/acelite/ace/Lock_Adapter_T.inl +++ b/dep/acelite/ace/Lock_Adapter_T.inl @@ -1,6 +1,8 @@ // -*- C++ -*- // -// $Id: Lock_Adapter_T.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Lock_Adapter_T.inl 93385 2011-02-14 20:21:20Z mitza $ + +#include "ace/OS_Memory.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -13,4 +15,14 @@ ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter ( { } +template <class ACE_LOCKING_MECHANISM> +ACE_INLINE +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (void) + : lock_ (0), + delete_lock_ (true) +{ + ACE_NEW (this->lock_, + ACE_LOCKING_MECHANISM); +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Log_Msg.cpp b/dep/acelite/ace/Log_Msg.cpp index 3df89332aea..676236b72ca 100644 --- a/dep/acelite/ace/Log_Msg.cpp +++ b/dep/acelite/ace/Log_Msg.cpp @@ -1,4 +1,4 @@ -// $Id: Log_Msg.cpp 92052 2010-09-27 14:20:22Z vzykov $ +// $Id: Log_Msg.cpp 95761 2012-05-15 18:23:04Z johnnyw $ // We need this to get the status of ACE_NTRACE... #include "ace/config-all.h" @@ -57,16 +57,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ defined (ACE_HAS_TSS_EMULATION) -#if defined (ACE_MVS) - static ACE_thread_key_t the_log_msg_tss_key = - #if !defined(_LP64) - { '\0','\0','\0','\0' }; - #else - { '\0','\0','\0','\0','\0','\0','\0','\0' }; - #endif -#else - static ACE_thread_key_t the_log_msg_tss_key = 0; -#endif /* defined (ACE_MVS) */ +static ACE_thread_key_t the_log_msg_tss_key = 0; ACE_thread_key_t *log_msg_tss_key (void) { @@ -1051,27 +1042,30 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, } if (timestamp_ > 0) - { - ACE_TCHAR day_and_time[35]; - const ACE_TCHAR *s = 0; - if (timestamp_ == 1) - { - // Print just the time - s = ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR), 1); - } - else - { - // Print time and date - ACE::timestamp (day_and_time, sizeof day_and_time / sizeof (ACE_TCHAR)); - s = day_and_time; - } - - for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace) - ++bp; - - *bp++ = '|'; - --bspace; - } + { + ACE_TCHAR day_and_time[27]; + const ACE_TCHAR *s = 0; + if (timestamp_ == 1) + { + // Print just the time + s = ACE::timestamp (day_and_time, + sizeof (day_and_time) / sizeof (ACE_TCHAR), + true); + } + else + { + // Print time and date + ACE::timestamp (day_and_time, + sizeof (day_and_time) / sizeof (ACE_TCHAR)); + s = day_and_time; + } + + for (; bspace > 1 && (*bp = *s) != '\0'; ++s, --bspace) + ++bp; + + *bp++ = '|'; + --bspace; + } while (*format_str != '\0' && bspace > 0) { @@ -1106,7 +1100,8 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, const ACE_TCHAR *abort_str = ACE_TEXT ("Aborting..."); const ACE_TCHAR *start_format = format_str; ACE_TCHAR format[128]; // Converted format string - ACE_TCHAR *fp; // Current format pointer + ACE_OS::memset (format, '\0', 128); // Set this string to known values. + ACE_TCHAR *fp = 0; // Current format pointer int wp = 0; // Width/precision extracted from args bool done = false; bool skip_nul_locate = false; @@ -1647,21 +1642,23 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, } case 'D': // Format the timestamp in format: - // Weekday Month day year hour:minute:sec.usec + // yyyy-mm-dd hour:minute:sec.usec + // This is a maximum of 27 characters + // including terminator. { - ACE_TCHAR day_and_time[35]; + ACE_TCHAR day_and_time[27]; // Did we find the flag indicating a time value argument if (format[1] == ACE_TEXT('#')) { ACE_Time_Value* time_value = va_arg (argp, ACE_Time_Value*); ACE::timestamp (*time_value, day_and_time, - sizeof day_and_time / sizeof (ACE_TCHAR)); + sizeof (day_and_time) / sizeof (ACE_TCHAR)); } else { ACE::timestamp (day_and_time, - sizeof day_and_time / sizeof (ACE_TCHAR)); + sizeof (day_and_time) / sizeof (ACE_TCHAR)); } #if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) ACE_OS::strcpy (fp, ACE_TEXT ("ls")); @@ -1678,9 +1675,9 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, } case 'T': // Format the timestamp in - // hour:minute:sec:usec format. + // hour:minute:sec.usec format. { - ACE_TCHAR day_and_time[35]; + ACE_TCHAR day_and_time[27]; #if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) ACE_OS::strcpy (fp, ACE_TEXT ("ls")); #else @@ -1733,15 +1730,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, ACE_hthread_t t_id; ACE_OS::thr_self (t_id); -# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS) - // MVS's pthread_t is a struct... yuck. So use the ACE 5.0 - // code for it. - ACE_OS::strcpy (fp, ACE_TEXT ("u")); - if (can_check) - this_len = ACE_OS::snprintf (bp, bspace, format, t_id); - else - this_len = ACE_OS::sprintf (bp, format, t_id); -# else // Yes, this is an ugly C-style cast, but the correct // C++ cast is different depending on whether the t_id // is an integral type or a pointer type. FreeBSD uses @@ -1754,7 +1742,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, else this_len = ACE_OS::sprintf (bp, format, (unsigned long)t_id); -# endif /* ACE_MWS || ACE_TANDEM_T1248_PTHREADS */ #endif /* ACE_WIN32 */ ACE_UPDATE_COUNT (bspace, this_len); @@ -1981,21 +1968,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, break; case 'Q': -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - { - // This relies on the ACE_U_LongLong storage layout. - ACE_UINT32 hi = va_arg (argp, ACE_UINT32); - ACE_UINT32 lo = va_arg (argp, ACE_UINT32); - if (hi > 0) - this_len = ACE_OS::sprintf (bp, - "0x%lx%0*lx", - hi, - 2 * sizeof lo, - lo); - else - this_len = ACE_OS::sprintf (bp, "0x%lx", lo); - } -#else /* ! ACE_LACKS_LONGLONG_T */ { const ACE_TCHAR *fmt = ACE_UINT64_FORMAT_SPECIFIER; ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % @@ -2008,15 +1980,10 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, format, va_arg (argp, ACE_UINT64)); } -#endif /* ! ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ ACE_UPDATE_COUNT (bspace, this_len); break; case 'q': - #if defined (ACE_LACKS_LONGLONG_T) - // No implementation available yet, no ACE_INT64 emulation - // available yet - #else /* ! ACE_LACKS_LONGLONG_T */ { const ACE_TCHAR *fmt = ACE_INT64_FORMAT_SPECIFIER; ACE_OS::strcpy (fp, &fmt[1]); // Skip leading % @@ -2029,7 +1996,6 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, format, va_arg (argp, ACE_INT64)); } - #endif /* ! ACE_LACKS_LONGLONG_T */ ACE_UPDATE_COUNT (bspace, this_len); break; diff --git a/dep/acelite/ace/Log_Msg.h b/dep/acelite/ace/Log_Msg.h index 28b00325dc7..28d5944937f 100644 --- a/dep/acelite/ace/Log_Msg.h +++ b/dep/acelite/ace/Log_Msg.h @@ -4,7 +4,7 @@ /** * @file Log_Msg.h * - * $Id: Log_Msg.h 92298 2010-10-21 11:15:17Z johnnyw $ + * $Id: Log_Msg.h 95128 2011-11-27 21:22:15Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -556,16 +556,16 @@ public: size_t size, const ACE_TCHAR *text = 0); - static void init_hook (ACE_OS_Log_Msg_Attributes &attributes -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) - , ACE_SEH_EXCEPT_HANDLER selector = 0 - , ACE_SEH_EXCEPT_HANDLER handler = 0 -# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ /** * Init hook, create a Log_Msg_Attribute object, initialize its * attributes from the TSS Log_Msg and save the object in the * @a attributes argument */ + static void init_hook (ACE_OS_Log_Msg_Attributes &attributes +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) + , ACE_SEH_EXCEPT_HANDLER selector = 0 + , ACE_SEH_EXCEPT_HANDLER handler = 0 +# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ ); /** @@ -633,7 +633,7 @@ private: /** * If we're running in the context of an ACE_Thread_Manager this * will point to the thread descriptor adapter which holds the - * thread descriptor of the thread. This can be used to repidly + * thread descriptor of the thread. This can be used to rapidly * access all thread data kept in ACE_Thread_Descriptor. */ ACE_Thread_Descriptor *thr_desc_; diff --git a/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp b/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp index 50e78754653..ae4e307ec0e 100644 --- a/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp +++ b/dep/acelite/ace/Log_Msg_UNIX_Syslog.cpp @@ -1,4 +1,4 @@ -// $Id: Log_Msg_UNIX_Syslog.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Log_Msg_UNIX_Syslog.cpp 92791 2010-12-04 16:25:22Z shuston $ #include "ace/config-all.h" @@ -110,7 +110,7 @@ ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record) if (ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE) || ACE_BIT_ENABLED (flags, ACE_Log_Msg::VERBOSE_LITE)) { - ACE_TCHAR date_and_time[35]; + ACE_TCHAR date_and_time[27]; if (0 == ACE::timestamp (date_and_time, sizeof (date_and_time), 1)) ACE_OS::strcpy (date_and_time, ACE_TEXT ("<time error>")); const ACE_TCHAR *prio_name = diff --git a/dep/acelite/ace/Log_Record.cpp b/dep/acelite/ace/Log_Record.cpp index cea333a5c1e..b626533b517 100644 --- a/dep/acelite/ace/Log_Record.cpp +++ b/dep/acelite/ace/Log_Record.cpp @@ -1,11 +1,10 @@ -// $Id: Log_Record.cpp 91764 2010-09-14 13:04:37Z johnnyw $ +// $Id: Log_Record.cpp 92791 2010-12-04 16:25:22Z shuston $ #include "ace/Log_Record.h" #include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_time.h" #include "ace/CDR_Stream.h" #include "ace/Auto_Ptr.h" #include "ace/Truncate.h" @@ -214,18 +213,16 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], u_long verbose_flag, ACE_TCHAR *verbose_msg) { - /* 0123456789012345678901234 */ - /* Oct 18 14:25:36.000 1989<nul> */ - ACE_TCHAR timestamp[26]; // Only used by VERBOSE and VERBOSE_LITE. + /* 012345678901234567890123456 */ + /* yyyy-mm-dd hh:mm:ss.mmmmmm<nul> */ + ACE_TCHAR timestamp[27]; // Only used by VERBOSE and VERBOSE_LITE. // The sprintf format needs to be different for Windows and POSIX // in the wide-char case. #if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR) - const ACE_TCHAR *time_fmt = ACE_TEXT ("%s.%03ld %s"); const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%s@%s@%u@%s@%s"); const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%s@%s@%s"); #else - const ACE_TCHAR *time_fmt = ACE_TEXT ("%ls.%03ld %ls"); const ACE_TCHAR *verbose_fmt = ACE_TEXT ("%ls@%ls@%u@%ls@%ls"); const ACE_TCHAR *verbose_lite_fmt = ACE_TEXT ("%ls@%ls@%ls"); #endif @@ -235,23 +232,16 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], || ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE)) { - time_t const now = this->secs_; - ACE_TCHAR ctp[26]; // 26 is a magic number... - - if (ACE_OS::ctime_r (&now, ctp, sizeof ctp / sizeof (ACE_TCHAR)) == 0) + ACE_Time_Value reftime (this->secs_, this->usecs_); + if (0 == ACE::timestamp (reftime, + timestamp, + sizeof (timestamp) / sizeof (ACE_TCHAR))) return -1; - /* 01234567890123456789012345 */ - /* Wed Oct 18 14:25:36 1989n0 */ - - ctp[19] = '\0'; // NUL-terminate after the time. - ctp[24] = '\0'; // NUL-terminate after the date. - - ACE_OS::sprintf (timestamp, - time_fmt, - ctp + 4, - ((long) this->usecs_) / 1000, - ctp + 20); + // Historical timestamp in VERBOSE[_LITE] used 3 places for partial sec. + // 012345678901234567890123456 + // 1989-10-18 14:25:36.123<nul> + timestamp[23] = '\0'; } if (ACE_BIT_ENABLED (verbose_flag, diff --git a/dep/acelite/ace/MEM_Stream.h b/dep/acelite/ace/MEM_Stream.h index 63ad2736a4d..6f0d3616070 100644 --- a/dep/acelite/ace/MEM_Stream.h +++ b/dep/acelite/ace/MEM_Stream.h @@ -4,7 +4,7 @@ /** * @file MEM_Stream.h * - * $Id: MEM_Stream.h 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: MEM_Stream.h 94448 2011-09-08 08:20:29Z johnnyw $ * * @author Nanbor Wang <nanbor@cs.wustl.edu> */ @@ -13,8 +13,11 @@ #ifndef ACE_MEM_STREAM_H #define ACE_MEM_STREAM_H + #include /**/ "ace/pre.h" +#include /**/ "ace/ACE_export.h" + #include "ace/MEM_IO.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/dep/acelite/ace/MMAP_Memory_Pool.cpp b/dep/acelite/ace/MMAP_Memory_Pool.cpp index 82556a8327a..f1a65100700 100644 --- a/dep/acelite/ace/MMAP_Memory_Pool.cpp +++ b/dep/acelite/ace/MMAP_Memory_Pool.cpp @@ -1,4 +1,4 @@ -// $Id: MMAP_Memory_Pool.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: MMAP_Memory_Pool.cpp 93974 2011-04-22 07:26:59Z msmit $ // MMAP_Memory_Pool.cpp #include "ace/MMAP_Memory_Pool.h" @@ -372,7 +372,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes, void *result = this->acquire (nbytes, rounded_bytes); // After the first time, reset the flag so that subsequent calls // will use MAP_FIXED - if (use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::FIRSTCALL_FIXED) + if (this->use_fixed_addr_ == ACE_MMAP_Memory_Pool_Options::FIRSTCALL_FIXED) { ACE_SET_BITS (flags_, MAP_FIXED); } diff --git a/dep/acelite/ace/Malloc_T.cpp b/dep/acelite/ace/Malloc_T.cpp index 88b456d66e2..be56870f342 100644 --- a/dep/acelite/ace/Malloc_T.cpp +++ b/dep/acelite/ace/Malloc_T.cpp @@ -1,4 +1,4 @@ -// $Id: Malloc_T.cpp 91809 2010-09-17 07:20:41Z johnnyw $ +// $Id: Malloc_T.cpp 94341 2011-07-22 12:33:43Z schmidt $ #ifndef ACE_MALLOC_T_CPP #define ACE_MALLOC_T_CPP @@ -105,16 +105,17 @@ ACE_Dynamic_Cached_Allocator<ACE_LOCK>::ACE_Dynamic_Cached_Allocator (size_t n_chunks, size_t chunk_size) : pool_ (0), free_list_ (ACE_PURE_FREE_LIST), - chunk_size_(chunk_size) + chunk_size_ (chunk_size) { + ACE_ASSERT (chunk_size > 0); chunk_size = ACE_MALLOC_ROUNDUP (chunk_size, ACE_MALLOC_ALIGN); - ACE_NEW (this->pool_, char[n_chunks * chunk_size_]); + ACE_NEW (this->pool_, char[n_chunks * chunk_size]); for (size_t c = 0; c < n_chunks; c++) { - void* placement = this->pool_ + c * chunk_size_; + void *placement = this->pool_ + c * chunk_size; this->free_list_.add (new (placement) ACE_Cached_Mem_Pool_Node<char>); } diff --git a/dep/acelite/ace/Map_T.h b/dep/acelite/ace/Map_T.h index bb5965a76d3..5eeecc007bf 100644 --- a/dep/acelite/ace/Map_T.h +++ b/dep/acelite/ace/Map_T.h @@ -4,7 +4,7 @@ /** * @file Map_T.h * - * $Id: Map_T.h 92097 2010-09-30 05:41:49Z msmit $ + * $Id: Map_T.h 93792 2011-04-07 11:48:50Z mcorino $ * * @author Irfan Pyarali <irfan@cs.wustl.edu> */ @@ -851,11 +851,11 @@ public: /// Close down and release dynamically allocated resources. virtual ~ACE_Active_Map_Manager_Adapter (void); - /// Initialize a <Map> with size @a length. + /// Initialize a Map with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = 0); - /// Close down a <Map> and release dynamically allocated resources. + /// Close down a Map and release dynamically allocated resources. virtual int close (void); /** @@ -870,11 +870,10 @@ public: /** * Add @a key / @a value pair to the map. @a key is an "inout" parameter * and maybe modified/extended by the map to add additional - * information. To recover original key, call the <recover_key> + * information. To recover original key, call the recover_key() * method. */ - virtual int bind_modify_key (const VALUE &value, - KEY &key); + virtual int bind_modify_key (const VALUE &value, KEY &key); /** * Produce a key and return it through @a key which is an "out" @@ -910,7 +909,7 @@ public: virtual int bind_create_key (const VALUE &value); /// Recovers the original key potentially modified by the map during - /// <bind_modify_key>. + /// bind_modify_key(). virtual int recover_key (const KEY &modified_key, KEY &original_key); diff --git a/dep/acelite/ace/Mem_Map.cpp b/dep/acelite/ace/Mem_Map.cpp index baf9ce36189..c4e689ec842 100644 --- a/dep/acelite/ace/Mem_Map.cpp +++ b/dep/acelite/ace/Mem_Map.cpp @@ -1,8 +1,9 @@ -// $Id: Mem_Map.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Mem_Map.cpp 95716 2012-05-01 07:49:04Z johnnyw $ // Defines the member functions for the memory mapping facility. #include "ace/Mem_Map.h" + #if !defined (__ACE_INLINE__) #include "ace/Mem_Map.inl" #endif /* __ACE_INLINE__ */ @@ -13,13 +14,10 @@ #include "ace/Log_Msg.h" #include "ace/Truncate.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Mem_Map) - void ACE_Mem_Map::dump (void) const { @@ -79,68 +77,95 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, this->base_addr_ = addr; this->handle_ = handle; - // Get the current filesize - ACE_OFF_T const current_file_length = ACE_OS::filesize (this->handle_); - - // Flag to indicate if we need to extend the back store - bool extend_backing_store = false; - - // File length requested by user - ACE_OFF_T requested_file_length = 0; + // mmap through character device doens't care about it's size + // So map with /dev/* is done with a special case. + ACE_stat current_file_type; + int result = ACE_OS::fstat (this->handle_, ¤t_file_type); - // Check <length_request> - if (length_request == static_cast<size_t> (-1)) + if (result == -1) { - // Set length to file_request or size_t max. - this->length_ = ACE_Utils::truncate_cast<size_t> (current_file_length - offset); + // Something wrong found, bail out. + return -1; } - else + else if ((current_file_type.st_mode & S_IFMT) == S_IFCHR) { - // Make sure that we have not been asked to do the impossible. - if (static_cast<ACE_UINT64> (length_request) - + static_cast<ACE_UINT64> (offset) - > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_OFF_T>::max ())) - return -1; - - // File length implicitly requested by user - requested_file_length = static_cast<ACE_OFF_T> (length_request) + offset; - - // Check to see if we need to extend the backing store - if (requested_file_length > current_file_length) - { - // If the length of the mapped region is less than the - // length of the file then we force a complete new remapping - // by setting the descriptor to ACE_INVALID_HANDLE (closing - // down the descriptor if necessary). - this->close_filemapping_handle (); - - // Remember to extend the backing store - extend_backing_store = true; - } - // Set length to length_request this->length_ = length_request; } - - // Check if we need to extend the backing store. - if (extend_backing_store) + else if ((current_file_type.st_mode & S_IFMT) == S_IFREG) { - // Remember than write increases the size by one. - ACE_OFF_T null_byte_position = 0; - if (requested_file_length > 0) + // Get the current filesize + ACE_OFF_T const current_file_length = ACE_OS::filesize (this->handle_); + + // Flag to indicate if we need to extend the back store + bool extend_backing_store = false; + + // File length requested by user + ACE_OFF_T requested_file_length = 0; + + // Check <length_request> + if (length_request == static_cast<size_t> (-1)) { - // This will make the file size <requested_file_length> - null_byte_position = requested_file_length - 1; + // Set length to file_request or size_t max. + this->length_ = ACE_Utils::truncate_cast<size_t> (current_file_length - offset); +#if defined (ACE_MMAP_NO_ZERO) + if (this->length_ == 0) + { + this->length_ = ACE_OS::getpagesize (); + } +#endif /* ACE_MMAP_NO_ZERO */ + } + else + { + // Make sure that we have not been asked to do the impossible. + if (static_cast<ACE_UINT64> (length_request) + + static_cast<ACE_UINT64> (offset) + > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_OFF_T>::max ())) + return -1; + + // File length implicitly requested by user + requested_file_length = static_cast<ACE_OFF_T> (length_request) + offset; + + // Check to see if we need to extend the backing store + if (requested_file_length > current_file_length) + { + // If the length of the mapped region is less than the + // length of the file then we force a complete new remapping + // by setting the descriptor to ACE_INVALID_HANDLE (closing + // down the descriptor if necessary). + this->close_filemapping_handle (); + + // Remember to extend the backing store + extend_backing_store = true; + } + + // Set length to length_request + this->length_ = length_request; } - if (ACE_OS::pwrite (this->handle_, - "", - 1, - null_byte_position) == -1) - return -1; - } + // Check if we need to extend the backing store. + if (extend_backing_store) + { + // Remember than write increases the size by one. + ACE_OFF_T null_byte_position = 0; + if (requested_file_length > 0) + { + // This will make the file size <requested_file_length> + null_byte_position = requested_file_length - 1; + } + + if (ACE_OS::pwrite (this->handle_, + "", + 1, + null_byte_position) == -1) + return -1; + } + } + else + // Unmappable file type. + return -1; - this->base_addr_ = ACE_OS::mmap (this->base_addr_, + this->base_addr_ = ACE_OS::mmap (this->base_addr_, this->length_, prot, share, diff --git a/dep/acelite/ace/Message_Block.cpp b/dep/acelite/ace/Message_Block.cpp index 0265fa11f1c..3ce71d6c5ca 100644 --- a/dep/acelite/ace/Message_Block.cpp +++ b/dep/acelite/ace/Message_Block.cpp @@ -1,4 +1,4 @@ -// $Id: Message_Block.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Message_Block.cpp 94516 2011-09-21 14:51:23Z johnnyw $ #include "ace/Message_Block.h" #if !defined (__ACE_INLINE__) @@ -1173,80 +1173,88 @@ ACE_Message_Block::clone (Message_Flags mask) const { ACE_TRACE ("ACE_Message_Block::clone"); - // Get a pointer to a "cloned" <ACE_Data_Block> (will copy the - // values rather than increment the reference count). - ACE_Data_Block *db = this->data_block ()->clone (mask); + const ACE_Message_Block *old_message_block = this; + ACE_Message_Block *new_message_block = 0; + ACE_Message_Block *new_previous_message_block = 0; + ACE_Message_Block *new_root_message_block = 0; - if (db == 0) - return 0; - - ACE_Message_Block *nb = 0; - - if(message_block_allocator_ == 0) - { - ACE_NEW_RETURN (nb, - ACE_Message_Block (0, // size - ACE_Message_Type (0), // type - 0, // cont - 0, // data - 0, // allocator - 0, // locking strategy - 0, // flags - this->priority_, // priority - ACE_EXECUTION_TIME, // execution time - ACE_DEADLINE_TIME, // absolute time to deadline - // Get a pointer to a - // "duplicated" <ACE_Data_Block> - // (will simply increment the - // reference count). - db, - db->data_block_allocator (), - this->message_block_allocator_), - 0); - } - else + do { - // This is the ACE_NEW_MALLOC macro with the return check removed. - // We need to do it this way because if it fails we need to release - // the cloned data block that was created above. If we used - // ACE_NEW_MALLOC_RETURN, there would be a memory leak because the - // above db pointer would be left dangling. - nb = static_cast<ACE_Message_Block*> (message_block_allocator_->malloc (sizeof (ACE_Message_Block))); - if(nb != 0) - new (nb) ACE_Message_Block (0, // size - ACE_Message_Type (0), // type - 0, // cont - 0, // data - 0, // allocator - 0, // locking strategy - 0, // flags - this->priority_, // priority - ACE_EXECUTION_TIME, // execution time - ACE_DEADLINE_TIME, // absolute time to deadline - db, - db->data_block_allocator (), - this->message_block_allocator_); - } + // Get a pointer to a "cloned"<ACE_Data_Block> (will copy the + // values rather than increment the reference count). + ACE_Data_Block *db = old_message_block->data_block ()->clone (mask); - if (nb == 0) - { - db->release (); - return 0; - } + if (db == 0) + return 0; - // Set the read and write pointers in the new <Message_Block> to the - // same relative offset as in the existing <Message_Block>. - nb->rd_ptr (this->rd_ptr_); - nb->wr_ptr (this->wr_ptr_); + if(old_message_block->message_block_allocator_ == 0) + { + ACE_NEW_RETURN (new_message_block, + ACE_Message_Block (0, // size + ACE_Message_Type (0), // type + 0, // cont + 0, // data + 0, // allocator + 0, // locking strategy + 0, // flags + old_message_block->priority_, // priority + ACE_EXECUTION_TIME, // execution time + ACE_DEADLINE_TIME, // absolute time to deadline + // Get a pointer to a + // "duplicated"<ACE_Data_Block> + // (will simply increment the + // reference count). + db, + db->data_block_allocator (), + old_message_block->message_block_allocator_), + 0); + } + else + { + // This is the ACE_NEW_MALLOC macro with the return check removed. + // We need to do it this way because if it fails we need to release + // the cloned data block that was created above. If we used + // ACE_NEW_MALLOC_RETURN, there would be a memory leak because the + // above db pointer would be left dangling. + new_message_block = static_cast<ACE_Message_Block*> (message_block_allocator_->malloc (sizeof (ACE_Message_Block))); + if (new_message_block != 0) + new (new_message_block) ACE_Message_Block (0, // size + ACE_Message_Type (0), // type + 0, // cont + 0, // data + 0, // allocator + 0, // locking strategy + 0, // flags + old_message_block->priority_, // priority + ACE_EXECUTION_TIME, // execution time + ACE_DEADLINE_TIME, // absolute time to deadline + db, + db->data_block_allocator (), + old_message_block->message_block_allocator_); + } - // Clone all the continuation messages if necessary. - if (this->cont () != 0 - && (nb->cont_ = this->cont ()->clone (mask)) == 0) - { - nb->release (); - return 0; + if (new_message_block == 0) + { + db->release (); + return 0; + } + + // Set the read and write pointers in the new <Message_Block> to the + // same relative offset as in the existing <Message_Block>. + new_message_block->rd_ptr (old_message_block->rd_ptr_); + new_message_block->wr_ptr (old_message_block->wr_ptr_); + // save the root message block to return + if (new_root_message_block == 0) + new_root_message_block = new_message_block; + if (new_previous_message_block != 0) + // we're a continuation of the previous block, add ourself to its chain + new_previous_message_block->cont_ = new_message_block; + new_previous_message_block = new_message_block; + old_message_block = old_message_block->cont (); } - return nb; + while (old_message_block != 0); + + return new_root_message_block; } // This is private. diff --git a/dep/acelite/ace/Message_Block.h b/dep/acelite/ace/Message_Block.h index 0e8c4bfd643..516f6fd42d1 100644 --- a/dep/acelite/ace/Message_Block.h +++ b/dep/acelite/ace/Message_Block.h @@ -4,7 +4,7 @@ /** * @file Message_Block.h * - * $Id: Message_Block.h 91066 2010-07-12 11:05:04Z johnnyw $ + * $Id: Message_Block.h 95798 2012-05-31 07:58:55Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -204,7 +204,7 @@ public: /** * Create a Message Block that assumes it has ownership of @a data, - * but in reality it doesnt (i.e., cannot delete it since it didn't + * but in reality it doesn't (i.e., cannot delete it since it didn't * malloc it!). Note that the @c size of the Message_Block will * be @a size, but the @a length will be 0 until <wr_ptr> is set. */ @@ -276,8 +276,8 @@ public: // = Data Block flag accessors and mutators. /// Bitwise-or the @a more_flags into the existing message flags and /// return the new value. - /* @todo: I think the following set of methods could not be used at - * all. May be they are useless. Let us have it so that we dont + /** @todo I think the following set of methods could not be used at + * all. May be they are useless. Let us have it so that we don't * mess up memory management of the Message_Block. Somebody correct * me if I am totally totally wrong.. */ @@ -319,9 +319,9 @@ public: /** * Return a "shallow" copy that increments our reference count by 1. - * This is similar to CORBA's <_duplicate> method, which is useful + * This is similar to CORBA's _duplicate() method, which is useful * if you want to eliminate lots of checks for NULL @a mb pointers - * before calling <_duplicate> on them. + * before calling _duplicate() on them. */ static ACE_Message_Block *duplicate (const ACE_Message_Block *mb); @@ -355,10 +355,10 @@ public: virtual ACE_Message_Block *release (void); /** - * This behaves like the non-static method <release>, except that it - * checks if @a mb is 0. This is similar to <CORBA::release>, which + * This behaves like the non-static method release(), except that it + * checks if @a mb is 0. This is similar to CORBA::release(), which * is useful if you want to eliminate lots of checks for NULL - * pointers before calling <release> on them. Returns @a mb. + * pointers before calling release() on them. Returns @a mb. */ static ACE_Message_Block *release (ACE_Message_Block *mb); @@ -717,7 +717,7 @@ public: */ char *mark (void) const; - // = Message size is the total amount of space alloted. + // = Message size is the total amount of space allotred. /// Get the total amount of allotted space in the message. The amount of /// allotted space may be less than allocated space. @@ -762,11 +762,11 @@ public: ACE_Data_Block *release (ACE_Lock *lock = 0); // = Message flag accessors and mutators. - /// Bitwise-or the <more_flags> into the existing message flags and + /// Bitwise-or the @a more_flags into the existing message flags and /// return the new value. ACE_Message_Block::Message_Flags set_flags (ACE_Message_Block::Message_Flags more_flags); - /// Clear the message flag bits specified in <less_flags> and return + /// Clear the message flag bits specified in @a less_flags and return /// the new value. ACE_Message_Block::Message_Flags clr_flags (ACE_Message_Block::Message_Flags less_flags); @@ -803,7 +803,7 @@ protected: * Decrease the reference count, but don't delete the object. * Returns 0 if the object should be removed. * If @a lock is equal to the locking strategy then we assume that - * the lock is beign held by the current thread; this is used to + * the lock is being held by the current thread; this is used to * release all the data blocks in a chain while holding a single * lock. */ @@ -843,7 +843,7 @@ protected: /** * Reference count for this ACE_Data_Block, which is used to avoid - * deep copies (i.e., <clone>). Note that this pointer value is + * deep copies (i.e., clone()). Note that this pointer value is * shared by all owners of the <Data_Block>'s data, i.e., all the * ACE_Message_Blocks. */ diff --git a/dep/acelite/ace/Message_Queue.h b/dep/acelite/ace/Message_Queue.h index eca4a37606c..2a70a1046a9 100644 --- a/dep/acelite/ace/Message_Queue.h +++ b/dep/acelite/ace/Message_Queue.h @@ -4,7 +4,7 @@ /** * @file Message_Queue.h * - * $Id: Message_Queue.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Message_Queue.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -26,14 +26,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decls. class ACE_Notification_Strategy; -template <ACE_SYNCH_DECL> class ACE_Message_Queue_Iterator; -template <ACE_SYNCH_DECL> class ACE_Message_Queue_Reverse_Iterator; +template <ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Message_Queue_Iterator; +template <ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Message_Queue_Reverse_Iterator; /** * @class ACE_Message_Queue_Base * * @brief Base class for ACE_Message_Queue, which is the central - * queueing facility for messages in the ACE framework. + * queuing facility for messages in the ACE framework. * * For all the ACE_Time_Value pointer parameters the caller will * block until action is possible if @a timeout == 0. Otherwise, it @@ -90,7 +90,7 @@ public: * that @a timeout uses <{absolute}> time rather than <{relative}> * time. If the @a timeout elapses without receiving a message -1 is * returned and @c errno is set to @c EWOULDBLOCK. If the queue is - * deactivated -1 is returned and @c errno is set to <ESHUTDOWN>. + * deactivated -1 is returned and @c errno is set to @c ESHUTDOWN. * Otherwise, returns -1 on failure, else the number of items still * on the queue. */ @@ -101,8 +101,8 @@ public: * Enqueue a <ACE_Message_Block *> into the tail of the queue. * Returns number of items in queue if the call succeeds or -1 * otherwise. These calls return -1 when queue is closed, - * deactivated (in which case @c errno == <ESHUTDOWN>), when a signal - * occurs (in which case @c errno == <EINTR>, or if the time + * deactivated (in which case @c errno == @c ESHUTDOWN), when a signal + * occurs (in which case @c errno == @c EINTR, or if the time * specified in timeout elapses (in which case @c errno == * @c EWOULDBLOCK). */ @@ -115,8 +115,8 @@ public: * Dequeue and return the <ACE_Message_Block *> at the head of the * queue. Returns number of items in queue if the call succeeds or * -1 otherwise. These calls return -1 when queue is closed, - * deactivated (in which case @c errno == <ESHUTDOWN>), when a signal - * occurs (in which case @c errno == <EINTR>, or if the time + * deactivated (in which case @c errno == @c ESHUTDOWN), when a signal + * occurs (in which case @c errno == @c EINTR, or if the time * specified in timeout elapses (in which case @c errno == * @c EWOULDBLOCK). */ diff --git a/dep/acelite/ace/Message_Queue_NT.cpp b/dep/acelite/ace/Message_Queue_NT.cpp index 085282e2039..385af2c1b9b 100644 --- a/dep/acelite/ace/Message_Queue_NT.cpp +++ b/dep/acelite/ace/Message_Queue_NT.cpp @@ -1,4 +1,4 @@ -// $Id: Message_Queue_NT.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Message_Queue_NT.cpp 92900 2010-12-17 14:45:11Z mcorino $ #include "ace/Message_Queue.h" #include "ace/Message_Queue_NT.h" @@ -29,10 +29,13 @@ ACE_Message_Queue_NT::open (DWORD max_threads) { ACE_TRACE ("ACE_Message_Queue_NT::open"); this->max_cthrs_ = max_threads; + this->state_ = ACE_Message_Queue_Base::ACTIVATED; this->completion_port_ = ::CreateIoCompletionPort (ACE_INVALID_HANDLE, 0, ACE_Message_Queue_Base::ACTIVATED, max_threads); + if (this->completion_port_ == 0) + this->state_ = ACE_Message_Queue_Base::DEACTIVATED; return (this->completion_port_ == 0 ? -1 : 0); } diff --git a/dep/acelite/ace/Message_Queue_T.cpp b/dep/acelite/ace/Message_Queue_T.cpp index 922c5ab83d6..710df2c43da 100644 --- a/dep/acelite/ace/Message_Queue_T.cpp +++ b/dep/acelite/ace/Message_Queue_T.cpp @@ -1,4 +1,4 @@ -// $Id: Message_Queue_T.cpp 91633 2010-09-07 14:27:13Z johnnyw $ +// $Id: Message_Queue_T.cpp 96070 2012-08-17 09:07:16Z mcorino $ #ifndef ACE_MESSAGE_QUEUE_T_CPP #define ACE_MESSAGE_QUEUE_T_CPP @@ -6,6 +6,7 @@ // #include Message_Queue.h instead of Message_Queue_T.h to avoid // circular include problems. #include "ace/Message_Queue.h" +#include "ace/Message_Queue_Vx.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_time.h" @@ -19,6 +20,7 @@ #include "ace/Notification_Strategy.h" #include "ace/Truncate.h" +#include "ace/Condition_Attributes.h" #if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) #include "ace/OS_NS_stdio.h" @@ -33,93 +35,93 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Dynamic_Message_Queue) ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Ex) ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Ex_N) -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dump (void) const +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dump"); this->queue_.dump (); #endif /* ACE_HAS_DUMP */ } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_bytes (size_t new_value) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_bytes (size_t new_value) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_bytes"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_bytes"); this->queue_.message_bytes (new_value); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_length (size_t new_value) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_length (size_t new_value) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_length"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_length"); this->queue_.message_length (new_value); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::ACE_Message_Queue_Ex (size_t high_water_mark, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Ex (size_t high_water_mark, size_t low_water_mark, ACE_Notification_Strategy *ns) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::ACE_Message_Queue_Ex"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Ex"); if (this->queue_.open (high_water_mark, low_water_mark, ns) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Message_Queue_Ex"))); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::~ACE_Message_Queue_Ex (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue_Ex (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::~ACE_Message_Queue_Ex"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue_Ex"); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::open (size_t hwm, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::open (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::open"); return this->queue_.open (hwm, lwm, ns); } // Clean up the queue if we have not already done so! -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::close (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::close (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::close"); return this->queue_.close (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::flush (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::flush (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::flush"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::flush"); return this->queue_.flush (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::flush_i (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::flush_i (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::flush_i"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::flush_i"); return this->queue_.flush_i (); } // Take a look at the first item without removing it. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::peek_dequeue_head (ACE_MESSAGE_TYPE *&first_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::peek_dequeue_head"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head"); ACE_Message_Block *mb = 0; @@ -131,18 +133,18 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::peek_dequeue_head (ACE_ME return cur_count; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head (ACE_MESSAGE_TYPE *new_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_head (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_head"); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block ((char *) new_item, sizeof (*new_item), - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::DEFAULT_PRIORITY), -1); int const result = this->queue_.enqueue_head (mb, timeout); @@ -156,21 +158,21 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head (ACE_MESSAGE // accordance with its <msg_priority> (0 is lowest priority). Returns // -1 on failure, else the number of items still on the queue. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue (ACE_MESSAGE_TYPE *new_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue"); return this->enqueue_prio (new_item, timeout); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_prio (ACE_MESSAGE_TYPE *new_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_prio (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout, unsigned long priority) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_prio"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_prio"); ACE_Message_Block *mb = 0; @@ -188,18 +190,18 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_prio (ACE_MESSAGE return result; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_deadline (ACE_MESSAGE_TYPE *new_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_deadline"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline"); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block ((char *) new_item, sizeof (*new_item), - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY ), + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::DEFAULT_PRIORITY ), -1); int const result = this->queue_.enqueue_deadline (mb, timeout); @@ -213,18 +215,18 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_deadline (ACE_MES // Block indefinitely waiting for an item to arrive, // does not ignore alerts (e.g., signals). -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail (ACE_MESSAGE_TYPE *new_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail"); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block ((char *) new_item, sizeof (*new_item), - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::DEFAULT_PRIORITY), -1); int const result = this->queue_.enqueue_tail (mb, timeout); @@ -238,11 +240,11 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail (ACE_MESSAGE // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE_TYPE *&first_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_head (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_head"); ACE_Message_Block *mb = 0; @@ -263,11 +265,11 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE // block indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE_TYPE *&dequeued, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio"); ACE_Message_Block *mb = 0; @@ -288,11 +290,11 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE_TYPE *&dequeued, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail"); ACE_Message_Block *mb = 0; @@ -313,11 +315,11 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MESSAGE_TYPE *&dequeued, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline (ACE_MESSAGE_TYPE *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline"); ACE_Message_Block *mb = 0; @@ -334,24 +336,24 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MES return cur_count; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notify (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notify (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notify"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notify"); return this->queue_.notify (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>:: -ACE_Message_Queue_Ex_Iterator (ACE_Message_Queue_Ex <ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>:: +ACE_Message_Queue_Ex_Iterator (ACE_Message_Queue_Ex <ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> & queue) : iter_ (queue.queue_) { } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>:: +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>:: next (ACE_MESSAGE_TYPE *&entry) { ACE_Message_Block * mb = 0; @@ -363,36 +365,36 @@ next (ACE_MESSAGE_TYPE *&entry) return retval; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::done (void) const +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::done (void) const { return this->iter_.done (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::advance (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::advance (void) { return this->iter_.advance (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dump (void) const +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { this->iter_.dump (); } ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Ex_Iterator) -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>:: -ACE_Message_Queue_Ex_Reverse_Iterator (ACE_Message_Queue_Ex <ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>:: +ACE_Message_Queue_Ex_Reverse_Iterator (ACE_Message_Queue_Ex <ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> & queue) : iter_ (queue.queue_) { } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>:: +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>:: next (ACE_MESSAGE_TYPE *&entry) { ACE_Message_Block * mb = 0; @@ -404,50 +406,50 @@ next (ACE_MESSAGE_TYPE *&entry) return retval; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::done (void) const +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::done (void) const { return this->iter_.done (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::advance (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::advance (void) { return this->iter_.advance (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dump (void) const +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { this->iter_.dump (); } ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Ex_Reverse_Iterator) -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::ACE_Message_Queue_Ex_N +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Ex_N (size_t high_water_mark, size_t low_water_mark, ACE_Notification_Strategy *ns): - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> (high_water_mark, + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> (high_water_mark, low_water_mark, ns) { - ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::ACE_Message_Queue_Ex_N"); + ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Ex_N"); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::~ACE_Message_Queue_Ex_N (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue_Ex_N (void) { - ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::~ACE_Message_Queue_Ex_N"); + ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue_Ex_N"); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_head (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head"); + ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_head"); // Create a chained ACE_Message_Blocks wrappers around the 'chained' // ACE_MESSAGE_TYPES. @@ -466,12 +468,12 @@ ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head return result; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail (ACE_MESSAGE_TYPE *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail"); + ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail"); // Create a chained ACE_Message_Blocks wrappers around the 'chained' // ACE_MESSAGE_TYPES. @@ -490,11 +492,11 @@ ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail return result; } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_Message_Block * -ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::wrap_with_mbs_i +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> ACE_Message_Block * +ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::wrap_with_mbs_i (ACE_MESSAGE_TYPE *new_item) { - ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::wrap_with_mbs_i"); + ACE_TRACE ("ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::wrap_with_mbs_i"); // We need to keep a reference to the head of the chain ACE_Message_Block *mb_head = 0; @@ -502,7 +504,7 @@ ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::wrap_with_mbs_i ACE_NEW_RETURN (mb_head, ACE_Message_Block ((char *) new_item, sizeof (*new_item), - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::DEFAULT_PRIORITY), 0); // mb_tail will point to the last ACE_Message_Block @@ -515,7 +517,7 @@ ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::wrap_with_mbs_i ACE_NEW_NORETURN (mb_temp, ACE_Message_Block ((char *) pobj, sizeof (*pobj), - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY)); + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::DEFAULT_PRIORITY)); if (mb_temp == 0) { mb_head->release (); @@ -532,162 +534,176 @@ ACE_Message_Queue_Ex_N<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::wrap_with_mbs_i ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Reverse_Iterator) -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue (ACE_MESSAGE_TYPE *&first_item, +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue (ACE_MESSAGE_TYPE *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::dequeue"); return this->dequeue_head (first_item, timeout); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_Notification_Strategy * -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notification_strategy (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> ACE_Notification_Strategy * +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notification_strategy (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notification_strategy"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notification_strategy"); return this->queue_.notification_strategy (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notification_strategy (ACE_Notification_Strategy *s) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notification_strategy (ACE_Notification_Strategy *s) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::notification_strategy"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::notification_strategy"); this->queue_.notification_strategy (s); } // Check if queue is empty (holds locks). -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> bool -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::is_empty (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::is_empty (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::is_empty"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::is_empty"); return this->queue_.is_empty (); } // Check if queue is full (holds locks). -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> bool -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::is_full (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::is_full (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::is_full"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::is_full"); return this->queue_.is_full (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::high_water_mark (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::high_water_mark (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::high_water_mark"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::high_water_mark"); return this->queue_.high_water_mark (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::high_water_mark (size_t hwm) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::high_water_mark (size_t hwm) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::high_water_mark"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::high_water_mark"); this->queue_.high_water_mark (hwm); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::low_water_mark (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::low_water_mark (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::low_water_mark"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::low_water_mark"); return this->queue_.low_water_mark (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> void -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::low_water_mark (size_t lwm) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::low_water_mark (size_t lwm) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::low_water_mark"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::low_water_mark"); this->queue_.low_water_mark (lwm); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_bytes (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_bytes (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_bytes"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_bytes"); return this->queue_.message_bytes (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_length (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_length (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_length"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_length"); return this->queue_.message_length (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> size_t -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_count (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_count (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::message_count"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::message_count"); return this->queue_.message_count (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::deactivate (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::deactivate (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::deactivate"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::deactivate"); return this->queue_.deactivate (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::activate (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::activate (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::activate"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::activate"); return this->queue_.activate (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::pulse (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::pulse (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::pulse"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::pulse"); return this->queue_.pulse (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::deactivated (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::deactivated (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::deactivated"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::deactivated"); return this->queue_.deactivated (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::state (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::state (void) { - ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::state"); + ACE_TRACE ("ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::state"); return this->queue_.state (); } -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> ACE_SYNCH_MUTEX_T & -ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::lock (void) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> ACE_SYNCH_MUTEX_T & +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::lock (void) { return this->queue_.lock (); } -template <ACE_SYNCH_DECL> -ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::ACE_Message_Queue_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &q) +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::gettimeofday () +{ + return this->queue_.gettimeofday (); +} + +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> +void +ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>::set_time_policy (TIME_POLICY const & rhs) +{ + this->queue_.set_time_policy (rhs); +} + +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Iterator (ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &q) : queue_ (q), curr_ (q.head_) { } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::next (ACE_Message_Block *&entry) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>::next (ACE_Message_Block *&entry) { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) @@ -700,16 +716,16 @@ ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::next (ACE_Message_Block *&entry) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::done (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>::done (void) const { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) return this->curr_ == 0; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::advance (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>::advance (void) { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) @@ -718,8 +734,8 @@ ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::advance (void) return this->curr_ != 0; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) #endif /* ACE_HAS_DUMP */ @@ -727,15 +743,15 @@ ACE_Message_Queue_Iterator<ACE_SYNCH_USE>::dump (void) const ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue_Iterator) -template <ACE_SYNCH_DECL> -ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::ACE_Message_Queue_Reverse_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &q) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue_Reverse_Iterator (ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &q) : queue_ (q), curr_ (queue_.tail_) { } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::next (ACE_Message_Block *&entry) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>::next (ACE_Message_Block *&entry) { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) @@ -748,16 +764,16 @@ ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::next (ACE_Message_Block *&ent return 0; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::done (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>::done (void) const { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) return this->curr_ == 0; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::advance (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>::advance (void) { ACE_READ_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->queue_.lock_, -1) @@ -766,61 +782,61 @@ ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::advance (void) return this->curr_ != 0; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue (ACE_Message_Block *&first_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue"); return this->dequeue_head (first_item, timeout); } -template <ACE_SYNCH_DECL> ACE_Notification_Strategy * -ACE_Message_Queue<ACE_SYNCH_USE>::notification_strategy (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Notification_Strategy * +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notification_strategy (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::notification_strategy"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notification_strategy"); return this->notification_strategy_; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::notification_strategy (ACE_Notification_Strategy *s) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notification_strategy (ACE_Notification_Strategy *s) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::notification_strategy"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notification_strategy"); this->notification_strategy_ = s; } // Check if queue is empty (does not hold locks). -template <ACE_SYNCH_DECL> bool -ACE_Message_Queue<ACE_SYNCH_USE>::is_empty_i (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_empty_i (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::is_empty_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_empty_i"); return this->tail_ == 0; } // Check if queue is full (does not hold locks). -template <ACE_SYNCH_DECL> bool -ACE_Message_Queue<ACE_SYNCH_USE>::is_full_i (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_full_i (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::is_full_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_full_i"); return this->cur_bytes_ >= this->high_water_mark_; } // Check if queue is empty (holds locks). -template <ACE_SYNCH_DECL> bool -ACE_Message_Queue<ACE_SYNCH_USE>::is_empty (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_empty (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::is_empty"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_empty"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, false); return this->is_empty_i (); @@ -828,132 +844,146 @@ ACE_Message_Queue<ACE_SYNCH_USE>::is_empty (void) // Check if queue is full (holds locks). -template <ACE_SYNCH_DECL> bool -ACE_Message_Queue<ACE_SYNCH_USE>::is_full (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> bool +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_full (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::is_full"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::is_full"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, false); return this->is_full_i (); } -template <ACE_SYNCH_DECL> size_t -ACE_Message_Queue<ACE_SYNCH_USE>::high_water_mark (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::high_water_mark (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::high_water_mark"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::high_water_mark"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->high_water_mark_; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::high_water_mark (size_t hwm) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::high_water_mark (size_t hwm) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::high_water_mark"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::high_water_mark"); ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->high_water_mark_ = hwm; } -template <ACE_SYNCH_DECL> size_t -ACE_Message_Queue<ACE_SYNCH_USE>::low_water_mark (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::low_water_mark (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::low_water_mark"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::low_water_mark"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->low_water_mark_; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::low_water_mark (size_t lwm) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::low_water_mark (size_t lwm) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::low_water_mark"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::low_water_mark"); ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->low_water_mark_ = lwm; } -template <ACE_SYNCH_DECL> size_t -ACE_Message_Queue<ACE_SYNCH_USE>::message_bytes (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_bytes (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::message_bytes"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_bytes"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->cur_bytes_; } -template <ACE_SYNCH_DECL> size_t -ACE_Message_Queue<ACE_SYNCH_USE>::message_length (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_length (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::message_length"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_length"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->cur_length_; } -template <ACE_SYNCH_DECL> size_t -ACE_Message_Queue<ACE_SYNCH_USE>::message_count (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> size_t +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_count (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::message_count"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_count"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->cur_count_; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::deactivate () +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivate () { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::deactivate"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivate"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->deactivate_i (0); // Not a pulse } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::activate (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::activate (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::activate"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::activate"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->activate_i (); } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::pulse () +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::pulse () { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::pulse"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::pulse"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->deactivate_i (1); // Just a pulse } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::deactivated (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivated (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::deactivated"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivated"); return this->state_ == ACE_Message_Queue_Base::DEACTIVATED; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::state (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::state (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::state"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::state"); return this->state_; } -template <ACE_SYNCH_DECL> ACE_SYNCH_MUTEX_T & -ACE_Message_Queue<ACE_SYNCH_USE>::lock (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_SYNCH_MUTEX_T & +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::lock (void) { return this->lock_; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::gettimeofday (void) const +{ + return this->time_policy_ (); +} + +template <ACE_SYNCH_DECL, class TIME_POLICY> +void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::set_time_policy (TIME_POLICY const & rhs) +{ + this->time_policy_ = rhs; +} + +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); switch (this->state_) { @@ -993,32 +1023,37 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::message_bytes (size_t new_value) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_bytes (size_t new_value) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::message_bytes"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_bytes"); ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->cur_bytes_ = new_value; } -template <ACE_SYNCH_DECL> void -ACE_Message_Queue<ACE_SYNCH_USE>::message_length (size_t new_value) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_length (size_t new_value) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::message_length"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::message_length"); ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->cur_length_ = new_value; } -template <ACE_SYNCH_DECL> -ACE_Message_Queue<ACE_SYNCH_USE>::ACE_Message_Queue (size_t hwm, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) +#if defined (ACE_HAS_THREADS) + : not_empty_cond_ (lock_, cond_attr_) + , not_full_cond_ (lock_, cond_attr_) +#else : not_empty_cond_ (lock_) , not_full_cond_ (lock_) +#endif { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::ACE_Message_Queue"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::ACE_Message_Queue"); if (this->open (hwm, lwm, ns) == -1) ACE_ERROR ((LM_ERROR, @@ -1047,10 +1082,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::ACE_Message_Queue (size_t hwm, #endif /* ACE_HAS_MONITOR_POINTS==1 */ } -template <ACE_SYNCH_DECL> -ACE_Message_Queue<ACE_SYNCH_USE>::~ACE_Message_Queue (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::~ACE_Message_Queue"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Message_Queue"); if (this->head_ != 0 && this->close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("close"))); @@ -1061,8 +1096,8 @@ ACE_Message_Queue<ACE_SYNCH_USE>::~ACE_Message_Queue (void) #endif /* ACE_HAS_MONITOR_POINTS==1 */ } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::flush_i (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::flush_i (void) { int number_flushed = 0; @@ -1104,12 +1139,12 @@ ACE_Message_Queue<ACE_SYNCH_USE>::flush_i (void) // once for the same queue, we're in bigger trouble than just // concurrency control! -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::open (size_t hwm, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::open (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::open"); this->high_water_mark_ = hwm; this->low_water_mark_ = lwm; this->state_ = ACE_Message_Queue_Base::ACTIVATED; @@ -1125,10 +1160,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::open (size_t hwm, // Implementation of the public deactivate() method // (assumes locks are held). -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i (int pulse) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivate_i (int pulse) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::deactivate_i"); int const previous_state = this->state_; if (previous_state != ACE_Message_Queue_Base::DEACTIVATED) @@ -1146,19 +1181,19 @@ ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i (int pulse) return previous_state; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::activate_i (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::activate_i (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::activate_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::activate_i"); int const previous_state = this->state_; this->state_ = ACE_Message_Queue_Base::ACTIVATED; return previous_state; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::flush (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::flush (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::flush"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::flush"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); // Free up the remaining messages on the queue. @@ -1167,10 +1202,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::flush (void) // Clean up the queue if we have not already done so! -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::close (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::close (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::close"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); // There's no need to check the return value of deactivate_i() since @@ -1181,16 +1216,16 @@ ACE_Message_Queue<ACE_SYNCH_USE>::close (void) return this->flush_i (); } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::signal_enqueue_waiters (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::signal_enqueue_waiters (void) { if (this->not_full_cond_.signal () != 0) return -1; return 0; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::signal_dequeue_waiters (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::signal_dequeue_waiters (void) { // Tell any blocked threads that the queue has a new item! if (this->not_empty_cond_.signal () != 0) @@ -1201,10 +1236,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::signal_dequeue_waiters (void) // Actually put the node at the end (no locking so must be called with // locks held). -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail_i (ACE_Message_Block *new_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail_i (ACE_Message_Block *new_item) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail_i"); if (new_item == 0) return -1; @@ -1252,10 +1287,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail_i (ACE_Message_Block *new_item) // Actually put the node(s) at the head (no locking) -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i (ACE_Message_Block *new_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head_i (ACE_Message_Block *new_item) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head_i"); if (new_item == 0) return -1; @@ -1297,10 +1332,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i (ACE_Message_Block *new_item) // Actually put the node at its proper position relative to its // priority. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_i (ACE_Message_Block *new_item) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_i"); if (new_item == 0) return -1; @@ -1368,11 +1403,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item) // Actually put the node at its proper position relative to its // deadline time. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline_i (ACE_Message_Block *new_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline_i (ACE_Message_Block *new_item) { #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline_i"); if (new_item == 0) return -1; @@ -1439,14 +1474,14 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline_i (ACE_Message_Block *new_ite // called with locks held). This method assumes that the queue has at // least one item in it when it is called. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head_i (ACE_Message_Block *&first_item) { if (this->head_ ==0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Attempting to dequeue from empty queue")), -1); - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head_i"); first_item = this->head_; this->head_ = this->head_->next (); @@ -1490,10 +1525,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item // method assumes that the queue has at least one item in it when it // is called. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i (ACE_Message_Block *&dequeued) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio_i (ACE_Message_Block *&dequeued) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio_i"); if (this->head_ == 0) return -1; @@ -1565,14 +1600,14 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i (ACE_Message_Block *&dequeued) // called with locks held). This method assumes that the queue has at // least one item in it when it is called. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i (ACE_Message_Block *&dequeued) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail_i (ACE_Message_Block *&dequeued) { if (this->head_ == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Attempting to dequeue from empty queue")), -1); - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail_i"); dequeued = this->tail_; if (this->tail_->prev () == 0) { @@ -1614,15 +1649,15 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i (ACE_Message_Block *&dequeued) // (no locking, so must be called with locks held). This method assumes // that the queue has at least one item in it when it is called. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline_i (ACE_Message_Block *&dequeued) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline_i (ACE_Message_Block *&dequeued) { #if defined (ACE_HAS_TIMED_MESSAGE_BLOCKS) if (this->head_ == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Attempting to dequeue from empty queue")), -1); - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline_i"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline_i"); // Find the last message enqueued with the lowest deadline time ACE_Message_Block* chosen = 0; @@ -1684,11 +1719,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline_i (ACE_Message_Block *&dequeu // Take a look at the first item without removing it. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED) @@ -1698,7 +1733,6 @@ ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_i } // Wait for at least one item to become available. - if (this->wait_not_empty_cond (timeout) == -1) return -1; @@ -1706,8 +1740,8 @@ ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_i return ACE_Utils::truncate_cast<int> (this->cur_count_); } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_full_cond (ACE_Time_Value *timeout) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::wait_not_full_cond (ACE_Time_Value *timeout) { int result = 0; @@ -1732,8 +1766,8 @@ ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_full_cond (ACE_Time_Value *timeout) return result; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_empty_cond (ACE_Time_Value *timeout) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::wait_not_empty_cond (ACE_Time_Value *timeout) { int result = 0; @@ -1761,11 +1795,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_empty_cond (ACE_Time_Value *timeout) // Block indefinitely waiting for an item to arrive, does not ignore // alerts (e.g., signals). -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head"); int queue_count = 0; ACE_Notification_Strategy *notifier = 0; { @@ -1799,11 +1833,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head (ACE_Message_Block *new_item, // accordance with its <msg_priority> (0 is lowest priority). Returns // -1 on failure, else the number of items still on the queue. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_prio (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_prio"); int queue_count = 0; ACE_Notification_Strategy *notifier = 0; { @@ -1837,11 +1871,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_prio (ACE_Message_Block *new_item, // accordance with its <msg_deadline_time>. Returns // -1 on failure, else the number of items still on the queue. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_deadline"); int queue_count = 0; ACE_Notification_Strategy *notifier = 0; { @@ -1871,22 +1905,22 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline (ACE_Message_Block *new_item, return queue_count; } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue"); return this->enqueue_prio (new_item, timeout); } // Block indefinitely waiting for an item to arrive, // does not ignore alerts (e.g., signals). -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail"); int queue_count = 0; ACE_Notification_Strategy *notifier = 0; { @@ -1920,11 +1954,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail (ACE_Message_Block *new_item, // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head (ACE_Message_Block *&first_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED) @@ -1943,11 +1977,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head (ACE_Message_Block *&first_item, // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio (ACE_Message_Block *&dequeued, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio (ACE_Message_Block *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_prio"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED) @@ -1966,11 +2000,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio (ACE_Message_Block *&dequeued, // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail (ACE_Message_Block *&dequeued, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail (ACE_Message_Block *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_tail"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED) @@ -1989,11 +2023,11 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail (ACE_Message_Block *&dequeued, // indefinitely (or until an alert occurs). Otherwise, block for upto // the amount of time specified by timeout. -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline (ACE_Message_Block *&dequeued, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline (ACE_Message_Block *&dequeued, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_deadline"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->state_ == ACE_Message_Queue_Base::DEACTIVATED) @@ -2008,10 +2042,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline (ACE_Message_Block *&dequeued return this->dequeue_deadline_i (dequeued); } -template <ACE_SYNCH_DECL> int -ACE_Message_Queue<ACE_SYNCH_USE>::notify (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notify (void) { - ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::notify"); + ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::notify"); // By default, don't do anything. if (this->notification_strategy_ == 0) @@ -2021,12 +2055,12 @@ ACE_Message_Queue<ACE_SYNCH_USE>::notify (void) } // = Initialization and termination methods. -template <ACE_SYNCH_DECL> -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::ACE_Dynamic_Message_Queue (ACE_Dynamic_Message_Strategy & message_strategy, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::ACE_Dynamic_Message_Queue (ACE_Dynamic_Message_Strategy & message_strategy, size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) - : ACE_Message_Queue<ACE_SYNCH_USE> (hwm, lwm, ns), + : ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> (hwm, lwm, ns), pending_head_ (0), pending_tail_ (0), late_head_ (0), @@ -2042,14 +2076,14 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::ACE_Dynamic_Message_Queue (ACE_Dynamic // dtor: free message strategy and let base class dtor do the rest. -template <ACE_SYNCH_DECL> -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::~ACE_Dynamic_Message_Queue (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Dynamic_Message_Queue (void) { delete &this->message_strategy_; } -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&list_head, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::remove_messages (ACE_Message_Block *&list_head, ACE_Message_Block *&list_tail, u_int status_flags) { @@ -2188,11 +2222,11 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&l // messages are returned in priority order, from head to tail, as of // the time this method was called. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head (ACE_Message_Block *&first_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); @@ -2228,15 +2262,15 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head (ACE_Message_Block *&firs // Dequeue and return the <ACE_Message_Block *> at the (logical) head // of the queue. -template <ACE_SYNCH_DECL> void -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Message_Queue<ACE_SYNCH_USE> (base class):\n"))); - this->ACE_Message_Queue<ACE_SYNCH_USE>::dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> (base class):\n"))); + this->ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dump (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("pending_head_ = %u\n") @@ -2260,10 +2294,10 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dump (void) const } // dump the state of the queue -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_i (ACE_Message_Block *new_item) { - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_i"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_i"); if (new_item == 0) { @@ -2415,8 +2449,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item // Message Queue constructor to update the priorities of all enqueued // messages. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::sublist_enqueue_i (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::sublist_enqueue_i (ACE_Message_Block *new_item, const ACE_Time_Value ¤t_time, ACE_Message_Block *&sublist_head, ACE_Message_Block *&sublist_tail, @@ -2484,10 +2518,10 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::sublist_enqueue_i (ACE_Message_Block * // Enqueue a message in priority order within a given priority status // sublist. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head_i (ACE_Message_Block *&first_item) { - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::dequeue_head_i"); int result = 0; int last_in_subqueue = 0; @@ -2615,8 +2649,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&fi // is empty from the beyond late portion, or if that is empty just // sets the passed pointer to zero and returns -1. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_queue (const ACE_Time_Value ¤t_time) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::refresh_queue (const ACE_Time_Value ¤t_time) { int result; @@ -2631,8 +2665,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_queue (const ACE_Time_Value &c // Refresh the queue using the strategy specific priority status // function. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_pending_queue (const ACE_Time_Value ¤t_time) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::refresh_pending_queue (const ACE_Time_Value ¤t_time) { ACE_Dynamic_Message_Strategy::Priority_Status current_status; @@ -2754,8 +2788,8 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_pending_queue (const ACE_Time_ // Refresh the pending queue using the strategy specific priority // status function. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_late_queue (const ACE_Time_Value ¤t_time) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::refresh_late_queue (const ACE_Time_Value ¤t_time) { ACE_Dynamic_Message_Strategy::Priority_Status current_status; @@ -2839,22 +2873,22 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::refresh_late_queue (const ACE_Time_Val // Refresh the late queue using the strategy specific priority status // function. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout) { - return ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (first_item, + return ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::peek_dequeue_head (first_item, timeout); } // Private method to hide public base class method: just calls base // class method. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_tail (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_tail"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_tail"); return this->enqueue_prio (new_item, timeout); } @@ -2863,11 +2897,11 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_tail (ACE_Message_Block *new_i // where it was placed after the queue is refreshed prior to the next // enqueue or dequeue operation. -template <ACE_SYNCH_DECL> int -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_head (ACE_Message_Block *new_item, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout) { - ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_head"); + ACE_TRACE ("ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY>::enqueue_head"); return this->enqueue_prio (new_item, timeout); } @@ -2876,25 +2910,26 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_head (ACE_Message_Block *new_i // where it was placed after the queue is refreshed prior to the next // enqueue or dequeue operation. -template <ACE_SYNCH_DECL> -ACE_Message_Queue<ACE_SYNCH_USE> * -ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_static_message_queue (size_t hwm, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Message_Queue_Factory<ACE_SYNCH_USE, TIME_POLICY>::create_static_message_queue (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) { - ACE_Message_Queue<ACE_SYNCH_USE> *tmp = 0; + typedef ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> QUEUE_TYPE; + QUEUE_TYPE *tmp = 0; ACE_NEW_RETURN (tmp, - ACE_Message_Queue<ACE_SYNCH_USE> (hwm, lwm, ns), + QUEUE_TYPE (hwm, lwm, ns), 0); return tmp; } // Factory method for a statically prioritized ACE_Message_Queue. -template <ACE_SYNCH_DECL> -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> * -ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_deadline_message_queue (size_t hwm, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Message_Queue_Factory<ACE_SYNCH_USE, TIME_POLICY>::create_deadline_message_queue (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns, u_long static_bit_field_mask, @@ -2911,9 +2946,10 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_deadline_message_queue (size_t dynamic_priority_offset), 0); - ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> *tmp = 0; + typedef ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> QUEUE_TYPE; + QUEUE_TYPE *tmp = 0; ACE_NEW_RETURN (tmp, - ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> (*adms, hwm, lwm, ns), + QUEUE_TYPE (*adms, hwm, lwm, ns), 0); return tmp; } @@ -2921,9 +2957,9 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_deadline_message_queue (size_t // Factory method for a dynamically prioritized (by time to deadline) // ACE_Dynamic_Message_Queue. -template <ACE_SYNCH_DECL> -ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> * -ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_laxity_message_queue (size_t hwm, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Message_Queue_Factory<ACE_SYNCH_USE, TIME_POLICY>::create_laxity_message_queue (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns, u_long static_bit_field_mask, @@ -2940,9 +2976,10 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_laxity_message_queue (size_t hw dynamic_priority_offset), 0); - ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> *tmp = 0; + typedef ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> QUEUE_TYPE; + QUEUE_TYPE *tmp = 0; ACE_NEW_RETURN (tmp, - ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> (*alms, hwm, lwm, ns), + QUEUE_TYPE (*alms, hwm, lwm, ns), 0); return tmp; } @@ -2953,9 +2990,9 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_laxity_message_queue (size_t hw #if defined (ACE_VXWORKS) // factory method for a wrapped VxWorks message queue -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Message_Queue_Vx * -ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_Vx_message_queue (size_t max_messages, +ACE_Message_Queue_Factory<ACE_SYNCH_USE, TIME_POLICY>::create_Vx_message_queue (size_t max_messages, size_t max_message_length, ACE_Notification_Strategy *ns) { @@ -2970,9 +3007,9 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_Vx_message_queue (size_t max_me #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Message_Queue_NT * -ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_NT_message_queue (size_t max_threads) +ACE_Message_Queue_Factory<ACE_SYNCH_USE, TIME_POLICY>::create_NT_message_queue (size_t max_threads) { ACE_Message_Queue_NT *tmp = 0; diff --git a/dep/acelite/ace/Message_Queue_T.h b/dep/acelite/ace/Message_Queue_T.h index 73e4626766c..52024907a15 100644 --- a/dep/acelite/ace/Message_Queue_T.h +++ b/dep/acelite/ace/Message_Queue_T.h @@ -4,7 +4,7 @@ /** * @file Message_Queue_T.h * - * $Id: Message_Queue_T.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Message_Queue_T.h 96070 2012-08-17 09:07:16Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -19,6 +19,11 @@ #include "ace/Dynamic_Message_Strategy.h" #include "ace/Synch_Traits.h" #include "ace/Guard_T.h" +#include "ace/Time_Policy.h" +#include "ace/Time_Value_T.h" +#if defined (ACE_HAS_THREADS) +# include "ace/Condition_Attributes.h" +#endif #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -47,11 +52,11 @@ namespace ACE /** * @class ACE_Message_Queue * - * @brief A message queueing facility with parameterized synchronization + * @brief A message queuing facility with parameterized synchronization * capability. ACE_Message_Queue is modeled after the queueing facilities * in System V STREAMs. * - * ACE_Message_Queue is the primary queueing facility for + * ACE_Message_Queue is the primary queuing facility for * messages in the ACE framework. It's one template argument parameterizes * the queue's synchronization. The argument specifies a synchronization * strategy. The two main strategies available for ACE_SYNCH_DECL are: @@ -61,17 +66,17 @@ namespace ACE * All data passing through ACE_Message_Queue is in the form of * ACE_Message_Block objects. @sa ACE_Message_Block. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue : public ACE_Message_Queue_Base { public: - friend class ACE_Message_Queue_Iterator<ACE_SYNCH_USE>; - friend class ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE>; + friend class ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY>; + friend class ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY>; // = Traits - typedef ACE_Message_Queue_Iterator<ACE_SYNCH_USE> + typedef ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY> ITERATOR; - typedef ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE> + typedef ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY> REVERSE_ITERATOR; /** @@ -482,6 +487,14 @@ public: /// Returns a reference to the lock used by the ACE_Message_Queue. virtual ACE_SYNCH_MUTEX_T &lock (void); + /// Get the current time of day according to the queue's TIME_POLICY. + /// Allows users to initialize timeout values using correct time policy. + ACE_Time_Value_T<TIME_POLICY> gettimeofday (void) const; + + /// Allows applications to control how the timer queue gets the time + /// of day. + void set_time_policy (TIME_POLICY const & time_policy); + /// Dump the state of an object. virtual void dump (void) const; @@ -596,12 +609,23 @@ protected: /// Protect queue from concurrent access. ACE_SYNCH_MUTEX_T lock_; +#if defined (ACE_HAS_THREADS) + /// Attributes to initialize conditions with. + /* We only need this because some crappy compilers can't + properly handle initializing the conditions with + temporary objects. */ + ACE_Condition_Attributes_T<TIME_POLICY> cond_attr_; +#endif + /// Used to make threads sleep until the queue is no longer empty. ACE_SYNCH_CONDITION_T not_empty_cond_; /// Used to make threads sleep until the queue is no longer full. ACE_SYNCH_CONDITION_T not_full_cond_; + /// The policy to return the current time of day + TIME_POLICY time_policy_; + /// Sends the size of the queue whenever it changes. #if defined (ACE_HAS_MONITOR_POINTS) && (ACE_HAS_MONITOR_POINTS == 1) ACE::Monitor_Control::Size_Monitor *monitor_; @@ -623,12 +647,12 @@ typedef ACE_Message_Queue<ACE_SYNCH> ACE_DEFAULT_MESSAGE_QUEUE_TYPE; * * @brief Iterator for the ACE_Message_Queue. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Iterator { public: // = Initialization method. - ACE_Message_Queue_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &queue); + ACE_Message_Queue_Iterator (ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &queue); // = Iteration methods. /// Pass back the @a entry that hasn't been seen in the queue. @@ -650,7 +674,7 @@ public: private: /// Message_Queue we are iterating over. - ACE_Message_Queue <ACE_SYNCH_USE> &queue_; + ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &queue_; /// Keeps track of how far we've advanced... ACE_Message_Block *curr_; @@ -661,12 +685,12 @@ private: * * @brief Reverse Iterator for the ACE_Message_Queue. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Reverse_Iterator { public: // = Initialization method. - ACE_Message_Queue_Reverse_Iterator (ACE_Message_Queue <ACE_SYNCH_USE> &queue); + ACE_Message_Queue_Reverse_Iterator (ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &queue); // = Iteration methods. /// Pass back the @a entry that hasn't been seen in the queue. @@ -688,7 +712,7 @@ public: private: /// Message_Queue we are iterating over. - ACE_Message_Queue <ACE_SYNCH_USE> &queue_; + ACE_Message_Queue <ACE_SYNCH_USE, TIME_POLICY> &queue_; /// Keeps track of how far we've advanced... ACE_Message_Block *curr_; @@ -761,8 +785,8 @@ private: * ensure the correct semantics, but that is not a * very stable or portable approach (discouraged). */ -template <ACE_SYNCH_DECL> -class ACE_Dynamic_Message_Queue : public ACE_Message_Queue<ACE_SYNCH_USE> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> +class ACE_Dynamic_Message_Queue : public ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> { public: // = Initialization and termination methods. @@ -883,8 +907,8 @@ protected: private: // = Disallow public access to these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Message_Queue (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Dynamic_Message_Queue (const ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> &)) // provide definitions for these (just call base class method), // but make them private so they're not accessible outside the class @@ -909,18 +933,18 @@ private: * any of these factory methods is only responsible for * ensuring destruction of the message queue itself. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Factory { public: /// Factory method for a statically prioritized ACE_Message_Queue - static ACE_Message_Queue<ACE_SYNCH_USE> * + static ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * create_static_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy * = 0); /// Factory method for a dynamically prioritized (by time to deadline) ACE_Dynamic_Message_Queue - static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> * + static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * create_deadline_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy * = 0, @@ -930,7 +954,7 @@ public: u_long dynamic_priority_offset = 0x200000UL); // 2^(22-1) /// Factory method for a dynamically prioritized (by laxity) ACE_Dynamic_Message_Queue - static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE> * + static ACE_Dynamic_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * create_laxity_message_queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, ACE_Notification_Strategy * = 0, @@ -959,8 +983,8 @@ public: }; // Forward decls. -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> class ACE_Message_Queue_Ex_Iterator; -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> class ACE_Message_Queue_Ex_Reverse_Iterator; +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Message_Queue_Ex_Iterator; +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Message_Queue_Ex_Reverse_Iterator; /** * @class ACE_Message_Queue_Ex @@ -979,7 +1003,7 @@ template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> class ACE_Message_Queue_Ex_Rev * -# ACE_MT_SYNCH: all operations are thread-safe * -# ACE_NULL_SYNCH: no synchronization and no locking overhead */ -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Ex { public: @@ -990,13 +1014,13 @@ public: DEFAULT_PRIORITY = 0 }; - friend class ACE_Message_Queue_Ex_Iterator <ACE_MESSAGE_TYPE, ACE_SYNCH_USE>; - friend class ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>; + friend class ACE_Message_Queue_Ex_Iterator <ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>; + friend class ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>; // = Traits - typedef ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> + typedef ACE_Message_Queue_Ex_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> ITERATOR; - typedef ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> + typedef ACE_Message_Queue_Ex_Reverse_Iterator<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> REVERSE_ITERATOR; /** @@ -1365,6 +1389,14 @@ public: /// Returns a reference to the lock used by the ACE_Message_Queue_Ex. virtual ACE_SYNCH_MUTEX_T &lock (void); + /// Get the current time of day according to the queue's TIME_POLICY. + /// Allows users to initialize timeout + ACE_Time_Value_T<TIME_POLICY> gettimeofday (); + + /// Allows applications to control how the timer queue gets the time + /// of day. + void set_time_policy (TIME_POLICY const & time_policy); + /// Dump the state of an object. virtual void dump (void) const; @@ -1373,7 +1405,7 @@ public: protected: /// Implement this via an ACE_Message_Queue. - ACE_Message_Queue<ACE_SYNCH_USE> queue_; + ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> queue_; }; /** @@ -1381,12 +1413,12 @@ protected: * * @brief Iterator for the ACE_Message_Queue_Ex. */ -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Ex_Iterator { public: // = Initialization method. - ACE_Message_Queue_Ex_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue); + ACE_Message_Queue_Ex_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> & queue); // = Iteration methods. /// Pass back the @a entry that hasn't been seen in the queue. @@ -1408,7 +1440,7 @@ public: private: /// Implement this via the ACE_Message_Queue_Iterator - ACE_Message_Queue_Iterator<ACE_SYNCH_USE> iter_; + ACE_Message_Queue_Iterator<ACE_SYNCH_USE, TIME_POLICY> iter_; }; /** @@ -1416,12 +1448,12 @@ private: * * @brief Reverse iterator for the ACE_Message_Queue_Ex. */ -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Message_Queue_Ex_Reverse_Iterator { public: // = Initialization method. - ACE_Message_Queue_Ex_Reverse_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> & queue); + ACE_Message_Queue_Ex_Reverse_Iterator (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> & queue); // = Iteration methods. /// Pass back the @a entry that hasn't been seen in the queue. @@ -1443,7 +1475,7 @@ public: private: /// Implement this via the ACE_Message_Queue_Reverse_Iterator - ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE> iter_; + ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_USE, TIME_POLICY> iter_; }; /** @@ -1464,8 +1496,8 @@ private: * ACE_Message_Queue_Ex_N uses this method to run through * all the incoming messages and enqueue them in one call. */ -template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> -class ACE_Message_Queue_Ex_N : public ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> +template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> +class ACE_Message_Queue_Ex_N : public ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> { public: // = Initialization and termination methods. diff --git a/dep/acelite/ace/Message_Queue_Vx.cpp b/dep/acelite/ace/Message_Queue_Vx.cpp index 0c680b0353e..a42b1fe6599 100644 --- a/dep/acelite/ace/Message_Queue_Vx.cpp +++ b/dep/acelite/ace/Message_Queue_Vx.cpp @@ -1,5 +1,6 @@ -// $Id: Message_Queue_Vx.cpp 91626 2010-09-07 10:59:20Z johnnyw $ +// $Id: Message_Queue_Vx.cpp 95534 2012-02-17 23:19:33Z mitza $ +#include "ace/Message_Queue.h" #include "ace/Message_Queue_Vx.h" #include "ace/Log_Msg.h" diff --git a/dep/acelite/ace/Message_Queue_Vx.inl b/dep/acelite/ace/Message_Queue_Vx.inl index b295e958c92..03bcc36ee5b 100644 --- a/dep/acelite/ace/Message_Queue_Vx.inl +++ b/dep/acelite/ace/Message_Queue_Vx.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Message_Queue_Vx.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Message_Queue_Vx.inl 96017 2012-08-08 22:18:09Z mitza $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -11,7 +11,7 @@ ACE_INLINE MSG_Q_ID ACE_Message_Queue_Vx::msgq (void) { // Hijack the tail_ field to store the MSG_Q_ID. - return reinterpret_cast<MSG_Q_ID> (tail_); + return static_cast<MSG_Q_ID> (reinterpret_cast<long> (tail_)); } #endif /* ACE_VXWORKS */ diff --git a/dep/acelite/ace/Metrics_Cache_T.h b/dep/acelite/ace/Metrics_Cache_T.h index 5cf438a13a0..05aac1a86cf 100644 --- a/dep/acelite/ace/Metrics_Cache_T.h +++ b/dep/acelite/ace/Metrics_Cache_T.h @@ -4,7 +4,7 @@ /** * @file Metrics_Cache_T.h * - * $Id: Metrics_Cache_T.h 92090 2010-09-29 14:10:45Z johnnyw $ + * $Id: Metrics_Cache_T.h 95839 2012-06-07 10:13:33Z johnnyw $ * * @author Chris Gill <cdgill@cse.wustl.edu> */ @@ -55,7 +55,7 @@ public: typedef ACE_METRICS_TIMEPROBE_TYPE* ACE_METRICS_TIMEPROBE_BASED_PTR_TYPE; typedef char* ACE_METRICS_NAME_BASED_PTR_TYPE; - // Enumerated timeprobe event types. + /// Enumerated timeprobe event types. enum event_id { WORK_START = 0, diff --git a/dep/acelite/ace/Module.cpp b/dep/acelite/ace/Module.cpp index 286270a9b55..376ed83670d 100644 --- a/dep/acelite/ace/Module.cpp +++ b/dep/acelite/ace/Module.cpp @@ -1,4 +1,4 @@ -// $Id: Module.cpp 84068 2008-12-24 18:32:05Z shuston $ +// $Id: Module.cpp 96080 2012-08-20 09:04:14Z johnnyw $ #ifndef ACE_MODULE_CPP #define ACE_MODULE_CPP @@ -19,19 +19,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Module) -template <ACE_SYNCH_DECL> void -ACE_Module<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::dump"); #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> void -ACE_Module<ACE_SYNCH_USE>::writer (ACE_Task<ACE_SYNCH_USE> *q, +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::writer (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q, int flags /* = M_DELETE_WRITER */) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::writer"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::writer"); // Close and maybe delete old writer this->close_i (1, flags); @@ -49,11 +49,11 @@ ACE_Module<ACE_SYNCH_USE>::writer (ACE_Task<ACE_SYNCH_USE> *q, ACE_SET_BITS (flags_, (flags & M_DELETE_WRITER)); } -template <ACE_SYNCH_DECL> void -ACE_Module<ACE_SYNCH_USE>::reader (ACE_Task<ACE_SYNCH_USE> *q, +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::reader (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q, int flags /* = M_DELETE_READER */) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::reader"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::reader"); // Close and maybe delete old writer this->close_i (0, flags); @@ -73,23 +73,23 @@ ACE_Module<ACE_SYNCH_USE>::reader (ACE_Task<ACE_SYNCH_USE> *q, // Link this ACE_Module on top of ACE_Module M. -template <ACE_SYNCH_DECL> void -ACE_Module<ACE_SYNCH_USE>::link (ACE_Module<ACE_SYNCH_USE> *m) +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::link (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *m) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::link"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::link"); this->next (m); this->writer ()->next (m->writer ()); m->reader ()->next (this->reader ()); } -template <ACE_SYNCH_DECL> int -ACE_Module<ACE_SYNCH_USE>::open (const ACE_TCHAR *module_name, - ACE_Task<ACE_SYNCH_USE> *writer_q, - ACE_Task<ACE_SYNCH_USE> *reader_q, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::open (const ACE_TCHAR *module_name, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *writer_q, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *reader_q, void *arg, int flags /* = M_DELETE */) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::open"); this->name (module_name); this->arg_ = arg; @@ -102,27 +102,21 @@ ACE_Module<ACE_SYNCH_USE>::open (const ACE_TCHAR *module_name, if (writer_q == 0) { - ACE_NEW_RETURN (writer_q, - ACE_Thru_Task<ACE_SYNCH_USE>, - -1); + typedef ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY> TASK_TYPE; + ACE_NEW_NORETURN (writer_q, + TASK_TYPE); ACE_SET_BITS (flags, M_DELETE_WRITER); } if (reader_q == 0) { - ACE_NEW_RETURN (reader_q, - ACE_Thru_Task<ACE_SYNCH_USE>, - -1); + typedef ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY> TASK_TYPE; + ACE_NEW_NORETURN (reader_q, + TASK_TYPE); ACE_SET_BITS (flags, M_DELETE_READER); } - this->reader (reader_q); - this->writer (writer_q); - - // Save the flags - this->flags_ = flags; - - // Make sure that the memory is allocated before proceding. + // Make sure that the memory is allocated before proceeding. if (writer_q == 0 || reader_q == 0) { // These calls will delete writer_q and/or reader_q, if @@ -134,6 +128,12 @@ ACE_Module<ACE_SYNCH_USE>::open (const ACE_TCHAR *module_name, return -1; } + this->reader (reader_q); + this->writer (writer_q); + + // Save the flags + this->flags_ = flags; + // Setup back pointers (this must come last, after we've made sure // there's memory allocated here. reader_q->mod_ = this; @@ -144,10 +144,10 @@ ACE_Module<ACE_SYNCH_USE>::open (const ACE_TCHAR *module_name, // Set and get pointer to sibling ACE_Task in ACE_Module. -template <ACE_SYNCH_DECL> ACE_Task<ACE_SYNCH_USE> * -ACE_Module<ACE_SYNCH_USE>::sibling (ACE_Task<ACE_SYNCH_USE> *orig) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::sibling (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *orig) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::sibling"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::sibling"); if (this->q_pair_[0] == orig) return this->q_pair_[1]; else if (this->q_pair_[1] == orig) @@ -156,36 +156,38 @@ ACE_Module<ACE_SYNCH_USE>::sibling (ACE_Task<ACE_SYNCH_USE> *orig) return 0; } -template <ACE_SYNCH_DECL> -ACE_Module<ACE_SYNCH_USE>::ACE_Module (void) - : flags_ (M_FLAGS_NOT_SET) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::ACE_Module (void) + : next_ (0) + , arg_ (0) + , flags_ (M_FLAGS_NOT_SET) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::ACE_Module"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::ACE_Module"); this->name (ACE_TEXT ("<unknown>")); // Do nothing... this->q_pair_[0] = 0; this->q_pair_[1] = 0; } -template <ACE_SYNCH_DECL> -ACE_Module<ACE_SYNCH_USE>::~ACE_Module (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Module (void) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::~ACE_Module"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Module"); // Only close down if we haven't already done so. if (this->reader () || this->writer ()) this->close (); } -template <ACE_SYNCH_DECL> -ACE_Module<ACE_SYNCH_USE>::ACE_Module (const ACE_TCHAR *module_name, - ACE_Task<ACE_SYNCH_USE> *writer_q, - ACE_Task<ACE_SYNCH_USE> *reader_q, +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::ACE_Module (const ACE_TCHAR *module_name, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *writer_q, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *reader_q, void *args, int flags /* = M_DELETE */) : flags_ (M_FLAGS_NOT_SET) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::ACE_Module"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::ACE_Module"); this->q_pair_[0] = 0; this->q_pair_[1] = 0; @@ -196,10 +198,10 @@ ACE_Module<ACE_SYNCH_USE>::ACE_Module (const ACE_TCHAR *module_name, ACE_TEXT ("ACE_Module"))); } -template <ACE_SYNCH_DECL> int -ACE_Module<ACE_SYNCH_USE>::close (int flags /* = M_DELETE_NONE */) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::close (int flags /* = M_DELETE_NONE */) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::close"); int result = 0; @@ -217,18 +219,18 @@ ACE_Module<ACE_SYNCH_USE>::close (int flags /* = M_DELETE_NONE */) return result; } -template <ACE_SYNCH_DECL> int -ACE_Module<ACE_SYNCH_USE>::close_i (int which, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::close_i (int which, int flags) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::close_i"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::close_i"); if (this->q_pair_[which] == 0) return 0; // Copy task pointer to prevent problems when ACE_Task::close // changes the task pointer - ACE_Task<ACE_SYNCH_USE> *task = this->q_pair_[which]; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *task = this->q_pair_[which]; // Change so that close doesn't get called again from the task base. diff --git a/dep/acelite/ace/Module.h b/dep/acelite/ace/Module.h index a7e4575e5f3..b015ec3e4c6 100644 --- a/dep/acelite/ace/Module.h +++ b/dep/acelite/ace/Module.h @@ -4,7 +4,7 @@ /** * @file Module.h * - * $Id: Module.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Module.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -74,7 +74,7 @@ public: * general, you shouldn't subclass from this class, but instead * subclass from the ACE_Task. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Module : public ACE_Module_Base { public: @@ -88,8 +88,8 @@ public: /// Create an initialized module with @a module_name as its identity /// and @a reader and @a writer as its tasks. ACE_Module (const ACE_TCHAR *module_name, - ACE_Task<ACE_SYNCH_USE> *writer = 0, - ACE_Task<ACE_SYNCH_USE> *reader = 0, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *writer = 0, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *reader = 0, void *args = 0, int flags = M_DELETE); @@ -101,8 +101,8 @@ public: * <ACE_Task::module_closed>. */ int open (const ACE_TCHAR *module_name, - ACE_Task<ACE_SYNCH_USE> *writer = 0, - ACE_Task<ACE_SYNCH_USE> *reader = 0, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *writer = 0, + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *reader = 0, void *a = 0, int flags = M_DELETE); @@ -117,7 +117,7 @@ public: // = ACE_Task manipulation routines /// Get the writer task. - ACE_Task<ACE_SYNCH_USE> *writer (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *writer (void); /** * Set the writer task. @a flags can be used to indicate that the @@ -126,10 +126,10 @@ public: * also be deleted, depending on the old flags_ value. Should not * be called from within <ACE_Task::module_closed>. */ - void writer (ACE_Task<ACE_SYNCH_USE> *q, int flags = M_DELETE_WRITER); + void writer (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q, int flags = M_DELETE_WRITER); /// Get the reader task. - ACE_Task<ACE_SYNCH_USE> *reader (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *reader (void); /** * Set the reader task. @a flags can be used to indicate that the @@ -138,10 +138,10 @@ public: * also be deleted, depending on the old flags_ value. Should not * be called from within <ACE_Task::module_closed>. */ - void reader (ACE_Task<ACE_SYNCH_USE> *q, int flags = M_DELETE_READER); + void reader (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q, int flags = M_DELETE_READER); /// Set and get pointer to sibling ACE_Task in an ACE_Module - ACE_Task<ACE_SYNCH_USE> *sibling (ACE_Task<ACE_SYNCH_USE> *orig); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *sibling (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *orig); // = Identify the module /// Get the module name. @@ -158,13 +158,13 @@ public: void arg (void *); /// Link to other modules in the ustream stack - void link (ACE_Module<ACE_SYNCH_USE> *m); + void link (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *m); /// Get the next pointer to the module above in the stream. - ACE_Module<ACE_SYNCH_USE> *next (void); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *next (void); /// Set the next pointer to the module above in the stream. - void next (ACE_Module<ACE_SYNCH_USE> *m); + void next (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *m); /// Dump the state of an object. void dump (void) const; @@ -179,13 +179,13 @@ private: /// Pair of Tasks that form the "read-side" and "write-side" of the /// ACE_Module partitioning. - ACE_Task<ACE_SYNCH_USE> *q_pair_[2]; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q_pair_[2]; /// Name of the ACE_Module. ACE_TCHAR name_[MAXPATHLEN + 1]; /// Next ACE_Module in the stack. - ACE_Module<ACE_SYNCH_USE> *next_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *next_; /// Argument passed through to the reader and writer task when they /// are opened. diff --git a/dep/acelite/ace/Module.inl b/dep/acelite/ace/Module.inl index 62e4929a24b..3081bed3925 100644 --- a/dep/acelite/ace/Module.inl +++ b/dep/acelite/ace/Module.inl @@ -1,64 +1,64 @@ // -*- C++ -*- // -// $Id: Module.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Module.inl 96061 2012-08-16 09:36:07Z mcorino $ #include "ace/OS_NS_string.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL> ACE_INLINE void * -ACE_Module<ACE_SYNCH_USE>::arg (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::arg (void) const { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::arg"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::arg"); return this->arg_; } -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Module<ACE_SYNCH_USE>::arg (void *a) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::arg (void *a) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::arg"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::arg"); this->arg_ = a; } -template <ACE_SYNCH_DECL> ACE_INLINE const ACE_TCHAR * -ACE_Module<ACE_SYNCH_USE>::name (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE const ACE_TCHAR * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::name (void) const { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::name"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::name"); return this->name_; } -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Module<ACE_SYNCH_USE>::name (const ACE_TCHAR *n) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::name (const ACE_TCHAR *n) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::name"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::name"); ACE_OS::strsncpy (this->name_, n, MAXPATHLEN); } -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> * -ACE_Module<ACE_SYNCH_USE>::writer (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::writer (void) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::writer"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::writer"); return this->q_pair_[1]; } -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> * -ACE_Module<ACE_SYNCH_USE>::reader (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::reader (void) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::reader"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::reader"); return this->q_pair_[0]; } -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> * -ACE_Module<ACE_SYNCH_USE>::next (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::next (void) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::next"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::next"); return this->next_; } -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Module<ACE_SYNCH_USE>::next (ACE_Module<ACE_SYNCH_USE> *m) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::next (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *m) { - ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::next"); + ACE_TRACE ("ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::next"); this->next_ = m; } diff --git a/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.cpp b/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.cpp new file mode 100644 index 00000000000..5c4b02d794b --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.cpp @@ -0,0 +1,35 @@ +// $Id: Auto_Update_Starter.cpp 86518 2009-08-18 12:30:56Z olli $ + +#include "ace/Monitor_Control/Auto_Update_Starter.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Reactor.h" +#include "ace/Dynamic_Service.h" +#include "ace/Monitor_Admin_Manager.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + int + Auto_Update_Starter::svc (void) + { + MC_ADMINMANAGER* mgr = + ACE_Dynamic_Service<MC_ADMINMANAGER>::instance ("MC_ADMINMANAGER"); + + /// We want the thread in which the event loop is started to + /// own the reactor, otherwise the handle_timeout() calls + /// aren't triggerd. + mgr->admin ().reactor ()->owner (ACE_Thread::self ()); + + return mgr->admin ().reactor ()->run_reactor_event_loop (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.h b/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.h new file mode 100644 index 00000000000..7201410161a --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Auto_Update_Starter.h @@ -0,0 +1,61 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Auto_Update_Starter.h + * + * $Id: Auto_Update_Starter.h 85297 2009-05-07 01:40:41Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef AUTO_UPDATE_STARTER_H +#define AUTO_UPDATE_STARTER_H + +#include /**/ "ace/pre.h" + +#include "ace/Task.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Auto_Update_Starter + * + * @brief Starts reactor event loop that handles registered timers. + * + * For all the monitors that are periodically updated, the reactor + * event loop that calls their associated registered timers must + * be started in a separate thread so the rest of the application + * isn't blocked. A very simple class inheriting from ACE_Task_Base + * and overriding the svc() method suffices. + */ + class MONITOR_CONTROL_Export Auto_Update_Starter : public ACE_Task_Base + { + public: + int svc (void); + }; + } +} + +typedef ACE::Monitor_Control::Auto_Update_Starter STARTER; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // AUTO_UPDATE_STARTER_H diff --git a/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.cpp b/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.cpp new file mode 100644 index 00000000000..97467dfd90d --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.cpp @@ -0,0 +1,136 @@ +// $Id: BSD_Network_Interface_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Monitor_Control/BSD_Network_Interface_Monitor.h" + +#if defined (__NetBSD__) || defined (__OpenBSD__) + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/sockio.h> +#include <sys/ioctl.h> +#include <net/if.h> +#include <ifaddrs.h> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + BSD_Network_Interface_Monitor::BSD_Network_Interface_Monitor ( + const ACE_TCHAR *lookup_str) + : value_ (0UL), + start_ (0UL), + lookup_str_ (lookup_str) + { + this->init(); + } + + void + BSD_Network_Interface_Monitor::update_i (void) + { + this->fetch(this->value_); + this->value_ -= this->start_; + } + + void + BSD_Network_Interface_Monitor::clear_impl (void) + { + this->init(); + } + + void + BSD_Network_Interface_Monitor::init (void) + { + this->fetch(this->start_); + this->value_ = 0UL; + } + + void + BSD_Network_Interface_Monitor::fetch (ACE_UINT64& value) const + { + ACE_UINT64 count = 0; + int fd = socket (AF_INET, SOCK_DGRAM, 0); + + if (fd == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("socket failed\n"))); + return; + } + + struct ifaddrs *ifa, *ifap; + + if (getifaddrs (&ifap) < 0) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("getifaddrs failed\n"))); + close (fd); + return; + } + + char *p = 0; + + for (ifa = ifap; ifa != 0; ifa = ifa->ifa_next) + { + if (p && strcmp (p, ifa->ifa_name) == 0) + { + continue; + } + + p = ifa->ifa_name; + +#if defined (__OpenBSD__) + struct ifreq ifdr; +#else + struct ifdatareq ifdr; +#endif + memset (&ifdr, 0, sizeof (ifdr)); + +#if defined (__OpenBSD__) + struct if_data if_data; + ifdr.ifr_data = reinterpret_cast<caddr_t> (&if_data); + strncpy (ifdr.ifr_name, ifa->ifa_name, IFNAMSIZ-1); +#else + strncpy (ifdr.ifdr_name, ifa->ifa_name, sizeof (ifdr)); +#endif + if (ioctl (fd, SIOCGIFDATA, &ifdr) == -1) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("SIOCGIFDATA failed\n"))); + } + +#if defined (__OpenBSD__) + struct if_data * const ifi = &if_data; +#else + struct if_data * const ifi = &ifdr.ifdr_data; +#endif + + if (this->lookup_str_ == "ibytes") + { + count += ifi->ifi_ibytes; + } + else if (this->lookup_str_ == "ipackets") + { + count += ifi->ifi_ipackets; + } + else if (this->lookup_str_ == "obytes") + { + count += ifi->ifi_obytes; + } + else if (this->lookup_str_ == "opackets") + { + count += ifi->ifi_opackets; + } + } + + freeifaddrs (ifap); + close (fd); + + value = count; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (__NetBSD__) || defined (__OpenBSD__) */ diff --git a/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.h b/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.h new file mode 100644 index 00000000000..df4ab5d7102 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/BSD_Network_Interface_Monitor.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file BSD_Network_Interface_Monitor.h + * + * $Id: BSD_Network_Interface_Monitor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef BSD_NETWORK_INTERFACE_MONITOR_H +#define BSD_NETWORK_INTERFACE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +#if defined (__NetBSD__) || defined (__OpenBSD__) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class BSD_Network_Interface_Monitor + * + * @brief Mixin class for network interface monitors compiled on + * xxxBSD machines. + */ + class MONITOR_CONTROL_Export BSD_Network_Interface_Monitor + { + protected: + BSD_Network_Interface_Monitor (const ACE_TCHAR *lookup_str); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + ACE_UINT64 value_; + + private: + void init (void); + void fetch (ACE_UINT64& value) const; + + ACE_UINT64 start_; + ACE_CString lookup_str_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (__NetBSD__) || defined (__OpenBSD__) */ + +#include /**/ "ace/post.h" + +#endif // BSD_NETWORK_INTERFACE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.cpp new file mode 100644 index 00000000000..a1ef6b6e3b3 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.cpp @@ -0,0 +1,60 @@ +// $Id: Bytes_Received_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Bytes_Received_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Bytes_Received_Monitor::default_name_ = + "OS/Network/BytesReceived"; + + Bytes_Received_Monitor::Bytes_Received_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Multi_Instance_Monitor ( + ACE_TEXT ("\\Network Interface(*)\\Bytes Received/sec")) +#elif defined (ACE_LINUX) || defined (AIX) + , Linux_Network_Interface_Monitor ( + " %*[^:]: %lu %*u %*u %*u %*u %*u %*u %*u %*u %*u") + /// Scan format for /proc/net/dev +#elif defined (ACE_HAS_KSTAT) + , Solaris_Network_Interface_Monitor (ACE_TEXT ("rbytes")) +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , BSD_Network_Interface_Monitor (ACE_TEXT ("ibytes")) +#elif defined (__FreeBSD__) || defined (__Lynx__) + , FreeBSD_Network_Interface_Monitor (ACE_TEXT ("ibytes")) +#endif + {} + + void + Bytes_Received_Monitor::update (void) + { + this->update_i (); + + /// On some platforms, value_ is an ACE_UINT64. + this->receive (static_cast<double> (this->value_)); + } + + const char* + Bytes_Received_Monitor::default_name (void) + { + return Bytes_Received_Monitor::default_name_; + } + + void + Bytes_Received_Monitor::clear_i (void) + { + this->clear_impl (); + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.h b/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.h new file mode 100644 index 00000000000..1490293c0cb --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Bytes_Received_Monitor.h @@ -0,0 +1,94 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Bytes_Received_Monitor.h + * + * $Id: Bytes_Received_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef BYTES_RECEIVED_MONITOR_H +#define BYTES_RECEIVED_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Multi_Instance_Monitor.h" +#elif defined (ACE_LINUX) || defined (AIX) +#include "ace/Monitor_Control/Linux_Network_Interface_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +#include "ace/Monitor_Control/Solaris_Network_Interface_Monitor.h" +#elif defined (__FreeBSD__) || defined (__Lynx__) +#include "ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h" +#elif defined (__NetBSD__) || defined (__OpenBSD__) +#include "ace/Monitor_Control/BSD_Network_Interface_Monitor.h" +#else +#include "ace/Monitor_Control/Null_Network_Interface_Monitor.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Bytes_Received_Monitor + * + * @brief Monitors total bytes received over all network interfaces. + */ + class MONITOR_CONTROL_Export Bytes_Received_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Multi_Instance_Monitor +#elif defined (ACE_LINUX) || defined (AIX) + , public Linux_Network_Interface_Monitor +#elif defined (ACE_HAS_KSTAT) + , public Solaris_Network_Interface_Monitor +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , public BSD_Network_Interface_Monitor +#elif defined (__FreeBSD__) || defined (__Lynx__) + , public FreeBSD_Network_Interface_Monitor +#else + , public Null_Network_Interface_Monitor +#endif + { + public: + Bytes_Received_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // BYTES_RECEIVED_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.cpp new file mode 100644 index 00000000000..03e8f6f4ffc --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.cpp @@ -0,0 +1,60 @@ +// $Id: Bytes_Sent_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Bytes_Sent_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Bytes_Sent_Monitor::default_name_ = + "OS/Network/BytesSent"; + + Bytes_Sent_Monitor::Bytes_Sent_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Multi_Instance_Monitor ( + ACE_TEXT ("\\Network Interface(*)\\Bytes Sent/sec")) +#elif defined (ACE_LINUX) || defined (AIX) + , Linux_Network_Interface_Monitor ( + " %*[^:]: %*u %*u %*u %*u %*u %*u %*u %*u %lu %*u") + /// Scan format for /proc/net/dev +#elif defined (ACE_HAS_KSTAT) + , Solaris_Network_Interface_Monitor (ACE_TEXT ("obytes")) +#elif defined (__FreeBSD__) || defined (__Lynx__) + , FreeBSD_Network_Interface_Monitor (ACE_TEXT ("obytes")) +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , BSD_Network_Interface_Monitor (ACE_TEXT ("obytes")) +#endif + {} + + void + Bytes_Sent_Monitor::update (void) + { + this->update_i (); + + /// On some platforms, value_ is an ACE_UINT64. + this->receive (static_cast<double> (this->value_)); + } + + const char* + Bytes_Sent_Monitor::default_name (void) + { + return Bytes_Sent_Monitor::default_name_; + } + + void + Bytes_Sent_Monitor::clear_i (void) + { + this->clear_impl (); + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.h b/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.h new file mode 100644 index 00000000000..8023195c355 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Bytes_Sent_Monitor.h @@ -0,0 +1,94 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Bytes_Sent_Monitor.h + * + * $Id: Bytes_Sent_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef BYTES_SENT_MONITOR_H +#define BYTES_SENT_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Multi_Instance_Monitor.h" +#elif defined (ACE_LINUX) || defined (AIX) +#include "ace/Monitor_Control/Linux_Network_Interface_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +#include "ace/Monitor_Control/Solaris_Network_Interface_Monitor.h" +#elif defined (__FreeBSD__) || defined (__Lynx__) +#include "ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h" +#elif defined (__NetBSD__) || defined (__OpenBSD__) +#include "ace/Monitor_Control/BSD_Network_Interface_Monitor.h" +#else +#include "ace/Monitor_Control/Null_Network_Interface_Monitor.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Bytes_Sent_Monitor + * + * @brief Monitors total bytes sent over all network interfaces. + */ + class MONITOR_CONTROL_Export Bytes_Sent_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Multi_Instance_Monitor +#elif defined (ACE_LINUX) || defined (AIX) + , public Linux_Network_Interface_Monitor +#elif defined (ACE_HAS_KSTAT) + , public Solaris_Network_Interface_Monitor +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , public BSD_Network_Interface_Monitor +#elif defined (__FreeBSD__) || defined (__Lynx__) + , public FreeBSD_Network_Interface_Monitor +#else + , public Null_Network_Interface_Monitor +#endif + { + public: + Bytes_Sent_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // BYTESSENTMONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.cpp b/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.cpp new file mode 100644 index 00000000000..5e016777c01 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.cpp @@ -0,0 +1,254 @@ +// $Id: CPU_Load_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/CPU_Load_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_KSTAT) +#include <sys/sysinfo.h> +#endif + +#if defined (ACE_LINUX) +#include "ace/OS_NS_stdio.h" +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* CPU_Load_Monitor::default_name_ = + "OS/Processor/CPULoad"; + + CPU_Load_Monitor::CPU_Load_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Monitor (ACE_TEXT("\\Processor(_Total)\\% Processor Time")) +#endif +#if defined (ACE_LINUX) || defined (ACE_HAS_KSTAT) + , user_ (0) + , wait_ (0) + , kernel_ (0) + , idle_ (0) + , prev_idle_ (0) + , prev_total_ (0.0) +#endif +#if defined (ACE_LINUX) + , file_ptr_ (0) +#elif defined (ACE_HAS_KSTAT) + , kstats_ (0) + , kstat_ (0) + , kstat_id_ (0) +#endif + { + this->init (); + } + + void + CPU_Load_Monitor::update (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->update_i (); + this->receive (this->value_); +#elif defined (ACE_LINUX) + this->access_proc_stat (&this->idle_); +#elif defined (ACE_HAS_KSTAT) + this->access_kstats (&this->idle_); +#endif + +#if defined (ACE_LINUX) || defined (ACE_HAS_KSTAT) + double delta_idle = this->idle_ - this->prev_idle_; + double total = + this->user_ + this->wait_ + this->kernel_ + this->idle_; + double delta_total = total - this->prev_total_; + + if (ACE::is_equal (delta_total, 0.0)) + { + /// The system hasn't updated /proc/stat since the last call + /// to update(), we must avoid dividing by 0. + return; + } + + double percent_cpu_load = 100.0 - (delta_idle / delta_total * 100.0); + + /// Stores value and timestamp with thread-safety. + this->receive (percent_cpu_load); + + this->prev_idle_ = this->idle_; + this->prev_total_ = total; +#endif + } + + const char* + CPU_Load_Monitor::default_name (void) + { + return CPU_Load_Monitor::default_name_; + } + + void + CPU_Load_Monitor::clear_i (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->clear_impl (); +#endif + + this->init (); + this->Monitor_Base::clear_i (); + } + + void + CPU_Load_Monitor::init (void) + { +#if defined (ACE_LINUX) + /// All data in this file are stored as running 'jiffy' totals, so we + /// get values here in the constructor to subtract for the difference + /// in subsequent calls. + this->access_proc_stat (&this->prev_idle_); + + this->prev_total_ = + this->user_ + this->wait_ + this->kernel_ + this->prev_idle_; +#elif defined (ACE_HAS_KSTAT) + /// Stored similarly to Linux, in a system file. + this->access_kstats (&this->prev_idle_); + + this->prev_total_ = + this->user_ + this->wait_ + this->kernel_ + this->prev_idle_; +#endif + } + +#if defined (ACE_LINUX) + void + CPU_Load_Monitor::access_proc_stat (unsigned long *which_idle) + { + this->file_ptr_ = ACE_OS::fopen (ACE_TEXT ("/proc/stat"), + ACE_TEXT ("r")); + + if (this->file_ptr_ == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("CPU load - opening /proc/stat failed\n"))); + return; + } + + char *item = 0; + char *arg = 0; + + while ((ACE_OS::fgets (buf_, sizeof (buf_), file_ptr_)) != 0) + { + item = ACE_OS::strtok (this->buf_, " \t\n"); + arg = ACE_OS::strtok (0, "\n"); + + if (item == 0 || arg == 0) + { + continue; + } + + if (ACE_OS::strcmp (item, "cpu") == 0) + { + sscanf (arg, + "%lu %lu %lu %lu", + &this->user_, + &this->wait_, + &this->kernel_, + which_idle); + break; + } + } + + ACE_OS::fclose (this->file_ptr_); + } +#endif + +#if defined (ACE_HAS_KSTAT) + void + CPU_Load_Monitor::access_kstats (unsigned long *which_idle) + { + this->kstats_ = kstat_open (); + + if (this->kstats_ == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("opening kstats file failed\n"))); + return; + } + + this->kstat_id_ = this->kstats_->kc_chain_id; + + while (true) + { + this->kernel_ = 0UL; + this->wait_ = 0UL; + this->user_ = 0UL; + (*which_idle) = 0UL; + + /// Unlike Linux's "/proc/stat", there is no entry for total CPU + /// stats, so we have to sum them manually. + for (this->kstat_ = this->kstats_->kc_chain; + this->kstat_ != 0; + this->kstat_ = this->kstat_->ks_next) + { + int result = ACE_OS::strncmp (this->kstat_->ks_name, + "cpu_stat", + ACE_OS::strlen ("cpu_stat")); + + if (result == 0) + { + /// Because the kstat chain can change dynamically, + /// watch the chain ID and restart the walk if the ID + /// differs from what we saw during the walk. The restart + /// is done by breaking from the cycle with kstat_ not 0. + + kid_t kstat_id = kstat_read (this->kstats_, this->kstat_, 0); + + if (kstat_id != this->kstat_id_) + { + break; + } + + cpu_stat_t &kstat_cpu = + *((cpu_stat_t *) this->kstat_->ks_data); + + this->kernel_ += kstat_cpu.cpu_sysinfo.cpu[CPU_KERNEL]; + this->wait_ += kstat_cpu.cpu_sysinfo.cpu[CPU_WAIT]; + this->user_ += kstat_cpu.cpu_sysinfo.cpu[CPU_USER]; + (*which_idle) += kstat_cpu.cpu_sysinfo.cpu[CPU_IDLE]; + } + } + + if (this->kstat_ != 0) + { + /// The ID changed underneath us, so get the new one and + /// start again. + this->kstat_id_ = kstat_chain_update (this->kstats_); + + if (! this->kstat_id_ > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("kstat chain update ") + ACE_TEXT ("returned null id\n"))); + return; + } + } + else + { + /// Clean run, exit the WHILE loop. + break; + } + } + + int status = kstat_close (this->kstats_); + + if (status != 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("closing kstats file failed\n"))); + } + } +#endif + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.h b/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.h new file mode 100644 index 00000000000..6481a1a66b4 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/CPU_Load_Monitor.h @@ -0,0 +1,106 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CPU_Load_Monitor.h + * + * $Id: CPU_Load_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CPU_LOAD_MONITOR_H +#define CPU_LOAD_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +#include "ace/os_include/os_kstat.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class CPU_Load_Monitor + * + * @brief Monitors percentage CPU utilization. + */ + class MONITOR_CONTROL_Export CPU_Load_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Monitor +#endif + { + public: + CPU_Load_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + /// Common code to the constructor and to clear_i(). + void init (void); + + private: +#if defined (ACE_LINUX) + void access_proc_stat (unsigned long *which_idle); +#endif + +#if defined (ACE_HAS_KSTAT) + void access_kstats (unsigned long *which_idle); +#endif + + private: + static const char* default_name_; + + /// Common to Linux and Solaris implementations. +#if defined (ACE_LINUX) || defined (ACE_HAS_KSTAT) + unsigned long user_; + unsigned long wait_; + unsigned long kernel_; + unsigned long idle_; + unsigned long prev_idle_; + double prev_total_; +#endif +#if defined (ACE_LINUX) + FILE *file_ptr_; + char buf_[1024]; +#elif defined (ACE_HAS_KSTAT) + kstat_ctl_t *kstats_; + kstat_t *kstat_; + kid_t kstat_id_; +#endif + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // CPU_LOAD_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.cpp b/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.cpp new file mode 100644 index 00000000000..18916522538 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.cpp @@ -0,0 +1,62 @@ +// $Id: Constraint_Interpreter.cpp 86518 2009-08-18 12:30:56Z olli $ + +#include "ace/Monitor_Control/Constraint_Interpreter.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Log_Msg.h" + +#include "ace/ETCL/ETCL_Constraint.h" + +#include "ace/Monitor_Control/Constraint_Visitor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Constraint_Interpreter::Constraint_Interpreter (void) + { + } + + Constraint_Interpreter::~Constraint_Interpreter (void) + { + } + + int + Constraint_Interpreter::build_tree (const char *constraints) + { + if (ETCL_Interpreter::is_empty_string (constraints)) + { + /// Root is deleted in the interpreter's destructor. + ACE_NEW_RETURN (this->root_, + ETCL_Literal_Constraint (true), + -1); + } + else + { + /// root_ is set in this base class call. + if (ETCL_Interpreter::build_tree (constraints) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Constraint_Interpreter::build_tree() - " + "ETCL_Interpreter::build_tree() failed\n"), + -1); + } + } + + return 0; + } + + ACE_CDR::Boolean + Constraint_Interpreter::evaluate (Constraint_Visitor &evaluator) + { + return evaluator.evaluate_constraint (this->root_); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.h b/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.h new file mode 100644 index 00000000000..e75981980fe --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Constraint_Interpreter.h @@ -0,0 +1,74 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Constraint_Interpreter.h + * + * $Id: Constraint_Interpreter.h 81753 2008-05-21 19:02:47Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CONSTRAINT_INTERPRETER_H +#define CONSTRAINT_INTERPRETER_H + +#include /**/ "ace/pre.h" + +#include "ace/CDR_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/ETCL/ETCL_Interpreter.h" + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + class Constraint_Visitor; + + /** + * @class Constraint_Interpreter + * + * @brief "ETCL" Interpreter for MonitorControl constraints, + specialized to encapsulate MonitorControl-specific + knowledge of types and visitors. + */ + class MONITOR_CONTROL_Export Constraint_Interpreter + : public ETCL_Interpreter + { + public: + Constraint_Interpreter (void); + + virtual ~Constraint_Interpreter (void); + + /** + * This method builds an expression tree representing the + * constraint specified in <constraints>, and returns -1 with + * an error message if the constraint given has syntax errors or + * semantic errors, such as mismatched types. + */ + int build_tree (const char* constraints); + + /// Returns true if the constraint is evaluated successfully by + /// the evaluator. + ACE_CDR::Boolean evaluate (Constraint_Visitor &evaluator); + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif /* CONSTRAINT_INTERPRETER_H */ diff --git a/dep/acelite/ace/Monitor_Control/Constraint_Visitor.cpp b/dep/acelite/ace/Monitor_Control/Constraint_Visitor.cpp new file mode 100644 index 00000000000..d37ad53cc49 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Constraint_Visitor.cpp @@ -0,0 +1,304 @@ +// $Id: Constraint_Visitor.cpp 86518 2009-08-18 12:30:56Z olli $ + +#include "ace/Monitor_Control/Constraint_Visitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/ETCL/ETCL_y.h" +#include "ace/ETCL/ETCL_Constraint.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Constraint_Visitor::Constraint_Visitor ( + const Monitor_Control_Types::Data& data) + : data_ (data) + {} + + Constraint_Visitor::~Constraint_Visitor (void) + {} + + ACE_CDR::Boolean + Constraint_Visitor::evaluate_constraint (ETCL_Constraint *root) + { + ACE_CDR::Boolean result = false; + this->queue_.reset (); + + // Evaluate the constraint in root_; + if (root != 0) + { + if (root->accept (this) == 0 && !this->queue_.is_empty ()) + { + ETCL_Literal_Constraint top; + this->queue_.dequeue_head (top); + result = (ACE_CDR::Boolean) top; + } + } + + // If a property couldn't be evaluated we must return FALSE. + return result; + } + + int + Constraint_Visitor::visit_literal (ETCL_Literal_Constraint *constraint) + { + this->queue_.enqueue_head (*constraint); + return 0; + } + + int + Constraint_Visitor::visit_identifier (ETCL_Identifier *ident) + { + /// TODO - check for strings related to other identifiers + /// relevant in MonitorControl, for example the data timestamp. + if (ACE_OS::strcmp (ident->value (), "value") == 0) + { + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (this->data_.value_)); + + return 0; + } + + return -1; + } + + int + Constraint_Visitor::visit_unary_expr (ETCL_Unary_Expr *unary_expr) + { + ETCL_Constraint *subexpression = unary_expr->subexpr (); + + /// Call to accept() puts the subexpression's evaluation on our queue. + if (subexpression->accept (this) == 0) + { + ETCL_Literal_Constraint subexpr_result; + ACE_CDR::Boolean result = 0; + int op_type = unary_expr->type (); + + switch (op_type) + { + case ETCL_NOT: + this->queue_.dequeue_head (subexpr_result); + result = ! (ACE_CDR::Boolean) subexpr_result; + this->queue_.enqueue_head (ETCL_Literal_Constraint (result)); + return 0; + case ETCL_MINUS: + /// The leading '-' was parsed separately, so we have to pull + /// the literal constraint off the queue, apply the class' own + /// unary minus operator, and put it back. + this->queue_.dequeue_head (subexpr_result); + this->queue_.enqueue_head (-subexpr_result); + return 0; + case ETCL_PLUS: + /// Leave the literal constraint on the queue. The leading + /// '+' was just syntactic sugar - no action is necessary. + return 0; + default: + /// The parser should never construct a ETCL_Unary_Constraint + /// behind any operators except the above three. + return -1; + } + } + + return -1; + } + + int + Constraint_Visitor::visit_binary_expr (ETCL_Binary_Expr *binary_expr) + { + int bin_op_type = binary_expr->type (); + + switch (bin_op_type) + { + case ETCL_OR: + return this->visit_or (binary_expr); + case ETCL_AND: + return this->visit_and (binary_expr); + case ETCL_LT: + case ETCL_LE: + case ETCL_GT: + case ETCL_GE: + case ETCL_EQ: + case ETCL_NE: + case ETCL_PLUS: + case ETCL_MINUS: + case ETCL_MULT: + case ETCL_DIV: + return this->visit_binary_op (binary_expr, bin_op_type); + /// These last two are not supported in non_CORBA ETCL. + case ETCL_TWIDDLE: + case ETCL_IN: + default: + return -1; + } + } + + int + Constraint_Visitor::visit_or (ETCL_Binary_Expr *binary) + { + int return_value = -1; + ACE_CDR::Boolean result = false; + ETCL_Constraint *lhs = binary->lhs (); + + /// Call to accept() puts the lhs (or its evaluation) on our queue. + if (lhs->accept (this) == 0) + { + ETCL_Literal_Constraint lhs_result; + this->queue_.dequeue_head (lhs_result); + result = (ACE_CDR::Boolean) lhs_result; + + /// Short-circuiting OR. + if (!result) + { + ETCL_Constraint *rhs = binary->rhs (); + + if (rhs->accept (this) == 0) + { + ETCL_Literal_Constraint rhs_result; + this->queue_.dequeue_head (rhs_result); + result = (ACE_CDR::Boolean) rhs_result; + return_value = 0; + } + } + else + { + return_value = 0; + } + } + + if (return_value == 0) + { + this->queue_.enqueue_head (ETCL_Literal_Constraint (result)); + } + + return return_value; + } + + int + Constraint_Visitor::visit_and (ETCL_Binary_Expr *binary) + { + int return_value = -1; + ACE_CDR::Boolean result = false; + ETCL_Constraint *lhs = binary->lhs (); + + /// Call to accept() puts the lhs (or its evaluation) on our queue. + if (lhs->accept (this) == 0) + { + ETCL_Literal_Constraint lhs_result; + this->queue_.dequeue_head (lhs_result); + result = (ACE_CDR::Boolean) lhs_result; + + /// Short-circuiting AND. + if (result == true) + { + ETCL_Constraint *rhs = binary->rhs (); + + if (rhs->accept (this) == 0) + { + ETCL_Literal_Constraint rhs_result; + this->queue_.dequeue_head (rhs_result); + result = (ACE_CDR::Boolean) rhs_result; + return_value = 0; + } + } + else + { + return_value = 0; + } + } + + if (return_value == 0) + { + this->queue_.enqueue_head (ETCL_Literal_Constraint (result)); + } + + return return_value; + } + + int + Constraint_Visitor::visit_binary_op (ETCL_Binary_Expr *binary, + int op_type) + { + int return_value = -1; + ETCL_Constraint *lhs = binary->lhs (); + ACE_CDR::Boolean result = false; + + /// Perform an operation on the results of evaluating the left and + /// right branches of this subtree. The evaluations go on our queue. + if (lhs->accept (this) == 0) + { + ETCL_Literal_Constraint left_operand; + this->queue_.dequeue_head (left_operand); + ETCL_Constraint *rhs = binary->rhs (); + + if (rhs->accept (this) == 0) + { + ETCL_Literal_Constraint right_operand; + this->queue_.dequeue_head (right_operand); + return_value = 0; + + switch (op_type) + { + case ETCL_LT: + result = left_operand < right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_LE: + result = left_operand <= right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_GT: + result = left_operand > right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_GE: + result = left_operand >= right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_EQ: + result = left_operand == right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_NE: + result = left_operand != right_operand; + this->queue_.enqueue_head ( + ETCL_Literal_Constraint (result)); + break; + case ETCL_PLUS: + this->queue_.enqueue_head ( + left_operand + right_operand); + break; + case ETCL_MINUS: + this->queue_.enqueue_head ( + left_operand - right_operand); + break; + case ETCL_MULT: + this->queue_.enqueue_head ( + left_operand * right_operand); + break; + case ETCL_DIV: + this->queue_.enqueue_head ( + left_operand / right_operand); + break; + default: + return_value = -1; + break; + } + } + } + + return return_value; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Constraint_Visitor.h b/dep/acelite/ace/Monitor_Control/Constraint_Visitor.h new file mode 100644 index 00000000000..582ee1ab129 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Constraint_Visitor.h @@ -0,0 +1,86 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Constraint_Visitor.h + * + * $Id: Constraint_Visitor.h 86518 2009-08-18 12:30:56Z olli $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CONSTRAINT_VISITOR_H +#define CONSTRAINT_VISITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/CDR_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Monitor_Control_Types.h" + +#include "ace/ETCL/ETCL_Constraint.h" +#include "ace/ETCL/ETCL_Constraint_Visitor.h" + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ETCL_Literal_Constraint; +class ETCL_Identifier; +class ETCL_Unary_Expr; +class ETCL_Binary_Expr; +class ETCL_Constraint; + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Constraint_Visitor + * + * @brief Backend for the non-CORBA ETCL frontend, specific to + * MonitorControl and supporting only basic types not + specific to CORBA. + */ + class MONITOR_CONTROL_Export Constraint_Visitor + : public ETCL_Constraint_Visitor + { + public: + Constraint_Visitor (const Monitor_Control_Types::Data& data); + virtual ~Constraint_Visitor (void); + + ACE_CDR::Boolean evaluate_constraint (ETCL_Constraint *root); + + virtual int visit_literal (ETCL_Literal_Constraint *); + virtual int visit_identifier (ETCL_Identifier *); + virtual int visit_unary_expr (ETCL_Unary_Expr *); + virtual int visit_binary_expr (ETCL_Binary_Expr *); + + private: + /// Sub-methods for visit_binary_expr(). + int visit_or (ETCL_Binary_Expr *); + int visit_and (ETCL_Binary_Expr *); + int visit_binary_op (ETCL_Binary_Expr *binary_expr, + int op_type); + + private: + const Monitor_Control_Types::Data& data_; + ACE_Unbounded_Queue<ETCL_Literal_Constraint> queue_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // CONSTRAINT_VISITOR_H diff --git a/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.cpp b/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.cpp new file mode 100644 index 00000000000..87a3cffdd8a --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.cpp @@ -0,0 +1,124 @@ +// $Id: FreeBSD_Network_Interface_Monitor.cpp 86518 2009-08-18 12:30:56Z olli $ + +#include "ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h" + +#if defined (__FreeBSD__) || defined (__Lynx__) + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/sysctl.h> +#include <sys/time.h> +#include <net/if.h> +#include <net/if_mib.h> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + FreeBSD_Network_Interface_Monitor::FreeBSD_Network_Interface_Monitor ( + const ACE_TCHAR *lookup_str) + : value_ (0UL), + start_ (0UL), + lookup_str_ (lookup_str) + { + this->init(); + } + + void + FreeBSD_Network_Interface_Monitor::update_i (void) + { + this->fetch(this->value_); + this->value_ -= this->start_; + } + + void + FreeBSD_Network_Interface_Monitor::clear_impl (void) + { + this->init(); + } + + void + FreeBSD_Network_Interface_Monitor::init (void) + { + this->fetch(this->start_); + this->value_ = 0UL; + } + + void + FreeBSD_Network_Interface_Monitor::fetch (ACE_UINT64& value) const + { + ACE_UINT64 count = 0; + + int req_name[5]; + int ifcount; + size_t ifcount_len = sizeof(ifcount); + + req_name[0] = CTL_NET; + req_name[1] = PF_LINK; + req_name[2] = NETLINK_GENERIC; + req_name[3] = IFMIB_SYSTEM; + req_name[4] = IFMIB_IFCOUNT; + + if (::sysctl(req_name, 5, &ifcount, &ifcount_len, (void *)0, 0) == -1) + { + ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) %p\n"), + ACE_TEXT("sysctl failed"))); + + return; + } + + for (int i = 1; i <= ifcount; i++) + { + int name[6]; + struct ifmibdata ifmd; + size_t len = sizeof(ifmd); + + name[0] = CTL_NET; + name[1] = PF_LINK; + name[2] = NETLINK_GENERIC; + name[3] = IFMIB_IFDATA; + name[4] = i; + name[5] = IFDATA_GENERAL; + + if(::sysctl(name, 6, &ifmd, &len, (void *)0, 0) == -1) + { + ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) %p\n"), + ACE_TEXT("sysctl failed"))); + + break; + } + + struct if_data * const ifi = &ifmd.ifmd_data; + + if(this->lookup_str_ == "ibytes") + { + count += ifi->ifi_ibytes; + } + else if(this->lookup_str_ == "ipackets") + { + count += ifi->ifi_ipackets; + } + else if(this->lookup_str_ == "obytes") + { + count += ifi->ifi_obytes; + } + else if(this->lookup_str_ == "opackets") + { + count += ifi->ifi_opackets; + } + + } // for + + value = count; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (__FreeBSD__) || defined (__Lynx__) */ diff --git a/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h b/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h new file mode 100644 index 00000000000..b820b3b0e64 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file FreeBSD_Network_Interface_Monitor.h + * + * $Id: FreeBSD_Network_Interface_Monitor.h 86518 2009-08-18 12:30:56Z olli $ + * + * @author Boyan Kasarov + */ +//============================================================================= + +#ifndef FREEBSD_NETWORK_INTERFACE_MONITOR_H +#define FREEBSD_NETWORK_INTERFACE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +#if defined (__FreeBSD__) || defined (__Lynx__) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class FreeBSD_Network_Interface_Monitor + * + * @brief Mixin class for network interface monitors compiled on + * FreeBSD machines. + */ + class MONITOR_CONTROL_Export FreeBSD_Network_Interface_Monitor + { + protected: + FreeBSD_Network_Interface_Monitor (const ACE_TCHAR *lookup_str); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + ACE_UINT64 value_; + + private: + void init (void); + void fetch (ACE_UINT64& value) const; + + ACE_UINT64 start_; + ACE_CString lookup_str_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (__FreeBSD__) || defined (__Lynx__) */ + +#include /**/ "ace/post.h" + +#endif // FREEBSD_NETWORK_INTERFACE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp new file mode 100644 index 00000000000..ffcdc054d06 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.cpp @@ -0,0 +1,124 @@ +// $Id: Linux_Network_Interface_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Linux_Network_Interface_Monitor.h" + +#if defined (ACE_LINUX) || defined (AIX) + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Linux_Network_Interface_Monitor::Linux_Network_Interface_Monitor ( + const char *scan_format) + : value_ (0UL), + start_ (0UL), + scan_format_ (scan_format) + { + this->init (); + } + + void + Linux_Network_Interface_Monitor::update_i (void) + { + char buf[1024]; + FILE* fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/dev"), + ACE_TEXT ("r")); + + if (fp == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("bytes sent - opening ") + ACE_TEXT ("/proc/net/dev failed\n"))); + return; + } + + /// Ignore the first 2 lines of the file, which are file + /// and column headers. + void* dummy = ACE_OS::fgets (buf, sizeof (buf), fp); + ACE_UNUSED_ARG (dummy); + dummy = ACE_OS::fgets (buf, sizeof (buf), fp); + ACE_UNUSED_ARG (dummy); + + unsigned long iface_value = 0UL; + ACE_UINT32 iface_index = 0UL; + ACE_UINT64 total_value = 0UL; + + while (ACE_OS::fgets (buf, sizeof (buf), fp) != 0) + { + sscanf (buf, this->scan_format_.c_str (), &iface_value); + + /// If the monitor runs long enough, the system counters will + /// wrap around, the statement below is an attempt to correct + /// for that. + this->value_array_[iface_index] += + iface_value + - static_cast<unsigned long> (this->value_array_[iface_index]); + total_value += this->value_array_[iface_index]; + + ++iface_index; + } + + this->value_ = total_value - this->start_; + (void) ACE_OS::fclose (fp); + } + + void + Linux_Network_Interface_Monitor::clear_impl (void) + { + this->init (); + } + + void + Linux_Network_Interface_Monitor::init (void) + { + for (unsigned long i = 0UL; i < MAX_INTERFACES; ++i) + { + this->value_array_[i] = 0UL; + } + + /// Read the file once to get a base value that we can subtract + /// from subsequent readings to get bytes sent since we started + /// monitoring. + char buf[1024]; + FILE* fp = ACE_OS::fopen (ACE_TEXT ("/proc/net/dev"), + ACE_TEXT ("r")); + + if (fp == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("bytes sent - opening ") + ACE_TEXT ("/proc/net/dev failed\n"))); + return; + } + + /// Ignore the first 2 lines of the file, which are file + /// and column headers. + void* dummy = ACE_OS::fgets (buf, sizeof (buf), fp); + ACE_UNUSED_ARG (dummy); + dummy = ACE_OS::fgets (buf, sizeof (buf), fp); + ACE_UNUSED_ARG (dummy); + + unsigned long iface_value = 0UL; + ACE_UINT32 iface_index = 0UL; + + while (ACE_OS::fgets (buf, sizeof (buf), fp) != 0) + { + sscanf (buf, this->scan_format_.c_str (), &iface_value); + this->start_ += iface_value; + + ++iface_index; + } + + (void) ACE_OS::fclose (fp); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_LINUX) || defined (AIX) */ diff --git a/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.h b/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.h new file mode 100644 index 00000000000..b2e5226008d --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Linux_Network_Interface_Monitor.h @@ -0,0 +1,76 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Linux_Network_Interface_Monitor.h + * + * $Id: Linux_Network_Interface_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef LINUX_NETWORK_INTERFACE_MONITOR_H +#define LINUX_NETWORK_INTERFACE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +#if defined (ACE_LINUX) || defined (AIX) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Linux_Network_Interface_Monitor + * + * @brief Mixin class for network interface monitors compiled on + * Linux machines. + */ + class MONITOR_CONTROL_Export Linux_Network_Interface_Monitor + { + protected: + /// The Linux system file /proc/net/dev stores a wealth of + /// network information about the system. To get the specific + /// value we want to monitor, we just vary the scan format string. + Linux_Network_Interface_Monitor (const char *scan_format); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + ACE_UINT64 value_; + + private: + /// Common code. + void init (void); + + private: + static const unsigned long MAX_INTERFACES = 10UL; + ACE_UINT64 value_array_[MAX_INTERFACES]; + ACE_UINT64 start_; + ACE_CString scan_format_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_LINUX) || defined (AIX) */ + +#include /**/ "ace/post.h" + +#endif // LINUX_NETWORK_INTERFACE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.cpp new file mode 100644 index 00000000000..cc8a2c769a3 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.cpp @@ -0,0 +1,78 @@ +// $Id: Memory_Usage_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#if defined (ACE_HAS_KSTAT) +#include <sys/sysinfo.h> +#endif + +#include "ace/Monitor_Control/Memory_Usage_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Memory_Usage_Monitor::default_name_ = + "OS/Memory/TotalUsage"; + + Memory_Usage_Monitor::Memory_Usage_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Monitor (ACE_TEXT ("\\Memory\\% Committed Bytes In Use")) +#endif + { + } + + void + Memory_Usage_Monitor::update (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->update_i (); + this->receive (this->value_); +#elif defined (ACE_HAS_LINUX_SYSINFO) + if (::sysinfo (&this->sysinfo_) != 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Memory usage - sysinfo() failed\n"))); + return; + } + + double used_ram = this->sysinfo_.totalram - this->sysinfo_.freeram; + double percent_mem_usage = used_ram / this->sysinfo_.totalram * 100.0; + + this->receive (percent_mem_usage); +#elif defined (ACE_HAS_KSTAT) + unsigned long page_size = sysconf (_SC_PAGE_SIZE); + unsigned long total = sysconf (_SC_PHYS_PAGES) * page_size; + unsigned long free = sysconf (_SC_AVPHYS_PAGES) * page_size; + + double used = total - free; + double percent_mem_usage = used / total * 100.0; + + this->receive (percent_mem_usage); +#endif + } + + const char* + Memory_Usage_Monitor::default_name (void) + { + return Memory_Usage_Monitor::default_name_; + } + + void + Memory_Usage_Monitor::clear_i (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->clear_impl (); +#endif + + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.h b/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.h new file mode 100644 index 00000000000..7da7f531ff8 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Memory_Usage_Monitor.h @@ -0,0 +1,80 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Memory_Usage_Monitor.h + * + * $Id: Memory_Usage_Monitor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MEMORY_USAGE_MONITOR_H +#define MEMORY_USAGE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Monitor.h" +#elif defined (ACE_HAS_LINUX_SYSINFO) +#include "ace/os_include/sys/os_sysinfo.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Memory_Usage_Monitor + * + * @brief Monitor percentage of total available memory used. + */ + class MONITOR_CONTROL_Export Memory_Usage_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Monitor +#endif + { + public: + Memory_Usage_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + +#if defined (ACE_HAS_LINUX_SYSINFO) + struct sysinfo sysinfo_; +#endif + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // MEMORY_USAGE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Control.h b/dep/acelite/ace/Monitor_Control/Monitor_Control.h new file mode 100644 index 00000000000..482e0662a8b --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Control.h @@ -0,0 +1,46 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Control.h + * + * $Id: Monitor_Control.h 81753 2008-05-21 19:02:47Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MONITOR_CONTROL_H +#define MONITOR_CONTROL_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Point_Registry.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Monitor_Admin_Manager.h" + +#include "ace/Monitor_Control/CPU_Load_Monitor.h" +#include "ace/Monitor_Control/Memory_Usage_Monitor.h" +#include "ace/Monitor_Control/Num_Threads_Monitor.h" +#include "ace/Monitor_Control/Bytes_Sent_Monitor.h" +#include "ace/Monitor_Control/Packets_Sent_Monitor.h" +#include "ace/Monitor_Control/Bytes_Received_Monitor.h" +#include "ace/Monitor_Control/Packets_Received_Monitor.h" +#include "ace/Monitor_Control/Monitor_Group.h" +#include "ace/Monitor_Control/Monitor_Query.h" +#include "ace/Monitor_Control/Monitor_Control_utils.h" + +static int +ACE_Requires_MC_Initializer = MC_ADMINMANAGER::Initializer (); + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // MONITOR_CONTROL_H diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Control_export.h b/dep/acelite/ace/Monitor_Control/Monitor_Control_export.h new file mode 100644 index 00000000000..2cae021033e --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Control_export.h @@ -0,0 +1,49 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Control_export.h + * + * $Id: Monitor_Control_export.h 81753 2008-05-21 19:02:47Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef MONITOR_CONTROL_EXPORT_H +#define MONITOR_CONTROL_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) +# if !defined (MONITOR_CONTROL_HAS_DLL) +# define MONITOR_CONTROL_HAS_DLL 0 +# endif /* ! MONITOR_CONTROL_HAS_DLL */ +#else +# if !defined (MONITOR_CONTROL_HAS_DLL) +# define MONITOR_CONTROL_HAS_DLL 1 +# endif /* ! MONITOR_CONTROL_HAS_DLL */ +#endif /* ACE_AS_STATIC_LIB */ + +#if defined (MONITOR_CONTROL_HAS_DLL) && (MONITOR_CONTROL_HAS_DLL == 1) +# if defined (MONITOR_CONTROL_BUILD_DLL) +# define MONITOR_CONTROL_Export ACE_Proper_Export_Flag +# define MONITOR_CONTROL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define MONITOR_CONTROL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* MONITOR_CONTROL_BUILD_DLL */ +# define MONITOR_CONTROL_Export ACE_Proper_Import_Flag +# define MONITOR_CONTROL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define MONITOR_CONTROL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* MONITOR_CONTROL_BUILD_DLL */ +#else /* MONITOR_CONTROL_HAS_DLL == 1 */ +# define MONITOR_CONTROL_Export +# define MONITOR_CONTROL_SINGLETON_DECLARATION(T) +# define MONITOR_CONTROL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* MONITOR_CONTROL_HAS_DLL == 1 */ + +#endif /* MONITOR_CONTROL_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Control_utils.h b/dep/acelite/ace/Monitor_Control/Monitor_Control_utils.h new file mode 100644 index 00000000000..d0d21c0f5a9 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Control_utils.h @@ -0,0 +1,92 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Control_utils.h + * + * $Id: Monitor_Control_utils.h 81753 2008-05-21 19:02:47Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MONITOR_CONTROL_UTILS_H +#define MONITOR_CONTROL_UTILS_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Service_Config.h" +#include "ace/Dynamic_Service.h" +#include "ace/Reactor.h" + +#include "ace/Monitor_Control/Auto_Update_Starter.h" + +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::CPU_Load_Monitor + CPU_LOAD_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Memory_Usage_Monitor + MEMORY_USAGE_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Num_Threads_Monitor + NUM_THREADS_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Bytes_Sent_Monitor + BYTES_SENT_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Packets_Sent_Monitor + PACKETS_SENT_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Bytes_Received_Monitor + BYTES_RECEIVED_MONITOR; +typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Packets_Received_Monitor + PACKETS_RECEIVED_MONITOR; + +using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control; + +template<typename OS_MP_TYPE> +Monitor_Base* +create_os_monitor (const char* name = 0, + ACE_Time_Value period = ACE_Time_Value::zero) +{ + Monitor_Base* retval = 0; + + ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER *mgr = + ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service< + ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER>::instance ( + "MC_ADMINMANAGER"); + + const char* working_name = + (name == 0 ? OS_MP_TYPE::default_name () : name); + + retval = mgr->admin ().monitor_point (working_name); + + if (retval == 0) + { + ACE_NEW_RETURN (retval, OS_MP_TYPE (working_name), 0); + (void) mgr->admin ().monitor_point (retval, period); + } + + return retval; +} + +#define START_PERIODIC_MONITORS \ + ACE_VERSIONED_NAMESPACE_NAME::STARTER starter; \ + starter.activate () + +#define STOP_PERIODIC_MONITORS \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service< \ + ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER>::instance ( \ + "MC_ADMINMANAGER")->admin ().reactor ()->end_reactor_event_loop (); \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Thread_Manager::instance ()->wait () + +#define ADD_PERIODIC_QUERY(HANDLER,QUERY,INTERVAL_SEC) \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service< \ + ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER>::instance ( \ + "MC_ADMINMANAGER")->admin ().auto_query (HANDLER, QUERY, INTERVAL_SEC) + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // MONITOR_CONTROL_UTILS_H diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Group.cpp b/dep/acelite/ace/Monitor_Control/Monitor_Group.cpp new file mode 100644 index 00000000000..1d6a497654a --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Group.cpp @@ -0,0 +1,67 @@ +// $Id: Monitor_Group.cpp 93390 2011-02-15 14:44:58Z johnnyw $ + +#include "ace/Monitor_Control/Monitor_Group.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Monitor_Group::Monitor_Group (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_GROUP) + {} + + void + Monitor_Group::add_member (Monitor_Base* member) + { + this->members_.enqueue_tail (member); + } + + void + Monitor_Group::update (void) + { + for (MEMBERS_ITERATOR i (this->members_); !i.done (); i.advance ()) + { + Monitor_Base **member; + i.next (member); + (*member)->update (); + } + } + + void + Monitor_Group::receive (double /* data */) + { + /// No-op, should always call update(). + } + + void + Monitor_Group::receive (size_t /* data */) + { + /// No-op, should always call update(). + } + + void + Monitor_Group::receive (const Monitor_Control_Types::NameList& /* data */) + { + /// No-op, should always call update(). + } + + void + Monitor_Group::clear (void) + { + for (MEMBERS_ITERATOR i (this->members_); !i.done (); i.advance ()) + { + Monitor_Base **member = 0; + i.next (member); + (*member)->clear (); + } + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Group.h b/dep/acelite/ace/Monitor_Control/Monitor_Group.h new file mode 100644 index 00000000000..99eb7d6753e --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Group.h @@ -0,0 +1,72 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Group.h + * + * $Id: Monitor_Group.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MONITOR_GROUP_H +#define MONITOR_GROUP_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Monitor_Group + * + * @brief Updates and/or clears a group of monitors with a single call. + */ + class MONITOR_CONTROL_Export Monitor_Group : public Monitor_Base + { + public: + Monitor_Group (const char* name); + + void add_member (Monitor_Base* member); + + virtual void update (void); + + /// These are overridden to be no-ops. + virtual void receive (double data); + virtual void receive (size_t data); + virtual void receive (const Monitor_Control_Types::NameList& data); + + virtual void clear (void); + + private: + typedef ACE_Unbounded_Queue<Monitor_Base *> + MEMBERS; + typedef ACE_Unbounded_Queue_Const_Iterator<Monitor_Base *> + MEMBERS_ITERATOR; + + MEMBERS members_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // MONITOR_GROUP_H diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Query.cpp b/dep/acelite/ace/Monitor_Control/Monitor_Query.cpp new file mode 100644 index 00000000000..f37b3290f24 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Query.cpp @@ -0,0 +1,82 @@ +// $Id: Monitor_Query.cpp 86518 2009-08-18 12:30:56Z olli $ + +#include "ace/Monitor_Point_Registry.h" +#include "ace/Monitor_Base.h" +#include "ace/Monitor_Control_Action.h" + +#include "ace/Monitor_Control/Monitor_Query.h" +#include "ace/Monitor_Control/Constraint_Interpreter.h" +#include "ace/Monitor_Control/Constraint_Visitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + int + Monitor_Point_Auto_Query::handle_timeout ( + const ACE_Time_Value& /* current */, + const void* monitor_query) + { + const Monitor_Query* const_mq = + reinterpret_cast<const Monitor_Query*> (monitor_query); + + Monitor_Query* mq = const_cast<Monitor_Query*> (const_mq); + + mq->query (); + + return 0; + } + + //========================================================= + + Monitor_Query::Monitor_Query (const char* monitor_name) + : monitor_ (0) + { + ACE_CString name_str (monitor_name, 0, false); + this->monitor_ = Monitor_Point_Registry::instance ()->get (name_str); + + if (this->monitor_ == 0) + { + ACE_ERROR ((LM_ERROR, "Monitor_Query - monitor lookup failed\n")); + } + } + + void + Monitor_Query::query (void) + { + if (this->monitor_ == 0) + { + ACE_ERROR ((LM_ERROR, "Monitor_Query::query - null monitor\n")); + return; + } + + Monitor_Base::CONSTRAINTS& list = this->monitor_->constraints (); + + for (Monitor_Base::CONSTRAINT_ITERATOR i (list.begin ()); + i != list.end (); + ++i) + { + Constraint_Interpreter interpreter; + interpreter.build_tree (i->second.expr.fast_rep ()); + + Monitor_Control_Types::Data data (this->monitor_->type ()); + this->monitor_->retrieve (data); + Constraint_Visitor visitor (data); + bool satisfied = interpreter.evaluate (visitor); + + if (satisfied && i->second.control_action != 0) + { + i->second.control_action->execute (); + } + } + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Monitor_Query.h b/dep/acelite/ace/Monitor_Control/Monitor_Query.h new file mode 100644 index 00000000000..4f841bee372 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Monitor_Query.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Monitor_Query.h + * + * $Id: Monitor_Query.h 81753 2008-05-21 19:02:47Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef MONITOR_QUERY_H +#define MONITOR_QUERY_H + +#include /**/ "ace/pre.h" + +#include "ace/Event_Handler.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Monitor_Point_Auto_Query + * + * @brief Automates periodic querying of monitor point classes. + * + */ + class MONITOR_CONTROL_Export Monitor_Point_Auto_Query + : public ACE_Event_Handler + { + public: + /// Override of ACE base class method. + virtual int handle_timeout (const ACE_Time_Value& current, + const void* monitor_query); + }; + + /** + * @class Monitor_Query + * + * @brief Handles queries for a specific monitor point, and + * evaluates its constraint(s) with each query. + * + */ + class MONITOR_CONTROL_Export Monitor_Query + { + public: + Monitor_Query (const char* monitor_name); + + void query (void); + + private: + Monitor_Base* monitor_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // MONITOR_QUERY_H diff --git a/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.cpp new file mode 100644 index 00000000000..6c902514086 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.cpp @@ -0,0 +1,30 @@ +// $Id: Null_Network_Interface_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Monitor_Control/Null_Network_Interface_Monitor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Null_Network_Interface_Monitor::Null_Network_Interface_Monitor (void) + : value_ (0UL) + { + } + + void + Null_Network_Interface_Monitor::update_i (void) + { + /// No-op. + } + + void + Null_Network_Interface_Monitor::clear_impl (void) + { + /// No-op. + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.h b/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.h new file mode 100644 index 00000000000..9fa24196966 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Null_Network_Interface_Monitor.h @@ -0,0 +1,61 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Null_Network_Interface_Monitor.h + * + * $Id: Null_Network_Interface_Monitor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef NULL_NETWORK_INTERFACE_MONITOR_H +#define NULL_NETWORK_INTERFACE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Basic_Types.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Null_Network_Interface_Monitor + * + * @brief Mixin class for network interface monitors compiled on + * platforms without any native OS monitor support, or on + a platform with such support when the platform-specific + OS monitor flag is not set. + */ + class MONITOR_CONTROL_Export Null_Network_Interface_Monitor + { + protected: + Null_Network_Interface_Monitor (void); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + ACE_UINT64 value_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif // NULL_NETWORK_INTERFACE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.cpp new file mode 100644 index 00000000000..8d21e7e45a5 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.cpp @@ -0,0 +1,96 @@ +// $Id: Num_Threads_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Num_Threads_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_LINUX) +#include "ace/OS_NS_stdio.h" +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Num_Threads_Monitor::default_name_ = + "OS/System/NumThreads"; + + Num_Threads_Monitor::Num_Threads_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Monitor (ACE_TEXT ("\\System\\Threads")) +#elif defined (ACE_LINUX) + , file_ptr_ (0) + , nthreads_ (0UL) +#endif + { + } + + void + Num_Threads_Monitor::update (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->update_i (); + this->receive (this->value_); +#elif defined (ACE_LINUX) + this->file_ptr_ = ACE_OS::fopen (ACE_TEXT ("/proc/self/status"), + ACE_TEXT ("r")); + + if (this->file_ptr_ == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("Num threads - opening ") + ACE_TEXT ("/proc/self/status failed\n"))); + return; + } + + char *item = 0; + char *arg = 0; + + while ((ACE_OS::fgets (buf_, sizeof (buf_), file_ptr_)) != 0) + { + item = ACE_OS::strtok (this->buf_, " \t\n"); + arg = ACE_OS::strtok (0, "\n"); + + if (item == 0 || arg == 0) + { + continue; + } + + if (ACE_OS::strcmp (item, "Threads:") == 0) + { + sscanf (arg, "%lu", &this->nthreads_); + break; + } + } + + /// Stores value and timestamp with thread-safety. + this->receive (static_cast<double> (this->nthreads_)); + + ACE_OS::fclose (this->file_ptr_); +#endif + } + + const char* + Num_Threads_Monitor::default_name (void) + { + return Num_Threads_Monitor::default_name_; + } + + void + Num_Threads_Monitor::clear_i (void) + { +#if defined (ACE_HAS_WIN32_PDH) + this->clear_impl (); +#endif + + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.h b/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.h new file mode 100644 index 00000000000..094df0b47e7 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Num_Threads_Monitor.h @@ -0,0 +1,88 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Num_Threads_Monitor.h + * + * $Id: Num_Threads_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef NUM_THREADS_MONITOR_H +#define NUM_THREADS_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +/// There is apparently no way to query the number of threads on the +/// Solaris platform. The only benchmark I've seen had to put hooks +/// in the thread creation functions to keep track of the highest +/// thread ID, then check all the IDs less than that to see if the +/// threads still exist. Since we don't have that option in this +/// framework, which is to be used by existing applications, this +/// particular OS monitor is left unimplemented on Solaris. +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Num_Threads_Monitor + * + * @brief Monitor total number of threads in the system. + */ + class MONITOR_CONTROL_Export Num_Threads_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Monitor +#endif + { + public: + Num_Threads_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + +#if defined (ACE_LINUX) + FILE *file_ptr_; + char buf_[1024]; + unsigned long nthreads_; +#endif + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // NUM_THREADS_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.cpp new file mode 100644 index 00000000000..960f32bda2e --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.cpp @@ -0,0 +1,60 @@ +// $Id: Packets_Received_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Packets_Received_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Packets_Received_Monitor::default_name_ = + "OS/Network/PacketsReceived"; + + Packets_Received_Monitor::Packets_Received_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Multi_Instance_Monitor ( + ACE_TEXT ("\\Network Interface(*)\\Packets Received/sec")) +#elif defined (ACE_LINUX) || defined (AIX) + , Linux_Network_Interface_Monitor ( + " %*[^:]: %*u %lu %*u %*u %*u %*u %*u %*u %*u %*u") + /// Scan format for /proc/net/dev +#elif defined (ACE_HAS_KSTAT) + , Solaris_Network_Interface_Monitor (ACE_TEXT ("ipackets")) +#elif defined (__FreeBSD__) || defined (__Lynx__) + , FreeBSD_Network_Interface_Monitor (ACE_TEXT ("ipackets")) +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , BSD_Network_Interface_Monitor (ACE_TEXT ("ipackets")) +#endif + {} + + void + Packets_Received_Monitor::update (void) + { + this->update_i (); + + /// On some platforms, value_ is an ACE_UINT64. + this->receive (static_cast<double> (this->value_)); + } + + const char* + Packets_Received_Monitor::default_name (void) + { + return Packets_Received_Monitor::default_name_; + } + + void + Packets_Received_Monitor::clear_i (void) + { + this->clear_impl (); + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.h b/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.h new file mode 100644 index 00000000000..64aeef971a0 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Packets_Received_Monitor.h @@ -0,0 +1,94 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Packets_Received_Monitor.h + * + * $Id: Packets_Received_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef PACKETS_RECEIVED_MONITOR_H +#define PACKETS_RECEIVED_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Multi_Instance_Monitor.h" +#elif defined (ACE_LINUX) || defined (AIX) +#include "ace/Monitor_Control/Linux_Network_Interface_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +#include "ace/Monitor_Control/Solaris_Network_Interface_Monitor.h" +#elif defined (__FreeBSD__) || defined (__Lynx__) +#include "ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h" +#elif defined (__NetBSD__) || defined (__OpenBSD__) +#include "ace/Monitor_Control/BSD_Network_Interface_Monitor.h" +#else +#include "ace/Monitor_Control/Null_Network_Interface_Monitor.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Packets_Received_Monitor + * + * @brief Monitors total packets received over all network interfaces. + */ + class MONITOR_CONTROL_Export Packets_Received_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Multi_Instance_Monitor +#elif defined (ACE_LINUX) || defined (AIX) + , public Linux_Network_Interface_Monitor +#elif defined (ACE_HAS_KSTAT) + , public Solaris_Network_Interface_Monitor +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , public BSD_Network_Interface_Monitor +#elif defined (__FreeBSD__) || defined (__Lynx__) + , public FreeBSD_Network_Interface_Monitor +#else + , public Null_Network_Interface_Monitor +#endif + { + public: + Packets_Received_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // PACKETS_RECEIVED_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.cpp new file mode 100644 index 00000000000..0e6ead400ad --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.cpp @@ -0,0 +1,60 @@ +// $Id: Packets_Sent_Monitor.cpp 95533 2012-02-14 22:59:17Z wotte $ + +#include "ace/Monitor_Control/Packets_Sent_Monitor.h" + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + const char* Packets_Sent_Monitor::default_name_ = + "OS/Network/PacketsSent"; + + Packets_Sent_Monitor::Packets_Sent_Monitor (const char* name) + : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) +#if defined (ACE_HAS_WIN32_PDH) + , Windows_Multi_Instance_Monitor ( + ACE_TEXT ("\\Network Interface(*)\\Packets Sent/sec")) +#elif defined (ACE_LINUX) || defined (AIX) + , Linux_Network_Interface_Monitor ( + " %*[^:]: %*u %*u %*u %*u %*u %*u %*u %*u %*u %lu") + /// Scan format for /proc/net/dev +#elif defined (ACE_HAS_KSTAT) + , Solaris_Network_Interface_Monitor (ACE_TEXT ("opackets")) +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , BSD_Network_Interface_Monitor (ACE_TEXT ("opackets")) +#elif defined (__FreeBSD__) || defined (__Lynx__) + , FreeBSD_Network_Interface_Monitor (ACE_TEXT ("opackets")) +#endif + {} + + void + Packets_Sent_Monitor::update (void) + { + this->update_i (); + + /// On some platforms, value_ is an ACE_UINT64. + this->receive (static_cast<double> (this->value_)); + } + + const char* + Packets_Sent_Monitor::default_name (void) + { + return Packets_Sent_Monitor::default_name_; + } + + void + Packets_Sent_Monitor::clear_i (void) + { + this->clear_impl (); + this->Monitor_Base::clear_i (); + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.h b/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.h new file mode 100644 index 00000000000..bccea8f896e --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Packets_Sent_Monitor.h @@ -0,0 +1,94 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Packets_Sent_Monitor.h + * + * $Id: Packets_Sent_Monitor.h 95533 2012-02-14 22:59:17Z wotte $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef PACKETS_SENT_MONITOR_H +#define PACKETS_SENT_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) + +#if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H) +#include "ace/Monitor_Control/Windows_Multi_Instance_Monitor.h" +#elif defined (ACE_LINUX) || defined (AIX) +#include "ace/Monitor_Control/Linux_Network_Interface_Monitor.h" +#elif defined (ACE_HAS_KSTAT) +#include "ace/Monitor_Control/Solaris_Network_Interface_Monitor.h" +#elif defined (__FreeBSD__) || defined (__Lynx__) +#include "ace/Monitor_Control/FreeBSD_Network_Interface_Monitor.h" +#elif defined (__NetBSD__) || defined (__OpenBSD__) +#include "ace/Monitor_Control/BSD_Network_Interface_Monitor.h" +#else +#include "ace/Monitor_Control/Null_Network_Interface_Monitor.h" +#endif + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Packets_Sent_Monitor + * + * @brief Monitors total packets sent over all network interfaces. + */ + class MONITOR_CONTROL_Export Packets_Sent_Monitor + : public Monitor_Base +#if defined (ACE_HAS_WIN32_PDH) + , public Windows_Multi_Instance_Monitor +#elif defined (ACE_LINUX) || defined (AIX) + , public Linux_Network_Interface_Monitor +#elif defined (ACE_HAS_KSTAT) + , public Solaris_Network_Interface_Monitor +#elif defined (__NetBSD__) || defined (__OpenBSD__) + , public BSD_Network_Interface_Monitor +#elif defined (__FreeBSD__) || defined (__Lynx__) + , public FreeBSD_Network_Interface_Monitor +#else + , public Null_Network_Interface_Monitor +#endif + { + public: + Packets_Sent_Monitor (const char* name); + + /// Implementation of the pure virtual method. + virtual void update (void); + + /// Stores the default name, used if none is supplied by the user. + static const char* default_name (void); + + private: + /// Overridden reset, calls platform-specific reset. + virtual void clear_i (void); + + private: + static const char* default_name_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ + +#include /**/ "ace/post.h" + +#endif // PACKETS_SENT_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.cpp new file mode 100644 index 00000000000..63ec6b74739 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.cpp @@ -0,0 +1,223 @@ +// $Id: Solaris_Network_Interface_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Monitor_Control/Solaris_Network_Interface_Monitor.h" + +#if defined (ACE_HAS_KSTAT) + +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Solaris_Network_Interface_Monitor::Solaris_Network_Interface_Monitor ( + const ACE_TCHAR *lookup_str) + : value_ (0UL), + start_ (0UL), + lookup_str_ (lookup_str) + { + this->init (); + } + + void + Solaris_Network_Interface_Monitor::update_i (void) + { + this->access_kstats (this->value_); + this->value_ -= this->start_; + } + + void + Solaris_Network_Interface_Monitor::clear_impl (void) + { + this->init (); + } + + void + Solaris_Network_Interface_Monitor::init (void) + { + unsigned long i; + + for (i = 0UL; i < MAX_LO_INTERFACES; ++i) + { + this->value_array_lo_[i] = 0UL; + } + + for (i = 0UL; i < MAX_HME_INTERFACES; ++i) + { + this->value_array_hme_[i] = 0UL; + } + + this->access_kstats (this->start_); + } + + void + Solaris_Network_Interface_Monitor::access_kstats ( + ACE_UINT64 &which_member) + { + this->kstats_ = kstat_open (); + + if (this->kstats_ == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("opening kstats file failed\n"))); + return; + } + + this->kstat_id_ = this->kstats_->kc_chain_id; + int status = 0; + + while (true) + { + /// We have to sum the network interfaces manually. + for (this->kstat_ = this->kstats_->kc_chain; + this->kstat_ != 0; + this->kstat_ = this->kstat_->ks_next) + { + if (ACE_OS::strcmp (this->kstat_->ks_class, "net") != 0) + { + continue; + } + + unsigned long ks_instance = this->kstat_->ks_instance; + + if (ACE_OS::strcmp (this->kstat_->ks_module, "lo") == 0) + { + /// Interfaces 'lo' have only packet counters. + if (this->lookup_str_ == ACE_TEXT ("obytes") + || this->lookup_str_ == ACE_TEXT ("rbytes")) + { + continue; + } + + status = this->check_ks_module (ks_instance, + MAX_LO_INTERFACES, + "MAX_LO_INTERFACES", + this->value_array_lo_, + which_member); + + if (status == -1) + { + /// Unrecoverable error, diagnostic already output. + (void) kstat_close (this->kstats_); + return; + } + else if (status == 1) + { + /// The kstat_id changed underneath us, start over. + break; + } + } + else if (ACE_OS::strcmp (this->kstat_->ks_module, "hme") == 0 + || ACE_OS::strcmp (this->kstat_->ks_module, "bge") == 0) + { + status = this->check_ks_module (ks_instance, + MAX_HME_INTERFACES, + "MAX_HME_INTERFACES", + this->value_array_hme_, + which_member); + + if (status == -1) + { + /// Unrecoverable error, diagnostic already output. + (void) kstat_close (this->kstats_); + return; + } + else if (status == 1) + { + /// The kstat_id changed underneath us, start over. + break; + } + } + } + + if (this->kstat_) + { + this->kstat_id_ = kstat_chain_update (this->kstats_); + + if (! this->kstat_id_ > 0) + { + ACE_ERROR ((LM_ERROR, "kstat is is not > 0.\n")); + break; + } + } + else + { + break; + } + } + + status = kstat_close (this->kstats_); + + if (status != 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("closing kstats file failed\n"))); + } + } + + int + Solaris_Network_Interface_Monitor::check_ks_module ( + const unsigned long ks_instance, + const unsigned long which_max, + const char *max_str, + ACE_UINT64 *value_array, + ACE_UINT64 &which_member) + { + if (! (ks_instance < which_max)) + { + ACE_ERROR_RETURN ((LM_ERROR, + "%s exceeded.\n", + max_str), + -1); + } + + /// Because the kstat chain can change dynamically, + /// watch the chain ID and restart the walk if the ID + /// differs from what we saw during the walk. The restart + /// is done by breaking from the cycle with kstat_ not 0. + + kid_t kstat_id = + kstat_read (this->kstats_, this->kstat_, 0); + + if (kstat_id != this->kstat_id_) + { + /// This return value restarts the walk as described above. + return 1; + } + + kstat_named_t *value = + (kstat_named_t *) kstat_data_lookup ( + this->kstat_, + ACE_TEXT_ALWAYS_CHAR (this->lookup_str_.rep ())); + + if (value == 0) + { + /// Just return and let the calling FOR loop advance. + return 0; + } + + if (value->data_type != KSTAT_DATA_UINT32) + { + ACE_ERROR_RETURN ((LM_ERROR, + "Wrong data type.\n"), + -1); + } + + /// Guard against overflow. + value_array[ks_instance] += + value->value.ui32 + - static_cast<ACE_UINT32> (value_array[ks_instance]); + + which_member += value_array[ks_instance]; + + return 0; + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_HAS_KSTAT) */ diff --git a/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.h b/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.h new file mode 100644 index 00000000000..98ce5a67d2c --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Solaris_Network_Interface_Monitor.h @@ -0,0 +1,91 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Solaris_Network_Interface_Monitor.h + * + * $Id: Solaris_Network_Interface_Monitor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef SOLARIS_NETWORK_INTERFACE_MONITOR_H +#define SOLARIS_NETWORK_INTERFACE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +#if defined (ACE_HAS_KSTAT) + +#include "ace/os_include/os_kstat.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Solaris_Network_Interface_Monitor + * + * @brief Mixin class for network interface monitors compiled on + * Solaris machines. + */ + class MONITOR_CONTROL_Export Solaris_Network_Interface_Monitor + { + protected: + /// The kstat interface can access a wealth of + /// network information about the system. To get the specific + /// value we want to monitor, we just vary the lookup string. + Solaris_Network_Interface_Monitor (const ACE_TCHAR *lookup_str); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + ACE_UINT64 value_; + + private: + /// Common code. + + void init (void); + void access_kstats (ACE_UINT64 &which_member); + int check_ks_module (const unsigned long ks_instance, + const unsigned long which_max, + const char *max_str, + ACE_UINT64 *value_array, + ACE_UINT64 &which_member); + + + private: + static const unsigned long MAX_LO_INTERFACES = 5UL; + static const unsigned long MAX_HME_INTERFACES = 10UL; + ACE_UINT64 value_array_lo_[MAX_LO_INTERFACES]; + ACE_UINT64 value_array_hme_[MAX_HME_INTERFACES]; + ACE_UINT64 start_; + ACE_TString lookup_str_; + kstat_ctl_t *kstats_; + kstat_t *kstat_; + kid_t kstat_id_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_HAS_KSTAT) */ + +#include /**/ "ace/post.h" + +#endif // SOLARIS_NETWORK_INTERFACE_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Windows_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Windows_Monitor.cpp new file mode 100644 index 00000000000..a3883ece639 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Windows_Monitor.cpp @@ -0,0 +1,76 @@ +// $Id: Windows_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Monitor_Control/Windows_Monitor.h" + +#if defined (ACE_HAS_WIN32_PDH) + +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Windows_Monitor::Windows_Monitor (const ACE_TCHAR *path) + : value_ (0.0) + , path_ (path) + , query_ (0) + , counter_ (0) + , status_ (ERROR_SUCCESS) + { + this->init (); + } + + void + Windows_Monitor::update_i (void) + { + PdhCollectQueryData (this->query_); + PDH_FMT_COUNTERVALUE pdh_value; + + PdhGetFormattedCounterValue (this->counter_, + PDH_FMT_DOUBLE, + 0, + &pdh_value); + + this->value_ = pdh_value.doubleValue; + } + + void + Windows_Monitor::clear_impl (void) + { + this->init (); + } + + void + Windows_Monitor::init (void) + { + /// Create a query and a counter here so it doesn't have + /// to be done with each update. + + this->status_ = ACE_TEXT_PdhOpenQuery (0, 0, &this->query_); + + if (ERROR_SUCCESS != this->status_) + { + ACE_ERROR ((LM_DEBUG, ACE_TEXT ("PdhOpenQuery failed\n"))); + } + + this->status_ = + ACE_TEXT_PdhAddCounter (this->query_, + this->path_.c_str (), + 0, + &this->counter_); + + if (ERROR_SUCCESS != this->status_) + { + ACE_ERROR ((LM_DEBUG, + ACE_TEXT ("PdhAddCounter %s failed\n"), + this->path_.c_str ())); + } + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_HAS_WIN32_PDH) */ diff --git a/dep/acelite/ace/Monitor_Control/Windows_Monitor.h b/dep/acelite/ace/Monitor_Control/Windows_Monitor.h new file mode 100644 index 00000000000..cd39d81fedf --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Windows_Monitor.h @@ -0,0 +1,78 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Windows_Monitor.h + * + * $Id: Windows_Monitor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef WINDOWS_MONITOR_H +#define WINDOWS_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/SString.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/os_include/os_pdh.h" + +#include "ace/Monitor_Control/Monitor_Control_export.h" + +#if defined (ACE_HAS_WIN32_PDH) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Windows_Monitor + * + * @brief Mixin class for concrete monitors compiled on Windows machines. + */ + class MONITOR_CONTROL_Export Windows_Monitor + { + friend class Windows_Multi_Instance_Monitor; + + protected: + Windows_Monitor (const ACE_TCHAR *path); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + double value_; + + private: + /// Code common to constructor and clear_impl(). + void init (void); + + /// Make these persistent as members so they don't have to be + /// created & destroyed with each update. + private: + ACE_TString path_; + HQUERY query_; + HCOUNTER counter_; + PDH_STATUS status_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* defined (ACE_HAS_WIN32_PDH) */ + +#endif // WINDOWS_MONITOR_H diff --git a/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.cpp b/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.cpp new file mode 100644 index 00000000000..c5492640981 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.cpp @@ -0,0 +1,110 @@ +// $Id: Windows_Multi_Instance_Monitor.cpp 91813 2010-09-17 07:52:52Z johnnyw $ + +#include "ace/Monitor_Control/Windows_Multi_Instance_Monitor.h" + +#if defined (ACE_HAS_WIN32_PDH) + +#include "ace/Log_Msg.h" +#include "ace/SString.h" +#include "ace/os_include/os_pdhmsg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + Windows_Multi_Instance_Monitor::Windows_Multi_Instance_Monitor ( + const ACE_TCHAR *wildcard_path) + : value_ (0.0) + , instances_ (0) + , n_instances_ (0) + , status_ (ERROR_SUCCESS) + { + /// Create a string which is a concatentation of the path + /// name of each 'instance' we need to monitor. + + DWORD paths_size = 4096; + ACE_LPSTR paths = (ACE_LPSTR) GlobalAlloc (GPTR, paths_size); + + this->status_ = ACE_TEXT_PdhExpandCounterPath (wildcard_path, + paths, + &paths_size); + + if (PDH_MORE_DATA == static_cast<DWORD> (this->status_)) + { + ++paths_size; + GlobalFree (paths); + paths = (ACE_LPSTR) GlobalAlloc (GPTR, paths_size); + + this->status_ = ACE_TEXT_PdhExpandCounterPath (wildcard_path, + paths, + &paths_size); + } + + if (PDH_CSTATUS_VALID_DATA != static_cast<DWORD> (this->status_)) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%s: PdhExpandCounterPath failed\n"), + wildcard_path)); + } + + ACE_LPSTR path = paths; + + /// Create a regular Windows monitor for each path name. + while (*path != 0) + { + Windows_Monitor *instance = new Windows_Monitor (path); + this->instances_.enqueue_tail (instance); + path += ACE_OS::strlen (path) + 1; + } + + GlobalFree (paths); + } + + Windows_Multi_Instance_Monitor::~Windows_Multi_Instance_Monitor (void) + { + Windows_Monitor *instance = 0; + + /// Destroy the single instance monitors created in the constructor. + while (this->instances_.dequeue_head (instance) == 0) + { + delete instance; + } + } + + void + Windows_Multi_Instance_Monitor::update_i (void) + { + Windows_Monitor **current_instance = 0; + + /// Sum the values of each single instance monitor. + for (INSTANCES_ITERATOR i (this->instances_); !i.done (); i.advance ()) + { + i.next (current_instance); + + (*current_instance)->update_i (); + + this->value_ += (*current_instance)->value_; + } + } + + void + Windows_Multi_Instance_Monitor::clear_impl (void) + { + Windows_Monitor **current_instance = 0; + + /// Sum the values of each single instance monitor. + for (INSTANCES_ITERATOR i (this->instances_); !i.done (); i.advance ()) + { + i.next (current_instance); + + (*current_instance)->clear_impl (); + } + } + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* defined (ACE_HAS_WIN32_PDH) */ diff --git a/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.h b/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.h new file mode 100644 index 00000000000..ec4e17a4a41 --- /dev/null +++ b/dep/acelite/ace/Monitor_Control/Windows_Multi_Instance_Monitor.h @@ -0,0 +1,75 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Windows_Multi_Instance_Monitor.h + * + * $Id: Windows_Multi_Instance_Monitor.h 82115 2008-06-20 20:43:13Z parsons $ + * + * @author Jeff Parsons <j.parsons@vanderbilt.edu> + */ +//============================================================================= + +#ifndef WINDOWS_MULTI_INSTANCE_MONITOR_H +#define WINDOWS_MULTI_INSTANCE_MONITOR_H + +#include /**/ "ace/pre.h" + +#include "ace/Unbounded_Queue.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Monitor_Control/Windows_Monitor.h" + +#if defined (ACE_HAS_WIN32_PDH) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + /** + * @class Windows_Multi_Instance_Monitor + * + * @brief Mixin class for concrete monitors compiled on Windows machines + * where the Performance Data Helper object of interest has more + * than once instance, for example multiple CPUs or network cards. + */ + class MONITOR_CONTROL_Export Windows_Multi_Instance_Monitor + { + protected: + Windows_Multi_Instance_Monitor (const ACE_TCHAR *wildcard_path); + virtual ~Windows_Multi_Instance_Monitor (void); + + /// Platform-specific implementation. + void update_i (void); + + /// Platform-specific reset. + void clear_impl (void); + + protected: + double value_; + + private: + typedef ACE_Unbounded_Queue<Windows_Monitor *> + INSTANCES; + typedef ACE_Unbounded_Queue_Const_Iterator<Windows_Monitor *> + INSTANCES_ITERATOR; + + INSTANCES instances_; + DWORD n_instances_; + PDH_STATUS status_; + }; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* defined (ACE_HAS_WIN32_PDH) */ + +#endif // WINDOWS_MULTI_INSTANCE_MONITOR_H diff --git a/dep/acelite/ace/Monotonic_Time_Policy.cpp b/dep/acelite/ace/Monotonic_Time_Policy.cpp new file mode 100644 index 00000000000..3965c1bee48 --- /dev/null +++ b/dep/acelite/ace/Monotonic_Time_Policy.cpp @@ -0,0 +1,7 @@ +// $Id: Monotonic_Time_Policy.cpp 96061 2012-08-16 09:36:07Z mcorino $ + +#include "ace/Monotonic_Time_Policy.h" + +#if !defined(__ACE_INLINE__) +# include "ace/Monotonic_Time_Policy.inl" +#endif /* __ACE_INLINE__ */ diff --git a/dep/acelite/ace/Monotonic_Time_Policy.h b/dep/acelite/ace/Monotonic_Time_Policy.h new file mode 100644 index 00000000000..a9615c98eb8 --- /dev/null +++ b/dep/acelite/ace/Monotonic_Time_Policy.h @@ -0,0 +1,50 @@ +#ifndef ACE_MONOTONIC_TIME_POLICY_H +#define ACE_MONOTONIC_TIME_POLICY_H +// -*- C++ -*- +/** + * @file Monotonic_Time_Policy.h + * + * $Id: Monotonic_Time_Policy.h 96061 2012-08-16 09:36:07Z mcorino $ + * + * @author Martin Corino <mcorino@remedy.nl> + */ +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#include /**/ "ace/Time_Value_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Monotonic_Time_Policy + * + * @brief Implement a monotonic time policy for ACE. + * + * This class implements support for returning monotonic time values + * on platforms that support that. + * If a platform does not support monotonic time the policy returns + * ACE_Time_Value::zero. + */ +class ACE_Export ACE_Monotonic_Time_Policy +{ +public: + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_Monotonic_Time_Policy> operator() () const; + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Monotonic_Time_Policy.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_MONOTONIC_TIME_POLICY_H */ diff --git a/dep/acelite/ace/Monotonic_Time_Policy.inl b/dep/acelite/ace/Monotonic_Time_Policy.inl new file mode 100644 index 00000000000..e6f0b3df4f6 --- /dev/null +++ b/dep/acelite/ace/Monotonic_Time_Policy.inl @@ -0,0 +1,32 @@ +// -*- C++ -*- +// +// $Id: Monotonic_Time_Policy.inl 96095 2012-08-23 06:36:25Z johnnyw $ + +#include "ace/OS_NS_sys_time.h" +#include "ace/High_Res_Timer.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_Time_Value_T<ACE_Monotonic_Time_Policy> +ACE_Monotonic_Time_Policy::operator()() const +{ +# if defined (ACE_WIN32) + return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_High_Res_Timer::gettimeofday_hr ()); +#elif (defined (_POSIX_MONOTONIC_CLOCK) && !defined (ACE_LACKS_MONOTONIC_TIME)) || defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) + struct timespec ts; + + if (ACE_OS::clock_gettime (CLOCK_MONOTONIC, &ts) == 0) + return ACE_Time_Value_T<ACE_Monotonic_Time_Policy>(ts); + else + return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_Time_Value::zero); +#else + return ACE_Time_Value_T<ACE_Monotonic_Time_Policy> (ACE_Time_Value::zero); +#endif +} + +ACE_INLINE void +ACE_Monotonic_Time_Policy::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/NT_Service.h b/dep/acelite/ace/NT_Service.h index 0e1e0a16a84..f602021e418 100644 --- a/dep/acelite/ace/NT_Service.h +++ b/dep/acelite/ace/NT_Service.h @@ -4,7 +4,7 @@ /** * @file NT_Service.h * - * $Id: NT_Service.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: NT_Service.h 93117 2011-01-20 12:11:28Z mcorino $ * * @author Steve Huston <shuston@riverace.com> */ @@ -415,7 +415,8 @@ extern VOID WINAPI ace_nt_svc_main_##SVCNAME (DWORD dwArgc, \ ACE_TCHAR **lpszArgv); #define ACE_NT_SERVICE_ENTRY(SVCDESC, SVCNAME) \ - { SVCDESC, &ace_nt_svc_main_##SVCNAME } + { const_cast<ACE_TCHAR*> (SVCDESC), \ + &ace_nt_svc_main_##SVCNAME } #define ACE_NT_SERVICE_RUN(SVCNAME, SVCINSTANCE, RET) \ ACE_TEXT_SERVICE_TABLE_ENTRY _ace_nt_svc_table[2] = \ diff --git a/dep/acelite/ace/Name_Request_Reply.cpp b/dep/acelite/ace/Name_Request_Reply.cpp index 2d57818f97f..40ef90ccb2f 100644 --- a/dep/acelite/ace/Name_Request_Reply.cpp +++ b/dep/acelite/ace/Name_Request_Reply.cpp @@ -1,4 +1,4 @@ -// $Id: Name_Request_Reply.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Name_Request_Reply.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/Name_Request_Reply.h" #include "ace/Basic_Types.h" @@ -48,7 +48,8 @@ ACE_Name_Request::ACE_Name_Request ( this->block_forever (0); // Keep track of how long client is willing to wait. this->transfer_.sec_timeout_ = timeout->sec (); - this->transfer_.usec_timeout_ = timeout->usec (); + this->transfer_.usec_timeout_ = + static_cast<ACE_UINT32> (timeout->usec ()); } // Set up pointers and copy name value and type into request. @@ -195,7 +196,7 @@ ACE_Name_Request::timeout (const ACE_Time_Value timeout) { ACE_TRACE ("ACE_Name_Request::timeout"); this->transfer_.sec_timeout_ = timeout.sec (); - this->transfer_.usec_timeout_ = timeout.usec (); + this->transfer_.usec_timeout_ = static_cast<ACE_UINT32> (timeout.usec ()); } // = Set/get the name @@ -270,7 +271,7 @@ ACE_Name_Request::encode (void *&buf) for (size_t i = 0; i < nv_data_len; i++) this->transfer_.data_[i] = - ACE_HTONS (this->transfer_.data_[i]); + static_cast<ACE_WCHAR_T> (ACE_HTONS (this->transfer_.data_[i])); buf = (void *) &this->transfer_; this->transfer_.block_forever_ = ACE_HTONL (this->transfer_.block_forever_); @@ -314,7 +315,7 @@ ACE_Name_Request::decode (void) for (size_t i = 0; i < nv_data_len; i++) this->transfer_.data_[i] = - ACE_NTOHS (this->transfer_.data_[i]); + static_cast<ACE_WCHAR_T> (ACE_NTOHS (this->transfer_.data_[i])); this->name_ = this->transfer_.data_; this->value_ = &this->name_[this->transfer_.name_len_ / sizeof (ACE_WCHAR_T)]; diff --git a/dep/acelite/ace/Name_Space.h b/dep/acelite/ace/Name_Space.h index 93b57bd9cf9..66396644a29 100644 --- a/dep/acelite/ace/Name_Space.h +++ b/dep/acelite/ace/Name_Space.h @@ -4,7 +4,7 @@ /** * @file Name_Space.h * - * $Id: Name_Space.h 84834 2009-03-16 12:28:51Z johnnyw $ + * $Id: Name_Space.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Prashant Jain <pjain@cse.wustl.edu> */ @@ -99,13 +99,13 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Name_Space or bind a new name to the context, if it didn't - * exist yet. (Wide charcter strings interface). + * exist yet. (Wide character strings interface). */ virtual int rebind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, const char *type_in = "") = 0; - /// Delete a name from a ACE_Name_Space (Wide charcter strings + /// Delete a name from a ACE_Name_Space (Wide character strings /// Interface). virtual int unbind (const ACE_NS_WString &name_in) = 0; diff --git a/dep/acelite/ace/Naming_Context.cpp b/dep/acelite/ace/Naming_Context.cpp index 4bf312e8ad8..bca3b9b87d9 100644 --- a/dep/acelite/ace/Naming_Context.cpp +++ b/dep/acelite/ace/Naming_Context.cpp @@ -1,4 +1,4 @@ -// $Id: Naming_Context.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Naming_Context.cpp 93539 2011-03-13 09:40:44Z vzykov $ #include "ace/Get_Opt.h" #include "ace/Naming_Context.h" @@ -626,7 +626,7 @@ ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[]) "\t[-b base address]\n" "\t[-v] (verbose)\n" "\t[-r] (use Win32 Registry)\n", - argv[0]); + ACE_TEXT_ALWAYS_CHAR (argv[0])); /* NOTREACHED */ break; } diff --git a/dep/acelite/ace/Naming_Context.h b/dep/acelite/ace/Naming_Context.h index ffc0252eda7..15a20a6bfa2 100644 --- a/dep/acelite/ace/Naming_Context.h +++ b/dep/acelite/ace/Naming_Context.h @@ -4,7 +4,7 @@ /** * @file Naming_Context.h * - * $Id: Naming_Context.h 84160 2009-01-14 14:13:58Z johnnyw $ + * $Id: Naming_Context.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Gerhard Lenzer * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> @@ -126,7 +126,7 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Naming_Context or bind a new name to the context, if it - * didn't exist yet. (Wide charcter strings interface). + * didn't exist yet. (Wide character strings interface). */ int rebind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, @@ -135,13 +135,13 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Naming_Context or bind a new name to the context, if it - * didn't exist yet. ( charcter strings interface) + * didn't exist yet. ( character strings interface) */ int rebind (const char *name_in, const char *value_in, const char *type_in = ""); - /// Delete a name from a ACE_Naming_Context (Wide charcter strings + /// Delete a name from a ACE_Naming_Context (Wide character strings /// Interface). int unbind (const ACE_NS_WString &name_in); diff --git a/dep/acelite/ace/Netlink_Addr.h b/dep/acelite/ace/Netlink_Addr.h index b596068c517..87f0653da99 100644 --- a/dep/acelite/ace/Netlink_Addr.h +++ b/dep/acelite/ace/Netlink_Addr.h @@ -1,10 +1,8 @@ -// $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $ - //============================================================================= /** * @file Netlink_Addr.h * - * $Id: Netlink_Addr.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Netlink_Addr.h 95425 2012-01-09 11:09:43Z johnnyw $ * * @author Robert Iakobashvilli <coroberti@gmail.com> * @author Raz Ben Yehuda <raziebe@gmail.com> diff --git a/dep/acelite/ace/Notification_Queue.h b/dep/acelite/ace/Notification_Queue.h index a9ad1ad245b..d312e0cd2c7 100644 --- a/dep/acelite/ace/Notification_Queue.h +++ b/dep/acelite/ace/Notification_Queue.h @@ -1,15 +1,16 @@ -#ifndef ACE_NOTIFICATION_QUEUE_H -#define ACE_NOTIFICATION_QUEUE_H - -#include /**/ "ace/pre.h" - /** * @file Notification_Queue.h * - * $Id: Notification_Queue.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Notification_Queue.h 95425 2012-01-09 11:09:43Z johnnyw $ * * @author Carlos O'Ryan <coryan@atdesk.com> */ + +#ifndef ACE_NOTIFICATION_QUEUE_H +#define ACE_NOTIFICATION_QUEUE_H + +#include /**/ "ace/pre.h" + #include "ace/Copy_Disabled.h" #include "ace/Event_Handler.h" #include "ace/Intrusive_List.h" diff --git a/dep/acelite/ace/Notification_Queue.inl b/dep/acelite/ace/Notification_Queue.inl index d3579d272cf..999dd831e87 100644 --- a/dep/acelite/ace/Notification_Queue.inl +++ b/dep/acelite/ace/Notification_Queue.inl @@ -1,4 +1,4 @@ -// $Id: Notification_Queue.inl 81315 2008-04-10 07:14:15Z johnnyw $ +// $Id: Notification_Queue.inl 94385 2011-08-10 12:19:36Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -10,29 +10,26 @@ ACE_Notification_Queue_Node() } ACE_INLINE void -ACE_Notification_Queue_Node:: -set(ACE_Notification_Buffer const & rhs) +ACE_Notification_Queue_Node::set(ACE_Notification_Buffer const & rhs) { contents_ = rhs; } ACE_INLINE ACE_Notification_Buffer const & -ACE_Notification_Queue_Node:: -get() const +ACE_Notification_Queue_Node::get() const { return contents_; } ACE_INLINE bool -ACE_Notification_Queue_Node:: -matches_for_purging(ACE_Event_Handler * eh) const +ACE_Notification_Queue_Node::matches_for_purging(ACE_Event_Handler * eh) const { return (0 != get().eh_) && (0 == eh || eh == get().eh_); } ACE_INLINE bool -ACE_Notification_Queue_Node:: -mask_disables_all_notifications(ACE_Reactor_Mask mask) +ACE_Notification_Queue_Node::mask_disables_all_notifications( + ACE_Reactor_Mask mask) { // the existing notification mask is left with nothing when applying // the mask @@ -40,8 +37,7 @@ mask_disables_all_notifications(ACE_Reactor_Mask mask) } ACE_INLINE void -ACE_Notification_Queue_Node:: -clear_mask(ACE_Reactor_Mask mask) +ACE_Notification_Queue_Node::clear_mask(ACE_Reactor_Mask mask) { ACE_CLR_BITS(contents_.mask_, mask); } diff --git a/dep/acelite/ace/Null_Condition.h b/dep/acelite/ace/Null_Condition.h index 5f6277d1146..9a1e47ec093 100644 --- a/dep/acelite/ace/Null_Condition.h +++ b/dep/acelite/ace/Null_Condition.h @@ -4,7 +4,7 @@ /** * @file Null_Condition.h * - * $Id: Null_Condition.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Null_Condition.h 96076 2012-08-18 19:26:00Z johnnyw $ * * Moved from Synch.h. * @@ -17,6 +17,7 @@ #include /**/ "ace/pre.h" #include "ace/Null_Mutex.h" +#include "ace/Condition_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -27,23 +28,30 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; +class ACE_Condition_Attributes; +template <class MUTEX> class ACE_Condition; /** - * @class ACE_Null_Condition - * - * @brief Implement a do nothing ACE_Condition variable wrapper, - * i.e., all methods are no ops. This class is necessary since - * some C++ compilers are *very* lame... + * @brief ACE_Condition template specialization written using + * ACE_Null_Mutexes. Implements a do nothing ACE_Condition + * specialization, i.e., all methods are no ops. */ -class ACE_Null_Condition +template <> +class ACE_Condition<ACE_Null_Mutex> { public: - ACE_Null_Condition (const ACE_Null_Mutex &m, - const ACE_TCHAR * = 0, - void * = 0) + ACE_Condition (const ACE_Null_Mutex &m, + const ACE_TCHAR * = 0, + void * = 0) : mutex_ ((ACE_Null_Mutex &) m) {} - ~ACE_Null_Condition (void) {} + ACE_Condition (const ACE_Null_Mutex &m, + const ACE_Condition_Attributes &, + const ACE_TCHAR * = 0, + void * = 0) + : mutex_ ((ACE_Null_Mutex &) m) {} + + ~ACE_Condition (void) {} /// Returns 0. int remove (void) {return 0;} @@ -73,10 +81,12 @@ protected: private: // = Prevent assignment and initialization. - void operator= (const ACE_Null_Condition &); - ACE_Null_Condition (const ACE_Null_Condition &); + void operator= (const ACE_Condition<ACE_Null_Mutex> &); + ACE_Condition (const ACE_Condition<ACE_Null_Mutex> &); }; +typedef ACE_Condition<ACE_Null_Mutex> ACE_Null_Condition; + ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/dep/acelite/ace/Numeric_Limits.h b/dep/acelite/ace/Numeric_Limits.h index 0a1d5f2e8c3..c8ab7c2ff7b 100644 --- a/dep/acelite/ace/Numeric_Limits.h +++ b/dep/acelite/ace/Numeric_Limits.h @@ -4,7 +4,7 @@ /** * @file Numeric_Limits.h * - * $Id: Numeric_Limits.h 85057 2009-04-08 10:59:58Z msmit $ + * $Id: Numeric_Limits.h 95761 2012-05-15 18:23:04Z johnnyw $ * * Traits containing basic integer limits. Useful for template-based * code on platforms that lack @c std::numeric_limits<>. @@ -44,7 +44,7 @@ // // Ideally, we could prevent those macros from being defined by // defining the Windows-specific NOMINMAX symbol before any Windows -// headers are included, preferrably on the command line. However, +// headers are included, preferably on the command line. However, // that would probably break some applications. // // @@ Why isn't this a problem with MSVC++ and Borland builds? @@ -52,11 +52,6 @@ # undef max # endif /* __MINGW32__ */ -# if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -// For ACE_U_LongLong. -# include "ace/Basic_Types.h" -# endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ - # include <limits> #endif /* ACE_LACKS_NUMERIC_LIMITS */ @@ -112,34 +107,32 @@ struct ACE_Export ACE_Numeric_Limits<signed long> static signed long max (void) { return LONG_MAX; } }; -// #ifndef ACE_LACKS_LONGLONG_T -// template<> -// struct ACE_Export ACE_Numeric_Limits<signed long long> -// { -// #if defined (LLONG_MIN) -// # define ACE_LLONG_MIN LLONG_MIN -// #elif defined (LONG_LONG_MIN) -// # define ACE_LLONG_MIN LONG_LONG_MIN -// #elif defined (LONGLONG_MIN) -// # define ACE_LLONG_MIN LONGLONG_MIN -// #else -// # error Unable to determine minimum signed long long value. -// #endif /* LLONG_MIN */ - -// #if defined (LLONG_MAX) -// # define ACE_LLONG_MAX LLONG_MAX -// #elif defined (LONG_LONG_MAX) -// # define ACE_LLONG_MAX LONG_LONG_MAX -// #elif defined (LONGLONG_MAX) -// # define ACE_LLONG_MAX LONGLONG_MAX -// #else -// # error Unable to determine maximum signed long long value. -// #endif /* LLONG_MAX */ - -// static signed long long min (void) { return ACE_LLONG_MIN; } -// static signed long long max (void) { return ACE_LLONG_MAX; } -// }; -// #endif /* !ACE_LACKS_LONGLONG_T */ +template<> +struct ACE_Export ACE_Numeric_Limits<signed long long> +{ +#if defined (LLONG_MIN) +# define ACE_LLONG_MIN LLONG_MIN +#elif defined (LONG_LONG_MIN) +# define ACE_LLONG_MIN LONG_LONG_MIN +#elif defined (LONGLONG_MIN) +# define ACE_LLONG_MIN LONGLONG_MIN +#else +# error Unable to determine minimum signed long long value. +#endif /* LLONG_MIN */ + +#if defined (LLONG_MAX) +# define ACE_LLONG_MAX LLONG_MAX +#elif defined (LONG_LONG_MAX) +# define ACE_LLONG_MAX LONG_LONG_MAX +#elif defined (LONGLONG_MAX) +# define ACE_LLONG_MAX LONGLONG_MAX +#else +# error Unable to determine maximum signed long long value. +#endif /* LLONG_MAX */ + + static signed long long min (void) { return ACE_LLONG_MIN; } + static signed long long max (void) { return ACE_LLONG_MAX; } +}; // ------------------------------------------ // Unsigned integers @@ -171,23 +164,21 @@ struct ACE_Export ACE_Numeric_Limits<unsigned long> static unsigned long max (void) { return ULONG_MAX; } }; -// #ifndef ACE_LACKS_LONGLONG_T -// template<> -// struct ACE_Export ACE_Numeric_Limits<unsigned long long> -// { -// static unsigned long long min (void) { return 0; } -// static unsigned long long max (void) -// { -// # if defined (ULLONG_MAX) -// return ULLONG_MAX; -// # elif defined (ULONGLONG_MAX) -// return ULONGLONG_MAX; -// # else -// # error Unable to determine maximum unsigned long long value. -// # endif /* ULLONG_MAX */ -// } -// }; -// #endif /* !ACE_LACKS_LONGLONG_T */ +template<> +struct ACE_Export ACE_Numeric_Limits<unsigned long long> +{ + static unsigned long long min (void) { return 0; } + static unsigned long long max (void) + { +# if defined (ULLONG_MAX) + return ULLONG_MAX; +# elif defined (ULONGLONG_MAX) + return ULONGLONG_MAX; +# else +# error Unable to determine maximum unsigned long long value. +# endif /* ULLONG_MAX */ + } +}; // ------------------------------------------ // Floating point types @@ -254,15 +245,6 @@ struct ACE_Numeric_Limits<ULONGLONG> #endif /* ACE_LACKS_NUMERIC_LIMITS */ -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -template<> -struct ACE_Numeric_Limits<ACE_U_LongLong> -{ - static ACE_U_LongLong min (void) { return ACE_U_LongLong (); /* 0 */ } - static ACE_U_LongLong max (void) { return ACE_UINT64_MAX; } -}; -#endif /* ACE_LACKS_LONGLONG_T || defined ACE_LACKS_UNSIGNEDLONGLONG_T */ - ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/dep/acelite/ace/OS.h b/dep/acelite/ace/OS.h new file mode 100644 index 00000000000..1d52d2faaa3 --- /dev/null +++ b/dep/acelite/ace/OS.h @@ -0,0 +1,106 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file OS.h + * + * $Id: OS.h 95319 2011-12-13 14:54:44Z mhengstmengel $ + * + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + * @author Jesper S. M|ller<stophph@diku.dk> + * @author and a cast of thousands... + */ +//============================================================================= + +#ifndef ACE_OS_H +#define ACE_OS_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @namespace ACE_OS + * + * @brief This namespace defines an OS independent programming API that + * shields developers from nonportable aspects of writing + * efficient system programs on Win32, POSIX and other versions + * of UNIX, and various real-time operating systems. + * + * This namespace encapsulates the differences between various OS + * platforms. When porting ACE to a new platform, this class is + * the place to focus on. Once this file is ported to a new + * platform, pretty much everything else comes for "free." See + * <www.cs.wustl.edu/~schmidt/ACE_wrappers/etc/ACE-porting.html> + * for instructions on porting ACE. Please see the README file + * in this directory for complete information on the meaning of + * the various macros. + */ +namespace ACE_OS +{ + // = A set of wrappers for miscellaneous operations. +} /* namespace ACE_OS */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if !defined (DO_NOT_INCLUDE_OS_H) +#include "ace/Cleanup.h" +#include "ace/Object_Manager_Base.h" +#include "ace/OS_main.h" +#include "ace/OS_NS_arpa_inet.h" +#include "ace/OS_NS_ctype.h" +#include "ace/OS_NS_dirent.h" +#include "ace/OS_NS_dlfcn.h" +#include "ace/OS_NS_errno.h" +#include "ace/OS_NS_fcntl.h" +#include "ace/OS_NS_math.h" +#include "ace/OS_NS_netdb.h" +#include "ace/OS_NS_poll.h" +#include "ace/OS_NS_pwd.h" +#include "ace/OS_NS_regex.h" +#include "ace/OS_NS_signal.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_stdlib.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_strings.h" +#include "ace/OS_NS_stropts.h" +#include "ace/OS_NS_sys_mman.h" +#include "ace/OS_NS_sys_msg.h" +#include "ace/OS_NS_sys_resource.h" +#include "ace/OS_NS_sys_select.h" +#include "ace/OS_NS_sys_shm.h" +#include "ace/OS_NS_sys_socket.h" +#include "ace/OS_NS_sys_stat.h" +#include "ace/OS_NS_sys_time.h" +#include "ace/OS_NS_sys_uio.h" +#include "ace/OS_NS_sys_utsname.h" +#include "ace/OS_NS_sys_wait.h" +#include "ace/OS_NS_Thread.h" +#include "ace/OS_NS_time.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_wchar.h" + +// Include the split up ACE_OS classes +#include "ace/OS_Memory.h" +#include "ace/OS_TLI.h" +#include "ace/OS_Errno.h" + +// Here are all ACE-specific default constants, needed throughout ACE +// and its applications. The values can be over written by user +// specific values in config.h files. +#include "ace/Default_Constants.h" + +// Here are all ACE-specific global declarations needed throughout +// ACE. +#include "ace/Global_Macros.h" + +#endif /* DO_NOT_INCLUDE_OS_H */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_H */ diff --git a/dep/acelite/ace/OS_NS_Thread.cpp b/dep/acelite/ace/OS_NS_Thread.cpp index c424e3f5795..8e36eb9e4f7 100644 --- a/dep/acelite/ace/OS_NS_Thread.cpp +++ b/dep/acelite/ace/OS_NS_Thread.cpp @@ -1,4 +1,4 @@ -// $Id: OS_NS_Thread.cpp 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: OS_NS_Thread.cpp 96061 2012-08-16 09:36:07Z mcorino $ #include "ace/OS_NS_Thread.h" @@ -18,7 +18,7 @@ // This is necessary to work around nasty problems with MVS C++. #include "ace/Auto_Ptr.h" #include "ace/Thread_Mutex.h" -#include "ace/Condition_T.h" +#include "ace/Condition_Thread_Mutex.h" #include "ace/Guard_T.h" extern "C" void @@ -50,34 +50,18 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Thread_ID::to_string (char *thr_string) const { - char format[128]; // Converted format string - char *fp = 0; // Current format pointer - fp = format; - *fp++ = '%'; // Copy in the % - #if defined (ACE_WIN32) - ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_string, - format, + ACE_OS::sprintf (thr_string, "%u", static_cast <unsigned> (this->thread_id_)); #else -# if defined (ACE_MVS) || defined (ACE_TANDEM_T1248_PTHREADS) - // MVS's pthread_t is a struct... yuck. So use the ACE 5.0 - // code for it. - ACE_OS::strcpy (fp, "u"); - ACE_OS::sprintf (thr_string, format, thread_handle_); -# else - // Yes, this is an ugly C-style cast, but the - // correct C++ cast is different depending on - // whether the t_id is an integral type or a pointer - // type. FreeBSD uses a pointer type, but doesn't - // have a _np function to get an integral type, like - // the OSes above. - ACE_OS::strcpy (fp, "lu"); - ACE_OS::sprintf (thr_string, - format, - (unsigned long) thread_handle_); -# endif /* ACE_MVS || ACE_TANDEM_T1248_PTHREADS */ + // Yes, this is an ugly C-style cast, but the + // correct C++ cast is different depending on + // whether the t_id is an integral type or a pointer + // type. FreeBSD uses a pointer type, but doesn't + // have a _np function to get an integral type like + // other OSes, so use the bigger hammer. + ACE_OS::sprintf (thr_string, "%lu", + (unsigned long) thread_handle_); #endif /* ACE_WIN32 */ } @@ -232,13 +216,7 @@ ACE_TSS_Emulation::next_key (ACE_thread_key_t &key) // Loop through all possible keys and check whether a key is free for ( ;counter < ACE_TSS_THREAD_KEYS_MAX; counter++) { - ACE_thread_key_t localkey; -# if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T) - ACE_OS::memset (&localkey, 0, sizeof (ACE_thread_key_t)); - ACE_OS::memcpy (&localkey, &counter_, sizeof (u_int)); -# else - localkey = counter; -# endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */ + ACE_thread_key_t localkey = counter; // If the key is not set as used, we can give out this key, if not // we have to search further if (tss_keys_used_->is_set(localkey) == 0) @@ -397,20 +375,6 @@ ACE_TSS_Info::ACE_TSS_Info (void) ACE_OS_TRACE ("ACE_TSS_Info::ACE_TSS_Info"); } -# if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T) -static inline bool operator== (const ACE_thread_key_t &lhs, - const ACE_thread_key_t &rhs) -{ - return ! ACE_OS::memcmp (&lhs, &rhs, sizeof (ACE_thread_key_t)); -} - -static inline bool operator!= (const ACE_thread_key_t &lhs, - const ACE_thread_key_t &rhs) -{ - return ! (lhs == rhs); -} -# endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */ - // Check for equality. bool ACE_TSS_Info::operator== (const ACE_TSS_Info &info) const @@ -466,9 +430,8 @@ ACE_TSS_Keys::find (const u_int key, u_int &word, u_int &bit) int ACE_TSS_Keys::test_and_set (const ACE_thread_key_t key) { - ACE_KEY_INDEX (key_index, key); u_int word, bit; - find (key_index, word, bit); + find (key, word, bit); if (ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) { @@ -484,9 +447,8 @@ ACE_TSS_Keys::test_and_set (const ACE_thread_key_t key) int ACE_TSS_Keys::test_and_clear (const ACE_thread_key_t key) { - ACE_KEY_INDEX (key_index, key); u_int word, bit; - find (key_index, word, bit); + find (key, word, bit); if (word < ACE_WORDS && ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) { @@ -502,9 +464,8 @@ ACE_TSS_Keys::test_and_clear (const ACE_thread_key_t key) int ACE_TSS_Keys::is_set (const ACE_thread_key_t key) const { - ACE_KEY_INDEX (key_index, key); u_int word, bit; - find (key_index, word, bit); + find (key, word, bit); return word < ACE_WORDS ? ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit) : 0; } @@ -627,7 +588,7 @@ private: static unsigned int reference_count_; static ACE_TSS_Cleanup * instance_; static ACE_Thread_Mutex* mutex_; - static ACE_Thread_Condition<ACE_Thread_Mutex>* condition_; + static ACE_Condition_Thread_Mutex* condition_; private: ACE_TSS_Cleanup * ptr_; @@ -650,7 +611,7 @@ TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose) if (mutex_ == 0) { ACE_NEW (mutex_, ACE_Thread_Mutex ()); - ACE_NEW (condition_, ACE_Thread_Condition<ACE_Thread_Mutex> (*mutex_)); + ACE_NEW (condition_, ACE_Condition_Thread_Mutex (*mutex_)); } ACE_GUARD (ACE_Thread_Mutex, m, *mutex_); @@ -750,7 +711,7 @@ TSS_Cleanup_Instance::operator ->() unsigned int TSS_Cleanup_Instance::reference_count_ = 0; ACE_TSS_Cleanup * TSS_Cleanup_Instance::instance_ = 0; ACE_Thread_Mutex* TSS_Cleanup_Instance::mutex_ = 0; -ACE_Thread_Condition<ACE_Thread_Mutex>* TSS_Cleanup_Instance::condition_ = 0; +ACE_Condition_Thread_Mutex* TSS_Cleanup_Instance::condition_ = 0; ACE_TSS_Cleanup::~ACE_TSS_Cleanup (void) { @@ -810,7 +771,7 @@ ACE_TSS_Cleanup::thread_exit (void) } // remove the in_use bit vector last - ACE_KEY_INDEX (use_index, this->in_use_); + u_int use_index = this->in_use_; ACE_TSS_Info & info = this->table_[use_index]; destructor[d_count] = 0; tss_obj[d_count] = 0; @@ -852,7 +813,7 @@ ACE_TSS_Cleanup::insert (ACE_thread_key_t key, ACE_OS_TRACE ("ACE_TSS_Cleanup::insert"); ACE_TSS_CLEANUP_GUARD - ACE_KEY_INDEX (key_index, key); + u_int key_index = key; ACE_ASSERT (key_index < ACE_DEFAULT_THREAD_KEYS); if (key_index < ACE_DEFAULT_THREAD_KEYS) { @@ -873,7 +834,7 @@ ACE_TSS_Cleanup::free_key (ACE_thread_key_t key) { ACE_OS_TRACE ("ACE_TSS_Cleanup::free_key"); ACE_TSS_CLEANUP_GUARD - ACE_KEY_INDEX (key_index, key); + u_int key_index = key; if (key_index < ACE_DEFAULT_THREAD_KEYS) { return remove_key (this->table_ [key_index]); @@ -923,7 +884,7 @@ ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key) { ACE_TSS_CLEANUP_GUARD - ACE_KEY_INDEX (key_index, key); + u_int key_index = key; ACE_ASSERT (key_index < sizeof(this->table_)/sizeof(this->table_[0]) && this->table_[key_index].key_ == key); ACE_TSS_Info &info = this->table_ [key_index]; @@ -979,7 +940,7 @@ ACE_TSS_Cleanup::thread_use_key (ACE_thread_key_t key) ACE_TSS_CLEANUP_GUARD // Retrieve the key's ACE_TSS_Info and increment its thread_count_. - ACE_KEY_INDEX (key_index, key); + u_int key_index = key; ACE_TSS_Info &key_info = this->table_ [key_index]; ACE_ASSERT (key_info.key_in_use ()); @@ -1450,7 +1411,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // WaitForSingleObjects() expects). - ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout->to_relative_time (); // Watchout for situations where a context switch has caused the // current time to be > the timeout. @@ -1623,7 +1584,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, int msec_timeout = 0; int result = 0; - ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout->to_relative_time (); // Watchout for situations where a context switch has caused the // current time to be > the timeout. if (relative_time > ACE_Time_Value::zero) @@ -1652,7 +1613,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // WaitForSingleObjects() expects). - ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout->to_relative_time (); // Watchout for situations where a context switch has caused the // current time to be > the timeout. @@ -2184,7 +2145,7 @@ ACE_OS::mutex_lock (ACE_mutex_t *m, // Note that we must convert between absolute time (which is passed // as a parameter) and relative time (which is what the system call // expects). - ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout.to_relative_time (); switch (m->type_) { @@ -2218,7 +2179,7 @@ ACE_OS::mutex_lock (ACE_mutex_t *m, // Note that we must convert between absolute time (which is passed // as a parameter) and relative time (which is what the system call // expects). - ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout.to_relative_time (); int ticks_per_sec = ::sysClkRateGet (); @@ -3055,7 +3016,7 @@ ACE_OS::event_timedwait (ACE_event_t *event, { // Time is given in absolute time, we should use // gettimeofday() to calculate relative time - ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout->to_relative_time (); // Watchout for situations where a context switch has caused // the current time to be > the timeout. Thanks to Norbert @@ -3116,7 +3077,7 @@ ACE_OS::event_timedwait (ACE_event_t *event, // cond_timewait() expects absolute time, check // <use_absolute_time> flag. if (use_absolute_time == 0) - absolute_timeout += ACE_OS::gettimeofday (); + absolute_timeout = timeout->to_absolute_time (); while (event->eventdata_->is_signaled_ == 0 && event->eventdata_->auto_event_signaled_ == false) @@ -3533,7 +3494,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, #if defined (ACE_HAS_STHREADS) return ACE_OS::set_scheduling_params (sched_params, id); #elif defined (ACE_HAS_PTHREADS) && \ - (!defined (ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ + (!defined (ACE_LACKS_SETSCHED) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) if (sched_params.quantum () != ACE_Time_Value::zero) { @@ -3552,15 +3513,15 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, if (sched_params.scope () == ACE_SCOPE_PROCESS) { -# if defined(ACE_TANDEM_T1248_PTHREADS) || defined (ACE_HAS_PTHREAD_SCHEDPARAM) +# if defined (ACE_HAS_PTHREAD_SCHEDPARAM) ACE_UNUSED_ARG (id); ACE_NOTSUP_RETURN (-1); -# else /* ! ACE_TANDEM_T1248_PTHREADS */ +# else /* !ACE_HAS_PTHREAD_SCHEDPARAM */ int result = ::sched_setscheduler (id == ACE_SELF ? 0 : id, sched_params.policy (), ¶m) == -1 ? -1 : 0; return result; -# endif /* ! ACE_TANDEM_T1248_PTHREADS */ +# endif /* !ACE_HAS_PTHREAD_SCHEDPARAM */ } else if (sched_params.scope () == ACE_SCOPE_THREAD) { @@ -3858,12 +3819,14 @@ ACE_OS::thr_create (ACE_THR_FUNC func, ACE_OS_Thread_Adapter (func, args, (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_OS_Object_Manager::seh_except_selector(), - ACE_OS_Object_Manager::seh_except_handler()), + ACE_OS_Object_Manager::seh_except_handler(), + flags), -1); #else ACE_NEW_RETURN (thread_args, ACE_OS_Thread_Adapter (func, args, - (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME), + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, + flags), -1); #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ @@ -3873,9 +3836,8 @@ ACE_OS::thr_create (ACE_THR_FUNC func, auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args; if (thread_adapter == 0) - ACE_AUTO_PTR_RESET (auto_thread_args, - thread_args, - ACE_Base_Thread_Adapter); + ACE_auto_ptr_reset (auto_thread_args, + thread_args); #if defined (ACE_HAS_THREADS) @@ -4104,6 +4066,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } } +# if !defined (ACE_LACKS_SETINHERITSCHED) // *** Set scheduling explicit or inherited if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED) || ACE_BIT_ENABLED (flags, THR_EXPLICIT_SCHED)) @@ -4117,6 +4080,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func, return -1; } } +# endif /* ACE_LACKS_SETINHERITSCHED */ # else /* ACE_LACKS_SETSCHED */ ACE_UNUSED_ARG (priority); # endif /* ACE_LACKS_SETSCHED */ diff --git a/dep/acelite/ace/OS_NS_Thread.h b/dep/acelite/ace/OS_NS_Thread.h index 4145210889b..ee73b5bd3c1 100644 --- a/dep/acelite/ace/OS_NS_Thread.h +++ b/dep/acelite/ace/OS_NS_Thread.h @@ -4,7 +4,7 @@ /** * @file OS_NS_Thread.h * - * $Id: OS_NS_Thread.h 91693 2010-09-09 12:57:54Z johnnyw $ + * $Id: OS_NS_Thread.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -1023,23 +1023,12 @@ private: # endif /* defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) */ -// Support non-scalar thread keys, such as with some POSIX -// implementations, e.g., MVS. -# if defined (ACE_HAS_NONSCALAR_THREAD_KEY_T) -# define ACE_KEY_INDEX(OBJ,KEY) \ - u_int OBJ; \ - ACE_OS::memcpy (&OBJ, &KEY, sizeof (u_int)) -# else -# define ACE_KEY_INDEX(OBJ,KEY) u_int OBJ = KEY -# endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */ - ACE_END_VERSIONED_NAMESPACE_DECL #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # define ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_mutex_lock_cleanup_adapter) #endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ - # 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_NAME (void *args); @@ -1099,6 +1088,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int condattr_destroy (ACE_condattr_t &attributes); + ACE_NAMESPACE_INLINE_FUNCTION + int condattr_setclock(ACE_condattr_t &attributes, + clockid_t clock_id); + #if defined (ACE_LACKS_COND_T) extern ACE_Export #else @@ -1288,7 +1281,7 @@ namespace ACE_OS { const ACE_Time_Value &timeout); /** - * If <timeout> == 0, calls <ACE_OS::mutex_lock(m)>. Otherwise, + * If @a timeout == 0, calls <ACE_OS::mutex_lock(m)>. Otherwise, * this method attempts to acquire a lock, but gives up if the lock * has not been acquired by the given time, in which case it returns * -1 with an @c ETIME errno on platforms that actually support timed @@ -1312,7 +1305,7 @@ namespace ACE_OS { int mutex_trylock (ACE_mutex_t *m); /// This method is only implemented for Win32. For abandoned - /// mutexes, <abandoned> is set to 1 and 0 is returned. + /// mutexes, @a abandoned is set to 1 and 0 is returned. extern ACE_Export int mutex_trylock (ACE_mutex_t *m, int &abandoned); @@ -1410,7 +1403,7 @@ namespace ACE_OS { int sched_params (const ACE_Sched_Params &, ACE_id_t id = ACE_SELF); //@} - /// Find the schedling class ID that corresponds to the class name. + /// Find the scheduling class ID that corresponds to the class name. extern ACE_Export int scheduling_class (const char *class_name, ACE_id_t &); @@ -1509,7 +1502,7 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int thr_continue (ACE_hthread_t target_thread); - /* + /** * Creates a new thread having @a flags attributes and running @a func * with @a args (if @a thread_adapter is non-0 then @a func and @a args * are ignored and are obtained from @a thread_adapter). @a thr_id @@ -1684,9 +1677,11 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION const char* thr_name (void); + /// State is THR_CANCEL_ENABLE or THR_CANCEL_DISABLE ACE_NAMESPACE_INLINE_FUNCTION int thr_setcancelstate (int new_state, int *old_state); + /// Type is THR_CANCEL_DEFERRED or THR_CANCEL_ASYNCHRONOUS ACE_NAMESPACE_INLINE_FUNCTION int thr_setcanceltype (int new_type, int *old_type); diff --git a/dep/acelite/ace/OS_NS_Thread.inl b/dep/acelite/ace/OS_NS_Thread.inl index a921e6907b6..460e80f2a04 100644 --- a/dep/acelite/ace/OS_NS_Thread.inl +++ b/dep/acelite/ace/OS_NS_Thread.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_Thread.inl 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: OS_NS_Thread.inl 96074 2012-08-17 18:06:56Z johnnyw $ #include "ace/OS_NS_macros.h" // for timespec_t, perhaps move it to os_time.h @@ -45,7 +45,11 @@ void **& ACE_TSS_Emulation::tss_base () { # if defined (ACE_HAS_VXTHREADS) + #if (ACE_VXWORKS <= 0x680) int &spare = taskIdCurrent->ACE_VXWORKS_SPARE; + #else // VxWorks 6.9 updated datatype (WIND00241209) see taskLib.h + long &spare = taskIdCurrent->ACE_VXWORKS_SPARE; + #endif return reinterpret_cast <void **&> (spare); # else // Uh oh. @@ -58,8 +62,7 @@ ACE_INLINE ACE_TSS_Emulation::ACE_TSS_DESTRUCTOR ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key) { - ACE_KEY_INDEX (key_index, key); - return tss_destructor_ [key_index]; + return tss_destructor_ [key]; } ACE_INLINE @@ -67,16 +70,13 @@ void ACE_TSS_Emulation::tss_destructor (const ACE_thread_key_t key, ACE_TSS_DESTRUCTOR destructor) { - ACE_KEY_INDEX (key_index, key); - tss_destructor_ [key_index] = destructor; + tss_destructor_ [key] = destructor; } ACE_INLINE void *& ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key) { - ACE_KEY_INDEX (key_index, key); - # if defined (ACE_HAS_VXTHREADS) /* If someone wants tss_base make sure they get one. This gets used if someone spawns a VxWorks task directly, not @@ -97,7 +97,7 @@ ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key) } # endif /* ACE_HAS_VXTHREADS */ - return tss_base ()[key_index]; + return tss_base ()[key]; } #endif /* ACE_HAS_TSS_EMULATION */ @@ -124,7 +124,7 @@ ACE_OS::thr_equal (ACE_thread_t t1, ACE_thread_t t2) ACE_INLINE int ACE_OS::condattr_destroy (ACE_condattr_t &attributes) { -#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_THREADS) && !defined (ACE_LACKS_CONDATTR) # if defined (ACE_HAS_PTHREADS) pthread_condattr_destroy (&attributes); # else @@ -145,23 +145,30 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes, int type) # if defined (ACE_HAS_PTHREADS) int result = -1; -# if defined (ACE_PTHREAD_CONDATTR_T_INITIALIZE) - /* Tests show that VxWorks 6.x pthread lib does not only - * require zeroing of mutex/condition objects to function correctly - * but also of the attribute objects. - */ - ACE_OS::memset (&attributes, 0, sizeof (attributes)); -# endif +# if !defined (ACE_LACKS_CONDATTR) +# if defined (ACE_PTHREAD_CONDATTR_T_INITIALIZE) + /* Tests show that VxWorks 6.x pthread lib does not only + * require zeroing of mutex/condition objects to function correctly + * but also of the attribute objects. + */ + ACE_OS::memset (&attributes, 0, sizeof (attributes)); +# endif if ( ACE_ADAPT_RETVAL (pthread_condattr_init (&attributes), result) == 0 -# if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED) +# if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED) && ACE_ADAPT_RETVAL (pthread_condattr_setpshared (&attributes, type), result) == 0 -# endif /* _POSIX_THREAD_PROCESS_SHARED && ! ACE_LACKS_CONDATTR_PSHARED */ +# endif /* _POSIX_THREAD_PROCESS_SHARED && ! ACE_LACKS_CONDATTR_PSHARED */ ) +# else + if (type == USYNC_THREAD) +# endif /* !ACE_LACKS_CONDATTR */ result = 0; else - result = -1; // ACE_ADAPT_RETVAL used it for intermediate status + { + ACE_UNUSED_ARG (attributes); + result = -1; // ACE_ADAPT_RETVAL used it for intermediate status + } return result; # else @@ -176,6 +183,36 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes, int type) # endif /* ACE_HAS_THREADS */ } +ACE_INLINE int +ACE_OS::condattr_setclock (ACE_condattr_t &attributes, clockid_t clock_id) +{ +# if defined (ACE_HAS_THREADS) +# if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_CONDATTR) + int result = -1; + +# if defined (_POSIX_CLOCK_SELECTION) && !defined (ACE_LACKS_CONDATTR_SETCLOCK) + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_condattr_setclock (&attributes, clock_id), + result), + int, -1); +# else + ACE_UNUSED_ARG (clock_id); + ACE_UNUSED_ARG (attributes); +# endif /* _POSIX_CLOCK_SELECTION) && !ACE_LACKS_CONDATTR_SETCLOCK */ + + return result; +# else + ACE_UNUSED_ARG (clock_id); + ACE_UNUSED_ARG (attributes); + ACE_NOTSUP_RETURN (-1); +# endif /* ACE_HAS_PTHREADS && !ACE_LACKS_CONDATTR */ + +# else + ACE_UNUSED_ARG (clock_id); + ACE_UNUSED_ARG (attributes); + ACE_NOTSUP_RETURN (-1); +# endif /* ACE_HAS_THREADS */ +} + #if !defined (ACE_LACKS_COND_T) // NOTE: The ACE_OS::cond_* functions for Unix platforms are defined // here because the ACE_OS::sema_* functions below need them. @@ -383,7 +420,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, int msec_timeout = 0; if (timeout != 0) { - ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = timeout->to_relative_time (); // Watchout for situations where a context switch has caused the // current time to be > the timeout. if (relative_time > ACE_Time_Value::zero) @@ -2146,7 +2183,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) { result = ACE_OS::sema_trywait (s); if (result == -1 && errno == EAGAIN) - expired = ACE_OS::gettimeofday () > tv; + expired = (tv.to_relative_time () <= ACE_Time_Value::zero); else expired = false; @@ -2169,7 +2206,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) error = ETIME; # if defined (ACE_LACKS_COND_TIMEDWAIT_RESET) - tv = ACE_OS::gettimeofday (); + tv = tv.now (); # endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */ } @@ -2184,13 +2221,10 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) # endif /* ACE_HAS_POSIX_SEM_TIMEOUT */ # elif defined (ACE_USES_FIFO_SEM) int rc; - ACE_Time_Value now = ACE_OS::gettimeofday (); + ACE_Time_Value timeout = tv.to_relative_time (); - while (tv > now) + while (timeout > ACE_Time_Value::zero) { - ACE_Time_Value timeout = tv; - timeout -= now; - ACE_Handle_Set fds_; fds_.set_bit (s->fd_[0]); @@ -2210,7 +2244,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // we were woken for input but someone beat us to it // so we wait again if there is still time - now = ACE_OS::gettimeofday (); + timeout = tv.to_relative_time (); } // make sure errno is set right @@ -2253,7 +2287,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) if (result == 0) { # if defined (ACE_LACKS_COND_TIMEDWAIT_RESET) - tv = ACE_OS::gettimeofday (); + tv = tv.now (); # endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */ --s->count_; } @@ -2273,7 +2307,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // <WaitForSingleObjects> expects). - ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = tv.to_relative_time (); // Watchout for situations where a context switch has caused the // current time to be > the timeout. @@ -2286,7 +2320,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) switch (::WaitForSingleObject (*s, msec_timeout)) { case WAIT_OBJECT_0: - tv = ACE_OS::gettimeofday (); // Update time to when acquired + tv = tv.now (); // Update time to when acquired return 0; case WAIT_TIMEOUT: errno = ETIME; @@ -2308,10 +2342,9 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // as a shortcut for "now", which works on non-Windows because 0 is // always earlier than now. However, the need to convert to relative time // means we need to watch out for this case. - ACE_Time_Value end_time = tv; - if (tv == ACE_Time_Value::zero) - end_time = ACE_OS::gettimeofday (); - ACE_Time_Value relative_time = end_time - ACE_OS::gettimeofday (); + ACE_Time_Value relative_time (ACE_Time_Value::zero); + if (tv != ACE_Time_Value::zero) + relative_time = tv.to_relative_time (); int result = -1; // While we are not timeout yet. >= 0 will let this go through once @@ -2343,7 +2376,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // Only return when we successfully get the semaphore. if (result == 0) { - tv = ACE_OS::gettimeofday (); // Update to time acquired + tv = tv.now (); // Update to time acquired return 0; } break; @@ -2362,7 +2395,8 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // Haven't been able to get the semaphore yet, update the // timeout value to reflect the remaining time we want to wait. - relative_time = end_time - ACE_OS::gettimeofday (); + // in case of tv == 0 relative_time will now be < 0 and we will be out of time + relative_time = tv.to_relative_time (); } // We have timed out. @@ -2373,7 +2407,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // the system call expects). - ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); + ACE_Time_Value relative_time = tv.to_relative_time (); int ticks_per_sec = ::sysClkRateGet (); @@ -2391,7 +2425,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) } else { - tv = ACE_OS::gettimeofday (); // Update to time acquired + tv = tv.now (); // Update to time acquired return 0; } # endif /* ACE_HAS_STHREADS */ @@ -2504,10 +2538,7 @@ ACE_OS::sigwait (sigset_t *sset, int *sig) // Cygwin has sigwait definition, but it is not implemented ACE_UNUSED_ARG (sset); ACE_NOTSUP_RETURN (-1); -# elif defined (ACE_TANDEM_T1248_PTHREADS) - errno = ::spt_sigwait (sset, sig); - return errno == 0 ? *sig : -1; -# else /* this is draft 7 or std */ +# else /* this is std */ errno = ::sigwait (sset, sig); return errno == 0 ? *sig : -1; # endif /* CYGWIN32 */ @@ -2988,10 +3019,35 @@ ACE_OS::thr_setcancelstate (int new_state, int *old_state) #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcancelstate (new_state, - old_state), - result), - int, -1); + int local_new, local_old; + switch (new_state) + { + case THR_CANCEL_ENABLE: + local_new = PTHREAD_CANCEL_ENABLE; + break; + case THR_CANCEL_DISABLE: + local_new = PTHREAD_CANCEL_DISABLE; + break; + default: + errno = EINVAL; + return -1; + } + ACE_OSCALL (ACE_ADAPT_RETVAL (pthread_setcancelstate (local_new, + &local_old), + result), + int, -1, result); + if (result == -1) + return -1; + switch (local_old) + { + case PTHREAD_CANCEL_ENABLE: + *old_state = THR_CANCEL_ENABLE; + break; + case PTHREAD_CANCEL_DISABLE: + *old_state = THR_CANCEL_DISABLE; + break; + } + return result; # elif defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (new_state); ACE_UNUSED_ARG (old_state); @@ -3019,10 +3075,35 @@ ACE_OS::thr_setcanceltype (int new_type, int *old_type) #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcanceltype (new_type, - old_type), - result), - int, -1); + int local_new, local_old; + switch (new_type) + { + case THR_CANCEL_DEFERRED: + local_new = PTHREAD_CANCEL_DEFERRED; + break; + case THR_CANCEL_ASYNCHRONOUS: + local_new = PTHREAD_CANCEL_ASYNCHRONOUS; + break; + default: + errno = EINVAL; + return -1; + } + ACE_OSCALL (ACE_ADAPT_RETVAL (pthread_setcanceltype (local_new, + &local_old), + result), + int, -1, result); + if (result == -1) + return -1; + switch (local_old) + { + case PTHREAD_CANCEL_DEFERRED: + *old_type = THR_CANCEL_DEFERRED; + break; + case PTHREAD_CANCEL_ASYNCHRONOUS: + *old_type = THR_CANCEL_ASYNCHRONOUS; + break; + } + return result; # else /* Could be ACE_HAS_PTHREADS && ACE_LACKS_PTHREAD_CANCEL */ ACE_UNUSED_ARG (new_type); ACE_UNUSED_ARG (old_type); diff --git a/dep/acelite/ace/OS_NS_arpa_inet.cpp b/dep/acelite/ace/OS_NS_arpa_inet.cpp index 537051cc1df..d585cc69ec9 100644 --- a/dep/acelite/ace/OS_NS_arpa_inet.cpp +++ b/dep/acelite/ace/OS_NS_arpa_inet.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: OS_NS_arpa_inet.cpp 91781 2010-09-15 12:49:15Z johnnyw $ +// $Id: OS_NS_arpa_inet.cpp 95534 2012-02-17 23:19:33Z mitza $ #include "ace/OS_NS_arpa_inet.h" @@ -34,7 +34,7 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) addr->s_addr = ip_addr; // Network byte ordered return 1; } -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x680) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x690) // inet_aton() returns OK (0) on success and ERROR (-1) on failure. // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 ::errnoSet(0); diff --git a/dep/acelite/ace/OS_NS_dlfcn.inl b/dep/acelite/ace/OS_NS_dlfcn.inl index 14960008dd1..522166befe2 100644 --- a/dep/acelite/ace/OS_NS_dlfcn.inl +++ b/dep/acelite/ace/OS_NS_dlfcn.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_dlfcn.inl 85341 2009-05-14 11:07:37Z johnnyw $ +// $Id: OS_NS_dlfcn.inl 92474 2010-11-02 13:29:39Z johnnyw $ #include "ace/OS_NS_macros.h" #include "ace/OS_NS_errno.h" @@ -40,11 +40,7 @@ ACE_OS::dlclose (ACE_SHLIB_HANDLE handle) if (ptr != 0) (*((int (*)(void)) ptr)) (); // Call _fini hook explicitly. # endif /* ACE_HAS_AUTOMATIC_INIT_FINI */ -#if defined (_M_UNIX) - ACE_OSCALL_RETURN (::_dlclose (handle), int, -1); -#else /* _MUNIX */ - ACE_OSCALL_RETURN (::dlclose (handle), int, -1); -#endif /* _M_UNIX */ + ACE_OSCALL_RETURN (::dlclose (handle), int, -1); #elif defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FreeLibrary (handle), ace_result_), int, -1); #elif defined (__hpux) @@ -79,11 +75,7 @@ ACE_OS::dlerror (void) ACE_OS_TRACE ("ACE_OS::dlerror"); # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) const char *err = 0; -# if defined(_M_UNIX) - ACE_OSCALL (::_dlerror (), const char *, 0, err); -# else /* _M_UNIX */ ACE_OSCALL (::dlerror (), const char *, 0, err); -# endif /* _M_UNIX */ if (err == 0) return 0; # if defined (ACE_USES_WCHAR) @@ -128,9 +120,6 @@ ACE_OS::dlopen (const ACE_TCHAR *fname, # if defined (ACE_HAS_SGIDLADD) ACE_OSCALL (::sgidladd (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle); -# elif defined (_M_UNIX) - ACE_OSCALL - (::_dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle); # else ACE_OSCALL (::dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle); @@ -244,8 +233,6 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle, ACE_OSCALL (::dlsym (handle, asm_symbolname), void *, 0, ace_result); delete [] asm_symbolname; return ace_result; -# elif defined (_M_UNIX) - ACE_OSCALL_RETURN (::_dlsym (handle, symbolname), void *, 0); # else ACE_OSCALL_RETURN (::dlsym (handle, symbolname), void *, 0); # endif /* ACE_USES_ASM_SYMBOL_IN_DLSYM */ diff --git a/dep/acelite/ace/OS_NS_errno.h b/dep/acelite/ace/OS_NS_errno.h index 22e3d006d06..36c3e94b21c 100644 --- a/dep/acelite/ace/OS_NS_errno.h +++ b/dep/acelite/ace/OS_NS_errno.h @@ -4,7 +4,7 @@ /** * @file OS_NS_errno.h * - * $Id: OS_NS_errno.h 85321 2009-05-12 08:31:31Z johnnyw $ + * $Id: OS_NS_errno.h 94454 2011-09-08 17:36:56Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -84,7 +84,9 @@ private: # define ACE_ERRNO_TYPE ACE_CE_Errno # define ACE_ERRNO_GET ACE_CE_Errno::instance ()->operator int() #else -# define ACE_ERRNO_TYPE int +# if !defined (ACE_ERRNO_TYPE) +# define ACE_ERRNO_TYPE int +# endif /* !ACE_ERRNO_TYPE */ # define ACE_ERRNO_GET errno #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ diff --git a/dep/acelite/ace/OS_NS_errno.inl b/dep/acelite/ace/OS_NS_errno.inl index 3795eec54a7..3a3ec6c5403 100644 --- a/dep/acelite/ace/OS_NS_errno.inl +++ b/dep/acelite/ace/OS_NS_errno.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_errno.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: OS_NS_errno.inl 94454 2011-09-08 17:36:56Z johnnyw $ #include "ace/config-all.h" /* Need ACE_TRACE */ @@ -17,8 +17,8 @@ ACE_OS::last_error (void) // C++ socket wrapper facades. On Windows, some things that would // use errno on UNIX require ::GetLastError(), so this method tries // to shield the rest of ACE from having to know about this. - int lerror = ::GetLastError (); - int lerrno = errno; + int const lerror = ::GetLastError (); + int const lerrno = errno; return lerrno == 0 ? lerror : lerrno; #else return errno; diff --git a/dep/acelite/ace/OS_NS_math.h b/dep/acelite/ace/OS_NS_math.h index 9ba3b6632ad..210554eede6 100644 --- a/dep/acelite/ace/OS_NS_math.h +++ b/dep/acelite/ace/OS_NS_math.h @@ -4,7 +4,7 @@ /** * @file OS_NS_math.h * - * $Id: OS_NS_math.h 89470 2010-03-12 12:12:12Z olli $ + * $Id: OS_NS_math.h 95724 2012-05-03 06:43:31Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -89,18 +89,40 @@ namespace ACE_OS { /// This method computes the largest integral value not greater than x. template <typename T> + inline T floor (T x) { return ACE_STD_NAMESPACE::floor (x); } +#if defined (ACE_HAS_WINCE) + /// Windows CE has an intrinsic floor for float + template <> + inline + float floor (float x) + { + return ACE_STD_NAMESPACE::floorf (x); + } +#endif + /// This method computes the smallest integral value not less than x. template <typename T> + inline T ceil (T x) { return ACE_STD_NAMESPACE::ceil (x); } +#if defined (ACE_HAS_WINCE) + /// Windows CE has an intrinsic ceil for float + template <> + inline + float ceil (float x) + { + return ACE_STD_NAMESPACE::ceilf (x); + } +#endif + /// This method computes the base-2 logarithm of x. ACE_NAMESPACE_INLINE_FUNCTION double log2 (double x); diff --git a/dep/acelite/ace/OS_NS_math.inl b/dep/acelite/ace/OS_NS_math.inl index e66dc496e5d..76a50caa47f 100644 --- a/dep/acelite/ace/OS_NS_math.inl +++ b/dep/acelite/ace/OS_NS_math.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: OS_NS_math.inl 89470 2010-03-12 12:12:12Z olli $ +// $Id: OS_NS_math.inl 93622 2011-03-22 15:45:57Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/OS_NS_netdb.cpp b/dep/acelite/ace/OS_NS_netdb.cpp index b615df1387d..6de2b74e580 100644 --- a/dep/acelite/ace/OS_NS_netdb.cpp +++ b/dep/acelite/ace/OS_NS_netdb.cpp @@ -1,10 +1,8 @@ // -*- C++ -*- -// $Id: OS_NS_netdb.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_netdb.cpp 95533 2012-02-14 22:59:17Z wotte $ #include "ace/OS_NS_netdb.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_netdb.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ @@ -17,196 +15,6 @@ #include "ace/OS_NS_stropts.h" #include "ace/OS_NS_sys_socket.h" -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) - -struct hostent * -ACE_OS::gethostbyaddr (const char *addr, int length, int type) -{ - ACE_OS_TRACE ("ACE_OS::gethostbyaddr"); - - if (length != 4 || type != AF_INET) - { - errno = EINVAL; - return 0; - } - - // not thread safe! - static hostent ret; - static char name [MAXNAMELEN + 1]; - static char *hostaddr[2]; - static char *aliases[1]; - - if (::hostGetByAddr (*(int *) addr, name) != 0) - { - // errno will have been set to S_hostLib_UNKNOWN_HOST. - return 0; - } - - // Might not be official: just echo input arg. - hostaddr[0] = (char *) addr; - hostaddr[1] = 0; - aliases[0] = 0; - - ret.h_name = name; - ret.h_addrtype = AF_INET; - ret.h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN; - ret.h_addr_list = hostaddr; - ret.h_aliases = aliases; - - return &ret; -} - -#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */ - -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) - -struct hostent * -ACE_OS::gethostbyaddr_r (const char *addr, int length, int type, - hostent *result, ACE_HOSTENT_DATA buffer, - int *h_errnop) -{ - ACE_OS_TRACE ("ACE_OS::gethostbyaddr_r"); - if (length != 4 || type != AF_INET) - { - errno = EINVAL; - return 0; - } - - if (ACE_OS::netdb_acquire ()) - return 0; - else - { - // buffer layout: - // buffer[0-3]: h_addr_list[0], the first (and only) addr. - // buffer[4-7]: h_addr_list[1], the null terminator for the h_addr_list. - // buffer[8]: the name of the host, null terminated. - - // Call ::hostGetByAddr (), which puts the (one) hostname into - // buffer. - if (::hostGetByAddr (*(int *) addr, &buffer[8]) == 0) - { - // Store the return values in result. - result->h_name = &buffer[8]; // null-terminated host name - result->h_addrtype = AF_INET; - result->h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN. - - result->h_addr_list = (char **) buffer; - // Might not be official: just echo input arg. - result->h_addr_list[0] = (char *) addr; - // Null-terminate the list of addresses. - result->h_addr_list[1] = 0; - // And no aliases, so null-terminate h_aliases. - result->h_aliases = &result->h_addr_list[1]; - } - else - { - // errno will have been set to S_hostLib_UNKNOWN_HOST. - result = 0; - } - } - - ACE_OS::netdb_release (); - *h_errnop = errno; - return result; -} - -#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */ - -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) - -struct hostent * -ACE_OS::gethostbyname (const char *name) -{ - ACE_OS_TRACE ("ACE_OS::gethostbyname"); - - // not thread safe! - static hostent ret; - static int first_addr; - static char *hostaddr[2]; - static char *aliases[1]; - - if (0 == name || '\0' == name[0]) - return 0; - - ACE_OSCALL (::hostGetByName (const_cast <char *> (name)), int, -1, first_addr); - if (first_addr == -1) - return 0; - - hostaddr[0] = (char *) &first_addr; - hostaddr[1] = 0; - aliases[0] = 0; - - // Might not be official: just echo input arg. - ret.h_name = (char *) name; - ret.h_addrtype = AF_INET; - ret.h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN; - ret.h_addr_list = hostaddr; - ret.h_aliases = aliases; - - return &ret; -} - -#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME */ - -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) - -struct hostent * -ACE_OS::gethostbyname_r (const char *name, hostent *result, - ACE_HOSTENT_DATA buffer, - int *h_errnop) -{ - ACE_OS_TRACE ("ACE_OS::gethostbyname_r"); - - if (0 == name || '\0' == name[0]) - return 0; - - if (ACE_OS::netdb_acquire ()) - return 0; - else - { - int addr; - ACE_OSCALL (::hostGetByName (const_cast <char *> (name)), int, -1, addr); - - if (addr == -1) - { - // errno will have been set to S_hostLib_UNKNOWN_HOST - result = 0; - } - else - { - // Might not be official: just echo input arg. - result->h_name = (char *) name; - result->h_addrtype = AF_INET; - result->h_length = 4; // VxWorks 5.2/3 doesn't define IP_ADDR_LEN; - - // buffer layout: - // buffer[0-3]: h_addr_list[0], pointer to the addr. - // buffer[4-7]: h_addr_list[1], null terminator for the h_addr_list. - // buffer[8-11]: the first (and only) addr. - - // Store the address list in buffer. - result->h_addr_list = (char **) buffer; - // Store the actual address _after_ the address list. - result->h_addr_list[0] = (char *) &result->h_addr_list[2]; - result->h_addr_list[2] = (char *) addr; - // Null-terminate the list of addresses. - result->h_addr_list[1] = 0; - // And no aliases, so null-terminate h_aliases. - result->h_aliases = &result->h_addr_list[1]; - } - } - - ACE_OS::netdb_release (); - *h_errnop = errno; - return result; -} - -#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME*/ - -ACE_END_VERSIONED_NAMESPACE_DECL - // Include if_arp so that getmacaddr can use the // arp structure. #if defined (sun) @@ -356,7 +164,7 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node) return 0; -#elif defined (linux) && !defined (ACE_LACKS_NETWORKING) +#elif defined (ACE_LINUX) && !defined (ACE_LACKS_NETWORKING) struct ifreq ifr; @@ -385,7 +193,7 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node) return 0; -#elif defined (ACE_HAS_IPHONE) || defined (ACE_HAS_MAC_OSX) +#elif defined (ACE_HAS_SIOCGIFCONF) const long BUFFERSIZE = 4000; char buffer[BUFFERSIZE]; diff --git a/dep/acelite/ace/OS_NS_netdb.h b/dep/acelite/ace/OS_NS_netdb.h index 0c6bdf43556..63f2bafc7ea 100644 --- a/dep/acelite/ace/OS_NS_netdb.h +++ b/dep/acelite/ace/OS_NS_netdb.h @@ -4,7 +4,7 @@ /** * @file OS_NS_netdb.h * - * $Id: OS_NS_netdb.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: OS_NS_netdb.h 93597 2011-03-21 12:54:52Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -38,20 +38,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* ACE_VXWORKS */ struct hostent *gethostbyaddr (const char *addr, int length, int type); -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* ACE_VXWORKS */ struct hostent *gethostbyaddr_r (const char *addr, int length, int type, @@ -59,18 +51,10 @@ namespace ACE_OS ACE_HOSTENT_DATA buffer, int *h_errnop); -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* ACE_VXWORKS */ struct hostent *gethostbyname (const char *name); -#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* ACE_VXWORKS */ struct hostent *gethostbyname_r (const char *name, struct hostent *result, ACE_HOSTENT_DATA buffer, diff --git a/dep/acelite/ace/OS_NS_netdb.inl b/dep/acelite/ace/OS_NS_netdb.inl index 0888c72f934..2db9779a348 100644 --- a/dep/acelite/ace/OS_NS_netdb.inl +++ b/dep/acelite/ace/OS_NS_netdb.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_netdb.inl 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: OS_NS_netdb.inl 93597 2011-03-21 12:54:52Z johnnyw $ #include "ace/OS_NS_macros.h" #include "ace/OS_NS_string.h" @@ -42,8 +42,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)) - ACE_INLINE struct hostent * ACE_OS::gethostbyaddr (const char *addr, int length, int type) { @@ -86,10 +84,6 @@ ACE_OS::gethostbyaddr (const char *addr, int length, int type) # endif /* !ACE_LACKS_GETHOSTBYADDR */ } -#endif - -#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)) - ACE_INLINE struct hostent * ACE_OS::gethostbyaddr_r (const char *addr, int length, @@ -143,6 +137,7 @@ ACE_OS::gethostbyaddr_r (const char *addr, else return (struct hostent *) 0; # elif defined (ACE_VXWORKS) + ACE_UNUSED_ARG (h_errnop); // VxWorks 6.x has a threadsafe gethostbyaddr() which returns a heap-allocated // data structure which needs to be freed with hostentFree() //FUZZ: disable check_for_lack_ACE_OS @@ -233,10 +228,6 @@ ACE_OS::gethostbyaddr_r (const char *addr, # endif /* ACE_LACKS_GETHOSTBYADDR_R */ } -#endif - -#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)) - ACE_INLINE struct hostent * ACE_OS::gethostbyname (const char *name) { @@ -273,10 +264,6 @@ ACE_OS::gethostbyname (const char *name) # endif /* !ACE_LACKS_GETHOSTBYNAME */ } -#endif - -#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)) - ACE_INLINE struct hostent * ACE_OS::gethostbyname_r (const char *name, struct hostent *result, @@ -333,6 +320,7 @@ ACE_OS::gethostbyname_r (const char *name, else return (struct hostent *) 0; # elif defined (ACE_VXWORKS) + ACE_UNUSED_ARG (h_errnop); // VxWorks 6.x has a threadsafe gethostbyname() which returns a heap-allocated // data structure which needs to be freed with hostentFree() //FUZZ: disable check_for_lack_ACE_OS @@ -423,8 +411,6 @@ ACE_OS::gethostbyname_r (const char *name, # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) */ } -#endif - ACE_INLINE struct hostent * ACE_OS::getipnodebyaddr (const void *src, size_t len, int family) { diff --git a/dep/acelite/ace/OS_NS_pwd.h b/dep/acelite/ace/OS_NS_pwd.h index f32c247d224..ffbf7180b58 100644 --- a/dep/acelite/ace/OS_NS_pwd.h +++ b/dep/acelite/ace/OS_NS_pwd.h @@ -4,7 +4,7 @@ /** * @file OS_NS_pwd.h * - * $Id: OS_NS_pwd.h 87270 2009-10-29 21:47:47Z olli $ + * $Id: OS_NS_pwd.h 93597 2011-03-21 12:54:52Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -39,8 +39,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { - - //@{ @name A set of wrappers for password routines. ACE_NAMESPACE_INLINE_FUNCTION @@ -53,14 +51,15 @@ namespace ACE_OS struct passwd *getpwnam (const char *user); ACE_NAMESPACE_INLINE_FUNCTION - struct passwd *getpwnam_r (const char *name, - struct passwd *pwent, - char *buffer, - int buflen); + int getpwnam_r (const char *name, + struct passwd *pwd, + char *buffer, + size_t bufsize, + struct passwd **result); + ACE_NAMESPACE_INLINE_FUNCTION void setpwent (void); //@} - } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/OS_NS_pwd.inl b/dep/acelite/ace/OS_NS_pwd.inl index 6fcb076fd8b..396ea0af064 100644 --- a/dep/acelite/ace/OS_NS_pwd.inl +++ b/dep/acelite/ace/OS_NS_pwd.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_pwd.inl 91781 2010-09-15 12:49:15Z johnnyw $ +// $Id: OS_NS_pwd.inl 93563 2011-03-16 14:33:48Z olli $ #include "ace/OS_NS_errno.h" @@ -37,71 +37,31 @@ ACE_OS::getpwnam (const char *name) #endif /* ACE_LACKS_PWD_FUNCTIONS */ } -ACE_INLINE struct passwd * -ACE_OS::getpwnam_r (const char *name, struct passwd *pwent, - char *buffer, int buflen) +ACE_INLINE int +ACE_OS::getpwnam_r (const char *name, + struct passwd *pwd, + char *buffer, + size_t bufsize, + struct passwd **result) { -#if defined (ACE_HAS_POSIX_GETPWNAM_R) - struct passwd *result = 0; - - int const status = ::getpwnam_r (name, pwent, buffer, buflen, &result); - - if (status != 0) - { - errno = status; - result = 0; - } - return result; -#elif !defined (ACE_LACKS_PWD_FUNCTIONS) -# if defined (ACE_HAS_REENTRANT_FUNCTIONS) -# if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS) -# if defined (ACE_HAS_PTHREADS) && \ - !defined (ACE_HAS_STHREADS) || \ - defined (HPUX_11) - struct passwd *result = 0; - int status; - // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined - // in pwd.h, and that redefinition is used here -# if defined (__IBMCPP__) && (__IBMCPP__ >= 400) /* VAC++ 4 */ - status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result); -# else - status = ::getpwnam_r (name, pwent, buffer, buflen, &result); -# endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */ - if (status != 0) - { - errno = status; - result = 0; - } - return result; -# elif defined (AIX) - if (::getpwnam_r (name, pwent, buffer, buflen) == -1) - return 0; - else - return pwent; -# else - return ::getpwnam_r (name, pwent, buffer, buflen); -# endif /* ACE_HAS_PTHREADS */ -# else +#if defined (ACE_LACKS_PWD_FUNCTIONS) ACE_UNUSED_ARG (name); - ACE_UNUSED_ARG (pwent); + ACE_UNUSED_ARG (pwd); ACE_UNUSED_ARG (buffer); - ACE_UNUSED_ARG (buflen); + ACE_UNUSED_ARG (bufsize); + ACE_UNUSED_ARG (result); ACE_NOTSUP_RETURN (0); -# endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */ -# else - ACE_UNUSED_ARG (name); - ACE_UNUSED_ARG (pwent); - ACE_UNUSED_ARG (buffer); - ACE_UNUSED_ARG (buflen); - ACE_NOTSUP_RETURN (0); -# endif /* ACE_HAS_REENTRANT_FUNCTIONS */ +#elif defined (ACE_HAS_LYNXOS4_GETPWNAM_R) + if (::getpwnam_r (pwd, const_cast<char*>(name), buffer, bufsize) == -1) + { + *result = 0; + return -1; + } + *result = pwd; + return 0; #else - ACE_UNUSED_ARG (name); - ACE_UNUSED_ARG (pwent); - ACE_UNUSED_ARG (buffer); - ACE_UNUSED_ARG (buflen); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_HAS_POSIX_GETPWNAM_R */ + return ::getpwnam_r (name, pwd, buffer, bufsize, result); +#endif /* ACE_LACKS_PWD_FUNCTIONS */ } ACE_INLINE void diff --git a/dep/acelite/ace/OS_NS_signal.h b/dep/acelite/ace/OS_NS_signal.h index 8dc02c10ab2..123011f1eaf 100644 --- a/dep/acelite/ace/OS_NS_signal.h +++ b/dep/acelite/ace/OS_NS_signal.h @@ -4,7 +4,7 @@ /** * @file OS_NS_signal.h * - * $Id: OS_NS_signal.h 87097 2009-10-14 14:42:24Z olli $ + * $Id: OS_NS_signal.h 93481 2011-03-04 14:59:09Z olli $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -33,10 +33,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -#if defined (__Lynx__) -// LynxOS defines pthread_sigmask() in pthread.h +#if defined (__Lynx__) || defined (__OpenBSD__) +// LynxOS and OpenBSD define pthread_sigmask() in pthread.h # include "ace/os_include/os_pthread.h" -#endif /* __Lynx__ */ +#endif /* __Lynx__ || OpenBSD */ /* * We inline and undef some functions that may be implemented diff --git a/dep/acelite/ace/OS_NS_signal.inl b/dep/acelite/ace/OS_NS_signal.inl index d6f6494e118..43046245f3b 100644 --- a/dep/acelite/ace/OS_NS_signal.inl +++ b/dep/acelite/ace/OS_NS_signal.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: OS_NS_signal.inl 87480 2009-11-11 11:38:15Z olli $ +// $Id: OS_NS_signal.inl 93651 2011-03-28 08:49:11Z johnnyw $ #include "ace/OS_NS_macros.h" #include "ace/OS_NS_errno.h" diff --git a/dep/acelite/ace/OS_NS_stdio.h b/dep/acelite/ace/OS_NS_stdio.h index bf120229c28..bbb30ca82e8 100644 --- a/dep/acelite/ace/OS_NS_stdio.h +++ b/dep/acelite/ace/OS_NS_stdio.h @@ -4,7 +4,7 @@ /** * @file OS_NS_stdio.h * - * $Id: OS_NS_stdio.h 92178 2010-10-08 07:44:20Z olli $ + * $Id: OS_NS_stdio.h 93500 2011-03-07 16:19:27Z vzykov $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -220,7 +220,8 @@ namespace ACE_OS { //@} extern ACE_Export - int asprintf (char **bufp, const char* format, ...); + int asprintf (char **bufp, const char* format, ...) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 3); # if defined (ACE_HAS_WCHAR) extern ACE_Export @@ -371,7 +372,8 @@ namespace ACE_OS { #endif /* ACE_WIN32 */ extern ACE_Export - int fprintf (FILE *fp, const char *format, ...); + int fprintf (FILE *fp, const char *format, ...) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 3); # if defined (ACE_HAS_WCHAR) extern ACE_Export @@ -437,7 +439,8 @@ namespace ACE_OS { #endif /* ACE_HAS_WCHAR */ extern ACE_Export - int printf (const char *format, ...); + int printf (const char *format, ...) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 1, 2); #if defined (ACE_HAS_WCHAR) extern ACE_Export @@ -468,7 +471,8 @@ namespace ACE_OS { void rewind (FILE *fp); extern ACE_Export - int snprintf (char *buf, size_t maxlen, const char *format, ...); + int snprintf (char *buf, size_t maxlen, const char *format, ...) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 3, 4); # if defined (ACE_HAS_WCHAR) extern ACE_Export @@ -476,7 +480,8 @@ namespace ACE_OS { # endif /* ACE_HAS_WCHAR */ extern ACE_Export - int sprintf (char *buf, const char *format, ...); + int sprintf (char *buf, const char *format, ...) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 3); # if defined (ACE_HAS_WCHAR) extern ACE_Export @@ -494,19 +499,24 @@ namespace ACE_OS { #endif /* ACE_HAS_WCHAR */ ACE_NAMESPACE_INLINE_FUNCTION - int vasprintf (char **bufp, const char *format, va_list argptr); + int vasprintf (char **bufp, const char *format, va_list argptr) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 0); ACE_NAMESPACE_INLINE_FUNCTION - int vprintf (const char *format, va_list argptr); + int vprintf (const char *format, va_list argptr) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 1, 0); ACE_NAMESPACE_INLINE_FUNCTION - int vfprintf (FILE *fp, const char *format, va_list argptr); + int vfprintf (FILE *fp, const char *format, va_list argptr) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 0); ACE_NAMESPACE_INLINE_FUNCTION - int vsprintf (char *buffer, const char *format, va_list argptr); + int vsprintf (char *buffer, const char *format, va_list argptr) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 2, 0); ACE_NAMESPACE_INLINE_FUNCTION - int vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr); + int vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr) + ACE_GCC_FORMAT_ATTRIBUTE (printf, 3, 0); # if defined (ACE_HAS_WCHAR) ACE_NAMESPACE_INLINE_FUNCTION diff --git a/dep/acelite/ace/OS_NS_stdlib.cpp b/dep/acelite/ace/OS_NS_stdlib.cpp index 92430d0c84d..c9ce0fe66ea 100644 --- a/dep/acelite/ace/OS_NS_stdlib.cpp +++ b/dep/acelite/ace/OS_NS_stdlib.cpp @@ -1,4 +1,4 @@ -// $Id: OS_NS_stdlib.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_stdlib.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/OS_NS_stdlib.h" @@ -259,13 +259,13 @@ ACE_OS::itow_emulation (int value, wchar_t *string, int radix) // Now reverse the string to get the correct result while (e > b) - { - wchar_t temp = *e; - *e = *b; - *b = temp; - ++b; - --e; - } + { + wchar_t temp = *e; + *e = *b; + *b = temp; + ++b; + --e; + } return string; } @@ -842,7 +842,7 @@ ACE_OS::strtoll_emulation (const char *nptr, break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -910,7 +910,7 @@ ACE_OS::wcstoll_emulation (const wchar_t *nptr, break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; @@ -978,7 +978,7 @@ ACE_OS::strtoull_emulation (const char *nptr, break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { @@ -1048,7 +1048,7 @@ ACE_OS::wcstoull_emulation (const wchar_t *nptr, break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { @@ -1108,7 +1108,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s) // ACE_thread_t may be a char* (returned by ACE_OS::thr_self()) so // we need to use a C-style cast as a catch-all in order to use a // static_cast<> to an integral type. - ACE_RANDR_TYPE seed = static_cast<ACE_RANDR_TYPE> (msec); + unsigned int seed = static_cast<unsigned int> (msec); // We only care about UTF-8 / ASCII characters in generated // filenames. A UTF-16 or UTF-32 character could potentially cause @@ -1148,7 +1148,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s) // selection to work for EBCDIC, as well. do { - r = static_cast<ACE_TCHAR> (coefficient * ACE_OS::rand_r (seed)); + r = static_cast<ACE_TCHAR> (coefficient * ACE_OS::rand_r (&seed)); } while (!ACE_OS::ace_isalnum (r)); diff --git a/dep/acelite/ace/OS_NS_stdlib.h b/dep/acelite/ace/OS_NS_stdlib.h index 28e11a96be5..4a35fe9d8e0 100644 --- a/dep/acelite/ace/OS_NS_stdlib.h +++ b/dep/acelite/ace/OS_NS_stdlib.h @@ -4,7 +4,7 @@ /** * @file OS_NS_stdlib.h * - * $Id: OS_NS_stdlib.h 88493 2010-01-12 19:17:42Z olli $ + * $Id: OS_NS_stdlib.h 93571 2011-03-17 07:37:11Z olli $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -272,7 +272,7 @@ namespace ACE_OS { int rand (void); ACE_NAMESPACE_INLINE_FUNCTION - int rand_r (ACE_RANDR_TYPE &seed); + int rand_r (unsigned int *seed); extern ACE_Export void *realloc (void *, size_t); diff --git a/dep/acelite/ace/OS_NS_stdlib.inl b/dep/acelite/ace/OS_NS_stdlib.inl index 97d04e8d855..65e005f9bb7 100644 --- a/dep/acelite/ace/OS_NS_stdlib.inl +++ b/dep/acelite/ace/OS_NS_stdlib.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_stdlib.inl 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: OS_NS_stdlib.inl 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/config-all.h" /* Need ACE_TRACE */ #include "ace/Object_Manager_Base.h" @@ -35,12 +35,11 @@ ACE_OS::_exit (int status) ACE_INLINE void ACE_OS::abort (void) { -#if !defined (ACE_HAS_WINCE) +#if !defined (ACE_LACKS_ABORT) ::abort (); #else - // @@ CE doesn't support abort? exit (1); -#endif /* !ACE_HAS_WINCE */ +#endif /* !ACE_LACKS_ABORT */ } ACE_INLINE int @@ -403,45 +402,25 @@ ACE_OS::rand (void) ACE_OSCALL_RETURN (::rand (), int, -1); } -#if !defined (ACE_WIN32) - -ACE_INLINE int -ACE_OS::rand_r (ACE_RANDR_TYPE &seed) -{ - ACE_OS_TRACE ("ACE_OS::rand_r"); -# if defined (ACE_HAS_REENTRANT_FUNCTIONS) && \ - !defined (ACE_LACKS_RAND_REENTRANT_FUNCTIONS) -# if defined (ACE_HAS_BROKEN_RANDR) - ACE_OSCALL_RETURN (::rand_r (seed), int, -1); -# else - ACE_OSCALL_RETURN (::rand_r (&seed), int, -1); -# endif /* ACE_HAS_BROKEN_RANDR */ -# else - ACE_UNUSED_ARG (seed); - ACE_OSCALL_RETURN (::rand (), int, -1); -# endif /* ACE_HAS_REENTRANT_FUNCTIONS */ -} - -#else /* ACE_WIN32 */ - ACE_INLINE int -ACE_OS::rand_r (ACE_RANDR_TYPE& seed) +ACE_OS::rand_r (unsigned int *seed) { ACE_OS_TRACE ("ACE_OS::rand_r"); - - long new_seed = (long) (seed); +#if defined (ACE_LACKS_RAND_R) + long new_seed = (long) *seed; if (new_seed == 0) new_seed = 0x12345987; long temp = new_seed / 127773; new_seed = 16807 * (new_seed - temp * 127773) - 2836 * temp; if (new_seed < 0) new_seed += 2147483647; - (seed) = (unsigned int)new_seed; + *seed = (unsigned int)new_seed; return (int) (new_seed & RAND_MAX); +#else + return ::rand_r (seed); +# endif /* ACE_LACKS_RAND_R */ } -#endif /* !ACE_WIN32 */ - # if !defined (ACE_LACKS_REALPATH) ACE_INLINE char * ACE_OS::realpath (const char *file_name, @@ -612,8 +591,6 @@ ACE_OS::system (const ACE_TCHAR *s) ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR) ACE_OSCALL_RETURN (::_wsystem (s), int, -1); -#elif defined (ACE_TANDEM_T1248_PTHREADS) - ACE_OSCALL_RETURN (::spt_system (s), int, -1); #else ACE_OSCALL_RETURN (::system (ACE_TEXT_ALWAYS_CHAR (s)), int, -1); #endif /* ACE_LACKS_SYSTEM */ diff --git a/dep/acelite/ace/OS_NS_string.cpp b/dep/acelite/ace/OS_NS_string.cpp index 93e112d60c8..067bb1c66a3 100644 --- a/dep/acelite/ace/OS_NS_string.cpp +++ b/dep/acelite/ace/OS_NS_string.cpp @@ -1,4 +1,4 @@ -// $Id: OS_NS_string.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: OS_NS_string.cpp 93549 2011-03-15 19:50:24Z olli $ #include "ace/ACE.h" #include "ace/OS_NS_string.h" @@ -368,8 +368,7 @@ ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen) return dst; } -#if (!defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R)) \ - && !defined (ACE_HAS_TR24731_2005_CRT) +#if defined (ACE_LACKS_STRTOK_R) char * ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts) { @@ -390,7 +389,7 @@ ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts) *lasts = s + l_sub; return s ; } -#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ +#endif /* ACE_LACKS_STRTOK_R */ # if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOK) wchar_t* diff --git a/dep/acelite/ace/OS_NS_string.h b/dep/acelite/ace/OS_NS_string.h index 54da02a8ba8..d881d7f738f 100644 --- a/dep/acelite/ace/OS_NS_string.h +++ b/dep/acelite/ace/OS_NS_string.h @@ -4,7 +4,7 @@ /** * @file OS_NS_string.h * - * $Id: OS_NS_string.h 91995 2010-09-24 12:45:24Z johnnyw $ + * $Id: OS_NS_string.h 93549 2011-03-15 19:50:24Z olli $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -449,11 +449,11 @@ namespace ACE_OS { wchar_t *strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts); #endif // ACE_HAS_WCHAR -#if !defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R) +#if defined (ACE_LACKS_STRTOK_R) /// Emulated strtok_r. extern ACE_Export char *strtok_r_emulation (char *s, const char *tokens, char **lasts); -#endif /* !ACE_HAS_REENTRANT_FUNCTIONS */ +#endif /* ACE_LACKS_STRTOK_R */ # if defined (ACE_HAS_WCHAR) && defined(ACE_LACKS_WCSTOK) /// Emulated strtok_r (wchar_t version). diff --git a/dep/acelite/ace/OS_NS_string.inl b/dep/acelite/ace/OS_NS_string.inl index 52ade6993fa..e12a6d22524 100644 --- a/dep/acelite/ace/OS_NS_string.inl +++ b/dep/acelite/ace/OS_NS_string.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_string.inl 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: OS_NS_string.inl 93549 2011-03-15 19:50:24Z olli $ // OS_NS_wchar.h is only needed to get the emulation methods. // Perhaps they should be moved. dhinton @@ -526,11 +526,11 @@ ACE_OS::strtok_r (char *s, const char *tokens, char **lasts) { #if defined (ACE_HAS_TR24731_2005_CRT) return strtok_s (s, tokens, lasts); -#elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (ACE_LACKS_STRTOK_R) - return ::strtok_r (s, tokens, lasts); -#else +#elif defined (ACE_LACKS_STRTOK_R) return ACE_OS::strtok_r_emulation (s, tokens, lasts); -#endif /* (ACE_HAS_REENTRANT_FUNCTIONS) */ +#else + return ::strtok_r (s, tokens, lasts); +#endif /* ACE_HAS_TR24731_2005_CRT */ } #if defined (ACE_HAS_WCHAR) diff --git a/dep/acelite/ace/OS_NS_sys_mman.cpp b/dep/acelite/ace/OS_NS_sys_mman.cpp index 340511eb020..8f80280e983 100644 --- a/dep/acelite/ace/OS_NS_sys_mman.cpp +++ b/dep/acelite/ace/OS_NS_sys_mman.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_sys_mman.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_mman.cpp 92837 2010-12-08 17:31:02Z johnnyw $ #include "ace/OS_NS_sys_mman.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_sys_mman.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ diff --git a/dep/acelite/ace/OS_NS_sys_mman.inl b/dep/acelite/ace/OS_NS_sys_mman.inl index fb8a9a0b657..2e9460b5036 100644 --- a/dep/acelite/ace/OS_NS_sys_mman.inl +++ b/dep/acelite/ace/OS_NS_sys_mman.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_sys_mman.inl 85429 2009-05-25 09:53:48Z johnnyw $ +// $Id: OS_NS_sys_mman.inl 92464 2010-11-01 14:58:30Z mitza $ #include "ace/OS_NS_fcntl.h" #include "ace/OS_NS_unistd.h" @@ -102,11 +102,18 @@ ACE_OS::mmap (void *addr, &sa_buffer, &sd_buffer); +# ifdef ACE_WIN64 + const DWORD len_low = static_cast<DWORD>(len), + len_high = static_cast<DWORD>(len >> 32); +# else + const DWORD len_low = len, len_high = 0; +# endif + *file_mapping = ACE_TEXT_CreateFileMapping (file_handle, attr, prot, - 0, - (file_handle == ACE_INVALID_HANDLE) ? len : 0, + (file_handle == ACE_INVALID_HANDLE) ? len_high : 0, + (file_handle == ACE_INVALID_HANDLE) ? len_low : 0, file_mapping_name); } diff --git a/dep/acelite/ace/OS_NS_sys_msg.cpp b/dep/acelite/ace/OS_NS_sys_msg.cpp index d59e47e7c00..789c32a4731 100644 --- a/dep/acelite/ace/OS_NS_sys_msg.cpp +++ b/dep/acelite/ace/OS_NS_sys_msg.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_sys_msg.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_msg.cpp 92837 2010-12-08 17:31:02Z johnnyw $ #include "ace/OS_NS_sys_msg.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_sys_msg.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ diff --git a/dep/acelite/ace/OS_NS_sys_select.inl b/dep/acelite/ace/OS_NS_sys_select.inl index e58c6166ed5..ef1d4bed72e 100644 --- a/dep/acelite/ace/OS_NS_sys_select.inl +++ b/dep/acelite/ace/OS_NS_sys_select.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_sys_select.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: OS_NS_sys_select.inl 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" @@ -38,9 +38,6 @@ ACE_OS::select (int width, ACE_UNUSED_ARG (efds); ACE_UNUSED_ARG (timeout); ACE_NOTSUP_RETURN (-1); -#elif defined(ACE_TANDEM_T1248_PTHREADS) - ACE_SOCKCALL_RETURN (::spt_select (width, rfds, wfds, efds, timep), - int, -1); #else ACE_SOCKCALL_RETURN (::select (width, rfds, wfds, efds, timep), int, -1); @@ -67,9 +64,6 @@ ACE_OS::select (int width, ACE_UNUSED_ARG (efds); ACE_UNUSED_ARG (timeout); ACE_NOTSUP_RETURN (-1); -#elif defined(ACE_TANDEM_T1248_PTHREADS) - ACE_SOCKCALL_RETURN (::spt_select (width, rfds, wfds, efds, ___ACE_TIMEOUT), - int, -1); #else ACE_SOCKCALL_RETURN (::select (width, rfds, wfds, efds, ___ACE_TIMEOUT), int, -1); diff --git a/dep/acelite/ace/OS_NS_sys_shm.h b/dep/acelite/ace/OS_NS_sys_shm.h index 9f34b482bc9..5edb851171a 100644 --- a/dep/acelite/ace/OS_NS_sys_shm.h +++ b/dep/acelite/ace/OS_NS_sys_shm.h @@ -4,7 +4,7 @@ /** * @file OS_NS_sys_shm.h * - * $Id: OS_NS_sys_shm.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: OS_NS_sys_shm.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -37,7 +37,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { - //@{ @name A set of wrappers for System V shared memory. ACE_NAMESPACE_INLINE_FUNCTION void *shmat (int int_id, @@ -56,8 +55,7 @@ namespace ACE_OS int shmget (key_t key, size_t size, int flags); - ///@} - + //@} } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/OS_NS_sys_socket.cpp b/dep/acelite/ace/OS_NS_sys_socket.cpp index 3ce26a82490..8e64d6635ca 100644 --- a/dep/acelite/ace/OS_NS_sys_socket.cpp +++ b/dep/acelite/ace/OS_NS_sys_socket.cpp @@ -1,4 +1,4 @@ -// $Id: OS_NS_sys_socket.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_socket.cpp 93822 2011-04-08 21:56:45Z mesnier_p $ #include "ace/OS_NS_sys_socket.h" @@ -8,6 +8,8 @@ # include "ace/OS_NS_sys_socket.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ +#include "ace/Containers_T.h" + ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_WIN32) @@ -156,4 +158,123 @@ ACE_OS::socket_fini (void) return 0; } +ssize_t +ACE_OS::sendv_partial_i (ACE_HANDLE handle, + const iovec *buffers, + int n) +{ + // the divide and conquer logic should remain consistent + // with send_partial_i +#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) + DWORD bytes_sent = 0; + int result = 1; + int simulated_n = n; + ACE_UINT64 buffer_size = 0; + ACE_Array<iovec> iovec_array(simulated_n); + int i = 0; + for ( ; i < simulated_n; ++i) + { + iovec_array[i].iov_base = buffers[i].iov_base; + iovec_array[i].iov_len = buffers[i].iov_len; + buffer_size += buffers[i].iov_len; + } + // keep dividing the current buffer_size in half and then + // attempt to send the modified iovec buffer until some + // data is sent, or we get an errno that is not ENOBUFS + while (true) + { + ACE_UINT64 remove_size = buffer_size / 2; + buffer_size -= remove_size; + for (i = simulated_n - 1; (i >= 0) && (remove_size > 0); --i) + { + // if the buffer division splits an iovec, we need + // to set its iov_len properly + if (iovec_array[i].iov_len > remove_size) + { + iovec_array[i].iov_len -= static_cast<u_long>(remove_size); + break; + } + remove_size -= iovec_array[i].iov_len; + } + + simulated_n = i + 1; + + result = ::WSASend ((SOCKET) handle, + (WSABUF *) &(iovec_array[0]), + simulated_n, + &bytes_sent, + 0, + 0, + 0); + if (result != SOCKET_ERROR) + break; + + ACE_OS::set_errno_to_wsa_last_error (); + // if ENOBUFS is received, we apply a divide and + // conquer strategy, but if bytes are sent we + // cannot guarantee this is the same behavior + if ((errno != ENOBUFS) || + (bytes_sent != 0)) + { + return -1; + } + } + + return (ssize_t) bytes_sent; +# else + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (buffers); + ACE_UNUSED_ARG (n); + + return -1; +# endif /* ACE_HAS_WINSOCK2 */ +} + +ssize_t +ACE_OS::send_partial_i (ACE_HANDLE handle, + const char *buf, + size_t len, + int flags) +{ + // the divide and conquer logic should remain consistent + // with sendv_partial_i +#if !defined (ACE_LACKS_SEND) && defined (ACE_WIN32) + DWORD bytes_sent = 0; + ssize_t result = 1; + // keep dividing the current buffer_size in half and then + // attempt to send the modified buffer until some data is + // sent, or we get an errno that is not ENOBUFS + while (true) + { + len -= len / 2; + + result = (ssize_t) ::send ((SOCKET) handle, + buf, + static_cast<int> (len), + flags); + if (result != SOCKET_ERROR) + break; + + ACE_OS::set_errno_to_wsa_last_error (); + // if ENOBUFS is received, we apply a divide and + // conquer strategy, but if bytes are sent we + // cannot guarantee this is the same behavior + if ((errno != ENOBUFS) || + (bytes_sent != 0)) + { + return -1; + } + } + + return result; +# else + ACE_UNUSED_ARG (handle); + ACE_UNUSED_ARG (buf); + ACE_UNUSED_ARG (len); + ACE_UNUSED_ARG (flags); + + return -1; +# endif /* ACE_LACKS_SEND && ACE_WIN32 */ +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/OS_NS_sys_socket.h b/dep/acelite/ace/OS_NS_sys_socket.h index fc5d8901cfe..860de8dfb92 100644 --- a/dep/acelite/ace/OS_NS_sys_socket.h +++ b/dep/acelite/ace/OS_NS_sys_socket.h @@ -4,7 +4,7 @@ /** * @file OS_NS_sys_socket.h * - * $Id: OS_NS_sys_socket.h 85110 2009-04-20 09:18:43Z msmit $ + * $Id: OS_NS_sys_socket.h 95533 2012-02-14 22:59:17Z wotte $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -192,6 +192,14 @@ namespace ACE_OS size_t len, int flags = 0); + /// internal function used by send when an ENOBUFS condition + /// requires a buffer to do a partial send + extern ACE_Export + ssize_t send_partial_i (ACE_HANDLE handle, + const char *buf, + size_t len, + int flags); + ACE_NAMESPACE_INLINE_FUNCTION ssize_t sendmsg (ACE_HANDLE handle, const struct msghdr *msg, @@ -221,6 +229,12 @@ namespace ACE_OS const iovec *iov, int iovcnt); + /// internal function used by sendv when an ENOBUFS condition + /// requires a buffer to do a partial send + extern ACE_Export + ssize_t sendv_partial_i (ACE_HANDLE handle, + const iovec *iov, + int iovcnt); /// Manipulate the options associated with a socket. ACE_NAMESPACE_INLINE_FUNCTION @@ -234,7 +248,7 @@ namespace ACE_OS int shutdown (ACE_HANDLE handle, int how); -#if defined (__linux__) && defined (ACE_HAS_IPV6) +#if defined (ACE_LINUX) && defined (ACE_HAS_IPV6) ACE_NAMESPACE_INLINE_FUNCTION unsigned int if_nametoindex (const char *ifname); @@ -246,7 +260,7 @@ namespace ACE_OS ACE_NAMESPACE_INLINE_FUNCTION void if_freenameindex (struct if_nameindex *ptr); -#endif /* __linux__ && ACE_HAS_IPV6 */ +#endif /* ACE_LINUX && ACE_HAS_IPV6 */ /// Initialize WinSock before first use (e.g., when a DLL is first /// loaded or the first use of a socket() call. diff --git a/dep/acelite/ace/OS_NS_sys_socket.inl b/dep/acelite/ace/OS_NS_sys_socket.inl index f55ead2c3d7..c4ca358207c 100644 --- a/dep/acelite/ace/OS_NS_sys_socket.inl +++ b/dep/acelite/ace/OS_NS_sys_socket.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_sys_socket.inl 91626 2010-09-07 10:59:20Z johnnyw $ +// $Id: OS_NS_sys_socket.inl 95533 2012-02-14 22:59:17Z wotte $ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" @@ -572,10 +572,21 @@ ACE_OS::send (ACE_HANDLE handle, const char *buf, size_t len, int flags) ACE_UNUSED_ARG (flags); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) - ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle, - buf, - static_cast<int> (len), - flags), ssize_t, -1); + ssize_t result = ::send ((ACE_SOCKET) handle, + buf, + static_cast<int> (len), + flags); + if (result == -1) + { + ACE_OS::set_errno_to_wsa_last_error(); + if (errno != ENOBUFS) + return -1; + + ACE_SOCKCALL_RETURN(send_partial_i(handle, buf, len, flags), ssize_t, -1); + } + else + return result; + #else ssize_t const ace_result_ = ::send ((ACE_SOCKET) handle, buf, len, flags); @@ -761,7 +772,18 @@ ACE_OS::sendv (ACE_HANDLE handle, if (result == SOCKET_ERROR) { ACE_OS::set_errno_to_wsa_last_error (); - return -1; + if ((errno != ENOBUFS) || + (bytes_sent != 0)) + { + return -1; + } + result = sendv_partial_i(handle, buffers, n); + if (result == SOCKET_ERROR) + { + ACE_OS::set_errno_to_wsa_last_error (); + return -1; + } + bytes_sent = static_cast<DWORD>(result); } # else for (int i = 0; i < n; ++i) @@ -965,7 +987,7 @@ ACE_OS::socketpair (int domain, int type, #endif /* ACE_LACKS_SOCKETPAIR */ } -#if defined (__linux__) && defined (ACE_HAS_IPV6) +#if defined (ACE_LINUX) && defined (ACE_HAS_IPV6) ACE_INLINE unsigned int ACE_OS::if_nametoindex (const char *ifname) { @@ -994,6 +1016,6 @@ ACE_OS::if_freenameindex (struct if_nameindex *ptr) if (ptr != 0) ::if_freenameindex (ptr); } -#endif /* __linux__ && ACE_HAS_IPV6 */ +#endif /* ACE_LINUX && ACE_HAS_IPV6 */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/OS_NS_sys_time.cpp b/dep/acelite/ace/OS_NS_sys_time.cpp index d47c4ba1d23..39a5858829b 100644 --- a/dep/acelite/ace/OS_NS_sys_time.cpp +++ b/dep/acelite/ace/OS_NS_sys_time.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_sys_time.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_time.cpp 95719 2012-05-01 12:54:01Z johnnyw $ #include "ace/OS_NS_sys_time.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_sys_time.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ diff --git a/dep/acelite/ace/OS_NS_sys_utsname.cpp b/dep/acelite/ace/OS_NS_sys_utsname.cpp index b6dc6d31c05..f9efec38df5 100644 --- a/dep/acelite/ace/OS_NS_sys_utsname.cpp +++ b/dep/acelite/ace/OS_NS_sys_utsname.cpp @@ -1,9 +1,6 @@ -// $Id: OS_NS_sys_utsname.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_utsname.cpp 93543 2011-03-14 08:25:46Z johnnyw $ #include "ace/OS_NS_sys_utsname.h" - - - #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" @@ -81,11 +78,7 @@ ACE_OS::uname (ACE_utsname *name) char processor[bufsize] = "Unknown"; char subtype[bufsize] = "Unknown"; -# if defined (ghs) - WORD arch = sinfo.u.s.wProcessorArchitecture; -# else WORD arch = sinfo.wProcessorArchitecture; -# endif switch (arch) { diff --git a/dep/acelite/ace/OS_NS_sys_wait.cpp b/dep/acelite/ace/OS_NS_sys_wait.cpp index 148d778e40b..fbb2608b321 100644 --- a/dep/acelite/ace/OS_NS_sys_wait.cpp +++ b/dep/acelite/ace/OS_NS_sys_wait.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_sys_wait.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_sys_wait.cpp 92712 2010-11-25 12:22:13Z johnnyw $ #include "ace/OS_NS_sys_wait.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_sys_wait.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ diff --git a/dep/acelite/ace/OS_NS_sys_wait.inl b/dep/acelite/ace/OS_NS_sys_wait.inl index 02333b409a1..7ae954e0e85 100644 --- a/dep/acelite/ace/OS_NS_sys_wait.inl +++ b/dep/acelite/ace/OS_NS_sys_wait.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_sys_wait.inl 91781 2010-09-15 12:49:15Z johnnyw $ +// $Id: OS_NS_sys_wait.inl 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/OS_NS_errno.h" #include "ace/Global_Macros.h" @@ -76,10 +76,6 @@ ACE_OS::waitpid (pid_t pid, if (handle == 0) ::CloseHandle (phandle); return result; -#elif defined(ACE_TANDEM_T1248_PTHREADS) - ACE_UNUSED_ARG (handle); - ACE_OSCALL_RETURN (::spt_waitpid (pid, status, wait_options), - pid_t, -1); #else ACE_UNUSED_ARG (handle); ACE_OSCALL_RETURN (::waitpid (pid, status, wait_options), diff --git a/dep/acelite/ace/OS_NS_time.cpp b/dep/acelite/ace/OS_NS_time.cpp index 2e7aedf23b1..836e257675f 100644 --- a/dep/acelite/ace/OS_NS_time.cpp +++ b/dep/acelite/ace/OS_NS_time.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_time.cpp 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: OS_NS_time.cpp 93561 2011-03-16 14:02:24Z olli $ #include "ace/OS_NS_time.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_time.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ @@ -225,24 +223,9 @@ struct tm * ACE_OS::localtime_r (const time_t *t, struct tm *res) { ACE_OS_TRACE ("ACE_OS::localtime_r"); -#if defined (ACE_HAS_REENTRANT_FUNCTIONS) - ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0); -#elif defined (ACE_HAS_TR24731_2005_CRT) +#if defined (ACE_HAS_TR24731_2005_CRT) ACE_SECURECRTCALL (localtime_s (res, t), struct tm *, 0, res); return res; -#elif !defined (ACE_HAS_WINCE) - ACE_OS_GUARD - - ACE_UNUSED_ARG (res); - struct tm * res_ptr = 0; - ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr); - if (res_ptr == 0) - return 0; - else - { - *res = *res_ptr; - return res; - } #elif defined (ACE_HAS_WINCE) // This is really stupid, converting FILETIME to timeval back and // forth. It assumes FILETIME and DWORDLONG are the same structure @@ -292,13 +275,22 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) res->tm_year = res->tm_year - 1900; return res; -#else - // @@ Same as ACE_OS::localtime (), you need to implement it - // yourself. - ACE_UNUSED_ARG (t); +#elif defined (ACE_LACKS_LOCALTIME_R) + ACE_OS_GUARD + ACE_UNUSED_ARG (res); - ACE_NOTSUP_RETURN (0); -#endif /* ACE_HAS_REENTRANT_FUNCTIONS */ + struct tm * res_ptr = 0; + ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr); + if (res_ptr == 0) + return 0; + else + { + *res = *res_ptr; + return res; + } +#else + ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0); +#endif /* ACE_HAS_TR24731_2005_CRT */ } time_t @@ -329,28 +321,6 @@ ACE_OS::mktime (struct tm *t) # endif /* ACE_HAS_WINCE */ } -#if defined (ACE_HAS_POWERPC_TIMER) && defined (ghs) -void -ACE_OS::readPPCTimeBase (u_long &most, u_long &least) -{ - ACE_OS_TRACE ("ACE_OS::readPPCTimeBase"); - - // This function can't be inline because it depends on the arguments - // being in particular registers (r3 and r4), in conformance with the - // EABI standard. It would be nice if we knew how to put the variable - // names directly into the assembler instructions . . . - asm("aclock:"); - asm("mftb r5,TBU"); - asm("mftb r6,TBL"); - asm("mftb r7,TBU"); - asm("cmpw r5,r7"); - asm("bne aclock"); - - asm("stw r5, 0(r3)"); - asm("stw r6, 0(r4)"); -} -#endif /* ACE_HAS_POWERPC_TIMER && ghs */ - #if defined (ACE_LACKS_STRPTIME) char * ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm) diff --git a/dep/acelite/ace/OS_NS_time.h b/dep/acelite/ace/OS_NS_time.h index dc22f0a0cbd..078dd9a6948 100644 --- a/dep/acelite/ace/OS_NS_time.h +++ b/dep/acelite/ace/OS_NS_time.h @@ -4,7 +4,7 @@ /** * @file OS_NS_time.h * - * $Id: OS_NS_time.h 87260 2009-10-29 14:00:43Z olli $ + * $Id: OS_NS_time.h 95763 2012-05-16 06:43:51Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -94,11 +94,11 @@ inline long ace_timezone() #if !defined (ACE_LACKS_DIFFTIME) -# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) \ +# if defined (_WIN32_WCE) && ((_WIN32_WCE >= 0x600) && (_WIN32_WCE <= 0x700)) && !defined (_USE_32BIT_TIME_T) \ && defined (_MSC_VER) - // The WinCE 6.0 SDK ships with a diff_time that uses __time32_t as type + // The WinCE 6.0/7.0 SDK ships with a diff_time that uses __time32_t as type // not time_t. This resolves in compilation warnings because time_t - // can be 64bit. Disable at this momemt the warning for just this method + // can be 64bit. Disable at this moment the warning for just this method // else we get two compile warnings on each source file that includes // this file. # pragma warning (push) @@ -117,42 +117,32 @@ inline double ace_difftime(time_t t1, time_t t0) { return difftime (t1, t0); } -# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) \ +# if defined (_WIN32_WCE) && ((_WIN32_WCE >= 0x600) && (_WIN32_WCE <= 0x700)) && !defined (_USE_32BIT_TIME_T) \ && defined (_MSC_VER) # pragma warning (pop) # endif #endif /* !ACE_LACKS_DIFFTIME */ # if defined (ACE_WIN32) -# if !defined (ACE_LACKS_LONGLONG_T) // 64-bit quad-word definitions. typedef unsigned __int64 ACE_QWORD; typedef unsigned __int64 ACE_hrtime_t; inline ACE_QWORD ACE_MAKE_QWORD (DWORD lo, DWORD hi) { return ACE_QWORD (lo) | (ACE_QWORD (hi) << 32); } inline DWORD ACE_LOW_DWORD (ACE_QWORD q) { return (DWORD) q; } inline DWORD ACE_HIGH_DWORD (ACE_QWORD q) { return (DWORD) (q >> 32); } -# else -// Can't find ANY place that ACE_QWORD is used, but hrtime_t is. -typedef ACE_UINT64 ACE_hrtime_t; -# endif // ACE_LACKS_LONGLONG_T # elif defined (_TNS_R_TARGET) typedef long long ACE_hrtime_t; # else /* !ACE_WIN32 */ -# if defined (ACE_HAS_HI_RES_TIMER) && !defined (ACE_LACKS_LONGLONG_T) +# if defined (ACE_HAS_HI_RES_TIMER) /* hrtime_t is defined on systems (Suns) with ACE_HAS_HI_RES_TIMER */ typedef hrtime_t ACE_hrtime_t; -# else /* ! ACE_HAS_HI_RES_TIMER || ACE_LACKS_LONGLONG_T */ +# else /* ! ACE_HAS_HI_RES_TIMER */ typedef ACE_UINT64 ACE_hrtime_t; -# endif /* ! ACE_HAS_HI_RES_TIMER || ACE_LACKS_LONGLONG_T */ +# endif /* ! ACE_HAS_HI_RES_TIMER */ # endif /* ACE_WIN32 */ -# if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) -# define ACE_HRTIME_CONVERSION(VAL) ACE_U64_TO_U32(VAL) -# define ACE_HRTIME_TO_U64(VAL) ACE_U_LongLong(VAL) -# else -# define ACE_HRTIME_CONVERSION(VAL) (VAL) -# define ACE_HRTIME_TO_U64(VAL) (VAL) -# endif +#define ACE_HRTIME_CONVERSION(VAL) (VAL) +#define ACE_HRTIME_TO_U64(VAL) (VAL) namespace ACE_OS { @@ -216,6 +206,29 @@ namespace ACE_OS struct tm *localtime_r (const time_t *clock, struct tm *res); +#if defined (ACE_USES_ULONG_FOR_STAT_TIME) + ACE_NAMESPACE_INLINE_FUNCTION + ACE_TCHAR *ctime (const unsigned long *t); + + ACE_NAMESPACE_INLINE_FUNCTION + ACE_TCHAR *ctime_r (const unsigned long *clock, ACE_TCHAR *buf, int buflen); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *gmtime (const unsigned long *clock); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *gmtime_r (const unsigned long *clock, + struct tm *res); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *localtime (const unsigned long *clock); + + ACE_NAMESPACE_INLINE_FUNCTION + struct tm *localtime_r (const unsigned long *clock, + struct tm *res); +#endif + + // Get the current time. extern ACE_Export time_t mktime (struct tm *timeptr); @@ -224,17 +237,12 @@ namespace ACE_OS int nanosleep (const struct timespec *requested, struct timespec *remaining = 0); -# if defined (ACE_HAS_POWERPC_TIMER) && defined (ghs) - extern ACE_Export - void readPPCTimeBase (u_long &most, - u_long &least); -# endif /* ACE_HAS_POWERPC_TIMER && ghs */ - ACE_NAMESPACE_INLINE_FUNCTION size_t strftime (char *s, size_t maxsize, const char *format, - const struct tm *timeptr); + const struct tm *timeptr) + ACE_GCC_FORMAT_ATTRIBUTE (strftime, 3, 0); /** * strptime wrapper. Note that the struct @a tm will always be set to diff --git a/dep/acelite/ace/OS_NS_time.inl b/dep/acelite/ace/OS_NS_time.inl index c89fba5accb..0d99bb88028 100644 --- a/dep/acelite/ace/OS_NS_time.inl +++ b/dep/acelite/ace/OS_NS_time.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_time.inl 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: OS_NS_time.inl 95763 2012-05-16 06:43:51Z johnnyw $ #include "ace/OS_NS_string.h" #include "ace/OS_NS_errno.h" @@ -199,6 +199,48 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen) } #endif /* !ACE_HAS_WINCE */ +#if defined (ACE_USES_ULONG_FOR_STAT_TIME) +ACE_INLINE ACE_TCHAR * +ACE_OS::ctime (const unsigned long *t) +{ + return ACE_OS::ctime (reinterpret_cast<const time_t *>(t)); +} + +ACE_INLINE ACE_TCHAR * +ACE_OS::ctime_r (const unsigned long *clock, ACE_TCHAR *buf, int buflen) +{ + return ACE_OS::ctime_r (reinterpret_cast<const time_t *>(clock), buf, buflen); +} + +ACE_INLINE struct tm * +ACE_OS::gmtime (const unsigned long *clock) +{ + return ACE_OS::gmtime (reinterpret_cast<const time_t *>(clock)); +} + +ACE_INLINE struct tm * +ACE_OS::gmtime_r (const unsigned long *clock, + struct tm *res) +{ + return ACE_OS::gmtime_r (reinterpret_cast<const time_t *>(clock), res); +} + +ACE_INLINE struct tm * +ACE_OS::localtime (const unsigned long *clock) +{ + return ACE_OS::localtime (reinterpret_cast<const time_t *>(clock)); +} + +ACE_INLINE struct tm * +ACE_OS::localtime_r (const unsigned long *clock, + struct tm *res) +{ + return ACE_OS::localtime_r (reinterpret_cast<const time_t *>(clock), res); +} + + +#endif + #if !defined (ACE_LACKS_DIFFTIME) ACE_INLINE double ACE_OS::difftime (time_t t1, time_t t0) @@ -207,10 +249,6 @@ ACE_OS::difftime (time_t t1, time_t t0) } #endif /* ! ACE_LACKS_DIFFTIME */ -#if defined (ghs) && defined (ACE_HAS_PENTIUM) && !defined (ACE_WIN32) - extern "C" ACE_hrtime_t ACE_GETHRTIME_NAME (); -#endif /* ghs && ACE_HAS_PENTIUM */ - ACE_INLINE ACE_hrtime_t ACE_OS::gethrtime (const ACE_HRTimer_Op op) { @@ -232,24 +270,14 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) ::QueryPerformanceCounter (&freq); -# if defined (ACE_LACKS_LONGLONG_T) - ACE_UINT64 uint64_freq (freq.u.LowPart, - static_cast<unsigned int> (freq.u.HighPart)); - return uint64_freq; -# else return freq.QuadPart; -# endif //ACE_LACKS_LONGLONG_T #elif defined (ghs) && defined (ACE_HAS_PENTIUM) ACE_UNUSED_ARG (op); // Use .obj/gethrtime.o, which was compiled with g++. return ACE_GETHRTIME_NAME (); #elif (defined (__GNUG__) || defined (__INTEL_COMPILER)) && !defined(ACE_VXWORKS) && defined (ACE_HAS_PENTIUM) ACE_UNUSED_ARG (op); -# if defined (ACE_LACKS_LONGLONG_T) - double now; -# else /* ! ACE_LACKS_LONGLONG_T */ ACE_hrtime_t now; -# endif /* ! ACE_LACKS_LONGLONG_T */ #if defined (__amd64__) || defined (__x86_64__) // Read the high res tick counter into 32 bit int variables "eax" and @@ -263,18 +291,8 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) asm volatile ("rdtsc" : "=A" (now) : : "memory"); #endif -# if defined (ACE_LACKS_LONGLONG_T) - ACE_UINT32 least, most; - ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32)); - ACE_OS::memcpy (&most, (u_char *) &now + sizeof (ACE_UINT32), - sizeof (ACE_UINT32)); - - ACE_hrtime_t ret (least, most); - return ret; -# else /* ! ACE_LACKS_LONGLONG_T */ return now; -# endif /* ! ACE_LACKS_LONGLONG_T */ -#elif defined (linux) && defined (ACE_HAS_ALPHA_TIMER) +#elif defined (ACE_LINUX) && defined (ACE_HAS_ALPHA_TIMER) // NOTE: alphas only have a 32 bit tick (cycle) counter. The rpcc // instruction actually reads 64 bits, but the high 32 bits are // implementation-specific. Linux and Digital Unix, for example, @@ -310,11 +328,7 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) } while (most != scratch); #endif -#if defined (ACE_LACKS_LONGLONG_T) - return ACE_U_LongLong (least, most); -#else /* ! ACE_LACKS_LONGLONG_T */ return 0x100000000llu * most + least; -#endif /* ! ACE_LACKS_LONGLONG_T */ #elif defined (ACE_HAS_CLOCK_GETTIME) // e.g., VxWorks (besides POWERPC && GreenHills) . . . @@ -330,7 +344,6 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) &ts); // Carefully create the return value to avoid arithmetic overflow - // if ACE_hrtime_t is ACE_U_LongLong. return static_cast<ACE_hrtime_t> (ts.tv_sec) * ACE_U_ONE_SECOND_IN_NSECS + static_cast<ACE_hrtime_t> (ts.tv_nsec); #else @@ -338,7 +351,6 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) ACE_Time_Value const now = ACE_OS::gettimeofday (); // Carefully create the return value to avoid arithmetic overflow - // if ACE_hrtime_t is ACE_U_LongLong. return (static_cast<ACE_hrtime_t> (now.sec ()) * (ACE_UINT32) 1000000 + static_cast<ACE_hrtime_t> (now.usec ())) * (ACE_UINT32) 1000; #endif /* ACE_HAS_HI_RES_TIMER */ @@ -467,7 +479,7 @@ ACE_OS::timezone (void) { return ::ace_timezone (); } -#endif /* linux */ +#endif /* ACE_LINUX */ ACE_INLINE void ACE_OS::tzset (void) diff --git a/dep/acelite/ace/OS_NS_unistd.cpp b/dep/acelite/ace/OS_NS_unistd.cpp index 66ff09f5c3d..1d2b56a358d 100644 --- a/dep/acelite/ace/OS_NS_unistd.cpp +++ b/dep/acelite/ace/OS_NS_unistd.cpp @@ -1,4 +1,4 @@ -// $Id: OS_NS_unistd.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_unistd.cpp 94448 2011-09-08 08:20:29Z johnnyw $ #include "ace/OS_NS_unistd.h" @@ -22,22 +22,6 @@ # include "cpuset.h" #endif /* ACE_HAS_VXCPULIB */ -#if defined (ACE_NEEDS_FTRUNCATE) -extern "C" int -ftruncate (ACE_HANDLE handle, long len) -{ - struct flock fl; - fl.l_whence = 0; - fl.l_len = 0; - fl.l_start = len; - fl.l_type = F_WRLCK; - - return ACE_OS::fcntl (handle, F_FREESP, reinterpret_cast <long> (&fl)); -} -#endif /* ACE_NEEDS_FTRUNCATE */ - -/*****************************************************************************/ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL int @@ -723,8 +707,11 @@ ACE_OS::pwrite (ACE_HANDLE handle, return (ssize_t) bytes_written; # else /* ACE_WIN32 */ - +# if defined (ACE_HAS_NON_CONST_PWRITE) + return ::pwrite (handle, const_cast<void*> (buf), nbytes, offset); +# else return ::pwrite (handle, buf, nbytes, offset); +# endif # endif /* ACE_WIN32 */ # else /* ACE_HAS_P_READ_WRITE */ diff --git a/dep/acelite/ace/OS_NS_unistd.h b/dep/acelite/ace/OS_NS_unistd.h index 489dc8e43e7..298e124175a 100644 --- a/dep/acelite/ace/OS_NS_unistd.h +++ b/dep/acelite/ace/OS_NS_unistd.h @@ -4,7 +4,7 @@ /** * @file OS_NS_unistd.h * - * $Id: OS_NS_unistd.h 91066 2010-07-12 11:05:04Z johnnyw $ + * $Id: OS_NS_unistd.h 92712 2010-11-25 12:22:13Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -31,18 +31,11 @@ #include "ace/os_include/os_unistd.h" #include "ace/os_include/os_stdio.h" - #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO #endif #define ACE_EXPORT_MACRO ACE_Export -// This should go in os_unistd.h, but since we don't yet implement any code -// at that level, we put it here. It used to be in OS.i. -#if defined (ACE_NEEDS_FTRUNCATE) -extern "C" ACE_Export int ftruncate (ACE_HANDLE handle, long len); -#endif /* ACE_NEEDS_FTRUNCATE */ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS diff --git a/dep/acelite/ace/OS_NS_unistd.inl b/dep/acelite/ace/OS_NS_unistd.inl index 8de371fdb9a..cf23b832225 100644 --- a/dep/acelite/ace/OS_NS_unistd.inl +++ b/dep/acelite/ace/OS_NS_unistd.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: OS_NS_unistd.inl 88515 2010-01-13 08:47:38Z johnnyw $ +// $Id: OS_NS_unistd.inl 96017 2012-08-08 22:18:09Z mitza $ #include "ace/OS_NS_sys_utsname.h" #include "ace/OS_NS_string.h" @@ -23,7 +23,7 @@ # include "ace/os_include/os_unistd.h" #endif /* ACE_HAS_ACCESS_EMULATION */ -#if defined (ACE_VXWORKS) && (((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x680)) || defined (ACE_HAS_VXWORKS551_MEDUSA)) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x690) # if defined (__RTP__) # include "ace/os_include/os_strings.h" # else @@ -274,7 +274,7 @@ ACE_OS::execv (const char *path, ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) -# if defined (__BORLANDC__) /* VSB */ +# if defined (__BORLANDC__) return ::execv (path, argv); # elif defined (__MINGW32__) return ::_execv (path, (char *const *) argv); @@ -304,7 +304,7 @@ ACE_OS::execve (const char *path, ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) -# if defined (__BORLANDC__) /* VSB */ +# if defined (__BORLANDC__) return ::execve (path, argv, envp); # elif defined (__MINGW32__) return ::_execve (path, (char *const *) argv, (char *const *) envp); @@ -332,7 +332,7 @@ ACE_OS::execvp (const char *file, ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) -# if defined (__BORLANDC__) /* VSB */ +# if defined (__BORLANDC__) return ::execvp (file, argv); # elif defined (__MINGW32__) return ::_execvp (file, (char *const *) argv); @@ -478,7 +478,7 @@ ACE_OS::getpgid (pid_t pid) #if defined (ACE_LACKS_GETPGID) ACE_UNUSED_ARG (pid); ACE_NOTSUP_RETURN (-1); -#elif defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 +#elif defined (ACE_LINUX) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 // getpgid() is from SVR4, which appears to be the reason why GLIBC // doesn't enable its prototype by default. // Rather than create our own extern prototype, just use the one @@ -763,7 +763,6 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len, ACE_OVERLAPPED *overlapped) { ACE_OS_TRACE ("ACE_OS::read"); - overlapped = overlapped; #if defined (ACE_WIN32) DWORD ok_len; DWORD short_len = static_cast<DWORD> (len); @@ -772,6 +771,7 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len, else ACE_FAIL_RETURN (-1); #else + ACE_UNUSED_ARG (overlapped); return ACE_OS::read (handle, buf, len); #endif /* ACE_WIN32 */ } @@ -955,13 +955,9 @@ ACE_OS::sleep (const ACE_Time_Value &tv) // Copy the timeval, because this platform doesn't declare the timeval // as a pointer to const. timeval tv_copy = tv; -# if defined(ACE_TANDEM_T1248_PTHREADS) - ACE_OSCALL_RETURN (::spt_select (0, 0, 0, 0, &tv_copy), int, -1); -# else - //FUZZ: disable check_for_lack_ACE_OS - ACE_OSCALL_RETURN (::select (0, 0, 0, 0, &tv_copy), int, -1); - //FUZZ: enable check_for_lack_ACE_OS -# endif + //FUZZ: disable check_for_lack_ACE_OS + ACE_OSCALL_RETURN (::select (0, 0, 0, 0, &tv_copy), int, -1); + //FUZZ: enable check_for_lack_ACE_OS # else /* ! ACE_HAS_NONCONST_SELECT_TIMEVAL */ const timeval *tvp = tv; //FUZZ: disable check_for_lack_ACE_OS @@ -1114,7 +1110,11 @@ ACE_OS::ualarm (useconds_t usecs, useconds_t interval) return ::ualarm (usecs, interval); #elif !defined (ACE_LACKS_UNIX_SIGNALS) ACE_UNUSED_ARG (interval); +# if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 && defined (_WRS_CONFIG_LP64) + return ::alarm (static_cast<unsigned int> (usecs * ACE_ONE_SECOND_IN_USECS)); +# else return ::alarm (usecs * ACE_ONE_SECOND_IN_USECS); +#endif #else ACE_UNUSED_ARG (usecs); ACE_UNUSED_ARG (interval); @@ -1135,7 +1135,11 @@ ACE_OS::ualarm (const ACE_Time_Value &tv, return ::ualarm (usecs, interval); #elif !defined (ACE_LACKS_UNIX_SIGNALS) ACE_UNUSED_ARG (tv_interval); +# if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 && defined (_WRS_CONFIG_LP64) + return ::alarm (static_cast<unsigned int> (tv.sec ())); +# else return ::alarm (tv.sec ()); +# endif #else ACE_UNUSED_ARG (tv_interval); ACE_UNUSED_ARG (tv); @@ -1209,7 +1213,6 @@ ACE_OS::write (ACE_HANDLE handle, ACE_OVERLAPPED *overlapped) { ACE_OS_TRACE ("ACE_OS::write"); - overlapped = overlapped; #if defined (ACE_WIN32) DWORD bytes_written; // This is set to 0 byte WriteFile. @@ -1219,6 +1222,7 @@ ACE_OS::write (ACE_HANDLE handle, else ACE_FAIL_RETURN (-1); #else + ACE_UNUSED_ARG (overlapped); return ACE_OS::write (handle, buf, nbyte); #endif /* ACE_WIN32 */ } diff --git a/dep/acelite/ace/OS_NS_wchar.cpp b/dep/acelite/ace/OS_NS_wchar.cpp index b0a5075ac9c..9592a385456 100644 --- a/dep/acelite/ace/OS_NS_wchar.cpp +++ b/dep/acelite/ace/OS_NS_wchar.cpp @@ -1,9 +1,7 @@ -// $Id: OS_NS_wchar.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: OS_NS_wchar.cpp 92712 2010-11-25 12:22:13Z johnnyw $ #include "ace/OS_NS_wchar.h" - - #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_wchar.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ diff --git a/dep/acelite/ace/OS_Thread_Adapter.cpp b/dep/acelite/ace/OS_Thread_Adapter.cpp index e5bf95b239b..17713e6f655 100644 --- a/dep/acelite/ace/OS_Thread_Adapter.cpp +++ b/dep/acelite/ace/OS_Thread_Adapter.cpp @@ -1,4 +1,4 @@ -// $Id: OS_Thread_Adapter.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: OS_Thread_Adapter.cpp 92682 2010-11-23 23:41:19Z shuston $ #include "ace/OS_Thread_Adapter.h" @@ -17,13 +17,15 @@ ACE_OS_Thread_Adapter::ACE_OS_Thread_Adapter ( , ACE_SEH_EXCEPT_HANDLER selector , ACE_SEH_EXCEPT_HANDLER handler # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags ) : ACE_Base_Thread_Adapter (user_func, arg, entry_point -# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , 0 +# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , selector , handler # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , cancel_flags ) { } @@ -44,6 +46,9 @@ ACE_OS_Thread_Adapter::invoke (void) reinterpret_cast<ACE_THR_FUNC_INTERNAL> (this->user_func_); void *arg = this->arg_; + // Pick up the cancel-related flags before deleting this. + long cancel_flags = this->flags_; + // Delete ourselves since we don't need <this> anymore. Make sure // not to access <this> anywhere below this point. delete this; @@ -65,6 +70,18 @@ ACE_OS_Thread_Adapter::invoke (void) #endif /* ACE_NEEDS_LWP_PRIO_SET */ + if (cancel_flags != 0) + { + // If both flags are set, ignore this. + int old = 0; + int val = cancel_flags & (THR_CANCEL_ENABLE | THR_CANCEL_DISABLE); + if (val == THR_CANCEL_ENABLE || val == THR_CANCEL_DISABLE) + ACE_OS::thr_setcancelstate (val, &old); + val = cancel_flags & (THR_CANCEL_DEFERRED | THR_CANCEL_ASYNCHRONOUS); + if (val == THR_CANCEL_DEFERRED || val == THR_CANCEL_ASYNCHRONOUS) + ACE_OS::thr_setcanceltype (val, &old); + } + ACE_THR_FUNC_RETURN status = 0; ACE_SEH_TRY diff --git a/dep/acelite/ace/OS_Thread_Adapter.h b/dep/acelite/ace/OS_Thread_Adapter.h index 4dc3cee0911..401a3df9ce2 100644 --- a/dep/acelite/ace/OS_Thread_Adapter.h +++ b/dep/acelite/ace/OS_Thread_Adapter.h @@ -4,7 +4,7 @@ /** * @file OS_Thread_Adapter.h * - * $Id: OS_Thread_Adapter.h 85341 2009-05-14 11:07:37Z johnnyw $ + * $Id: OS_Thread_Adapter.h 92682 2010-11-23 23:41:19Z shuston $ * * @author Carlos O'Ryan <coryan@uci.edu> */ @@ -50,6 +50,7 @@ public: , ACE_SEH_EXCEPT_HANDLER selector = 0 , ACE_SEH_EXCEPT_HANDLER handler = 0 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags = 0 ); /** diff --git a/dep/acelite/ace/Obchunk.cpp b/dep/acelite/ace/Obchunk.cpp index 50ac21fa0da..98b33e5244f 100644 --- a/dep/acelite/ace/Obchunk.cpp +++ b/dep/acelite/ace/Obchunk.cpp @@ -1,4 +1,4 @@ -// $Id: Obchunk.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Obchunk.cpp 92580 2010-11-15 09:48:02Z johnnyw $ #include "ace/Obchunk.h" @@ -6,8 +6,6 @@ #include "ace/Obchunk.inl" #endif /* __ACE_INLINE__ */ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Obchunk) diff --git a/dep/acelite/ace/Object_Manager.cpp b/dep/acelite/ace/Object_Manager.cpp index 3966fd31261..92ef37f4fa0 100644 --- a/dep/acelite/ace/Object_Manager.cpp +++ b/dep/acelite/ace/Object_Manager.cpp @@ -1,4 +1,4 @@ -// $Id: Object_Manager.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Object_Manager.cpp 93159 2011-01-25 10:52:44Z mcorino $ #include "ace/Object_Manager.h" #if !defined (ACE_LACKS_ACE_TOKEN) @@ -30,13 +30,9 @@ #include "ace/Null_Mutex.h" #include "ace/Mutex.h" #include "ace/RW_Thread_Mutex.h" -#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && \ - defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) \ - && (_MSC_VER >= 1400) // VC++ 8.0 and above. +#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && !defined (ACE_HAS_WINCE) #include "ace/OS_NS_stdlib.h" -#endif // ACE_DISABLE_WIN32_ERROR_WINDOWS && ACE_WIN32 && !ACE_HAS_WINCE && (_MSC_VER >= 1400) - - +#endif // ACE_DISABLE_WIN32_ERROR_WINDOWS #if ! defined (ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS) # define ACE_APPLICATION_PREALLOCATED_OBJECT_DEFINITIONS @@ -58,15 +54,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Note the following fix was derived from that proposed by Jochen Kalmbach // http://blog.kalmbachnet.de/?postid=75 -#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && \ - defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && \ - (_MSC_VER >= 1400) && defined (_M_IX86) +#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && !defined (ACE_HAS_WINCE) LPTOP_LEVEL_EXCEPTION_FILTER WINAPI ACEdisableSetUnhandledExceptionFilter ( - LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) + LPTOP_LEVEL_EXCEPTION_FILTER /*lpTopLevelExceptionFilter*/) { return 0; } -#endif // ACE_DISABLE_WIN32_ERROR_WINDOWS && ACE_WIN32 && !ACE_HAS_WINCE && (_MSC_VER >= 1400) && _M_IX86 +#endif // ACE_DISABLE_WIN32_ERROR_WINDOWS // Singleton pointer. ACE_Object_Manager *ACE_Object_Manager::instance_ = 0; @@ -260,14 +254,13 @@ ACE_Object_Manager::init (void) } # endif /* ACE_HAS_TSS_EMULATION */ -#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && \ - defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) -#if defined (_DEBUG) && (defined (_MSC_VER) || defined (__INTEL_COMPILER)) +#if defined (ACE_DISABLE_WIN32_ERROR_WINDOWS) && !defined (ACE_HAS_WINCE) +#if defined (_DEBUG) && (defined (_MSC_VER) || defined (__INTEL_COMPILER) || defined (__MINGW32__)) _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR ); _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); -#endif /* _DEBUG && _MSC_VER || __INTEL_COMPILER */ +#endif /* _DEBUG && _MSC_VER || __INTEL_COMPILER || __MINGW32__ */ // The system does not display the critical-error-handler message box SetErrorMode(SEM_FAILCRITICALERRORS); @@ -275,10 +268,10 @@ ACE_Object_Manager::init (void) // And this will catch all unhandled exceptions. SetUnhandledExceptionFilter (&ACE_UnhandledExceptionFilter); -# if (_MSC_VER >= 1400) // VC++ 8.0 and above. +# if (_MSC_VER >= 1400) // VC++ 8.0 and above // And this will stop the abort system call from being treated as a crash _set_abort_behavior( 0, _CALL_REPORTFAULT); - +# endif // Note the following fix was derived from that proposed by Jochen Kalmbach // http://blog.kalmbachnet.de/?postid=75 // See also: @@ -293,18 +286,22 @@ ACE_Object_Manager::init (void) // from calling SetUnhandledExceptionFilter() after we have done so above. // NOTE this only works for intel based windows builds. +# if (_MSC_VER >= 1400) \ + || (__MINGW32_MAJOR_VERSION > 3) || \ + ((__MINGW32_MAJOR_VERSION == 3) && \ + (__MINGW32_MINOR_VERSION >= 15)) // VC++ 8.0 and above || MingW32 >= 3.15 # ifdef _M_IX86 HMODULE hKernel32 = ACE_TEXT_LoadLibrary (ACE_TEXT ("kernel32.dll")); if (hKernel32) { void *pOrgEntry = - GetProcAddress (hKernel32, "SetUnhandledExceptionFilter"); + reinterpret_cast<void*> (GetProcAddress (hKernel32, "SetUnhandledExceptionFilter")); if (pOrgEntry) { unsigned char newJump[ 100 ]; DWORD dwOrgEntryAddr = reinterpret_cast<DWORD> (pOrgEntry); dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far - void *pNewFunc = &ACEdisableSetUnhandledExceptionFilter; + void *pNewFunc = reinterpret_cast<void*> (&ACEdisableSetUnhandledExceptionFilter); DWORD dwNewEntryAddr = reinterpret_cast<DWORD> (pNewFunc); DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr; @@ -321,7 +318,7 @@ ACE_Object_Manager::init (void) } # endif // _M_IX86 # endif // (_MSC_VER >= 1400) // VC++ 8.0 and above. -#endif /* ACE_DISABLE_WIN32_ERROR_WINDOWS && ACE_WIN32 && !ACE_HAS_WINCE */ +#endif /* ACE_DISABLE_WIN32_ERROR_WINDOWS */ # if !defined (ACE_LACKS_ACE_SVCCONF) diff --git a/dep/acelite/ace/Object_Manager_Base.cpp b/dep/acelite/ace/Object_Manager_Base.cpp index fbc5864a93c..e62b0567658 100644 --- a/dep/acelite/ace/Object_Manager_Base.cpp +++ b/dep/acelite/ace/Object_Manager_Base.cpp @@ -1,9 +1,6 @@ -// $Id: Object_Manager_Base.cpp 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Object_Manager_Base.cpp 92580 2010-11-15 09:48:02Z johnnyw $ #include "ace/Object_Manager_Base.h" - - - #include "ace/OS_Memory.h" #include "ace/OS_NS_Thread.h" #include "ace/OS_NS_sys_socket.h" diff --git a/dep/acelite/ace/Ping_Socket.h b/dep/acelite/ace/Ping_Socket.h index 213f37fbd47..b063681ddce 100644 --- a/dep/acelite/ace/Ping_Socket.h +++ b/dep/acelite/ace/Ping_Socket.h @@ -4,7 +4,7 @@ /** * @file Ping_Socket.h * - * $Id: Ping_Socket.h 81737 2008-05-20 09:46:39Z johnnyw $ + * $Id: Ping_Socket.h 93597 2011-03-21 12:54:52Z johnnyw $ * * @author Robert S. Iakobashvili <coroberti@gmail.com> <coroberti@walla.co.il> * @author Gonzalo A. Diethelm <gonzalo.diethelm@aditiva.com> @@ -60,7 +60,7 @@ public: int protocol = IPPROTO_ICMP, int reuse_addr = 0); - /// @a toConnect = 1 - makes connect to remote address + /// @a to_connect = true - makes connect to remote address int send_echo_check (ACE_INET_Addr & remote_addr, bool to_connect = false); @@ -68,7 +68,7 @@ public: /// sending @c ICMP_ECHO. int process_incoming_dgram (char * ptr, ssize_t len); - /// @a toConnect = 1 - makes connect to remote address + /// @a to_connect = true - makes connect to remote address int make_echo_check (ACE_INET_Addr & remote_addr, bool to_connect = false, ACE_Time_Value const * timeout = &time_default_); diff --git a/dep/acelite/ace/Proactor.cpp b/dep/acelite/ace/Proactor.cpp index 983b8eabb7d..dffacd2184d 100644 --- a/dep/acelite/ace/Proactor.cpp +++ b/dep/acelite/ace/Proactor.cpp @@ -1,4 +1,4 @@ -// $Id: Proactor.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Proactor.cpp 95368 2011-12-19 13:38:49Z mcorino $ #include "ace/config-lite.h" #include "ace/Proactor.h" @@ -58,11 +58,6 @@ bool ACE_Proactor::delete_proactor_ = false; */ class ACE_Proactor_Timer_Handler : public ACE_Task<ACE_NULL_SYNCH> { - - /// Proactor has special privileges - /// Access needed to: timer_event_ - friend class ACE_Proactor; - public: /// Constructor. ACE_Proactor_Timer_Handler (ACE_Proactor &proactor); @@ -75,6 +70,11 @@ public: /// <destroy> does. <destroy> make sure the thread exits properly. int destroy (void); + /// Proactor calls this to refresh the timer event thread, to wake + /// up the thread from a sleep. This is needed to make the thread + /// recompute its sleep time after changes to the timer queue. + int signal (void); + protected: /// Run by a daemon thread to handle deferred processing. In other /// words, this method will do the waiting on the earliest timer and @@ -100,6 +100,12 @@ ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor) ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler (void) { + this->destroy(); +} + +int +ACE_Proactor_Timer_Handler::destroy (void) +{ // Mark for closing down. this->shutting_down_ = 1; @@ -108,6 +114,13 @@ ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler (void) // Wait for the Timer Handler thread to exit. this->wait (); + return 0; +} + +int +ACE_Proactor_Timer_Handler::signal (void) +{ + return this->timer_event_.signal (); } int @@ -127,7 +140,8 @@ ACE_Proactor_Timer_Handler::svc (void) // Get current time from timer queue since we don't know // which <gettimeofday> was used. - ACE_Time_Value cur_time = this->proactor_.timer_queue ()->gettimeofday (); + ACE_Time_Value cur_time = + this->proactor_.timer_queue ()->gettimeofday (); // Compare absolute time with curent time received from the // timer queue. @@ -172,15 +186,16 @@ ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall (void) } int -ACE_Proactor_Handle_Timeout_Upcall::registration (TIMER_QUEUE &, - ACE_Handler *, +ACE_Proactor_Handle_Timeout_Upcall::registration (ACE_Proactor_Timer_Queue &, + ACE_Handler * handler, const void *) { + handler->proactor(proactor_); return 0; } int -ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::preinvoke (ACE_Proactor_Timer_Queue &, ACE_Handler *, const void *, int, @@ -191,7 +206,7 @@ ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &, } int -ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::postinvoke (ACE_Proactor_Timer_Queue &, ACE_Handler *, const void *, int, @@ -202,7 +217,7 @@ ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &, } int -ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::timeout (ACE_Proactor_Timer_Queue &, ACE_Handler *handler, const void *act, int, @@ -248,7 +263,7 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &, } int -ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::cancel_type (ACE_Proactor_Timer_Queue &, ACE_Handler *, int, int &) @@ -258,7 +273,7 @@ ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &, } int -ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (ACE_Proactor_Timer_Queue &, ACE_Handler *, int, int) @@ -268,7 +283,7 @@ ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &, } int -ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &, +ACE_Proactor_Handle_Timeout_Upcall::deletion (ACE_Proactor_Timer_Queue &, ACE_Handler *, const void *) { @@ -295,7 +310,7 @@ ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor) ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation, bool delete_implementation, - TIMER_QUEUE *tq) + ACE_Proactor_Timer_Queue *tq) : implementation_ (0), delete_implementation_ (delete_implementation), timer_handler_ (0), @@ -623,6 +638,11 @@ ACE_Proactor::close (void) this->timer_queue_ = 0; this->delete_timer_queue_ = 0; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + this->timer_queue_ = 0; + } return 0; } @@ -666,42 +686,15 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler, // absolute time. ACE_Time_Value absolute_time = this->timer_queue_->gettimeofday () + time; - - // Only one guy goes in here at a time - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, - ace_mon, - this->timer_queue_->mutex (), - -1)); - - // Remember the old proactor. - ACE_Proactor *old_proactor = handler.proactor (); - - // Assign *this* Proactor to the handler. - handler.proactor (this); - - // Schedule the timer long result = this->timer_queue_->schedule (&handler, act, absolute_time, interval); if (result != -1) { - // no failures: check to see if we are the earliest time - if (this->timer_queue_->earliest_time () == absolute_time) - - // wake up the timer thread - if (this->timer_handler_->timer_event_.signal () == -1) - { - // Cancel timer - this->timer_queue_->cancel (result); - result = -1; - } - } - - if (result == -1) - { - // Reset the old proactor in case of failures. - handler.proactor (old_proactor); + // Signal the timer thread to make sure that new events are + // dispatched and the sleep time is updated. + (void) this->timer_handler_->signal (); } return result; @@ -765,14 +758,14 @@ ACE_Proactor::number_of_threads (size_t threads) this->implementation ()->number_of_threads (threads); } -ACE_Proactor::TIMER_QUEUE * +ACE_Proactor_Timer_Queue * ACE_Proactor::timer_queue (void) const { return this->timer_queue_; } void -ACE_Proactor::timer_queue (TIMER_QUEUE *tq) +ACE_Proactor::timer_queue (ACE_Proactor_Timer_Queue *tq) { // Cleanup old timer queue. if (this->delete_timer_queue_) @@ -780,6 +773,10 @@ ACE_Proactor::timer_queue (TIMER_QUEUE *tq) delete this->timer_queue_; this->delete_timer_queue_ = 0; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + } // New timer queue. if (tq == 0) @@ -795,7 +792,14 @@ ACE_Proactor::timer_queue (TIMER_QUEUE *tq) } // Set the proactor in the timer queue's functor - this->timer_queue_->upcall_functor ().proactor (*this); + typedef ACE_Timer_Queue_Upcall_Base<ACE_Handler*,ACE_Proactor_Handle_Timeout_Upcall> TQ_Base; + + TQ_Base * tqb = dynamic_cast<TQ_Base*> (this->timer_queue_); + + if (tqb != 0) + { + tqb->upcall_functor ().proactor (*this); + } } ACE_HANDLE diff --git a/dep/acelite/ace/Proactor.h b/dep/acelite/ace/Proactor.h index 6b3f34f358f..4288aef6b76 100644 --- a/dep/acelite/ace/Proactor.h +++ b/dep/acelite/ace/Proactor.h @@ -4,7 +4,7 @@ /** * @file Proactor.h * - * $Id: Proactor.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Proactor.h 95332 2011-12-15 11:09:41Z mcorino $ * * @author Irfan Pyarali <irfan@cs.wustl.edu> * @author Tim Harrison <harrison@cs.wustl.edu> @@ -43,6 +43,9 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Proactor_Impl; class ACE_Proactor_Timer_Handler; +/// Type def for the timer queue. +typedef ACE_Abstract_Timer_Queue<ACE_Handler *> ACE_Proactor_Timer_Queue; + /** * @class ACE_Proactor_Handle_Timeout_Upcall * @@ -51,15 +54,8 @@ class ACE_Proactor_Timer_Handler; * This class implements the functor required by the Timer * Queue to call <handle_timeout> on ACE_Handlers. */ -class ACE_Proactor_Handle_Timeout_Upcall +class ACE_Export ACE_Proactor_Handle_Timeout_Upcall { - - /// Type def for the timer queue. - typedef ACE_Timer_Queue_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX> - TIMER_QUEUE; - /// The main Proactor class has special permissions. friend class ACE_Proactor; @@ -68,12 +64,12 @@ public: ACE_Proactor_Handle_Timeout_Upcall (void); /// This method is called when a timer is registered. - int registration (TIMER_QUEUE &timer_queue, + int registration (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg); /// This method is called before the timer expires. - int preinvoke (TIMER_QUEUE &timer_queue, + int preinvoke (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, @@ -81,14 +77,14 @@ public: const void *&upcall_act); /// This method is called when the timer expires. - int timeout (TIMER_QUEUE &timer_queue, + int timeout (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time); /// This method is called after the timer expires. - int postinvoke (TIMER_QUEUE &timer_queue, + int postinvoke (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, @@ -96,20 +92,20 @@ public: const void *upcall_act); /// This method is called when a handler is canceled. - int cancel_type (TIMER_QUEUE &timer_queue, + int cancel_type (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, int dont_call_handle_close, int &requires_reference_counting); /// This method is called when a timer is canceled. - int cancel_timer (TIMER_QUEUE &timer_queue, + int cancel_timer (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, int dont_call_handle_close, int requires_reference_counting); /// This method is called when the timer queue is destroyed and the /// timer is still contained in it. - int deletion (TIMER_QUEUE &timer_queue, + int deletion (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg); @@ -135,10 +131,8 @@ class ACE_Export ACE_Proactor { // = Here are the private typedefs that the ACE_Proactor uses. - typedef ACE_Timer_Queue_Iterator_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX> - TIMER_QUEUE_ITERATOR; + typedef ACE_Timer_Queue_Iterator_T<ACE_Handler *> + TIMER_QUEUE_ITERATOR; typedef ACE_Timer_List_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> @@ -171,12 +165,6 @@ class ACE_Export ACE_Proactor friend class ACE_Proactor_Timer_Handler; public: - /// Public type. - typedef ACE_Timer_Queue_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX> - TIMER_QUEUE; - /** * Constructor. If @a implementation is 0, the correct implementation * object will be created. @a delete_implementation flag determines @@ -185,7 +173,7 @@ public: */ ACE_Proactor (ACE_Proactor_Impl *implementation = 0, bool delete_implementation = false, - TIMER_QUEUE *tq = 0); + ACE_Proactor_Timer_Queue *tq = 0); /// Destruction. ~ACE_Proactor (void); @@ -323,8 +311,8 @@ public: const void *act, const ACE_Time_Value &interval); - // Same as above except @a interval it is used to reschedule the - // @a handler automatically. + /// Same as above except @a interval it is used to reschedule the + /// @a handler automatically. /// This combines the above two methods into one. Mostly for backward /// compatibility. @@ -357,7 +345,7 @@ public: * @param wait_time the time to wait for an event to occur. This is * a relative time. On successful return, the time is updated to * reflect the amount of time spent waiting for event(s) to occur. - * @return Returns 0 if no events occur before the wait_time expires. + * @return Returns 0 if no events occur before the @a wait_time expires. * Returns 1 when a completion is dispatched. On error, returns -1 * and sets errno accordingly. */ @@ -383,10 +371,10 @@ public: void number_of_threads (size_t threads); /// Get timer queue. - TIMER_QUEUE *timer_queue (void) const; + ACE_Proactor_Timer_Queue *timer_queue (void) const; /// Set timer queue. - void timer_queue (TIMER_QUEUE *timer_queue); + void timer_queue (ACE_Proactor_Timer_Queue *timer_queue); /** * Get the event handle. @@ -614,7 +602,7 @@ protected: ACE_Thread_Manager thr_mgr_; /// Timer Queue. - TIMER_QUEUE *timer_queue_; + ACE_Proactor_Timer_Queue *timer_queue_; /// Flag on whether to delete the timer queue. int delete_timer_queue_; diff --git a/dep/acelite/ace/Process.cpp b/dep/acelite/ace/Process.cpp index 5198023592e..22a49a4a97c 100644 --- a/dep/acelite/ace/Process.cpp +++ b/dep/acelite/ace/Process.cpp @@ -1,4 +1,4 @@ -// $Id: Process.cpp 92218 2010-10-14 13:18:15Z mcorino $ +// $Id: Process.cpp 95567 2012-02-28 14:36:02Z johnnyw $ #include "ace/Process.h" @@ -24,13 +24,11 @@ #include "ace/Vector_T.h" #include "ace/Tokenizer_T.h" -#if defined (ACE_VXWORKS) && (ACE_VXWORKS > 0x600) && defined (__RTP__) +#if defined (ACE_VXWORKS) && defined (__RTP__) # include <rtpLib.h> # include <taskLib.h> #endif - - // This function acts as a signal handler for SIGCHLD. We don't really want // to do anything with the signal - it's just needed to interrupt a sleep. // See wait() for more info. @@ -255,7 +253,7 @@ ACE_Process::spawn (ACE_Process_Options &options) } return this->child_id_; -#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS > 0x600)) && defined (__RTP__) +#elif defined (ACE_VXWORKS) && defined (__RTP__) if (ACE_BIT_ENABLED (options.creation_flags (), ACE_Process_Options::NO_EXEC)) ACE_NOTSUP_RETURN (ACE_INVALID_PID); @@ -519,13 +517,7 @@ ACE_Process::spawn (ACE_Process_Options &options) } else { -# if defined (ghs) - // GreenHills 1.8.8 (for VxWorks 5.3.x) can't compile this - // code. Processes aren't supported on VxWorks anyways. - ACE_NOTSUP_RETURN (ACE_INVALID_PID); -# else result = ACE_OS::execve (procname, procargv, procenv); -# endif /* ghs */ } if (result == -1) { @@ -624,7 +616,7 @@ ACE_Process::wait (const ACE_Time_Value &tv, # if defined (ACE_VXWORKS) { pid_t retv; - while ( (retv = this->wait (status)) == ACE_INVALID_PID && errno == EINTR ) ; + while ((retv = this->wait (status)) == ACE_INVALID_PID && errno == EINTR); return retv; } # else @@ -1231,7 +1223,10 @@ ACE_Process_Options::command_line (const ACE_TCHAR *format, ...) va_start (argp, format); if (command_line_buf_len_ < 1) - return -1; + { + va_end (argp); + return -1; + } #if !defined (ACE_LACKS_VSNPRINTF) || defined (ACE_HAS_TRIO) // vsnprintf the format and args into command_line_buf__. @@ -1325,7 +1320,7 @@ ACE_Process_Options::command_line_argv (void) do command_line_argv_[x] = parser.next (); while (command_line_argv_[x] != 0 - // substract one for the ending zero. + // subtract one for the ending zero. && ++x < max_command_line_args_ - 1); command_line_argv_[x] = 0; diff --git a/dep/acelite/ace/Process.h b/dep/acelite/ace/Process.h index 61a3802ecc6..ba5f7018581 100644 --- a/dep/acelite/ace/Process.h +++ b/dep/acelite/ace/Process.h @@ -4,7 +4,7 @@ /** * @file Process.h * - * $Id: Process.h 92218 2010-10-14 13:18:15Z mcorino $ + * $Id: Process.h 93506 2011-03-09 10:42:51Z vzykov $ * * @author Tim Harrison <harrison@cs.wustl.edu> */ diff --git a/dep/acelite/ace/Process_Manager.cpp b/dep/acelite/ace/Process_Manager.cpp index e9be7773a8b..7687e1ed839 100644 --- a/dep/acelite/ace/Process_Manager.cpp +++ b/dep/acelite/ace/Process_Manager.cpp @@ -1,4 +1,4 @@ -// $Id: Process_Manager.cpp 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Process_Manager.cpp 94454 2011-09-08 17:36:56Z johnnyw $ // Process_Manager.cpp #include "ace/Process_Manager.h" @@ -347,8 +347,7 @@ ACE_Process_Manager::handle_signal (int, #if defined (ACE_WIN32) ACE_HANDLE proc = si->si_handle_; ACE_exitcode status = 0; - BOOL result = ::GetExitCodeProcess (proc, - &status); + BOOL result = ::GetExitCodeProcess (proc, &status); if (result) { if (status != STILL_ACTIVE) @@ -843,7 +842,7 @@ ACE_Process_Manager::wait (pid_t pid, // WAIT_OBJECT_0 is a pointless comparison because // WAIT_OBJECT_0 is zero and DWORD is unsigned long, so this // test is skipped for Green Hills. Same for mingw. -# if defined (ghs) || defined (__MINGW32__) || defined (_MSC_VER) +# if defined (__MINGW32__) || defined (_MSC_VER) ACE_ASSERT (result < WAIT_OBJECT_0 + this->current_count_); # else ACE_ASSERT (result >= WAIT_OBJECT_0 @@ -917,7 +916,7 @@ ACE_Process_Manager::wait (pid_t pid, for (ACE_Countdown_Time time_left (&tmo); ; time_left.update ()) { pid = ACE_OS::waitpid (-1, status, WNOHANG); -# if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) +# if defined (ACE_VXWORKS) if (pid > 0 || (pid == ACE_INVALID_PID && errno != EINTR)) # else if (pid > 0 || pid == ACE_INVALID_PID) diff --git a/dep/acelite/ace/Process_Manager.h b/dep/acelite/ace/Process_Manager.h index 3956c18d0b6..2f50e761882 100644 --- a/dep/acelite/ace/Process_Manager.h +++ b/dep/acelite/ace/Process_Manager.h @@ -4,7 +4,7 @@ /** * @file Process_Manager.h * - * $Id: Process_Manager.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Process_Manager.h 92489 2010-11-05 00:33:37Z shuston $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -210,6 +210,9 @@ public: * * @note This call is potentially dangerous to use since the process * being terminated may not have a chance to cleanup before it shuts down. + * The process's entry is also not removed from this class's process + * table. Calling either wait() or remove() after terminate() is + * advisable. * * @retval 0 on success and -1 on failure. */ @@ -290,10 +293,9 @@ public: /** * Remove process @a pid from the ACE_Process_Manager's internal records. - * This is called automatically by the reap() method after it successfully - * reaps a process. It's also possible to call this method - * directly from a signal handler, but don't call both reap() and - * remove()! + * This is called automatically by the wait() method if the waited process + * exits. This method can also be called after calling terminate() if + * there's no need to wait() for the terminated process. */ int remove (pid_t pid); diff --git a/dep/acelite/ace/Process_Semaphore.h b/dep/acelite/ace/Process_Semaphore.h index ea614bf691c..fddaf8aecda 100644 --- a/dep/acelite/ace/Process_Semaphore.h +++ b/dep/acelite/ace/Process_Semaphore.h @@ -4,7 +4,7 @@ /** * @file Process_Semaphore.h * - * $Id: Process_Semaphore.h 86731 2009-09-17 12:23:48Z johnnyw $ + * $Id: Process_Semaphore.h 93359 2011-02-11 11:33:12Z mcorino $ * * Wrapper for Dijkstra style general semaphores that work * across processes. @@ -71,14 +71,14 @@ public: int release (void); /** - * Acquire semaphore ownership. This calls <acquire> and is only + * Acquire semaphore ownership. This calls acquire() and is only * here to make the ACE_Process_Semaphore interface consistent * with the other synchronization APIs. */ int acquire_read (void); /** - * Acquire semaphore ownership. This calls <acquire> and is only + * Acquire semaphore ownership. This calls acquire() and is only * here to make the ACE_Process_Semaphore interface consistent * with the other synchronization APIs. */ @@ -86,7 +86,7 @@ public: /** * Conditionally acquire semaphore (i.e., won't block). This calls - * <tryacquire> and is only here to make the ACE_Process_Semaphore + * tryacquire() and is only here to make the ACE_Process_Semaphore * interface consistent with the other synchronization APIs. * Returns -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. @@ -95,7 +95,7 @@ public: /** * Conditionally acquire semaphore (i.e., won't block). This calls - * <tryacquire> and is only here to make the ACE_Process_Semaphore + * tryacquire() and is only here to make the ACE_Process_Semaphore * interface consistent with the other synchronization APIs. * Returns -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. @@ -138,7 +138,7 @@ template <class T> class ACE_Malloc_Lock_Adapter_T; * @brief Template specialization of ACE_Malloc_Lock_Adapter_T for * ACE_Process_Semaphore. * - * This is needed since the ctor for ACE_Process_Semaphore doesn't match + * This is needed since the constructor for ACE_Process_Semaphore doesn't match * the standard form used by other lock strategy classes. */ template<> diff --git a/dep/acelite/ace/Profile_Timer.cpp b/dep/acelite/ace/Profile_Timer.cpp index 767638a5411..013d40e08c3 100644 --- a/dep/acelite/ace/Profile_Timer.cpp +++ b/dep/acelite/ace/Profile_Timer.cpp @@ -1,4 +1,4 @@ -// $Id: Profile_Timer.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Profile_Timer.cpp 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Profile_Timer.h" @@ -308,11 +308,7 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et) ACE_hrtime_t delta_t; // nanoseconds timer_.elapsed_time (delta_t); -# if defined (ACE_LACKS_LONGLONG_T) - et.real_time = delta_t / (double) ACE_ONE_SECOND_IN_NSECS; -# else et.real_time = (__int64) delta_t / (double) ACE_ONE_SECOND_IN_NSECS; -# endif /* ACE_LACKS_LONGLONG_T */ # if defined (ACE_HAS_GETRUSAGE) ACE_Time_Value atv = ACE_Time_Value (this->end_usage_.ru_utime) - ACE_Time_Value (this->begin_usage_.ru_utime); diff --git a/dep/acelite/ace/Profile_Timer.h b/dep/acelite/ace/Profile_Timer.h index 247c2796ff1..e21c397969b 100644 --- a/dep/acelite/ace/Profile_Timer.h +++ b/dep/acelite/ace/Profile_Timer.h @@ -4,7 +4,7 @@ /** * @file Profile_Timer.h * - * $Id: Profile_Timer.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Profile_Timer.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -101,14 +101,14 @@ private: ACE_Profile_Timer::Rusage last_usage_; #if defined (ACE_HAS_PRUSAGE_T) - /// Substract two timestructs and store their difference. + /// Subtract two timestructs and store their difference. void subtract (timespec_t &tdiff, timespec_t &t0, timespec_t &t1); /// I/O handle for /proc file system. ACE_HANDLE proc_handle_; #elif defined (ACE_HAS_GETRUSAGE) - /// Substract two timestructs and store their difference. + /// Subtract two timestructs and store their difference. void subtract (timeval &tdiff, timeval &t0, timeval &t1); diff --git a/dep/acelite/ace/QoS/README b/dep/acelite/ace/QoS/README index ce7fac62937..e7f533c8187 100644 --- a/dep/acelite/ace/QoS/README +++ b/dep/acelite/ace/QoS/README @@ -1,4 +1,4 @@ -$Id: README 80826 2008-03-04 14:51:23Z wotte $ +$Id: README 94641 2011-10-06 15:06:16Z johnnyw $ ACE QoS API (AQoSA) =================== @@ -13,7 +13,7 @@ AQoSA makes use of the GQOS API under Windows 2000. The minimum requirements are: 1. June98 Platform SDK or later. -2. Link with ws2_32.lib +2. Link with ws2_32.lib More information about GQOS is available from the MSDN website: http://msdn.microsoft.com/msdn-files/026/002/258/Search.asp @@ -35,9 +35,9 @@ PLATFORM_RAPI_CPPFLAGS += -I[path to RAPI header files] PLATFORM_RAPI_LIBS += -lrsvp PLATFORM_RAPI_LDFLAGS += -L[path to RAPI library files] -1. Compile AQoSA with - - make rapi=1 +1. Compile AQoSA with + + make rapi=1 More information about RAPI can be found at: diff --git a/dep/acelite/ace/QtReactor/ACE_QtReactor_export.h b/dep/acelite/ace/QtReactor/ACE_QtReactor_export.h new file mode 100644 index 00000000000..29494c9213f --- /dev/null +++ b/dep/acelite/ace/QtReactor/ACE_QtReactor_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_QtReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s ACE_QtReactor +// ------------------------------ +#ifndef ACE_QTREACTOR_EXPORT_H +#define ACE_QTREACTOR_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_QTREACTOR_HAS_DLL) +# define ACE_QTREACTOR_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_QTREACTOR_HAS_DLL */ + +#if !defined (ACE_QTREACTOR_HAS_DLL) +# define ACE_QTREACTOR_HAS_DLL 1 +#endif /* ! ACE_QTREACTOR_HAS_DLL */ + +#if defined (ACE_QTREACTOR_HAS_DLL) && (ACE_QTREACTOR_HAS_DLL == 1) +# if defined (ACE_QTREACTOR_BUILD_DLL) +# define ACE_QtReactor_Export ACE_Proper_Export_Flag +# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_QTREACTOR_BUILD_DLL */ +# define ACE_QtReactor_Export ACE_Proper_Import_Flag +# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_QTREACTOR_BUILD_DLL */ +#else /* ACE_QTREACTOR_HAS_DLL == 1 */ +# define ACE_QtReactor_Export +# define ACE_QTREACTOR_SINGLETON_DECLARATION(T) +# define ACE_QTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_QTREACTOR_HAS_DLL == 1 */ + +// Set ACE_QTREACTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_QTREACTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_QTREACTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_QTREACTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_QTREACTOR_NTRACE */ + +#if (ACE_QTREACTOR_NTRACE == 1) +# define ACE_QTREACTOR_TRACE(X) +#else /* (ACE_QTREACTOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_QTREACTOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_QTREACTOR_NTRACE == 1) */ + +#endif /* ACE_QTREACTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/QtReactor/QtReactor.cpp b/dep/acelite/ace/QtReactor/QtReactor.cpp new file mode 100644 index 00000000000..eb0dc70b651 --- /dev/null +++ b/dep/acelite/ace/QtReactor/QtReactor.cpp @@ -0,0 +1,644 @@ +//$Id: QtReactor.cpp 82723 2008-09-16 09:35:44Z johnnyw $ + +#include "ace/QtReactor/QtReactor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_QtReactor) + +// Must be called with lock held + +ACE_QtReactor::ACE_QtReactor (QApplication *qapp , + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int disable_notify_pipe, + ACE_Reactor_Notify *notify, + bool mask_signals, + int s_queue ): + ACE_Select_Reactor( sh, tq, disable_notify_pipe, + notify, mask_signals, s_queue), + qapp_(qapp), + qtime_ (0) +{ + reopen_notification_pipe(); +} + +// Must be called with lock held +ACE_QtReactor::ACE_QtReactor (size_t size, + QApplication *qapp, + bool restart, + ACE_Sig_Handler *sh, + ACE_Timer_Queue *tq, + int disable_notify_pipe, + ACE_Reactor_Notify *notify, + bool mask_signals, + int s_queue): + ACE_Select_Reactor( size, restart, sh, tq, + disable_notify_pipe, notify, mask_signals, + s_queue ), + qapp_(qapp), + qtime_ (0) + +{ + reopen_notification_pipe(); +} + +void ACE_QtReactor::reopen_notification_pipe( void) +{ + // When the ACE_Select_Reactor is constructed it creates the notify + // pipe and registers it with the register_handler_i() method. The + // QtReactor overloads this method BUT because the + // register_handler_i occurs when constructing the base class + // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() + // is called not the QtReactor register_handler_i(). This means + // that the notify pipe is registered with the ACE_Select_Reactor + // event handling code not the QtReactor and so notfications don't + // work. To get around this we simply close and re-opened the + // notification handler in the constructor of the QtReactor. + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + if ( initialized_ ) + { + this->notify_handler_->close (); + + // Patch for MS Windows: close and open doesn't clear the read + // fd_set, so reset it manually + this->wait_set_.rd_mask_.reset (); + + this->notify_handler_->open (this, 0); + } +#endif /* ACE_MT_SAFE */ +} + +ACE_QtReactor::~ACE_QtReactor (void) +{ + // iterate over QSocketNotifiers for read and release them + MAP::ITERATOR iter = this->read_notifier_.begin (); + MAP::ITERATOR iterEnd = this->read_notifier_.end (); + while( iter != iterEnd ) + { + MAP::ENTRY &entry = *iter; + // QOBject destructor notifies qapplication (hopefully) on delete + delete entry.int_id_; + ++iter; + } + + // iterate over QSocketNotifiers for write and release them + this->write_notifier_.begin (); + this->write_notifier_.end (); + while( iter != iterEnd ) + { + MAP::ENTRY &entry = *iter; + // QOBject destructor notifies qapplication (hopefully) on delete + delete entry.int_id_; + ++iter; + } + + // iterate over QSocketNotifiers for exceptions and release them + this->exception_notifier_.begin (); + this->exception_notifier_.end (); + while( iter != iterEnd ) + { + MAP::ENTRY &entry = *iter; + // QOBject destructor notifies qapplication (hopefully) on delete + delete entry.int_id_; + ++iter; + } + + // QOBject destructor notifies qapplication (hopefully) on delete + delete qtime_; +} + +void +ACE_QtReactor::qapplication (QApplication *qapp) +{ + // reparent QSocketNotifiers and QTimer + qapp_ = qapp ; +} + +void +ACE_QtReactor::timeout_event (void) +{ + // Deal with any timer events + ACE_Select_Reactor_Handle_Set handle_set; + this->dispatch (0, handle_set ); + + // Set next timeout signal + this->reset_timeout (); +} + +void +ACE_QtReactor::read_event (int p_handle) +{ + ACE_TRACE ("ACE_QtReactor::read_event"); + + ACE_HANDLE handle = ACE_HANDLE( p_handle ); + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // disable socket notifier to clear pending events + QSocketNotifier *qsock_notifier = 0; + if ( ( this->read_notifier_.find( handle, + qsock_notifier) != -1) ) + qsock_notifier->setEnabled( false ); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ + + // The core of read event handling + ACE_Select_Reactor_Handle_Set dispatch_set; + + dispatch_set.rd_mask_.set_bit ( handle ); + this->dispatch (1, dispatch_set); + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // enable socket notifier according to current mask + ACE_Reactor_Mask mask = 0; + mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); + if ( -1 != mask ) + set_enable_flag_by_mask ( 1, handle, mask); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ +} + +void +ACE_QtReactor::write_event (int p_handle) +{ + ACE_TRACE ("ACE_QtReactor::write_event"); + + ACE_HANDLE handle = ACE_HANDLE( p_handle ); + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // disable socket notifier to clear pending events + QSocketNotifier *qsock_notifier = 0; + if ( ( this->write_notifier_.find( handle, qsock_notifier) != -1) ) + qsock_notifier->setEnabled( false ); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ + + // The core of write event handling + ACE_Select_Reactor_Handle_Set dispatch_set; + + dispatch_set.wr_mask_.set_bit( handle ); + this->dispatch (1, dispatch_set); + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // enable socket notifier according to current mask + ACE_Reactor_Mask mask = 0; + mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); + if ( -1 != mask ) + set_enable_flag_by_mask ( 1, handle, mask); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ +} + +void +ACE_QtReactor::exception_event (int p_handle) +{ + ACE_TRACE ("ACE_QtReactor::exception_event"); + + ACE_HANDLE handle = ACE_HANDLE( p_handle ); + + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // disable socket notifier to clear pending events + QSocketNotifier *qsock_notifier = 0; + if ( ( this->exception_notifier_.find( handle, qsock_notifier) != -1) ) + qsock_notifier->setEnabled( false ); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ + + // The core of exception event handling + ACE_Select_Reactor_Handle_Set dispatch_set; + + dispatch_set.ex_mask_.set_bit( handle ); + dispatch (1, dispatch_set); + +#ifdef ACE_QTREACTOR_CLEAR_PENDING_EVENTS + // enable socket notifier according to current mask + ACE_Reactor_Mask mask = 0; + mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); + if ( -1 != mask ) + set_enable_flag_by_mask ( 1, handle, mask); +#endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ +} + +int +ACE_QtReactor::set_enable_flag_by_mask (int flag_value, + ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + QSocketNotifier *qs_not; + + if (ACE_BIT_ENABLED(mask, ACE_Event_Handler::READ_MASK) || + ACE_BIT_ENABLED( mask, ACE_Event_Handler::ACCEPT_MASK)) + { + // Find the current notifier + qs_not = 0; + if ((this->read_notifier_.find (handle, qs_not) == -1)) + return -1; + + qs_not->setEnabled (flag_value); + } + + if (ACE_BIT_ENABLED( mask, ACE_Event_Handler::WRITE_MASK) || + ACE_BIT_ENABLED( mask, ACE_Event_Handler::ACCEPT_MASK) || + ACE_BIT_ENABLED( mask, ACE_Event_Handler::CONNECT_MASK)) + { + qs_not = 0; + if ((this->write_notifier_.find (handle, qs_not) == -1)) + return -1; + + qs_not->setEnabled (flag_value); + } + + if (ACE_BIT_ENABLED( mask, + ACE_Event_Handler::EXCEPT_MASK)) + { + qs_not = 0; + if ((this->exception_notifier_.find (handle, qs_not) == -1)) + return -1; + + qs_not->setEnabled (flag_value); + } + + return 0; +} + +int +ACE_QtReactor::bit_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Select_Reactor_Handle_Set &handle_set, + int ops) +{ + int result; + ACE_Select_Reactor_Handle_Set preserved_handle_set = handle_set; + + // Call regular bit_ops + if ((result = ACE_Select_Reactor::bit_ops (handle, mask, handle_set, ops)) == -1) + return -1; + + // disable or enable the notifiers based on handle_set and mask + int enableFlag = -1; + if (&handle_set == &this->suspend_set_) + enableFlag = 0; + else if (&handle_set == &this->wait_set_) + enableFlag = 1; + else + // We have no work to do here, so just return + return result; + + switch (ops) + { + case ACE_Reactor::SET_MASK: + case ACE_Reactor::ADD_MASK: + // Enable or disable notifiers based on the specified masks + if (this->set_enable_flag_by_mask (enableFlag, handle, mask) == -1) + { + // We can't just return -1 here because we'll have half-changed things. + // So, we need to restore the old handle_set, then return -1. + handle_set = preserved_handle_set; + return -1; + } + break; + + case ACE_Reactor::CLR_MASK: + if (this->set_enable_flag_by_mask (!enableFlag, handle, mask) == -1) + { + handle_set = preserved_handle_set; + return -1; + } + break; + + default: + // we take no action for any other operations + break; + } + + return result; +} + +void +ACE_QtReactor::create_notifiers_for_handle (ACE_HANDLE handle) +{ + QSocketNotifier *qsock_notifier = 0; + + // if there is already a read socket notifier for this handle, do nothing + // otherwise create read notifier + if ( ( this->read_notifier_.find (handle, + qsock_notifier) == -1) ) + { + ACE_NEW (qsock_notifier, + QSocketNotifier (int(handle), QSocketNotifier::Read, this)); + this->read_notifier_.bind (handle, + qsock_notifier); + QObject::connect (qsock_notifier, + SIGNAL (activated (int)), + this, + SLOT (read_event (int))) ; + // disable; it will be enabled by the regular register_handler_i if + // necessary + qsock_notifier->setEnabled (0); + } + + qsock_notifier = 0; + + + // if there is already a write socket notifier for this handle, do nothing + // otherwise create read notifier + if ((this->write_notifier_.find (handle, + qsock_notifier) == -1)) + { + ACE_NEW (qsock_notifier, + QSocketNotifier (int(handle), QSocketNotifier::Write, this)); + + this->write_notifier_.bind (handle, + qsock_notifier); + + QObject::connect (qsock_notifier, + SIGNAL (activated (int)), + this, + SLOT (write_event (int))); + // disable; it will be enabled by the regular register_handler_i if + // necessary + qsock_notifier->setEnabled (0); + } + + + qsock_notifier = 0; + + // if there is already a write socket notifier for this handle, do nothing + // otherwise create read notifier + if ((this->exception_notifier_.find (handle, + qsock_notifier) == -1)) + { + + ACE_NEW (qsock_notifier, + QSocketNotifier (int(handle), QSocketNotifier::Exception, this)); + + this->exception_notifier_.bind (handle, + qsock_notifier); + + QObject::connect (qsock_notifier, + SIGNAL (activated (int)), + this, + SLOT (exception_event (int))) ; + // disable; it will be enabled by the regular register_handler_i if + // necessary + qsock_notifier->setEnabled (0); + } +} + +void +ACE_QtReactor::destroy_notifiers_for_handle (ACE_HANDLE handle) +{ + QSocketNotifier *qsock_notifier = 0; + + // Looks for the handle in the maps and removes them. + + if ((this->read_notifier_.find (handle, + qsock_notifier) != -1)) + { + this->read_notifier_.unbind (handle, + qsock_notifier); + delete qsock_notifier; + } + + if ((this->write_notifier_.find (handle, + qsock_notifier) != -1)) + { + this->write_notifier_.unbind (handle, + qsock_notifier); + delete qsock_notifier; + } + + + if ((this->exception_notifier_.find (handle, + qsock_notifier) != -1)) + { + this->exception_notifier_.unbind (handle, + qsock_notifier); + delete qsock_notifier; + } +} + +int +ACE_QtReactor::register_handler_i (ACE_HANDLE handle , + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_QtReactor::register_handler_i"); + + this->create_notifiers_for_handle (handle); + + int result; + if ((result = ACE_Select_Reactor::register_handler_i(handle, + handler, + mask )) + == -1) + { + // destroy notifiers only when there is no handler for handle + if ( !ACE_Select_Reactor::find_handler( handle ) ) + this->destroy_notifiers_for_handle (handle); + return -1; + } + + return 0; +} + +int +ACE_QtReactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::register_handler_i(handles, + handler, + mask); +} + +int ACE_QtReactor::remove_handler_i (ACE_HANDLE handle , + ACE_Reactor_Mask mask ) +{ + ACE_TRACE ("ACE_QtReactor::remove_handler_i"); + + int result = ACE_Select_Reactor::remove_handler_i (handle, mask); + // destroy notifiers only when there is no handler for handle + if ( !ACE_Select_Reactor::find_handler( handle ) ) + this->destroy_notifiers_for_handle (handle); + return result; +} + + +int +ACE_QtReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, + mask); +} + +// The following functions ensure that there is an Qt timeout for the +// first timeout in the Reactor's Timer_Queue. + +void +ACE_QtReactor::reset_timeout (void) +{ + if (this->qtime_ != 0) + { + delete this->qtime_; + this->qtime_ = 0; + } + + ACE_Time_Value *max_wait_time = + this->timer_queue_->calculate_timeout (0) ; + + if (max_wait_time) + { + ACE_NEW (this->qtime_, + QTimer); + + QObject::connect (qtime_, + SIGNAL (timeout ()), + this, + SLOT (timeout_event ())); + +#if QT_VERSION >= 0x040000 + qtime_->setSingleShot (1); + qtime_->start(max_wait_time->msec()); +#else + qtime_->start(max_wait_time->msec(), 1); +#endif + } + +} + + +long +ACE_QtReactor::schedule_timer (ACE_Event_Handler *handler, + const void *arg, + const ACE_Time_Value &delay_time, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_QtReactor::schedule_timer"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, + ace_mon, + this->token_, + -1)); + + long result; + if ((result = ACE_Select_Reactor::schedule_timer(handler, + arg, + delay_time, + interval)) == -1 ) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +int +ACE_QtReactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_QtReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (handler, + dont_call_handle_close ) == -1 ) + return -1 ; + else + { + this->reset_timeout( ) ; + return 0 ; + } +} + +int ACE_QtReactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close ) +{ + ACE_TRACE ("ACE_QtReactor::cancel_timer") ; + + if (ACE_Select_Reactor::cancel_timer (timer_id, + arg, + dont_call_handle_close ) == -1 ) + return -1 ; + else + { + this->reset_timeout( ) ; + return 0 ; + } +} + +// mbrudka: who needs QtWaitForMultipleEvents? It seems it's cargo load now! +int +ACE_QtReactor::QtWaitForMultipleEvents (int width, + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value * /*max_wait_time*/) +{ + // Keep a copy of the wait set in case the wait_set be changed + // between the two select calls in this function. It could happen + // while waiting for an event, another event is handled and dispatched + // which changes the dispatch_set_/wait_set. + ACE_Select_Reactor_Handle_Set orig_wait_set = wait_set; + + // Check to make sure our handle's are all usable. + ACE_Select_Reactor_Handle_Set temp_set = wait_set; + + if (ACE_OS::select (width, + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero ) == -1) + return -1; // Bad file arguments... + + // Qt processing. +#if QT_VERSION >= 0x040000 + this->qapp_->processEvents(); +#else + this->qapp_->processOneEvent (); +#endif + + // Reset the width, in case it changed during the upcalls. + width = handler_rep_.max_handlep1 (); + + // Now actually read the result needed by the <Select_Reactor> using + // <select>. + return ACE_OS::select(width, + orig_wait_set.rd_mask_, + orig_wait_set.wr_mask_, + orig_wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); +} + +// mbrudka: who needs wait_for_multiple_events? It seems it's cargo load now! +int +ACE_QtReactor::wait_for_multiple_events ( + ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_QtReactor::wait_for_multiple_events"); + + int nfound = 0; + do + { + max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); + size_t width = this->handler_rep_.max_handlep1 (); + handle_set.rd_mask_ = this->wait_set_.rd_mask_; + handle_set.wr_mask_ = this->wait_set_.wr_mask_; + handle_set.ex_mask_ = this->wait_set_.ex_mask_; + + nfound = QtWaitForMultipleEvents (width, + handle_set, + max_wait_time); + + } while( nfound == -1 && this->handle_error () > 0 ); + + if (nfound > 0) + { +#if !defined (ACE_WIN32) + handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + + return nfound; + // Timed out or input available +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/QtReactor/QtReactor.h b/dep/acelite/ace/QtReactor/QtReactor.h new file mode 100644 index 00000000000..72fe6d984e4 --- /dev/null +++ b/dep/acelite/ace/QtReactor/QtReactor.h @@ -0,0 +1,226 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file QtReactor.h + * + * $Id: QtReactor.h 94053 2011-05-11 13:44:41Z mhengstmengel $ + * + * @author Hamish Friedlander <ullexco@wave.co.nz> + * @author Balachandran Natarajan <bala@cs.wustl.edu> + */ +//============================================================================= + +#ifndef ACE_QTREACTOR_H +#define ACE_QTREACTOR_H + +#include /**/ "ace/pre.h" + +#include "ace/QtReactor/ACE_QtReactor_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Select_Reactor.h" +#include "ace/Map_Manager.h" + +#if defined (ACE_HAS_QT4) +# include "QtCore/qglobal.h" +#endif + +// QT toolkit specific includes. +#include /**/ <QtGui/QApplication> +#include /**/ <QtCore/QObject> +#include /**/ <QtCore/QSocketNotifier> +#include /**/ <QtCore/QTimer> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_QtReactor + * + * @brief An object-oriented event demultiplexor and event handler + * dispatcher that uses the Qt Library. This class declaration + * also uses the extension facilities provided by the Qt. So, + * readers of the class declaration should not be upset with + * the appearence of the Keywords like Q_OBJECT, private slots + * etc. They are specific to Qt which uses these as a call back + * methods implementation mechanism. + * + * \note Marek Brudka <mbrudka@elka.pw.edu.pl>: ACE_QtReactor was + * quickly bugfixed to meet ACE 5.4.2 (6.0.0?) deadline. + * While it passes QtReactor_Test now, there is a great + * room for improvements as the implementation is rather inefficient + * and obfuscated + * To be more specific: + * - reset_timeout always creates and removes qtimer after each + * timeout event! Obviously, for fast triggering timers this may + * lead to excessive memory management. + * - create/destroy_notifiers_for_handle may also be reworked to + * establish more clean relations between handles and QSocketNotifiers. + * - read/write_exception_event disable now SocketNotifier for a while + * to clear pending events. The cost of this operation is high: two hash + * acces in ACE and at least two next ones in Qt. This makes QtReator slow, + * but how clear pending events another way ? + * - there is qapplication() mutator, which sets new qapplication for + * QtReactor. This mutator violates implicit assumption about the + * relations between QTimer and QSocketNotifiers and QApplication for + * this reactor, namely one may expect that after qapplication(), none + * of QtReactor artifacts is bound to old qapplication. That's not true + * now, as QTimer and QSocketNotifiers are not reparent to new + * QApplication. As a result, the sequence: + * QApplication *old_qapp = new QApplication(..); + * QtReactor qreactor( old_qapp); + * // .. register handlers, schedule_timers etc + * QApplication *new_qapp = new QApplication(..); + * qreactor.qpplication( new_qapp ); + * delete old_qapp; + * almost always leads to problems and memory violation, because + * QSocketNotifiers are released by old_qapp. Therefore QtReactor + * should not be reparent now by setting new qapplication. + * - the lifecycle of Qt objects in ACE contects is rather mysterious + * and should be made more explicit. + * - valgrind reports a small memory leak in QtReactor_Test, though as for now + * it is not clear if the leak is introduced by QtReactor, or rather incorrect + * memory management in QtReactor_Test. + */ +class ACE_QtReactor_Export ACE_QtReactor + : public QObject, + public ACE_Select_Reactor +{ + + Q_OBJECT + +public: + /** \brief Constructor follows @ACE_Select_Reactor + \param QApplication *qapp, qapplication which runs events loop + */ + ACE_QtReactor (QApplication *qapp = 0, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify *notify = 0, + bool mask_signals = true, + int s_queue = ACE_SELECT_TOKEN::FIFO); + + /** \brief Constructor follows @ACE_Select_Reactor + \param QApplication *qapp, qapplication which runs events loop + */ + ACE_QtReactor (size_t size, + QApplication *qapp = 0, + bool restart = false, + ACE_Sig_Handler * = 0, + ACE_Timer_Queue * = 0, + int disable_notify_pipe = 0, + ACE_Reactor_Notify *notify = 0, + bool mask_signals = true, + int s_queue = ACE_SELECT_TOKEN::FIFO); + + virtual ~ACE_QtReactor (void); + + void qapplication (QApplication *qapp); + + // = Timer operations. + virtual long schedule_timer (ACE_Event_Handler *handler, + const void *arg, + const ACE_Time_Value &delay_time, + const ACE_Time_Value &interval); + + virtual int cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close = 1); + + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + +protected: + + // = Register timers/handles with Qt + + /// Register a single @a handler. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Register a set of <handlers> with Qt. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + + /// Remove the <handler> associated with this @a handle. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Remove a set of <handles>. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time); + + virtual int QtWaitForMultipleEvents (int width, + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value *max_wait_time); + + virtual int bit_ops (ACE_HANDLE handle, + ACE_Reactor_Mask mask, + ACE_Select_Reactor_Handle_Set &handle_set, + int ops); + + int set_enable_flag_by_mask (int flag_value, ACE_HANDLE handle, ACE_Reactor_Mask mask); + void create_notifiers_for_handle (ACE_HANDLE handle); + void destroy_notifiers_for_handle (ACE_HANDLE handle); + + // Wait for Qt events to occur + + /// Some Qt stuff that we need to have + QApplication *qapp_ ; + + /// Typedef of a map. + typedef ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> MAP; + + /// A notifier for a read + MAP read_notifier_; + + /// A write notifier + MAP write_notifier_; + + /// An exception notifier + MAP exception_notifier_; + + /// The timer class that would provide timer-sgnals & single-shot timers + QTimer *qtime_ ; + +private: + /// This method ensures there's an Qt timeout for the first timeout + /// in the Reactor's Timer_Queue. + void reset_timeout (void); + /// reopens notification pipe to create SocketNotifier for it + void reopen_notification_pipe(void); + /// Deny access since member-wise won't work... + ACE_QtReactor (const ACE_QtReactor &); + ACE_QtReactor &operator= (const ACE_QtReactor &); + +private slots: + + // These are all part of the communication mechanism adopted in Qt. + /// Dispatch a Read Event + void read_event (int FD); + + /// Dispatch a Write Event + void write_event (int FD); + + /// Dispatch an exception event + void exception_event (int FD); + + /// Dispatch a timeout event + void timeout_event (void); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_QTREACTOR_H */ diff --git a/dep/acelite/ace/RB_Tree.cpp b/dep/acelite/ace/RB_Tree.cpp index 0a6c8a08c8d..e9953b3ac68 100644 --- a/dep/acelite/ace/RB_Tree.cpp +++ b/dep/acelite/ace/RB_Tree.cpp @@ -1,4 +1,4 @@ -// $Id: RB_Tree.cpp 91813 2010-09-17 07:52:52Z johnnyw $ +// $Id: RB_Tree.cpp 94171 2011-06-09 01:49:08Z schmidt $ #ifndef ACE_RB_TREE_CPP #define ACE_RB_TREE_CPP @@ -49,8 +49,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (ACE_Allocator : root_ (0), current_size_ (0) { - ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::" - "ACE_RB_Tree (ACE_Allocator *alloc)"); + ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (ACE_Allocator *alloc)"); allocator_ = alloc; if (this->open (alloc) == -1) ACE_ERROR ((LM_ERROR, @@ -64,8 +63,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (const ACE_RB_T : root_ (0), current_size_ (0) { - ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::" - "ACE_RB_Tree (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &rbt)"); + ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &rbt)"); ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); allocator_ = rbt.allocator_; @@ -85,6 +83,8 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree ( ACE_Allocator *alloc ) { + ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (void *, ACE_Allocator *)"); + if (location != this) { this->root_ = 0; @@ -728,8 +728,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, const INT_ID &t, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, const INT_ID &t, " - "ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i"); // Find the closest matching node, if there is one. RB_SearchResult result = LEFT; diff --git a/dep/acelite/ace/RB_Tree.inl b/dep/acelite/ace/RB_Tree.inl index 7de889abf5b..6f085fd624e 100644 --- a/dep/acelite/ace/RB_Tree.inl +++ b/dep/acelite/ace/RB_Tree.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: RB_Tree.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: RB_Tree.inl 94310 2011-07-09 19:10:06Z schmidt $ #include "ace/Guard_T.h" #include "ace/Malloc_Base.h" @@ -194,8 +194,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree::bind (const EXT_ID &ext_id, const INT_ID &int_id, " - "ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree::bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); return this->insert_i (ext_id, int_id, entry); @@ -238,8 +237,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_ INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id, " - "ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree::trybind (const EXT_ID &ext_id, INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); int result = this->insert_i (ext_id, int_id, entry); @@ -290,8 +288,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i const INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, " - "ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); int result = this->insert_i (ext_id, int_id, entry); @@ -318,8 +315,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i const INT_ID &int_id, INT_ID &old_int_id) { - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, " - "const INT_ID &int_id, INT_ID &old_int_id)"); + ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, INT_ID &old_int_id)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry; @@ -347,8 +343,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id," - "INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id,INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); int result = this->insert_i (ext_id, int_id, entry); @@ -380,8 +375,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i EXT_ID &old_ext_id, INT_ID &old_int_id) { - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id," - "EXT_ID &old_ext_id, INT_ID &old_int_id)"); + ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id,EXT_ID &old_ext_id, INT_ID &old_int_id)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry; @@ -411,9 +405,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::rebind (const EXT_ID &ext_i INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry) { - ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, " - "EXT_ID &old_ext_id, INT_ID &old_int_id, " - "ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); + ACE_TRACE ("ACE_RB_Tree::rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry)"); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); int result = this->insert_i (ext_id, int_id, entry); diff --git a/dep/acelite/ace/README b/dep/acelite/ace/README index 6afb534a2bf..56321ab2aa4 100644 --- a/dep/acelite/ace/README +++ b/dep/acelite/ace/README @@ -1,4 +1,4 @@ -// $Id: README 92182 2010-10-08 08:21:27Z olli $ +// $Id: README 93588 2011-03-18 05:18:06Z olli $ ACE Portability Macros ---------------------- @@ -173,8 +173,6 @@ ACE_HAS_NONRECURSIVE_MUTEXES In addition to recursive mutexes, platform has non-recursive ones also. ACE_HAS_RECV_TIMEDWAIT Platform has the MIT pthreads APIs for -ACE_HAS_RECVFROM_TIMEDWAIT timed send/recv operations -ACE_HAS_RECVMSG_TIMEDWAIT ACE_HAS_RLIMIT_RESOURCE_ENUM Platform has enum instead of int for first argument to ::{get,set}rlimit (). The @@ -201,19 +199,12 @@ ACE_SCANDIR_CMP_USES_CONST_VOIDPTR The OS's scandir() comparator function const void*). ACE_SCANDIR_SEL_LACKS_CONST The OS's scandir() selector function is int (*selector)(ACE_DIRENT*) -ACE_HAS_SEND_TIMEDWAIT -ACE_HAS_SENDTO_TIMEDWAIT -ACE_HAS_SENDMSG_TIMEDWAIT ACE_HAS_STDARG_THR_DEST Platform has void (*)(...) prototype for pthread_key_create() destructor (e.g., LynxOS). ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS Platform/compiler supports Win32 structural exceptions -ACE_HAS_READ_TIMEDWAIT -ACE_HAS_READV_TIMEDWAIT -ACE_HAS_WRITE_TIMEDWAIT -ACE_HAS_WRITEV_TIMEDWAIT ACE_HAS_4_4BSD_SENDMSG_RECVMSG Platform has BSD 4.4 sendmsg()/recvmsg() APIs. ACE_HAS_P_READ_WRITE Platform has pread() and @@ -261,9 +252,6 @@ ACE_HAS_BROKEN_NESTED_TEMPLATES MSVC has trouble with defining structs and classes ACE_HAS_BROKEN_POSIX_TIME Platform defines struct timespec in <sys/timers.h> -ACE_HAS_BROKEN_RANDR OS/compiler's header files are - inconsistent with libC - definition of rand_r(). ACE_HAS_BROKEN_T_ERROR Compiler/platform has the wrong prototype for t_error(), i.e., t_error(char *) rather than @@ -353,8 +341,6 @@ ACE_USES_IPV4_IPV6_MIGRATION Enable IPv6 support in ACE on turned on by default. ACE_HAS_IPV6_V6ONLY Platform supports the IPPROTO_IPV6 level IPV6_V6ONLY socket option. -ACE_HAS_IRIX62_THREADS Platform supports the very odd - IRIX 6.2 threads... ACE_HAS_NONSTATIC_OBJECT_MANAGER Causes the ACE_Object_Manager instance to be created in main (int, char *[]), instead of as @@ -482,12 +468,6 @@ ACE_HAS_PTHREADS Platform supports POSIX one. Also may need some ACE_HAS_... thing for extensions. -ACE_HAS_PTHREADS_DRAFT4 Platform's 'Pthreads' is .4a draft 4 -ACE_HAS_PTHREADS_DRAFT6 Platform's 'Pthreads' is .4a draft 6 -ACE_HAS_PTHREADS_DRAFT7 Platform's 'Pthreads' is .1c draft 7 -ACE_HAS_PTHREADS_STD Platform supports POSIX.1c-1995 threads - (This is the final standard - Pthreads). ACE_HAS_PTHREADS_UNIX98_EXT Platform has the UNIX98 extensions to Pthreads (rwlocks) ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP Platform has @@ -694,9 +674,6 @@ ACE_HAS_UCONTEXT_T Platform supports ucontext_t ACE_HAS_UNION_WAIT The wait() system call takes a (union wait *) rather than int * -ACE_HAS_UNIXWARE_SVR4_SIGNAL_T Has inconsistent SVR4 signal - stuff, but not the same as the - other platforms ACE_HAS_VALGRIND Running with valgrind ACE_HAS_VERBOSE_NOTSUP Prints out console message in ACE_NOTSUP. Useful for @@ -969,7 +946,6 @@ ACE_LACKS_PWD_REENTRANT_FUNCTIONS Platform lacks getpwnam_r() ACE_LACKS_QSORT Compiler/platform lacks the standard C library qsort() function -ACE_LACKS_RAND_REENTRANT_FUNCTIONS Platform lacks rand_r() ACE_LACKS_READLINK Platform lacks the readlink() function. ACE_LACKS_READV Platform doesn't define readv, so use our own diff --git a/dep/acelite/ace/RW_Mutex.h b/dep/acelite/ace/RW_Mutex.h index aaaabdc0b96..99ba4c0d3fc 100644 --- a/dep/acelite/ace/RW_Mutex.h +++ b/dep/acelite/ace/RW_Mutex.h @@ -4,7 +4,7 @@ /** * @file RW_Mutex.h * - * $Id: RW_Mutex.h 83934 2008-12-01 13:47:06Z johnnyw $ + * $Id: RW_Mutex.h 93359 2011-02-11 11:33:12Z mcorino $ * * Moved from Synch.h. * @@ -92,7 +92,7 @@ public: /** * Note, for interface uniformity with other synchronization - * wrappers we include the <tryacquire> method. This is implemented + * wrappers we include the tryacquire() method. This is implemented * as a write-lock to be safe... Returns -1 on failure. If we * "failed" because someone else already had the lock, @c errno is * set to @c EBUSY. @@ -115,11 +115,11 @@ protected: /// Readers/writer lock. ACE_rwlock_t lock_; - /// Keeps track of whether <remove> has been called yet to avoid - /// multiple <remove> calls, e.g., explicitly and implicitly in the - /// destructor. This flag isn't protected by a lock, so make sure + /// Keeps track of whether remove() has been called yet to avoid + /// multiple remove() calls, e.g., explicitly and implicitly in the + /// destructor. This flag isn't protected by a lock, so make sure /// that you don't have multiple threads simultaneously calling - /// <remove> on the same object, which is a bad idea anyway... + /// remove() on the same object, which is a bad idea anyway... bool removed_; private: diff --git a/dep/acelite/ace/Reactor.h b/dep/acelite/ace/Reactor.h index 6198b4ebcfc..57d2ec7ea91 100644 --- a/dep/acelite/ace/Reactor.h +++ b/dep/acelite/ace/Reactor.h @@ -4,7 +4,7 @@ /** * @file Reactor.h * - * $Id: Reactor.h 92345 2010-10-24 12:39:33Z johnnyw $ + * $Id: Reactor.h 95774 2012-05-17 15:45:58Z shuston $ * * @author Irfan Pyarali <irfan@cs.wustl.edu> * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> @@ -110,11 +110,11 @@ public: // i.e., the one returned from ACE_Reactor::instance(). /** * Run the event loop until the - * <ACE_Reactor::handle_events/ACE_Reactor::alertable_handle_events> + * ACE_Reactor::handle_events()/ACE_Reactor::alertable_handle_events() * method returns -1 or the end_event_loop() method is invoked. * Note that this method can only be used by the singleton * ACE_Reactor::instance(). Thus, to run another reactor use - * <ACE_Reactor::run_reactor_event_loop>. + * ACE_Reactor::run_reactor_event_loop(). * * @deprecated Use ACE_Reactor::instance()->run_reactor_event_loop() instead */ @@ -178,18 +178,23 @@ public: // These methods work with an instance of a reactor. /** - * Run the event loop until the - * ACE_Reactor::handle_events()/ACE_Reactor::alertable_handle_events() - * method returns -1 or the end_reactor_event_loop() method is invoked. + * Run the event loop until the ACE_Reactor::handle_events() or + * ACE_Reactor::alertable_handle_events() method returns -1 or + * the end_reactor_event_loop() method is invoked. */ int run_reactor_event_loop (REACTOR_EVENT_HOOK = 0); int run_alertable_reactor_event_loop (REACTOR_EVENT_HOOK = 0); /** * Run the event loop until the ACE_Reactor::handle_events() or - * <ACE_Reactor::alertable_handle_events> methods returns -1, the + * ACE_Reactor::alertable_handle_events() method returns -1, the * end_reactor_event_loop() method is invoked, or the ACE_Time_Value - * expires. + * expires while the underlying event demultiplexer is waiting for + * events. + * Note that it is possible for events to continuously be available, + * avoiding the need to wait for events. In this situation the timeout + * value will not have an opportunity to expire until the next time + * the underlying event demultiplexer waits for events. */ int run_reactor_event_loop (ACE_Time_Value &tv, REACTOR_EVENT_HOOK = 0); @@ -559,13 +564,19 @@ public: * @see cancel_timer() * @see reset_timer_interval() * - * @param event_handler Event handler to schedule on reactor - * @param arg Argument passed to the handle_timeout() method of - * event_handler - * @param delay Time interval after which the timer will expire - * @param interval Time interval after which the timer will be automatically - * rescheduled - * @return -1 on failure, a timer_id value on success + * @param event_handler Event handler to schedule on reactor. The handler's + * handle_timeout() method will be called when this + * scheduled timer expires. + * @param arg Argument passed to the handle_timeout() method of + * event_handler. + * @param delay Time interval after which the timer will expire. + * @param interval Time interval for which the timer will be + * automatically rescheduled if the handle_timeout() + * callback does not return a value less than 0. + * + * @retval timer id, on success. The id can be used to + * cancel or reschedule this timer. + * @retval -1 on failure, with errno set. */ virtual long schedule_timer (ACE_Event_Handler *event_handler, const void *arg, diff --git a/dep/acelite/ace/Recursive_Thread_Mutex.h b/dep/acelite/ace/Recursive_Thread_Mutex.h index 6ddd04bd6bf..240d9ce60a0 100644 --- a/dep/acelite/ace/Recursive_Thread_Mutex.h +++ b/dep/acelite/ace/Recursive_Thread_Mutex.h @@ -4,7 +4,7 @@ /** * @file Recursive_Thread_Mutex.h * - * $Id: Recursive_Thread_Mutex.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Recursive_Thread_Mutex.h 93359 2011-02-11 11:33:12Z mcorino $ * * Moved from Synch.h. * @@ -72,7 +72,7 @@ public: int acquire (ACE_Time_Value &tv); /** - * If @a tv == 0 the call <acquire()> directly. Otherwise, Block the + * If @a tv == 0 the call acquire() directly. Otherwise, Block the * thread until we acquire the mutex or until @a tv times out, in * which case -1 is returned with @c errno == @c ETIME. Note that * <*tv> is assumed to be in "absolute" rather than "relative" time. @@ -89,14 +89,14 @@ public: int tryacquire (void); /** - * Acquire mutex ownership. This calls <acquire> and is only + * Acquire mutex ownership. This calls acquire() and is only * here to make the ACE_Recusive_Thread_Mutex interface consistent * with the other synchronization APIs. */ int acquire_read (void); /** - * Acquire mutex ownership. This calls <acquire> and is only + * Acquire mutex ownership. This calls acquire() and is only * here to make the ACE_Recusive_Thread_Mutex interface consistent * with the other synchronization APIs. */ @@ -104,7 +104,7 @@ public: /** * Conditionally acquire mutex (i.e., won't block). This calls - * <tryacquire> and is only here to make the + * tryacquire() and is only here to make the * ACE_Recusive_Thread_Mutex interface consistent with the other * synchronization APIs. Returns -1 on failure. If we "failed" * because someone else already had the lock, @c errno is set to @@ -114,7 +114,7 @@ public: /** * Conditionally acquire mutex (i.e., won't block). This calls - * <tryacquire> and is only here to make the + * tryacquire() and is only here to make the * ACE_Recusive_Thread_Mutex interface consistent with the other * synchronization APIs. Returns -1 on failure. If we "failed" * because someone else already had the lock, @c errno is set to @@ -169,11 +169,11 @@ protected: /// Recursive mutex. ACE_recursive_thread_mutex_t lock_; - /// Keeps track of whether <remove> has been called yet to avoid - /// multiple <remove> calls, e.g., explicitly and implicitly in the + /// Keeps track of whether remove() has been called yet to avoid + /// multiple remove() calls, e.g., explicitly and implicitly in the /// destructor. This flag isn't protected by a lock, so make sure /// that you don't have multiple threads simultaneously calling - /// <remove> on the same object, which is a bad idea anyway... + /// remove() on the same object, which is a bad idea anyway... bool removed_; private: diff --git a/dep/acelite/ace/Registry_Name_Space.h b/dep/acelite/ace/Registry_Name_Space.h index eb9f77587f6..289e61039fa 100644 --- a/dep/acelite/ace/Registry_Name_Space.h +++ b/dep/acelite/ace/Registry_Name_Space.h @@ -4,7 +4,7 @@ /** * @file Registry_Name_Space.h * - * $Id: Registry_Name_Space.h 92345 2010-10-24 12:39:33Z johnnyw $ + * $Id: Registry_Name_Space.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Irfan Pyarali (irfan@cs.wustl.edu) */ @@ -67,13 +67,13 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Name_Space or bind a new name to the context, if it didn't - * exist yet. (Wide charcter strings interface). + * exist yet. (Wide character strings interface). */ int rebind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, const char *type_in = ""); - /// Delete a name from a ACE_Name_Space (Wide charcter strings + /// Delete a name from a ACE_Name_Space (Wide character strings /// Interface). int unbind (const ACE_NS_WString &name_in); diff --git a/dep/acelite/ace/Remote_Name_Space.h b/dep/acelite/ace/Remote_Name_Space.h index 683f36c7963..73c9272f07d 100644 --- a/dep/acelite/ace/Remote_Name_Space.h +++ b/dep/acelite/ace/Remote_Name_Space.h @@ -4,7 +4,7 @@ /** * @file Remote_Name_Space.h * - * $Id: Remote_Name_Space.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Remote_Name_Space.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Prashant Jain */ @@ -77,18 +77,18 @@ public: /** * Overwrite the value or type of an existing name in a * ACE_Remote_Name_Space or bind a new name to the context, if it - * didn't exist yet. (Wide charcter strings interface). + * didn't exist yet. (Wide character strings interface). */ virtual int rebind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, const char *type_in = ""); - /// Delete a name from a ACE_Remote_Name_Space (Wide charcter strings + /// Delete a name from a ACE_Remote_Name_Space (Wide character strings /// Interface). virtual int unbind (const ACE_NS_WString &name_in); /// Get value and type of a given name binding (Wide chars). The - /// caller is responsible for deleting both <value_out> and <type_out>! + /// caller is responsible for deleting both @a value_out and @a type_out! virtual int resolve (const ACE_NS_WString &name_in, ACE_NS_WString &value_out, char *&type_out); diff --git a/dep/acelite/ace/Remote_Tokens.h b/dep/acelite/ace/Remote_Tokens.h index 3c9ed94f561..3d09f7f2fc4 100644 --- a/dep/acelite/ace/Remote_Tokens.h +++ b/dep/acelite/ace/Remote_Tokens.h @@ -4,7 +4,7 @@ /** * @file Remote_Tokens.h * - * $Id: Remote_Tokens.h 92345 2010-10-24 12:39:33Z johnnyw $ + * $Id: Remote_Tokens.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) * @author Tim Harrison (harrison@cs.wustl.edu) @@ -42,7 +42,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * distributed token operations. It is similar to the * ACE_Token_Proxy. * @todo - * Distributed sleep_hooks have not been implemented. <owner_id> + * Distributed sleep_hooks have not been implemented. <owner_id> * is not implemented. */ class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy diff --git a/dep/acelite/ace/SOCK_Dgram.cpp b/dep/acelite/ace/SOCK_Dgram.cpp index 0530584b059..3706d780ad5 100644 --- a/dep/acelite/ace/SOCK_Dgram.cpp +++ b/dep/acelite/ace/SOCK_Dgram.cpp @@ -1,4 +1,4 @@ -// $Id: SOCK_Dgram.cpp 91622 2010-09-06 08:26:30Z sma $ +// $Id: SOCK_Dgram.cpp 95533 2012-02-14 22:59:17Z wotte $ #include "ace/SOCK_Dgram.h" @@ -320,7 +320,7 @@ ACE_SOCK_Dgram::send (const iovec iov[], // Determine the total length of all the buffers in <iov>. for (i = 0; i < n; i++) -#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS)) +#if ! (defined(__BORLANDC__) || defined(ACE_LINUX) || defined(ACE_HAS_RTEMS)) // The iov_len is unsigned on Linux, RTEMS and with Borland. If we go // ahead and try the if, it will emit a warning. if (iov[i].iov_len < 0) @@ -369,7 +369,7 @@ ACE_SOCK_Dgram::recv (iovec iov[], int i; for (i = 0; i < n; i++) -#if ! (defined(__BORLANDC__) || defined(linux) || defined(ACE_HAS_RTEMS)) +#if ! (defined(__BORLANDC__) || defined(ACE_LINUX) || defined(ACE_HAS_RTEMS)) // The iov_len is unsigned on Linux, RTEMS and with Borland. If we go // ahead and try the if, it will emit a warning. if (iov[i].iov_len < 0) @@ -596,7 +596,7 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, 0, sizeof (lmreq)); -#if defined(__linux__) +#if defined(ACE_LINUX) if (net_if != 0) { lmreq.ipv6mr_interface = ACE_OS::if_nametoindex (ACE_TEXT_ALWAYS_CHAR(net_if)); @@ -674,6 +674,6 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, return 0; } -#endif /* __linux__ && ACE_HAS_IPV6 */ +#endif /* ACE_LINUX && ACE_HAS_IPV6 */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/SOCK_Dgram.h b/dep/acelite/ace/SOCK_Dgram.h index c26c5ff2c35..3a8eba63da7 100644 --- a/dep/acelite/ace/SOCK_Dgram.h +++ b/dep/acelite/ace/SOCK_Dgram.h @@ -4,7 +4,7 @@ /** * @file SOCK_Dgram.h * - * $Id: SOCK_Dgram.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: SOCK_Dgram.h 92580 2010-11-15 09:48:02Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -206,8 +206,7 @@ public: protected: /// Open is shared by this and by <LSOCK_Dgram>. - int shared_open (const ACE_Addr &local, - int protocol_family); + int shared_open (const ACE_Addr &local, int protocol_family); /// Create a multicast addr/if pair, in format useful for system calls. /// If mreq param is NULL, just verify the passed addr/interface specs. diff --git a/dep/acelite/ace/SOCK_Dgram_Bcast.cpp b/dep/acelite/ace/SOCK_Dgram_Bcast.cpp index fec4c39a259..f6226665e25 100644 --- a/dep/acelite/ace/SOCK_Dgram_Bcast.cpp +++ b/dep/acelite/ace/SOCK_Dgram_Bcast.cpp @@ -1,4 +1,4 @@ -// $Id: SOCK_Dgram_Bcast.cpp 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: SOCK_Dgram_Bcast.cpp 93359 2011-02-11 11:33:12Z mcorino $ #include "ace/SOCK_Dgram_Bcast.h" @@ -181,7 +181,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) // Silently skip link interfaces if (ifr->ifr_addr.sa_family == AF_LINK) continue; -#endif /* __QNX__ */ +#endif /* __QNX__ || ACE_VXWORKS */ // Compare host ip address with interface ip address. if (host_name) { diff --git a/dep/acelite/ace/SOCK_Dgram_Mcast.cpp b/dep/acelite/ace/SOCK_Dgram_Mcast.cpp index 5f31771b0f1..91167e0ac14 100644 --- a/dep/acelite/ace/SOCK_Dgram_Mcast.cpp +++ b/dep/acelite/ace/SOCK_Dgram_Mcast.cpp @@ -1,4 +1,4 @@ -// $Id: SOCK_Dgram_Mcast.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: SOCK_Dgram_Mcast.cpp 95679 2012-04-03 22:55:46Z shuston $ #include "ace/SOCK_Dgram_Mcast.h" @@ -8,14 +8,22 @@ #include "ace/os_include/net/os_if.h" #include "ace/os_include/arpa/os_inet.h" -#if defined (__linux__) && defined (ACE_HAS_IPV6) +#if defined (ACE_LINUX) && defined (ACE_HAS_IPV6) #include "ace/OS_NS_sys_socket.h" #endif -#if defined (ACE_HAS_IPV6) && defined (ACE_WIN32) +#if defined (ACE_WIN32) #include /**/ <iphlpapi.h> #endif +#if defined (ACE_HAS_GETIFADDRS) +# if defined (ACE_VXWORKS) +# include /**/ <net/ifaddrs.h> +# else +# include /**/ <ifaddrs.h> +# endif /*ACE_VXWORKS */ +#endif /* ACE_HAS_GETIFADDRS */ + #if !defined (__ACE_INLINE__) #include "ace/SOCK_Dgram_Mcast.inl" #endif /* __ACE_INLINE__ */ @@ -253,135 +261,135 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) && net_if == 0) { -#if defined (ACE_HAS_IPV6) - if (mcast_addr.get_type () == AF_INET6) - { - size_t nr_subscribed = 0; -# if defined(__linux__) - struct if_nameindex *intf; - - intf = ACE_OS::if_nameindex (); - - if (intf == 0) - return -1; - - int index = 0; - while (intf[index].if_index != 0 || intf[index].if_name != 0) - { - if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) - ++nr_subscribed; - - ++index; - } + int family = mcast_addr.get_type (); + size_t nr_subscribed = 0; - ACE_OS::if_freenameindex (intf); +#if defined (ACE_HAS_GETIFADDRS) -# elif defined (ACE_WIN32) + // Take advantage of the BSD getifaddrs function that simplifies + // access to connected interfaces. + struct ifaddrs *ifap = 0; + struct ifaddrs *p_if = 0; - IP_ADAPTER_ADDRESSES tmp_addrs; - // Initial call to determine actual memory size needed - DWORD dwRetVal; - ULONG bufLen = 0; - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - 0, - &tmp_addrs, - &bufLen)) != ERROR_BUFFER_OVERFLOW) - return -1; // With output bufferlength 0 this can't be right. + if (::getifaddrs (&ifap) != 0) + return -1; - // Get required output buffer and retrieve info for real. - PIP_ADAPTER_ADDRESSES pAddrs; - char *buf; - ACE_NEW_RETURN (buf, - char[bufLen], - -1); - pAddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES> (buf); - if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, - 0, - 0, - pAddrs, - &bufLen)) != NO_ERROR) + // Not every interface is for IP, and not all are up and multicast. + for (p_if = ifap; + p_if != 0; + p_if = p_if->ifa_next) + { + // Some OSes can return interfaces with no ifa_addr if the + // interface has no assigned address. + // If there is an address but it's not the family we want, ignore it. + if (p_if->ifa_addr == 0 || p_if->ifa_addr->sa_family != family) + continue; + + // Check to see if it's up and supports multicast. + unsigned int wanted = IFF_UP | IFF_MULTICAST; + if ((p_if->ifa_flags & wanted) != wanted) + continue; + + // Sometimes the kernel returns 0.0.0.0 as the interface + // address, skip those... + if (p_if->ifa_addr->sa_family == PF_INET) { - delete[] buf; // clean up - return -1; - } + struct sockaddr_in *addr = + reinterpret_cast<sockaddr_in *> (p_if->ifa_addr); - while (pAddrs) + if (addr->sin_addr.s_addr == INADDR_ANY) + continue; + } +# if defined (ACE_HAS_IPV6) + else if (p_if->ifa_addr->sa_family == AF_INET6) { - if (this->join (mcast_addr, reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) - ++nr_subscribed; + struct sockaddr_in6 *addr = + reinterpret_cast<sockaddr_in6 *> (p_if->ifa_addr); - pAddrs = pAddrs->Next; + // Skip the ANY address + if (IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) + continue; } +# endif /* ACE_HAS_IPV6 */ - delete[] buf; // clean up + // Ok, now join on this interface. + if (this->join (mcast_addr, + reuse_addr, + ACE_TEXT_CHAR_TO_TCHAR(p_if->ifa_name)) == 0) + ++nr_subscribed; + } -# endif /* ACE_WIN32 */ + ::freeifaddrs (ifap); - if (nr_subscribed == 0) - { - errno = ENODEV; - return -1; - } +# elif defined (ACE_WIN32) - return 1; - } - else + IP_ADAPTER_ADDRESSES tmp_addrs; + // Initial call to determine actual memory size needed + DWORD dwRetVal; + ULONG bufLen = 0; + // Note... GetAdaptersAddresses returns different bufLen values depending + // on how many multicast joins there are on the system. To avoid this, + // specify that we don't want to know about multicast addresses. This + // does not avoid multicastable interfaces and makes the size-check + // more reliable across varying conditions. + DWORD flags = GAA_FLAG_SKIP_MULTICAST; + if ((dwRetVal = ::GetAdaptersAddresses (family, + flags, + 0, + &tmp_addrs, + &bufLen)) != ERROR_BUFFER_OVERFLOW) { - // Subscribe on all local multicast-capable network interfaces, by - // doing recursive calls with specific interfaces. - - ACE_INET_Addr *if_addrs = 0; - size_t if_cnt; + errno = dwRetVal; + return -1; // With output bufferlength 0 this can't be right. + } - if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) - return -1; + // Get required output buffer and retrieve info for real. + PIP_ADAPTER_ADDRESSES pAddrs; + char *buf; + ACE_NEW_RETURN (buf, + char[bufLen], + -1); + pAddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES> (buf); + if ((dwRetVal = ::GetAdaptersAddresses (family, + flags, + 0, + pAddrs, + &bufLen)) != NO_ERROR) + { + delete[] buf; // clean up + errno = dwRetVal; + return -1; + } - size_t nr_subscribed = 0; + for (; pAddrs; pAddrs = pAddrs->Next) + { + if (pAddrs->OperStatus != IfOperStatusUp) + continue; - if (if_cnt < 2) + // The ACE_SOCK_Dgram::make_multicast_ifaddr (IPv4), called by join(), + // can only deal with a dotted-decimal address, not an interface name. + if (family == AF_INET) { - if (this->join (mcast_addr, - reuse_addr, - ACE_TEXT ("0.0.0.0")) == 0) + ACE_INET_Addr intf_addr ((sockaddr_in*)(pAddrs->FirstUnicastAddress->Address.lpSockaddr), + pAddrs->FirstUnicastAddress->Address.iSockaddrLength); + char intf_addr_str[INET_ADDRSTRLEN]; + intf_addr.get_host_addr (intf_addr_str, sizeof (intf_addr_str)); + if (this->join (mcast_addr, reuse_addr, + ACE_TEXT_CHAR_TO_TCHAR(intf_addr_str)) == 0) ++nr_subscribed; } else { - // Iterate through all the interfaces, figure out which ones - // offer multicast service, and subscribe to them. - while (if_cnt > 0) - { - --if_cnt; - - // Convert to 0-based for indexing, next loop check. - if (if_addrs[if_cnt].get_type () != AF_INET || if_addrs[if_cnt].is_loopback ()) - continue; - char addr_buf[INET6_ADDRSTRLEN]; - if (this->join (mcast_addr, - reuse_addr, - ACE_TEXT_CHAR_TO_TCHAR - (if_addrs[if_cnt].get_host_addr (addr_buf, INET6_ADDRSTRLEN))) == 0) - ++nr_subscribed; - } + if (this->join (mcast_addr, reuse_addr, + ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) + ++nr_subscribed; } + } - delete [] if_addrs; + delete[] buf; // clean up - if (nr_subscribed == 0) - { - errno = ENODEV; - return -1; - } +# else - // 1 indicates a "short-circuit" return. This handles the - // recursive behavior of checking all the interfaces. - return 1; - - } -#else // Subscribe on all local multicast-capable network interfaces, by // doing recursive calls with specific interfaces. @@ -391,8 +399,6 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; - size_t nr_subscribed = 0; - if (if_cnt < 2) { if (this->join (mcast_addr, @@ -409,7 +415,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, --if_cnt; // Convert to 0-based for indexing, next loop check. - if (if_addrs[if_cnt].is_loopback ()) + if (if_addrs[if_cnt].get_type () != family || if_addrs[if_cnt].is_loopback ()) continue; char addr_buf[INET6_ADDRSTRLEN]; if (this->join (mcast_addr, @@ -422,18 +428,19 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, delete [] if_addrs; +# endif /* ACE_WIN32 */ + if (nr_subscribed == 0) { errno = ENODEV; return -1; } - // 1 indicates a "short-circuit" return. This handles the - // recursive behavior of checking all the interfaces. return 1; -#endif /* ACE_HAS_IPV6 */ } + // Subscribe on a specific interface, or on the default interface. + #if defined (ACE_HAS_IPV6) if (mcast_addr.get_type () == AF_INET6) { @@ -441,6 +448,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, return -1; } else +#endif /* ACE_HAS_IPV6 - Fall into IPv4-only case */ { // Validate passed multicast addr and iface specifications. if (this->make_multicast_ifaddr (0, @@ -448,13 +456,6 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, net_if) == -1) return -1; } -#else - // Validate passed multicast addr and iface specifications. - if (this->make_multicast_ifaddr (0, - mcast_addr, - net_if) == -1) - return -1; -#endif /* ACE_HAS_IPV6 */ return 0; @@ -552,7 +553,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr, ip_mreq mreq; #if defined (ACE_HAS_IPV6) ipv6_mreq mreq6; -#endif /* __linux__ && ACE_HAS_IPV6 */ +#endif /* ACE_LINUX && ACE_HAS_IPV6 */ // Open the socket IFF this is the first ::subscribe and ::open // was not explicitly invoked. @@ -616,7 +617,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, if (mcast_addr.get_type () == AF_INET6) { size_t nr_unsubscribed = 0; -# if defined(__linux__) +# if defined(ACE_LINUX) struct if_nameindex *intf; diff --git a/dep/acelite/ace/SOCK_Dgram_Mcast.h b/dep/acelite/ace/SOCK_Dgram_Mcast.h index 7c42e46e78a..a2e7def0fe6 100644 --- a/dep/acelite/ace/SOCK_Dgram_Mcast.h +++ b/dep/acelite/ace/SOCK_Dgram_Mcast.h @@ -4,7 +4,7 @@ /** * @file SOCK_Dgram_Mcast.h * - * $Id: SOCK_Dgram_Mcast.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: SOCK_Dgram_Mcast.h 96014 2012-08-08 15:30:01Z sma $ * * @author Irfan Pyrali <irfan@cs.wustl.edu> * @author Tim Harrison <harrison@cs.wustl.edu> @@ -46,50 +46,56 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * * Supports multiple simultaneous subscriptions, unsubscription from one or * all subscriptions, and independent send/recv address and interface - * specifications. Template parameters and/or ctor arguments determine - * per-instance optional functionality. + * specifications. Constructor arguments determine per-instance optional + * functionality. * - * Note that multicast semantics and implementation details are _very_ + * Note that multicast semantics and implementation details are @i very * environment-specific; this class is just a wrapper around the underlying * implementation and does not try to normalize the concept of multicast * communications. * * Usage Notes: - * - Send and Recv addresses and network interfaces, but not port#, are - * independent. While this instance is open, 1 send interface (and a default - * send address) is in effect and 0, 1, or multiple recv addresses/interfaces - * are in effect. - * - The first <open>/<subscribe> invocation defines the network interface + * - Send and receive addresses and network interfaces, but not port number, + * are independent. While this instance is open, one send interface (and a + * default send address) is in effect and 0, 1, or multiple receive + * addresses/interfaces are in effect. + * - The first open()/subscribe() invocation defines the network interface * and default address used for all sends by this instance, defines the - * port# and optionally the multicast address bound to the underlying - * socket, and defines the (one) port# that is used for all subscribes - * (subsequent subscribes must pass the same port# or '0'). + * port number and optionally the multicast address bound to the underlying + * socket, and defines the (one) port number that is used for all subscribes + * (subsequent subscribes must pass the same port number or 0). * - The default loopback state is not explicitly set; the environment will - * determine the default state. Note that some environments (e.g. some Win32) - * do not allow the default to be changed, and that the semantics of - * loopback control are environment dependent (e.g. sender vs receiver - * control). + * determine the default state. Note that some environments (e.g. some + * Windows versions) do not allow the default to be changed, and that the + * semantics of loopback control are environment dependent (e.g. sender vs. + * receiver control). * - In general, due to multicast design and implementation quirks/bugs, it is * difficult to tell which address a received message was sent to or which * interface it was received on (even if only one subscription is active). - * However; there are filtering options that can be applied, to narrow it + * However, there are filtering options that can be applied, to narrow it * down considerably. * - * Interface specification notes (for <subscribe> and <unsubscribe>): - * - If net_if == 0, the null_iface_opt option determines whether only the - * system "default" interface or all interfaces is affected. Specifying - * "all" interfaces is supported only for environments for which - * <ACE_Sock_Connect::get_ip_interfaces> is properly implemented. + * Interface specification notes (for subscribe() and unsubscribe()): + * - If @a net_if == 0, the @c OPT_NULLIFACE_ALL and @c OPT_NULLIFACE_ONE + * options determine whether only the system default interface + * (if @c OPT_NULLIFACE_ONE is set) or all interfaces (if + * @c OPT_NULLIFACE_ALL is set) is affected. Specifying all interfaces + * functions correctly only on: + * + Windows + * + Platforms with the ACE_HAS_GETIFADDRS config setting (includes Linux) + * + Platforms which accept the IP address as an interface + * name/specification + * + Systems with only one non-loopback interface. + * Other platforms require additional supporting code. * - Multiple subscriptions for the same address but different interfaces is * normally supported, but re-subscription to an address/interface that is * already subscribed is normally not allowed. - * - The <net_if> interface specification syntax is environment-specific. + * - The @a net_if interface specification syntax is environment-specific. * UNIX systems will normally use device specifications such as "le0" or * "elxl1", while other systems will use the IP address of the interface. * Some platforms, such as pSoS, support only cardinal numbers as network * interface specifications; for these platforms, just give these numbers in - * alphanumeric form and <subscribe> will convert them into numbers via - * ACE_OS::atoi(). + * string form and join() will convert them into numbers. */ class ACE_Export ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram { @@ -99,78 +105,88 @@ public: * @brief Option parameters. * * These control per-instance optional functionality. They are set via - * optional constructor arguments. + * an optional constructor argument. + * * @note Certain option values are not valid for all environments (see * comments in source file for environment-specific restrictions). Default * values are always valid values for the compilation environment. */ enum options { - // Define whether a specific (multicast) address (in addition to the port#) - // is bound to the socket. - // Notes: - // - Effect of doing this is stack/environment dependent, but in most - // environments can be used to filter out unwanted unicast, broadcast, and - // (other) multicast messages sent to the same port#. - // - Some IP stacks (e.g. some Win32) do not support binding multicast - // addresses. Using this option will always cause an <open> error. - // - It's not strictly possible for user code to do this level of filtering - // w/out the bind; some environments support ways to determine which address - // a message was sent _to_, but this class interface does not support access - // to that info. - // - The address (and port#) passed to <open> (or the first <subscribe>, if - // <open> is not explicitly invoked) is the one that is bound. - // + /* Define whether a specific multicast address (in addition to the port + * number) is bound to the socket. + * @note: + * - Effect of doing this is stack/environment dependent, but in most + * environments can be used to filter out unwanted unicast, broadcast, + * and (other) multicast messages sent to the same port number. + * - Some IP stacks (e.g. some Windows) do not support binding multicast + * addresses. Using this option will always cause an open() error. + * - It's not strictly possible for user code to do this level of filtering + * without the bind; some environments support ways to determine which + * address a message was sent to, but this class interface does not + * support access to that information. + * - The address (and port number) passed to open() (or the first + * join(), if open() is not explicitly invoked) is the one that is bound. + */ + /// Disable address bind. (Bind only port.) - // Note that this might seem odd, but we need a way to distinquish between - // default behavior, which might or might not be to bind, and explicitely - // choosing to bind or not to bind--which "is the question." ;-) + /// @note This might seem odd, but we need a way to distinguish between + /// default behavior, which might or might not be to bind, and explicitly + /// choosing to bind or not to bind--which "is the question." ;-) OPT_BINDADDR_NO = 0, /// Enable address bind. (Bind port and address.) OPT_BINDADDR_YES = 1, /// Default value for BINDADDR option. (Environment-dependent.) #if defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) \ && (ACE_LACKS_PERFECT_MULTICAST_FILTERING == 1) - // Platforms that don't support perfect filtering. Note that perfect - // filtering only really applies to multicast traffic, not unicast - // or broadcast. + /// Platforms that don't support perfect filtering. Note that perfect + /// filtering only really applies to multicast traffic, not unicast + /// or broadcast. DEFOPT_BINDADDR = OPT_BINDADDR_YES, # else - // At least some Win32 OS's can not bind mcast addr, so disable it. - // General-purpose default behavior is 'disabled', since effect is - // environment-specific and side-effects might be surprising. + /// At least some Win32 OS's can not bind mcast addr, so disable it. + /// General-purpose default behavior is 'disabled', since effect is + /// environment-specific and side-effects might be surprising. DEFOPT_BINDADDR = OPT_BINDADDR_NO, #endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING = 1) */ - // - /// Define the interpretation of 'NULL' as a recv interface specification. - // If the interface part of a multicast address specification is NULL, it - // will be interpreted to mean either "the default interface" or "all - // interfaces", depending on the setting of this option. - // Notes: - // - The 'nulliface_all' option can not be used in environments which do - // not fully support the <ACE_Sock_Connect::get_ip_interfaces> method - // (e.g. non-Windows). - // If it is, using NULL for iface will _always_ fail. - // - The default behavior in most IP stacks is to use the 'default' interface, - // where 'default' has rather ad-hoc semantics. - // - This applies only to receives, not sends (which always use only one - // interface; NULL means use the "system default" interface). - // Supported values: + + /* + * Define the interpretation of NULL as a join interface specification. + * If the interface part of a multicast address specification is NULL, it + * will be interpreted to mean either "the default interface" or "all + * interfaces", depending on the setting of this option. + * @note + * - The @c OPT_NULLIFACE_ALL option can be used only in the following + * environments: + * + Windows + * + Platforms with the ACE_HAS_GETIFADDRS config setting (includes + * Linux) + * + Platforms which accept the IP address as an interface + * name/specification and for which + * ACE_Sock_Connect::get_ip_interfaces() is fully implemented + * + Systems with only one non-loopback interface. + * Other platforms require additional supporting code. + * - The default behavior in most IP stacks is to use the default + * interface where "default" has rather ad-hoc semantics. + * - This applies only to receives, not sends (which always use only one + * interface; NULL means use the "system default" interface). + */ + /// Supported values: /// If (net_if==NULL), use default interface. - // Note that this might seem odd, but we need a way to distinquish between - // default behavior, which might or might not be to bind, and explicitely - // choosing to bind or not to bind--which "is the question." ;-) + /// @note This might seem odd, but we need a way to distinguish between + /// default behavior, which might or might not be to bind, and explicitly + /// choosing to bind or not to bind--which "is the question." ;-) OPT_NULLIFACE_ONE = 0, /// If (net_if==NULL), use all mcast interfaces. OPT_NULLIFACE_ALL = 2, /// Default value for NULLIFACE option. (Environment-dependent.) #ifdef ACE_WIN32 - // This is the (ad-hoc) legacy behavior for Win32/WinSock. - // Notice: Older version of WinSock/MSVC may not get all multicast-capable - // interfaces (e.g. PPP interfaces). + /// This is the (ad-hoc) legacy behavior for Win32/WinSock. + /// @note Older version of WinSock/MSVC may not get all multicast-capable + /// interfaces (e.g. PPP interfaces). DEFOPT_NULLIFACE = OPT_NULLIFACE_ALL, #else - // General-purpose default behavior (as per legacy behavior). + /// General-purpose default behavior (as per legacy behavior). DEFOPT_NULLIFACE = OPT_NULLIFACE_ONE, #endif /* ACE_WIN32 */ /// All default options. @@ -179,48 +195,53 @@ public: // = Initialization routines. - /// Ctor - Create an unitialized instance and define per-instance optional + /// Create an unitialized instance and define per-instance optional /// functionality. /** - * You must invoke <open> or <subscribe>, to create/bind a socket and define + * You must invoke open() or join(), to create/bind a socket and define * operational parameters, before performing any I/O with this instance. */ ACE_SOCK_Dgram_Mcast (options opts = DEFOPTS); - /// Dtor - Release all resources and implicitly or explicitly unsubscribe + /// Release all resources and implicitly or explicitly unsubscribe /// from all currently subscribed groups. /** - * The OPT_DTORUNSUB_YES_ option defines whether an explicit <unsusbcribe> is + * The OPT_DTORUNSUB_YES_ option defines whether an explicit unsubscribe() is * done by the destructor. If not, most systems will automatically * unsubscribe upon the close of the socket. */ ~ACE_SOCK_Dgram_Mcast (void); - /// Explicitly open/bind the socket and define the network interface - /// and default multicast address used for sending messages. /** + * Explicitly open/bind the socket and define the network interface + * and default multicast address used for sending messages. + * * This method is optional; if not explicitly invoked, it is invoked by - * the first <subscribe>, using the subscribed address/port# and network + * the first join(), using the subscribed address/port number and network * interface parameters. - * The @a mcast_addr parameter defines the default send address/port# and - * also the port# and, if the OPT_BINDADDR_YES option is used, - * the multicast address that is bound to this socket. - * If the <send_net_if> parameter != 0, it defines the network interface - * used for all sends by this instance, otherwise the system "default" - * interface is used. (The <send_net_if> parameter is ignored if this - * feature is not supported by the environment.) - * The port# in <mcast_addr> may be 0, in which case a system-assigned - * (ephemeral) port# is used for sending and receiving. - * If @a reuse_addr != 0, the SO_REUSEADDR option and, if it is supported, - * the SO_REUSEPORT option are enabled. * - * Returns: -1 if the call fails. Failure can occur due to problems with - * the address, port#, and/or interface parameters or during system open() + * @param mcast_addr Defines the default send address/port number and, + * if the @c OPT_BINDADDR_YES option is used, the multicast address + * that is bound to this socket. The port number in @a mcast_addr + * may be 0, in which case a system-assigned (ephemeral) port number + * is used for sending and receiving. + * + * @param net_if If @a net_if is not 0, it defines the network interface + * used for all sends by this instance, otherwise the system default + * interface is used. (The @a net_if parameter is ignored if this + * feature is not supported by the environment.) + * + * @param reuse_addr If @a reuse_addr is not 0, the @c SO_REUSEADDR option + * and, if it is supported, the SO_REUSEPORT option are enabled. + * + * @retval 0 on success + * @retval -1 if the call fails. Failure can occur due to problems with + * the address, port, and/or interface parameters or during system open() * or socket option processing. */ - int open (const ACE_INET_Addr &mcast_addr, // Bound & sendto address. - const ACE_TCHAR *net_if = 0, // Net interface for sends. - int reuse_addr = 1); // Reuse addr/port sock opt. + int open (const ACE_INET_Addr &mcast_addr, + const ACE_TCHAR *net_if = 0, + int reuse_addr = 1); // = Multicast group subscribe/unsubscribe routines. @@ -228,27 +249,27 @@ public: /// supported). /** * The given group is joined on the specified interface. If option - * OPT_NULLIFACE_ALL is used and <net_if> is = 0, the group is joined on + * OPT_NULLIFACE_ALL is used and @a net_if is = 0, the group is joined on * all multicast capable interfaces (IFF supported). Multiple subscriptions * to various address and interface combinations are supported and tracked. - * If this is the first invocation of <subscribe>, and <open> was not - * previously invoked, <open> will be invoked using <mcast_addr> for binding - * the socket and <net_if> as the interface for <send>. + * If this is the first invocation of subscribe(), and open() was not + * previously invoked, open() will be invoked using @a mcast_addr for binding + * the socket and @a net_if as the interface for send(). * * Returns: -1 if the call fails. Failure can occur due to problems with * the address, port#, and/or interface parameters or during the subscription - * attempt. Once bind() has been invoked (by the first <open> or - * <subscribe>), returns errno of ENXIO if the port# is not 0 and does not + * attempt. Once bind() has been invoked (by the first open() or + * subscribe()), returns errno of ENXIO if the port# is not 0 and does not * match the bound port#, or if OPT_BINDADDR_YES option is used * and the address does not match the bound address. Returns errno of * ENODEV if the addr/port#/interface parameters appeared valid, but no * subscription(s) succeeded. An error is unconditionally returned if - * option OPT_NULLIFACE_ALL is used, <net_if> is NULL, and - * <ACE_Sock_Connect::get_ip_interfaces> is not implemented in this + * option OPT_NULLIFACE_ALL is used, @a net_if is NULL, and + * ACE_Sock_Connect::get_ip_interfaces() is not implemented in this * environment. * * Note that the optional @a reuse_addr parameter does not apply to - * subscriptions; it is only used if <open> is implicitly invoked (see above). + * subscriptions; it is only used if open() is implicitly invoked (see above). * * Uses the mcast_addr to determine protocol_family, and protocol which * we always pass as 0 anyway. @@ -262,15 +283,15 @@ public: /// supported). /** * The specified group/interface combination is unsubscribed. If option - * OPT_NULLIFACE_ALL is used and <net_if> is = 0, the group is unsubscribed + * OPT_NULLIFACE_ALL is used and @a net_if is = 0, the group is unsubscribed * from all interfaces (IFF supported). * * Returns: -1 if the unsubscribe failed. Most environments will return -1 * if there was no active subscription for this address/interface combination. * An error is unconditionally returned if option OPT_NULLIFACE_ALL is used, - * <net_if> is = 0, and <ACE_Sock_Connect::get_ip_interfaces> is not - * implemented in this environment (_even if_ the <subscribe> specifies a - * non- NULL <net_if>). + * @a net_if is = 0, and ACE_Sock_Connect::get_ip_interfaces() is not + * implemented in this environment (_even if_ the subscribe() specifies a + * non- NULL @a net_if). * * leave() replaces unsubscribe() and uses mcast_addr to determine * protocol_family, and protocol which we always pass as 0 anyway. @@ -281,13 +302,13 @@ public: // = Data transfer routines. /// Send @a n bytes in @a buf, using the multicast address and network interface - /// defined by the first <open> or <subscribe>. + /// defined by the first open() or subscribe(). ssize_t send (const void *buf, size_t n, int flags = 0) const; - /// Send @a n <iovecs>, using the multicast address and network interface - /// defined by the first <open> or <subscribe>. + /// Send @a n iovecs, using the multicast address and network interface + /// defined by the first open() or subscribe(). ssize_t send (const iovec iov[], int n, int flags = 0) const; @@ -318,6 +339,14 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; + /// Override write acessor for the constructor options (@see enum options above) + /// This class is typically default instantiated in a connection handler templated + /// framework so these cannot be specified on construction. + void opts (int opts); + + /// Read acessor for the constructor options (@see enum options above) + int opts () const; + private: /// Subscribe to a multicast address on one or more network interface(s). @@ -356,9 +385,9 @@ private: /// Per-instance options.. int opts_; - /// Multicast address to which local <send> methods send datagrams. + /// Multicast address to which local send() methods send datagrams. ACE_INET_Addr send_addr_; - /// Network interface to which all <send> methods send multicast datagrams. + /// Network interface to which all send() methods send multicast datagrams. ACE_TCHAR *send_net_if_; #if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) diff --git a/dep/acelite/ace/SOCK_Dgram_Mcast.inl b/dep/acelite/ace/SOCK_Dgram_Mcast.inl index 75457d32d92..d5f1ecbd17d 100644 --- a/dep/acelite/ace/SOCK_Dgram_Mcast.inl +++ b/dep/acelite/ace/SOCK_Dgram_Mcast.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: SOCK_Dgram_Mcast.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: SOCK_Dgram_Mcast.inl 96014 2012-08-08 15:30:01Z sma $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -49,4 +49,16 @@ ACE_SOCK_Dgram_Mcast::send (const iovec iov[], flags); } +ACE_INLINE void +ACE_SOCK_Dgram_Mcast::opts (int opts) +{ + this->opts_ = opts; +} + +ACE_INLINE int +ACE_SOCK_Dgram_Mcast::opts () const +{ + return this->opts_; +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/SOCK_Stream.h b/dep/acelite/ace/SOCK_Stream.h index a96d7e664ef..97dc8f70858 100644 --- a/dep/acelite/ace/SOCK_Stream.h +++ b/dep/acelite/ace/SOCK_Stream.h @@ -4,7 +4,7 @@ /** * @file SOCK_Stream.h * - * $Id: SOCK_Stream.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: SOCK_Stream.h 92956 2010-12-29 16:12:31Z shuston $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -78,7 +78,10 @@ public: * wait indefinitely or until an error occurs for the * specified number of bytes to be transferred. * To avoid any waiting, specify a timeout value with - * 0 seconds. + * 0 seconds. Note that the timeout period restarts on + * each retried operation issued; therefore, an operation + * that requires multiples retries may take longer than the + * specified timeout to complete. * @param bytes_transferred If non-0, points to a location which receives * the total number of bytes transferred before the method * returns, even if it's less than the number requested. diff --git a/dep/acelite/ace/SPIPE_Acceptor.h b/dep/acelite/ace/SPIPE_Acceptor.h index 84529c76582..a804670d061 100644 --- a/dep/acelite/ace/SPIPE_Acceptor.h +++ b/dep/acelite/ace/SPIPE_Acceptor.h @@ -4,7 +4,7 @@ /** * @file SPIPE_Acceptor.h * - * $Id: SPIPE_Acceptor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * $Id: SPIPE_Acceptor.h 94007 2011-04-27 09:01:45Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Prashant Jain <pjain@cs.wustl.edu> @@ -148,7 +148,7 @@ private: DWORD pipe_mode_; // On Windows, the handle maintained in the ACE_IPC_SAP class is the - // event handle from event_. The pipe handle is useless for telling + // event handle from event. The pipe handle is useless for telling // when a pipe connect is done/ready, and it changes on each pipe // acceptance, quite unlike other acceptor-type classes in ACE. // This allows the get_handle()-obtained handle to be used for diff --git a/dep/acelite/ace/SPIPE_Stream.inl b/dep/acelite/ace/SPIPE_Stream.inl index d490f88f145..0aa53269079 100644 --- a/dep/acelite/ace/SPIPE_Stream.inl +++ b/dep/acelite/ace/SPIPE_Stream.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: SPIPE_Stream.inl 88707 2010-01-25 18:49:25Z johnnyw $ +// $Id: SPIPE_Stream.inl 93061 2011-01-12 21:06:07Z wotte $ #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_errno.h" @@ -139,7 +139,7 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const } return 0; #else - handle = handle; + ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_STREAM_PIPES */ } @@ -195,7 +195,7 @@ ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const } return 0; #else - handle = handle; + ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_STREAM_PIPES */ } diff --git a/dep/acelite/ace/SSL/SSL_Context.cpp b/dep/acelite/ace/SSL/SSL_Context.cpp index 992cdeff921..c6cf6adcdf8 100644 --- a/dep/acelite/ace/SSL/SSL_Context.cpp +++ b/dep/acelite/ace/SSL/SSL_Context.cpp @@ -1,4 +1,4 @@ -// $Id: SSL_Context.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: SSL_Context.cpp 93497 2011-03-07 09:43:36Z vzykov $ #include "SSL_Context.h" #include "sslconf.h" @@ -202,9 +202,6 @@ ACE_SSL_Context::ssl_library_fini (void) --ssl_library_init_count; if (ssl_library_init_count == 0) { - // Explicitly close the singleton - ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::close(); - ::ERR_free_strings (); ::EVP_cleanup (); @@ -216,7 +213,6 @@ ACE_SSL_Context::ssl_library_fini (void) delete [] this->locks_; this->locks_ = 0; - #endif /* ACE_HAS_THREADS */ } } @@ -645,8 +641,8 @@ ACE_SSL_Context::dh_params (const char *file_name, #if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) -template ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX> * - ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::singleton_; +template ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX> * + ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::singleton_; #endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ diff --git a/dep/acelite/ace/SSL/SSL_Context.h b/dep/acelite/ace/SSL/SSL_Context.h index 003d6042c5b..4ad127557a1 100644 --- a/dep/acelite/ace/SSL/SSL_Context.h +++ b/dep/acelite/ace/SSL/SSL_Context.h @@ -1,17 +1,15 @@ // -*- C++ -*- - //============================================================================= /** * @file SSL_Context.h * - * $Id: SSL_Context.h 83916 2008-11-28 16:32:21Z johnnyw $ + * $Id: SSL_Context.h 96087 2012-08-21 12:26:44Z sma $ * * @author Carlos O'Ryan <coryan@ece.uci.edu> * @author Ossama Othman <ossama@dre.vanderbilt.edu> */ //============================================================================= - #ifndef ACE_SSL_CONTEXT_H #define ACE_SSL_CONTEXT_H @@ -31,13 +29,11 @@ #include <openssl/ssl.h> - ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_SSL_Export ACE_SSL_Data_File { public: - /// Default constructor ACE_SSL_Data_File (void); @@ -52,7 +48,6 @@ public: int type (void) const; private: - /// The file name ACE_CString file_name_; @@ -62,6 +57,34 @@ private: // **************************************************************** +// NOTE: Solaris studio compilers amongst others will issue warnings if the +// the correct type of function pointer (i.e. extern "C" ) is not stored/used +// of the form: +// Warning (Anachronism): Formal argument callback of type +// extern "C" int(*)(int,x509_store_ctx_st*) in call to +// SSL_CTX_set_verify(ssl_ctx_st*, int, extern "C" int(*)(int,x509_store_ctx_st*)) +// is being passed int(*)(int,x509_store_ctx_st*) +// when C library routines are passed CallBack functions pointers that are +// actually C++ functions. +// +// Unfortunatly you can not specify extern "C" linkage anywhere inside a class +// declaration or inside a function prototype for individual parameters. I.e: +// class { extern "C" int (*callback_) (int, void *); }; +// to store a function pointer as a data member of the class is illegal as is: +// void function (extern "C" int (*callback) (int, void *); +// to declare function (or a class member) that takes a extern "C" function +// pointer as a parameter. +// +// Since we need an extern "C" function pointer as a parameter to be stored +// in the class and handled by member functions, we are forced to declare +// a typedef of that extern "C" function pointer that we can then use. +// Again unfortunatly you also are not allowed to simply add the extern "C" +// to the typedef itself, instead you have to place the typedef declaration +// inside an extern "C" block, thus: + +extern "C" { + typedef int (*extern_C_CallBackVerify_t) (int, X509_STORE_CTX *); +} /** * @class ACE_SSL_Context @@ -75,7 +98,6 @@ private: class ACE_SSL_Export ACE_SSL_Context { public: - #ifdef ACE_HAS_THREADS typedef ACE_SYNCH_MUTEX lock_type; #endif /* ACE_HAS_THREADS */ @@ -235,7 +257,6 @@ public: */ int have_trusted_ca (void) const; - /** * @todo Complete this documentation where elipses(...) are used * @@ -284,8 +305,8 @@ public: * inherited by all the ACE_SSL objects created using the context. * It can be overriden on a per-ACE_SSL object. */ - void default_verify_callback (int (*callback) (int, X509_STORE_CTX *)); - int (*default_verify_callback(void) const) (int,X509_STORE_CTX *); + void default_verify_callback (extern_C_CallBackVerify_t); + extern_C_CallBackVerify_t default_verify_callback (void) const; /** * @name OpenSSL Random Number Generator Seed Related Methods @@ -339,7 +360,6 @@ public: //@} private: - /// Verify if the context has been initialized or not. void check_context (void); @@ -354,7 +374,6 @@ private: //@} private: - /// The SSL_CTX structure SSL_CTX *context_; @@ -370,7 +389,7 @@ private: int default_verify_mode_; /// The default verify callback. - int (*default_verify_callback_)(int, X509_STORE_CTX *); + extern_C_CallBackVerify_t default_verify_callback_; /// count of successful CA load attempts int have_ca_; @@ -380,7 +399,6 @@ private: /// application is multithreaded. static lock_type * locks_; #endif /* ACE_HAS_THREADS */ - }; ACE_END_VERSIONED_NAMESPACE_DECL @@ -390,5 +408,4 @@ ACE_END_VERSIONED_NAMESPACE_DECL #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" - #endif /* ACE_SSL_CONTEXT_H */ diff --git a/dep/acelite/ace/SSL/SSL_Context.inl b/dep/acelite/ace/SSL/SSL_Context.inl index 7ecb3e0627e..65370672a8e 100644 --- a/dep/acelite/ace/SSL/SSL_Context.inl +++ b/dep/acelite/ace/SSL/SSL_Context.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: SSL_Context.inl 83916 2008-11-28 16:32:21Z johnnyw $ +// $Id: SSL_Context.inl 96087 2012-08-21 12:26:44Z sma $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -100,12 +100,12 @@ ACE_SSL_Context::default_verify_mode (void) const } ACE_INLINE void -ACE_SSL_Context::default_verify_callback (int (*callback) (int, X509_STORE_CTX*)) +ACE_SSL_Context::default_verify_callback (extern_C_CallBackVerify_t callback) { this->default_verify_callback_ = callback; } -ACE_INLINE int (*ACE_SSL_Context::default_verify_callback(void) const)(int,X509_STORE_CTX *) +ACE_INLINE extern_C_CallBackVerify_t ACE_SSL_Context::default_verify_callback(void) const { return this->default_verify_callback_; } diff --git a/dep/acelite/ace/SSL/SSL_Initializer.cpp b/dep/acelite/ace/SSL/SSL_Initializer.cpp new file mode 100644 index 00000000000..4903e60815c --- /dev/null +++ b/dep/acelite/ace/SSL/SSL_Initializer.cpp @@ -0,0 +1,44 @@ +// $Id: SSL_Initializer.cpp 93497 2011-03-07 09:43:36Z vzykov $ + +#include "SSL_Initializer.h" +#include "SSL_Context.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +int +ACE_SSL_Initializer::static_init (void) +{ + ACE_Service_Config::process_directive (ace_svc_desc_ACE_SSL_Initializer); + return 0; +} + +int +ACE_SSL_Initializer::init (int, ACE_TCHAR *[]) +{ + // Initialize ACE_SSL_Context singleton. + ACE_SSL_Context * ssl_ctx = ACE_SSL_Context::instance (); + ACE_ASSERT (ssl_ctx != 0); + ACE_UNUSED_ARG (ssl_ctx); + + return 0; +} + +int +ACE_SSL_Initializer::fini (void) +{ + // Explicitly close the ACE_SSL_Context singleton. + ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::close(); + + return 0; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DEFINE (ACE_SSL_Initializer, + ACE_TEXT ("ACE_SSL_Initializer"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (ACE_SSL_Initializer), + ACE_Service_Type::DELETE_THIS | + ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (ACE_SSL, ACE_SSL_Initializer) diff --git a/dep/acelite/ace/SSL/SSL_Initializer.h b/dep/acelite/ace/SSL/SSL_Initializer.h new file mode 100644 index 00000000000..1d15a73159c --- /dev/null +++ b/dep/acelite/ace/SSL/SSL_Initializer.h @@ -0,0 +1,52 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file SSL_Initializer.h + * + * $Id: SSL_Initializer.h 93497 2011-03-07 09:43:36Z vzykov $ + * + * @author Vladimir Zykov <vz@prismtech.com> + */ +//============================================================================= + +#ifndef ACE_SSL_INITIALIZER_H +#define ACE_SSL_INITIALIZER_H + +#include /**/ "ace/pre.h" + +#include "SSL_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "ace/Service_Object.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_SSL_Export ACE_SSL_Initializer + : public ACE_Service_Object +{ +public: + /// Used to force the initialization of ACE_SSL. + static int static_init (void); + + /// Create ACE_SSL_Context singleton. + virtual int init (int argc, ACE_TCHAR *argv[]); + + /// Do cleanup of SSL library. + virtual int fini (void); +}; + +static int ACE_Force_ACE_SSL_Initializer = ACE_SSL_Initializer::static_init (); + +ACE_END_VERSIONED_NAMESPACE_DECL + +ACE_STATIC_SVC_DECLARE (ACE_SSL_Initializer) +ACE_FACTORY_DECLARE (ACE_SSL, ACE_SSL_Initializer) + +#include /**/ "ace/post.h" + +#endif /* ACE_SSL_INITIALIZER_H */ diff --git a/dep/acelite/ace/SString.cpp b/dep/acelite/ace/SString.cpp index 5a087e3e0a9..db66850fda4 100644 --- a/dep/acelite/ace/SString.cpp +++ b/dep/acelite/ace/SString.cpp @@ -1,4 +1,4 @@ -// $Id: SString.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: SString.cpp 92580 2010-11-15 09:48:02Z johnnyw $ #include "ace/Malloc_T.h" #include "ace/OS_Memory.h" @@ -79,7 +79,7 @@ ACE_NS_WString::char_rep (void) const } } -ACE_USHORT16 * +ACE_UINT16 * ACE_NS_WString::ushort_rep (void) const { ACE_TRACE ("ACE_NS_WString::ushort_rep"); @@ -87,16 +87,16 @@ ACE_NS_WString::ushort_rep (void) const return 0; else { - ACE_USHORT16 *t = 0; + ACE_UINT16 *t = 0; ACE_NEW_RETURN (t, - ACE_USHORT16[this->len_ + 1], + ACE_UINT16[this->len_ + 1], 0); for (size_type i = 0; i < this->len_; ++i) // Note that this cast may lose data if wide chars are // actually used! - t[i] = (ACE_USHORT16)this->rep_[i]; + t[i] = (ACE_UINT16)this->rep_[i]; t[this->len_] = 0; return t; @@ -125,7 +125,7 @@ ACE_NS_WString::ACE_NS_WString (const char *s, } #if defined (ACE_WSTRING_HAS_USHORT_SUPPORT) -ACE_NS_WString::ACE_NS_WString (const ACE_USHORT16 *s, +ACE_NS_WString::ACE_NS_WString (const ACE_UINT16 *s, size_type len, ACE_Allocator *alloc) : ACE_WString (alloc) diff --git a/dep/acelite/ace/SString.h b/dep/acelite/ace/SString.h index e7ff8ea7872..3c5f9957be7 100644 --- a/dep/acelite/ace/SString.h +++ b/dep/acelite/ace/SString.h @@ -4,7 +4,7 @@ /** * @file SString.h * - * $Id: SString.h 91058 2010-07-12 08:20:09Z johnnyw $ + * $Id: SString.h 92580 2010-11-15 09:48:02Z johnnyw $ * * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) */ @@ -75,7 +75,7 @@ public: #if defined (ACE_WSTRING_HAS_USHORT_SUPPORT) /// Constructor that takes in a ushort16 string (mainly used by the /// ACE Name_Space classes) - ACE_NS_WString (const ACE_USHORT16 *s, + ACE_NS_WString (const ACE_UINT16 *s, size_type len, ACE_Allocator *alloc = 0); #endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */ @@ -102,7 +102,7 @@ public: /// Transform into a copy of a USHORT16 representation (caller must /// delete). Note, behavior is undefined when sizeof (wchar_t) != 2. - ACE_USHORT16 *ushort_rep (void) const; + ACE_UINT16 *ushort_rep (void) const; }; ACE_Export diff --git a/dep/acelite/ace/Sample_History.cpp b/dep/acelite/ace/Sample_History.cpp index 78a7558703f..5c9e24417d3 100644 --- a/dep/acelite/ace/Sample_History.cpp +++ b/dep/acelite/ace/Sample_History.cpp @@ -1,4 +1,4 @@ -// $Id: Sample_History.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Sample_History.cpp 95747 2012-05-13 17:14:12Z johnnyw $ #include "ace/Sample_History.h" @@ -10,9 +10,6 @@ #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" - - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Sample_History::ACE_Sample_History (size_t max_samples) @@ -27,21 +24,10 @@ ACE_Sample_History::~ACE_Sample_History (void) delete[] this->samples_; } -size_t -ACE_Sample_History::max_samples (void) const -{ - return this->max_samples_; -} - -size_t -ACE_Sample_History::sample_count (void) const -{ - return this->sample_count_; -} - void -ACE_Sample_History::dump_samples (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const +ACE_Sample_History::dump_samples ( + const ACE_TCHAR *msg, + ACE_Sample_History::scale_factor_type scale_factor) const { #ifndef ACE_NLOGGING for (size_t i = 0; i != this->sample_count_; ++i) diff --git a/dep/acelite/ace/Sample_History.h b/dep/acelite/ace/Sample_History.h index 730deea4fab..c31c5692360 100644 --- a/dep/acelite/ace/Sample_History.h +++ b/dep/acelite/ace/Sample_History.h @@ -4,7 +4,7 @@ /** * @file Sample_History.h * - * $Id: Sample_History.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Sample_History.h 95747 2012-05-13 17:14:12Z johnnyw $ * * @author Carlos O'Ryan <coryan@uci.edu> */ @@ -34,6 +34,12 @@ class ACE_Basic_Stats; class ACE_Export ACE_Sample_History { public: +#if !defined (ACE_WIN32) + typedef ACE_UINT32 scale_factor_type; +#else + typedef ACE_UINT64 scale_factor_type; +#endif + /// Constructor /** * The number of samples is pre-allocated, and cannot changes once @@ -62,7 +68,7 @@ public: * message. */ void dump_samples (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor) const; + scale_factor_type scale_factor) const; /// Collect the summary for all the samples void collect_basic_stats (ACE_Basic_Stats &) const; diff --git a/dep/acelite/ace/Sample_History.inl b/dep/acelite/ace/Sample_History.inl index 9945bfe14ec..8d7d7c9b5f7 100644 --- a/dep/acelite/ace/Sample_History.inl +++ b/dep/acelite/ace/Sample_History.inl @@ -1,6 +1,5 @@ // -*- C++ -*- -// -// $Id: Sample_History.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Sample_History.inl 95747 2012-05-13 17:14:12Z johnnyw $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -23,4 +22,16 @@ ACE_Sample_History::get_sample (size_t i) const return this->samples_[i]; } +ACE_INLINE size_t +ACE_Sample_History::max_samples (void) const +{ + return this->max_samples_; +} + +ACE_INLINE size_t +ACE_Sample_History::sample_count (void) const +{ + return this->sample_count_; +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Sched_Params.cpp b/dep/acelite/ace/Sched_Params.cpp index 5002f52a797..8aee95bfc58 100644 --- a/dep/acelite/ace/Sched_Params.cpp +++ b/dep/acelite/ace/Sched_Params.cpp @@ -3,7 +3,7 @@ /** * @file Sched_Params.cpp * - * $Id: Sched_Params.cpp 91286 2010-08-05 09:04:31Z johnnyw $ + * $Id: Sched_Params.cpp 95761 2012-05-15 18:23:04Z johnnyw $ * * @author David Levine */ @@ -84,9 +84,7 @@ ACE_Sched_Params::priority_min (const Policy policy, } } #elif defined(ACE_HAS_PTHREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ - defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - + (!defined(ACE_LACKS_SETSCHED)) switch (scope) { case ACE_SCOPE_THREAD: @@ -192,7 +190,7 @@ ACE_Sched_Params::priority_max (const Policy policy, } } #elif defined(ACE_HAS_PTHREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ + (!defined(ACE_LACKS_SETSCHED) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) switch (scope) @@ -274,7 +272,7 @@ ACE_Sched_Params::next_priority (const Policy policy, return priority; // unknown priority: should never get here } #elif defined(ACE_HAS_THREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ + (!defined(ACE_LACKS_SETSCHED) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) // including STHREADS, and PTHREADS int const max = priority_max (policy, scope); @@ -318,7 +316,7 @@ ACE_Sched_Params::previous_priority (const Policy policy, return priority; // unknown priority: should never get here } #elif defined(ACE_HAS_THREADS) && \ - (!defined(ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ + (!defined(ACE_LACKS_SETSCHED) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) // including STHREADS and PTHREADS int const min = priority_min (policy, scope); diff --git a/dep/acelite/ace/Select_Reactor_Base.cpp b/dep/acelite/ace/Select_Reactor_Base.cpp index 2165d6e16c2..d160c5c122e 100644 --- a/dep/acelite/ace/Select_Reactor_Base.cpp +++ b/dep/acelite/ace/Select_Reactor_Base.cpp @@ -1,4 +1,4 @@ -// $Id: Select_Reactor_Base.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Select_Reactor_Base.cpp 95574 2012-02-29 07:26:08Z johnnyw $ #include "ace/Select_Reactor_Base.h" #include "ace/Reactor.h" @@ -530,7 +530,8 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const ACE_ALLOC_HOOK_DEFINE(ACE_Select_Reactor_Handler_Repository_Iterator) ACE_Select_Reactor_Notify::ACE_Select_Reactor_Notify (void) - : max_notify_iterations_ (-1) + : select_reactor_ (0) + , max_notify_iterations_ (-1) { } @@ -599,8 +600,7 @@ ACE_Select_Reactor_Notify::open (ACE_Reactor_Impl *r, if (disable_notify_pipe == 0) { - this->select_reactor_ = - dynamic_cast<ACE_Select_Reactor_Impl *> (r); + this->select_reactor_ = dynamic_cast<ACE_Select_Reactor_Impl *> (r); if (select_reactor_ == 0) { diff --git a/dep/acelite/ace/Select_Reactor_Base.h b/dep/acelite/ace/Select_Reactor_Base.h index 7902791624b..851fea0d662 100644 --- a/dep/acelite/ace/Select_Reactor_Base.h +++ b/dep/acelite/ace/Select_Reactor_Base.h @@ -4,7 +4,7 @@ /** * @file Select_Reactor_Base.h * - * $Id: Select_Reactor_Base.h 87252 2009-10-28 20:03:48Z cleeland $ + * $Id: Select_Reactor_Base.h 93792 2011-04-07 11:48:50Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -92,7 +92,6 @@ public: class ACE_Event_Tuple { public: - /// Default constructor. ACE_Event_Tuple (void); @@ -106,7 +105,6 @@ public: bool operator!= (const ACE_Event_Tuple &rhs) const; public: - /// Handle. ACE_HANDLE handle_; diff --git a/dep/acelite/ace/Select_Reactor_T.cpp b/dep/acelite/ace/Select_Reactor_T.cpp index b70b2d427c3..fde3ea3fcd1 100644 --- a/dep/acelite/ace/Select_Reactor_T.cpp +++ b/dep/acelite/ace/Select_Reactor_T.cpp @@ -1,4 +1,4 @@ -// $Id: Select_Reactor_T.cpp 92201 2010-10-11 19:07:59Z johnnyw $ +// $Id: Select_Reactor_T.cpp 95533 2012-02-14 22:59:17Z wotte $ #ifndef ACE_SELECT_REACTOR_T_CPP #define ACE_SELECT_REACTOR_T_CPP @@ -461,7 +461,14 @@ template <class ACE_SELECT_REACTOR_TOKEN> int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::timer_queue (ACE_Timer_Queue *tq) { - delete this->timer_queue_; + if (this->delete_timer_queue_) + { + delete this->timer_queue_; + } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + } this->timer_queue_ = tq; this->delete_timer_queue_ = false; return 0; @@ -495,6 +502,9 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ACE_Select_Reactor_T // determine the size at run-time by checking the process file // descriptor limit on platforms that support this feature. + // reset the errno so that subsequent checks are valid + errno = 0; + // There is no need to deallocate resources from previous open() // call since the open() method deallocates any resources prior // to exiting if an error was encountered. @@ -573,6 +583,11 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::close (void) this->timer_queue_ = 0; this->delete_timer_queue_ = false; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + this->timer_queue_ = 0; + } if (this->notify_handler_ != 0) this->notify_handler_->close (); @@ -764,14 +779,14 @@ template <class ACE_SELECT_REACTOR_TOKEN> int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handle_error (void) { ACE_TRACE ("ACE_Select_Reactor_T::handle_error"); -#if defined (linux) && defined (ERESTARTNOHAND) +#if defined (ACE_LINUX) && defined (ERESTARTNOHAND) int const error = errno; // Avoid multiple TSS accesses. if (error == EINTR || error == ERESTARTNOHAND) return this->restart_; #else if (errno == EINTR) return this->restart_; -#endif /* linux && ERESTARTNOHAND */ +#endif /* ACE_LINUX && ERESTARTNOHAND */ #if defined (__MVS__) || defined (ACE_WIN32) || defined (ACE_VXWORKS) // On MVS Open Edition and Win32, there can be a number of failure // codes on a bad socket, so check_handles on anything other than @@ -1402,15 +1417,25 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handle_events ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1); - if (ACE_OS::thr_equal (ACE_Thread::self (), - this->owner_) == 0 || this->deactivated_) - return -1; + if (ACE_OS::thr_equal (ACE_Thread::self (), this->owner_) == 0) + { + errno = EACCES; + return -1; + } + if (this->deactivated_) + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the mutex. countdown.update (); #else if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } #endif /* ACE_MT_SAFE */ return this->handle_events_i (max_wait_time); diff --git a/dep/acelite/ace/Select_Reactor_T.h b/dep/acelite/ace/Select_Reactor_T.h index 9e7411ef985..a9737c1e872 100644 --- a/dep/acelite/ace/Select_Reactor_T.h +++ b/dep/acelite/ace/Select_Reactor_T.h @@ -4,7 +4,7 @@ /** * @file Select_Reactor_T.h * - * $Id: Select_Reactor_T.h 86495 2009-08-13 19:35:25Z johnnyw $ + * $Id: Select_Reactor_T.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -60,7 +60,7 @@ public: /// If @a disable_notify_pipe is non-0 then the reactor will /// not create a notification pipe, which will save two I/O handles - /// but will elide the <notify()> feature. If @a mask_signals is + /// but will elide the notify() feature. If @a mask_signals is /// true the reactor is "signal-safe" when dispatching handlers to /// signal events, whereas if @a mask_signals is false the reactor will /// be more efficient, but not signal-safe (which may be perfectly @@ -106,7 +106,7 @@ public: * timer queue, respectively. If @arg disable_notify_pipe is non-0 the * notification pipe is not created, thereby saving two I/O handles. * - * @note On Unix platforms, the maximum_number_of_handles parameter + * @note On Unix platforms, the @a maximum_number_of_handles parameter * should be as large as the maximum number of file * descriptors allowed for a given process. This is necessary * since a file descriptor is used to directly index the array @@ -148,6 +148,7 @@ public: */ virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); + //@{ /** * This event loop driver that blocks for @a max_wait_time before * returning. It will return earlier if timer events, I/O events, @@ -165,12 +166,14 @@ public: * that were dispatched, 0 if the @a max_wait_time elapsed without * dispatching any handlers, or -1 if something goes wrong. * - * Current <alertable_handle_events> is identical to - * <handle_events>. + * Current alertable_handle_events() is identical to + * handle_events(). */ virtual int handle_events (ACE_Time_Value *max_wait_time = 0); virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0); + //@} + //@{ /** * This method is just like the one above, except the * @a max_wait_time value is a reference and can therefore never be @@ -181,6 +184,7 @@ public: */ virtual int handle_events (ACE_Time_Value &max_wait_time); virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); + //@} // = Event handling control. @@ -599,7 +603,7 @@ protected: virtual int any_ready (ACE_Select_Reactor_Handle_Set &handle_set); /// Implement the <any_ready> method, assuming that the Sig_Guard is - /// beign held + /// being held virtual int any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set); /// Take corrective action when errors occur. diff --git a/dep/acelite/ace/Select_Reactor_T.inl b/dep/acelite/ace/Select_Reactor_T.inl index 30c8cbc6b7d..54542427f79 100644 --- a/dep/acelite/ace/Select_Reactor_T.inl +++ b/dep/acelite/ace/Select_Reactor_T.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Select_Reactor_T.inl 82723 2008-09-16 09:35:44Z johnnyw $ +// $Id: Select_Reactor_T.inl 96017 2012-08-08 22:18:09Z mitza $ #include "ace/Reactor.h" #include "ace/Signal.h" @@ -221,7 +221,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop) ACE_MT (ACE_GUARD (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_)); - this->deactivated_ = do_stop; + this->deactivated_ = static_cast<sig_atomic_t> (do_stop); } this->wakeup_all_threads (); diff --git a/dep/acelite/ace/Service_Config.cpp b/dep/acelite/ace/Service_Config.cpp index d63f46c1b86..9149e98e43d 100644 --- a/dep/acelite/ace/Service_Config.cpp +++ b/dep/acelite/ace/Service_Config.cpp @@ -1,4 +1,4 @@ -// $Id: Service_Config.cpp 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: Service_Config.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/Service_Config.h" @@ -601,7 +601,8 @@ void ACE_Service_Config::reconfig_occurred (int config_occurred) { ACE_TRACE ("ACE_Service_Config::reconfig_occurred"); - ACE_Service_Config::reconfig_occurred_ = config_occurred; + ACE_Service_Config::reconfig_occurred_ = + static_cast<sig_atomic_t> (config_occurred); } ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Service_Config.h b/dep/acelite/ace/Service_Config.h index 5269d8f367e..56be51fde10 100644 --- a/dep/acelite/ace/Service_Config.h +++ b/dep/acelite/ace/Service_Config.h @@ -4,7 +4,7 @@ /** * @file Service_Config.h * - * $Id: Service_Config.h 89501 2010-03-17 08:59:56Z vzykov $ + * $Id: Service_Config.h 94385 2011-08-10 12:19:36Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -159,8 +159,8 @@ template<> class ACE_Export ACE_Threading_Helper<ACE_Thread_Mutex> { public: - ACE_Threading_Helper (); - ~ACE_Threading_Helper (); + ACE_Threading_Helper (void); + ~ACE_Threading_Helper (void); void set (void*); void* get (void); @@ -178,8 +178,8 @@ template<> class ACE_Export ACE_Threading_Helper<ACE_Null_Mutex> { public: - ACE_Threading_Helper (); - ~ACE_Threading_Helper (); + ACE_Threading_Helper (void); + ~ACE_Threading_Helper (void); void set (void*); void* get (void); diff --git a/dep/acelite/ace/Service_Gestalt.cpp b/dep/acelite/ace/Service_Gestalt.cpp index 29e2804b4b6..f177260ca4b 100644 --- a/dep/acelite/ace/Service_Gestalt.cpp +++ b/dep/acelite/ace/Service_Gestalt.cpp @@ -1,4 +1,4 @@ -// $Id: Service_Gestalt.cpp 92357 2010-10-25 14:11:44Z mesnier_p $ +// $Id: Service_Gestalt.cpp 95610 2012-03-13 11:26:31Z johnnyw $ #include "ace/Svc_Conf.h" #include "ace/Get_Opt.h" diff --git a/dep/acelite/ace/Service_Object.cpp b/dep/acelite/ace/Service_Object.cpp index 912fa39532c..4a9ace4029e 100644 --- a/dep/acelite/ace/Service_Object.cpp +++ b/dep/acelite/ace/Service_Object.cpp @@ -1,4 +1,4 @@ -// $Id: Service_Object.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Service_Object.cpp 93539 2011-03-13 09:40:44Z vzykov $ #include "ace/config-all.h" @@ -36,9 +36,9 @@ ACE_Service_Type::dump (void) const // the generated C++ code. ACE_OS::fprintf(stderr, "// [ST] dump, this=%p, name=%s, type=%p, so=%p, active=%d\n", - this, - this->name_, - this->type_, + static_cast<void const *> (this), + ACE_TEXT_ALWAYS_CHAR (this->name_), + static_cast<void const *> (this->type_), (this->type_ != 0) ? this->type_->object () : 0, this->active_); diff --git a/dep/acelite/ace/Service_Types.cpp b/dep/acelite/ace/Service_Types.cpp index b3f7d098054..b743536b304 100644 --- a/dep/acelite/ace/Service_Types.cpp +++ b/dep/acelite/ace/Service_Types.cpp @@ -1,4 +1,4 @@ -// $Id: Service_Types.cpp 91813 2010-09-17 07:52:52Z johnnyw $ +// $Id: Service_Types.cpp 95676 2012-04-03 16:32:27Z schmidt $ #include "ace/Service_Types.h" @@ -165,6 +165,7 @@ ACE_Module_Type::ACE_Module_Type (void *m, u_int f, int stype) : ACE_Service_Type_Impl (m, m_name, f, 0, stype) + , link_ (0) { ACE_TRACE ("ACE_Module_Type::ACE_Module_Type"); } @@ -181,12 +182,12 @@ ACE_Module_Type::init (int argc, ACE_TCHAR *argv[]) const void *obj = this->object (); MT_Module *mod = (MT_Module *) obj; // - // Change the Module's name to what's in the svc.conf file. - // We must do this so the names match up so everything shuts - // down properly during the call to ACE_Stream_Type::fini - // which calls MT_Stream::remove([name]) for all the modules. - // If the calls to remove fail, we end up with a double delete - // during shutdown. Bugzilla #3847 + // Change the Module's name to what's in the svc.conf file. We must + // do this so the names match up so everything shuts down properly + // during the call to ACE_Stream_Type::fini which calls + // MT_Stream::remove([name]) for all the modules. If the calls to + // remove fail, we end up with a double delete during + // shutdown. Bugzilla #3847 // mod->name (this->name_); MT_Task *reader = mod->reader (); diff --git a/dep/acelite/ace/Signal.h b/dep/acelite/ace/Signal.h index 736d62e5c08..5dc26ff7146 100644 --- a/dep/acelite/ace/Signal.h +++ b/dep/acelite/ace/Signal.h @@ -4,7 +4,7 @@ /** * @file Signal.h * - * $Id: Signal.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Signal.h 94454 2011-09-08 17:36:56Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -45,7 +45,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Sig_Set { public: - // = Initialization and termination methods. /// Initialize <sigset_> with @a sigset. If @a sigset == 0 then fill /// the set. ACE_Sig_Set (sigset_t *sigset); @@ -136,18 +135,6 @@ public: const ACE_Sig_Set &sigmask, int flags = 0); - - // @@ The next two methods have a parameter as "signalss". Please do - // not change the argument name as "signals". This causes the - // following problem as reported by - // <James.Briggs@dsto.defence.gov.au>. - - // In the file Signal.h two of the functions have and argument name - // of signals. signals is a Qt macro (to do with their meta object - // stuff. - // We could as well have it as "signal", but I am nost sure whether - // that would cause a problem with something else - Bala <bala@cs> - /** * Assigns the various fields of a @c sigaction struct and registers * the @a handler to process all @a signalss via the @c sigaction @@ -236,7 +223,7 @@ class ACE_Export ACE_Sig_Guard public: // = Initialization and termination methods. /// This is kind of conditional Guard, needed when guard should be - /// activated only when a spcific condition met. When condition == + /// activated only when a specific condition met. When condition == /// true (default), Guard is activated ACE_Sig_Guard (ACE_Sig_Set *mask = 0, bool condition = true); diff --git a/dep/acelite/ace/Sock_Connect.cpp b/dep/acelite/ace/Sock_Connect.cpp index ce2a17d2bf5..77c5e4af93f 100644 --- a/dep/acelite/ace/Sock_Connect.cpp +++ b/dep/acelite/ace/Sock_Connect.cpp @@ -1,4 +1,4 @@ -// $Id: Sock_Connect.cpp 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: Sock_Connect.cpp 95628 2012-03-21 22:10:02Z shuston $ #include "ace/Sock_Connect.h" #include "ace/INET_Addr.h" @@ -29,33 +29,16 @@ # endif /* _AIX */ #endif /* ACE_HAS_IPV6 */ -# if defined (ACE_HAS_GETIFADDRS) -# if defined (ACE_VXWORKS) -# include /**/ <net/ifaddrs.h> -# else -# include /**/ <ifaddrs.h> -# endif /*ACE_VXWORKS */ -# endif /* ACE_HAS_GETIFADDRS */ - -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) -#include /**/ <inetLib.h> -#include /**/ <netinet/in_var.h> -#if defined (ACE_HAS_IPV6) -#include /**/ <ifLib.h> -extern "C" { - extern struct in_ifaddr* in_ifaddr; - extern LIST_HEAD(in_ifaddrhashhead, in_ifaddr) *in_ifaddrhashtbl; -} -#endif /* ACE_HAS_IPV6 */ -#include "ace/OS_NS_stdio.h" -#endif /* ACE_VXWORKS < 0x600 */ +#if defined (ACE_HAS_GETIFADDRS) +# include "ace/os_include/os_ifaddrs.h" +#endif /* ACE_HAS_GETIFADDRS */ -#if defined (ACE_VXWORKS) && ((ACE_VXWORKS >= 0x630) && (ACE_VXWORKS <= 0x670)) && defined (__RTP__) && defined (ACE_HAS_IPV6) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670) && defined (__RTP__) && defined (ACE_HAS_IPV6) const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT; const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT; const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; -#endif /* ACE_VXWORKS >= 0x630 && <= 0x670 && __RTP__ && ACE_HAS_IPV6 */ +#endif /* ACE_VXWORKS <= 0x670 && __RTP__ && ACE_HAS_IPV6 */ #if defined (ACE_HAS_WINCE) #include /**/ <iphlpapi.h> @@ -146,17 +129,6 @@ namespace # define SA_FAMILY sa_family #endif /* ACE_HAS_IPV6 */ -// This is a hack to work around a problem with Visual Age C++ 5 and 6 on AIX. -// Without this, the compiler auto-instantiates the ACE_Auto_Array_Ptr for -// ifreq (contained in this module) but only adds the #include for <net/if.h> -// and not the one for <sys/socket.h> which is also needed. Although we -// don't need the template defined here, it makes the compiler pull in -// <sys/socket.h> and the build runs clean. -#if defined (AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 500) && (__IBMCPP__ < 700) -static ACE_Auto_Array_Ptr<sockaddr> force_compiler_to_include_socket_h; -#endif /* AIX && __IBMCPP__ >= 500 */ - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Bind socket to an unused port. @@ -805,8 +777,14 @@ get_ip_interfaces_getifaddrs (size_t &count, p_if != 0; p_if = p_if->ifa_next) { - if (p_if->ifa_addr && - p_if->ifa_addr->sa_family == AF_INET) + if (p_if->ifa_addr == 0) + continue; + + // Check to see if it's up. + if ((p_if->ifa_flags & IFF_UP) != IFF_UP) + continue; + + if (p_if->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *addr = reinterpret_cast<sockaddr_in *> (p_if->ifa_addr); @@ -822,8 +800,7 @@ get_ip_interfaces_getifaddrs (size_t &count, } } # if defined (ACE_HAS_IPV6) - else if (p_if->ifa_addr && - p_if->ifa_addr->sa_family == AF_INET6) + else if (p_if->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *addr = reinterpret_cast<sockaddr_in6 *> (p_if->ifa_addr); @@ -1094,64 +1071,7 @@ get_ip_interfaces_aix (size_t &count, return 0; } -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA) -int -get_ip_interfaces_vxworks_lt600 (size_t &count, - ACE_INET_Addr *&addrs) -{ - count = 0; - // Loop through each address structure - -# if defined (ACE_HAS_IPV6) && defined (TAILQ_ENTRY) -# define ia_next ia_link.tqe_next -# endif /* TAILQ_ENTRY */ - - for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next) - { - ++count; - } - - // Now create and initialize output array. - ACE_NEW_RETURN (addrs, - ACE_INET_Addr[count], - -1); // caller must free - count = 0; - for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next) - { - struct ifnet* ifp = ia->ia_ifa.ifa_ifp; - if (ifp != 0) - { - // Get the current interface name - char interface[64]; - ACE_OS::sprintf(interface, "%s%d", ifp->if_name, ifp->if_unit); - - // Get the address for the current interface - char address [INET_ADDR_LEN]; - STATUS status = ifAddrGet(interface, address); - - if (status == OK) - { - // Concatenate a ':' at the end. This is because in - // ACE_INET_Addr::string_to_addr, the ip_address is - // obtained using ':' as the delimiter. Since, using - // ifAddrGet(), we just get the IP address, I am adding - // a ":" to get with the general case. - ACE_OS::strcat (address, ":"); - addrs[count].set (address); - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("ACE::get_ip_interface failed\n") - ACE_TEXT ("Couldnt get the IP Address\n")), - -1); - } - ++count; - } - } - return 0; -} -#endif // ACE_WIN32 || ACE_HAS_GETIFADDRS || __hpux || _AIX || ACE_VXWORKS < 0x600 +#endif // ACE_WIN32 || ACE_HAS_GETIFADDRS || __hpux || _AIX // return an array of all configured IP interfaces on this host, count @@ -1174,8 +1094,6 @@ ACE::get_ip_interfaces (size_t &count, ACE_INET_Addr *&addrs) return get_ip_interfaces_hpux (count, addrs); #elif defined (_AIX) return get_ip_interfaces_aix (count, addrs); -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) && !defined (ACE_HAS_VXWORKS551_MEDUSA) - return get_ip_interfaces_vxworks_lt600 (count, addrs); #elif (defined (__unix) || defined (__unix__) || defined (ACE_OPENVMS) || (defined (ACE_VXWORKS) && !defined (ACE_HAS_GETIFADDRS)) || defined (ACE_HAS_RTEMS)) && !defined (ACE_LACKS_NETWORKING) // COMMON (SVR4 and BSD) UNIX CODE diff --git a/dep/acelite/ace/Stack_Trace.cpp b/dep/acelite/ace/Stack_Trace.cpp index 6c04e192886..353be81067b 100644 --- a/dep/acelite/ace/Stack_Trace.cpp +++ b/dep/acelite/ace/Stack_Trace.cpp @@ -2,7 +2,7 @@ /** * @file Stack_Trace.cpp * - * $Id: Stack_Trace.cpp 91286 2010-08-05 09:04:31Z johnnyw $ + * $Id: Stack_Trace.cpp 96017 2012-08-08 22:18:09Z mitza $ * * @brief Encapsulate string representation of stack trace. * @@ -197,7 +197,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, // See memEdrLib.c in VxWorks RTP sources for an example of stack tracing. -static STATUS ace_vx_rtp_pc_validate (INSTR *pc, TRC_OS_CTX *pOsCtx) +static STATUS ace_vx_rtp_pc_validate (INSTR *pc, TRC_OS_CTX *) { return ALIGNED (pc, sizeof (INSTR)) ? OK : ERROR; } @@ -222,7 +222,12 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, TRC_OS_CTX osCtx; osCtx.stackBase = desc.td_pStackBase; osCtx.stackEnd = desc.td_pStackEnd; +#if (ACE_VXWORKS < 0x690) osCtx.pcValidateRtn = reinterpret_cast<FUNCPTR> (ace_vx_rtp_pc_validate); +#else + // reinterpret_cast causes an error + osCtx.pcValidateRtn = ace_vx_rtp_pc_validate; +#endif char *fp = _WRS_FRAMEP_FROM_JMP_BUF (regs); INSTR *pc = _WRS_RET_PC_FROM_JMP_BUF (regs); @@ -250,8 +255,19 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, const char *fnName = "(no symbols)"; static const int N_ARGS = 12; - int buf[N_ARGS]; - int *pArgs = 0; +#if (ACE_VXWORKS < 0x690) +# define ACE_VX_USR_ARG_T int +# define ACE_VX_ARG_FORMAT "%x" +#else +# define ACE_VX_USR_ARG_T _Vx_usr_arg_t +# ifdef _WRS_CONFIG_LP64 +# define ACE_VX_ARG_FORMAT "%lx" +# else +# define ACE_VX_ARG_FORMAT "%x" +# endif +#endif + ACE_VX_USR_ARG_T buf[N_ARGS]; + ACE_VX_USR_ARG_T *pArgs = 0; int numArgs = trcLibFuncs.lvlArgsGet (prevPc, prevFn, prevFp, buf, N_ARGS, &pArgs); @@ -262,7 +278,7 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, size_t len = ACE_OS::strlen (this->buf_); size_t space = SYMBUFSIZ - len - 1; char *cursor = this->buf_ + len; - size_t written = ACE_OS::snprintf (cursor, space, "%x %s", + size_t written = ACE_OS::snprintf (cursor, space, "%p %s", prevFn, fnName); cursor += written; space -= written; @@ -272,7 +288,9 @@ ACE_Stack_Trace::generate_trace (ssize_t starting_frame_offset, { if (arg == 0) *cursor++ = '(', --space; written = ACE_OS::snprintf (cursor, space, - (arg < numArgs - 1) ? "%x, " : "%x", + (arg < numArgs - 1) ? + ACE_VX_ARG_FORMAT ", " : + ACE_VX_ARG_FORMAT, pArgs[arg]); cursor += written; space -= written; diff --git a/dep/acelite/ace/Stats.cpp b/dep/acelite/ace/Stats.cpp index 856d0e04db5..04bba5e86b1 100644 --- a/dep/acelite/ace/Stats.cpp +++ b/dep/acelite/ace/Stats.cpp @@ -1,4 +1,4 @@ -// $Id: Stats.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Stats.cpp 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Stats.h" @@ -68,15 +68,8 @@ ACE_Stats::mean (ACE_Stats_Value &m, { if (number_of_samples_ > 0) { -#if defined ACE_LACKS_LONGLONG_T - // If ACE_LACKS_LONGLONG_T, then ACE_UINT64 is a user-defined class. - // To prevent having to construct a static of that class, declare it - // on the stack, and construct it, in each function that needs it. - const ACE_U_LongLong ACE_STATS_INTERNAL_OFFSET (0, 8); -#else /* ! ACE_LACKS_LONGLONG_T */ const ACE_UINT64 ACE_STATS_INTERNAL_OFFSET = ACE_UINT64_LITERAL (0x100000000); -#endif /* ! ACE_LACKS_LONGLONG_T */ ACE_UINT64 sum = ACE_STATS_INTERNAL_OFFSET; ACE_Unbounded_Queue_Iterator<ACE_INT32> i (samples_); diff --git a/dep/acelite/ace/Strategies.h b/dep/acelite/ace/Strategies.h deleted file mode 100644 index 484ffa9a510..00000000000 --- a/dep/acelite/ace/Strategies.h +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Strategies.h - * - * $Id: Strategies.h 80826 2008-03-04 14:51:23Z wotte $ - * - * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> - */ -//============================================================================= - -#ifndef ACE_STRATEGIES_H -#define ACE_STRATEGIES_H -#include /**/ "ace/pre.h" - -#include /**/ "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/// Place holder for backward compatibility.. -#include "ace/Connection_Recycling_Strategy.h" -#include "ace/Hashable.h" -#include "ace/Notification_Strategy.h" -#include "ace/Reactor_Notification_Strategy.h" -#include "ace/Recyclable.h" -#include "ace/Refcountable.h" - - -#include /**/ "ace/post.h" -#endif /*ACE_STRATEGIES_H*/ diff --git a/dep/acelite/ace/Strategies_T.cpp b/dep/acelite/ace/Strategies_T.cpp index fbbc1a5bc93..28d786489ad 100644 --- a/dep/acelite/ace/Strategies_T.cpp +++ b/dep/acelite/ace/Strategies_T.cpp @@ -1,4 +1,4 @@ -// $Id: Strategies_T.cpp 89510 2010-03-17 12:21:14Z vzykov $ +// $Id: Strategies_T.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #ifndef ACE_STRATEGIES_T_CPP #define ACE_STRATEGIES_T_CPP @@ -1011,12 +1011,15 @@ ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX>::connect_s return result; } - // For all successful cases: mark the <svc_handler> in the cache - // as being <in_use>. Therefore recyclable is BUSY. - entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); + if (entry) + { + // For all successful cases: mark the <svc_handler> in the cache + // as being <in_use>. Therefore recyclable is BUSY. + entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); - // And increment the refcount - entry->ext_id_.increment (); + // And increment the refcount + entry->ext_id_.increment (); + } return 0; } diff --git a/dep/acelite/ace/Stream.cpp b/dep/acelite/ace/Stream.cpp index 4d7a893a2fe..6f30f863661 100644 --- a/dep/acelite/ace/Stream.cpp +++ b/dep/acelite/ace/Stream.cpp @@ -1,5 +1,5 @@ // Stream.cpp -// $Id: Stream.cpp 90072 2010-05-04 21:34:39Z cbeaulac $ +// $Id: Stream.cpp 96070 2012-08-17 09:07:16Z mcorino $ #ifndef ACE_STREAM_CPP #define ACE_STREAM_CPP @@ -25,14 +25,14 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Stream) // Give some idea of what the heck is going on in a stream! -template <ACE_SYNCH_DECL> void -ACE_Stream<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("-------- module links --------\n"))); - for (ACE_Module<ACE_SYNCH_USE> *mp = this->stream_head_; + for (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mp = this->stream_head_; ; mp = mp->next ()) { @@ -43,7 +43,7 @@ ACE_Stream<ACE_SYNCH_USE>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("-------- writer links --------\n"))); - ACE_Task<ACE_SYNCH_USE> *tp; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *tp; for (tp = this->stream_head_->writer (); ; @@ -72,10 +72,10 @@ ACE_Stream<ACE_SYNCH_USE>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::push (ACE_Module<ACE_SYNCH_USE> *new_top) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::push (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *new_top) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::push"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::push"); if (this->push_module (new_top, this->stream_head_->next (), this->stream_head_) == -1) @@ -84,27 +84,27 @@ ACE_Stream<ACE_SYNCH_USE>::push (ACE_Module<ACE_SYNCH_USE> *new_top) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::put (ACE_Message_Block *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::put"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::put"); return this->stream_head_->writer ()->put (mb, tv); } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::get (ACE_Message_Block *&mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::get (ACE_Message_Block *&mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::get"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::get"); return this->stream_head_->reader ()->getq (mb, tv); } // Return the "top" ACE_Module in a ACE_Stream, skipping over the // stream_head. -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::top (ACE_Module<ACE_SYNCH_USE> *&m) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::top (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *&m) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::top"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::top"); if (this->stream_head_->next () == this->stream_tail_) return -1; else @@ -114,18 +114,18 @@ ACE_Stream<ACE_SYNCH_USE>::top (ACE_Module<ACE_SYNCH_USE> *&m) } } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::insert (const ACE_TCHAR *prev_name, - ACE_Module<ACE_SYNCH_USE> *mod) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::insert (const ACE_TCHAR *prev_name, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::insert"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::insert"); - for (ACE_Module<ACE_SYNCH_USE> *prev_mod = this->stream_head_; + for (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *prev_mod = this->stream_head_; prev_mod != 0; prev_mod = prev_mod->next ()) if (ACE_OS::strcmp (prev_mod->name (), prev_name) == 0) { - ACE_Module<ACE_SYNCH_USE> *next_mod = prev_mod->next (); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *next_mod = prev_mod->next (); // We can't insert a module below <stream_tail_>. if (next_mod == 0) @@ -146,20 +146,20 @@ ACE_Stream<ACE_SYNCH_USE>::insert (const ACE_TCHAR *prev_name, return -1; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::replace (const ACE_TCHAR *replace_name, - ACE_Module<ACE_SYNCH_USE> *mod, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::replace (const ACE_TCHAR *replace_name, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod, int flags) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::replace"); - ACE_Module<ACE_SYNCH_USE> *prev_mod = 0; + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::replace"); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *prev_mod = 0; - for (ACE_Module<ACE_SYNCH_USE> *rep_mod = this->stream_head_; + for (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *rep_mod = this->stream_head_; rep_mod != 0; rep_mod = rep_mod->next ()) if (ACE_OS::strcmp (rep_mod->name (), replace_name) == 0) { - ACE_Module<ACE_SYNCH_USE> *next_mod = rep_mod->next (); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *next_mod = rep_mod->next (); if (next_mod) mod->link (next_mod); @@ -184,7 +184,7 @@ ACE_Stream<ACE_SYNCH_USE>::replace (const ACE_TCHAR *replace_name, if (mod->writer ()->open (mod->arg ()) == -1) return -1; - if (flags != ACE_Module<ACE_SYNCH_USE>::M_DELETE_NONE) + if (flags != ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::M_DELETE_NONE) { rep_mod->close (flags); delete rep_mod; @@ -201,17 +201,17 @@ ACE_Stream<ACE_SYNCH_USE>::replace (const ACE_TCHAR *replace_name, // Remove the "top" ACE_Module in a ACE_Stream, skipping over the // stream_head. -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::pop (int flags) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::pop (int flags) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::pop"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::pop"); if (this->stream_head_->next () == this->stream_tail_) return -1; else { // Skip over the ACE_Stream head. - ACE_Module<ACE_SYNCH_USE> *top_mod = this->stream_head_->next (); - ACE_Module<ACE_SYNCH_USE> *new_top = top_mod->next (); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *top_mod = this->stream_head_->next (); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *new_top = top_mod->next (); this->stream_head_->next (new_top); @@ -220,7 +220,7 @@ ACE_Stream<ACE_SYNCH_USE>::pop (int flags) top_mod->close (flags); // Don't delete the Module unless the flags request this. - if (flags != ACE_Module<ACE_SYNCH_USE>::M_DELETE_NONE) + if (flags != ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::M_DELETE_NONE) delete top_mod; this->stream_head_->writer ()->next (new_top->writer ()); @@ -232,14 +232,14 @@ ACE_Stream<ACE_SYNCH_USE>::pop (int flags) // Remove a named ACE_Module from an arbitrary place in the // ACE_Stream. -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::remove (const ACE_TCHAR *name, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::remove (const ACE_TCHAR *name, int flags) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::remove"); - ACE_Module<ACE_SYNCH_USE> *prev = 0; + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::remove"); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *prev = 0; - for (ACE_Module<ACE_SYNCH_USE> *mod = this->stream_head_; + for (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod = this->stream_head_; mod != 0; mod = mod->next ()) { @@ -247,7 +247,7 @@ ACE_Stream<ACE_SYNCH_USE>::remove (const ACE_TCHAR *name, if (ACE::debug ()) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("ACE_Stream::remove comparing existing module :%s: with :%s:\n"), + ACE_TEXT ("ACE_Stream::remove - comparing existing module :%s: with :%s:\n"), mod->name (), name)); } @@ -260,11 +260,13 @@ ACE_Stream<ACE_SYNCH_USE>::remove (const ACE_TCHAR *name, else prev->link (mod->next ()); + // Close down the module. + mod->close (flags); + // Don't delete the Module unless the flags request this. - if (flags != ACE_Module<ACE_SYNCH_USE>::M_DELETE_NONE) + if (flags != ACE_Module<ACE_SYNCH_USE, TIME_POLICY>::M_DELETE_NONE) { - // Close down the module and release the memory. - mod->close (flags); + // Release the memory. delete mod; } @@ -278,11 +280,11 @@ ACE_Stream<ACE_SYNCH_USE>::remove (const ACE_TCHAR *name, return -1; } -template <ACE_SYNCH_DECL> ACE_Module<ACE_SYNCH_USE> * -ACE_Stream<ACE_SYNCH_USE>::find (const ACE_TCHAR *name) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::find (const ACE_TCHAR *name) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::find"); - for (ACE_Module<ACE_SYNCH_USE> *mod = this->stream_head_; + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::find"); + for (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod = this->stream_head_; mod != 0; mod = mod->next ()) if (ACE_OS::strcmp (mod->name (), name) == 0) @@ -293,16 +295,16 @@ ACE_Stream<ACE_SYNCH_USE>::find (const ACE_TCHAR *name) // Actually push a module onto the stack... -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::push_module (ACE_Module<ACE_SYNCH_USE> *new_top, - ACE_Module<ACE_SYNCH_USE> *current_top, - ACE_Module<ACE_SYNCH_USE> *head) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::push_module (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *new_top, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *current_top, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::push_module"); - ACE_Task<ACE_SYNCH_USE> *nt_reader = new_top->reader (); - ACE_Task<ACE_SYNCH_USE> *nt_writer = new_top->writer (); - ACE_Task<ACE_SYNCH_USE> *ct_reader = 0; - ACE_Task<ACE_SYNCH_USE> *ct_writer = 0; + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::push_module"); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *nt_reader = new_top->reader (); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *nt_writer = new_top->writer (); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *ct_reader = 0; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *ct_writer = 0; if (current_top) { @@ -331,47 +333,45 @@ ACE_Stream<ACE_SYNCH_USE>::push_module (ACE_Module<ACE_SYNCH_USE> *new_top, return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::open (void *a, - ACE_Module<ACE_SYNCH_USE> *head, - ACE_Module<ACE_SYNCH_USE> *tail) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::open (void *a, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *tail) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::open"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - ACE_Task<ACE_SYNCH_USE> *h1 = 0, *h2 = 0; - ACE_Task<ACE_SYNCH_USE> *t1 = 0, *t2 = 0; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *h1 = 0, *h2 = 0; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *t1 = 0, *t2 = 0; if (head == 0) { - ACE_NEW_RETURN (h1, - ACE_Stream_Head<ACE_SYNCH_USE>, - -1); - ACE_NEW_RETURN (h2, - ACE_Stream_Head<ACE_SYNCH_USE>, - -1); - ACE_NEW_RETURN (head, - ACE_Module<ACE_SYNCH_USE> (ACE_TEXT ("ACE_Stream_Head"), - h1, h2, - a, - M_DELETE), - -1); + typedef ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY> STREAM_HEAD_TYPE; + ACE_NEW_NORETURN (h1, + STREAM_HEAD_TYPE); + ACE_NEW_NORETURN (h2, + STREAM_HEAD_TYPE); + typedef ACE_Module<ACE_SYNCH_USE, TIME_POLICY> MODULE_TYPE; + ACE_NEW_NORETURN (head, + MODULE_TYPE (ACE_TEXT ("ACE_Stream_Head"), + h1, h2, + a, + M_DELETE)); } if (tail == 0) { - ACE_NEW_RETURN (t1, - ACE_Stream_Tail<ACE_SYNCH_USE>, - -1); - ACE_NEW_RETURN (t2, - ACE_Stream_Tail<ACE_SYNCH_USE>, - -1); - ACE_NEW_RETURN (tail, - ACE_Module<ACE_SYNCH_USE> (ACE_TEXT ("ACE_Stream_Tail"), - t1, t2, - a, - M_DELETE), - -1); + typedef ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY> STREAM_TAIL_TYPE; + ACE_NEW_NORETURN (t1, + STREAM_TAIL_TYPE); + ACE_NEW_NORETURN (t2, + STREAM_TAIL_TYPE); + typedef ACE_Module<ACE_SYNCH_USE, TIME_POLICY> MODULE_TYPE; + ACE_NEW_NORETURN (tail, + MODULE_TYPE (ACE_TEXT ("ACE_Stream_Tail"), + t1, t2, + a, + M_DELETE)); } // Make sure *all* the allocation succeeded! @@ -401,10 +401,10 @@ ACE_Stream<ACE_SYNCH_USE>::open (void *a, return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::close (int flags) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::close (int flags) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::close"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->stream_head_ != 0 @@ -441,14 +441,14 @@ ACE_Stream<ACE_SYNCH_USE>::close (int flags) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void *a) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::control"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::control"); ACE_IO_Cntl_Msg ioc (cmd); - ACE_Message_Block *db; + ACE_Message_Block *db = 0; // Try to create a data block that contains the user-supplied data. ACE_NEW_RETURN (db, @@ -462,12 +462,11 @@ ACE_Stream<ACE_SYNCH_USE>::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, // field. ACE_Message_Block *cb = 0; - ACE_NEW_RETURN (cb, - ACE_Message_Block (sizeof ioc, - ACE_Message_Block::MB_IOCTL, - db, - (char *) &ioc), - -1); + ACE_NEW_NORETURN (cb, + ACE_Message_Block (sizeof ioc, + ACE_Message_Block::MB_IOCTL, + db, + (char *) &ioc)); // @@ Michael: The old semantic assumed that cb returns == 0 // if no memory was available. We will now return immediately // without release (errno is set to ENOMEM by the macro). @@ -501,15 +500,15 @@ ACE_Stream<ACE_SYNCH_USE>::control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, // on the fact that the Stream head and Stream tail are non-NULL... // This must be called with locks held. -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::link_i (ACE_Stream<ACE_SYNCH_USE> &us) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::link_i (ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &us) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::link_i"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::link_i"); this->linked_us_ = &us; // Make sure the other side is also linked to us! us.linked_us_ = this; - ACE_Module<ACE_SYNCH_USE> *my_tail = this->stream_head_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *my_tail = this->stream_head_; if (my_tail == 0) return -1; @@ -518,7 +517,7 @@ ACE_Stream<ACE_SYNCH_USE>::link_i (ACE_Stream<ACE_SYNCH_USE> &us) while (my_tail->next () != this->stream_tail_) my_tail = my_tail->next (); - ACE_Module<ACE_SYNCH_USE> *other_tail = us.stream_head_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *other_tail = us.stream_head_; if (other_tail == 0) return -1; @@ -533,10 +532,10 @@ ACE_Stream<ACE_SYNCH_USE>::link_i (ACE_Stream<ACE_SYNCH_USE> &us) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::link (ACE_Stream<ACE_SYNCH_USE> &us) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::link (ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &us) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::link"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::link"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); @@ -545,16 +544,16 @@ ACE_Stream<ACE_SYNCH_USE>::link (ACE_Stream<ACE_SYNCH_USE> &us) // Must be called with locks held... -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::unlink_i (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::unlink_i (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::unlink_i"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::unlink_i"); // Only try to unlink if we are in fact still linked! if (this->linked_us_ != 0) { - ACE_Module<ACE_SYNCH_USE> *my_tail = this->stream_head_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *my_tail = this->stream_head_; // Only relink if we still exist! if (my_tail) @@ -567,7 +566,7 @@ ACE_Stream<ACE_SYNCH_USE>::unlink_i (void) my_tail->writer ()->next (this->stream_tail_->writer ()); } - ACE_Module<ACE_SYNCH_USE> *other_tail = + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *other_tail = this->linked_us_->stream_head_; // Only fiddle with the other side if it in fact still remains. @@ -590,42 +589,48 @@ ACE_Stream<ACE_SYNCH_USE>::unlink_i (void) return -1; } -template <ACE_SYNCH_DECL> int -ACE_Stream<ACE_SYNCH_USE>::unlink (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::unlink (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::unlink"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::unlink"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->unlink_i (); } -template <ACE_SYNCH_DECL> -ACE_Stream<ACE_SYNCH_USE>::ACE_Stream (void * a, - ACE_Module<ACE_SYNCH_USE> *head, - ACE_Module<ACE_SYNCH_USE> *tail) - : linked_us_ (0), +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream (void * a, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *tail) + : stream_head_ (0), + stream_tail_ (0), + linked_us_ (0), +#if defined (ACE_HAS_THREADS) + final_close_ (lock_, cond_attr_) +#else final_close_ (lock_) +#endif { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::ACE_Stream"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream"); if (this->open (a, head, tail) == -1) ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE_Stream<ACE_SYNCH_USE>::open (%s, %s)\n"), + ACE_TEXT ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::open (%s, %s)\n"), head->name (), tail->name ())); } -template <ACE_SYNCH_DECL> -ACE_Stream<ACE_SYNCH_USE>::~ACE_Stream (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::~ACE_Stream"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream"); if (this->stream_head_ != 0) this->close (); } -template <ACE_SYNCH_DECL> -ACE_Stream_Iterator<ACE_SYNCH_USE>::ACE_Stream_Iterator (const ACE_Stream<ACE_SYNCH_USE> &sr) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Iterator (const ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &sr) : next_ (sr.stream_head_) { - ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::ACE_Stream_Iterator"); + ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Iterator"); } ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Stream.h b/dep/acelite/ace/Stream.h index 9172485c132..a9dc401f046 100644 --- a/dep/acelite/ace/Stream.h +++ b/dep/acelite/ace/Stream.h @@ -4,7 +4,7 @@ /** * @file Stream.h * - * $Id: Stream.h 91058 2010-07-12 08:20:09Z johnnyw $ + * $Id: Stream.h 96070 2012-08-17 09:07:16Z mcorino $ * * @author Douglas C. Schmidt <schmidt@uci.edu> */ @@ -24,11 +24,14 @@ #include "ace/IO_Cntl_Msg.h" #include "ace/Message_Block.h" #include "ace/Module.h" +#if defined (ACE_HAS_THREADS) +# include "ace/Condition_Attributes.h" +#endif ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decls. -template<ACE_SYNCH_DECL> class ACE_Stream_Iterator; +template<ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Stream_Iterator; class ACE_Time_Value; /** @@ -45,11 +48,11 @@ class ACE_Time_Value; * won't be overridden properly unless you call it in a subclass * destructor. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Stream { public: - friend class ACE_Stream_Iterator<ACE_SYNCH_USE>; + friend class ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>; enum { @@ -66,8 +69,8 @@ public: * @a arg is the value past in to the <open> methods of the tasks. */ ACE_Stream (void *arg = 0, - ACE_Module<ACE_SYNCH_USE> *head = 0, - ACE_Module<ACE_SYNCH_USE> *tail = 0); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head = 0, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *tail = 0); /** * Create a Stream consisting of @a head and @a tail as the Stream @@ -76,8 +79,8 @@ public: * @a arg is the value past in to the @c open() methods of the tasks. */ virtual int open (void *arg, - ACE_Module<ACE_SYNCH_USE> *head = 0, - ACE_Module<ACE_SYNCH_USE> *tail = 0); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head = 0, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *tail = 0); /// Close down the stream and release all the resources. virtual int close (int flags = M_DELETE); @@ -90,7 +93,7 @@ public: /// Add a new module @a mod right below the Stream head. The /// @c open() hook methods of the @c ACE_Tasks in this ACE_Module /// are invoked to initialize the tasks. - virtual int push (ACE_Module<ACE_SYNCH_USE> *mod); + virtual int push (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod); /// Remove the @a mod right below the Stream head and close it down. // The <close()> hook methods of the <ACE_Tasks> in this ACE_Module @@ -99,15 +102,15 @@ public: /// Return the top module on the stream (right below the stream /// head). - virtual int top (ACE_Module<ACE_SYNCH_USE> *&mod); + virtual int top (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *&mod); /// Insert a new module @a mod below the named module @a prev_name. virtual int insert (const ACE_TCHAR *prev_name, - ACE_Module<ACE_SYNCH_USE> *mod); + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod); /// Replace the named module @a replace_name with a new module @a mod. virtual int replace (const ACE_TCHAR *replace_name, - ACE_Module<ACE_SYNCH_USE> *mod, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod, int flags = M_DELETE); /// Remove the named module @a mod from the stream. This bypasses the @@ -116,16 +119,16 @@ public: int flags = M_DELETE); /// Return current stream head. - virtual ACE_Module<ACE_SYNCH_USE> *head (void); + virtual ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *head (void); /// Return current stream tail. - virtual ACE_Module<ACE_SYNCH_USE> *tail (void); + virtual ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *tail (void); /// Find a particular ACE_Module. - virtual ACE_Module<ACE_SYNCH_USE> *find (const ACE_TCHAR *mod); + virtual ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *find (const ACE_TCHAR *mod); /// Create a pipe between two Streams. - virtual int link (ACE_Stream<ACE_SYNCH_USE> &); + virtual int link (ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &); /// Remove a pipe formed between two Streams. virtual int unlink (void); @@ -168,26 +171,34 @@ private: /// Actually perform the linking of two Streams (must be called with /// locks held). - int link_i (ACE_Stream<ACE_SYNCH_USE> &); + int link_i (ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &); /// Must a new module onto the Stream. - int push_module (ACE_Module<ACE_SYNCH_USE> *, - ACE_Module<ACE_SYNCH_USE> * = 0, - ACE_Module<ACE_SYNCH_USE> * = 0); + int push_module (ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * = 0, + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * = 0); /// Pointer to the head of the stream. - ACE_Module<ACE_SYNCH_USE> *stream_head_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *stream_head_; /// Pointer to the tail of the stream. - ACE_Module<ACE_SYNCH_USE> *stream_tail_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *stream_tail_; /// Pointer to an adjoining linked stream. - ACE_Stream<ACE_SYNCH_USE> *linked_us_; + ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> *linked_us_; // = Synchronization objects used for thread-safe streams. /// Protect the stream against race conditions. ACE_SYNCH_MUTEX_T lock_; +#if defined (ACE_HAS_THREADS) + /// Attributes to initialize condition with. + /* We only need this because some crappy compilers can't + properly handle initializing the conditions with + temporary objects. */ + ACE_Condition_Attributes_T<TIME_POLICY> cond_attr_; +#endif + /// Use to tell all threads waiting on the close that we are done. ACE_SYNCH_CONDITION_T final_close_; }; @@ -197,18 +208,18 @@ private: * * @brief Iterate through an ACE_Stream. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Stream_Iterator { public: // = Initialization method. - ACE_Stream_Iterator (const ACE_Stream<ACE_SYNCH_USE> &sr); + ACE_Stream_Iterator (const ACE_Stream<ACE_SYNCH_USE, TIME_POLICY> &sr); // = Iteration methods. /// Pass back the @a next_item that hasn't been seen in the set. /// Returns 0 when all items have been seen, else 1. - int next (const ACE_Module<ACE_SYNCH_USE> *&next_item); + int next (const ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *&next_item); /// Returns 1 when all items have been seen, else 0. int done (void) const; @@ -219,7 +230,7 @@ public: private: /// Next ACE_Module that we haven't yet seen. - ACE_Module<ACE_SYNCH_USE> *next_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *next_; }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Stream.inl b/dep/acelite/ace/Stream.inl index 6263d431147..b1bd92a609f 100644 --- a/dep/acelite/ace/Stream.inl +++ b/dep/acelite/ace/Stream.inl @@ -1,49 +1,49 @@ // -*- C++ -*- // -// $Id: Stream.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Stream.inl 96061 2012-08-16 09:36:07Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> * -ACE_Stream<ACE_SYNCH_USE>::head (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::head (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::head"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::head"); return this->stream_head_; } -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> * -ACE_Stream<ACE_SYNCH_USE>::tail (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::tail (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::tail"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::tail"); return this->stream_tail_; } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Stream<ACE_SYNCH_USE>::wait (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::wait (void) { - ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::wait"); + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE, TIME_POLICY>::wait"); return this->final_close_.wait (); } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Stream_Iterator<ACE_SYNCH_USE>::next (const ACE_Module<ACE_SYNCH_USE> *&mod) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::next (const ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *&mod) { - ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::next"); + ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::next"); mod = this->next_; return this->next_ != 0; } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Stream_Iterator<ACE_SYNCH_USE>::done (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::done (void) const { - ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::done"); + ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::done"); return this->next_ == 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Iterator<ACE_SYNCH_USE>::advance (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::advance (void) { - ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::advance"); + ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE, TIME_POLICY>::advance"); this->next_ = this->next_->next (); return this->next_ != 0; } diff --git a/dep/acelite/ace/Stream_Modules.cpp b/dep/acelite/ace/Stream_Modules.cpp index 8d11e5da1da..a071aa19f1d 100644 --- a/dep/acelite/ace/Stream_Modules.cpp +++ b/dep/acelite/ace/Stream_Modules.cpp @@ -1,4 +1,4 @@ -// $Id: Stream_Modules.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Stream_Modules.cpp 96061 2012-08-16 09:36:07Z mcorino $ #ifndef ACE_STREAM_MODULES_CPP #define ACE_STREAM_MODULES_CPP @@ -15,53 +15,53 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Head) -template <ACE_SYNCH_DECL> -ACE_Stream_Head<ACE_SYNCH_USE>::ACE_Stream_Head (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Head (void) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::ACE_Stream_Head"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Head"); } -template <ACE_SYNCH_DECL> -ACE_Stream_Head<ACE_SYNCH_USE>::~ACE_Stream_Head (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream_Head (void) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::~ACE_Stream_Head"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream_Head"); } -template <ACE_SYNCH_DECL> void -ACE_Stream_Head<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::dump"); #endif /* ACE_HAS_DUMP */ } // ACE_Module that act as the head and tail of a Stream. -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::open (void *) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::open (void *) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::open"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::close (u_long) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::close (u_long) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::close"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::svc (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::svc (void) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::svc"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::svc"); return -1; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::control (ACE_Message_Block *mb) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::control (ACE_Message_Block *mb) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::control"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::control"); ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr (); ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd; @@ -80,10 +80,10 @@ ACE_Stream_Head<ACE_SYNCH_USE>::control (ACE_Message_Block *mb) // Performs canonical flushing at the ACE_Stream Head. -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::canonical_flush (ACE_Message_Block *mb) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::canonical_flush (ACE_Message_Block *mb) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::canonical_flush"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::canonical_flush"); char *cp = mb->rd_ptr (); if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHR)) @@ -99,11 +99,11 @@ ACE_Stream_Head<ACE_SYNCH_USE>::canonical_flush (ACE_Message_Block *mb) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::put (ACE_Message_Block *mb, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::put"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::put"); int res = 0; if (mb->msg_type () == ACE_Message_Block::MB_IOCTL @@ -126,17 +126,17 @@ ACE_Stream_Head<ACE_SYNCH_USE>::put (ACE_Message_Block *mb, } } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::init (int, ACE_TCHAR *[]) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::init (int, ACE_TCHAR *[]) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::init"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::init"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, size_t length) const +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::info (ACE_TCHAR **strp, size_t length) const { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::info"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::info"); const ACE_TCHAR *name = this->name (); if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) @@ -146,60 +146,60 @@ ACE_Stream_Head<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, size_t length) const return static_cast<int> (ACE_OS::strlen (name)); } -template <ACE_SYNCH_DECL> int -ACE_Stream_Head<ACE_SYNCH_USE>::fini (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::fini (void) { - ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE>::fini"); + ACE_TRACE ("ACE_Stream_Head<ACE_SYNCH_USE, TIME_POLICY>::fini"); return 0; } ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Tail) -template <ACE_SYNCH_DECL> -ACE_Stream_Tail<ACE_SYNCH_USE>::ACE_Stream_Tail (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Tail (void) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::ACE_Stream_Tail"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::ACE_Stream_Tail"); } -template <ACE_SYNCH_DECL> -ACE_Stream_Tail<ACE_SYNCH_USE>::~ACE_Stream_Tail (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream_Tail (void) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::~ACE_Stream_Tail"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Stream_Tail"); } -template <ACE_SYNCH_DECL> void -ACE_Stream_Tail<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::dump"); #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::open (void *) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::open (void *) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::open"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::close (u_long) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::close (u_long) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::close"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::svc (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::svc (void) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::svc"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::svc"); return -1; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::control (ACE_Message_Block *mb) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::control (ACE_Message_Block *mb) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::control"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::control"); ACE_IO_Cntl_Msg *ioc = (ACE_IO_Cntl_Msg *) mb->rd_ptr (); ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd; @@ -217,16 +217,17 @@ ACE_Stream_Tail<ACE_SYNCH_USE>::control (ACE_Message_Block *mb) } default: mb->msg_type (ACE_Message_Block::MB_IOCNAK); + break; } return this->reply (mb); } // Perform flush algorithm as though we were the driver. -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::canonical_flush (ACE_Message_Block *mb) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::canonical_flush (ACE_Message_Block *mb) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::canonical_flush"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::canonical_flush"); char *cp = mb->rd_ptr (); if (ACE_BIT_ENABLED (*cp, ACE_Task_Flags::ACE_FLUSHW)) @@ -246,11 +247,11 @@ ACE_Stream_Tail<ACE_SYNCH_USE>::canonical_flush (ACE_Message_Block *mb) return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::put (ACE_Message_Block *mb, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::put (ACE_Message_Block *mb, ACE_Time_Value *) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::put"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::put"); if (this->is_writer ()) { @@ -269,17 +270,17 @@ ACE_Stream_Tail<ACE_SYNCH_USE>::put (ACE_Message_Block *mb, return -1; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::init (int, ACE_TCHAR *[]) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::init (int, ACE_TCHAR *[]) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::init"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::init"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, size_t length) const +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::info (ACE_TCHAR **strp, size_t length) const { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::info"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::info"); const ACE_TCHAR *name = this->name (); if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) @@ -289,76 +290,76 @@ ACE_Stream_Tail<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, size_t length) const return static_cast<int> (ACE_OS::strlen (name)); } -template <ACE_SYNCH_DECL> int -ACE_Stream_Tail<ACE_SYNCH_USE>::fini (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::fini (void) { - ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE>::fini"); + ACE_TRACE ("ACE_Stream_Tail<ACE_SYNCH_USE, TIME_POLICY>::fini"); return 0; } ACE_ALLOC_HOOK_DEFINE(ACE_Thru_Task) -template <ACE_SYNCH_DECL> -ACE_Thru_Task<ACE_SYNCH_USE>::ACE_Thru_Task (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Thru_Task (void) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::ACE_Thru_Task"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Thru_Task"); } -template <ACE_SYNCH_DECL> -ACE_Thru_Task<ACE_SYNCH_USE>::~ACE_Thru_Task (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Thru_Task (void) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::~ACE_Thru_Task"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Thru_Task"); } -template <ACE_SYNCH_DECL> void -ACE_Thru_Task<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::dump"); #endif /* ACE_HAS_DUMP */ } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::open (void *) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::open (void *) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::open"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::open"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::close (u_long) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::close (u_long) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::close"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::close"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::svc (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::svc (void) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::svc"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::svc"); return -1; } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::put (ACE_Message_Block *msg, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::put (ACE_Message_Block *msg, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::put"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::put"); return this->put_next (msg, tv); } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::init (int, ACE_TCHAR *[]) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::init (int, ACE_TCHAR *[]) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::init"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::init"); return 0; } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::info (ACE_TCHAR **strp, size_t length) const { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::info"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::info"); const ACE_TCHAR *name = this->name (); if (*strp == 0 && (*strp = ACE_OS::strdup (name)) == 0) @@ -368,10 +369,10 @@ ACE_Thru_Task<ACE_SYNCH_USE>::info (ACE_TCHAR **strp, return static_cast<int> (ACE_OS::strlen (name)); } -template <ACE_SYNCH_DECL> int -ACE_Thru_Task<ACE_SYNCH_USE>::fini (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> int +ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::fini (void) { - ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE>::fini"); + ACE_TRACE ("ACE_Thru_Task<ACE_SYNCH_USE, TIME_POLICY>::fini"); return 0; } diff --git a/dep/acelite/ace/Stream_Modules.h b/dep/acelite/ace/Stream_Modules.h index 5bbc072ad4c..008bdecd52f 100644 --- a/dep/acelite/ace/Stream_Modules.h +++ b/dep/acelite/ace/Stream_Modules.h @@ -4,7 +4,7 @@ /** * @file Stream_Modules.h * - * $Id: Stream_Modules.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Stream_Modules.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -47,15 +47,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * stream. * - Writer: The block is passed to the next module in the stream. */ -template <ACE_SYNCH_DECL> -class ACE_Stream_Head : public ACE_Task<ACE_SYNCH_USE> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> +class ACE_Stream_Head : public ACE_Task<ACE_SYNCH_USE, TIME_POLICY> { public: /// Construction ACE_Stream_Head (void); /// Destruction - ~ACE_Stream_Head (void); + virtual ~ACE_Stream_Head (void); // = ACE_Task hooks virtual int open (void *a = 0); @@ -85,15 +85,15 @@ private: * * @brief Standard module that acts as the head of a stream. */ -template <ACE_SYNCH_DECL> -class ACE_Stream_Tail : public ACE_Task<ACE_SYNCH_USE> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> +class ACE_Stream_Tail : public ACE_Task<ACE_SYNCH_USE, TIME_POLICY> { public: /// Construction ACE_Stream_Tail (void); /// Destruction - ~ACE_Stream_Tail (void); + virtual ~ACE_Stream_Tail (void); // = ACE_Task hooks virtual int open (void *a = 0); @@ -124,15 +124,15 @@ private: * @brief Standard module that acts as a "no op", simply passing on all * data to its adjacent neighbor. */ -template <ACE_SYNCH_DECL> -class ACE_Thru_Task : public ACE_Task<ACE_SYNCH_USE> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> +class ACE_Thru_Task : public ACE_Task<ACE_SYNCH_USE, TIME_POLICY> { public: /// Construction ACE_Thru_Task (void); /// Destruction - ~ACE_Thru_Task (void); + virtual ~ACE_Thru_Task (void); // = ACE_Task hooks virtual int open (void *a = 0); diff --git a/dep/acelite/ace/String_Base.cpp b/dep/acelite/ace/String_Base.cpp index 8438cc6e59d..2373c578204 100644 --- a/dep/acelite/ace/String_Base.cpp +++ b/dep/acelite/ace/String_Base.cpp @@ -1,4 +1,4 @@ -// $Id: String_Base.cpp 88793 2010-02-01 17:50:34Z cleeland $ +// $Id: String_Base.cpp 93238 2011-02-01 14:30:38Z shuston $ #ifndef ACE_STRING_BASE_CPP #define ACE_STRING_BASE_CPP @@ -655,7 +655,9 @@ ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_CHAR_T c) { ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator+=(const ACE_CHAR_T)"); const size_type slen = 1; - return this->append (&c, slen); + // This temp is silly but it quiets an optimizer warning in IBM XL C++ 10. + ACE_String_Base<ACE_CHAR_T>& r = this->append (&c, slen); + return r; } ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/String_Base.h b/dep/acelite/ace/String_Base.h index 128fe76a2b6..b02d786725a 100644 --- a/dep/acelite/ace/String_Base.h +++ b/dep/acelite/ace/String_Base.h @@ -4,7 +4,7 @@ /** * @file String_Base.h * - * $Id: String_Base.h 92057 2010-09-27 14:52:00Z johnnyw $ + * $Id: String_Base.h 95709 2012-04-24 01:19:24Z schmidt $ * * @author Douglas C. Schmidt (schmidt@cs.wustl.edu) * @author Nanbor Wang <nanbor@cs.wustl.edu> diff --git a/dep/acelite/ace/Svc_Conf.y b/dep/acelite/ace/Svc_Conf.y index 8ddc6a8d3a7..ec3ed5c06c1 100644 --- a/dep/acelite/ace/Svc_Conf.y +++ b/dep/acelite/ace/Svc_Conf.y @@ -1,5 +1,5 @@ %{ -// $Id: Svc_Conf.y 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Svc_Conf.y 94034 2011-05-09 19:11:03Z johnnyw $ #include "ace/Svc_Conf.h" @@ -331,11 +331,10 @@ ace_get_module (ACE_Service_Type const * sr, ACE_TCHAR const * svc_name, int & yyerrno) { - ACE_Service_Type_Impl const * const type = sr->type (); ACE_Stream_Type const * const st = (sr == 0 ? 0 - : dynamic_cast<ACE_Stream_Type const *> (type)); + : dynamic_cast<ACE_Stream_Type const *> (sr->type ())); ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name)); if (sr == 0 || st == 0 || mt == 0) diff --git a/dep/acelite/ace/Svc_Conf_y.cpp b/dep/acelite/ace/Svc_Conf_y.cpp index e14286699cd..8aa656ff39f 100644 --- a/dep/acelite/ace/Svc_Conf_y.cpp +++ b/dep/acelite/ace/Svc_Conf_y.cpp @@ -1,4 +1,4 @@ -// $Id: Svc_Conf_y.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Svc_Conf_y.cpp 94034 2011-05-09 19:11:03Z johnnyw $ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C @@ -105,7 +105,7 @@ /* Copy the first part of user declarations. */ -// $Id: Svc_Conf_y.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Svc_Conf_y.cpp 94034 2011-05-09 19:11:03Z johnnyw $ #include "ace/Svc_Conf.h" @@ -1955,11 +1955,10 @@ ace_get_module (ACE_Service_Type const * sr, ACE_TCHAR const * svc_name, int & ace_yyerrno) { - ACE_Service_Type_Impl const * const type = sr->type (); ACE_Stream_Type const * const st = (sr == 0 ? 0 - : dynamic_cast<ACE_Stream_Type const *> (type)); + : dynamic_cast<ACE_Stream_Type const *> (sr->type ())); ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name)); if (sr == 0 || st == 0 || mt == 0) diff --git a/dep/acelite/ace/Svc_Handler.cpp b/dep/acelite/ace/Svc_Handler.cpp index a4f22c98ce4..565d96c5c34 100644 --- a/dep/acelite/ace/Svc_Handler.cpp +++ b/dep/acelite/ace/Svc_Handler.cpp @@ -1,4 +1,4 @@ -// $Id: Svc_Handler.cpp 89432 2010-03-10 10:34:51Z vzykov $ +// $Id: Svc_Handler.cpp 94310 2011-07-09 19:10:06Z schmidt $ #ifndef ACE_SVC_HANDLER_CPP #define ACE_SVC_HANDLER_CPP @@ -95,8 +95,7 @@ template <PR_ST_1, ACE_SYNCH_DECL> void ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete (void *p, const ACE_nothrow_t&) throw() { - ACE_TRACE - ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete(nothrow)"); + ACE_TRACE("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete(nothrow)"); ::delete [] static_cast <char *> (p); } #endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ diff --git a/dep/acelite/ace/Synch_Traits.h b/dep/acelite/ace/Synch_Traits.h index 785b9fd0eec..a841039a223 100644 --- a/dep/acelite/ace/Synch_Traits.h +++ b/dep/acelite/ace/Synch_Traits.h @@ -4,7 +4,7 @@ /** * @file Synch_Traits.h * - * $Id: Synch_Traits.h 91626 2010-09-07 10:59:20Z johnnyw $ + * $Id: Synch_Traits.h 96073 2012-08-17 13:39:55Z mcorino $ * * Moved from Synch.h. * @@ -27,17 +27,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decl class ACE_Null_Mutex; -class ACE_Null_Condition; class ACE_Null_Semaphore; class ACE_Null_Mutex; class ACE_Thread_Mutex; class ACE_Process_Mutex; class ACE_Recursive_Thread_Mutex; class ACE_RW_Thread_Mutex; -class ACE_Condition_Thread_Mutex; -class ACE_Condition_Recursive_Thread_Mutex; class ACE_Thread_Semaphore; +template <class MUTEX> class ACE_Condition; +typedef ACE_Condition<ACE_Null_Mutex> ACE_Null_Condition; +typedef ACE_Condition<ACE_Thread_Mutex> ACE_Condition_Thread_Mutex; +typedef ACE_Condition<ACE_Recursive_Thread_Mutex> ACE_Condition_Recursive_Thread_Mutex; + /** * @class ACE_NULL_SYNCH * @@ -62,7 +64,6 @@ public: #if defined (ACE_HAS_THREADS) class ACE_Process_Mutex; -class ACE_Condition_Recursive_Thread_Mutex; /** * @class ACE_MT_SYNCH diff --git a/dep/acelite/ace/TLI.inl b/dep/acelite/ace/TLI.inl index 001d8c65292..1d7e196b198 100644 --- a/dep/acelite/ace/TLI.inl +++ b/dep/acelite/ace/TLI.inl @@ -1,10 +1,8 @@ // -*- C++ -*- -// -// $Id: TLI.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: TLI.inl 93359 2011-02-11 11:33:12Z mcorino $ #include "ace/TLI.h" - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE diff --git a/dep/acelite/ace/TP_Reactor.cpp b/dep/acelite/ace/TP_Reactor.cpp index 683dfd58622..70998e60497 100644 --- a/dep/acelite/ace/TP_Reactor.cpp +++ b/dep/acelite/ace/TP_Reactor.cpp @@ -1,10 +1,11 @@ -// $Id: TP_Reactor.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: TP_Reactor.cpp 95332 2011-12-15 11:09:41Z mcorino $ #include "ace/TP_Reactor.h" #include "ace/Thread.h" #include "ace/Timer_Queue.h" #include "ace/Sig_Handler.h" #include "ace/Log_Msg.h" +#include "ace/Functor_T.h" #include "ace/OS_NS_sys_time.h" #if !defined (__ACE_INLINE__) @@ -161,7 +162,10 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // After getting the lock just just for deactivation.. if (this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Update the countdown to reflect time waiting for the token. countdown.update (); @@ -303,40 +307,10 @@ int ACE_TP_Reactor::handle_timer_events (int & /*event_count*/, ACE_TP_Token_Guard &guard) { - if (this->timer_queue_ == 0 || this->timer_queue_->is_empty()) - { // Empty timer queue so cannot have any expired timers. - return 0; - } - - // Get the current time - ACE_Time_Value cur_time (this->timer_queue_->gettimeofday () + - this->timer_queue_->timer_skew ()); - - // Look for a node in the timer queue whose timer <= the present - // time. - ACE_Timer_Node_Dispatch_Info info; - - if (this->timer_queue_->dispatch_info (cur_time, info)) - { - const void *upcall_act = 0; + typedef ACE_Member_Function_Command<ACE_TP_Token_Guard> Guard_Release; - // Preinvoke. - this->timer_queue_->preinvoke (info, cur_time, upcall_act); - - // Release the token before dispatching notifies... - guard.release_token (); - - // call the functor - this->timer_queue_->upcall (info, cur_time); - - // Postinvoke - this->timer_queue_->postinvoke (info, cur_time, upcall_act); - - // We have dispatched a timer - return 1; - } - - return 0; + Guard_Release release(guard, &ACE_TP_Token_Guard::release_token); + return this->timer_queue_->expire_single(release); } int diff --git a/dep/acelite/ace/TP_Reactor.h b/dep/acelite/ace/TP_Reactor.h index 33e00c2e57f..965b6dfcc91 100644 --- a/dep/acelite/ace/TP_Reactor.h +++ b/dep/acelite/ace/TP_Reactor.h @@ -4,7 +4,7 @@ /** * @file TP_Reactor.h * - * $Id: TP_Reactor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * $Id: TP_Reactor.h 94454 2011-09-08 17:36:56Z johnnyw $ * * The ACE_TP_Reactor (aka, Thread Pool Reactor) uses the * Leader/Followers pattern to demultiplex events among a pool of @@ -131,7 +131,7 @@ private: /// Flag that indicate whether the thread that created this object /// owns the token or not. A value of false indicates that this class - /// hasnt got the token (and hence the thread) and a value of true + /// hasn't got the token (and hence the thread) and a value of true /// vice-versa. bool owner_; diff --git a/dep/acelite/ace/TSS_Adapter.cpp b/dep/acelite/ace/TSS_Adapter.cpp index 748ad1c13e6..e51ca303511 100644 --- a/dep/acelite/ace/TSS_Adapter.cpp +++ b/dep/acelite/ace/TSS_Adapter.cpp @@ -1,7 +1,7 @@ /** * @file TSS_Adapter.cpp * - * $Id: TSS_Adapter.cpp 91286 2010-08-05 09:04:31Z johnnyw $ + * $Id: TSS_Adapter.cpp 93792 2011-04-07 11:48:50Z mcorino $ * * Originally in Synch.cpp * @@ -10,30 +10,25 @@ #include "ace/TSS_Adapter.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_TSS_Adapter::ACE_TSS_Adapter (void *object, ACE_THR_DEST f) : ts_obj_ (object), func_ (f) { - // ACE_TRACE ("ACE_TSS_Adapter::ACE_TSS_Adapter"); } void ACE_TSS_Adapter::cleanup (void) { - // ACE_TRACE ("ACE_TSS_Adapter::cleanup"); (*this->func_)(this->ts_obj_); // call cleanup routine for ts_obj_ } ACE_END_VERSIONED_NAMESPACE_DECL -extern "C" void +extern "C" ACE_Export void ACE_TSS_C_cleanup (void *object) { - // ACE_TRACE ("ACE_TSS_C_cleanup"); if (object != 0) { ACE_TSS_Adapter * const tss_adapter = (ACE_TSS_Adapter *) object; diff --git a/dep/acelite/ace/TSS_Adapter.h b/dep/acelite/ace/TSS_Adapter.h index b8ff85e3210..b806422365f 100644 --- a/dep/acelite/ace/TSS_Adapter.h +++ b/dep/acelite/ace/TSS_Adapter.h @@ -4,7 +4,7 @@ /** * @file TSS_Adapter.h * - * $Id: TSS_Adapter.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: TSS_Adapter.h 93792 2011-04-07 11:48:50Z mcorino $ * * Originally in Synch.h * @@ -30,8 +30,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * @brief This class encapsulates a TSS object and its associated * C++ destructor function. It is used by the ACE_TSS... * methods (in Synch_T.cpp) in order to allow an extern - * "C" cleanup routine to be used. Needed by the "frigging" - * MVS C++ compiler. + * "C" cleanup routine to be used. * * Objects of this class are stored in thread specific * storage. ts_obj_ points to the "real" object and diff --git a/dep/acelite/ace/TSS_T.cpp b/dep/acelite/ace/TSS_T.cpp index 9cc112f3ec7..8c6f30e1116 100644 --- a/dep/acelite/ace/TSS_T.cpp +++ b/dep/acelite/ace/TSS_T.cpp @@ -1,4 +1,4 @@ -// $Id: TSS_T.cpp 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: TSS_T.cpp 93792 2011-04-07 11:48:50Z mcorino $ #ifndef ACE_TSS_T_CPP #define ACE_TSS_T_CPP @@ -28,7 +28,7 @@ ACE_ALLOC_HOOK_DEFINE(ACE_TSS) #if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) # if defined (ACE_HAS_THR_C_DEST) -extern "C" void ACE_TSS_C_cleanup (void *); +extern "C" ACE_Export void ACE_TSS_C_cleanup (void *); # endif /* ACE_HAS_THR_C_DEST */ #endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ diff --git a/dep/acelite/ace/TTY_IO.h b/dep/acelite/ace/TTY_IO.h index 1029966e56c..39de5f8d236 100644 --- a/dep/acelite/ace/TTY_IO.h +++ b/dep/acelite/ace/TTY_IO.h @@ -4,7 +4,7 @@ /** * @file TTY_IO.h * - * $Id: TTY_IO.h 82271 2008-07-09 09:23:03Z olli $ + * $Id: TTY_IO.h 95212 2011-12-05 12:29:55Z johnnyw $ * * @author Douglas C. Schmidt <schmidt@uci.edu> */ @@ -46,7 +46,7 @@ public: { Serial_Params (void); - /** Specifies the baudrate at which the communnication port operates. */ + /** Specifies the baudrate at which the communication port operates. */ int baudrate; /** Specifies the minimum number of bytes in input buffer before XON char is sent. Negative value indicates that default value should diff --git a/dep/acelite/ace/Task.cpp b/dep/acelite/ace/Task.cpp index c570fc0dc89..1d159ad84b7 100644 --- a/dep/acelite/ace/Task.cpp +++ b/dep/acelite/ace/Task.cpp @@ -1,4 +1,4 @@ -// $Id: Task.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Task.cpp 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Task.h" #include "ace/Module.h" @@ -15,21 +15,15 @@ ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) thr_mgr_ (thr_man), flags_ (0), grp_id_ (-1) -#if !(defined (ACE_MVS) || defined(__TANDEM)) ,last_thread_id_ (0) -#endif /* !defined (ACE_MVS) */ { -#if (defined (ACE_MVS) || defined(__TANDEM)) - ACE_OS::memset( &this->last_thread_id_, '\0', sizeof( this->last_thread_id_ )); -#endif /* defined (ACE_MVS) */ } ACE_Task_Base::~ACE_Task_Base (void) { } -// Default ACE_Task service routine - +/// Default ACE_Task service routine int ACE_Task_Base::svc (void) { @@ -37,8 +31,7 @@ ACE_Task_Base::svc (void) return 0; } -// Default ACE_Task open routine - +/// Default ACE_Task open routine int ACE_Task_Base::open (void *) { @@ -46,8 +39,7 @@ ACE_Task_Base::open (void *) return 0; } -// Default ACE_Task close routine - +/// Default ACE_Task close routine int ACE_Task_Base::close (u_long) { @@ -55,17 +47,15 @@ ACE_Task_Base::close (u_long) return 0; } -// Forward the call to close() so that existing applications don't -// break. - +/// Forward the call to close() so that existing applications don't +/// break. int ACE_Task_Base::module_closed (void) { return this->close (1); } -// Default ACE_Task put routine. - +/// Default ACE_Task put routine. int ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *) { @@ -73,8 +63,7 @@ ACE_Task_Base::put (ACE_Message_Block *, ACE_Time_Value *) return 0; } -// Wait for all threads running in a task to exit. - +/// Wait for all threads running in a task to exit. int ACE_Task_Base::wait (void) { @@ -88,7 +77,7 @@ ACE_Task_Base::wait (void) return 0; } -// Suspend a task. +/// Suspend a task. int ACE_Task_Base::suspend (void) { @@ -100,7 +89,7 @@ ACE_Task_Base::suspend (void) return 0; } -// Resume a suspended task. +/// Resume a suspended task. int ACE_Task_Base::resume (void) { @@ -195,11 +184,11 @@ ACE_Task_Base::activate (long flags, if (this->grp_id_ == -1) this->grp_id_ = grp_spawned; -#if defined (ACE_MVS) || defined(__TANDEM) +#if defined(ACE_TANDEM_T1248_PTHREADS) ACE_OS::memcpy( &this->last_thread_id_, '\0', sizeof(this->last_thread_id_)); #else this->last_thread_id_ = 0; // Reset to prevent inadvertant match on ID -#endif /* defined (ACE_MVS) */ +#endif /* defined (ACE_TANDEM_T1248_PTHREADS) */ return 0; diff --git a/dep/acelite/ace/Task_Ex_T.cpp b/dep/acelite/ace/Task_Ex_T.cpp index de97e5ba6b4..bcc0ff0bed3 100644 --- a/dep/acelite/ace/Task_Ex_T.cpp +++ b/dep/acelite/ace/Task_Ex_T.cpp @@ -1,4 +1,4 @@ -// $Id: Task_Ex_T.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Task_Ex_T.cpp 96061 2012-08-16 09:36:07Z mcorino $ #ifndef ACE_TASK_EX_T_CPP #define ACE_TASK_EX_T_CPP @@ -19,11 +19,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> void -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump (void) const +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> void +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); this->msg_queue_->dump (); @@ -44,31 +44,31 @@ ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump (void) const // If the user doesn't supply a ACE_Message_Queue_Ex pointer then we'll // allocate one dynamically. Otherwise, we'll use the one they give. -template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::ACE_Task_Ex (ACE_Thread_Manager *thr_man, - ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> *mq) +template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::ACE_Task_Ex (ACE_Thread_Manager *thr_man, + ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> *mq) : ACE_Task_Base (thr_man), msg_queue_ (0), delete_msg_queue_ (false), mod_ (0), next_ (0) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::ACE_Task_Ex"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::ACE_Task_Ex"); if (mq == 0) { ACE_NEW (mq, - (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>)); + (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY>)); this->delete_msg_queue_ = true; } this->msg_queue_ = mq; } -template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::~ACE_Task_Ex (void) +template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::~ACE_Task_Ex (void) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::~ACE_Task_Ex"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::~ACE_Task_Ex"); if (this->delete_msg_queue_) delete this->msg_queue_; @@ -77,10 +77,10 @@ ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::~ACE_Task_Ex (void) this->delete_msg_queue_ = false; } -template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Task<ACE_SYNCH_USE> * -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::sibling (void) +template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::sibling (void) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::sibling"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::sibling"); /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well. /// Now always return 0 for sibling return 0; @@ -92,20 +92,20 @@ ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::sibling (void) */ } -template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> const ACE_TCHAR * -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::name (void) const +template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> const ACE_TCHAR * +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::name (void) const { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::name"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::name"); if (this->mod_ == 0) return 0; else return this->mod_->name (); } -template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Module<ACE_SYNCH_USE> * -ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::module (void) const +template<ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::module (void) const { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::module"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE, TIME_POLICY>::module"); return this->mod_; } diff --git a/dep/acelite/ace/Task_Ex_T.h b/dep/acelite/ace/Task_Ex_T.h index 70a97247b04..04eadb794e3 100644 --- a/dep/acelite/ace/Task_Ex_T.h +++ b/dep/acelite/ace/Task_Ex_T.h @@ -4,7 +4,7 @@ /** * @file Task_Ex_T.h * - * $Id: Task_Ex_T.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Task_Ex_T.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Kobi Cohen-Arazi <kobi-co@barak-online.net> */ @@ -26,7 +26,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decls... -template <ACE_SYNCH_DECL> class ACE_Module; +template <ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Module; /** * @class ACE_Task_Ex @@ -57,14 +57,14 @@ template <ACE_SYNCH_DECL> class ACE_Module; * When User (and legacy code) write ACE_Task<ACE_MT_SYNCH>, specialized ACE_Task * code is in action. */ -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Task_Ex : public ACE_Task_Base, private ACE_Copy_Disabled { public: - friend class ACE_Module<ACE_SYNCH_USE>; + friend class ACE_Module<ACE_SYNCH_USE, TIME_POLICY>; friend class ACE_Module_Type; - typedef ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> MESSAGE_QUEUE_EX; + typedef ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> MESSAGE_QUEUE_EX; // = Initialization/termination methods. /** @@ -133,16 +133,16 @@ public: // Should be protected: // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). /// Get next Task pointer. - ACE_Task<ACE_SYNCH_USE> *next (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *next (void); /// Set next Task pointer. - void next (ACE_Task<ACE_SYNCH_USE> *); + void next (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *); /// Alwasy return 0. @todo FIXME - ACE_Task<ACE_SYNCH_USE> *sibling (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *sibling (void); /// Return the Task's Module if there is one, else returns 0. - ACE_Module<ACE_SYNCH_USE> *module (void) const; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *module (void) const; /** * Flush the task's queue, i.e., free all of the enqueued @@ -164,10 +164,10 @@ public: // Should be protected: bool delete_msg_queue_; /// Back-pointer to the enclosing module. - ACE_Module<ACE_SYNCH_USE> *mod_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod_; /// Pointer to adjacent ACE_Task. - ACE_Task<ACE_SYNCH_USE> *next_; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *next_; /// Dump the state of an object. void dump (void) const; diff --git a/dep/acelite/ace/Task_Ex_T.inl b/dep/acelite/ace/Task_Ex_T.inl index 9b5c864c6ad..543e107efac 100644 --- a/dep/acelite/ace/Task_Ex_T.inl +++ b/dep/acelite/ace/Task_Ex_T.inl @@ -1,55 +1,55 @@ // -*- C++ -*- // -// $Id: Task_Ex_T.inl 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Task_Ex_T.inl 96061 2012-08-16 09:36:07Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE void +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, size_t wm_size) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::water_marks"); if (cmd == ACE_IO_Cntl_Msg::SET_LWM) this->msg_queue_->low_water_mark (wm_size); else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ this->msg_queue_->high_water_mark (wm_size); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::getq"); return this->msg_queue_->dequeue_head (mb, tv); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::putq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::putq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::putq"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::putq"); return this->msg_queue_->enqueue_tail (mb, tv); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::ungetq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::ungetq (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::ungetq"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::ungetq"); return this->msg_queue_->enqueue_head (mb, tv); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::flush (u_long flag) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::flush (u_long flag) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::flush"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::flush"); if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) return this->msg_queue_ != 0 && this->msg_queue_->close (); else return -1; // Note, need to be more careful about what we free... } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> *mq) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE void +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::msg_queue (ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> *mq) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::msg_queue"); if (this->delete_msg_queue_) { delete this->msg_queue_; @@ -58,44 +58,44 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (ACE_Message_Queue_Ex<ACE this->msg_queue_ = mq; } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE> * -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue (void) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::msg_queue (void) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::msg_queue"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::msg_queue"); return this->msg_queue_; } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::reply (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::reply (ACE_MESSAGE_TYPE *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::reply"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::reply"); ACE_UNUSED_ARG (mb); ACE_UNUSED_ARG (tv); return -1 ; // this->sibling ()->put_next (mb, tv); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE ACE_Task<ACE_SYNCH_USE> * -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next (void) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::next (void) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::next"); return this->next_; } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next (ACE_Task<ACE_SYNCH_USE> *q) +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE void +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::next (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::next"); this->next_ = q; } // Transfer msg to the next ACE_Task_Ex. -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next ( +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE, class TIME_POLICY> ACE_INLINE int +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::put_next ( ACE_MESSAGE_TYPE * /* msg */, ACE_Time_Value * /* tv */) { - ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next"); + ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE, TIME_POLICY>::put_next"); return -1; // this->next_ == 0 ? -1 : this->next_->put (msg, tv); } diff --git a/dep/acelite/ace/Task_T.cpp b/dep/acelite/ace/Task_T.cpp index 08b36f82f08..e2481ae2bc6 100644 --- a/dep/acelite/ace/Task_T.cpp +++ b/dep/acelite/ace/Task_T.cpp @@ -1,4 +1,4 @@ -// $Id: Task_T.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Task_T.cpp 96061 2012-08-16 09:36:07Z mcorino $ #ifndef ACE_TASK_T_CPP #define ACE_TASK_T_CPP @@ -18,11 +18,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL> void -ACE_Task<ACE_SYNCH_USE>::dump (void) const +template <ACE_SYNCH_DECL, class TIME_POLICY> void +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::dump"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); this->msg_queue_->dump (); @@ -43,31 +43,32 @@ ACE_Task<ACE_SYNCH_USE>::dump (void) const // If the user doesn't supply a ACE_Message_Queue pointer then we'll // allocate one dynamically. Otherwise, we'll use the one they give. -template<ACE_SYNCH_DECL> -ACE_Task<ACE_SYNCH_USE>::ACE_Task (ACE_Thread_Manager *thr_man, - ACE_Message_Queue<ACE_SYNCH_USE> *mq) +template<ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Task (ACE_Thread_Manager *thr_man, + ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *mq) : ACE_Task_Base (thr_man), msg_queue_ (0), delete_msg_queue_ (false), mod_ (0), next_ (0) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::ACE_Task"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ACE_Task"); if (mq == 0) { + typedef ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> QUEUE_TYPE; ACE_NEW (mq, - ACE_Message_Queue<ACE_SYNCH_USE>); + QUEUE_TYPE); this->delete_msg_queue_ = true; } this->msg_queue_ = mq; } -template<ACE_SYNCH_DECL> -ACE_Task<ACE_SYNCH_USE>::~ACE_Task (void) +template<ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Task (void) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::~ACE_Task"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::~ACE_Task"); if (this->delete_msg_queue_) delete this->msg_queue_; @@ -76,30 +77,30 @@ ACE_Task<ACE_SYNCH_USE>::~ACE_Task (void) this->delete_msg_queue_ = false; } -template<ACE_SYNCH_DECL> ACE_Task<ACE_SYNCH_USE> * -ACE_Task<ACE_SYNCH_USE>::sibling (void) +template<ACE_SYNCH_DECL, class TIME_POLICY> ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::sibling (void) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::sibling"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::sibling"); if (this->mod_ == 0) return 0; else return this->mod_->sibling (this); } -template<ACE_SYNCH_DECL> const ACE_TCHAR * -ACE_Task<ACE_SYNCH_USE>::name (void) const +template<ACE_SYNCH_DECL, class TIME_POLICY> const ACE_TCHAR * +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::name (void) const { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::name"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::name"); if (this->mod_ == 0) return 0; else return this->mod_->name (); } -template<ACE_SYNCH_DECL> ACE_Module<ACE_SYNCH_USE> * -ACE_Task<ACE_SYNCH_USE>::module (void) const +template<ACE_SYNCH_DECL, class TIME_POLICY> ACE_Module<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::module (void) const { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::module"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::module"); return this->mod_; } diff --git a/dep/acelite/ace/Task_T.h b/dep/acelite/ace/Task_T.h index 1946f45cfe5..9b0cd9e2c6f 100644 --- a/dep/acelite/ace/Task_T.h +++ b/dep/acelite/ace/Task_T.h @@ -4,7 +4,7 @@ /** * @file Task_T.h * - * $Id: Task_T.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: Task_T.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -27,7 +27,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decls... -template <ACE_SYNCH_DECL> class ACE_Module; +template <ACE_SYNCH_DECL, class TIME_POLICY> class ACE_Module; /** * @class ACE_Task @@ -38,11 +38,11 @@ template <ACE_SYNCH_DECL> class ACE_Module; * This class serves as the basis for passive and active objects * in ACE. */ -template <ACE_SYNCH_DECL> +template <ACE_SYNCH_DECL, class TIME_POLICY = ACE_System_Time_Policy> class ACE_Task : public ACE_Task_Base { public: - friend class ACE_Module<ACE_SYNCH_USE>; + friend class ACE_Module<ACE_SYNCH_USE, TIME_POLICY>; friend class ACE_Module_Type; // = Initialization/termination methods. @@ -53,16 +53,24 @@ public: * one passed as a parameter. */ ACE_Task (ACE_Thread_Manager *thr_mgr = 0, - ACE_Message_Queue<ACE_SYNCH_USE> *mq = 0); + ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *mq = 0); /// Destructor. virtual ~ACE_Task (void); /// Gets the message queue associated with this task. - ACE_Message_Queue<ACE_SYNCH_USE> *msg_queue (void); + ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *msg_queue (void); /// Sets the message queue associated with this task. - void msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *); + void msg_queue (ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *); + + /// Get the current time of day according to the queue's TIME_POLICY. + /// Allows users to initialize timeout values using correct time policy. + ACE_Time_Value_T<TIME_POLICY> gettimeofday (void) const; + + /// Allows applications to control how the timer queue gets the time + /// of day. + void set_time_policy (TIME_POLICY const & time_policy); public: // Should be protected: // = Message queue manipulation methods. @@ -118,17 +126,17 @@ public: // Should be protected: // = Pointers to next ACE_Task_Base (if ACE is part of an ACE_Stream). /// Get next Task pointer. - ACE_Task<ACE_SYNCH_USE> *next (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *next (void); /// Set next Task pointer. - void next (ACE_Task<ACE_SYNCH_USE> *); + void next (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *); /// Return the Task's sibling if there's one associated with the /// Task's Module, else returns 0. - ACE_Task<ACE_SYNCH_USE> *sibling (void); + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *sibling (void); /// Return the Task's Module if there is one, else returns 0. - ACE_Module<ACE_SYNCH_USE> *module (void) const; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *module (void) const; /** * Flush the task's queue, i.e., free all of the enqueued @@ -144,16 +152,16 @@ public: // Should be protected: void water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t); /// Queue of messages on the ACE_Task.. - ACE_Message_Queue<ACE_SYNCH_USE> *msg_queue_; + ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *msg_queue_; /// true if should delete Message_Queue, false otherwise. bool delete_msg_queue_; /// Back-pointer to the enclosing module. - ACE_Module<ACE_SYNCH_USE> *mod_; + ACE_Module<ACE_SYNCH_USE, TIME_POLICY> *mod_; /// Pointer to adjacent ACE_Task. - ACE_Task<ACE_SYNCH_USE> *next_; + ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *next_; /// Dump the state of an object. void dump (void) const; @@ -164,8 +172,8 @@ public: // Should be protected: private: // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task<ACE_SYNCH_USE> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Task (const ACE_Task<ACE_SYNCH_USE> &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Task<ACE_SYNCH_USE, TIME_POLICY> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Task (const ACE_Task<ACE_SYNCH_USE, TIME_POLICY> &)) }; #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT diff --git a/dep/acelite/ace/Task_T.inl b/dep/acelite/ace/Task_T.inl index 5eda4c2bf90..34ad25b0c6b 100644 --- a/dep/acelite/ace/Task_T.inl +++ b/dep/acelite/ace/Task_T.inl @@ -1,55 +1,55 @@ // -*- C++ -*- // -// $Id: Task_T.inl 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Task_T.inl 96066 2012-08-16 12:45:46Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, size_t wm_size) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::water_marks"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::water_marks"); if (cmd == ACE_IO_Cntl_Msg::SET_LWM) this->msg_queue_->low_water_mark (wm_size); else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */ this->msg_queue_->high_water_mark (wm_size); } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::getq"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::getq"); return this->msg_queue_->dequeue_head (mb, tv); } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::putq (ACE_Message_Block *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::putq (ACE_Message_Block *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::putq"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::putq"); return this->msg_queue_->enqueue_tail (mb, tv); } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::ungetq (ACE_Message_Block *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ungetq (ACE_Message_Block *mb, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::ungetq"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::ungetq"); return this->msg_queue_->enqueue_head (mb, tv); } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::flush (u_long flag) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::flush (u_long flag) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::flush"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::flush"); if (ACE_BIT_ENABLED (flag, ACE_Task_Flags::ACE_FLUSHALL)) return this->msg_queue_ != 0 && this->msg_queue_->close (); else return -1; // Note, need to be more careful about what we free... } -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Task<ACE_SYNCH_USE>::msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *mq) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::msg_queue (ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> *mq) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::msg_queue"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::msg_queue"); if (this->delete_msg_queue_) { delete this->msg_queue_; @@ -58,40 +58,58 @@ ACE_Task<ACE_SYNCH_USE>::msg_queue (ACE_Message_Queue<ACE_SYNCH_USE> *mq) this->msg_queue_ = mq; } -template <ACE_SYNCH_DECL> ACE_Message_Queue<ACE_SYNCH_USE> * -ACE_Task<ACE_SYNCH_USE>::msg_queue (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_Message_Queue<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::msg_queue (void) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::msg_queue"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::msg_queue"); return this->msg_queue_; } -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::reply (ACE_Message_Block *mb, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::gettimeofday (void) const { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::reply"); + if (this->msg_queue_ != 0) + return this->msg_queue_->gettimeofday (); + + return ACE_Time_Value_T<TIME_POLICY> (ACE_Time_Value::zero); +} + +template <ACE_SYNCH_DECL, class TIME_POLICY> +void +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::set_time_policy (TIME_POLICY const & rhs) +{ + if (this->msg_queue_ != 0) + this->msg_queue_->set_time_policy (rhs); +} + +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::reply (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::reply"); return this->sibling ()->put_next (mb, tv); } -template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> * -ACE_Task<ACE_SYNCH_USE>::next (void) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE ACE_Task<ACE_SYNCH_USE, TIME_POLICY> * +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::next (void) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::next"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::next"); return this->next_; } -template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Task<ACE_SYNCH_USE>::next (ACE_Task<ACE_SYNCH_USE> *q) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE void +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::next (ACE_Task<ACE_SYNCH_USE, TIME_POLICY> *q) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::next"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::next"); this->next_ = q; } // Transfer msg to the next ACE_Task. -template <ACE_SYNCH_DECL> ACE_INLINE int -ACE_Task<ACE_SYNCH_USE>::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv) +template <ACE_SYNCH_DECL, class TIME_POLICY> ACE_INLINE int +ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv) { - ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::put_next"); + ACE_TRACE ("ACE_Task<ACE_SYNCH_USE, TIME_POLICY>::put_next"); return this->next_ == 0 ? -1 : this->next_->put (msg, tv); } diff --git a/dep/acelite/ace/Thread.inl b/dep/acelite/ace/Thread.inl index b1fd120a261..5e08bd34d7e 100644 --- a/dep/acelite/ace/Thread.inl +++ b/dep/acelite/ace/Thread.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Thread.inl 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: Thread.inl 95376 2011-12-20 15:39:02Z shuston $ #include "ace/OS_NS_string.h" @@ -171,7 +171,7 @@ ACE_Thread::disablecancel (struct cancel_state *old_state) { ACE_OS::memset (old_state, 0, - sizeof (old_state)); + sizeof (*old_state)); old_state->cancelstate = old_cstate; } diff --git a/dep/acelite/ace/Thread_Adapter.cpp b/dep/acelite/ace/Thread_Adapter.cpp index 754691857a0..0afb322e731 100644 --- a/dep/acelite/ace/Thread_Adapter.cpp +++ b/dep/acelite/ace/Thread_Adapter.cpp @@ -1,4 +1,4 @@ -// $Id: Thread_Adapter.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Thread_Adapter.cpp 92682 2010-11-23 23:41:19Z shuston $ #include "ace/Thread_Adapter.h" #include "ace/Thread_Manager.h" @@ -22,6 +22,7 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, , ACE_SEH_EXCEPT_HANDLER selector, ACE_SEH_EXCEPT_HANDLER handler #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags ) : ACE_Base_Thread_Adapter ( user_func @@ -32,6 +33,7 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, , selector , handler #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , cancel_flags ) , thr_mgr_ (tm) { @@ -105,6 +107,9 @@ ACE_Thread_Adapter::invoke_i (void) ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_; #endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ + // Pick up the cancel-related flags before deleting this. + long cancel_flags = this->flags_; + // Delete ourselves since we don't need <this> anymore. Make sure // not to access <this> anywhere below this point. delete this; @@ -125,6 +130,17 @@ ACE_Thread_Adapter::invoke_i (void) ACE_OS::thr_setprio (prio); #endif /* ACE_NEEDS_LWP_PRIO_SET */ + if (cancel_flags != 0) + { + // If both flags are set, ignore this. + int old = 0; + int val = cancel_flags & (THR_CANCEL_ENABLE | THR_CANCEL_DISABLE); + if (val == THR_CANCEL_ENABLE || val == THR_CANCEL_DISABLE) + ACE_OS::thr_setcancelstate (val, &old); + val = cancel_flags & (THR_CANCEL_DEFERRED | THR_CANCEL_ASYNCHRONOUS); + if (val == THR_CANCEL_DEFERRED || val == THR_CANCEL_ASYNCHRONOUS) + ACE_OS::thr_setcanceltype (val, &old); + } ACE_THR_FUNC_RETURN status = 0; diff --git a/dep/acelite/ace/Thread_Adapter.h b/dep/acelite/ace/Thread_Adapter.h index d7ab4056de4..6880e2cb2cd 100644 --- a/dep/acelite/ace/Thread_Adapter.h +++ b/dep/acelite/ace/Thread_Adapter.h @@ -4,7 +4,7 @@ /** * @file Thread_Adapter.h * - * $Id: Thread_Adapter.h 92060 2010-09-27 18:08:48Z johnnyw $ + * $Id: Thread_Adapter.h 92682 2010-11-23 23:41:19Z shuston $ * * @author Carlos O'Ryan <coryan@uci.edu> */ @@ -56,6 +56,7 @@ public: , ACE_SEH_EXCEPT_HANDLER selector = 0, ACE_SEH_EXCEPT_HANDLER handler = 0 # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags = 0 ); /** diff --git a/dep/acelite/ace/Thread_Control.cpp b/dep/acelite/ace/Thread_Control.cpp index 2f38849e339..4046c07eef7 100644 --- a/dep/acelite/ace/Thread_Control.cpp +++ b/dep/acelite/ace/Thread_Control.cpp @@ -1,4 +1,4 @@ -// $Id: Thread_Control.cpp 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: Thread_Control.cpp 94054 2011-05-11 18:28:20Z johnnyw $ #include "ace/Thread_Control.h" #include "ace/Thread_Manager.h" @@ -18,7 +18,7 @@ ACE_Thread_Control::dump (void) const } int -ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert) +ACE_Thread_Control::insert (ACE_Thread_Manager *tm, bool insert) { ACE_OS_TRACE ("ACE_Thread_Control::insert"); @@ -33,7 +33,6 @@ ACE_Thread_Control::insert (ACE_Thread_Manager *tm, int insert) } // Initialize the thread controller. - ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t, int insert) : tm_ (t), @@ -50,7 +49,6 @@ ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t, } // Automatically kill thread on exit. - ACE_Thread_Control::~ACE_Thread_Control (void) { ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control"); @@ -63,7 +61,6 @@ ACE_Thread_Control::~ACE_Thread_Control (void) } // Exit from thread (but clean up first). - ACE_THR_FUNC_RETURN ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit) { diff --git a/dep/acelite/ace/Thread_Control.h b/dep/acelite/ace/Thread_Control.h index 3eb5185c84c..392eb7a62e0 100644 --- a/dep/acelite/ace/Thread_Control.h +++ b/dep/acelite/ace/Thread_Control.h @@ -4,13 +4,12 @@ /** * @file Thread_Control.h * - * $Id: Thread_Control.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Thread_Control.h 94054 2011-05-11 18:28:20Z johnnyw $ * * @author Carlos O'Ryan <coryan@uci.edu> */ //============================================================================= - #ifndef ACE_THREAD_CONTROL_H #define ACE_THREAD_CONTROL_H #include /**/ "ace/pre.h" @@ -48,7 +47,7 @@ public: ACE_Thread_Control (ACE_Thread_Manager *tm = 0, int insert = 0); - /// Remove the thread from its associated <Thread_Manager> and exit + /// Remove the thread from its associated Thread_Manager and exit /// the thread if <do_thr_exit> is enabled. ~ACE_Thread_Control (void); @@ -57,15 +56,15 @@ public: ACE_THR_FUNC_RETURN exit (ACE_THR_FUNC_RETURN status, int do_thr_exit); - /// Store the <Thread_Manager> and use it to register ourselves for + /// Store the Thread_Manager and use it to register ourselves for /// correct shutdown. - int insert (ACE_Thread_Manager *tm, int insert = 0); + int insert (ACE_Thread_Manager *tm, bool insert = false); - /// Returns the current <Thread_Manager>. + /// Returns the current Thread_Manager. ACE_Thread_Manager *thr_mgr (void); - /// Atomically set a new <Thread_Manager> and return the old - /// <Thread_Manager>. + /// Atomically set a new Thread_Manager and return the old + /// Thread_Manager. ACE_Thread_Manager *thr_mgr (ACE_Thread_Manager *); /// Set the exit status (and return existing status). diff --git a/dep/acelite/ace/Thread_Exit.cpp b/dep/acelite/ace/Thread_Exit.cpp index b85d48d1701..8f6484093ad 100644 --- a/dep/acelite/ace/Thread_Exit.cpp +++ b/dep/acelite/ace/Thread_Exit.cpp @@ -1,12 +1,10 @@ -// $Id: Thread_Exit.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Thread_Exit.cpp 92580 2010-11-15 09:48:02Z johnnyw $ #include "ace/Thread_Exit.h" #include "ace/Managed_Object.h" #include "ace/Thread_Manager.h" #include "ace/Guard_T.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL bool ACE_Thread_Exit::is_constructed_ = false; diff --git a/dep/acelite/ace/Thread_Hook.cpp b/dep/acelite/ace/Thread_Hook.cpp index 1121e4b44ae..03b2fd74cdb 100644 --- a/dep/acelite/ace/Thread_Hook.cpp +++ b/dep/acelite/ace/Thread_Hook.cpp @@ -1,10 +1,8 @@ -// $Id: Thread_Hook.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Thread_Hook.cpp 94054 2011-05-11 18:28:20Z johnnyw $ #include "ace/Thread_Hook.h" #include "ace/Object_Manager_Base.h" - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Thread_Hook::~ACE_Thread_Hook () @@ -12,8 +10,7 @@ ACE_Thread_Hook::~ACE_Thread_Hook () } ACE_THR_FUNC_RETURN -ACE_Thread_Hook::start (ACE_THR_FUNC func, - void *arg) +ACE_Thread_Hook::start (ACE_THR_FUNC func, void *arg) { return (func) (arg); } diff --git a/dep/acelite/ace/Thread_Hook.h b/dep/acelite/ace/Thread_Hook.h index 7bc3bcce492..df0d0293cc4 100644 --- a/dep/acelite/ace/Thread_Hook.h +++ b/dep/acelite/ace/Thread_Hook.h @@ -4,13 +4,12 @@ /** * @file Thread_Hook.h * - * $Id: Thread_Hook.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Thread_Hook.h 94054 2011-05-11 18:28:20Z johnnyw $ * * @author Carlos O'Ryan <coryan@uci.edu> */ //============================================================================= - #ifndef ACE_THREAD_HOOK_H #define ACE_THREAD_HOOK_H #include /**/ "ace/pre.h" @@ -34,9 +33,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL */ class ACE_Export ACE_Thread_Hook { - public: - /// Destructor. virtual ~ACE_Thread_Hook (void); @@ -51,7 +48,7 @@ public: virtual ACE_THR_FUNC_RETURN start (ACE_THR_FUNC func, void *arg); - /// sets the system wide thread hook, returns the previous thread + /// Sets the system wide thread hook, returns the previous thread /// hook or 0 if none is set. static ACE_Thread_Hook *thread_hook (ACE_Thread_Hook *hook); diff --git a/dep/acelite/ace/Thread_Manager.cpp b/dep/acelite/ace/Thread_Manager.cpp index 587636b6776..f26c7adbde9 100644 --- a/dep/acelite/ace/Thread_Manager.cpp +++ b/dep/acelite/ace/Thread_Manager.cpp @@ -1,4 +1,4 @@ -// $Id: Thread_Manager.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: Thread_Manager.cpp 96067 2012-08-16 13:45:10Z mcorino $ #include "ace/TSS_T.h" #include "ace/Thread_Manager.h" @@ -188,9 +188,16 @@ ACE_Thread_Descriptor::terminate () } #endif /* !ACE_HAS_VXTHREADS */ - // Remove thread descriptor from the table. + // Remove thread descriptor from the table. 'this' is invalid + // upon return. if (this->tm_ != 0) - tm_->remove_thr (this, close_handle); + { + // remove_thr makes use of 'this' invalid on return. + // Code below will free log_msg, so clear our pointer + // now - it's already been saved in log_msg. + this->log_msg_ = 0; + tm_->remove_thr (this, close_handle); + } } // Check if we need delete ACE_Log_Msg instance @@ -203,9 +210,6 @@ ACE_Thread_Descriptor::terminate () } else { - // Thread_Descriptor is the owner of the Log_Msg instance!! - // deleted. - this->log_msg_ = 0; delete log_msg; } } @@ -257,6 +261,7 @@ ACE_Thread_Descriptor::dump (void) const ACE_Thread_Descriptor::ACE_Thread_Descriptor (void) : log_msg_ (0), at_exit_list_ (0), + tm_ (0), terminated_ (false) { ACE_TRACE ("ACE_Thread_Descriptor::ACE_Thread_Descriptor"); @@ -369,6 +374,25 @@ ACE_Thread_Manager::ACE_Thread_Manager (size_t prealloc, ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager"); } +ACE_Thread_Manager::ACE_Thread_Manager (const ACE_Condition_Attributes &attributes, + size_t prealloc, + size_t lwm, + size_t inc, + size_t hwm) + : grp_id_ (1), + automatic_wait_ (1) +#if defined (ACE_HAS_THREADS) + , zero_cond_ (lock_, attributes) +#endif /* ACE_HAS_THREADS */ + , thread_desc_freelist_ (ACE_FREE_LIST_WITH_POOL, + prealloc, lwm, hwm, inc) +{ +#if !defined (ACE_HAS_THREADS) + ACE_UNUSED_ARG (attributes); +#endif /* ACE_HAS_THREADS */ + ACE_TRACE ("ACE_Thread_Manager::ACE_Thread_Manager"); +} + #if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) ACE_Thread_Manager * ACE_Thread_Manager::instance (void) @@ -525,10 +549,11 @@ ace_thread_manager_adapter (void *args) exit_hook.thr_mgr (thread_args->thr_mgr ()); // Invoke the user-supplied function with the args. - void *status = thread_args->invoke (); + ACE_THR_FUNC_RETURN status = thread_args->invoke (); delete static_cast<ACE_Base_Thread_Adapter *> (thread_args); - return status; + + return reinterpret_cast<void *> (status); } #endif @@ -571,7 +596,8 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, this, new_thr_desc.get (), ACE_OS_Object_Manager::seh_except_selector(), - ACE_OS_Object_Manager::seh_except_handler()), + ACE_OS_Object_Manager::seh_except_handler(), + flags), -1); # else ACE_NEW_RETURN (thread_args, @@ -579,7 +605,8 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, args, (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, this, - new_thr_desc.get ()), + new_thr_desc.get (), + flags), -1); # endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args (static_cast<ACE_Base_Thread_Adapter *> (thread_args)); @@ -1600,13 +1627,16 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout, { ACE_TRACE ("ACE_Thread_Manager::wait"); - ACE_Time_Value local_timeout; + ACE_Auto_Ptr<ACE_Time_Value> local_timeout; // Check to see if we're using absolute time or not. if (use_absolute_time == false && timeout != 0) { - local_timeout = *timeout; - local_timeout += ACE_OS::gettimeofday (); - timeout = &local_timeout; + // create time value duplicate (preserves time policy) + local_timeout.reset (timeout->duplicate ()); + // convert time value to absolute time + (*local_timeout) = local_timeout->to_absolute_time (); + // replace original time by abs time duplicate + timeout = local_timeout.get (); } #if !defined (ACE_HAS_VXTHREADS) diff --git a/dep/acelite/ace/Thread_Manager.h b/dep/acelite/ace/Thread_Manager.h index 650287277d7..59d81fd1981 100644 --- a/dep/acelite/ace/Thread_Manager.h +++ b/dep/acelite/ace/Thread_Manager.h @@ -4,7 +4,7 @@ /** * @file Thread_Manager.h * - * $Id: Thread_Manager.h 83956 2008-12-03 07:57:38Z johnnyw $ + * $Id: Thread_Manager.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -174,7 +174,7 @@ class ACE_Export ACE_Thread_Descriptor_Base : public ACE_OS_Thread_Descriptor friend class ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor>; public: ACE_Thread_Descriptor_Base (void); - ~ACE_Thread_Descriptor_Base (void); + virtual ~ACE_Thread_Descriptor_Base (void); // = We need the following operators to make Borland happy. @@ -437,6 +437,11 @@ public: size_t lwm = ACE_DEFAULT_THREAD_MANAGER_LWM, size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC, size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM); + ACE_Thread_Manager (const ACE_Condition_Attributes &attributes, + size_t preaolloc = ACE_DEFAULT_THREAD_MANAGER_PREALLOC, + size_t lwm = ACE_DEFAULT_THREAD_MANAGER_LWM, + size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC, + size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM); ~ACE_Thread_Manager (void); #if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) diff --git a/dep/acelite/ace/Thread_Mutex.h b/dep/acelite/ace/Thread_Mutex.h index 7bda270e5d3..71fff2db17b 100644 --- a/dep/acelite/ace/Thread_Mutex.h +++ b/dep/acelite/ace/Thread_Mutex.h @@ -4,7 +4,7 @@ /** * @file Thread_Mutex.h * - * $Id: Thread_Mutex.h 92060 2010-09-27 18:08:48Z johnnyw $ + * $Id: Thread_Mutex.h 96061 2012-08-16 09:36:07Z mcorino $ * * Moved from Synch.h. * @@ -49,7 +49,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL */ class ACE_Export ACE_Thread_Mutex { - friend class ACE_Condition_Thread_Mutex; public: /// Constructor. ACE_Thread_Mutex (const ACE_TCHAR *name = 0, diff --git a/dep/acelite/ace/Thread_Semaphore.h b/dep/acelite/ace/Thread_Semaphore.h index d7013d9c3f2..c9843a919ad 100644 --- a/dep/acelite/ace/Thread_Semaphore.h +++ b/dep/acelite/ace/Thread_Semaphore.h @@ -4,7 +4,7 @@ /** * @file Thread_Semaphore.h * - * $Id: Thread_Semaphore.h 86731 2009-09-17 12:23:48Z johnnyw $ + * $Id: Thread_Semaphore.h 95807 2012-06-01 12:44:19Z johnnyw $ * * Moved from Synch.h. * @@ -47,7 +47,7 @@ public: void * = 0, int max = 0x7FFFFFFF); - /// Default dtor. + /// Default destructor. ~ACE_Thread_Semaphore (void); /// Dump the state of an object. diff --git a/dep/acelite/ace/Throughput_Stats.cpp b/dep/acelite/ace/Throughput_Stats.cpp index 87a63c715ef..f8e27fba837 100644 --- a/dep/acelite/ace/Throughput_Stats.cpp +++ b/dep/acelite/ace/Throughput_Stats.cpp @@ -1,4 +1,4 @@ -// $Id: Throughput_Stats.cpp 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Throughput_Stats.cpp 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Throughput_Stats.h" @@ -25,10 +25,6 @@ ACE_Throughput_Stats::sample (ACE_UINT64 throughput, if (this->samples_count () == 1u) { - this->throughput_last_ = throughput; - } - else - { this->throughput_last_ = throughput; } } @@ -53,7 +49,7 @@ ACE_Throughput_Stats::accumulate (const ACE_Throughput_Stats &rhs) void ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg, - ACE_UINT32 sf) + ACE_Basic_Stats::scale_factor_type sf) { if (this->samples_count () == 0u) { @@ -71,20 +67,13 @@ ACE_Throughput_Stats::dump_results (const ACE_TCHAR* msg, void ACE_Throughput_Stats::dump_throughput (const ACE_TCHAR *msg, - ACE_UINT32 sf, + ACE_Basic_Stats::scale_factor_type sf, ACE_UINT64 elapsed_time, ACE_UINT32 samples_count) { #ifndef ACE_NLOGGING double seconds = -# if defined ACE_LACKS_LONGLONG_T - elapsed_time / sf; -#elif defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER ( - ACE_U_LongLong(elapsed_time / sf))); -# else /* ! ACE_LACKS_LONGLONG_T */ static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER (elapsed_time / sf)); -# endif /* ! ACE_LACKS_LONGLONG_T */ seconds /= ACE_HR_SCALE_CONVERSION; const double t_avg = samples_count / seconds; diff --git a/dep/acelite/ace/Throughput_Stats.h b/dep/acelite/ace/Throughput_Stats.h index f9a97122aae..0911e8d4b8d 100644 --- a/dep/acelite/ace/Throughput_Stats.h +++ b/dep/acelite/ace/Throughput_Stats.h @@ -4,7 +4,7 @@ /** * @file Throughput_Stats.h * - * $Id: Throughput_Stats.h 92069 2010-09-28 11:38:59Z johnnyw $ + * $Id: Throughput_Stats.h 95743 2012-05-13 12:29:28Z johnnyw $ * * @author David L. Levine */ @@ -55,11 +55,11 @@ public: void accumulate (const ACE_Throughput_Stats &throughput); /// Print down the stats - void dump_results (const ACE_TCHAR* msg, ACE_UINT32 scale_factor); + void dump_results (const ACE_TCHAR* msg, scale_factor_type scale_factor); /// Dump the average throughput stats. static void dump_throughput (const ACE_TCHAR *msg, - ACE_UINT32 scale_factor, + scale_factor_type scale_factor, ACE_UINT64 elapsed_time, ACE_UINT32 samples_count); private: diff --git a/dep/acelite/ace/Time_Policy.cpp b/dep/acelite/ace/Time_Policy.cpp new file mode 100644 index 00000000000..c44daa7fe96 --- /dev/null +++ b/dep/acelite/ace/Time_Policy.cpp @@ -0,0 +1,34 @@ +// $Id: Time_Policy.cpp 96061 2012-08-16 09:36:07Z mcorino $ + +#include "ace/Time_Policy.h" + +#if !defined(__ACE_INLINE__) +# include "ace/Time_Policy.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Dynamic_Time_Policy_Base::~ACE_Dynamic_Time_Policy_Base () +{ +} + + +class NULL_Time_Policy : public ACE_Dynamic_Time_Policy_Base +{ +protected: + virtual ACE_Time_Value_T<ACE_Delegating_Time_Policy> gettimeofday () const; +}; + +ACE_Time_Value_T<ACE_Delegating_Time_Policy> NULL_Time_Policy::gettimeofday () const +{ + return ACE_Time_Value_T<ACE_Delegating_Time_Policy> (ACE_Time_Value::zero); +} + +static NULL_Time_Policy null_policy_; + +ACE_Delegating_Time_Policy::ACE_Delegating_Time_Policy (ACE_Dynamic_Time_Policy_Base const * delegate) + : delegate_ (delegate != 0 ? delegate : &null_policy_) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Time_Policy.h b/dep/acelite/ace/Time_Policy.h new file mode 100644 index 00000000000..a94dd9591c7 --- /dev/null +++ b/dep/acelite/ace/Time_Policy.h @@ -0,0 +1,172 @@ +#ifndef ACE_TIME_POLICY_H +#define ACE_TIME_POLICY_H +// -*- C++ -*- +/** + * @file Time_Policy.h + * + * $Id: Time_Policy.h 96061 2012-08-16 09:36:07Z mcorino $ + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * @author Martin Corino <mcorino@remedy.nl> + */ +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#include /**/ "ace/Time_Value_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_System_Time_Policy + * + * @brief Implement the system time policy for ACE. + * + * The most common time policy is to simply use + * ACE_OS::gettimeofday(), this class implements that policy, i.e., it + * simply calls that function. + */ +class ACE_Export ACE_System_Time_Policy +{ +public: + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_System_Time_Policy> operator() () const; + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +}; + +/** + * @class ACE_HR_Time_Policy + * + * @brief Implement a time policy based on the ACE Highres timer. + * + */ +class ACE_Export ACE_HR_Time_Policy +{ +public: + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_HR_Time_Policy> operator() () const; + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +}; + +/** + * @class ACE_FPointer_Timer_Policy + * + * @brief Implement a time policy based on a function pointer. + * + * This time policy allows dynamic changes to the source of time by + * using a function pointer. + */ +class ACE_Export ACE_FPointer_Time_Policy +{ +public: + /** + * @brief Default constructor uses ACE_OS::gettimeofday() + * + * ACE_T requires a default constructor that leaves the + * policy in a functional state. Therefore, a null pointer would + * not be desirable, in other words, we need a non-trivial default + * constructor. + */ + ACE_FPointer_Time_Policy(); + + /** + * @typedef FPtr + * + * Short-hand for the right type of pointer to function. + */ + typedef ACE_Time_Value (*FPtr)(); + + /** + * @brief Constructor from a pointer to function. + * + * Construct from a pointer to function. + */ + ACE_FPointer_Time_Policy(FPtr f); + + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_FPointer_Time_Policy> operator()() const; + + /// Satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +private: + FPtr function_; +}; + +class ACE_Dynamic_Time_Policy_Base; // forward decl + +/** + * @class ACE_Delegating_Time_Policy + * + * @brief Implement a time policy that delegates to a dynamic + * time policy. + */ +class ACE_Export ACE_Delegating_Time_Policy +{ +public: + ACE_Delegating_Time_Policy (ACE_Dynamic_Time_Policy_Base const * delegate = 0); + + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_Delegating_Time_Policy> operator()() const; + + /// Set delegate + void set_delegate (ACE_Dynamic_Time_Policy_Base const * delegate); + + /// Copy policy + ACE_Delegating_Time_Policy& operator =(ACE_Delegating_Time_Policy const & pol); + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +private: + ACE_Dynamic_Time_Policy_Base const * delegate_; +}; + +/** + * @class ACE_Dynamic_Time_Policy_base + * + * @brief Abstract base class for dynamically loaded and/or shared + * time policies. + * + */ +class ACE_Export ACE_Dynamic_Time_Policy_Base +{ +public: + virtual ~ACE_Dynamic_Time_Policy_Base (); + + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_Delegating_Time_Policy> operator()() const; + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +protected: + /// Return the current time according to policy implementation. + virtual ACE_Time_Value_T<ACE_Delegating_Time_Policy> gettimeofday () const = 0; +}; + +/// Temporarily, for backwards compatibility reasons, this will +/// be the default time policy. In time to be replaced by +/// ACE_System_Time_Policy. +typedef ACE_FPointer_Time_Policy ACE_Default_Time_Policy; + +#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT +template class ACE_Export ACE_Time_Value_T<ACE_System_Time_Policy>; +template class ACE_Export ACE_Time_Value_T<ACE_HR_Time_Policy>; +template class ACE_Export ACE_Time_Value_T<ACE_FPointer_Time_Policy>; +template class ACE_Export ACE_Time_Value_T<ACE_Delegating_Time_Policy>; +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Time_Policy.inl" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIME_POLICY_H */ diff --git a/dep/acelite/ace/Time_Policy.inl b/dep/acelite/ace/Time_Policy.inl new file mode 100644 index 00000000000..b59a0f675d2 --- /dev/null +++ b/dep/acelite/ace/Time_Policy.inl @@ -0,0 +1,95 @@ +// -*- C++ -*- +// +// $Id: Time_Policy.inl 96061 2012-08-16 09:36:07Z mcorino $ + +#include "ace/OS_NS_sys_time.h" +#include "ace/High_Res_Timer.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_Time_Value_T<ACE_System_Time_Policy> +ACE_System_Time_Policy::operator()() const +{ + return ACE_Time_Value_T<ACE_System_Time_Policy> (ACE_OS::gettimeofday()); +} + +ACE_INLINE void +ACE_System_Time_Policy::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +ACE_INLINE ACE_Time_Value_T<ACE_HR_Time_Policy> +ACE_HR_Time_Policy::operator()() const +{ + return ACE_Time_Value_T<ACE_HR_Time_Policy> (ACE_High_Res_Timer::gettimeofday_hr ()); +} + +ACE_INLINE void +ACE_HR_Time_Policy::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +ACE_INLINE +ACE_FPointer_Time_Policy::ACE_FPointer_Time_Policy() + : function_(ACE_OS::gettimeofday) +{ +} + +ACE_INLINE +ACE_FPointer_Time_Policy:: +ACE_FPointer_Time_Policy(ACE_FPointer_Time_Policy::FPtr f) + : function_(f) +{ +} + +ACE_INLINE ACE_Time_Value_T<ACE_FPointer_Time_Policy> +ACE_FPointer_Time_Policy::operator()() const +{ + return ACE_Time_Value_T<ACE_FPointer_Time_Policy> ((*this->function_)(), *this); +} + +ACE_INLINE void +ACE_FPointer_Time_Policy::set_gettimeofday (ACE_Time_Value (*f)(void)) +{ + this->function_ = f; +} + +ACE_INLINE ACE_Time_Value_T<ACE_Delegating_Time_Policy> +ACE_Dynamic_Time_Policy_Base::operator()() const +{ + return this->gettimeofday (); +} + +ACE_INLINE void +ACE_Dynamic_Time_Policy_Base::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +ACE_INLINE ACE_Time_Value_T<ACE_Delegating_Time_Policy> +ACE_Delegating_Time_Policy::operator()() const +{ + return (*this->delegate_) (); +} + +ACE_INLINE void +ACE_Delegating_Time_Policy::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +ACE_INLINE void +ACE_Delegating_Time_Policy::set_delegate (ACE_Dynamic_Time_Policy_Base const * delegate) +{ + if (delegate != 0) + { + this->delegate_ = delegate; + } +} + +ACE_INLINE ACE_Delegating_Time_Policy& +ACE_Delegating_Time_Policy::operator =(ACE_Delegating_Time_Policy const & pol) +{ + this->delegate_ = pol.delegate_; + return *this; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Time_Policy_T.cpp b/dep/acelite/ace/Time_Policy_T.cpp new file mode 100644 index 00000000000..6845131aa21 --- /dev/null +++ b/dep/acelite/ace/Time_Policy_T.cpp @@ -0,0 +1,27 @@ +// $Id: Time_Policy_T.cpp 96061 2012-08-16 09:36:07Z mcorino $ + +#ifndef ACE_TIME_POLICY_T_CPP +#define ACE_TIME_POLICY_T_CPP + +#include "ace/Time_Policy_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Time_Policy_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <typename TIME_POLICY> +ACE_Time_Policy_T<TIME_POLICY>::~ACE_Time_Policy_T () +{ +} + +template <typename TIME_POLICY> ACE_Time_Value_T<ACE_Delegating_Time_Policy> +ACE_Time_Policy_T<TIME_POLICY>::gettimeofday () const +{ + return ACE_Time_Value_T<ACE_Delegating_Time_Policy> (this->time_policy_ (), ACE_Delegating_Time_Policy (this)); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIME_POLICY_T_CPP */ diff --git a/dep/acelite/ace/Time_Policy_T.h b/dep/acelite/ace/Time_Policy_T.h new file mode 100644 index 00000000000..bde0c5c45bc --- /dev/null +++ b/dep/acelite/ace/Time_Policy_T.h @@ -0,0 +1,77 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Time_Policy_T.h + * + * $Id: Time_Policy_T.h 96061 2012-08-16 09:36:07Z mcorino $ + * + * @author Martin Corino <mcorino@remedy.nl> + */ +//============================================================================= + +#ifndef ACE_TIME_POLICY_T_H +#define ACE_TIME_POLICY_T_H + +#include /**/ "ace/pre.h" + +#include /**/ "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Time_Policy.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Time_Policy_T + * + * @brief Template class implementing a dynamic time policy based on + * another time policy + * + */ +template <typename TIME_POLICY> +class ACE_Time_Policy_T : public ACE_Dynamic_Time_Policy_Base +{ +public: + ACE_Time_Policy_T (TIME_POLICY const & time_policy = TIME_POLICY()); + virtual ~ACE_Time_Policy_T (); + + /// Return the current time according to this policy + ACE_Time_Value_T<ACE_Delegating_Time_Policy> operator()() const; + + /// Allows applications to control how the timer queue gets the time + /// of day. + void set_time_policy(TIME_POLICY const & time_policy); + + /// Noop. Just here to satisfy backwards compatibility demands. + void set_gettimeofday (ACE_Time_Value (*gettimeofday)(void)); +protected: + /// Return the current time according to policy implementation. + virtual ACE_Time_Value_T<ACE_Delegating_Time_Policy> gettimeofday () const; + +private: + /// The policy to return the current time of day + TIME_POLICY time_policy_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#if defined (__ACE_INLINE__) +#include "ace/Time_Policy_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Time_Policy_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Time_Policy_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + + +#endif /* ACE_TIME_POLICY_T_H */ diff --git a/dep/acelite/ace/Time_Policy_T.inl b/dep/acelite/ace/Time_Policy_T.inl new file mode 100644 index 00000000000..23a07813a6c --- /dev/null +++ b/dep/acelite/ace/Time_Policy_T.inl @@ -0,0 +1,32 @@ +// -*- C++ -*- +// +// $Id: Time_Policy_T.inl 96066 2012-08-16 12:45:46Z mcorino $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <typename TIME_POLICY> +ACE_INLINE +ACE_Time_Policy_T<TIME_POLICY>::ACE_Time_Policy_T (TIME_POLICY const & time_policy) + : time_policy_ (time_policy) +{ +} + +template <typename TIME_POLICY> +ACE_INLINE ACE_Time_Value_T<ACE_Delegating_Time_Policy> +ACE_Time_Policy_T<TIME_POLICY>::operator() () const +{ + return this->gettimeofday (); +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Time_Policy_T<TIME_POLICY>::set_gettimeofday (ACE_Time_Value (*)(void)) +{ +} + +template <typename TIME_POLICY> ACE_INLINE void +ACE_Time_Policy_T<TIME_POLICY>::set_time_policy(TIME_POLICY const & time_policy) +{ + this->time_policy_ = time_policy; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Time_Value.cpp b/dep/acelite/ace/Time_Value.cpp index 045df4d4e66..0b13cdedac9 100644 --- a/dep/acelite/ace/Time_Value.cpp +++ b/dep/acelite/ace/Time_Value.cpp @@ -1,4 +1,4 @@ -// $Id: Time_Value.cpp 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Time_Value.cpp 96061 2012-08-16 09:36:07Z mcorino $ #include "ace/Time_Value.h" @@ -9,6 +9,7 @@ #include "ace/Numeric_Limits.h" #include "ace/If_Then_Else.h" #include "ace/OS_NS_math.h" +#include "ace/Time_Policy.h" #ifdef ACE_HAS_CPP98_IOSTREAMS #include <ostream> @@ -33,6 +34,9 @@ const ACE_Time_Value ACE_Time_Value::max_time ( ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value) +ACE_Time_Value::~ACE_Time_Value() +{} + /// Increment microseconds (the only reason this is here is to allow /// the use of ACE_Atomic_Op with ACE_Time_Value). ACE_Time_Value @@ -81,13 +85,8 @@ ACE_Time_Value::operator -- (void) /// /// In the beginning (Jan. 1, 1601), there was no time and no computer. /// And Bill said: "Let there be time," and there was time.... -# if defined (ACE_LACKS_LONGLONG_T) -const ACE_U_LongLong ACE_Time_Value::FILETIME_to_timval_skew = -ACE_U_LongLong (0xd53e8000, 0x19db1de); -# else const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew = ACE_INT64_LITERAL (0x19db1ded53e8000); -# endif /// Initializes the ACE_Time_Value object from a Win32 FILETIME ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) @@ -98,15 +97,7 @@ ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) void ACE_Time_Value::set (const FILETIME &file_time) { - // Initializes the ACE_Time_Value object from a Win32 FILETIME -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_100ns(file_time.dwLowDateTime, file_time.dwHighDateTime); - LL_100ns -= ACE_Time_Value::FILETIME_to_timval_skew; - // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); - // Convert remainder to microseconds; - this->tv_.tv_usec = (suseconds_t)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); -#else + // Initializes the ACE_Time_Value object from a Win32 FILETIME // Don't use a struct initializer, gcc don't like it. ULARGE_INTEGER _100ns; _100ns.LowPart = file_time.dwLowDateTime; @@ -115,10 +106,10 @@ void ACE_Time_Value::set (const FILETIME &file_time) _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); + this->tv_.tv_sec = (time_t) (_100ns.QuadPart / (10000 * 1000)); // Convert remainder to microseconds; this->tv_.tv_usec = (suseconds_t) ((_100ns.QuadPart % (10000 * 1000)) / 10); -#endif // ACE_LACKS_LONGLONG_T + this->normalize (); } @@ -128,15 +119,6 @@ ACE_Time_Value::operator FILETIME () const FILETIME file_time; // ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME"); -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_sec(this->tv_.tv_sec); - ACE_U_LongLong LL_usec(this->tv_.tv_usec); - ACE_U_LongLong LL_100ns = LL_sec * (ACE_UINT32)(10000 * 1000) + - LL_usec * (ACE_UINT32)10 + - ACE_Time_Value::FILETIME_to_timval_skew; - file_time.dwLowDateTime = LL_100ns.lo(); - file_time.dwHighDateTime = LL_100ns.hi(); -#else ULARGE_INTEGER _100ns; _100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) + this->tv_.tv_usec * 10) + @@ -144,13 +126,40 @@ ACE_Time_Value::operator FILETIME () const file_time.dwLowDateTime = _100ns.LowPart; file_time.dwHighDateTime = _100ns.HighPart; -#endif //ACE_LACKS_LONGLONG_T return file_time; } - #endif /* ACE_WIN32 */ +ACE_Time_Value +ACE_Time_Value::now () const +{ + ACE_System_Time_Policy systp; + return systp (); +} + +ACE_Time_Value +ACE_Time_Value::to_relative_time () const +{ + ACE_System_Time_Policy systp; + return (*this) - systp (); +} + +ACE_Time_Value +ACE_Time_Value::to_absolute_time () const +{ + ACE_System_Time_Policy systp; + return (*this) + systp (); +} + +ACE_Time_Value * +ACE_Time_Value::duplicate () const +{ + ACE_Time_Value * tmp = 0; + ACE_NEW_RETURN (tmp, ACE_Time_Value (*this), 0); + return tmp; +} + void ACE_Time_Value::dump (void) const { @@ -213,13 +222,13 @@ ACE_Time_Value::normalize (bool saturate) this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; } // tv_sec in qnxnto is unsigned -#if !defined ( __QNXNTO__) +#if !defined ( __QNX__) else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) { ++this->tv_.tv_sec; this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; } -#endif /* __QNXNTO__ */ +#endif /* __QNX__ */ } diff --git a/dep/acelite/ace/Time_Value.h b/dep/acelite/ace/Time_Value.h index f92c8c7f7f5..522b1e0b0ae 100644 --- a/dep/acelite/ace/Time_Value.h +++ b/dep/acelite/ace/Time_Value.h @@ -4,7 +4,7 @@ /** * @file Time_Value.h * - * $Id: Time_Value.h 90683 2010-06-17 22:07:42Z shuston $ + * $Id: Time_Value.h 96061 2012-08-16 09:36:07Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -35,17 +35,7 @@ suseconds_t const ACE_ONE_SECOND_IN_USECS = 1000000; // needed to determine if iostreams are present #include "ace/iosfwd.h" -// This forward declaration is needed by the set() and FILETIME() functions -#if defined (ACE_LACKS_LONGLONG_T) ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Export ACE_U_LongLong; -ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_LACKS_LONGLONG_T */ - -// ------------------------------------------------------------------- - -ACE_BEGIN_VERSIONED_NAMESPACE_DECL - /** * @class ACE_Time_Value @@ -90,6 +80,9 @@ public: /// Construct the ACE_Time_Value object from a timespec_t. explicit ACE_Time_Value (const timespec_t &t); + /// Destructor + virtual ~ACE_Time_Value (); + # if defined (ACE_WIN32) /// Construct the ACE_Time_Value object from a Win32 FILETIME explicit ACE_Time_Value (const FILETIME &ft); @@ -250,7 +243,7 @@ public: /// Subtract @a tv to this. ACE_Time_Value &operator -= (const ACE_Time_Value &tv); - /// Substract @a tv to this. + /// Subtract @a tv to this. ACE_Time_Value &operator -= (time_t tv); /** @@ -330,6 +323,51 @@ public: double d); //@} + /// Get current time of day. + /** + * @return Time value representing current time of day. + * + * @note This method is overloaded in the time policy based template + * instantiations derived from this class. Allows for time policy + * aware time values. + */ + virtual ACE_Time_Value now () const; + + /// Converts absolute time value to time value relative to current time of day. + /** + * @return Relative time value. + * + * @note This method is overloaded in the time policy based template + * instantiations derived from this class. Allows for time policy + * aware time values. + * The developer is responsible for making sure this is an absolute + * time value compatible with the active time policy (which is system + * time for the base class). + */ + virtual ACE_Time_Value to_relative_time () const; + + /// Converts relative time value to absolute time value based on current time of day. + /** + * @return Absolute time value. + * + * @note This method is overloaded in the time policy based template + * instantiations derived from this class. Allows for time policy + * aware time values. + * The developer is responsible for making sure this is a relative + * time value. Current time of day is determined based on time policy + * (which is system time for the base class). + */ + virtual ACE_Time_Value to_absolute_time () const; + + /// Duplicates this time value (incl. time policy). + /** + * @return Dynamically allocated time value copy. + * + * @note The caller is responsible for freeing the copy when it's not needed + * anymore. + */ + virtual ACE_Time_Value * duplicate () const; + /// Dump is a no-op. /** * The dump() method is a no-op. It's here for backwards compatibility @@ -341,11 +379,7 @@ public: # if defined (ACE_WIN32) /// Const time difference between FILETIME and POSIX time. -# if defined (ACE_LACKS_LONGLONG_T) - static const ACE_U_LongLong FILETIME_to_timval_skew; -# else static const DWORDLONG FILETIME_to_timval_skew; -# endif // ACE_LACKS_LONGLONG_T # endif /* ACE_WIN32 */ private: diff --git a/dep/acelite/ace/Time_Value.inl b/dep/acelite/ace/Time_Value.inl index 8f7bf23d837..c0a16c1b50c 100644 --- a/dep/acelite/ace/Time_Value.inl +++ b/dep/acelite/ace/Time_Value.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Time_Value.inl 90689 2010-06-18 11:14:47Z shuston $ +// $Id: Time_Value.inl 95761 2012-05-15 18:23:04Z johnnyw $ #include "ace/Truncate.h" @@ -58,23 +58,11 @@ ACE_INLINE void ACE_Time_Value::set (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::set"); -# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) && defined (_MSC_VER) - // The WinCE 6.0 SDK ships with a timeval tv_sec member that uses long as type - // not time_t. This resolves in compilation warnings because time_t - // can be 64bit. Disable at this momemt the warning for just this method - // else we get a compile warnings each time this inline file is included - // this file. -# pragma warning (push) -# pragma warning (disable: 4244) -# endif this->tv_.tv_sec = sec; -# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) && defined (_MSC_VER) -# pragma warning (pop) -# endif this->tv_.tv_usec = usec; -#if __GNUC__ - if (__builtin_constant_p(sec) && - __builtin_constant_p(usec) && +#if __GNUC__ && !(__GNUC__ == 3 && __GNUC_MINOR__ == 4) + if ((__builtin_constant_p(sec) & + __builtin_constant_p(usec)) && (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) return; #endif @@ -85,7 +73,7 @@ ACE_INLINE void ACE_Time_Value::set (double d) { // ACE_OS_TRACE ("ACE_Time_Value::set"); - long l = (long) d; + time_t l = (time_t) d; this->tv_.tv_sec = l; this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); this->normalize (); @@ -131,7 +119,7 @@ ACE_INLINE void ACE_Time_Value::sec (time_t sec) { // ACE_OS_TRACE ("ACE_Time_Value::sec"); - this->tv_.tv_sec = ACE_Utils::truncate_cast<long> (sec); + this->tv_.tv_sec = sec; } /// Converts from Time_Value format into milli-seconds format. @@ -222,15 +210,7 @@ ACE_INLINE void ACE_Time_Value::to_usec (ACE_UINT64 & usec) const { // ACE_OS_TRACE ("ACE_Time_Value::to_usec"); - -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - usec = ACE_U_LongLong (static_cast<long long> (this->tv_.tv_sec)); -#elif defined (ACE_LACKS_LONGLONG_T) - // No native 64-bit type, meaning time_t is most likely 32 bits. - usec = ACE_U_LongLong (this->tv_.tv_sec); -#else usec = static_cast<ACE_UINT64> (this->tv_.tv_sec); -#endif /* ACE_LACKS_LONGLONG_T */ usec *= 1000000; usec += this->tv_.tv_usec; } diff --git a/dep/acelite/ace/Time_Value_T.cpp b/dep/acelite/ace/Time_Value_T.cpp new file mode 100644 index 00000000000..e7fdec98762 --- /dev/null +++ b/dep/acelite/ace/Time_Value_T.cpp @@ -0,0 +1,52 @@ +// $Id: Time_Value_T.cpp 96061 2012-08-16 09:36:07Z mcorino $ + +#ifndef ACE_TIME_VALUE_T_CPP +#define ACE_TIME_VALUE_T_CPP + +#include "ace/Time_Value_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Time_Value_T.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/OS_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class TIME_POLICY> +ACE_Time_Value +ACE_Time_Value_T<TIME_POLICY>::now () const +{ + return this->time_policy_ (); +} + +template <class TIME_POLICY> +ACE_Time_Value +ACE_Time_Value_T<TIME_POLICY>::to_relative_time () const +{ + return (*this) - this->time_policy_ (); +} + +template <class TIME_POLICY> +ACE_Time_Value +ACE_Time_Value_T<TIME_POLICY>::to_absolute_time () const +{ + return (*this) + this->time_policy_ (); +} + +template <class TIME_POLICY> +ACE_Time_Value * +ACE_Time_Value_T<TIME_POLICY>::duplicate () const +{ + ACE_Time_Value_T<TIME_POLICY> * tmp = 0; + ACE_NEW_RETURN (tmp, ACE_Time_Value_T<TIME_POLICY> (*this), 0); + return tmp; +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIME_VALUE_T_CPP */ diff --git a/dep/acelite/ace/Time_Value_T.h b/dep/acelite/ace/Time_Value_T.h new file mode 100644 index 00000000000..615d5820a50 --- /dev/null +++ b/dep/acelite/ace/Time_Value_T.h @@ -0,0 +1,194 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Time_Value_T.h + * + * $Id: Time_Value_T.h 96061 2012-08-16 09:36:07Z mcorino $ + * + * @author Martin Corino <mcorino@remedy.nl> + */ +//============================================================================= + +#ifndef ACE_TIME_VALUE_T_H +#define ACE_TIME_VALUE_T_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Time_Value.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Time_Value + * + * @brief Operations on "timeval" structures, which express time in + * seconds (secs) and microseconds (usecs). + * + * This class centralizes all the time related processing in + * ACE. These time values are typically used in conjunction with OS + * mechanisms like <select>, <poll>, or <cond_timedwait>. + */ +template <class TIME_POLICY> +class ACE_Time_Value_T : public ACE_Time_Value +{ +public: + typedef TIME_POLICY time_policy_t; + + // = Initialization methods. + + /// Default Constructor. + ACE_Time_Value_T (void) {} + + /// Constructor. + explicit ACE_Time_Value_T (time_t sec, suseconds_t usec = 0) + : ACE_Time_Value (sec, usec) {} + + // = Methods for converting to/from various time formats. + + /// Construct the ACE_Time_Value from a timeval. + explicit ACE_Time_Value_T (const struct timeval &t) + : ACE_Time_Value (t) {} + + /// Construct the ACE_Time_Value object from a timespec_t. + explicit ACE_Time_Value_T (const timespec_t &t) + : ACE_Time_Value (t) {} + + /// Construct from ACE_Time_Value_T<TIME_POLICY> + ACE_Time_Value_T(const ACE_Time_Value_T<TIME_POLICY>& tv) + : ACE_Time_Value (tv), + time_policy_ (tv.time_policy_) + {} + + /// Construct from ACE_Time_Value + explicit ACE_Time_Value_T(const ACE_Time_Value& tv, + const TIME_POLICY& tp = TIME_POLICY ()) + : ACE_Time_Value (tv), + time_policy_ (tp) + {} + + /// Destructor + virtual ~ACE_Time_Value_T () {} + + /// Add @a tv to this. + ACE_Time_Value_T<TIME_POLICY> &operator += (const ACE_Time_Value &tv); + + /// Add @a tv to this. + ACE_Time_Value_T<TIME_POLICY> &operator += (time_t tv); + + /// Assign @ tv to this + ACE_Time_Value_T<TIME_POLICY> &operator = (const ACE_Time_Value_T<TIME_POLICY> &tv); + + /// Assign @ tv to this + ACE_Time_Value_T<TIME_POLICY> &operator = (const ACE_Time_Value &tv); + + /// Assign @ tv to this + ACE_Time_Value_T<TIME_POLICY> &operator = (time_t tv); + + /// Subtract @a tv to this. + ACE_Time_Value_T<TIME_POLICY> &operator -= (const ACE_Time_Value &tv); + + /// Subtract @a tv to this. + ACE_Time_Value_T<TIME_POLICY> &operator -= (time_t tv); + + /** + \brief Multiply the time value by the @a d factor. + \note The result of the operator is valid for results from range + < (ACE_INT32_MIN, -999999), (ACE_INT32_MAX, 999999) >. Result + outside this range are saturated to a limit. + */ + ACE_Time_Value_T<TIME_POLICY> &operator *= (double d); + + /// Increment microseconds as postfix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value_T<TIME_POLICY> operator++ (int); + + /// Increment microseconds as prefix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value_T<TIME_POLICY> &operator++ (void); + + /// Decrement microseconds as postfix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value_T<TIME_POLICY> operator-- (int); + + /// Decrement microseconds as prefix. + /** + * @note The only reason this is here is to allow the use of ACE_Atomic_Op + * with ACE_Time_Value. + */ + ACE_Time_Value_T<TIME_POLICY> &operator-- (void); + + /// Get current time of day according to time policy. + /** + * @return Time value representing current time of day according to time policy. + */ + virtual ACE_Time_Value now () const; + + /// Converts absolute time value to time value relative to current time of day. + /** + * @return Relative time value. + * + * @note This method uses it's time_policy_ member to get the current + * time of day. + * The developer is responsible for making sure this is an absolute + * time value compatible with the active time policy. + * Note that the returned time value has no notion of the time policy + * on which it is based anymore. + */ + virtual ACE_Time_Value to_relative_time () const; + + /// Converts relative time value to absolute time value based on current time of day. + /** + * @return Absolute time value. + * + * @note This method uses it's time_policy_ member to get the current + * time of day. + * The developer is responsible for making sure this is a relative + * time value. + * Note that the returned time value has no notion of the time policy + * on which it is based anymore. + */ + virtual ACE_Time_Value to_absolute_time () const; + + /// Duplicates this time value (incl. time policy). + /** + * @return Dynamically allocated time value copy. + * + * @note The caller is responsible for freeing the copy when it's not needed + * anymore. + */ + virtual ACE_Time_Value * duplicate () const; + +private: + TIME_POLICY time_policy_; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Time_Value_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Time_Value_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Time_Value_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIME_VALUE_T_H */ diff --git a/dep/acelite/ace/Time_Value_T.inl b/dep/acelite/ace/Time_Value_T.inl new file mode 100644 index 00000000000..e74f16b9194 --- /dev/null +++ b/dep/acelite/ace/Time_Value_T.inl @@ -0,0 +1,94 @@ +// -*- C++ -*- +// +// $Id: Time_Value_T.inl 96061 2012-08-16 09:36:07Z mcorino $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator += (const ACE_Time_Value &tv) +{ + this->ACE_Time_Value::operator +=(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator += (time_t tv) +{ + this->ACE_Time_Value::operator +=(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator = (const ACE_Time_Value_T<TIME_POLICY> &tv) +{ + this->time_policy_ = tv.time_policy_; + this->ACE_Time_Value::operator =(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator = (const ACE_Time_Value &tv) +{ + this->ACE_Time_Value::operator =(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator = (time_t tv) +{ + this->ACE_Time_Value::operator =(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator -= (const ACE_Time_Value &tv) +{ + this->ACE_Time_Value::operator -=(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator -= (time_t tv) +{ + this->ACE_Time_Value::operator -=(tv); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator *= (double d) +{ + this->ACE_Time_Value::operator *=(d); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> ACE_Time_Value_T<TIME_POLICY>::operator++ (int) +{ + ACE_Time_Value_T<TIME_POLICY> tv (*this); + ++*this; + return tv; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator++ (void) +{ + this->ACE_Time_Value::operator ++(); + return *this; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> ACE_Time_Value_T<TIME_POLICY>::operator-- (int) +{ + ACE_Time_Value_T<TIME_POLICY> tv (*this); + --*this; + return tv; +} + +template <class TIME_POLICY> +ACE_Time_Value_T<TIME_POLICY> &ACE_Time_Value_T<TIME_POLICY>::operator-- (void) +{ + this->ACE_Time_Value::operator --(); + return *this; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timeprobe_T.cpp b/dep/acelite/ace/Timeprobe_T.cpp index d23b7b8b869..f440c7edab0 100644 --- a/dep/acelite/ace/Timeprobe_T.cpp +++ b/dep/acelite/ace/Timeprobe_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timeprobe_T.cpp 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Timeprobe_T.cpp 95743 2012-05-13 12:29:28Z johnnyw $ #ifndef ACE_TIMEPROBE_T_CPP #define ACE_TIMEPROBE_T_CPP @@ -250,7 +250,8 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::print_times (void) "thread", "usec")); - double gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_High_Res_Timer::global_scale_factor_type gsf = + ACE_High_Res_Timer::global_scale_factor (); u_long i, j; // First element diff --git a/dep/acelite/ace/Timer_Hash.h b/dep/acelite/ace/Timer_Hash.h index b381419da44..3d786a1a2d1 100644 --- a/dep/acelite/ace/Timer_Hash.h +++ b/dep/acelite/ace/Timer_Hash.h @@ -4,7 +4,7 @@ /** * @file Timer_Hash.h * - * $Id: Timer_Hash.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Hash.h 95335 2011-12-15 13:13:17Z msmit $ * * @author Darrell Brunsch <brunsch@cs.wustl.edu> */ @@ -16,6 +16,7 @@ #include /**/ "ace/pre.h" #include "ace/Timer_Hash_T.h" +#include "ace/Event_Handler_Handle_Timeout_Upcall.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -29,7 +30,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // The following typedef are here for ease of use typedef ACE_Timer_Hash_Upcall <ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Hash_Upcall; @@ -45,26 +46,27 @@ typedef ACE_Timer_Heap_T <ACE_Event_Handler *, typedef ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_List> ACE_Timer_Hash; typedef ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_List> + ACE_Hash_Timer_List, + ACE_Default_Time_Policy> ACE_Timer_Hash_Iterator; typedef ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_Heap> ACE_Timer_Hash_Heap; typedef ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Hash_Timer_Heap> ACE_Timer_Hash_Heap_Iterator; diff --git a/dep/acelite/ace/Timer_Hash_T.cpp b/dep/acelite/ace/Timer_Hash_T.cpp index 3bc82b8a194..55bbdb86d53 100644 --- a/dep/acelite/ace/Timer_Hash_T.cpp +++ b/dep/acelite/ace/Timer_Hash_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_Hash_T.cpp 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Timer_Hash_T.cpp 95595 2012-03-07 13:33:25Z johnnyw $ #ifndef ACE_TIMER_HASH_T_CPP #define ACE_TIMER_HASH_T_CPP @@ -20,8 +20,13 @@ class Hash_Token { public: // This constructor is required by ACE_Locked_Free_List::alloc. - Hash_Token (void) - {} + Hash_Token (void) : + act_ (0), + pos_ (0), + orig_id_ (0), + next_ (0) + { + } Hash_Token<TYPE> *get_next (void) { @@ -171,18 +176,24 @@ ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::deletion ( return result; } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &hash) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::ACE_Timer_Hash_Iterator_T (Hash & hash) : timer_hash_ (hash) { this->first (); // Nothing } +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::~ACE_Timer_Hash_Iterator_T () +{ + // Nothing +} + // Positions the iterator at the first node in the timing hash table -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> void -ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::first (void) { for (this->position_ = 0; this->position_ < this->timer_hash_.table_size_; @@ -204,8 +215,8 @@ ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::first (void) // Positions the iterator at the next node in the bucket or goes to the next // bucket -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> void -ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::next (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::next (void) { if (this->isdone ()) return; @@ -235,17 +246,17 @@ ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::next (void) // Returns true when we are at the end (when bucket_item_ == 0) -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> bool -ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::isdone (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> bool +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::isdone (void) const { return this->iter_ == 0; } // Returns the node at the current position in the sequence -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::item (void) +ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::item (void) { if (this->isdone ()) return 0; @@ -253,9 +264,9 @@ ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::item (void) return this->iter_->item (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> & -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::iter (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Queue_Iterator_T<TYPE> & +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::iter (void) { this->iterator_->first (); return *this->iterator_; @@ -263,12 +274,13 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::iter (void) // Create an empty queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::ACE_Timer_Hash_T ( size_t table_size, FUNCTOR *upcall_functor, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> (upcall_functor, freelist), + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist, + TIME_POLICY const & time_policy) + : Base_Timer_Queue (upcall_functor, freelist, time_policy), size_ (0), table_size_ (table_size), table_functor_ (this), @@ -283,16 +295,14 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( ACE_NEW (table_, BUCKET *[table_size]); - this->gettimeofday (ACE_OS::gettimeofday); - for (size_t i = 0; i < table_size; ++i) { ACE_NEW (this->table_[i], BUCKET (&this->table_functor_, - this->free_list_)); - this->table_[i]->gettimeofday (ACE_OS::gettimeofday); + this->free_list_, + time_policy)); } ACE_NEW (iterator_, @@ -300,11 +310,12 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::ACE_Timer_Hash_T ( FUNCTOR *upcall_functor, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> (upcall_functor, freelist), + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist, + TIME_POLICY const & time_policy) + : Base_Timer_Queue (upcall_functor, freelist, time_policy), size_ (0), table_size_ (ACE_DEFAULT_TIMER_HASH_TABLE_SIZE), table_functor_ (this), @@ -319,17 +330,14 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( ACE_NEW (table_, BUCKET *[ACE_DEFAULT_TIMER_HASH_TABLE_SIZE]); - - this->gettimeofday (ACE_OS::gettimeofday); - for (size_t i = 0; i < this->table_size_; ++i) { ACE_NEW (this->table_[i], BUCKET (&this->table_functor_, - this->free_list_)); - this->table_[i]->gettimeofday (ACE_OS::gettimeofday); + this->free_list_, + time_policy)); } ACE_NEW (iterator_, @@ -338,26 +346,49 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_T ( // Remove all remaining items in the Queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::~ACE_Timer_Hash_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::~ACE_Timer_Hash_T (void) { ACE_TRACE ("ACE_Timer_Hash_T::~ACE_Timer_Hash_T"); ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); delete iterator_; + this->close (); + for (size_t i = 0; i < this->table_size_; ++i) delete this->table_[i]; + delete [] this->table_; } +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::close (void) +{ + ACE_TRACE ("ACE_Timer_Hash_T::close"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Remove all remaining items from the queue. + while (!this->is_empty()) + { + ACE_Timer_Node_T<TYPE>* n = this->remove_first(); + this->upcall_functor ().deletion (*this, + n->get_type(), + n->get_act()); + this->free_node (n); + } + + // leave the rest to destructor + return 0; +} + // Checks if queue is empty. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> bool -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::is_empty (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> bool +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::is_empty (void) const { ACE_TRACE ("ACE_Timer_Hash_T::is_empty"); return this->table_[this->earliest_position_]->is_empty (); @@ -365,16 +396,16 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::is_empty (void) const // Returns earliest time in a non-empty bucket -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> const ACE_Time_Value & -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::earliest_time (void) const +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::earliest_time (void) const { ACE_TRACE ("ACE_Timer_Hash_T::earliest_time"); return this->table_[this->earliest_position_]->earliest_time (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> void -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dump (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_Hash_T::dump"); @@ -394,9 +425,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dump (void) const // Reschedule a periodic timer. This function must be called with the // mutex lock held. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule ( +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::reschedule ( ACE_Timer_Node_T<TYPE> *expired) { ACE_TRACE ("ACE_Timer_Hash_T::reschedule"); @@ -423,7 +454,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule ( // then here schedule <expired> for deletion. Don't call // this->free_node() because that will invalidate <h> // and that's what user have as timer_id. - ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::free_node (expired); + Base_Timer_Queue::free_node (expired); if (this->table_[this->earliest_position_]->is_empty () || this->table_[h->pos_]->earliest_time () @@ -434,9 +465,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule ( // Insert a new handler that expires at time future_time; if interval // is > 0, the handler will be reinvoked periodically. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> long -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i ( +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::schedule_i ( const TYPE &type, const void *act, const ACE_Time_Value &future_time, @@ -489,9 +520,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i ( // Locate and update the inteval on the timer_id -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reset_interval ( +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::reset_interval ( long timer_id, const ACE_Time_Value & interval) { @@ -526,9 +557,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reset_interval ( // Locate and remove the single <ACE_Event_Handler> with a value of // @a timer_id from the correct table timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id, +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::cancel (long timer_id, const void **act, int dont_call) { @@ -596,9 +627,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id, // Locate and remove all values of <type> from the timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::cancel (const TYPE &type, int dont_call) { ACE_TRACE ("ACE_Timer_Hash_T::cancel"); @@ -618,9 +649,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, i < this->table_size_; ++i) { - ACE_Timer_Queue_Iterator_T<TYPE, - ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>, - ACE_Null_Mutex> &iter = + ACE_Timer_Queue_Iterator_T<TYPE> & iter = this->table_[i]->iter (); for (iter.first (); @@ -680,8 +709,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, // Removes the earliest node and finds the new earliest position -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::remove_first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::remove_first (void) { if (this->is_empty ()) return 0; @@ -698,8 +727,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::remove_first (void) // Finds a new earliest position -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> void -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::find_new_earliest (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::find_new_earliest (void) { for (size_t i = 0; i < this->table_size_; ++i) if (!this->table_[i]->is_empty ()) @@ -711,8 +740,8 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::find_new_earliest (void) // Returns the earliest node without removing it -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::get_first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::get_first (void) { ACE_TRACE ("ACE_Timer_Hash_T::get_first"); @@ -722,23 +751,22 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::get_first (void) return this->table_[this->earliest_position_]->get_first (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> void -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::free_node (ACE_Timer_Node_T<TYPE> *node) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> void +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::free_node (ACE_Timer_Node_T<TYPE> *node) { - ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::free_node (node); + Base_Timer_Queue::free_node (node); Hash_Token<TYPE> *h = reinterpret_cast<Hash_Token<TYPE> *> (const_cast<void *> (node->get_act ())); this->token_list_.add (h); } -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dispatch_info_i (const ACE_Time_Value &cur_time, +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::dispatch_info_i (const ACE_Time_Value &cur_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) { int const result = - ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::dispatch_info_i (cur_time, - info); + Base_Timer_Queue::dispatch_info_i (cur_time, info); if (result == 1) { @@ -753,16 +781,16 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dispatch_info_i (const ACE_Ti // Dummy version of expire to get rid of warnings in Sun CC 4.2 -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire () +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::expire () { - return ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::expire(); + return Base_Timer_Queue::expire(); } // Specialized expire for Timer Hash -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire (const ACE_Time_Value &cur_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> int +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>::expire (const ACE_Time_Value &cur_time) { ACE_TRACE ("ACE_Timer_Hash_T::expire"); diff --git a/dep/acelite/ace/Timer_Hash_T.h b/dep/acelite/ace/Timer_Hash_T.h index b04e7cfbcf3..d634536e54e 100644 --- a/dep/acelite/ace/Timer_Hash_T.h +++ b/dep/acelite/ace/Timer_Hash_T.h @@ -4,7 +4,7 @@ /** * @file Timer_Hash_T.h * - * $Id: Timer_Hash_T.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Hash_T.h 95807 2012-06-01 12:44:19Z johnnyw $ * * @author Darrell Brunsch <brunsch@cs.wustl.edu> */ @@ -25,7 +25,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY> class ACE_Timer_Hash_T; template <typename TYPE> class Hash_Token; @@ -40,6 +40,7 @@ class Hash_Token; */ template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Hash_Upcall + : private ACE_Copy_Disabled { public: typedef ACE_Timer_Queue_T<ACE_Event_Handler *, @@ -103,10 +104,6 @@ public: private: /// Timer Queue to do the calling up to ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> *timer_hash_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Hash_Upcall (const ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK> &)) }; /** @@ -118,12 +115,15 @@ private: * node of a timer queue. Be aware that it doesn't transverse * in the order of timeout values. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -class ACE_Timer_Hash_Iterator_T : public ACE_Timer_Queue_Iterator_T <TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_Hash_Iterator_T : public ACE_Timer_Queue_Iterator_T <TYPE> { public: /// Constructor. - ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &); + typedef ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY> Hash; + ACE_Timer_Hash_Iterator_T (Hash &); + + virtual ~ACE_Timer_Hash_Iterator_T (); /// Positions the iterator at the earliest node in the Timer Queue virtual void first (void); @@ -139,13 +139,13 @@ public: protected: /// Pointer to the ACE_Timer_Hash that we are iterating over. - ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &timer_hash_; + Hash & timer_hash_; /// Current position in <timer_hash_>'s table size_t position_; /// Current iterator used on <position>'s bucket - ACE_Timer_Queue_Iterator_T<TYPE, ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>, ACE_Null_Mutex> *iter_; + ACE_Timer_Queue_Iterator_T<TYPE> *iter_; }; /** @@ -156,21 +156,23 @@ protected: * * This implementation uses a hash table of BUCKETs. The hash * is based on the time_value of the event. Unlike other Timer - * Queues, ACE_Timer_Hash does not expire events in order. + * Queues, ACE_Timer_Hash does not expire events in strict order, + * i.e., all events are expired after their deadline. But two events + * may expired out of order as defined by their deadlines. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> -class ACE_Timer_Hash_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_Hash_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> { public: /// Type of iterator - typedef ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> + typedef ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY> HASH_ITERATOR; /// Iterator is a friend - friend class ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>; + friend class ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET, TIME_POLICY>; /// Type inherited from - typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> INHERITED; + typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Base_Timer_Queue; // = Initialization and termination methods. /** @@ -181,7 +183,8 @@ public: */ ACE_Timer_Hash_T (size_t table_size, FUNCTOR *upcall_functor = 0, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0); + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /** * Default constructor. @a upcall_functor is the instance of the @@ -190,7 +193,9 @@ public: * timer nodes. If 0, then a default freelist will be created. The default * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. */ - ACE_Timer_Hash_T (FUNCTOR *upcall_functor = 0, ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0); + ACE_Timer_Hash_T (FUNCTOR *upcall_functor = 0, + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Destructor virtual ~ACE_Timer_Hash_T (void); @@ -238,8 +243,13 @@ public: int dont_call_handle_close = 1); /** + * Destroy timer queue. Cancels all timers. + */ + virtual int close (void); + + /** * Run the <functor> for all timers whose values are <= - * <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns + * gettimeofday. Also accounts for <timer_skew>. Returns * the number of timers canceled. */ virtual int expire (void); @@ -252,7 +262,7 @@ public: virtual int expire (const ACE_Time_Value ¤t_time); /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void); + virtual ACE_Timer_Queue_Iterator_T<TYPE> &iter (void); /// Removes the earliest node from the queue and returns it virtual ACE_Timer_Node_T<TYPE> *remove_first (void); @@ -314,8 +324,8 @@ private: HASH_ITERATOR *iterator_; #if defined (ACE_WIN64) - // Part of a hack... see comments in schedule(). - // This is, essentially, the upper 32 bits of a 64-bit pointer on Win64. + /// Part of a hack... see comments in schedule(). + /// This is, essentially, the upper 32 bits of a 64-bit pointer on Win64. ptrdiff_t pointer_base_; #endif diff --git a/dep/acelite/ace/Timer_Heap.h b/dep/acelite/ace/Timer_Heap.h index 7dec5ec22b4..742aed8ff66 100644 --- a/dep/acelite/ace/Timer_Heap.h +++ b/dep/acelite/ace/Timer_Heap.h @@ -4,7 +4,7 @@ /** * @file Timer_Heap.h * - * $Id: Timer_Heap.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Heap.h 95335 2011-12-15 13:13:17Z msmit $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -15,6 +15,7 @@ #include /**/ "ace/pre.h" #include "ace/Timer_Heap_T.h" +#include "ace/Event_Handler_Handle_Timeout_Upcall.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -26,15 +27,21 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // compatibility. typedef ACE_Timer_Heap_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Heap; typedef ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Heap_Iterator; +typedef ACE_Timer_Heap_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_FPointer_Time_Policy> + ACE_Timer_Heap_Variable_Time_Source; + ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/dep/acelite/ace/Timer_Heap_T.cpp b/dep/acelite/ace/Timer_Heap_T.cpp index 1343915030c..93ce1341746 100644 --- a/dep/acelite/ace/Timer_Heap_T.cpp +++ b/dep/acelite/ace/Timer_Heap_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_Heap_T.cpp 92069 2010-09-28 11:38:59Z johnnyw $ +// $Id: Timer_Heap_T.cpp 95630 2012-03-22 13:04:47Z johnnyw $ #ifndef ACE_TIMER_HEAP_T_CPP #define ACE_TIMER_HEAP_T_CPP @@ -39,34 +39,34 @@ ACE_HEAP_LCHILD (size_t X) // Constructor that takes in an <ACE_Timer_Heap_T> to iterate over. -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_Iterator_T ( - ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &heap) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Heap_Iterator_T ( + Heap & heap) : timer_heap_ (heap) { ACE_TRACE ("ACE_Timer_Heap_Iterator_T::ACE_Timer_Heap_Iterator"); this->first (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Heap_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Heap_Iterator_T (void) { } // Positions the iterator at the first node in the heap array -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::first (void) +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::first (void) { this->position_ = 0; } // Positions the iterator at the next node in the heap array -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::next (void) { if (this->position_ != this->timer_heap_.cur_size_) ++this->position_; @@ -74,16 +74,16 @@ ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) // Returns true the <position_> is at the end of the heap array -template <class TYPE, class FUNCTOR, class ACE_LOCK> bool -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::isdone (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::isdone (void) const { return this->position_ == this->timer_heap_.cur_size_; } // Returns the node at the current position in the heap or 0 if at the end -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::item (void) { if (this->position_ != this->timer_heap_.cur_size_) return this->timer_heap_.heap_[this->position_]; @@ -95,13 +95,16 @@ ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) // Since timer IDs are assigned by first incrementing the timer_ids_curr_ // value, the first ID assigned will be 1 (just as in the previous design). // When it's time to wrap, the next ID given out will be 0. -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T ( +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Heap_T ( size_t size, bool preallocated, FUNCTOR *upcall_functor, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK> (upcall_functor, freelist), + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist, + TIME_POLICY const & time_policy) + : Base_Time_Policy (upcall_functor, + freelist, + time_policy), max_size_ (size), cur_size_ (0), cur_limbo_ (0), @@ -162,11 +165,14 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T ( // Since timer IDs are assigned by first incrementing the timer_ids_curr_ // value, the first ID assigned will be 1 (just as in the previous design). // When it's time to wrap, the next ID given out will be 0. -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T ( +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Heap_T ( FUNCTOR *upcall_functor, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK> (upcall_functor, freelist), + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist, + TIME_POLICY const & time_policy) + : Base_Time_Policy (upcall_functor, + freelist, + time_policy), max_size_ (ACE_DEFAULT_TIMERS), cur_size_ (0), cur_limbo_ (0), @@ -199,13 +205,36 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T ( HEAP_ITERATOR (*this)); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Heap_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Heap_T (void) { ACE_TRACE ("ACE_Timer_Heap_T::~ACE_Timer_Heap_T"); delete iterator_; + this->close (); + + delete [] this->heap_; + delete [] this->timer_ids_; + + // clean up any preallocated timer nodes + if (preallocated_nodes_ != 0) + { + ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<TYPE> *> + set_iterator (this->preallocated_node_set_); + + for (ACE_Timer_Node_T<TYPE> **entry = 0; + set_iterator.next (entry) !=0; + set_iterator.advance ()) + delete [] *entry; + } +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::close (void) +{ + ACE_TRACE ("ACE_Timer_Heap_T::close"); + size_t current_size = this->cur_size_; @@ -222,25 +251,13 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Heap_T (void) this->upcall_functor ().deletion (*this, eh, act); } - delete [] this->heap_; - delete [] this->timer_ids_; - - // clean up any preallocated timer nodes - if (preallocated_nodes_ != 0) - { - ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<TYPE> *> - set_iterator (this->preallocated_node_set_); - - for (ACE_Timer_Node_T<TYPE> **entry = 0; - set_iterator.next (entry) !=0; - set_iterator.advance ()) - delete [] *entry; - } + // leave the rest to the destructor + return 0; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::pop_freelist (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::pop_freelist (void) { ACE_TRACE ("ACE_Timer_Heap_T::pop_freelist"); @@ -271,9 +288,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::pop_freelist (void) return static_cast<long> (this->timer_ids_curr_); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::push_freelist (long old_id) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::push_freelist (long old_id) { ACE_TRACE ("ACE_Timer_Heap_T::push_freelist"); @@ -296,9 +313,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::push_freelist (long old_id) return; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::timer_id (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::timer_id (void) { ACE_TRACE ("ACE_Timer_Heap_T::timer_id"); @@ -308,17 +325,17 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::timer_id (void) // Checks if queue is empty. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::is_empty (void) const +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::is_empty (void) const { ACE_TRACE ("ACE_Timer_Heap_T::is_empty"); return this->cur_size_ == 0; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> & -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Queue_Iterator_T<TYPE> & +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::iter (void) { this->iterator_->first (); return *this->iterator_; @@ -326,16 +343,16 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) // Returns earliest time in a non-empty queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK> const ACE_Time_Value & -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::earliest_time (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> const ACE_Time_Value & +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::earliest_time (void) const { ACE_TRACE ("ACE_Timer_Heap_T::earliest_time"); return this->heap_[0]->get_timer_value (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_Heap_T::dump"); @@ -371,9 +388,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::copy ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::copy ( size_t slot, ACE_Timer_Node_T<TYPE> *moved_node) { @@ -392,9 +409,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::copy ( // this function must call either free_node (to reclaim the timer ID // and the timer node memory, as well as decrement the size of the queue) // or reschedule (to reinsert the node in the heap at a new time). -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::remove (size_t slot) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::remove (size_t slot) { ACE_Timer_Node_T<TYPE> *removed_node = this->heap_[slot]; @@ -437,8 +454,8 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::remove (size_t slot) return removed_node; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_down ( +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reheap_down ( ACE_Timer_Node_T<TYPE> *moved_node, size_t slot, size_t child) @@ -471,9 +488,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_down ( this->copy (slot, moved_node); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_up ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reheap_up ( ACE_Timer_Node_T<TYPE> *moved_node, size_t slot, size_t parent) @@ -501,9 +518,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_up ( moved_node); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::insert ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::insert ( ACE_Timer_Node_T<TYPE> *new_node) { if (this->cur_size_ + this->cur_limbo_ + 2 >= this->max_size_) @@ -515,9 +532,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::insert ( this->cur_size_++; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::grow_heap (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::grow_heap (void) { // All the containers will double in size from max_size_. size_t new_size = this->max_size_ * 2; @@ -597,9 +614,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::grow_heap (void) // Reschedule a periodic timer. This function must be called with the // mutex lock held. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reschedule ( ACE_Timer_Node_T<TYPE> *expired) { ACE_TRACE ("ACE_Timer_Heap_T::reschedule"); @@ -614,9 +631,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule ( this->insert (expired); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::alloc_node (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::alloc_node (void) { ACE_Timer_Node_T<TYPE> *temp = 0; @@ -633,16 +650,19 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::alloc_node (void) temp = this->preallocated_nodes_freelist_; - // Remove the first element from the freelist. - this->preallocated_nodes_freelist_ = - this->preallocated_nodes_freelist_->get_next (); + if (this->preallocated_nodes_freelist_) + { + // Remove the first element from the freelist. + this->preallocated_nodes_freelist_ = + this->preallocated_nodes_freelist_->get_next (); + } } return temp; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::free_node ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::free_node ( ACE_Timer_Node_T<TYPE> *node) { // Return this timer id to the freelist. @@ -661,9 +681,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::free_node ( // Insert a new timer that expires at time future_time; if interval is // > 0, the handler will be reinvoked periodically. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i ( +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i ( const TYPE &type, const void *act, const ACE_Time_Value &future_time, @@ -699,9 +719,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i ( // Locate and remove the single timer with a value of @a timer_id from // the timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (long timer_id, const void **act, int dont_call) { @@ -756,9 +776,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, // Locate and update the inteval on the timer_id -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reset_interval (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_Heap_T::reset_interval"); @@ -792,9 +812,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, // Locate and remove all values of @a type from the timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (const TYPE &type, int dont_call) { ACE_TRACE ("ACE_Timer_Heap_T::cancel"); @@ -849,9 +869,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, // Returns the earliest node or returns 0 if the heap is empty. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T <TYPE> * -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::remove_first (void) { ACE_TRACE ("ACE_Timer_Heap_T::remove_first"); @@ -861,9 +881,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first (void) return this->remove (0); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T <TYPE> * -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::get_first (void) { ACE_TRACE ("ACE_Timer_Heap_T::get_first"); diff --git a/dep/acelite/ace/Timer_Heap_T.h b/dep/acelite/ace/Timer_Heap_T.h index d6a6221aeed..147d633fd23 100644 --- a/dep/acelite/ace/Timer_Heap_T.h +++ b/dep/acelite/ace/Timer_Heap_T.h @@ -4,7 +4,7 @@ /** * @file Timer_Heap_T.h * - * $Id: Timer_Heap_T.h 84619 2009-02-26 12:26:16Z johnnyw $ + * $Id: Timer_Heap_T.h 95368 2011-12-19 13:38:49Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -26,7 +26,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> class ACE_Timer_Heap_T; /** @@ -38,15 +38,16 @@ class ACE_Timer_Heap_T; * node of a timer queue. Be aware that it doesn't transverse * in the order of timeout values. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_Heap_Iterator_T : public ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_Heap_Iterator_T : public ACE_Timer_Queue_Iterator_T<TYPE> { public: + typedef ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Heap; /// Constructor. - ACE_Timer_Heap_Iterator_T (ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &); + ACE_Timer_Heap_Iterator_T (Heap &); /// Destructor. - ~ACE_Timer_Heap_Iterator_T (void); + virtual ~ACE_Timer_Heap_Iterator_T (void); /// Positions the iterator at the earliest node in the Timer Queue virtual void first (void); @@ -62,7 +63,7 @@ public: protected: /// Pointer to the ACE_Timer_Heap that we are iterating over. - ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &timer_heap_; + Heap & timer_heap_; /// Position in the array where the iterator is at size_t position_; @@ -82,14 +83,14 @@ protected: * dynamic memory allocation, which is important for real-time * systems. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_Heap_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_Heap_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> { public: - typedef ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> HEAP_ITERATOR; - friend class ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>; + typedef ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> HEAP_ITERATOR; + friend class ACE_Timer_Heap_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>; - typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> INHERITED; + typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Base_Time_Policy; // = Initialization and termination methods. /** @@ -109,7 +110,8 @@ public: ACE_Timer_Heap_T (size_t size, bool preallocated = false, FUNCTOR *upcall_functor = 0, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0); + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /** * Default constructor. @c upcall_functor is the instance of the @@ -119,7 +121,8 @@ public: * size will be ACE_DEFAULT_TIMERS and there will be no preallocation. */ ACE_Timer_Heap_T (FUNCTOR *upcall_functor = 0, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0); + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Destructor. virtual ~ACE_Timer_Heap_T (void); @@ -162,8 +165,13 @@ public: const void **act = 0, int dont_call_handle_close = 1); + /** + * Destroy timer queue. Cancels all timers. + */ + virtual int close (void); + /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void); + virtual ACE_Timer_Queue_Iterator_T<TYPE> &iter (void); /** * Removes the earliest node from the queue and returns it. Note that @@ -318,10 +326,6 @@ private: /// Set of pointers to the arrays of preallocated timer nodes. /// Used to delete the allocated memory when required. ACE_Unbounded_Set<ACE_Timer_Node_T<TYPE> *> preallocated_node_set_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Heap_T (const ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &)) }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_List.h b/dep/acelite/ace/Timer_List.h index f2d9cc2a458..5dff92a56b0 100644 --- a/dep/acelite/ace/Timer_List.h +++ b/dep/acelite/ace/Timer_List.h @@ -4,7 +4,7 @@ /** * @file Timer_List.h * - * $Id: Timer_List.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_List.h 95335 2011-12-15 13:13:17Z msmit $ * * @author Doug Schmidt */ @@ -16,6 +16,7 @@ #include /**/ "ace/pre.h" #include "ace/Timer_List_T.h" +#include "ace/Event_Handler_Handle_Timeout_Upcall.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -25,15 +26,15 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // The following typedefs are here for ease of use and backward // compatibility. - typedef ACE_Timer_List_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_List; typedef ACE_Timer_List_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Event_Handler_Handle_Timeout_Upcall, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Default_Time_Policy> ACE_Timer_List_Iterator; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_List_T.cpp b/dep/acelite/ace/Timer_List_T.cpp index 3e4ba78f521..d45b71e0098 100644 --- a/dep/acelite/ace/Timer_List_T.cpp +++ b/dep/acelite/ace/Timer_List_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_List_T.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Timer_List_T.cpp 95368 2011-12-19 13:38:49Z mcorino $ #ifndef ACE_TIMER_LIST_T_C #define ACE_TIMER_LIST_T_C @@ -15,30 +15,30 @@ // Default Constructor -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_List_Iterator_T (List& lst) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_List_Iterator_T (List& lst) : list_ (lst) { this->first(); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_List_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_List_Iterator_T (void) { } // Positions the iterator at the node right after the dummy node -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::first (void) { this->current_node_ = this->list_.get_first(); } // Positions the iterator at the next node in the Timer Queue -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::next (void) { // Make sure that if we are at the end, we don't wrap around if (! this->isdone()) @@ -49,16 +49,16 @@ ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) // Returns true when we are at <head_> -template <class TYPE, class FUNCTOR, class ACE_LOCK> bool -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::isdone (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::isdone (void) const { return this->current_node_ == 0; } // Returns the node at <position_> or 0 if we are at the end -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::item (void) { if (! this->isdone()) return this->current_node_; @@ -70,8 +70,8 @@ ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) // Return our instance of the iterator -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> & -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Queue_Iterator_T<TYPE> & +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::iter (void) { this->iterator_->first (); return *this->iterator_; @@ -79,9 +79,11 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) // Create an empty list. -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_List_T (FUNCTOR* uf, FreeList* fl) - : Base(uf, fl) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_List_T (FUNCTOR* uf, + FreeList* fl, + TIME_POLICY const & time_policy) + : Base_Timer_Queue (uf, fl, time_policy) , head_ (new ACE_Timer_Node_T<TYPE>) , id_counter_ (0) { @@ -96,8 +98,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_List_T (FUNCTOR* uf, FreeLi // Checks if list is empty. -template <class TYPE, class FUNCTOR, class ACE_LOCK> bool -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::is_empty (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::is_empty (void) const { ACE_TRACE ("ACE_Timer_List_T::is_empty"); return this->get_first_i() == 0; @@ -106,8 +108,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::is_empty (void) const // Returns earliest time in a non-empty list. -template <class TYPE, class FUNCTOR, class ACE_LOCK> const ACE_Time_Value & -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::earliest_time (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> const ACE_Time_Value & +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::earliest_time (void) const { ACE_TRACE ("ACE_Timer_List_T::earliest_time"); ACE_Timer_Node_T<TYPE>* first = this->get_first_i(); @@ -119,14 +121,27 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::earliest_time (void) const // Remove all remaining items in the list. -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_List_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_List_T (void) { ACE_TRACE ("ACE_Timer_List_T::~ACE_Timer_List_T"); ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); delete iterator_; + this->close (); + + // delete the dummy node + delete this->head_; +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::close (void) +{ + ACE_TRACE ("ACE_Timer_List_T::close"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Remove all remaining items in the list. if (!this->is_empty()) { for (ACE_Timer_Node_T<TYPE>* n = this->get_first(); @@ -146,12 +161,12 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_List_T (void) } } - // delete the dummy node - delete this->head_; + // Leave rest to destructor + return 0; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_List_T::dump"); @@ -175,8 +190,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const // Reschedule a periodic timer. This function must be called with the // lock held. -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reschedule (ACE_Timer_Node_T<TYPE>* n) { ACE_TRACE ("ACE_Timer_List_T::reschedule"); this->schedule_i(n, n->get_timer_value()); @@ -186,8 +201,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule (ACE_Timer_Node_T<TYPE>* n // Insert a new handler that expires at time future_time; if interval // is > 0, the handler will be reinvoked periodically. -template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE &type, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval) @@ -213,8 +228,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE &type, } /// The shared scheduling functionality between schedule() and reschedule() -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (ACE_Timer_Node_T<TYPE>* n, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i (ACE_Timer_Node_T<TYPE>* n, const ACE_Time_Value& expire) { if (this->is_empty()) { @@ -240,9 +255,9 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (ACE_Timer_Node_T<TYPE>* n p->set_next(n); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE>* -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::find_node (long timer_id) const +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::find_node (long timer_id) const { ACE_Timer_Node_T<TYPE>* n = this->get_first_i(); if (n == 0) @@ -257,8 +272,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::find_node (long timer_id) const } // Locate and update the inteval on the timer_id -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reset_interval (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List_T::reset_interval"); @@ -273,8 +288,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, // Locate and remove the single <ACE_Event_Handler> with a value of // @a timer_id from the timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (long timer_id, const void **act, int skip_close) { @@ -310,8 +325,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, } // Locate and remove all values of <handler> from the timer queue. -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, int skip_close) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (const TYPE &type, int skip_close) { ACE_TRACE ("ACE_Timer_List_T::cancel"); @@ -365,8 +380,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, int skip_cl return num_canceled; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::unlink (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::unlink (ACE_Timer_Node_T<TYPE>* n) { n->get_prev()->set_next(n->get_next()); n->get_next()->set_prev(n->get_prev()); @@ -375,23 +390,23 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::unlink (ACE_Timer_Node_T<TYPE>* n) } /// Shared subset of the two cancel() methods. -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel_i (ACE_Timer_Node_T<TYPE>* n) { this->unlink (n); this->free_node (n); } // Reads the first node on the list and returns it. -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::get_first (void) { ACE_TRACE ("ACE_Timer_List_T::get_first"); return this->get_first_i(); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::get_first_i (void) const { ACE_TRACE ("ACE_Timer_List_T::get_first_i"); ACE_Timer_Node_T<TYPE>* first = this->head_->get_next(); @@ -403,8 +418,8 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const // Removes the first node on the list and returns it. -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::remove_first (void) { ACE_TRACE ("ACE_Timer_List_T::remove_first"); ACE_Timer_Node_T<TYPE>* first = this->get_first(); diff --git a/dep/acelite/ace/Timer_List_T.h b/dep/acelite/ace/Timer_List_T.h index cabd47aeaf0..918ba2cb9f3 100644 --- a/dep/acelite/ace/Timer_List_T.h +++ b/dep/acelite/ace/Timer_List_T.h @@ -4,7 +4,7 @@ /** * @file Timer_List_T.h * - * $Id: Timer_List_T.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_List_T.h 95368 2011-12-19 13:38:49Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -21,7 +21,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ // Forward declaration. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> class ACE_Timer_List_T; /** @@ -32,12 +32,12 @@ class ACE_Timer_List_T; * This is a generic iterator that can be used to visit every * node of a timer queue. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> class ACE_Timer_List_Iterator_T -: public ACE_Timer_Queue_Iterator_T <TYPE, FUNCTOR, ACE_LOCK> +: public ACE_Timer_Queue_Iterator_T <TYPE> { public: - typedef ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK> List; + typedef ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> List; /// Constructor. ACE_Timer_List_Iterator_T (List& lst); @@ -81,19 +81,19 @@ protected: * ACE_Timer_Heap will perform substantially faster than the * ACE_Timer_List. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_List_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_List_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> { public: /// Type of iterator - typedef ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> Iterator; + typedef ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Iterator; /// Iterator is a friend - friend class ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>; + friend class ACE_Timer_List_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>; typedef ACE_Timer_Node_T<TYPE> Node; /// Type inherited from - typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> Base; + typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Base_Timer_Queue; typedef ACE_Free_List<Node> FreeList; // = Initialization and termination methods. @@ -103,7 +103,8 @@ public: * default FUNCTOR will be created. @a freelist is the freelist of * timer nodes. If 0, then a default freelist will be created. */ - ACE_Timer_List_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); + ACE_Timer_List_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Destructor virtual ~ACE_Timer_List_T (void); @@ -146,8 +147,13 @@ public: const void** act = 0, int dont_call_handle_close = 1); + /** + * Destroy timer queue. Cancels all timers. + */ + virtual int close (void); + /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& iter (void); + virtual ACE_Timer_Queue_Iterator_T<TYPE>& iter (void); /// Removes the earliest node from the queue and returns it virtual ACE_Timer_Node_T<TYPE>* remove_first (void); diff --git a/dep/acelite/ace/Timer_Queue.h b/dep/acelite/ace/Timer_Queue.h index 4644aa1b43d..13ec4fc826a 100644 --- a/dep/acelite/ace/Timer_Queue.h +++ b/dep/acelite/ace/Timer_Queue.h @@ -4,7 +4,7 @@ /** * @file Timer_Queue.h * - * $Id: Timer_Queue.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Queue.h 95332 2011-12-15 11:09:41Z mcorino $ * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> * @author Irfan Pyarali <irfan@cs.wustl.edu> @@ -40,9 +40,7 @@ typedef ACE_Timer_Node_Dispatch_Info_T<ACE_Event_Handler *> typedef ACE_Timer_Node_T<ACE_Event_Handler *> ACE_Timer_Node; -typedef ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX> +typedef ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *> ACE_Timer_Queue_Iterator; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Queue_Adapters.cpp b/dep/acelite/ace/Timer_Queue_Adapters.cpp index 190d11c4f08..e4e2337395e 100644 --- a/dep/acelite/ace/Timer_Queue_Adapters.cpp +++ b/dep/acelite/ace/Timer_Queue_Adapters.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_Queue_Adapters.cpp 92285 2010-10-20 16:34:57Z shuston $ +// $Id: Timer_Queue_Adapters.cpp 95368 2011-12-19 13:38:49Z mcorino $ #ifndef ACE_TIMER_QUEUE_ADAPTERS_CPP #define ACE_TIMER_QUEUE_ADAPTERS_CPP @@ -182,6 +182,11 @@ ACE_Thread_Timer_Queue_Adapter<TQ, TYPE>::~ACE_Thread_Timer_Queue_Adapter (void) this->timer_queue_ = 0; this->delete_timer_queue_ = false; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + this->timer_queue_ = 0; + } } template<class TQ, class TYPE> ACE_SYNCH_RECURSIVE_MUTEX & @@ -264,8 +269,10 @@ ACE_Thread_Timer_Queue_Adapter<TQ, TYPE>::svc (void) { // Compute the remaining time, being careful not to sleep // for "negative" amounts of time. - ACE_Time_Value const tv_curr = this->timer_queue_->gettimeofday (); - ACE_Time_Value const tv_earl = this->timer_queue_->earliest_time (); + ACE_Time_Value const tv_curr = + this->timer_queue_->gettimeofday (); + ACE_Time_Value const tv_earl = + this->timer_queue_->earliest_time (); if (tv_earl > tv_curr) { diff --git a/dep/acelite/ace/Timer_Queue_Adapters.inl b/dep/acelite/ace/Timer_Queue_Adapters.inl index d73ef024246..c6a7690303e 100644 --- a/dep/acelite/ace/Timer_Queue_Adapters.inl +++ b/dep/acelite/ace/Timer_Queue_Adapters.inl @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: Timer_Queue_Adapters.inl 89482 2010-03-15 07:58:50Z johnnyw $ +// $Id: Timer_Queue_Adapters.inl 95368 2011-12-19 13:38:49Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -15,6 +15,8 @@ ACE_Thread_Timer_Queue_Adapter<TQ, TYPE>::timer_queue (TQ *tq) { if (this->delete_timer_queue_) delete this->timer_queue_; + else if (this->timer_queue_) + this->timer_queue_->close (); this->timer_queue_ = tq; this->delete_timer_queue_ = false; return 0; diff --git a/dep/acelite/ace/Timer_Queue_Iterator.cpp b/dep/acelite/ace/Timer_Queue_Iterator.cpp new file mode 100644 index 00000000000..cc95cbdcbe1 --- /dev/null +++ b/dep/acelite/ace/Timer_Queue_Iterator.cpp @@ -0,0 +1,58 @@ +//$Id: Timer_Queue_Iterator.cpp 95334 2011-12-15 12:52:50Z msmit $ + +#ifndef ACE_TIMER_QUEUE_ITERATOR_CPP +#define ACE_TIMER_QUEUE_ITERATOR_CPP + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Timer_Queue_Iterator.inl" +#endif /* __ACE_INLINE__ */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class TYPE> void +ACE_Timer_Node_T<TYPE>::dump (void) const +{ +#if defined (ACE_HAS_DUMP) + ACE_TRACE ("ACE_Timer_Node_T::dump"); + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nact_ = %x"), this->act_)); + this->timer_value_.dump (); + this->interval_.dump (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nprev_ = %x"), this->prev_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_id_ = %d\n"), this->timer_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* ACE_HAS_DUMP */ +} + +template <class TYPE> +ACE_Timer_Node_T<TYPE>::ACE_Timer_Node_T (void) +{ + ACE_TRACE ("ACE_Timer_Node_T::ACE_Timer_Node_T"); +} + +template <class TYPE> +ACE_Timer_Node_T<TYPE>::~ACE_Timer_Node_T (void) +{ + ACE_TRACE ("ACE_Timer_Node_T::~ACE_Timer_Node_T"); +} + +template <class TYPE> +ACE_Timer_Queue_Iterator_T<TYPE>::ACE_Timer_Queue_Iterator_T (void) +{ +} + +template <class TYPE> +ACE_Timer_Queue_Iterator_T<TYPE>::~ACE_Timer_Queue_Iterator_T (void) +{ +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_QUEUE_ITERATOR_CPP */ diff --git a/dep/acelite/ace/Timer_Queue_Iterator.h b/dep/acelite/ace/Timer_Queue_Iterator.h new file mode 100644 index 00000000000..56433e4b3dc --- /dev/null +++ b/dep/acelite/ace/Timer_Queue_Iterator.h @@ -0,0 +1,200 @@ +//$Id: Timer_Queue_Iterator.h 95334 2011-12-15 12:52:50Z msmit $ + +#ifndef ACE_TIMER_QUEUE_ITERATOR_H +#define ACE_TIMER_QUEUE_ITERATOR_H + +#include /**/ "ace/pre.h" + +/** + * @file Timer_Queue_Iterator.h + * + * Re-factored from Timer_Queue_T.h + */ + +#include "ace/Time_Value.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Timer_Node_Dispatch_Info_T + * + * @brief Maintains generated dispatch information for Timer nodes. + * + */ +template <class TYPE> +class ACE_Timer_Node_Dispatch_Info_T +{ +public: + /// The type of object held in the queue + TYPE type_; + + /// Asynchronous completion token associated with the timer. + const void *act_; + + /// Flag to check if the timer is recurring. + int recurring_timer_; +}; + +/** + * @class ACE_Timer_Node_T + * + * @brief Maintains the state associated with a Timer entry. + */ +template <class TYPE> +class ACE_Timer_Node_T +{ +public: + /// Default constructor + ACE_Timer_Node_T (void); + + /// Destructor + ~ACE_Timer_Node_T (void); + + /// Useful typedef .. + typedef ACE_Timer_Node_Dispatch_Info_T <TYPE> DISPATCH_INFO; + + /// Singly linked list + void set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T<TYPE> *n, + long timer_id); + + /// Doubly linked list version + void set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T<TYPE> *p, + ACE_Timer_Node_T<TYPE> *n, + long timer_id); + + // = Accessors + + /// Get the type. + TYPE &get_type (void); + + /// Set the type. + void set_type (TYPE &type); + + /// Get the asynchronous completion token. + const void *get_act (void); + + /// Set the asynchronous completion token. + void set_act (void *act); + + /// Get the timer value. + const ACE_Time_Value &get_timer_value (void) const; + + /// Set the timer value. + void set_timer_value (const ACE_Time_Value &timer_value); + + /// Get the timer interval. + const ACE_Time_Value &get_interval (void) const; + + /// Set the timer interval. + void set_interval (const ACE_Time_Value &interval); + + /// Get the previous pointer. + ACE_Timer_Node_T<TYPE> *get_prev (void); + + /// Set the previous pointer. + void set_prev (ACE_Timer_Node_T<TYPE> *prev); + + /// Get the next pointer. + ACE_Timer_Node_T<TYPE> *get_next (void); + + /// Set the next pointer. + void set_next (ACE_Timer_Node_T<TYPE> *next); + + /// Get the timer_id. + long get_timer_id (void) const; + + /// Set the timer_id. + void set_timer_id (long timer_id); + + /// Get the dispatch info. The dispatch information is got + /// through <info>. This form helps us in preventing allocation and + /// deleting data along the criticl path. + /// @@TODO: We may want to have a copying version too, so that our + /// interface will be complete.. + void get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T <TYPE> &info); + + /// Dump the state of an TYPE. + void dump (void) const; + +private: + /// Type of object stored in the Queue + TYPE type_; + + /// Asynchronous completion token associated with the timer. + const void *act_; + + /// Time until the timer expires. + ACE_Time_Value timer_value_; + + /// If this is a periodic timer this holds the time until the next + /// timeout. + ACE_Time_Value interval_; + + /// Pointer to previous timer. + ACE_Timer_Node_T<TYPE> *prev_; + + /// Pointer to next timer. + ACE_Timer_Node_T<TYPE> *next_; + + /// Id of this timer (used to cancel timers before they expire). + long timer_id_; +}; + +/** + * @class ACE_Timer_Queue_Iterator_T + * + * @brief Generic interface for iterating over a subclass of + * ACE_Timer_Queue. + * + * This is a generic iterator that can be used to visit every + * node of a timer queue. Be aware that it isn't guaranteed + * that the transversal will be in order of timeout values. + */ +template <class TYPE> +class ACE_Timer_Queue_Iterator_T +{ +public: + // = Initialization and termination methods. + /// Constructor. + ACE_Timer_Queue_Iterator_T (void); + + /// Destructor. + virtual ~ACE_Timer_Queue_Iterator_T (void); + + /// Positions the iterator at the earliest node in the Timer Queue + virtual void first (void) = 0; + + /// Positions the iterator at the next node in the Timer Queue + virtual void next (void) = 0; + + /// Returns true when there are no more nodes in the sequence + virtual bool isdone (void) const = 0; + + /// Returns the node at the current position in the sequence + virtual ACE_Timer_Node_T<TYPE> *item (void) = 0; +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/Timer_Queue_Iterator.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Timer_Queue_Iterator.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Timer_Queue_Iterator.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* ACE_TIMER_QUEUE_ITERATOR_H */ diff --git a/dep/acelite/ace/Timer_Queue_Iterator.inl b/dep/acelite/ace/Timer_Queue_Iterator.inl new file mode 100644 index 00000000000..90fa4687bbd --- /dev/null +++ b/dep/acelite/ace/Timer_Queue_Iterator.inl @@ -0,0 +1,135 @@ +// -*- C++ -*- +// +// $Id: Timer_Queue_Iterator.inl 95332 2011-12-15 11:09:41Z mcorino $ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T<TYPE> *n, + long timer_id) +{ + this->type_ = type; + this->act_ = a; + this->timer_value_ = t; + this->interval_ = i; + this->next_ = n; + this->timer_id_ = timer_id; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set (const TYPE &type, + const void *a, + const ACE_Time_Value &t, + const ACE_Time_Value &i, + ACE_Timer_Node_T<TYPE> *p, + ACE_Timer_Node_T<TYPE> *n, + long timer_id) +{ + this->type_ = type; + this->act_ = a; + this->timer_value_ = t; + this->interval_ = i; + this->prev_ = p; + this->next_ = n; + this->timer_id_ = timer_id; +} + +template <class TYPE> ACE_INLINE TYPE & +ACE_Timer_Node_T<TYPE>::get_type (void) +{ + return this->type_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_type (TYPE &type) +{ + this->type_ = type; +} + +template <class TYPE> ACE_INLINE const void * +ACE_Timer_Node_T<TYPE>::get_act (void) +{ + return this->act_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_act (void *act) +{ + this->act_ = act; +} + +template <class TYPE> ACE_INLINE const ACE_Time_Value & +ACE_Timer_Node_T<TYPE>::get_timer_value (void) const +{ + return this->timer_value_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_timer_value (const ACE_Time_Value &timer_value) +{ + this->timer_value_ = timer_value; +} + +template <class TYPE> ACE_INLINE const ACE_Time_Value & +ACE_Timer_Node_T<TYPE>::get_interval (void) const +{ + return this->interval_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_interval (const ACE_Time_Value &interval) +{ + this->interval_ = interval; +} + +template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> * +ACE_Timer_Node_T<TYPE>::get_prev (void) +{ + return this->prev_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_prev (ACE_Timer_Node_T<TYPE> *prev) +{ + this->prev_ = prev; +} + +template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> * +ACE_Timer_Node_T<TYPE>::get_next (void) +{ + return this->next_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_next (ACE_Timer_Node_T<TYPE> *next) +{ + this->next_ = next; +} + +template <class TYPE> ACE_INLINE long +ACE_Timer_Node_T<TYPE>::get_timer_id (void) const +{ + return this->timer_id_; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::set_timer_id (long timer_id) +{ + this->timer_id_ = timer_id; +} + +template <class TYPE> ACE_INLINE void +ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) +{ + // Yes, do a copy + info.type_ = this->type_; + info.act_ = this->act_; + info.recurring_timer_ = + this->interval_ > ACE_Time_Value::zero; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Queue_T.cpp b/dep/acelite/ace/Timer_Queue_T.cpp index 838d4422bcf..eafb4a24498 100644 --- a/dep/acelite/ace/Timer_Queue_T.cpp +++ b/dep/acelite/ace/Timer_Queue_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_Queue_T.cpp 92285 2010-10-20 16:34:57Z shuston $ +// $Id: Timer_Queue_T.cpp 95690 2012-04-09 22:00:03Z shuston $ #ifndef ACE_TIMER_QUEUE_T_CPP #define ACE_TIMER_QUEUE_T_CPP @@ -16,11 +16,11 @@ #include "ace/Timer_Queue_T.h" #include "ace/Guard_T.h" -#include "ace/Log_Msg.h" -#include "ace/Reactor_Timer_Interface.h" #include "ace/Reverse_Lock_T.h" +#include "ace/Log_Msg.h" #include "ace/Null_Mutex.h" #include "ace/OS_NS_sys_time.h" +#include "ace/Functor.h" #if !defined (__ACE_INLINE__) #include "ace/Timer_Queue_T.inl" @@ -35,46 +35,47 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_TIMER_SKEW 0 #endif /* ACE_TIMER_SKEW */ -template <class TYPE> void -ACE_Timer_Node_T<TYPE>::dump (void) const +template <class TYPE, class FUNCTOR> ACE_INLINE +ACE_Timer_Queue_Upcall_Base<TYPE, FUNCTOR>::ACE_Timer_Queue_Upcall_Base (FUNCTOR * upcall_functor) + : ACE_Abstract_Timer_Queue<TYPE>() + , ACE_Copy_Disabled() + , upcall_functor_(upcall_functor) + , delete_upcall_functor_ (upcall_functor == 0) { -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Timer_Node_T::dump"); - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nact_ = %x"), this->act_)); - this->timer_value_.dump (); - this->interval_.dump (); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nprev_ = %x"), this->prev_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ntimer_id_ = %d\n"), this->timer_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} + ACE_TRACE ("ACE_Timer_Queue_Upcall_Base::ACE_Timer_Queue_Upcall_Base"); -template <class TYPE> -ACE_Timer_Node_T<TYPE>::ACE_Timer_Node_T (void) -{ - ACE_TRACE ("ACE_Timer_Node_T::ACE_Timer_Node_T"); + if (upcall_functor != 0) + { + return; + } + + ACE_NEW (upcall_functor_, FUNCTOR); } -template <class TYPE> -ACE_Timer_Node_T<TYPE>::~ACE_Timer_Node_T (void) +template <class TYPE, class FUNCTOR> ACE_INLINE +ACE_Timer_Queue_Upcall_Base<TYPE, FUNCTOR>::~ACE_Timer_Queue_Upcall_Base () { - ACE_TRACE ("ACE_Timer_Node_T::~ACE_Timer_Node_T"); + ACE_TRACE ("ACE_Timer_Queue_Upcall_Base::~ACE_Timer_Queue_Upcall_Base"); + if (this->delete_upcall_functor_) + { + delete this->upcall_functor_; + } } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday() { + return this->gettimeofday_static(); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Queue_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday (ACE_Time_Value (*gettimeofday)(void)) { + this->time_policy_.set_gettimeofday (gettimeofday); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value * -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_timeout (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); @@ -84,7 +85,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m return max_wait_time; else { - ACE_Time_Value const cur_time = this->gettimeofday (); + ACE_Time_Value const cur_time = this->gettimeofday_static (); if (this->earliest_time () > cur_time) { @@ -110,8 +111,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m } } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value * -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_timeout (ACE_Time_Value *max_wait_time, ACE_Time_Value *the_timeout) { ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); @@ -119,6 +120,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m if (the_timeout == 0) return 0; + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); + if (this->is_empty ()) { // Nothing on the Timer_Queue, so use whatever the caller gave us. @@ -129,7 +132,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m } else { - ACE_Time_Value cur_time = this->gettimeofday (); + ACE_Time_Value cur_time = this->gettimeofday_static (); if (this->earliest_time () > cur_time) { @@ -153,8 +156,16 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *m return the_timeout; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Time_Value +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::current_time() +{ + ACE_Time_Value tv = this->gettimeofday_static (); + tv += this->timer_skew(); + return tv; +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_Queue_T::dump"); @@ -165,11 +176,12 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) - : gettimeofday_ (ACE_OS::gettimeofday), - delete_upcall_functor_ (upcall_functor == 0), +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist, + TIME_POLICY const & time_policy) + : ACE_Timer_Queue_Upcall_Base<TYPE,FUNCTOR>(upcall_functor), + time_policy_ (time_policy), delete_free_list_ (freelist == 0), timer_skew_ (0, ACE_TIMER_SKEW) { @@ -180,47 +192,38 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_f (ACE_Locked_Free_List<ACE_Timer_Node_T<TYPE>,ACE_Null_Mutex>)); else free_list_ = freelist; - - if (!upcall_functor) - ACE_NEW (upcall_functor_, - FUNCTOR); - else - upcall_functor_ = upcall_functor; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Queue_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Queue_T (void) { ACE_TRACE ("ACE_Timer_Queue_T::~ACE_Timer_Queue_T"); - // Cleanup the functor and free_list on the way out - if (this->delete_upcall_functor_) - delete this->upcall_functor_; - + // Cleanup the free_list on the way out if (this->delete_free_list_) delete this->free_list_; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::alloc_node (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::alloc_node (void) { return this->free_list_->remove (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::free_node (ACE_Timer_Node_T<TYPE> *node) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::free_node (ACE_Timer_Node_T<TYPE> *node) { this->free_list_->add (node); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_LOCK & -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::mutex (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_LOCK & +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::mutex (void) { return this->mutex_; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval) @@ -249,8 +252,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, // Run the <handle_timeout> method for all Timers whose values are <= // <cur_time>. -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire (const ACE_Time_Value &cur_time) { ACE_TRACE ("ACE_Timer_Queue_T::expire"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); @@ -287,8 +290,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti return number_of_timers_expired; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::recompute_next_abs_interval_time +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::recompute_next_abs_interval_time (ACE_Timer_Node_T<TYPE> *expired, const ACE_Time_Value &cur_time) { @@ -347,8 +350,52 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::recompute_next_abs_interval_time } } -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info_i (const ACE_Time_Value &cur_time, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire_single ( + ACE_Command_Base & pre_dispatch_command) +{ + ACE_TRACE ("ACE_Timer_Queue_T::expire_single"); + ACE_Timer_Node_Dispatch_Info_T<TYPE> info; + ACE_Time_Value cur_time; + { + // Create a scope for the lock ... + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + if (this->is_empty ()) + return 0; + + // Get the current time + cur_time = this->gettimeofday_static () + this->timer_skew (); + + // Look for a node in the timer queue whose timer <= the present + // time. + if (!this->dispatch_info_i (cur_time, info)) + { + return 0; + } + } + // We do not need the lock anymore, all these operations take place + // with local variables. + const void *upcall_act = 0; + + // Preinvoke (handles refcount if needed, etc.) + this->preinvoke (info, cur_time, upcall_act); + + // Release the token before expiration upcall. + pre_dispatch_command.execute(); + + // call the functor + this->upcall (info, cur_time); + + // Postinvoke (undo refcount if needed, etc.) + this->postinvoke (info, cur_time, upcall_act); + + // We have dispatched a timer + return 1; +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dispatch_info_i (const ACE_Time_Value &cur_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) { ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info_i"); @@ -388,155 +435,13 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info_i (const ACE_Time_Valu return 0; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::return_node (ACE_Timer_Node_T<TYPE> *node) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::return_node (ACE_Timer_Node_T<TYPE> *node) { ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); this->free_node (node); } - -template <class ACE_LOCK> -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::ACE_Event_Handler_Handle_Timeout_Upcall (void) -{ -} - -template <class ACE_LOCK> -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::~ACE_Event_Handler_Handle_Timeout_Upcall (void) -{ -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::registration (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - const void *) -{ - event_handler->add_reference (); - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::preinvoke (TIMER_QUEUE & /* timer_queue */, - ACE_Event_Handler *event_handler, - const void * /* timer_act */, - int /* recurring_timer */, - const ACE_Time_Value & /* cur_time */, - const void *&upcall_act) -{ - bool const requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - if (requires_reference_counting) - { - event_handler->add_reference (); - - upcall_act = &this->requires_reference_counting_; - } - - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::postinvoke (TIMER_QUEUE & /* timer_queue */, - ACE_Event_Handler *event_handler, - const void * /* timer_act */, - int /* recurring_timer */, - const ACE_Time_Value & /* cur_time */, - const void *upcall_act) -{ - if (upcall_act == &this->requires_reference_counting_) - { - event_handler->remove_reference (); - } - - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *event_handler, - const void *act, - int recurring_timer, - const ACE_Time_Value &cur_time) -{ - int requires_reference_counting = 0; - - if (!recurring_timer) - { - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - } - - // Upcall to the <handler>s handle_timeout method. - if (event_handler->handle_timeout (cur_time, act) == -1) - { - if (event_handler->reactor_timer_interface ()) - event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); - else - timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". - } - - if (!recurring_timer && - requires_reference_counting) - { - event_handler->remove_reference (); - } - - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancel_type (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - int dont_call, - int &requires_reference_counting) -{ - requires_reference_counting = - event_handler->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - - // Upcall to the <handler>s handle_close method - if (dont_call == 0) - event_handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::TIMER_MASK); - - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancel_timer (TIMER_QUEUE &, - ACE_Event_Handler *event_handler, - int, - int requires_reference_counting) -{ - if (requires_reference_counting) - event_handler->remove_reference (); - - return 0; -} - -template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *event_handler, - const void *) -{ - int requires_reference_counting = 0; - - this->cancel_type (timer_queue, - event_handler, - 0, - requires_reference_counting); - - this->cancel_timer (timer_queue, - event_handler, - 0, - requires_reference_counting); - - return 0; -} - ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_TIMER_QUEUE_T_CPP */ diff --git a/dep/acelite/ace/Timer_Queue_T.h b/dep/acelite/ace/Timer_Queue_T.h index 5e316e1e04b..ffd0a3726ed 100644 --- a/dep/acelite/ace/Timer_Queue_T.h +++ b/dep/acelite/ace/Timer_Queue_T.h @@ -4,7 +4,7 @@ /** * @file Timer_Queue_T.h * - * $Id: Timer_Queue_T.h 89254 2010-02-25 22:10:39Z cleeland $ + * $Id: Timer_Queue_T.h 95362 2011-12-18 11:56:24Z johnnyw $ * * @author Doug Schmidt <schmidt@cs.wustl.edu> * @author Irfan Pyarali <irfan@cs.wustl.edu> and @@ -22,176 +22,43 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Event_Handler.h" #include "ace/Time_Value.h" +#include "ace/Abstract_Timer_Queue.h" +#include "ace/Timer_Queue_Iterator.h" +#include "ace/Time_Policy.h" +#include "ace/Copy_Disabled.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** - * @class ACE_Timer_Node_Dispatch_Info_T + * @class ACE_Timer_Queue_Upcall_Base * - * @brief Maintains generated dispatch information for Timer nodes. - * - */ -template <class TYPE> -class ACE_Timer_Node_Dispatch_Info_T -{ -public: - /// The type of object held in the queue - TYPE type_; - - /// Asynchronous completion token associated with the timer. - const void *act_; - - /// Flag to check if the timer is recurring. - int recurring_timer_; -}; - -/** - * @class ACE_Timer_Node_T - * - * @brief Maintains the state associated with a Timer entry. + * Common base class for all timer queues with the same time source + * policy. This is really motivated by a single use-case in the code, + * namely the ACE_Proactor needs to set a backpointer in the upcall + * functor. */ -template <class TYPE> -class ACE_Timer_Node_T +template<typename TYPE, typename FUNCTOR> +class ACE_Timer_Queue_Upcall_Base + : public ACE_Abstract_Timer_Queue<TYPE> + , private ACE_Copy_Disabled { public: - /// Default constructor - ACE_Timer_Node_T (void); + // Constructor + explicit ACE_Timer_Queue_Upcall_Base(FUNCTOR * upcall_functor = 0); /// Destructor - ~ACE_Timer_Node_T (void); - - /// Useful typedef .. - typedef ACE_Timer_Node_Dispatch_Info_T <TYPE> DISPATCH_INFO; - - /// Singly linked list - void set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T<TYPE> *n, - long timer_id); - - /// Doubly linked list version - void set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T<TYPE> *p, - ACE_Timer_Node_T<TYPE> *n, - long timer_id); - - // = Accessors - - /// Get the type. - TYPE &get_type (void); - - /// Set the type. - void set_type (TYPE &type); - - /// Get the asynchronous completion token. - const void *get_act (void); - - /// Set the asynchronous completion token. - void set_act (void *act); - - /// Get the timer value. - const ACE_Time_Value &get_timer_value (void) const; - - /// Set the timer value. - void set_timer_value (const ACE_Time_Value &timer_value); - - /// Get the timer interval. - const ACE_Time_Value &get_interval (void) const; - - /// Set the timer interval. - void set_interval (const ACE_Time_Value &interval); - - /// Get the previous pointer. - ACE_Timer_Node_T<TYPE> *get_prev (void); - - /// Set the previous pointer. - void set_prev (ACE_Timer_Node_T<TYPE> *prev); - - /// Get the next pointer. - ACE_Timer_Node_T<TYPE> *get_next (void); - - /// Set the next pointer. - void set_next (ACE_Timer_Node_T<TYPE> *next); - - /// Get the timer_id. - long get_timer_id (void) const; - - /// Set the timer_id. - void set_timer_id (long timer_id); + virtual ~ACE_Timer_Queue_Upcall_Base (void); - /// Get the dispatch info. The dispatch information is got - /// through <info>. This form helps us in preventing allocation and - /// deleting data along the criticl path. - /// @@TODO: We may want to have a copying version too, so that our - /// interface will be complete.. - void get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T <TYPE> &info); - - /// Dump the state of an TYPE. - void dump (void) const; - -private: - /// Type of object stored in the Queue - TYPE type_; - - /// Asynchronous completion token associated with the timer. - const void *act_; - - /// Time until the timer expires. - ACE_Time_Value timer_value_; - - /// If this is a periodic timer this holds the time until the next - /// timeout. - ACE_Time_Value interval_; - - /// Pointer to previous timer. - ACE_Timer_Node_T<TYPE> *prev_; - - /// Pointer to next timer. - ACE_Timer_Node_T<TYPE> *next_; - - /// Id of this timer (used to cancel timers before they expire). - long timer_id_; -}; - -/** - * @class ACE_Timer_Queue_Iterator_T - * - * @brief Generic interface for iterating over a subclass of - * ACE_Timer_Queue. - * - * This is a generic iterator that can be used to visit every - * node of a timer queue. Be aware that it isn't guaranteed - * that the transversal will be in order of timeout values. - */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_Queue_Iterator_T -{ -public: - // = Initialization and termination methods. - /// Constructor. - ACE_Timer_Queue_Iterator_T (void); - - /// Destructor. - virtual ~ACE_Timer_Queue_Iterator_T (void); - - /// Positions the iterator at the earliest node in the Timer Queue - virtual void first (void) = 0; - - /// Positions the iterator at the next node in the Timer Queue - virtual void next (void) = 0; + /// Accessor to the upcall functor + FUNCTOR & upcall_functor (void); - /// Returns true when there are no more nodes in the sequence - virtual bool isdone (void) const = 0; +protected: + /// Upcall functor + FUNCTOR *upcall_functor_; - /// Returns the node at the current position in the sequence - virtual ACE_Timer_Node_T<TYPE> *item (void) = 0; + /// To delete or not to delete is the question? + bool const delete_upcall_functor_; }; /** @@ -203,13 +70,11 @@ public: * implementing specialized policies such as ACE_Timer_List * and ACE_Timer_Heap. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> class ACE_Timer_Queue_T + : public ACE_Timer_Queue_Upcall_Base<TYPE,FUNCTOR> { public: - /// Type of Iterator. - typedef ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> ITERATOR; - // = Initialization and termination methods. /** * Default constructor. @a upcall_functor is the instance of the @@ -218,78 +83,31 @@ public: * timer nodes. If 0, then a default freelist will be created. */ ACE_Timer_Queue_T (FUNCTOR *upcall_functor = 0, - ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0); + ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Destructor - make virtual for proper destruction of inherited /// classes. virtual ~ACE_Timer_Queue_T (void); - /// True if queue is empty, else false. - virtual bool is_empty (void) const = 0; - - /// Returns the time of the earlier node in the Timer_Queue. Must - /// be called on a non-empty queue. - virtual const ACE_Time_Value &earliest_time (void) const = 0; - /** - * Schedule @a type that will expire at @a future_time, which is - * specified in absolute time. If it expires then @a act is passed - * in as the value to the <functor>. If @a interval is != to - * ACE_Time_Value::zero then it is used to reschedule the @a type - * automatically, using relative time to the current <gettimeofday>. - * This method returns a <timer_id> that uniquely identifies the the - * @a type entry in an internal list. This <timer_id> can be used to - * cancel the timer before it expires. The cancellation ensures - * that <timer_ids> are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid <timer_id>). + * Implement ACE_Abstract_Timer_Queue<TYPE>::schedule () with the right + * locking strategy. */ virtual long schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval = ACE_Time_Value::zero); + //@{ /** - * Resets the interval of the timer represented by @a timer_id to - * @a interval, which is specified in relative time to the current - * <gettimeofday>. If @a interval is equal to - * ACE_Time_Value::zero, the timer will become a non-rescheduling - * timer. Returns 0 if successful, -1 if not. - */ - virtual int reset_interval (long timer_id, - const ACE_Time_Value &interval) = 0; - - /** - * Cancel all timer associated with @a type. If - * @a dont_call_handle_close is 0 then the <functor> will be invoked, - * which typically invokes the <handle_close> hook. Returns number - * of timers cancelled. - */ - virtual int cancel (const TYPE &type, - int dont_call_handle_close = 1) = 0; - - /** - * Cancel the single timer that matches the @a timer_id value (which - * was returned from the <schedule> method). If act is non-NULL - * then it will be set to point to the ``magic cookie'' argument - * passed in when the timer was registered. This makes it possible - * to free up the memory and avoid memory leaks. If - * @a dont_call_handle_close is 0 then the <functor> will be invoked, - * which typically calls the <handle_close> hook. Returns 1 if - * cancellation succeeded and 0 if the @a timer_id wasn't found. - */ - virtual int cancel (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1) = 0; - - /** - * Run the <functor> for all timers whose values are <= @a current_time. - * This does not account for <timer_skew>. Returns the number of - * timers canceled. + * Implement ACE_Abstract_Timer_Queue<TYPE>::expire () with the right + * locking strategy. */ virtual int expire (const ACE_Time_Value ¤t_time); + virtual int expire (void); + virtual int expire_single(ACE_Command_Base & pre_dispatch_command); + //@} /** * Get the dispatch information for a timer whose value is <= @a current_time. @@ -300,73 +118,46 @@ public: virtual int dispatch_info (const ACE_Time_Value ¤t_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); + + + //@{ /** - * Run the <functor> for all timers whose values are <= - * <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. - * - * Depending on the resolution of the underlying OS the system calls - * like select()/poll() might return at time different than that is - * specified in the timeout. Suppose the OS guarantees a resolution of t ms. - * The timeline will look like - * - * A B - * | | - * V V - * |-------------|-------------|-------------|-------------| - * t t t t t - * - * - * If you specify a timeout value of A, then the timeout will not occur - * at A but at the next interval of the timer, which is later than - * that is expected. Similarly, if your timeout value is equal to B, - * then the timeout will occur at interval after B. Now depending upon the - * resolution of your timeouts and the accuracy of the timeouts - * needed for your application, you should set the value of - * <timer_skew>. In the above case, if you want the timeout A to fire - * no later than A, then you should specify your <timer_skew> to be - * A % t. - * - * The timeout value should be specified via the macro ACE_TIMER_SKEW - * in your config.h file. The default value is zero. - * - * Things get interesting if the t before the timeout value B is zero - * i.e your timeout is less than the interval. In that case, you are - * almost sure of not getting the desired timeout behaviour. Maybe you - * should look for a better OS :-) - * - * Returns the number of timers canceled. + * Implement the gettimeofday() virtual function */ - - /* virtual */ int expire (void); + virtual ACE_Time_Value gettimeofday (void); + //@} /** - * Returns the current time of day. This method allows different - * implementations of the timer queue to use special high resolution - * timers. + * Allows applications to control how the timer queue gets the time + * of day. + * @deprecated Use TIME_POLICY support instead. + * This will only have effect when the TIME_POLICY used + * is ACE_FPointer_Time_Policy. Other standard ACE time + * policies will ignore this. */ - /* virtual */ ACE_Time_Value gettimeofday (void); + virtual void gettimeofday (ACE_Time_Value (*gettimeofday)(void)); + + /// Implement an inlined, non-abstract version of gettimeofday(), + /// through this member function the internals of the class can + /// make calls to ACE_OS::gettimeofday() with zero overhead. + ACE_Time_Value gettimeofday_static(); /// Allows applications to control how the timer queue gets the time /// of day. - void gettimeofday (ACE_Time_Value (*gettimeofday)(void)); + void set_time_policy(TIME_POLICY const & time_policy); /// Determine the next event to timeout. Returns @a max if there are /// no pending timers or if all pending timers are longer than max. /// This method acquires a lock internally since it modifies internal state. - virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max); - + //@{ /** - * Determine the next event to timeout. Returns @a max if there are - * no pending timers or if all pending timers are longer than max. - * <the_timeout> should be a pointer to storage for the timeout value, - * and this value is also returned. This method does not acquire a - * lock internally since it doesn't modify internal state. If you - * need to call this method when the queue is being modified - * concurrently, however, you should make sure to acquire the <mutex()> - * externally before making the call. + * Implement calculate_timeout() using the right locking policy */ + virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max); virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max, ACE_Time_Value *the_timeout); + virtual ACE_Time_Value current_time(); + //@} /// Set the timer skew for the Timer_Queue. void timer_skew (const ACE_Time_Value &skew); @@ -377,21 +168,9 @@ public: /// Synchronization variable used by the queue ACE_LOCK &mutex (void); - /// Accessor to the upcall functor - FUNCTOR &upcall_functor (void); - - /// Returns a pointer to this ACE_Timer_Queue's iterator. - virtual ITERATOR &iter (void) = 0; - - /// Removes the earliest node from the queue and returns it - virtual ACE_Timer_Node_T<TYPE> *remove_first (void) = 0; - /// Dump the state of a object. virtual void dump (void) const; - /// Reads the earliest node from the queue and returns it. - virtual ACE_Timer_Node_T<TYPE> *get_first (void) = 0; - /// Method used to return a timer node to the queue's ownership /// after it is returned by a method like <remove_first>. virtual void return_node (ACE_Timer_Node_T<TYPE> *); @@ -442,14 +221,8 @@ protected: /// Class that implements a free list ACE_Free_List<ACE_Timer_Node_T<TYPE> > *free_list_; - /// Pointer to function that returns the current time of day. - ACE_Time_Value (*gettimeofday_)(void); - - /// Upcall functor - FUNCTOR *upcall_functor_; - - /// To delete or not to delete is the question? - bool const delete_upcall_functor_; + /// The policy to return the current time of day + TIME_POLICY time_policy_; /// Flag to delete only if the class created the <free_list_> bool const delete_free_list_; @@ -461,91 +234,6 @@ private: /// Adjusts for timer skew in various clocks. ACE_Time_Value timer_skew_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Queue_T (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &)) -}; - -/** - * @class ACE_Event_Handler_Handle_Timeout_Upcall - * - * @brief Functor for Timer_Queues. - * - * This class implements the functor required by the Timer - * Queue to call <handle_timeout> on ACE_Event_Handlers. - */ -template <class ACE_LOCK> -class ACE_Event_Handler_Handle_Timeout_Upcall -{ -public: - typedef ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, - ACE_LOCK> - TIMER_QUEUE; - - // = Initialization and termination methods. - /// Constructor. - ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// Destructor. - ~ACE_Event_Handler_Handle_Timeout_Upcall (void); - - /// This method is called when a timer is registered. - int registration (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - - /// This method is called before the timer expires. - int preinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *&upcall_act); - - /// This method is called when the timer expires. - int timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time); - - /// This method is called after the timer expires. - int postinvoke (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - int recurring_timer, - const ACE_Time_Value &cur_time, - const void *upcall_act); - - /// This method is called when a handler is cancelled - int cancel_type (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int &requires_reference_counting); - - /// This method is called when a timer is cancelled - int cancel_timer (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - int dont_call, - int requires_reference_counting); - - /// This method is called when the timer queue is destroyed and - /// the timer is still contained in it - int deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg); - -private: - - /// Flag indicating that reference counting is required for this - /// event handler upcall. - int requires_reference_counting_; - - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC (ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &)) }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Queue_T.inl b/dep/acelite/ace/Timer_Queue_T.inl index 7606a2e1f62..eb896b6b8bd 100644 --- a/dep/acelite/ace/Timer_Queue_T.inl +++ b/dep/acelite/ace/Timer_Queue_T.inl @@ -1,160 +1,38 @@ // -*- C++ -*- // -// $Id: Timer_Queue_T.inl 80826 2008-03-04 14:51:23Z wotte $ +// $Id: Timer_Queue_T.inl 95332 2011-12-15 11:09:41Z mcorino $ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T<TYPE> *n, - long timer_id) +template <class TYPE, class FUNCTOR> ACE_INLINE FUNCTOR & +ACE_Timer_Queue_Upcall_Base<TYPE, FUNCTOR>::upcall_functor (void) { - this->type_ = type; - this->act_ = a; - this->timer_value_ = t; - this->interval_ = i; - this->next_ = n; - this->timer_id_ = timer_id; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set (const TYPE &type, - const void *a, - const ACE_Time_Value &t, - const ACE_Time_Value &i, - ACE_Timer_Node_T<TYPE> *p, - ACE_Timer_Node_T<TYPE> *n, - long timer_id) -{ - this->type_ = type; - this->act_ = a; - this->timer_value_ = t; - this->interval_ = i; - this->prev_ = p; - this->next_ = n; - this->timer_id_ = timer_id; -} - -template <class TYPE> ACE_INLINE TYPE & -ACE_Timer_Node_T<TYPE>::get_type (void) -{ - return this->type_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_type (TYPE &type) -{ - this->type_ = type; -} - -template <class TYPE> ACE_INLINE const void * -ACE_Timer_Node_T<TYPE>::get_act (void) -{ - return this->act_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_act (void *act) -{ - this->act_ = act; -} - -template <class TYPE> ACE_INLINE const ACE_Time_Value & -ACE_Timer_Node_T<TYPE>::get_timer_value (void) const -{ - return this->timer_value_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_timer_value (const ACE_Time_Value &timer_value) -{ - this->timer_value_ = timer_value; -} - -template <class TYPE> ACE_INLINE const ACE_Time_Value & -ACE_Timer_Node_T<TYPE>::get_interval (void) const -{ - return this->interval_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_interval (const ACE_Time_Value &interval) -{ - this->interval_ = interval; -} - -template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> * -ACE_Timer_Node_T<TYPE>::get_prev (void) -{ - return this->prev_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_prev (ACE_Timer_Node_T<TYPE> *prev) -{ - this->prev_ = prev; -} - -template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> * -ACE_Timer_Node_T<TYPE>::get_next (void) -{ - return this->next_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_next (ACE_Timer_Node_T<TYPE> *next) -{ - this->next_ = next; -} - -template <class TYPE> ACE_INLINE long -ACE_Timer_Node_T<TYPE>::get_timer_id (void) const -{ - return this->timer_id_; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::set_timer_id (long timer_id) -{ - this->timer_id_ = timer_id; -} - -template <class TYPE> ACE_INLINE void -ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) -{ - // Yes, do a copy - info.type_ = this->type_; - info.act_ = this->act_; - info.recurring_timer_ = - this->interval_ > ACE_Time_Value::zero; + return *this->upcall_functor_; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (const ACE_Time_Value &skew) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::timer_skew (const ACE_Time_Value &skew) { timer_skew_ = skew; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE const ACE_Time_Value & -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE const ACE_Time_Value & +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::timer_skew (void) const { return timer_skew_; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE int -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire (void) { if (!this->is_empty ()) - return this->expire (this->gettimeofday () + timer_skew_); + return this->expire (this->gettimeofday_static () + timer_skew_); else return 0; } -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value &cur_time, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dispatch_info (const ACE_Time_Value &cur_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) { ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info"); @@ -163,8 +41,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value return this->dispatch_info_i (cur_time, info); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, const ACE_Time_Value &cur_time) { this->upcall_functor ().timeout (*this, @@ -174,8 +52,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info cur_time); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, const ACE_Time_Value &cur_time, const void *&upcall_act) { @@ -187,8 +65,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_I upcall_act); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, const ACE_Time_Value &cur_time, const void *upcall_act) { @@ -200,23 +78,17 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_ upcall_act); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE ACE_Time_Value -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (void) -{ - // Invoke gettimeofday via pointer to function. - return this->gettimeofday_ (); -} - -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (ACE_Time_Value (*gettimeofday)(void)) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE ACE_Time_Value +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::gettimeofday_static (void) { - this->gettimeofday_ = gettimeofday; + // Get the current time according to the time policy. + return this->time_policy_ (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE FUNCTOR & -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::set_time_policy (TIME_POLICY const & rhs) { - return *this->upcall_functor_; + this->time_policy_ = rhs; } ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Queuefwd.h b/dep/acelite/ace/Timer_Queuefwd.h index 662f29c0411..46f0612cc87 100644 --- a/dep/acelite/ace/Timer_Queuefwd.h +++ b/dep/acelite/ace/Timer_Queuefwd.h @@ -4,7 +4,7 @@ /** * @file Timer_Queuefwd.h * - * $Id: Timer_Queuefwd.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Queuefwd.h 95332 2011-12-15 11:09:41Z mcorino $ * * Forward declarations and typedefs of ACE_Timer_Queue class. * @@ -17,19 +17,13 @@ #include /**/ "ace/pre.h" -#include "ace/Synch_Traits.h" +#include "ace/config-all.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_T; -template <class ACE_LOCK> class ACE_Event_Handler_Handle_Timeout_Upcall; - class ACE_Event_Handler; - -typedef ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX> - ACE_Timer_Queue; +template <class TYPE> class ACE_Abstract_Timer_Queue; +typedef ACE_Abstract_Timer_Queue<ACE_Event_Handler*> ACE_Timer_Queue; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Wheel.h b/dep/acelite/ace/Timer_Wheel.h index 21ba8776102..12b8bff0d5d 100644 --- a/dep/acelite/ace/Timer_Wheel.h +++ b/dep/acelite/ace/Timer_Wheel.h @@ -4,7 +4,7 @@ /** * @file Timer_Wheel.h * - * $Id: Timer_Wheel.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Timer_Wheel.h 95335 2011-12-15 13:13:17Z msmit $ * * @author Darrell Brunsch (brunsch@cs.wustl.edu) */ @@ -16,6 +16,7 @@ #include /**/ "ace/pre.h" #include "ace/Timer_Wheel_T.h" +#include "ace/Event_Handler_Handle_Timeout_Upcall.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -27,13 +28,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // compatibility. typedef ACE_Timer_Wheel_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, + ACE_Event_Handler_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Wheel; typedef ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX> + ACE_Event_Handler_Handle_Timeout_Upcall, + ACE_SYNCH_RECURSIVE_MUTEX, + ACE_Default_Time_Policy> ACE_Timer_Wheel_Iterator; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/Timer_Wheel_T.cpp b/dep/acelite/ace/Timer_Wheel_T.cpp index 529cc456d50..4d596ed2c9b 100644 --- a/dep/acelite/ace/Timer_Wheel_T.cpp +++ b/dep/acelite/ace/Timer_Wheel_T.cpp @@ -1,4 +1,4 @@ -// $Id: Timer_Wheel_T.cpp 89254 2010-02-25 22:10:39Z cleeland $ +// $Id: Timer_Wheel_T.cpp 95401 2011-12-31 22:17:35Z schmidt $ #ifndef ACE_TIMER_WHEEL_T_CPP #define ACE_TIMER_WHEEL_T_CPP @@ -41,12 +41,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * @param upcall_functor A pointer to a functor to use instead of the default * @param freelist A pointer to a freelist to use instead of the default */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Wheel_T +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Wheel_T (FUNCTOR* upcall_functor , FreeList* freelist + , TIME_POLICY const & time_policy ) -: Base (upcall_functor, freelist) + : Base_Timer_Queue (upcall_functor, freelist, time_policy) , spokes_(0) , spoke_count_(0) // calculated in open_i , spoke_bits_(0) @@ -71,14 +72,15 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Wheel_T * @param upcall_functor A pointer to a functor to use instead of the default * @param freelist A pointer to a freelist to use instead of the default */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Wheel_T +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_Wheel_T (u_int spoke_count, u_int resolution, size_t prealloc, FUNCTOR* upcall_functor, - FreeList* freelist) -: Base (upcall_functor, freelist) + FreeList* freelist, + TIME_POLICY const & time_policy) +: Base_Timer_Queue (upcall_functor, freelist, time_policy) , spokes_ (0) , spoke_count_ (0) // calculated in open_i , spoke_bits_ (0) @@ -91,8 +93,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Wheel_T this->open_i (prealloc, spoke_count, resolution); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::power2bits (int n, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::power2bits (int n, int min_bits, int max_bits) { @@ -127,14 +129,12 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::power2bits (int n, * Initialize the queue. Uses the established members for all needed * information. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::open_i +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::open_i (size_t prealloc, u_int spokes, u_int res) { ACE_TRACE ("ACE_Timer_Wheel_T::open_i"); - this->gettimeofday (ACE_OS::gettimeofday); - // Rather than waste bits in our timer id, we might as well round up // the spoke count to the next power of two - 1 . (i.e 1,3,7,15,...127,etc.) const int MIN_SPOKE_BITS = 3; // Allow between 8 and 4096 spokes @@ -164,13 +164,30 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::open_i } /// Destructor just cleans up its memory -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Wheel_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::~ACE_Timer_Wheel_T (void) { ACE_TRACE ("ACE_Timer_Wheel_T::~ACE_Timer_Wheel_T"); delete iterator_; + this->close (); + for (u_int i = 0; i < this->spoke_count_; ++i) + { + // Free all the nodes starting at the root + ACE_Timer_Node_T<TYPE>* root = this->spokes_[i]; + this->free_node (root); + } + + delete[] this->spokes_; +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::close (void) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::close"); + + // Remove any remaining nodes for (u_int i = 0; i < this->spoke_count_; ++i) { // Free all the nodes starting at the root @@ -184,15 +201,16 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Wheel_T (void) this->free_node (n); n = next; } - delete root; } - delete[] this->spokes_; + + // Leave rest for destructor + return 0; } /// Searches for a node by timer_id within one spoke. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE>* -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::find_spoke_node +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::find_spoke_node (u_int spoke, long timer_id) const { ACE_Timer_Node_T<TYPE>* root = this->spokes_[spoke]; @@ -208,9 +226,9 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::find_spoke_node /// Searches all spokes for a node matching the specified timer_id /// Uses the spoke encoded in the timer_id as a starting place. -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE>* -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::find_node (long timer_id) const +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::find_node (long timer_id) const { if (timer_id == -1) return 0; @@ -244,8 +262,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::find_node (long timer_id) const * * @return True if empty */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> bool -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::is_empty (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::is_empty (void) const { ACE_TRACE ("ACE_Timer_Wheel_T::is_empty"); return timer_count_ == 0; @@ -255,8 +273,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::is_empty (void) const /** * @return First (earliest) node in the wheel_'s earliest_spoke_ list */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> const ACE_Time_Value & -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::earliest_time (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> const ACE_Time_Value & +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::earliest_time (void) const { ACE_TRACE ("ACE_Timer_Wheel_T::earliest_time"); ACE_Timer_Node_T<TYPE>* n = this->get_first_i (); @@ -268,8 +286,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::earliest_time (void) const /// Uses a simple hash to find which spoke to use based on when the /// timer is due to expire. Hopefully the 64bit int operations avoid /// any overflow problems. -template <class TYPE, class FUNCTOR, class ACE_LOCK> u_int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_spoke +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> u_int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::calculate_spoke (const ACE_Time_Value& t) const { return static_cast<u_int> ((t.msec () >> this->res_bits_) & (this->spoke_count_ - 1)); @@ -280,8 +298,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_spoke /// have to do exhaustive searches within the spoke to ensure that a particular /// timer id is not already in use. Some optimizations are in place so /// that this hopefully doesn't have to happen often. -template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::generate_timer_id (u_int spoke) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::generate_timer_id (u_int spoke) { int cnt_bits = sizeof (long) * 8 - this->spoke_bits_; @@ -382,8 +400,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::generate_timer_id (u_int spoke) * @return Unique identifier (can be used to cancel the timer). * -1 on failure. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE& type, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> long +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i (const TYPE& type, const void* act, const ACE_Time_Value& future_time, const ACE_Time_Value& interval) @@ -418,8 +436,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE& type, * * @param n The timer node to reschedule */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reschedule (ACE_Timer_Node_T<TYPE>* n) { ACE_TRACE ("ACE_Timer_Wheel_T::reschedule"); const ACE_Time_Value& expire = n->get_timer_value (); @@ -428,8 +446,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule (ACE_Timer_Node_T<TYPE>* } /// The shared scheduling functionality between schedule() and reschedule() -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::schedule_i (ACE_Timer_Node_T<TYPE>* n, u_int spoke, const ACE_Time_Value& expire) @@ -476,8 +494,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i * * @return 0 if successful, -1 if no. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::reset_interval (long timer_id, const ACE_Time_Value &interval ) { @@ -506,8 +524,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, * * @return Number of timers cancelled */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE& type, int skip_close) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (const TYPE& type, int skip_close) { ACE_TRACE ("ACE_Timer_Wheel_T::cancel"); @@ -589,8 +607,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE& type, int skip_c * @return 1 for sucess and 0 if the timer_id wasn't found (or was * found to be invalid) */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel (long timer_id, const void **act, int skip_close) { @@ -631,8 +649,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, } /// Shared subset of the two cancel() methods. -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::cancel_i (ACE_Timer_Node_T<TYPE>* n) { this->unlink (n); this->free_node (n); @@ -644,8 +662,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n) /// determined from their expiration time. /// The last time is always passed in, even though you can often calculate /// it as get_first()->get_timer_value(). -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::recalc_earliest +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::recalc_earliest (const ACE_Time_Value& last) { // This is possible because we use a count for is_empty() @@ -687,8 +705,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::recalc_earliest * Dumps out the size of the wheel, the resolution, and the contents * of the wheel. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_Wheel_T::dump"); @@ -723,15 +741,15 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const * * @return The earliest timer node. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::remove_first (void) { ACE_TRACE ("ACE_Timer_Wheel_T::remove_first"); return remove_first_expired (ACE_Time_Value::max_time); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::unlink (ACE_Timer_Node_T<TYPE>* n) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::unlink (ACE_Timer_Node_T<TYPE>* n) { ACE_TRACE ("ACE_Timer_Wheel_T::unlink"); --timer_count_; @@ -741,8 +759,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::unlink (ACE_Timer_Node_T<TYPE>* n) n->set_next (0); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first_expired (const ACE_Time_Value& now) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::remove_first_expired (const ACE_Time_Value& now) { ACE_Timer_Node_T<TYPE>* n = this->get_first (); if (n != 0 && n->get_timer_value() <= now) @@ -759,17 +777,17 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first_expired (const ACE_Time * * @return The earliest timer node. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE>* -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::get_first (void) { ACE_TRACE ("ACE_Timer_Wheel_T::get_first"); return this->get_first_i (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE>* -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::get_first_i (void) const { ACE_Timer_Node_T<TYPE>* root = this->spokes_[this->earliest_spoke_]; ACE_Timer_Node_T<TYPE>* first = root->get_next (); @@ -782,9 +800,9 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const /** * @return The iterator */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Queue_Iterator_T<TYPE> & +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::iter (void) { this->iterator_->first (); return *this->iterator_; @@ -794,8 +812,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) * Dummy version of expire to get rid of warnings in Sun CC 4.2 * Just call the expire of the base class. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire () +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire () { return ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::expire (); } @@ -808,8 +826,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire () * * @return Number of timers expired */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value& cur_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> int +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::expire (const ACE_Time_Value& cur_time) { ACE_TRACE ("ACE_Timer_Wheel_T::expire"); @@ -866,8 +884,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value& cur_ti * * @param wheel A reference for a timer queue to iterate over */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK>::ACE_Timer_Wheel_Iterator_T +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK,TIME_POLICY>::ACE_Timer_Wheel_Iterator_T (Wheel& wheel) : timer_wheel_ (wheel) { @@ -878,10 +896,8 @@ ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK>::ACE_Timer_Wheel_Iterator_T /** * Destructor, at this level does nothing. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_Iterator_T<TYPE, -FUNCTOR, -ACE_LOCK>::~ACE_Timer_Wheel_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> +ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK,TIME_POLICY>::~ACE_Timer_Wheel_Iterator_T (void) { } @@ -894,8 +910,8 @@ ACE_LOCK>::~ACE_Timer_Wheel_Iterator_T (void) * If the wheel is empty, spoke_ will be equal timer_wheel_.spoke_count_ and * current_node_ would be 0. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::first (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::first (void) { this->goto_next(0); } @@ -904,8 +920,8 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::first (void) /** * Positions the iterator at the next node. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::next (void) { if (this->isdone()) return; @@ -919,8 +935,8 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::next (void) } /// Helper class for common functionality of next() and first() -template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::goto_next (u_int start_spoke) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> void +ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::goto_next (u_int start_spoke) { // Find the first non-empty entry. u_int sc = this->timer_wheel_.spoke_count_; @@ -943,8 +959,8 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::goto_next (u_int start_spok /** * @return True when we there aren't any more items (when current_node_ == 0) */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> bool -ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::isdone (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> bool +ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::isdone (void) const { return this->current_node_ == 0; } @@ -953,8 +969,8 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::isdone (void) const * @return The node at the current spokeition in the sequence or 0 if the wheel * is empty */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::item (void) { return this->current_node_; } diff --git a/dep/acelite/ace/Timer_Wheel_T.h b/dep/acelite/ace/Timer_Wheel_T.h index 266099f2e6a..e451deca908 100644 --- a/dep/acelite/ace/Timer_Wheel_T.h +++ b/dep/acelite/ace/Timer_Wheel_T.h @@ -4,7 +4,7 @@ /** * @file Timer_Wheel_T.h * - * $Id: Timer_Wheel_T.h 84619 2009-02-26 12:26:16Z johnnyw $ + * $Id: Timer_Wheel_T.h 95368 2011-12-19 13:38:49Z mcorino $ * * @author Darrell Brunsch <brunsch@cs.wustl.edu> */ @@ -15,6 +15,7 @@ #include /**/ "ace/pre.h" #include "ace/Timer_Queue_T.h" +#include "ace/Copy_Disabled.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -23,7 +24,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY> class ACE_Timer_Wheel_T; /** @@ -35,19 +36,19 @@ class ACE_Timer_Wheel_T; * node of a timer queue. Be aware that it doesn't traverse * in the order of timeout values. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> class ACE_Timer_Wheel_Iterator_T - : public ACE_Timer_Queue_Iterator_T <TYPE, FUNCTOR, ACE_LOCK> + : public ACE_Timer_Queue_Iterator_T <TYPE> { public: - typedef ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> Wheel; + typedef ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Wheel; typedef ACE_Timer_Node_T<TYPE> Node; /// Constructor ACE_Timer_Wheel_Iterator_T (Wheel &); /// Destructor - ~ACE_Timer_Wheel_Iterator_T (void); + virtual ~ACE_Timer_Wheel_Iterator_T (void); /// Positions the iterator at the earliest node in the Timer Queue virtual void first (void); @@ -88,28 +89,31 @@ private: * Timer Facilities" * (http://dworkin.wustl.edu/~varghese/PAPERS/newbsd.ps.Z) */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_Wheel_T : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK, typename TIME_POLICY = ACE_Default_Time_Policy> +class ACE_Timer_Wheel_T + : public ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> { public: /// Type of iterator - typedef ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> Iterator; + typedef ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Iterator; /// Iterator is a friend - friend class ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>; + friend class ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>; typedef ACE_Timer_Node_T<TYPE> Node; /// Type inherited from - typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> Base; + typedef ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY> Base_Timer_Queue; typedef ACE_Free_List<Node> FreeList; /// Default constructor - ACE_Timer_Wheel_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0); + ACE_Timer_Wheel_T (FUNCTOR* upcall_functor = 0, FreeList* freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Constructor with opportunities to set the wheelsize and resolution ACE_Timer_Wheel_T (u_int spoke_count, u_int resolution, size_t prealloc = 0, FUNCTOR* upcall_functor = 0, - FreeList* freelist = 0); + FreeList* freelist = 0, + TIME_POLICY const & time_policy = TIME_POLICY()); /// Destructor virtual ~ACE_Timer_Wheel_T (void); @@ -139,6 +143,11 @@ public: const void** act = 0, int dont_call_handle_close = 1); + /** + * Destroy timer queue. Cancels all timers. + */ + virtual int close (void); + /// Run the <functor> for all timers whose values are <= /// <ACE_OS::gettimeofday>. Also accounts for <timer_skew>. Returns /// the number of timers canceled. @@ -150,7 +159,7 @@ public: int expire (const ACE_Time_Value& current_time); /// Returns a pointer to this <ACE_Timer_Queue_T>'s iterator. - virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& iter (void); + virtual ACE_Timer_Queue_Iterator_T<TYPE> & iter (void); /// Removes the earliest node from the queue and returns it virtual ACE_Timer_Node_T<TYPE>* remove_first (void); @@ -205,11 +214,6 @@ private: ACE_Time_Value wheel_time_; /// The total number of timers currently scheduled. u_int timer_count_; - - // = Don't allow these operations for now, don't split into multiple lines - // breaks sun compilers - ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/TkReactor/ACE_TkReactor_export.h b/dep/acelite/ace/TkReactor/ACE_TkReactor_export.h new file mode 100644 index 00000000000..bbb6a52a1e3 --- /dev/null +++ b/dep/acelite/ace/TkReactor/ACE_TkReactor_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_TkReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s ACE_TkReactor +// ------------------------------ +#ifndef ACE_TKREACTOR_EXPORT_H +#define ACE_TKREACTOR_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_TKREACTOR_HAS_DLL) +# define ACE_TKREACTOR_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_TKREACTOR_HAS_DLL */ + +#if !defined (ACE_TKREACTOR_HAS_DLL) +# define ACE_TKREACTOR_HAS_DLL 1 +#endif /* ! ACE_TKREACTOR_HAS_DLL */ + +#if defined (ACE_TKREACTOR_HAS_DLL) && (ACE_TKREACTOR_HAS_DLL == 1) +# if defined (ACE_TKREACTOR_BUILD_DLL) +# define ACE_TkReactor_Export ACE_Proper_Export_Flag +# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_TKREACTOR_BUILD_DLL */ +# define ACE_TkReactor_Export ACE_Proper_Import_Flag +# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_TKREACTOR_BUILD_DLL */ +#else /* ACE_TKREACTOR_HAS_DLL == 1 */ +# define ACE_TkReactor_Export +# define ACE_TKREACTOR_SINGLETON_DECLARATION(T) +# define ACE_TKREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_TKREACTOR_HAS_DLL == 1 */ + +// Set ACE_TKREACTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_TKREACTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_TKREACTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_TKREACTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_TKREACTOR_NTRACE */ + +#if (ACE_TKREACTOR_NTRACE == 1) +# define ACE_TKREACTOR_TRACE(X) +#else /* (ACE_TKREACTOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_TKREACTOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_TKREACTOR_NTRACE == 1) */ + +#endif /* ACE_TKREACTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/TkReactor/TkReactor.cpp b/dep/acelite/ace/TkReactor/TkReactor.cpp new file mode 100644 index 00000000000..1d73e0f6fe1 --- /dev/null +++ b/dep/acelite/ace/TkReactor/TkReactor.cpp @@ -0,0 +1,438 @@ +// $Id: TkReactor.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +#include "ace/TkReactor/TkReactor.h" + +#include "ace/SOCK_Acceptor.h" +#include "ace/SOCK_Connector.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_TkReactor) + +// Must be called with lock held +ACE_TkReactor::ACE_TkReactor (size_t size, + bool restart, + ACE_Sig_Handler *h) + : ACE_Select_Reactor (size, restart, h), + ids_ (0), + timeout_ (0) +{ + // When the ACE_Select_Reactor is constructed it creates the notify + // pipe and registers it with the register_handler_i() method. The + // TkReactor overloads this method BUT because the + // register_handler_i occurs when constructing the base class + // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() + // is called not the TkReactor register_handler_i(). This means + // that the notify pipe is registered with the ACE_Select_Reactor + // event handling code not the TkReactor and so notfications don't + // work. To get around this we simply close and re-opened the + // notification handler in the constructor of the TkReactor. + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->notify_handler_->close (); + this->notify_handler_->open (this, 0); +#endif /* ACE_MT_SAFE */ +} + +ACE_TkReactor::~ACE_TkReactor (void) +{ + // Delete the remaining items in the linked list. + + while (this->ids_) + { + ACE_TkReactorID *TkID = this->ids_->next_; + delete this->ids_; + this->ids_ = TkID; + } +} + +// This is just the <wait_for_multiple_events> from ace/Reactor.cpp +// but we use the Tk functions to wait for an event, not <select> + +int +ACE_TkReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_TkReactor::wait_for_multiple_events"); + int nfound; + + do + { + max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); + + size_t width = this->handler_rep_.max_handlep1 (); + handle_set.rd_mask_ = this->wait_set_.rd_mask_; + handle_set.wr_mask_ = this->wait_set_.wr_mask_; + handle_set.ex_mask_ = this->wait_set_.ex_mask_; + nfound = TkWaitForMultipleEvents (width, + handle_set, + max_wait_time); + + } while (nfound == -1 && this->handle_error () > 0); + + if (nfound > 0) + { +#if !defined (ACE_WIN32) + handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + return nfound; // Timed out or input available +} + +void +ACE_TkReactor::TimerCallbackProc (ClientData cd) +{ + ACE_TkReactor *self = (ACE_TkReactor *) cd; + self->timeout_ = 0; + + // Deal with any timer events + ACE_Select_Reactor_Handle_Set handle_set; + self->dispatch (0, handle_set); + self->reset_timeout (); +} + +/** + * @todo the unused mask argument is probably quite useful, but we + * ignore it, why? In fact the following comment probably + * relates to that: + * This could be made shorter if we know which *kind* of event + * we were about to get. Here we use <select> to find out which + * one might be available. + */ +void +ACE_TkReactor::InputCallbackProc (ClientData cd, + int /* mask */) +{ + ACE_TkReactor_Input_Callback *callback = (ACE_TkReactor_Input_Callback *) cd; + ACE_TkReactor *self = callback->reactor_; + ACE_HANDLE handle = callback->handle_; + + // my copy isn't const. + ACE_Time_Value zero = ACE_Time_Value::zero; + + ACE_Select_Reactor_Handle_Set wait_set; + + // Deal with one file event. + + // - read which kind of event + if (self->wait_set_.rd_mask_.is_set (handle)) + wait_set.rd_mask_.set_bit (handle); + if (self->wait_set_.wr_mask_.is_set (handle)) + wait_set.wr_mask_.set_bit (handle); + if (self->wait_set_.ex_mask_.is_set (handle)) + wait_set.ex_mask_.set_bit (handle); + + int result = ACE_OS::select (handle + 1, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); + + ACE_Select_Reactor_Handle_Set dispatch_set; + + // - Use only that one file event (removes events for other files). + if (result > 0) + { + if (wait_set.rd_mask_.is_set (handle)) + dispatch_set.rd_mask_.set_bit (handle); + if (wait_set.wr_mask_.is_set (handle)) + dispatch_set.wr_mask_.set_bit (handle); + if (wait_set.ex_mask_.is_set (handle)) + dispatch_set.ex_mask_.set_bit (handle); + + self->dispatch (1, dispatch_set); + } +} + +int +ACE_TkReactor::TkWaitForMultipleEvents (int width, + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value *) +{ + // Check to make sure our handle's are all usable. + ACE_Select_Reactor_Handle_Set temp_set = wait_set; + + if (ACE_OS::select (width, + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + return -1; // Bad file arguments... + + // Instead of waiting using <select>, just use the Tk mechanism to + // wait for a single event. + + // Wait for something to happen. + ::Tcl_DoOneEvent (0); + + // Reset the width, in case it changed during the upcalls. + width = this->handler_rep_.max_handlep1 (); + + // Now actually read the result needed by the <Select_Reactor> using + // <select>. + return ACE_OS::select (width, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); +} + +int +ACE_TkReactor::register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_TkReactor::register_handler_i"); + + int result = ACE_Select_Reactor::register_handler_i (handle, + handler, mask); + if (result == -1) + return -1; + + int condition = 0; + +#if !defined ACE_WIN32 + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, TK_READABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, TK_WRITABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, TK_EXCEPTION); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (condition, TK_READABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ + ACE_SET_BITS (condition, TK_READABLE); // connected, you may write + ACE_SET_BITS (condition, TK_WRITABLE); // connected, you have data/err + } +#else + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, TK_READABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, TK_WRITABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_NOTSUP_RETURN(-1); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) + ACE_SET_BITS (condition, TK_READABLE); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ + ACE_SET_BITS (condition, TK_READABLE); // connected, you may write + ACE_SET_BITS (condition, TK_WRITABLE); // connected, you have data/err + } +#endif /* !ACE_WIN32 */ + + if (condition != 0) + { + ACE_TkReactorID *TkID = this->ids_; + + while(TkID) + { + if (TkID->handle_ == handle) + { + ::Tk_DeleteFileHandler (TkID->handle_); + + ACE_TkReactor_Input_Callback *callback; + ACE_NEW_RETURN (callback, + ACE_TkReactor_Input_Callback, + -1); + callback->reactor_ = this; + callback->handle_ = handle; + ::Tk_CreateFileHandler ((int) handle, + condition, + InputCallbackProc, + (ClientData) callback); + return 0; + } + else + TkID = TkID->next_; + } + + ACE_NEW_RETURN (TkID, + ACE_TkReactorID, + -1); + TkID->next_ = this->ids_; + TkID->handle_ = handle; + ACE_TkReactor_Input_Callback *callback; + ACE_NEW_RETURN (callback, + ACE_TkReactor_Input_Callback, + -1); + callback->reactor_ = this; + callback->handle_ = handle; + + ::Tk_CreateFileHandler ((int) handle, + condition, + InputCallbackProc, + (ClientData) callback); + this->ids_ = TkID; + } + return 0; +} + +int +ACE_TkReactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::register_handler_i (handles, + handler, + mask); +} + +int +ACE_TkReactor::remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_TkReactor::remove_handler_i"); + + // In the registration phase we registered first with + // ACE_Select_Reactor and then with X. Now we are now doing things + // in reverse order. + + // First clean up the corresponding X11Input. + this->remove_TkFileHandler (handle); + + // Now let the reactor do its work. + return ACE_Select_Reactor::remove_handler_i (handle, + mask); +} + +void +ACE_TkReactor::remove_TkFileHandler (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_TkReactor::remove_TkFileHandler"); + + ACE_TkReactorID *TkID = this->ids_; + + if (TkID) + { + if (TkID->handle_ == handle) + { + ::Tk_DeleteFileHandler (TkID->handle_); + this->ids_ = TkID->next_; + delete TkID; + return; + } + + ACE_TkReactorID *NextID = TkID->next_; + + while (NextID) + { + if (NextID->handle_ == handle) + { + ::Tk_DeleteFileHandler (NextID->handle_); + TkID->next_ = NextID->next_; + delete NextID; + return; + } + else + { + TkID = NextID; + NextID = NextID->next_; + } + } + } +} + +int +ACE_TkReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, + mask); +} + +// The following functions ensure that there is an Tk timeout for the +// first timeout in the Reactor's Timer_Queue. + +void +ACE_TkReactor::reset_timeout (void) +{ + if (this->timeout_) + ::Tk_DeleteTimerHandler (this->timeout_); + timeout_ = 0; + + ACE_Time_Value *max_wait_time = + this->timer_queue_->calculate_timeout (0); + + if (max_wait_time) + timeout_ = ::Tk_CreateTimerHandler (max_wait_time->msec (), + TimerCallbackProc, + (ClientData) this); +} + +int +ACE_TkReactor::reset_timer_interval + (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_TkReactor::reset_timer_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + int result = ACE_Select_Reactor::timer_queue_->reset_interval + (timer_id, + interval); + + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +long +ACE_TkReactor::schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_TkReactor::schedule_timer"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + long result = ACE_Select_Reactor::schedule_timer (event_handler, + arg, + delay, + interval); + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +int +ACE_TkReactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_TkReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (handler, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +int +ACE_TkReactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_TkReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (timer_id, + arg, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/TkReactor/TkReactor.h b/dep/acelite/ace/TkReactor/TkReactor.h new file mode 100644 index 00000000000..60ad54dd42f --- /dev/null +++ b/dep/acelite/ace/TkReactor/TkReactor.h @@ -0,0 +1,136 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file TkReactor.h + * + * $Id: TkReactor.h 82723 2008-09-16 09:35:44Z johnnyw $ + * + * @author Nagarajan Surendran <naga@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACE_TKREACTOR_H +#define ACE_TKREACTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/TkReactor/ACE_TkReactor_export.h" +#include "ace/Select_Reactor.h" +#include /**/ <tk.h> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_TkReactorID + * + * @brief This little class is necessary due to the way that Microsoft + * implements sockets to be pointers rather than indices. + */ +class ACE_TkReactor_Export ACE_TkReactorID +{ +public: + /// Underlying handle. + ACE_HANDLE handle_; + + /// Pointer to next node in the linked list. + ACE_TkReactorID *next_; +}; + +class ACE_TkReactor; + +class ACE_TkReactor_Export ACE_TkReactor_Input_Callback +{ +public: + ACE_TkReactor *reactor_; + ACE_HANDLE handle_; +}; + +/** + * @class ACE_TkReactor + * + * @brief An object-oriented event demultiplexor and event handler + * dispatcher that uses the Tk functions. + */ +class ACE_TkReactor_Export ACE_TkReactor : public ACE_Select_Reactor +{ +public: + // = Initialization and termination methods. + ACE_TkReactor (size_t size = DEFAULT_SIZE, + bool restart = false, + ACE_Sig_Handler * = 0); + + virtual ~ACE_TkReactor (void); + + // = Timer operations. + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval); + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + virtual int cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close = 1); + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + +protected: + // = Register timers/handles with Tk. + /// Register a single @a handler. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Register a set of <handlers>. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Remove the @a handler associated with this @a handle. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Remove a set of <handles>. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask); + + /// Removes an Tk FileHandler. + virtual void remove_TkFileHandler (ACE_HANDLE handle); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + ///Wait for Tk events to occur. + virtual int TkWaitForMultipleEvents (int, + ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + ACE_TkReactorID *ids_; + Tk_TimerToken timeout_; + +private: + /// This method ensures there's a Tk timeout for the first timeout in + /// the Reactor's Timer_Queue. + void reset_timeout (void); + + // = Integrate with the X callback function mechanism. + static void TimerCallbackProc (ClientData cd); + static void InputCallbackProc (ClientData cd,int mask); + + /// Deny access since member-wise won't work... + ACE_TkReactor (const ACE_TkReactor &); + ACE_TkReactor &operator = (const ACE_TkReactor &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* ACE_TK_REACTOR_H */ diff --git a/dep/acelite/ace/Token.cpp b/dep/acelite/ace/Token.cpp index c63370fa534..909f14c16e3 100644 --- a/dep/acelite/ace/Token.cpp +++ b/dep/acelite/ace/Token.cpp @@ -1,4 +1,4 @@ -// $Id: Token.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: Token.cpp 96024 2012-08-09 19:42:19Z schmidt $ #include "ace/Token.h" @@ -204,9 +204,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), return 0; } - // // Someone already holds the token. - // // Check if it is us. if (ACE_OS::thr_equal (thr_id, this->owner_)) @@ -536,7 +534,6 @@ ACE_Token::wakeup_next_waiter (void) // Wake up waiter and make it runable. queue->head_->runable_ = 1; queue->head_->signal (); - this->owner_ = queue->head_->thread_id_; } diff --git a/dep/acelite/ace/Truncate.h b/dep/acelite/ace/Truncate.h index 223513a56d9..8ff05141516 100644 --- a/dep/acelite/ace/Truncate.h +++ b/dep/acelite/ace/Truncate.h @@ -4,7 +4,7 @@ /** * @file Truncate.h * - * $Id: Truncate.h 83306 2008-10-17 12:19:53Z johnnyw $ + * $Id: Truncate.h 95761 2012-05-15 18:23:04Z johnnyw $ * * @author Steve Huston <shuston@riverace.com> * @author Ossama Othman <ossama_othman@symantec.com> @@ -27,10 +27,6 @@ #include "ace/If_Then_Else.h" #include "ace/Numeric_Limits.h" -#if defined (ACE_LACKS_LONGLONG_T) -# include "ace/Basic_Types.h" -#endif /* ACE_LACKS_LONGLONG_T */ - ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_Utils @@ -42,30 +38,24 @@ namespace ACE_Utils template<> struct Sign_Check<unsigned short> { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; template<> struct Sign_Check<unsigned int> { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; template<> struct Sign_Check<unsigned long> { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; -#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. __extension__ # endif /* __GNUC__ */ template<> struct Sign_Check<unsigned long long> { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; -#else - template<> struct Sign_Check<ACE_U_LongLong> { ACE_STATIC_CONSTANT (bool, is_signed = 0); }; -#endif /* !ACE_LACKS_LONGLONG_T */ // Specialize the signed cases. template<> struct Sign_Check<signed char> { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; template<> struct Sign_Check<signed short> { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; template<> struct Sign_Check<signed int> { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; template<> struct Sign_Check<signed long> { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; -#ifndef ACE_LACKS_LONGLONG_T # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. __extension__ # endif /* __GNUC__ */ template<> struct Sign_Check<signed long long> { ACE_STATIC_CONSTANT (bool, is_signed = 1); }; -#endif /* !ACE_LACKS_LONGLONG_T */ // ----------------------------------------------------- @@ -110,7 +100,6 @@ namespace ACE_Utils unsigned_type operator() (unsigned_type x) { return x; } }; -#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. @@ -123,15 +112,6 @@ namespace ACE_Utils unsigned_type operator() (unsigned_type x) { return x; } }; -#else - template<> - struct To_Unsigned<ACE_U_LongLong> - { - typedef ACE_U_LongLong unsigned_type; - - unsigned_type operator() (unsigned_type x) { return x; } - }; -#endif /* !ACE_LACKS_LONGLONG_T */ // ---------------- @@ -183,7 +163,6 @@ namespace ACE_Utils } }; -#if !(defined(ACE_LACKS_LONGLONG_T) || defined(ACE_LACKS_UNSIGNEDLONGLONG_T)) # ifdef __GNUC__ // Silence g++ "-pedantic" warnings regarding use of "long long" // type. @@ -200,7 +179,6 @@ namespace ACE_Utils return static_cast<unsigned_type> (x); } }; -#endif /* !ACE_LACKS_LONGLONG_T */ // ----------------------------------------------------- @@ -439,28 +417,6 @@ namespace ACE_Utils }; -#if defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - // Partial specialization for the case where we're casting from - // ACE_U_LongLong to a smaller integer. We assume that we're always - // truncating from ACE_U_LongLong to a smaller type. The partial - // specialization above handles the case where both the FROM and TO - // types are ACE_U_LongLong. - template<typename TO> - struct Truncator<ACE_U_LongLong, TO> - { - TO operator() (ACE_U_LongLong const & val) - { - // If val less than or equal to ACE_Numeric_Limits<TO>::max(), - // val.lo() must be less than or equal to - // ACE_Numeric_Limits<TO>::max (), as well. - return - (val > ACE_Numeric_Limits<TO>::max () - ? ACE_Numeric_Limits<TO>::max () - : static_cast<TO> (val.lo ())); - } - }; -#endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ - // ----------------------------------------------------- /** * @struct Noop_Truncator diff --git a/dep/acelite/ace/UUID.cpp b/dep/acelite/ace/UUID.cpp index 8fdf150b0fd..09855ca672d 100644 --- a/dep/acelite/ace/UUID.cpp +++ b/dep/acelite/ace/UUID.cpp @@ -1,4 +1,4 @@ -//$Id: UUID.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +//$Id: UUID.cpp 96017 2012-08-08 22:18:09Z mitza $ #include "ace/UUID.h" #include "ace/Guard_T.h" @@ -359,7 +359,7 @@ namespace ACE_Utils uuid.time_mid (static_cast<ACE_UINT16> ((timestamp >> 32) & 0xFFFF)); ACE_UINT16 tHAV = static_cast<ACE_UINT16> ((timestamp >> 48) & 0xFFFF); - tHAV |= (version << 12); + tHAV = static_cast<ACE_UINT16> (tHAV | (version << 12)); uuid.time_hi_and_version (tHAV); u_char cseqHAV; @@ -367,7 +367,7 @@ namespace ACE_Utils cseqHAV = static_cast<u_char> ((clock_sequence & 0x3f00) >> 8); uuid_state_.timestamp = timestamp; - cseqHAV |= variant; + cseqHAV = static_cast<u_char> (cseqHAV | variant); uuid.clock_seq_hi_and_reserved (cseqHAV); uuid.node (uuid_state_.node); @@ -460,13 +460,7 @@ namespace ACE_Utils UUID_Generator::get_systemtime (UUID_Time & timestamp) { const UUID_Time timeOffset = -#if defined (ACE_LACKS_UNSIGNEDLONGLONG_T) - ACE_U_LongLong (ACE_INT64_LITERAL (0x1B21DD213814000)); -#elif defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong (0x13814000u, 0x1B21DD2u); -#else ACE_UINT64_LITERAL (0x1B21DD213814000); -#endif /* ACE_LACKS_UNSIGNEDLONGLONG_T */ /// Get the time of day, convert to 100ns ticks then add the offset. ACE_Time_Value now = ACE_OS::gettimeofday (); diff --git a/dep/acelite/ace/Unbounded_Set_Ex.cpp b/dep/acelite/ace/Unbounded_Set_Ex.cpp index c5cd9e27b21..763d7aa01f3 100644 --- a/dep/acelite/ace/Unbounded_Set_Ex.cpp +++ b/dep/acelite/ace/Unbounded_Set_Ex.cpp @@ -1,4 +1,4 @@ -// $Id: Unbounded_Set_Ex.cpp 81702 2008-05-15 10:18:07Z johnnyw $ +// $Id: Unbounded_Set_Ex.cpp 94304 2011-07-07 15:25:58Z johnnyw $ #ifndef ACE_UNBOUNDED_SET_EX_CPP #define ACE_UNBOUNDED_SET_EX_CPP @@ -76,7 +76,7 @@ ACE_Unbounded_Set_Ex<T, C>::dump (void) const const_iterator const the_end = this->end (); for (const_iterator i (this->begin ()); - i != end; + i != the_end; ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("count = %u\n"), count++)); diff --git a/dep/acelite/ace/Value_Ptr.h b/dep/acelite/ace/Value_Ptr.h index c9272a90cff..dbcd20a0f2c 100644 --- a/dep/acelite/ace/Value_Ptr.h +++ b/dep/acelite/ace/Value_Ptr.h @@ -4,7 +4,7 @@ /** * @file Value_Ptr.h * - * $Id: Value_Ptr.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: Value_Ptr.h 92386 2010-10-28 07:44:37Z johnnyw $ * * Value_Ptr implementation based on code in Herb Sutter's book "More * Exceptional C++". @@ -103,11 +103,6 @@ namespace ACE return *this; } -#ifndef ACE_LACKS_MEMBER_TEMPLATES - - // Compiler can't handle member templates so we lose converting - // copy operations. - /// Converting copy constructor. template <typename U> Value_Ptr (Value_Ptr<U> const & other) @@ -123,12 +118,8 @@ namespace ACE return *this; } -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - private: -#ifndef ACE_LACKS_MEMBER_TEMPLATES - /// Copying method invoked when copy constructing. template <typename U> T * create_from (U const * p) const @@ -136,24 +127,8 @@ namespace ACE return p ? VP_traits<U>::clone (p) : 0; } -#else - - // Compiler can't handle member templates so we lose converting - // copy operations. - - /// Copying method invoked when copy constructing. - T * create_from (T const * p) const - { - return p ? VP_traits<T>::clone (p) : 0; - } - -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ - private: - -#ifndef ACE_LACKS_MEMBER_TEMPLATES template <typename U> friend class Value_Ptr; -#endif /* !ACE_LACKS_MEMBER_TEMPLATES */ /// Object owned by this @c Value_Ptr. T * p_; diff --git a/dep/acelite/ace/Version.h b/dep/acelite/ace/Version.h index 835fc849fd1..33a98834bad 100644 --- a/dep/acelite/ace/Version.h +++ b/dep/acelite/ace/Version.h @@ -1,9 +1,9 @@ // -*- C++ -*- -// $Id: Version.h 92364 2010-10-27 10:02:39Z johnnyw $ +// $Id: Version.h 96107 2012-08-29 06:17:32Z johnnyw $ // This is file was automatically generated by \$ACE_ROOT/bin/make_release.py -#define ACE_MAJOR_VERSION 5 -#define ACE_MINOR_VERSION 8 -#define ACE_BETA_VERSION 3 -#define ACE_VERSION "5.8.3" +#define ACE_MAJOR_VERSION 6 +#define ACE_MINOR_VERSION 1 +#define ACE_BETA_VERSION 4 +#define ACE_VERSION "6.1.4" diff --git a/dep/acelite/ace/WFMO_Reactor.cpp b/dep/acelite/ace/WFMO_Reactor.cpp index a86b9798e50..dd4086ffd06 100644 --- a/dep/acelite/ace/WFMO_Reactor.cpp +++ b/dep/acelite/ace/WFMO_Reactor.cpp @@ -1,4 +1,4 @@ -// $Id: WFMO_Reactor.cpp 91286 2010-08-05 09:04:31Z johnnyw $ +// $Id: WFMO_Reactor.cpp 95368 2011-12-19 13:38:49Z mcorino $ #include "ace/WFMO_Reactor.h" @@ -1153,6 +1153,8 @@ ACE_WFMO_Reactor::open (size_t size, // Timer Queue if (this->delete_timer_queue_) delete this->timer_queue_; + else if (this->timer_queue_) + this->timer_queue_->close (); if (tq == 0) { @@ -1283,8 +1285,14 @@ ACE_WFMO_Reactor::timer_queue (void) const int ACE_WFMO_Reactor::timer_queue (ACE_Timer_Queue *tq) { - if (this->timer_queue_ != 0 && this->delete_timer_queue_) - delete this->timer_queue_; + if (this->delete_timer_queue_) + { + delete this->timer_queue_; + } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + } this->timer_queue_ = tq; this->delete_timer_queue_ = false; return 0; @@ -1326,6 +1334,11 @@ ACE_WFMO_Reactor::~ACE_WFMO_Reactor (void) this->timer_queue_ = 0; this->delete_timer_queue_ = false; } + else if (this->timer_queue_) + { + this->timer_queue_->close (); + this->timer_queue_ = 0; + } if (this->delete_signal_handler_) { @@ -1683,7 +1696,10 @@ ACE_WFMO_Reactor::event_handling (ACE_Time_Value *max_wait_time, // Make sure we are not closed if (!this->open_for_business_ || this->deactivated_) - return -1; + { + errno = ESHUTDOWN; + return -1; + } // Stash the current time -- the destructor of this object will // automatically compute how much time elapsed since this method was @@ -1952,7 +1968,6 @@ ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status) { const bool ok = ( #if ! defined(__BORLANDC__) \ - && !defined (ghs) \ && !defined (__MINGW32__) \ && !defined (_MSC_VER) // wait_status is unsigned in Borland, Green Hills, diff --git a/dep/acelite/ace/WFMO_Reactor.h b/dep/acelite/ace/WFMO_Reactor.h index fb3a14d28cd..e15643e3bbf 100644 --- a/dep/acelite/ace/WFMO_Reactor.h +++ b/dep/acelite/ace/WFMO_Reactor.h @@ -4,7 +4,7 @@ /** * @file WFMO_Reactor.h * - * $Id: WFMO_Reactor.h 84727 2009-03-05 19:22:29Z johnnyw $ + * $Id: WFMO_Reactor.h 93792 2011-04-07 11:48:50Z mcorino $ * * @author Irfan Pyarali <irfan@cs.wustl.edu> * @author Tim Harrison <harrison@cs.wustl.edu> @@ -112,7 +112,7 @@ public: * @class Common_Info * * @brief This struct contains the necessary information for every - * <Event_Handler> entry. The reason the event is not in this + * Event_Handler entry. The reason the event is not in this * structure is because we need to pass an event array into * WaitForMultipleObjects and therefore keeping the events * seperate makes sense. @@ -124,25 +124,25 @@ public: /// event bool io_entry_; - /// The assosiated <Event_Handler> + /// The assosiated Event_Handler ACE_Event_Handler *event_handler_; - /// The I/O handle related to the <Event_Handler>. This entry is - /// only valid if the <io_entry_> flag is true. + /// The I/O handle related to the Event_Handler. This entry is + /// only valid if the io_entry_ flag is true. ACE_HANDLE io_handle_; /** - * This is the set of events that the <Event_Handler> is - * interested in. This entry is only valid if the <io_entry_> flag + * This is the set of events that the Event_Handler is + * interested in. This entry is only valid if the io_entry_ flag * is true. */ long network_events_; /** - * This flag indicates that <WFMO_Reactor> created the event on + * This flag indicates that WFMO_Reactor created the event on * behalf of the user. Therefore we need to clean this up when the - * <Event_Handler> removes itself from <WFMO_Reactor>. This entry - * is only valid if the <io_entry_> flag is true. + * Event_Handler removes itself from WFMO_Reactor. This entry + * is only valid if the io_entry_ flag is true. */ bool delete_event_; @@ -150,8 +150,8 @@ public: bool delete_entry_; /** - * These are the masks related to <handle_close> for the - * <Event_Handler>. This is only valid when <delete_entry_> is + * These are the masks related to handle_close() for the + * Event_Handler. This is only valid when delete_entry_ is * set. */ ACE_Reactor_Mask close_masks_; @@ -302,7 +302,7 @@ public: /// Destructor. virtual ~ACE_WFMO_Reactor_Handler_Repository (void); - /// Initialize the repository of the approriate @a size. + /// Initialize the repository of the appropriate @a size. int open (size_t size); /// Close down the handler repository. @@ -314,7 +314,7 @@ public: /// the simple event entry. int bind (ACE_HANDLE, ACE_Event_Handler *); - /// Insert I/O <Event_Handler> entry into the system. This method + /// Insert I/O Event_Handler entry into the system. This method /// assumes that the lock are head *before* this method is invoked. int bind_i (bool io_entry, ACE_Event_Handler *event_handler, @@ -363,7 +363,7 @@ public: /** * This method is used to calculate the network mask after a mask_op - * request to <WFMO_Reactor>. Note that because the <Event_Handler> + * request to <WFMO_Reactor>. Note that because the Event_Handler * may already be in the handler repository, we may have to find the * old event and the old network events */ @@ -561,7 +561,7 @@ public: /** * Get the maximum number of times that the - * <ACE_WFMO_Reactor_Notify::handle_input> method will iterate and + * ACE_WFMO_Reactor_Notify::handle_input() method will iterate and * dispatch the ACE_Event_Handlers that are passed in via the * notify queue before breaking out of its * <ACE_Message_Queue::dequeue> loop. @@ -592,7 +592,7 @@ private: */ virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); - /// An auto event is used so that we can <signal> it to wakeup one + /// An auto event is used so that we can signal() it to wakeup one /// thread up (e.g., when the <notify> method is called). ACE_Auto_Event wakeup_one_thread_; @@ -808,7 +808,7 @@ public: * <ACE_INVALID_HANDLE>, WFMO_Reactor will create an event for * associating it with the I/O handle. When the <event_handle> is * signalled, the appropriate <handle_*> callback will be invoked on - * the <Event_Handler> + * the Event_Handler */ virtual int register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, @@ -827,7 +827,7 @@ public: /** * This is a simple version of the above <register_handler> method * where the I/O handle will always come from <get_handle> on the - * <Event_Handler> and the event handle will always be created by + * Event_Handler and the event handle will always be created by * <WFMO_Reactor> */ virtual int register_handler (ACE_Event_Handler *event_handler, @@ -874,10 +874,10 @@ public: * either be the <event_handle> or the <io_handle> * * For the case of I/O entries, this removes the @a mask binding of - * <Event_Handler> whose handle is @a handle from <WFMO_Reactor>. If + * Event_Handler whose handle is @a handle from <WFMO_Reactor>. If * there are no more bindings for this <event_handler> then it is * removed from the WFMO_Reactor. For simple event entries, mask is - * mostly ignored and the <Event_Handler> is always removed from + * mostly ignored and the Event_Handler is always removed from * <WFMO_Reactor> */ virtual int remove_handler (ACE_HANDLE handle, @@ -885,7 +885,7 @@ public: /** * Removes all the @a mask bindings for handles in the @a handle_set - * bind of <Event_Handler>. If there are no more bindings for any + * bind of Event_Handler. If there are no more bindings for any * of these handles then they are removed from WFMO_Reactor. */ virtual int remove_handler (const ACE_Handle_Set &handle_set, @@ -903,13 +903,13 @@ public: ACE_Sig_Action *old_disp = 0, int sigkey = -1); - /// Calls <remove_handler> for every signal in @a sigset. + /// Calls remove_handler() for every signal in @a sigset. virtual int remove_handler (const ACE_Sig_Set &sigset); // = Suspend and resume Handlers. /// Suspend @a event_handler temporarily. Use - /// <ACE_Event_Handler::get_handle> to get the handle. + /// ACE_Event_Handler::get_handle() to get the handle. virtual int suspend_handler (ACE_Event_Handler *event_handler); /// Suspend @a handle temporarily. @@ -918,7 +918,7 @@ public: /// Suspend all @a handles in handle set temporarily. virtual int suspend_handler (const ACE_Handle_Set &handles); - /// Suspend all <handles> temporarily. + /// Suspend all handles temporarily. virtual int suspend_handlers (void); /// Resume @a event_handler. Use <ACE_Event_Handler::get_handle> to @@ -975,7 +975,7 @@ public: /** * Resets the interval of the timer represented by @a timer_id to * @a interval, which is specified in relative time to the current - * <gettimeofday>. If @a interval is equal to + * gettimeofday(). If @a interval is equal to * ACE_Time_Value::zero, the timer will become a non-rescheduling * timer. Returns 0 if successful, -1 if not. */ @@ -1019,15 +1019,15 @@ public: ACE_Reactor_Mask masks_to_be_added); /** - * Remove <masks_to_be_deleted> to the <handle>'s entry in - * WFMO_Reactor. The Event_Handler associated with <handle> must + * Remove @a masks_to_be_deleted to the <handle>'s entry in + * WFMO_Reactor. The Event_Handler associated with @a event_handler must * already have been registered with WFMO_Reactor. */ virtual int cancel_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_deleted); /** - * Remove <masks_to_be_deleted> to the <handle>'s entry in + * Remove @a masks_to_be_deleted to the <handle>'s entry in * WFMO_Reactor. The Event_Handler associated with <handle> must * already have been registered with WFMO_Reactor. */ diff --git a/dep/acelite/ace/WIN32_Asynch_IO.cpp b/dep/acelite/ace/WIN32_Asynch_IO.cpp index 75da1ad6f08..8eaf745ed15 100644 --- a/dep/acelite/ace/WIN32_Asynch_IO.cpp +++ b/dep/acelite/ace/WIN32_Asynch_IO.cpp @@ -1,4 +1,4 @@ -// $Id: WIN32_Asynch_IO.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $ +// $Id: WIN32_Asynch_IO.cpp 95652 2012-03-23 22:11:35Z shuston $ #include "ace/WIN32_Asynch_IO.h" @@ -3367,11 +3367,15 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, -1); // do the scatter/gather recv + // NOTE! The flags value is in/out to recvfrom() - it's changed AFTER + // the call to WSARecvFrom returns and if it completes immediately, the + // result object may already be deleted. Since the changed value is not + // used, and not needed by result, pass a copy to avoid the race. ssize_t initiate_result = ACE_OS::recvfrom (result->handle (), iov, iovcnt, number_of_bytes_recvd, - result->flags_, + flags, result->saddr (), &(result->addr_len_), result, @@ -3644,7 +3648,9 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, do { - if (msg_len >= 0 && iovcnt < ACE_IOV_MAX) + //if (msg_len >= 0 && iovcnt < ACE_IOV_MAX) + // msg_len >= 0 is always true since msg_len is unsigned + if (iovcnt < ACE_IOV_MAX) { u_long this_chunk_length; if (msg_len > ULONG_MAX) diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.hpp b/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.hpp new file mode 100644 index 00000000000..6c13fc94d9d --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.hpp @@ -0,0 +1,76 @@ +// file : XMLSchema/Traversal.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Traversal.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XMLSCHEMA_TRAVERSAL_HPP +#define XMLSCHEMA_TRAVERSAL_HPP + +#include <ace/XML_Utils/XSCRT/Traversal.hpp> +#include <ace/XML_Utils/XMLSchema/Types.hpp> + +namespace XMLSchema +{ + namespace Traversal + { + // Automatic traversal of IDREFs. + // + // + struct IDREF : + XSCRT::Traversal::Traverser<XMLSchema::IDREF_Base, XSCRT::Type> + { + virtual void + traverse (XMLSchema::IDREF_Base& r) + { + if (r.get ()) dispatch (*(r.get ())); + } + + virtual void + traverse (XMLSchema::IDREF_Base const& r) + { + if (r.get ()) dispatch (*(r.get ())); + } + }; + + + template <typename T> + struct Traverser : XSCRT::Traversal::Traverser<T, XSCRT::Type> + { + }; + + typedef Traverser<byte> byte; + typedef Traverser<unsignedByte> unsignedByte; + + typedef Traverser<short_> short_; + typedef Traverser<unsignedShort> unsignedShort; + + typedef Traverser<int_> int_; + typedef Traverser<unsignedInt> unsignedInt; + + typedef Traverser<long_> long_; + typedef Traverser<unsignedLong> unsignedLong; + + typedef Traverser<boolean> boolean; + + typedef Traverser<float_> float_; + typedef Traverser<double_> double_; + + template <typename C> + struct string : Traverser<XMLSchema::string<C> > + { + }; + + template <typename C> + struct ID : Traverser<XMLSchema::ID<C> > + { + }; + + template <typename C> + struct anyURI : Traverser <XMLSchema::anyURI<C> > + { + }; + } +} + +#include <ace/XML_Utils/XMLSchema/Traversal.ipp> + +#endif // XMLSCHEMA_TRAVERSAL_HPP diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.ipp b/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.ipp new file mode 100644 index 00000000000..8d467fa319a --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Traversal.ipp @@ -0,0 +1,10 @@ +// file : XMLSchema/Traversal.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Traversal.ipp 86462 2009-08-12 13:31:27Z wotte $ + +namespace XMLSchema +{ + namespace Traversal + { + } +} diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.hpp b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.hpp new file mode 100644 index 00000000000..7825bf67337 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.hpp @@ -0,0 +1,22 @@ +// file : XMLSchema/TypeInfo.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: TypeInfo.hpp 95802 2012-05-31 12:37:36Z johnnyw $ + +#ifndef XMLSCHEMA_TYPE_INFO_HPP +#define XMLSCHEMA_TYPE_INFO_HPP + +#include <ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp> + +namespace XMLSchema +{ + template <typename C> + struct TypeInfoInitializer + { + TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap&); + }; +} + +#include <ace/XML_Utils/XMLSchema/TypeInfo.ipp> +#include <ace/XML_Utils/XMLSchema/TypeInfo.tpp> + +#endif // XMLSCHEMA_TYPE_INFO_HPP diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.ipp b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.ipp new file mode 100644 index 00000000000..8f8487311f0 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.ipp @@ -0,0 +1,7 @@ +// file : XMLSchema/TypeInfo.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: TypeInfo.ipp 86462 2009-08-12 13:31:27Z wotte $ + +namespace XMLSchema +{ +} diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.tpp b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.tpp new file mode 100644 index 00000000000..1be4df0cf31 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/TypeInfo.tpp @@ -0,0 +1,98 @@ +// file : XMLSchema/TypeInfo.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: TypeInfo.tpp 91814 2010-09-17 08:33:40Z johnnyw $ + +namespace XMLSchema +{ + //@@ VC6 + // + template<typename T> + void + add_info (XSCRT::ExtendedTypeInfoMap& map, T*) + { + using XSCRT::TypeId; + using XSCRT::ExtendedTypeInfo; + + TypeId id (typeid (T)); + ExtendedTypeInfo info (id); + + info.add_base (ExtendedTypeInfo::Access::public_, + false, + typeid (XSCRT::Type)); + + map.insert (std::make_pair (id, info)); + } + + + template <typename C> + inline + TypeInfoInitializer<C>:: + TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap& map) + { + using XSCRT::TypeId; + using XSCRT::ExtendedTypeInfo; + + // XSCRT::Type + // + { + TypeId id (typeid (XSCRT::Type)); + map.insert (std::make_pair (id, ExtendedTypeInfo (id))); + } + + //@@ VC6 + + add_info<byte> (map, 0); + add_info<unsignedByte> (map, 0); + + add_info<short_> (map, 0); + add_info<unsignedShort> (map, 0); + + add_info<int_> (map, 0); + add_info<unsignedInt> (map, 0); + + add_info<long_> (map, 0); + add_info<unsignedLong> (map, 0); + + add_info<boolean> (map, 0); + + add_info<float_> (map, 0);; + add_info<double_> (map, 0); + + add_info<string<C> > (map, 0); + + add_info<normalizedString<C> > (map, 0); + add_info<token<C> > (map, 0); + add_info<NMTOKEN<C> > (map, 0); + add_info<Name<C> > (map, 0); + add_info<NCName<C> > (map, 0); + add_info<QName<C> > (map, 0); + + add_info<ID<C> > (map, 0); + + // IDREF_Base + // + { + TypeId id (typeid (IDREF_Base)); + ExtendedTypeInfo info (id); + + info.add_base (ExtendedTypeInfo::Access::public_, + false, + typeid (XSCRT::Type)); + + map.insert (std::make_pair (id, info)); + } + + // IDREF + // + { + TypeId id (typeid (IDREF<C>)); + ExtendedTypeInfo info (id); + + info.add_base (ExtendedTypeInfo::Access::public_, + false, + typeid (IDREF_Base)); + + map.insert (std::make_pair (id, info)); + } + } +} diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Types.hpp b/dep/acelite/ace/XML_Utils/XMLSchema/Types.hpp new file mode 100644 index 00000000000..fdbcdb43928 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Types.hpp @@ -0,0 +1,669 @@ +// file : XMLSchema/Types.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Types.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XMLSCHEMA_TYPES_HPP +#define XMLSCHEMA_TYPES_HPP + +#include <string> +#include "ace/XML_Utils/XSCRT/Elements.hpp" + +#include "ace/Basic_Types.h" +/** + * @@ HACK: VC7 + * + * Disabled the warning about using this in the base member initialization section. + * Our use in this file is fine. + */ +#ifdef _MSC_VER +# pragma warning ( disable: 4355 ) +#endif +namespace XMLSchema +{ + typedef XSCRT::FundamentalType<ACE_INT8> byte; + typedef XSCRT::FundamentalType<ACE_UINT8> unsignedByte; + + typedef XSCRT::FundamentalType<ACE_INT16> short_; + typedef XSCRT::FundamentalType<ACE_UINT16> unsignedShort; + + typedef XSCRT::FundamentalType<ACE_INT32> int_; + typedef XSCRT::FundamentalType<ACE_UINT32> unsignedInt; + + typedef XSCRT::FundamentalType<ACE_INT64> long_; + typedef XSCRT::FundamentalType<ACE_UINT64> unsignedLong; + + //@@ It would be nice to use some arbitrary-length integer class. + // + typedef long_ decimal; + typedef decimal integer; + typedef integer nonPositiveInteger; + typedef integer nonNegativeInteger; + typedef nonNegativeInteger positiveInteger; + typedef nonPositiveInteger negativeInteger; + + + typedef XSCRT::FundamentalType<bool> boolean; + + typedef XSCRT::FundamentalType<float> float_; + typedef XSCRT::FundamentalType<double> double_; + + // Just to make GCC 3.3 and other broken compilers shutup. + // + using std::basic_string; + + + template <typename C> + class string : public XSCRT::Type, public basic_string<C> + { + protected: + typedef basic_string<C> Base__ ; + + public: + // typedef ACE_Refcounted_Auto_Ptr < string, ACE_Null_Mutex > _ptr; + + //@@ VC6 does not inject XSCRT::Type into the scope so I have + // to qualify it all the time. + // + + string () + { + } + + string (XSCRT::XML::Element<C> const& e) + : Base__ (e.value ()) + { + } + + string (XSCRT::XML::Attribute<C> const& a) + : Base__ (a.value ()) + { + } + + string (Base__ const& x) + : Base__ (x) + { + } + + string (C const* x) + : Base__ (x) + { + } + + string& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class normalizedString : public string<C> + { + protected: + typedef typename string<C>::Base__ Base__; + + public: + normalizedString () + { + } + + normalizedString (XSCRT::XML::Element<C> const& e) + : string<C> (e) + { + } + + normalizedString (XSCRT::XML::Attribute<C> const& a) + : string<C> (a) + { + } + + normalizedString (Base__ const& x) + : string<C> (x) + { + } + + normalizedString (C const* x) + : string<C> (x) + { + } + + normalizedString& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class token : public normalizedString<C> + { + protected: + typedef typename normalizedString<C>::Base__ Base__; + + public: + token () + { + } + + token (XSCRT::XML::Element<C> const& e) + : normalizedString<C> (e) + { + } + + token (XSCRT::XML::Attribute<C> const& a) + : normalizedString<C> (a) + { + } + + token (Base__ const& x) + : normalizedString<C> (x) + { + } + + token (C const* x) + : normalizedString<C> (x) + { + } + + token& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class NMTOKEN : public token<C> + { + protected: + typedef typename token<C>::Base__ Base__; + + public: + NMTOKEN () + { + } + + NMTOKEN (XSCRT::XML::Element<C> const& e) + : token<C> (e) + { + } + + NMTOKEN (XSCRT::XML::Attribute<C> const& a) + : token<C> (a) + { + } + + NMTOKEN (Base__ const& x) + : token<C> (x) + { + } + + NMTOKEN (C const* x) + : token<C> (x) + { + } + + NMTOKEN& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + class Name: public token<C> + { + protected: + typedef typename token<C>::Base__ Base__; + + public: + Name() + { + } + + Name(XSCRT::XML::Element<C> const& e) + : token<C> (e) + { + } + + Name(XSCRT::XML::Attribute<C> const& a) + : token<C> (a) + { + } + + Name(Base__ const& x) + : token<C> (x) + { + } + + Name (C const* x) + : token<C> (x) + { + } + + Name& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class NCName: public Name<C> + { + protected: + typedef typename Name<C>::Base__ Base__; + + public: + NCName() + { + } + + NCName(XSCRT::XML::Element<C> const& e) + : Name<C> (e) + { + } + + NCName(XSCRT::XML::Attribute<C> const& a) + : Name<C> (a) + { + } + + NCName(Base__ const& x) + : Name<C> (x) + { + } + + NCName (C const* x) + : Name<C> (x) + { + } + + NCName& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + class QName: public Name<C> + { + protected: + typedef typename Name<C>::Base__ Base__; + + public: + QName() + { + } + + QName(XSCRT::XML::Element<C> const& e) + : Name<C> (e) + { + } + + QName(XSCRT::XML::Attribute<C> const& a) + : Name<C> (a) + { + } + + QName(Base__ const& x) + : Name<C> (x) + { + } + + QName (C const* x) + : Name<C> (x) + { + } + + QName& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + struct IdentityProvider : XSCRT::IdentityProvider + { + IdentityProvider (NCName<C> const& id) + : id_ (id) + { + } + + virtual ~IdentityProvider (void) + { + } + + virtual bool + before (XSCRT::IdentityProvider const& y) const + { + return id_ < dynamic_cast<IdentityProvider const&> (y).id_; + } + + private: + NCName<C> const& id_; + + private: + IdentityProvider (IdentityProvider const&); + + IdentityProvider& + operator= (IdentityProvider const&); + }; + + + template <typename C> + class ID : public NCName<C> + { + protected: + typedef typename NCName<C>::Base__ Base__; + + public: + ~ID() + { + unregister_id (); + } + + ID () + : id_provider_ (*this) + { + } + + ID (XSCRT::XML::Element<C> const& e) + : NCName<C> (e), id_provider_ (*this) + { + } + + ID (XSCRT::XML::Attribute<C> const& a) + : NCName<C> (a), id_provider_ (*this) + { + } + + ID (ID const& x) + : NCName<C> (x), id_provider_ (*this) + { + } + + ID (Base__ const& x) + : NCName<C> (x), id_provider_ (*this) + { + } + + ID (C const* x) + : NCName<C> (x), id_provider_ (*this) + { + } + + ID& + operator= (Base__ const& x) + { + unregister_id (); + + static_cast<NCName<C>&>(*this) = x; + + register_id (); + + return *this; + } + + ID& + operator= (ID const& x) + { + unregister_id (); + + static_cast<NCName<C>&>(*this) = static_cast<NCName<C> const&>(x); + + register_id (); + + return *this; + } + + public: + using NCName<C>::container; + + virtual void + container (XSCRT::Type* c) + { + unregister_id (); + + NCName<C>::container (c); + + register_id (); + } + + private: + using NCName<C>::empty; + using NCName<C>::root; + + void + register_id () + { + if (NCName<C>::container () != this && !empty ()) + { + //std::wcerr << "registering " << container () + // << " as '" << *this + // << "' on " << container () << std::endl; + NCName<C>::container ()->register_id (id_provider_, + NCName<C>::container ()); + } + } + + void + unregister_id () + { + if (NCName<C>::container () != this && !empty ()) + { + //std::wcerr << "un-registering " << container () + // << " as '" << *this + // << "' on " << container () << std::endl; + NCName<C>::container ()->unregister_id (id_provider_); + } + } + + private: + IdentityProvider<C> id_provider_; + }; + + struct IDREF_Base : public XSCRT::Type + { + virtual XSCRT::Type const* + get () const = 0; + + virtual XSCRT::Type* + get () = 0; + }; + + template <typename C> + class IDREF : public IDREF_Base + { + public: + typedef C CDR_Type__; + IDREF () + : id_provider_ (id_) + { + } + + IDREF (XSCRT::XML::Element<C> const& e) + : id_ (e), id_provider_ (id_) + { + } + + IDREF (XSCRT::XML::Attribute<C> const& a) + : id_ (a), id_provider_ (id_) + { + } + + IDREF (IDREF const& x) + : XMLSchema::IDREF_Base (), + id_ (x.id_), id_provider_ (id_) + { + } + + IDREF (basic_string<C> const& id) + : id_ (id), id_provider_ (id_) + { + } + + IDREF (C const* id) + : id_ (id), id_provider_ (id_) + { + } + + IDREF& + operator= (IDREF const& x) + { + id_ = x.id_; + return *this; + } + + IDREF& + operator= (basic_string<C> const& x) + { + id_ = x; + return *this; + } + + public: + NCName<C> + id () const + { + return id_; + } + + public: + XSCRT::Type const* + operator-> () const + { + return get (); + } + + XSCRT::Type* + operator-> () + { + return get (); + } + + XSCRT::Type const& + operator* () const + { + return *(get ()); + } + + XSCRT::Type& + operator* () + { + return *(get ()); + } + + virtual XSCRT::Type const* + get () const + { + if (!id_.empty () && container () != this) + { + return root ()->lookup_id (id_provider_); + } + else + { + return 0; + } + } + + virtual XSCRT::Type* + get () + { + if (!id_.empty () && container () != this) + { + return root ()->lookup_id (id_provider_); + } + else + { + return 0; + } + } + + // conversion to bool + // + typedef void (IDREF::*bool_convertable)(); + + operator bool_convertable () const + { + return get () ? &IDREF::true_ : 0; + } + + private: + void true_ () + { + } + + private: + NCName<C> id_; + IdentityProvider<C> id_provider_; + }; + + template <typename C> + class anyURI : public XSCRT::Type, public basic_string <C> + { + protected: + typedef basic_string <C> Base__ ; + + public: + // Trait for marshaling string + typedef C CDR_Type__; + + //@@ VC6 does not inject XSCRT::Type into the scope so I have + // to qualify it all the time. + // + + anyURI (void) + { + } + + anyURI (XSCRT::XML::Element<C> const& e) + : Base__ (e.value ()) + { + } + + anyURI (XSCRT::XML::Attribute<C> const& a) + : Base__ (a.value ()) + { + } + + anyURI (Base__ const& x) + : Base__ (x) + { + } + + anyURI (C const * x) + : Base__ (x) + { + } + + anyURI (const anyURI& s) + : Base__ (s) + { + + } + + anyURI & operator= (Base__ const& x) + { + static_cast <Base__ &> (*this) = x; + return *this; + } + }; +} + +#include "ace/XML_Utils/XMLSchema/Types.ipp" + +#endif // XMLSCHEMA_TYPES_HPP diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Types.ipp b/dep/acelite/ace/XML_Utils/XMLSchema/Types.ipp new file mode 100644 index 00000000000..9362a5b0066 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Types.ipp @@ -0,0 +1,8 @@ +// file : XMLSchema/Types.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Types.ipp 86462 2009-08-12 13:31:27Z wotte $ + +namespace XMLSchema +{ + +} diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Writer.hpp b/dep/acelite/ace/XML_Utils/XMLSchema/Writer.hpp new file mode 100644 index 00000000000..f54737a2846 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Writer.hpp @@ -0,0 +1,158 @@ +// file : XMLSchema/Writer.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Writer.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XMLSCHEMA_WRITER_HPP +#define XMLSCHEMA_WRITER_HPP + +#include <sstream> + +#include <ace/XML_Utils/XSCRT/Writer.hpp> + +#include <ace/XML_Utils/XMLSchema/Types.hpp> +#include <ace/XML_Utils/XMLSchema/Traversal.hpp> + +#include <iostream> + +namespace XMLSchema +{ + namespace Writer + { + template <typename T, typename C> + struct FundamentalType : Traversal::Traverser<T>, + virtual XSCRT::Writer<C> + { + FundamentalType (XSCRT::XML::Element<C>& e) + : XSCRT::Writer<C> (e) + { + } + + using XSCRT::Writer<C>::top_; + using XSCRT::Writer<C>::attr_; + + virtual void + traverse (T const& o) + { + using namespace XSCRT::XML; + + std::basic_ostringstream<C> os; + + os << o; + + if (Attribute<C>* a = attr_ ()) + { + a->value (os.str ()); + } + else + { + top_().value (os.str ()); + } + } + + protected: + virtual void + traverse (T &t) + { + Traversal::Traverser<T>::traverse (t); + } + + FundamentalType () + { + } + }; + + template<typename C> + struct FundamentalType <XSCRT::FundamentalType<bool>, C> : + Traversal::Traverser<XSCRT::FundamentalType<bool> >, + virtual XSCRT::Writer<C> + { + FundamentalType (XSCRT::XML::Element<C> &e) + : XSCRT::Writer<C> (e) + { + } + + using XSCRT::Writer<C>::top_; + using XSCRT::Writer<C>::attr_; + + virtual void + traverse (XSCRT::FundamentalType<bool> const &o) + { + using namespace XSCRT::XML; + + std::basic_ostringstream<C> os; + + if (o) + { + os << "true"; + } + else + { + os << "false"; + } + + if (Attribute<C>* a = attr_ ()) + { + a->value (os.str ()); + } + else + { + top_().value (os.str ()); + } + } + + protected: + virtual void + traverse (XSCRT::FundamentalType<bool> &t) + { + Traversal::Traverser<XSCRT::FundamentalType<bool> >::traverse (t); + } + + FundamentalType () + { + } + }; + + + template <typename C> + struct IDREF : Traversal::Traverser<XMLSchema::IDREF<C> >, + virtual XSCRT::Writer<C> + { + IDREF (XSCRT::XML::Element<C>& e) + : XSCRT::Writer<C> (e) + { + } + + virtual void + traverse ( + typename Traversal::Traverser<XMLSchema::IDREF<C> >::Type const& o) + { + using namespace XSCRT::XML; + + if (Attribute<C>* a = XSCRT::Writer<C>::attr_ ()) + { + a->value (o.id ()); + } + else + { + XSCRT::Writer<C>::top_().value (o.id ()); + } + } + + protected: + + virtual void + traverse (typename Traversal::Traverser<XMLSchema::IDREF<C> >::Type &o) + { + Traversal::Traverser<XMLSchema::IDREF<C> >::traverse (o); + } + + IDREF () + { + } + }; + } +} + +#include <ace/XML_Utils/XMLSchema/Writer.ipp> + +#endif // XMLSCHEMA_WRITER_HPP diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/Writer.ipp b/dep/acelite/ace/XML_Utils/XMLSchema/Writer.ipp new file mode 100644 index 00000000000..04019b1b1b9 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/Writer.ipp @@ -0,0 +1,10 @@ +// file : XMLSchema/Writer.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Writer.ipp 84406 2009-02-11 14:59:08Z wotte $ + +namespace XMLSchema +{ + namespace Writer + { + } +} diff --git a/dep/acelite/ace/XML_Utils/XMLSchema/id_map.hpp b/dep/acelite/ace/XML_Utils/XMLSchema/id_map.hpp new file mode 100644 index 00000000000..0356e250c48 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XMLSchema/id_map.hpp @@ -0,0 +1,144 @@ +// -*- C++ -*- +// $Id: id_map.hpp 95802 2012-05-31 12:37:36Z johnnyw $ + +//============================================================================= +/** + * @file id_map.hpp + * + * This file contains the ID_Map class which has the responsibility of linking + * XML IDREF objects to their XML ID counterparts. In the output files, this + * means that a <IDREF name>_ptr() will return a pointer to the identified + * object. + * + * Exception NULL_PTR_Entry is thrown when a program attempts to add a NULL_PTR + * to either the id_map or idref_map. + * + * Exception Unresolved_IDREF is thrown if an element in an XML document attempts + * to reference an ID that does not exist. + * + * @author Jason R. Cody <jason.r.cody@vanderbilt.edu; jason.r.cody@gmail.com> + */ +//============================================================================= + +#ifndef _ID_MAP_H +#define _ID_MAP_H + +//ID_Map makes use of the Types::idref_ data member to set it to the appropriate +//object created during parsing +#include "ace/XML_Utils/XMLSchema/Types.hpp" + +//The ID_Map is a Thread Specific Storage element. +#include "ace/TSS_T.h" +#include "ace/ace_wchar.h" + + /** + * @class ID_Map + * + * @brief A class that handles the mapping of IDREF objects to objects with the + * respective ID. + */ + class ID_Map + { + public: + + //Trait to allow for ease of thread specific storage. + typedef ACE_TSS<ID_Map> TSS_ID_Map; + typedef std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator id_iterator; + typedef std::multimap<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator idref_iterator; + typedef std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*> ID_MAP; + typedef std::multimap<std::basic_string<ACE_TCHAR>, XSCRT::Type*> IDREF_MAP; + + + //Exception Classes + //NULL_PTR_Entry thrown when a NULL PTR is added to the + //ID_Map + class NULL_PTR_Entry {}; + + //Unresolved_IDREF thrown when there are IDREF's in the + //XML document. + class Unresolved_IDREF {}; + + //Only a default constructor and destructor are needed + //Constructor + ID_Map () + { + } + + //Destructor + ~ID_Map () + { + } + + //Add an ID to the ID map + void add_id (std::basic_string<ACE_TCHAR> id, XSCRT::Type *obj_ref) + { + if (obj_ref) + { + this->id_map_.insert (ID_MAP::value_type(id, obj_ref)); + } + else + { + throw NULL_PTR_Entry(); + } + return; + } + + //Add an IDREF to the IDREF map + void add_idref (std::basic_string<ACE_TCHAR> idref, XSCRT::Type *obj_ref) + { + if (obj_ref) + { + this->idref_map_.insert (IDREF_MAP::value_type(idref, obj_ref)); + } + else + { + throw NULL_PTR_Entry(); + } + return; + } + + //Sets the referencing elements XSCRT::Type::idref_ to point to the + //referenced element. + //Note: The pointer is of type "XSCRT::Type*" + void resolve_idref ( void ) + { + //Declare iterators to navigate the maps + ID_Map::id_iterator id_iterator; + ID_Map::idref_iterator idref_iterator; + + for (idref_iterator = this->idref_map_.begin(); + idref_iterator != this->idref_map_.end(); + ++idref_iterator) + { + //Find the ID that matches the IDREF element + id_iterator = this->id_map_.find(idref_iterator->first); + if (id_iterator != this->id_map_.end()) + { + //Add the IDREF identifier and the reference to the + //identified object + std::basic_string<ACE_TCHAR> temp_id = id_iterator->first; + idref_iterator->second->set_idref(temp_id, id_iterator->second); + } + else + { + //throw Unresolved_IDREF(); + } + } + } + + void reset (void) + { + id_map_.clear (); + idref_map_.clear (); + } + + private: + //id_map_: maps the ID string to the element with the + // ID attribute + //idref_map_: multimap that maps the IDREF string to the + // element with the IDREF attribute + ID_MAP id_map_; + IDREF_MAP idref_map_; + }; + +#endif /* _ID_MAP_HPP */ diff --git a/dep/acelite/ace/XML_Utils/XML_Error_Handler.cpp b/dep/acelite/ace/XML_Utils/XML_Error_Handler.cpp new file mode 100644 index 00000000000..093a85ec942 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Error_Handler.cpp @@ -0,0 +1,77 @@ +// $Id: XML_Error_Handler.cpp 95885 2012-06-14 14:05:44Z johnnyw $ + +#include "XML_Error_Handler.h" +#include "ace/Log_Msg.h" +#include "ace/Auto_Ptr.h" +#include "ace/ACE.h" +#include <xercesc/util/XMLString.hpp> +#include <xercesc/dom/DOMLocator.hpp> +#include <xercesc/sax/SAXParseException.hpp> +#include "XercesString.h" +#include <iostream> + +using xercesc::SAXParseException; + +namespace XML +{ + XML_Error_Handler::XML_Error_Handler (void) + : errors_ (false) + { + } + + XML_Error_Handler::~XML_Error_Handler() + { + } + + void XML_Error_Handler::warning(const SAXParseException& toCatch) + { + if (ACE::debug ()) + { + XStr file (toCatch.getSystemId ()); + XStr msg (toCatch.getMessage ()); + + std::cerr << "Warning: " << file << ':' << toCatch.getLineNumber () + << ':' << toCatch.getColumnNumber () << " - " + << msg << std::endl; + } + } + + void XML_Error_Handler::error(const SAXParseException& toCatch) + { + if (ACE::debug ()) + { + XStr file (toCatch.getSystemId ()); + XStr msg (toCatch.getMessage ()); + + std::cerr << "Error: " << file << ':' << toCatch.getLineNumber () + << ':' << toCatch.getColumnNumber () << " - " + << msg << std::endl; + } + this->errors_ = true; + } + + void XML_Error_Handler::fatalError(const SAXParseException& toCatch) + { + if (ACE::debug ()) + { + XStr file (toCatch.getSystemId ()); + XStr msg (toCatch.getMessage ()); + + std::cerr << "Fatal Error: " << file << ':' << toCatch.getLineNumber () + << ':' << toCatch.getColumnNumber () << " - " + << msg << std::endl; + } + this->errors_ = true; + } + + void XML_Error_Handler::resetErrors() + { + this->errors_ = false; + } + + bool + XML_Error_Handler::getErrors (void) const + { + return this->errors_; + } +} diff --git a/dep/acelite/ace/XML_Utils/XML_Error_Handler.h b/dep/acelite/ace/XML_Utils/XML_Error_Handler.h new file mode 100644 index 00000000000..4047df6a09a --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Error_Handler.h @@ -0,0 +1,60 @@ +//============================================================== +/** + * @file XML_Error_Handler.h + * + * $Id: XML_Error_Handler.h 95801 2012-05-31 09:14:36Z johnnyw $ + * + * @brief Error handler for Xerces + * + * @author Bala Natarajan <bala@dre.vanderbilt.edu> + */ +//================================================================ +#ifndef ACE_XML_ERROR_HANDLER_H +#define ACE_XML_ERROR_HANDLER_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "XML_Utils_Export.h" + +#include <xercesc/sax/ErrorHandler.hpp> + +using xercesc::SAXParseException; + +namespace XML +{ + /** + * @class XML_Error_Hander + * + * @brief Error handler for XERCES + * + */ + class XML_Utils_Export XML_Error_Handler + : public xercesc::ErrorHandler + { + public: + + XML_Error_Handler (void); + + ~XML_Error_Handler (void); + + void warning(const SAXParseException& toCatch); + void error(const SAXParseException& toCatch); + void fatalError(const SAXParseException& toCatch); + void resetErrors(); + bool getErrors (void) const; + private : + // Disallow copying + XML_Error_Handler (const XML_Error_Handler&); + XML_Error_Handler& operator= (const XML_Error_Handler&); + + bool errors_; + }; +} + +#include /**/ "ace/post.h" + +#endif /* ACE_XML_ERROR_HANDLER_H */ diff --git a/dep/acelite/ace/XML_Utils/XML_Helper.h b/dep/acelite/ace/XML_Utils/XML_Helper.h new file mode 100644 index 00000000000..4bb0e8161f2 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Helper.h @@ -0,0 +1,99 @@ +// $Id: XML_Helper.h 95801 2012-05-31 09:14:36Z johnnyw $ +//============================================================ +/** + * @file XML_Helper.h + * + * @brief Some helper functions for XML + * + * @author Bala Natarajan <bala@dre.vanderbilt.edu> + * @author William R. Otte <wotte@dre.vanderbilt.edu> + */ +//============================================================ +#ifndef ACE_XML_HELPER_H +#define ACE_XML_HELPER_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "XML_Error_Handler.h" +#include "XML_Schema_Resolver.h" + +#include "xercesc/util/XercesDefs.hpp" +#include "xercesc/parsers/XercesDOMParser.hpp" + +#include <memory> + +namespace XERCES_CPP_NAMESPACE +{ + class DOMDocument; + class DOMWriter; + class DOMImplementation; + class DOMDocumentType; +} + +namespace XML +{ + /** + * @class XML_Helper + * + * @brief Helper class for some routine XML stuff. + */ + template <typename Resolver = XML_Schema_Resolver <>, + typename Error_Handler = XML_Error_Handler> + class XML_Helper + { + public: + // XML_Helper (void); + XML_Helper (Resolver *resolver = 0, Error_Handler *eh = 0); + + ~XML_Helper (void); + + /// Create a DOM tree + XERCES_CPP_NAMESPACE::DOMDocument * + create_dom (const ACE_TCHAR *uri) const; + + XERCES_CPP_NAMESPACE::DOMDocument * + create_dom (const ACE_TCHAR *root, + const ACE_TCHAR *ns, + XERCES_CPP_NAMESPACE::DOMDocumentType * doctype = 0) const; + + XERCES_CPP_NAMESPACE::DOMDocumentType * + create_doctype (const ACE_TCHAR *qn, + const ACE_TCHAR *pid, + const ACE_TCHAR *sid) const; + + /// Writes out a DOMDocument to an XML file + bool write_DOM (XERCES_CPP_NAMESPACE::DOMDocument *doc, + const ACE_TCHAR *file) const; + + bool is_initialized (void) const; + + /// Terminate the parser + void terminate_parser (void); + + Resolver &get_resolver (void); + + Error_Handler &get_error_handler (void); + + protected: + /// Intialize the parser + void init_parser (void); + + private: + bool initialized_; + XERCES_CPP_NAMESPACE::DOMImplementation *impl_; + mutable std::auto_ptr<XERCES_CPP_NAMESPACE::XercesDOMParser> parser_; + + Resolver *resolver_; + bool release_resolver_; + Error_Handler *e_handler_; + bool release_e_handler_; + }; +} + +#include "XML_Helper.tpp" + +#include /**/ "ace/post.h" +#endif/*ACE_XML_HELPER_H*/ diff --git a/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.cpp b/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.cpp new file mode 100644 index 00000000000..26914d99439 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.cpp @@ -0,0 +1,77 @@ +// $Id: XML_Schema_Resolver.cpp 95760 2012-05-15 13:46:19Z msmit $ +#include "XML_Schema_Resolver.h" + +#include <xercesc/util/PlatformUtils.hpp> +#include <xercesc/util/XercesDefs.hpp> + +#include "XercesString.h" + +#include "ace/Env_Value_T.h" + +#include <iostream> + +namespace XML +{ + Basic_Resolver::Basic_Resolver (const ACE_TCHAR *path) + : path_ (path) + { + } + + XMLCh * + Basic_Resolver::operator() (const XMLCh *const, + const XMLCh *const systemId) const + { + XStr path (path_); + path.append (systemId); + return path.release (); + } + + Environment_Resolver::Environment_Resolver (void) + { + } + + Environment_Resolver::Environment_Resolver (const ACE_TCHAR *variable, + const ACE_TCHAR *relpath) + { + this->add_path (variable, relpath); + } + + using xercesc::XMLPlatformUtils; + + void + Environment_Resolver::add_path (const ACE_TCHAR *variable, + const ACE_TCHAR *relpath) + { + ACE_Env_Value <const ACE_TCHAR *> path_env (variable, + ACE_TEXT("")); + + XStr xpath (path_env); + XStr xrelpath (relpath); + + xpath.append (xrelpath); + + paths_.push_back (xpath); + } + + XMLCh * + Environment_Resolver::operator() (const XMLCh *const, + const XMLCh *const systemId) const + { + for (std::vector<XStr>::const_iterator i = this->paths_.begin (); + i != this->paths_.end (); + ++i) + { + XStr path (*i); + path.append(systemId); + + FileHandle file (XMLPlatformUtils::openFile (path)); + + if (file != 0) + { + XMLPlatformUtils::closeFile (file); + return path.release (); + } + } + return 0; + } +} diff --git a/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.h b/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.h new file mode 100644 index 00000000000..174e3ea56e7 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Schema_Resolver.h @@ -0,0 +1,110 @@ +/** + * @file XML_Schema_Resolver.h + * @author Will Otte <wotte@dre.vanderbilt.edu> + * + * $Id: XML_Schema_Resolver.h 95801 2012-05-31 09:14:36Z johnnyw $ + * + * Resolves schema locations. + */ + +#ifndef ACE_XML_SCHEMA_RESOLVER_H +#define ACE_XML_SCHEMA_RESOLVER_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "XML_Utils_Export.h" +#include "XercesString.h" + +#include <xercesc/sax/EntityResolver.hpp> +#include <vector> +#include <string> + +using namespace xercesc; + +namespace XML +{ + // forward decl. + struct NoOp_Resolver; + + /** + * @class XML_Schema_Resolver + * @brief Resolves schema locations + * + * Template argument Resolver should be a functor with an operation + * const ACE_TCHAR * operator () (...arguments from resolveEntity...) + */ + template <typename Resolver = NoOp_Resolver> + class XML_Schema_Resolver + : public virtual EntityResolver + { + public: + XML_Schema_Resolver (void); + + XML_Schema_Resolver (Resolver &resolver); + + /// This function is called by the Xerces infrastructure to + /// actually resolve the location of a schema. + virtual InputSource * resolveEntity (const XMLCh *const publicId, + const XMLCh *const systemId); + + Resolver &get_resolver (void); + + private: + XML_Schema_Resolver (XML_Schema_Resolver<Resolver> &); + + Resolver resolver_; + }; + + /** + * @class NoOp_Resolver + * @brief Resolver that does nothing. + */ + struct NoOp_Resolver + { + const XMLCh* operator() (const XMLCh *const, + const XMLCh *const systemId) const + { return systemId; }; + }; + + /** + * @class Basic_Resolver + * @brief Resolves a schema location from a fixed path. + */ + struct Basic_Resolver + { + Basic_Resolver (const ACE_TCHAR *path); + + XMLCh* operator() (const XMLCh *const publicId, + const XMLCh *const systemId) const; + XStr path_; + }; + + /** + * @class Environment_Resolver + * @brief Resolves a schema location from a path from an environment variable. + */ + struct XML_Utils_Export Environment_Resolver + { + Environment_Resolver (void); + + Environment_Resolver (const ACE_TCHAR *variable, + const ACE_TCHAR *path); + + void add_path (const ACE_TCHAR *variable, + const ACE_TCHAR *path); + + XMLCh* operator() (const XMLCh *const publicId, + const XMLCh *const systemId) const; + + std::vector<XStr> paths_; + }; +} + +#include "XML_Schema_Resolver.tpp" + +#include /**/ "ace/post.h" + +#endif /* ACE_XML_SCHEMA_RESOLVER_H */ diff --git a/dep/acelite/ace/XML_Utils/XML_Typedefs.cpp b/dep/acelite/ace/XML_Utils/XML_Typedefs.cpp new file mode 100644 index 00000000000..aad41d82e80 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Typedefs.cpp @@ -0,0 +1,8 @@ +// $Id: XML_Typedefs.cpp 95760 2012-05-15 13:46:19Z msmit $ + +#include "XML_Typedefs.h" + +namespace XML +{ + XML_Typedef::HELPER XML_Typedef::XML_HELPER; +} diff --git a/dep/acelite/ace/XML_Utils/XML_Typedefs.h b/dep/acelite/ace/XML_Utils/XML_Typedefs.h new file mode 100644 index 00000000000..c41da608f76 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Typedefs.h @@ -0,0 +1,32 @@ +/** + * @file XML_Typedefs.h + * @author William R. Otte <wotte@dre.vanderbilt.edu> + * $Id: XML_Typedefs.h 95760 2012-05-15 13:46:19Z msmit $ + * Typedefs from the XML Utilities. + */ +#ifndef XML_TYPEDEFS_H +#define XML_TYPEDEFS_H + +#include "XML_Utils_Export.h" +#include "XML_Helper.h" +#include "XML_Schema_Resolver.h" +#include "XML_Error_Handler.h" + +namespace XML +{ + class XML_Utils_Export XML_Typedef + { + public: + typedef ::XML::Environment_Resolver PATH_RESOLVER; + typedef ::XML::XML_Schema_Resolver< ::XML::Environment_Resolver > XML_RESOLVER; + typedef ::XML::XML_Error_Handler ERROR_HANDLER; + typedef ::XML::XML_Helper< XML_RESOLVER, ERROR_HANDLER > HELPER; + + static ERROR_HANDLER _xml_error_handler; + + public: + static HELPER XML_HELPER; + }; +} + +#endif /* XML_TYPEDEFS_H */ diff --git a/dep/acelite/ace/XML_Utils/XML_Utils_Export.h b/dep/acelite/ace/XML_Utils/XML_Utils_Export.h new file mode 100644 index 00000000000..56ea76a248b --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XML_Utils_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: XML_Utils_Export.h 95760 2012-05-15 13:46:19Z msmit $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl XML_Utils +// ------------------------------ +#ifndef XML_UTILS_EXPORT_H +#define XML_UTILS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (XML_UTILS_HAS_DLL) +# define XML_UTILS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && XML_UTILS_HAS_DLL */ + +#if !defined (XML_UTILS_HAS_DLL) +# define XML_UTILS_HAS_DLL 1 +#endif /* ! XML_UTILS_HAS_DLL */ + +#if defined (XML_UTILS_HAS_DLL) && (XML_UTILS_HAS_DLL == 1) +# if defined (XML_UTILS_BUILD_DLL) +# define XML_Utils_Export ACE_Proper_Export_Flag +# define XML_UTILS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define XML_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* XML_UTILS_BUILD_DLL */ +# define XML_Utils_Export ACE_Proper_Import_Flag +# define XML_UTILS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define XML_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* XML_UTILS_BUILD_DLL */ +#else /* XML_UTILS_HAS_DLL == 1 */ +# define XML_Utils_Export +# define XML_UTILS_SINGLETON_DECLARATION(T) +# define XML_UTILS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* XML_UTILS_HAS_DLL == 1 */ + +// Set XML_UTILS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (XML_UTILS_NTRACE) +# if (ACE_NTRACE == 1) +# define XML_UTILS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define XML_UTILS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !XML_UTILS_NTRACE */ + +#if (XML_UTILS_NTRACE == 1) +# define XML_UTILS_TRACE(X) +#else /* (XML_UTILS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define XML_UTILS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (XML_UTILS_NTRACE == 1) */ + +#endif /* XML_UTILS_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/XML_Utils/XSCRT/Elements.hpp b/dep/acelite/ace/XML_Utils/XSCRT/Elements.hpp new file mode 100644 index 00000000000..d0afe1aaf2d --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/Elements.hpp @@ -0,0 +1,569 @@ +// file : XSCRT/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Elements.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XSCRT_ELEMENTS_HPP +#define XSCRT_ELEMENTS_HPP + +#include <map> +#include <string> +#include <sstream> +#include "ace/ace_wchar.h" +// #include <iostream> //@@ tmp + +#include <ace/XML_Utils/XSCRT/Parser.hpp> +#include "ace/Refcounted_Auto_Ptr.h" + +namespace XSCRT +{ + struct IdentityProvider + { + virtual bool + before (IdentityProvider const&) const = 0; + + virtual ~IdentityProvider (void) + { + + } + }; + + class Type + { + public: + + virtual ~Type (void) + { + } + + protected: + Type (void) + : container_ (0) + { + } + + template <typename C> + Type (XML::Element<C> const&) + : container_ (0) + { + } + + template <typename C> + Type (XML::Attribute<C> const&) + : container_ (0) + { + } + + Type (Type const&) + : container_ (0) + { + } + + Type& + operator= (Type const&) + { + //@@ I don't need this. + //if (map_.get ()) map_->clear (); // Flush the map. + return *this; + } + + public: + Type const* + container () const + { + return container_ ? container_ : this; + } + + Type* + container () + { + return container_ ? container_ : this; + } + + + Type const* + root () const + { + Type const* r = container (); + + //@@ VC6 can't handle this inside the loop. + // + Type const* c = r->container (); + + for (; c != r; c = c->container ()) r = c; + + return r; + } + + Type* + root () + { + Type* r = container (); + + for (Type* c = r->container (); c != r; c = c->container ()) r = c; + + return r; + } + + //@@ + //protected: + + public: + virtual void + container (Type* c) + { + if (container_ == c) return; + + // Revoke registrations from our old container. + // + if (container_ != 0 && map_.get ()) + { + for (Map_::iterator i (map_->begin ()); i != map_->end (); ++i) + { + //std::wcerr << "revoking " << i->second + // << " to " << container_ << std::endl; + + container_->unregister_id (*(i->first)); + } + } + + // Copy registrations to our new container. + // + if (c != 0 && map_.get ()) + { + for (Map_::iterator i (map_->begin ()); i != map_->end (); ++i) + { + //std::wcerr << "copying " << i->second + // << " to " << c << std::endl; + + c->register_id (*(i->first), i->second); + } + } + + container_ = c; + } + + //@@ + //protected: + + public: + void + register_id (IdentityProvider const& id, Type* t) + { + if (map_.get () == 0) + { + map_ = std::auto_ptr<Map_> (new Map_); + } + + if (!map_->insert ( + std::pair<IdentityProvider const*, Type*> (&id, t)).second) + { + throw 1; + } + + if (container () != this) container ()->register_id (id, t); + } + + void + unregister_id (IdentityProvider const& id) + { + if (map_.get ()) + { + Map_::iterator it (map_->find (&id)); + + if (it != map_->end ()) + { + map_->erase (it); + + if (container () != this) container ()->unregister_id (id); + + return; + } + } + + throw 1; + } + + Type* + lookup_id (IdentityProvider const& id) const + { + if (map_.get ()) + { + Map_::const_iterator it (map_->find (&id)); + + if (it != map_->end ()) + { + return it->second; + } + } + + return 0; + } + + //Get and set methods for the idref_map_ data member + Type* get_idref (const char* name) + { + std::basic_string<ACE_TCHAR> name_string (ACE_TEXT_CHAR_TO_TCHAR(name)); + std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator i = + this->idref_map_.find(name_string); + if (i != idref_map_.end()) + { + return i->second; + } + else + { + return 0; + } + } + + Type* get_idref (const wchar_t *name) + { + std::basic_string<ACE_TCHAR> name_string (ACE_TEXT_WCHAR_TO_TCHAR(name)); + std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*>::iterator i = + this->idref_map_.find(name_string); + if (i != idref_map_.end()) + { + return i->second; + } + else + { + return 0; + } + } + + + void set_idref (std::basic_string<ACE_TCHAR> name, Type* new_idref) + { + this->idref_map_.insert(std::pair<std::basic_string<ACE_TCHAR>,Type*>(name, new_idref)); + return; + } + + private: + + //Data member to handle unbounded IDREF attributes and elements + std::map<std::basic_string<ACE_TCHAR>, XSCRT::Type*> idref_map_; + + Type* container_; + + struct IdentityComparator + { + bool operator () (IdentityProvider const* x, + IdentityProvider const* y) const + { + return x->before (*y); + } + }; + + typedef + std::map<IdentityProvider const*, Type*, IdentityComparator> + Map_; + + std::auto_ptr<Map_> map_; + }; + + // Fundamental types template. + // + // + template <typename X> + class FundamentalType : public Type + { + public: + // Trait for marshaling a FundamentalType X + typedef X CDR_Type__; +#if !defined (__BORLANDC__) || (__BORLANDC__ >= 0x620) + typedef ACE_Refcounted_Auto_Ptr < FundamentalType, ACE_Null_Mutex > _ptr; +#endif /* !__BORLANDC__ */ + + FundamentalType () + { + } + + template<typename C> + FundamentalType (XML::Element<C> const& e) + { + std::basic_stringstream<C> s; + s << e.value (); + s >> x_; + } + + template<typename C> + FundamentalType (XML::Attribute<C> const& a) + { + std::basic_stringstream<C> s; + s << a.value (); + s >> x_; + } + + FundamentalType (X const& x) + : x_ (x) + { + } + + FundamentalType& + operator= (X const& x) + { + x_ = x; + return *this; + } + + public: + operator X const& () const + { + return x_; + } + + operator X& () + { + return x_; + } + + protected: + X x_; + }; + +#if !((defined (__GNUC__) && (__GNUC__ == 3 && (__GNUC_MINOR__ < 3))) || \ + (defined (__BORLANDC__) && (__BORLANDC__ < 0x620)) || \ + (defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x5100))) + + // Stuff for normal compilers. + // + + // Specialization for `signed char' + // + // + template<> + template<typename C> + inline + FundamentalType<signed char>:: + FundamentalType (XML::Element<C> const& e) + { + std::basic_stringstream<C> s; + s << e.value (); + + short t; + s >> t; + + x_ = static_cast<signed char> (t); + } + + template<> + template<typename C> + inline + FundamentalType<signed char>:: + FundamentalType (XML::Attribute<C> const& a) + { + std::basic_stringstream<C> s; + s << a.value (); + + short t; + s >> t; + + x_ = static_cast<signed char> (t); + } + + // Specialization for `unsigned char' + // + // + template<> + template<typename C> + inline + FundamentalType<unsigned char>:: + FundamentalType (XML::Element<C> const& e) + { + std::basic_stringstream<C> s; + s << e.value (); + + unsigned short t; + s >> t; + + x_ = static_cast<unsigned char> (t); + } + + template<> + template<typename C> + inline + FundamentalType<unsigned char>:: + FundamentalType (XML::Attribute<C> const& a) + { + std::basic_stringstream<C> s; + s << a.value (); + + unsigned short t; + s >> t; + + x_ = static_cast<unsigned char> (t); + } + +#else + + // Stuff for broken VC6 & gcc < 3.3. Don't like what you see - use better + // compiler! + // + + // Specialization for signed char. + // + template <> + class FundamentalType<signed char> : public Type + { + public: + FundamentalType () + { + } + + template<typename C> + FundamentalType (XML::Element<C> const& e) + { + std::basic_stringstream<C> s; + s << e.value (); + + short t; + s >> t; + + x_ = static_cast<signed char> (t); + } + + template<typename C> + FundamentalType (XML::Attribute<C> const& a) + { + std::basic_stringstream<C> s; + s << a.value (); + + short t; + s >> t; + + x_ = static_cast<signed char> (t); + } + + FundamentalType (signed char const& x) + : x_ (x) + { + } + + FundamentalType& + operator= (signed char const& x) + { + x_ = x; + return *this; + } + + public: + operator signed char const& () const + { + return x_; + } + + operator signed char& () + { + return x_; + } + + protected: + signed char x_; + }; + + // Specialization for unsigned char. + // + template <> + class FundamentalType<unsigned char> : public Type + { + public: + FundamentalType () + { + } + + template<typename C> + FundamentalType (XML::Element<C> const& e) + { + std::basic_stringstream<C> s; + s << e.value (); + + unsigned short t; + s >> t; + + x_ = static_cast<unsigned char> (t); + } + + template<typename C> + FundamentalType (XML::Attribute<C> const& a) + { + std::basic_stringstream<C> s; + s << a.value (); + + unsigned short t; + s >> t; + + x_ = static_cast<unsigned char> (t); + } + + FundamentalType (unsigned char const& x) + : x_ (x) + { + } + + FundamentalType& + operator= (unsigned char const& x) + { + x_ = x; + return *this; + } + + public: + operator unsigned char const& () const + { + return x_; + } + + operator unsigned char& () + { + return x_; + } + + protected: + unsigned char x_; + }; + +#endif + + + // Specialization for bool. + // + // + + template<> + template<> + inline + FundamentalType<bool>:: + FundamentalType (XML::Element<char> const& e) + { + x_ = (e.value () == "true") || (e.value () == "1"); + } + + template<> + template<> + inline + FundamentalType<bool>:: + FundamentalType (XML::Element<wchar_t> const& e) + { + x_ = (e.value () == L"true") || (e.value () == L"1"); + } + + template<> + template<> + inline + FundamentalType<bool>:: + FundamentalType (XML::Attribute<char> const& a) + { + x_ = (a.value () == "true") || (a.value () == "1"); + } + + template<> + template<> + inline + FundamentalType<bool>:: + FundamentalType (XML::Attribute<wchar_t> const& a) + { + x_ = (a.value () == L"true") || (a.value () == L"1"); + } + +} + +#endif // XSCRT_ELEMENTS_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp b/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp new file mode 100644 index 00000000000..89f6da81f52 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp @@ -0,0 +1,182 @@ +// file : XSCRT/ExtendedTypeInfo.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: ExtendedTypeInfo.hpp 95802 2012-05-31 12:37:36Z johnnyw $ + +#ifndef XSCRT_EXTENDED_TYPE_INFO_HPP +#define XSCRT_EXTENDED_TYPE_INFO_HPP + +#include <map> +#include <vector> +#include <typeinfo> + +namespace XSCRT +{ + // + // + // + class TypeId + { + public: + template<typename T> + TypeId (T const& t); + + TypeId (std::type_info const& tid); + + public: + bool + operator == (TypeId const& other) const; + + bool + operator != (TypeId const& other) const; + + bool + operator < (TypeId const& other) const; + + /* + friend std::ostream& + operator << (std::ostream& os, TypeId const& t); + */ + + public: + char const* + name () const + { + return tid_->name (); + } + + private: + std::type_info const* tid_; + }; + + + // + // + // + class ExtendedTypeInfo + { + public: + + // + // + // + struct Access + { + enum Value + { + private_, + protected_, + public_ + }; + }; + + + // + // + // + class BaseInfo + { + public: + BaseInfo (Access::Value access, bool virtual_base, TypeId const& tid); + + public: + ExtendedTypeInfo const& + type_info () const; + + Access::Value + access () const; + + bool + virtual_base () const; + + private: + TypeId tid_; + mutable ExtendedTypeInfo const* ti_; + bool virtual_base_; + Access::Value access_; + }; + + private: + typedef + std::vector<BaseInfo> + BaseInfoList; + + public: + typedef + BaseInfoList::const_iterator + BaseIterator; + + public: + ExtendedTypeInfo (TypeId const& tid); + + TypeId + type_id () const; + + BaseIterator + begin_base () const; + + BaseIterator + end_base () const; + + void + add_base (Access::Value access, bool virtual_base, TypeId const& tid); + + private: + TypeId tid_; + BaseInfoList base_; + }; + + typedef + std::map<TypeId, ExtendedTypeInfo> + ExtendedTypeInfoMap; + + + ExtendedTypeInfoMap& + extended_type_info_map (); + + + class NotAvailable {}; + + + template<typename T> + ExtendedTypeInfo const& + extended_type_info (T const& t) + { + return extended_type_info (typeid (t)); + } + + template<typename T> + ExtendedTypeInfo const& + extended_type_info () + { + return extended_type_info (typeid (T)); + } + + //@@ Had to use function template specialization because VC6 + // cannot handle simply overloaded functions. + // + + template <> + inline + ExtendedTypeInfo const& + extended_type_info<TypeId> (TypeId const& tid) + { + ExtendedTypeInfoMap::const_iterator i ( + extended_type_info_map ().find (tid)); + + if (i == extended_type_info_map ().end ()) throw NotAvailable (); + + return i->second; + } + + template <> + inline + ExtendedTypeInfo const& + extended_type_info<std::type_info> (std::type_info const& tid) + { + return extended_type_info (TypeId (tid)); + } +} + +#include <ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp> + +#endif // XSCRT_EXTENDED_TYPE_INFO_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp b/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp new file mode 100644 index 00000000000..5d62821347f --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/ExtendedTypeInfo.ipp @@ -0,0 +1,141 @@ +// file : XSCRT/ExtendedTypeInfo.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: ExtendedTypeInfo.ipp 86462 2009-08-12 13:31:27Z wotte $ + + +/* + * @@HACK: Visual Studio. + * I think the return value for operator== for type_info + * in VC7 (perhaps others) is int when is should be bool. + * This causes a warning about converting the return value from + * int to bool. + */ +#ifdef _MSC_VER +# pragma warning( disable: 4800 ) +#endif + +namespace XSCRT +{ + // TypeId + // + // + inline + TypeId:: + TypeId (std::type_info const& tid) + : tid_ (&tid) + { + } + + inline + bool TypeId:: + operator == (TypeId const& other) const + { + return *tid_ == *other.tid_; + } + + inline + bool TypeId:: + operator != (TypeId const& other) const + { + return *tid_ != *other.tid_; + } + + inline + bool TypeId:: + operator < (TypeId const& other) const + { + return tid_->before (*other.tid_); + } + + + // ExtendedTypeInfo::BaseInfo + // + // + + inline + ExtendedTypeInfo::BaseInfo:: + BaseInfo (Access::Value access, bool virtual_base, TypeId const& tid) + : tid_ (tid), + ti_ (0), + virtual_base_ (virtual_base), + access_ (access) + { + } + + inline + ExtendedTypeInfo const& ExtendedTypeInfo::BaseInfo:: + type_info () const + { + if (ti_ == 0) ti_ = &(extended_type_info (tid_)); + + return *ti_; + } + + + inline + ExtendedTypeInfo::Access::Value ExtendedTypeInfo::BaseInfo:: + access () const + { + return access_; + } + + inline + bool ExtendedTypeInfo::BaseInfo:: + virtual_base () const + { + return virtual_base_; + } + + + // ExtendedTypeInfo + // + // + inline + ExtendedTypeInfo:: + ExtendedTypeInfo (TypeId const& tid) + : tid_ (tid) + { + } + + inline + TypeId ExtendedTypeInfo:: + type_id () const + { + return tid_; + } + + inline + ExtendedTypeInfo::BaseIterator ExtendedTypeInfo:: + begin_base () const + { + return base_.begin (); + } + + + inline + ExtendedTypeInfo::BaseIterator ExtendedTypeInfo:: + end_base () const + { + return base_.end (); + } + + inline + void ExtendedTypeInfo:: + add_base (Access::Value access, bool virtual_base, TypeId const& tid) + { + base_.push_back (BaseInfo (access, virtual_base, tid)); + } + + // ExtendedTypeInfoMap + // + // + + inline + ExtendedTypeInfoMap& + extended_type_info_map () + { + static ExtendedTypeInfoMap extended_type_info_map_; + + return extended_type_info_map_; + } +} diff --git a/dep/acelite/ace/XML_Utils/XSCRT/Parser.hpp b/dep/acelite/ace/XML_Utils/XSCRT/Parser.hpp new file mode 100644 index 00000000000..52f7c6dcb14 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/Parser.hpp @@ -0,0 +1,64 @@ +// file : XSCRT/Parser.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Parser.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XSCRT_PARSER_HPP +#define XSCRT_PARSER_HPP + +#include <string> + +#include "ace/XML_Utils/XSCRT/XML.hpp" + +namespace XSCRT +{ + template <typename C> + class Parser + { + public: + Parser (XML::Element<C> const& e) + : e_ (e.dom_element ()->getChildNodes ()), ei_ (0), + a_ (e.dom_element ()->getAttributes ()), ai_ (0) + { + } + + bool + more_elements () const + { + return e_->getLength () > ei_; + } + + XML::Element<C> + next_element () + { + return XML::Element<C> (XML::dom_cast <xercesc::DOMElement*> (e_->item (ei_++))); + } + + bool + more_attributes () const + { + return a_->getLength () > ai_; + } + + XML::Attribute<C> + next_attribute () + { + return XML::Attribute<C> ( + XML::dom_cast <xercesc::DOMAttr*> (a_->item (ai_++))); + } + + private: + xercesc::DOMNodeList const* e_; + unsigned long ei_; + + xercesc::DOMNamedNodeMap const* a_; + unsigned long ai_; + + private: + Parser (Parser const&); + + void + operator= (Parser const&); + }; +} + +#endif // XSCRT_PARSER_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/Traversal.hpp b/dep/acelite/ace/XML_Utils/XSCRT/Traversal.hpp new file mode 100644 index 00000000000..ea04567fe7c --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/Traversal.hpp @@ -0,0 +1,265 @@ +// file : XSCRT/Traversal.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Traversal.hpp 95833 2012-06-06 14:53:45Z johnnyw $ + +#ifndef XSCRT_TRAVERSAL_HPP +#define XSCRT_TRAVERSAL_HPP + +#include <map> +#include <set> +#include <vector> + +#include "ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp" + +namespace XSCRT +{ + namespace Traversal + { + // + // + // + template<typename B> + class TraverserBase + { + protected: + virtual + ~TraverserBase (); + + //@@ VC6 + public: + virtual void + trampoline (B& n) = 0; + + virtual void + trampoline (B const& n) = 0; + }; + + + // + // + // + template <typename B> + class DispatcherBase + { + public: + virtual + ~DispatcherBase (); + + virtual void + dispatch (B& n); + + virtual void + dispatch (B const& n); + + void + map (TypeId id, TraverserBase<B>& t) + { + //wcerr << "map for " << id.name () << " to " << &t + // << " in " << &traversal_map_ << endl; + + //@@ VC6 + Traversers& traversers = traversal_map_[id]; + traversers.push_back (&t); + } + + public: + typedef + std::vector<TraverserBase<B>*> + Traversers; + + typedef + std::map<TypeId, Traversers> + TraversalMap; + + typedef + typename TraversalMap::const_iterator + Iterator; + + Iterator + begin () const + { + return traversal_map_.begin (); + } + + Iterator + end () const + { + return traversal_map_.end (); + } + + private: + struct TypeInfoComparator + { + bool + operator () (ExtendedTypeInfo const& x, + ExtendedTypeInfo const& y) const + { + return x.type_id () < y.type_id (); + } + }; + + typedef + std::map<ExtendedTypeInfo, unsigned long, TypeInfoComparator> + LevelMap; + + typedef + std::set<ExtendedTypeInfo, TypeInfoComparator> + TypeInfoSet; + + static unsigned long + compute_levels (ExtendedTypeInfo const& ti, + unsigned long cur, + LevelMap& map); + + static void + flatten_tree (ExtendedTypeInfo const& ti, TypeInfoSet& set); + + private: + TraversalMap traversal_map_; + }; + + + // + // + // + template <typename B> + class Dispatcher : public virtual DispatcherBase<B> + { + public: + Dispatcher () + : merge_ (true) + { + } + + void + traverser (DispatcherBase<B>& d) + { + for (typename DispatcherBase<B>::Iterator + i (d.begin ()), end (d.end ()); + i != end; ++i) + { + for (typename DispatcherBase<B>::Traversers::const_iterator + t (i->second.begin ()), end (i->second.end ()); + t != end; ++t) + { + dispatcher_.map (i->first, **t); + } + } + } + + public: + virtual void + dispatch (B& n) + { + merge (); + dispatcher_.dispatch (n); + } + + virtual void + dispatch (B const& n) + { + merge (); + dispatcher_.dispatch (n); + } + + using DispatcherBase<B>::begin; + using DispatcherBase<B>::end; + + private: + void + merge () + { + if (merge_) + { + for (typename DispatcherBase<B>::Iterator + i (begin ()), e (end ()); i != e; ++i) + { + for (typename DispatcherBase<B>::Traversers::const_iterator + t (i->second.begin ()), e (i->second.end ()); t != e; ++t) + { + dispatcher_.map (i->first, **t); + } + } + + merge_ = false; + } + } + + protected: + // DispatcherBase<B>& + // traverser () + // { + // return dispatcher_; + // } + + template <typename X, typename A, typename I> + void + iterate_and_dispatch (I begin, I end, X& x, void (X::*next)(A&), A& a) + { + for (; begin != end;) + { + dispatch (*begin); + + if (++begin != end) (x.*next) (a); + } + } + + private: + bool merge_; + DispatcherBase<B> dispatcher_; + }; + + + + // + // + // + template <typename T, typename B> + struct Traverser : TraverserBase<B>, virtual Dispatcher<B> + { + typedef + T + Type; + + Traverser () + { + DispatcherBase<B>::map (typeid (Type), *this); + } + + virtual void + traverse (Type&) + { + abort (); + } + + virtual void + traverse (Type const&) + { + abort (); + } + + protected: + virtual void + trampoline (B& n) + { + //wcerr << "trampoline for " << &n << " to type " + // << typeid (Type).name () << endl; + + traverse (dynamic_cast<Type&> (n)); + } + + virtual void + trampoline (B const& n) + { + //wcerr << "trampoline for " << &n << " to type " + // << typeid (Type).name () << endl; + + traverse (dynamic_cast<Type const&> (n)); + } + }; + } +} + +#include <ace/XML_Utils/XSCRT/Traversal.tpp> + +#endif // XSCRT_TRAVERSAL_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/Traversal.tpp b/dep/acelite/ace/XML_Utils/XSCRT/Traversal.tpp new file mode 100644 index 00000000000..f4e3d96fce1 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/Traversal.tpp @@ -0,0 +1,195 @@ +// file : XSCRT/Traversal.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Traversal.tpp 95833 2012-06-06 14:53:45Z johnnyw $ + +namespace XSCRT +{ + namespace Traversal + { + // TraverserBase + // + // + + template<typename B> + TraverserBase<B>:: + ~TraverserBase () + { + } + + // DispatcherBase + // + // + + template <typename B> + DispatcherBase<B>:: + ~DispatcherBase () + { + } + + //@@ merge after dropping VC6 + // + // + template <typename B> + void DispatcherBase<B>:: + dispatch (B& n) + { + LevelMap levels; + + //@@ VC6 + ExtendedTypeInfo const& ti = extended_type_info (n); + + unsigned long max = compute_levels (ti, 0, levels); + + + //wcerr << "starting dispatch process for " + // << typeid (n).name () << " with " + // << max << " levels" << endl; + + for (unsigned long l = 0; l < max + 1; ++l) + { + TypeInfoSet dispatched; + + for (typename LevelMap::const_iterator + i (levels.begin ()), e (levels.end ()); + i != e; ++i) + { + if (i->second == l) + { + typename TraversalMap::const_iterator v ( + traversal_map_.find (i->first.type_id ())); + + if (v != traversal_map_.end ()) + { + //wcerr << "dispatching traversers for " + // << typeid (n).name () << " as " + // << i->first.type_id ().name () << endl; + + //@@ VC6 + Traversers const& traversers = v->second; + for (typename Traversers::const_iterator + ti (traversers.begin ()), te (traversers.end ()); + ti != te; ++ti) + { + (*ti)->trampoline (n); + } + + flatten_tree (i->first, dispatched); + } + } + } + + // Remove traversed types from the level map. + // + //@@ VC6 + { + for (typename TypeInfoSet::const_iterator i = dispatched.begin (); + i != dispatched.end (); + ++i) + { + levels.erase (*i); + } + } + } + } + + template <typename B> + void DispatcherBase<B>:: + dispatch (B const& n) + { + LevelMap levels; + + //@@ VC6 + ExtendedTypeInfo const& ti = extended_type_info (n); + + unsigned long max = compute_levels (ti, 0, levels); + + + //wcerr << "starting dispatch process for " + // << typeid (n).name () << " with " + // << max << " levels" << endl; + + //wcerr << "using " << &traversal_map_ << " traversal map" << endl; + + for (unsigned long l = 0; l < max + 1; ++l) + { + TypeInfoSet dispatched; + + for (typename LevelMap::const_iterator + i (levels.begin ()), e (levels.end ()); + i != e; ++i) + { + if (i->second == l) + { + typename TraversalMap::const_iterator v ( + traversal_map_.find (i->first.type_id ())); + + if (v != traversal_map_.end ()) + { + //wcerr << "dispatching traversers for " + // << typeid (n).name () << " as " + // << i->first.type_id ().name () << endl; + + //@@ VC6 + Traversers const& traversers = v->second; + for (typename Traversers::const_iterator + ti (traversers.begin ()), te (traversers.end ()); + ti != te; ++ti) + { + (*ti)->trampoline (n); + } + + flatten_tree (i->first, dispatched); + } + } + } + + // Remove traversed types from the level map. + // + //@@ VC6 + { + for (typename TypeInfoSet::const_iterator i = dispatched.begin (); + i != dispatched.end (); + ++i) + { + levels.erase (*i); + } + } + } + } + + template <typename B> + unsigned long DispatcherBase<B>:: + compute_levels (ExtendedTypeInfo const& ti, + unsigned long cur, + LevelMap& map) + { + unsigned long ret = cur; + + if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur; + + for (ExtendedTypeInfo::BaseIterator i = ti.begin_base (); + i != ti.end_base (); + i++) + { + unsigned long t = compute_levels (i->type_info (), cur + 1, map); + if (t > ret) ret = t; + } + + return ret; + } + + template <typename B> + void DispatcherBase<B>:: + flatten_tree (ExtendedTypeInfo const& ti, TypeInfoSet& set) + { + set.insert (ti); + + for (ExtendedTypeInfo::BaseIterator i = ti.begin_base (); + i != ti.end_base (); + i++) + { + flatten_tree (i->type_info (), set); + } + } + } +} diff --git a/dep/acelite/ace/XML_Utils/XSCRT/Writer.hpp b/dep/acelite/ace/XML_Utils/XSCRT/Writer.hpp new file mode 100644 index 00000000000..10dd392304d --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/Writer.hpp @@ -0,0 +1,78 @@ +// file : XSCRT/Writer.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: Writer.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + +#ifndef XSCRT_WRITER_HPP +#define XSCRT_WRITER_HPP + +#include <stack> +#include <string> + +#include "ace/XML_Utils/XSCRT/XML.hpp" + +namespace XSCRT +{ + template <typename C> + class Writer + { + public: + Writer (XML::Element<C>& e) + : attr__ (0) + { + push_ (e); + } + + protected: + // This c-tor should never be called. + // + Writer () + { + abort (); + } + + public: + void + push_ (XML::Element<C> const& e) + { + stack_.push (e); + } + + void + pop_ () + { + stack_.pop (); + } + + XML::Element<C>& + top_ () + { + return stack_.top (); + } + + public: + XML::Attribute<C>* + attr_ () + { + return attr__; + } + + void + attr_ (XML::Attribute<C>* a) + { + attr__ = a; + } + + private: + std::stack<XML::Element<C> > stack_; + + XML::Attribute<C>* attr__; + + private: + Writer (Writer const&); + + void + operator= (Writer const&); + }; +} + +#endif // XSCRT_WRITER_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/XML.hpp b/dep/acelite/ace/XML_Utils/XSCRT/XML.hpp new file mode 100644 index 00000000000..24f1968ba80 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/XML.hpp @@ -0,0 +1,490 @@ +// file : XSCRT/XML.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: XML.hpp 95832 2012-06-06 13:09:50Z johnnyw $ + + +#ifndef XSCRT_XML_HPP +#define XSCRT_XML_HPP + +#include <string> + +#include <xercesc/dom/DOM.hpp> +#include <xercesc/util/XMLString.hpp> + +namespace XSCRT +{ + namespace XML + { + //@@ VC6 + // + template <typename C> + std::basic_string<C> + transcode (XMLCh const* s, C*); + + template <typename C> + XMLCh* + transcode (std::basic_string<C> const& s); + + // + // + // + class string + { + public : + template <typename C> + string (std::basic_string<C> const& s) + : s_ (XSCRT::XML::transcode<C> (s)) + { + } + + template <typename C> + string (C const* s) + : s_ (XSCRT::XML::transcode<C> (s)) + { + } + + ~string () + { + delete[] s_; + } + + XMLCh const* + c_str () const + { + return s_; + } + + private : + XMLCh* s_; + }; + + + template <> + inline + std::basic_string<char> + transcode<char> (XMLCh const* s, char*) + { + if (s == 0) return std::basic_string<char> (); + + char* buf = xercesc::XMLString::transcode (s); + + std::basic_string<char> r (buf); + + xercesc::XMLString::release (&buf); + + return r; + } + + template <> + inline + std::basic_string<wchar_t> + transcode<wchar_t> (XMLCh const* s, wchar_t*) + { + if (s == 0) return std::basic_string<wchar_t> (); + + // std::wcerr << s << std::endl; + + std::basic_string<wchar_t> r (xercesc::XMLString::stringLen (s), L'0'); + + for (std::size_t i (0); *s != XMLCh (0); ++s, ++i) + { + r[i] = *s; + } + + return r; + } + + template <> + inline + XMLCh* + transcode (std::basic_string<char> const& s) + { + return xercesc::XMLString::transcode (s.c_str ()); + } + + template <> + inline + XMLCh* + transcode (std::basic_string<wchar_t> const& s) + { + //@@ VC6 + std::size_t l = s.length (); + + //@@ VC6 + XMLCh* r = new XMLCh[l + 1]; + XMLCh* ir = r; + + for (std::size_t i (0); i < l; ++ir, ++i) + { + *ir = static_cast<XMLCh>(s[i]); + //std::wcerr << s[i] << "->" << *ir << std::endl; + } + + *ir = XMLCh (0); + + // std::wcerr << r << std::endl; + + return r; + } + + + template <typename C> + class Element; + + template <typename C> + std::basic_string<C> + ns_prefix (std::basic_string<C> const& ns, Element<C> const& e); + + // Casting helpers, made necessary by the Xerces project's braindead + // avoidance of RTTI. + template <typename DERIVED> struct dom_traits; + + // Specializations for different node types + template <> + struct dom_traits<xercesc::DOMElement *> + { + static const xercesc::DOMNode::NodeType node_type = xercesc::DOMNode::ELEMENT_NODE; + }; + + template <> + struct dom_traits<xercesc::DOMAttr *> + { + static const xercesc::DOMNode::NodeType node_type = xercesc::DOMNode::ATTRIBUTE_NODE; + }; + + template <typename DERIVED_PTR> + DERIVED_PTR dom_cast (xercesc::DOMNode *node) + { + DERIVED_PTR elem = 0; + if ((node != 0) && + (node->getNodeType () == dom_traits<DERIVED_PTR>::node_type)) + { + elem = reinterpret_cast <DERIVED_PTR> (node); + } + return elem; + } + + template <typename C> + class Element + { + typedef std::basic_string<C> string_; + + public: + Element (xercesc::DOMElement const* e) + : e_ (0), + ce_ (e), + name_ (transcode<C> (e->getLocalName (), 0)), + namespace__ (transcode<C> (e->getNamespaceURI (), 0)) + { + } + + Element (xercesc::DOMElement* e) + : e_ (e), + ce_ (e), + name_ (transcode<C> (e->getLocalName (), 0)), + namespace__ (transcode<C> (e->getNamespaceURI (), 0)) + { + } + + Element (string_ const& name, Element& parent) + : e_ (0), + ce_ (0), + name_ (name) + { + xercesc::DOMDocument* doc ( + parent.dom_element ()->getOwnerDocument ()); + + e_ = doc->createElement (string (name).c_str ()); + + parent.dom_element ()->appendChild (e_); + + ce_ = e_; + } + + Element (string_ const& name, string_ const& ns, Element& parent) + : e_ (0), + ce_ (0), + name_ (name), + namespace__ (ns) + { + string_ prefix (ns_prefix (ns, parent)); + + xercesc::DOMDocument* doc ( + parent.dom_element ()->getOwnerDocument ()); + + e_ = doc->createElementNS ( + string (ns).c_str (), + string (prefix.empty () + ? name + : prefix + string_ (1, ':') + name).c_str ()); + + parent.dom_element ()->appendChild (e_); + + ce_ = e_; + } + + public: + string_ + name () const + { + return name_; + } + + string_ + namespace_ () const + { + return namespace__; + } + + public: + Element<C> + parent () const + { + return dom_cast <xercesc::DOMElement const*>(ce_->getParentNode ()); + } + + public: + string_ + value () const + { + return XML::transcode<C> (dom_element ()->getTextContent (), 0); + } + + void + value (string_ const& v) + { + xercesc::DOMText* text ( + dom_element ()->getOwnerDocument ()->createTextNode( + string (v).c_str ())); + + dom_element ()->appendChild (text); + } + + public: + string_ + operator[] (string_ const& s) const + { + //@@ VC6 + XMLCh const* value = ce_->getAttribute (string (s).c_str ()); + + return transcode<C> (value, 0); + } + + public: + xercesc::DOMElement const* + dom_element () const + { + return ce_; + } + + xercesc::DOMElement* + dom_element () + { + return e_; + } + + private: + xercesc::DOMElement* e_; + xercesc::DOMElement const* ce_; + + string_ name_; + string_ namespace__; + }; + + + template <typename C> + class Attribute + { + typedef std::basic_string<C> string_; + + public: + Attribute (xercesc::DOMAttr const* a) + : a_ (0), + ca_ (a), + name_ (transcode<C> (a->getLocalName (), 0)), + value_ (transcode<C> (a->getValue (), 0)) + { + } + + Attribute (xercesc::DOMAttr* a) + : a_ (a), + ca_ (a), + name_ (transcode<C> (a->getLocalName (), 0)), + value_ (transcode<C> (a->getValue (), 0)) + { + } + + Attribute (string_ const& name, + string_ const& v, + Element<C>& parent) + : a_ (0), + ca_ (0), + name_ (name), + value_ () + { + xercesc::DOMDocument* doc ( + parent.dom_element ()->getOwnerDocument ()); + + a_ = doc->createAttribute (string (name).c_str ()); + + value (v); + + parent.dom_element ()->setAttributeNode (a_); + + ca_ = a_; + } + + Attribute (string_ const& name, + string_ const& ns, + string_ const& v, + Element<C>& parent) + : a_ (0), + ca_ (0), + name_ (name), + value_ () + { + string_ prefix (ns_prefix (ns, parent)); + + xercesc::DOMDocument* doc ( + parent.dom_element ()->getOwnerDocument ()); + + a_ = doc->createAttributeNS ( + string (ns).c_str (), + string (prefix.empty () + ? name + : prefix + string_ (1, ':') + name).c_str ()); + + value (v); + + parent.dom_element ()->setAttributeNodeNS (a_); + + ca_ = a_; + } + + string_ + name () const + { + return name_; + } + + string_ + value () const + { + return value_; + } + + void + value (string_ const& v) + { + value_ = v; + a_->setValue (string (v).c_str ()); + } + + public: + xercesc::DOMAttr const* + dom_attribute () const + { + return ca_; + } + + xercesc::DOMAttr* + dom_attribute () + { + return a_; + } + + private: + + private: + xercesc::DOMAttr* a_; + xercesc::DOMAttr const* ca_; + + string_ name_; + string_ value_; + }; + + template <typename C> + std::basic_string<C> + prefix (std::basic_string<C> const& n) + { + std::size_t i (0); + while (i < n.length () && n[i] != ':') ++i; + + //std::wcerr << "prefix " << n << " " + // << std::wstring (n, i == n.length () ? i : 0, i) << std::endl; + + return std::basic_string<C> (n, i == n.length () ? i : 0, i); + } + + template <typename C> + std::basic_string<C> + uq_name (std::basic_string<C> const& n) + { + std::size_t i (0); + while (i < n.length () && n[i] != ':') ++i; + + return std::basic_string<C> (n.c_str () + (i == n.length () ? 0 : i + 1)); + } + + template <typename C> + std::basic_string<C> + ns_name (Element<C> const& e, std::basic_string<C> const& n) + { + std::basic_string<C> wp (prefix (n)); + + //@@ VC6 + XMLCh const* xns = e.dom_element ()->lookupNamespaceURI ( + wp.empty () ? 0 : string (wp).c_str ()); + + + std::basic_string<C> ns ( + xns ? transcode<C> (xns, 0) : std::basic_string<C> ()); + + return ns; + + } + + template <typename C> + std::basic_string<C> + fq_name (Element<C> const& e, std::basic_string<C> const& n) + { + std::basic_string<C> ns (ns_name (e, n)); + std::basic_string<C> un (uq_name (n)); + + return ns.empty () ? un : (ns + C ('#') + un); + } + + class no_prefix {}; + + template <typename C> + std::basic_string<C> + ns_prefix (std::basic_string<C> const& ns, Element<C> const& e) + { + string xns (ns); + +#if defined(XERCES_VERSION_MAJOR) && XERCES_VERSION_MAJOR > 2 + XMLCh const* p (e.dom_element ()->lookupPrefix (xns.c_str ())); +#else + XMLCh const* p (e.dom_element ()->lookupNamespacePrefix (xns.c_str (), false)); +#endif + + if (p == 0) + { + bool r (e.dom_element ()->isDefaultNamespace (xns.c_str ())); + + if (r) + { + return std::basic_string<C> (); + } + else + { + throw no_prefix (); + } + } + + return transcode<C> (p, 0); + } + } +} + +#endif // XSCRT_XML_HPP diff --git a/dep/acelite/ace/XML_Utils/XSCRT/XMLSchema.hpp b/dep/acelite/ace/XML_Utils/XSCRT/XMLSchema.hpp new file mode 100644 index 00000000000..f975238f363 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XSCRT/XMLSchema.hpp @@ -0,0 +1,588 @@ +// file : XSCRT/XMLSchema.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id: XMLSchema.hpp 95802 2012-05-31 12:37:36Z johnnyw $ + +#ifndef XSCRT_XMLSCHEMA_HPP +#define XSCRT_XMLSCHEMA_HPP + +#include <string> +// #include <iostream> //@@ tmp + +#include "ace/XML_Utils/XMLSchema/XSCRT/Elements.hpp" + +namespace XMLSchema +{ + typedef XSCRT::FundamentalType<signed char> byte; + typedef XSCRT::FundamentalType<unsigned char> unsignedByte; + + typedef XSCRT::FundamentalType<short> short_; + typedef XSCRT::FundamentalType<unsigned short> unsignedShort; + + typedef XSCRT::FundamentalType<int> int_; + typedef XSCRT::FundamentalType<unsigned int> unsignedInt; + + typedef XSCRT::FundamentalType<long long> long_; + typedef XSCRT::FundamentalType<unsigned long long> unsignedLong; + + //@@ It would be nice to use some arbitrary-length integer class. + // + typedef long_ decimal; + typedef decimal integer; + typedef integer nonPositiveInteger; + typedef integer nonNegativeInteger; + typedef nonNegativeInteger positiveInteger; + typedef nonPositiveInteger negativeInteger; + + + typedef XSCRT::FundamentalType<bool> boolean; + + typedef XSCRT::FundamentalType<float> float_; + typedef XSCRT::FundamentalType<double> double_; + + // Just to make GCC 3.3 and other broken compilers shutup. + // + using std::basic_string; + + + template <typename C> + class string : public XSCRT::Type, public basic_string<C> + { + protected: + typedef basic_string<C> Base__ ; + + public: + + //@@ VC6 does not inject XSCRT::Type into the scope so I have + // to qualify it all the time. + // + + string () + { + } + + string (XSCRT::XML::Element<C> const& e) + : Base__ (e.value ()) + { + } + + string (XSCRT::XML::Attribute<C> const& a) + : Base__ (a.value ()) + { + } + + string (Base__ const& x) + : Base__ (x) + { + } + + string& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class normalizedString : public string<C> + { + protected: + typedef typename string<C>::Base__ Base__; + + public: + normalizedString () + { + } + + normalizedString (XSCRT::XML::Element<C> const& e) + : string<C> (e) + { + } + + normalizedString (XSCRT::XML::Attribute<C> const& a) + : string<C> (a) + { + } + + normalizedString (Base__ const& x) + : string<C> (x) + { + } + + normalizedString& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class token : public normalizedString<C> + { + protected: + typedef typename normalizedString<C>::Base__ Base__; + + public: + token () + { + } + + token (XSCRT::XML::Element<C> const& e) + : normalizedString<C> (e) + { + } + + token (XSCRT::XML::Attribute<C> const& a) + : normalizedString<C> (a) + { + } + + token (Base__ const& x) + : normalizedString<C> (x) + { + } + + token& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class NMTOKEN : public token<C> + { + protected: + typedef typename token<C>::Base__ Base__; + + public: + NMTOKEN () + { + } + + NMTOKEN (XSCRT::XML::Element<C> const& e) + : token<C> (e) + { + } + + NMTOKEN (XSCRT::XML::Attribute<C> const& a) + : token<C> (a) + { + } + + NMTOKEN (Base__ const& x) + : token<C> (x) + { + } + + NMTOKEN& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + class Name: public token<C> + { + protected: + typedef typename token<C>::Base__ Base__; + + public: + Name() + { + } + + Name(XSCRT::XML::Element<C> const& e) + : token<C> (e) + { + } + + Name(XSCRT::XML::Attribute<C> const& a) + : token<C> (a) + { + } + + Name(Base__ const& x) + : token<C> (x) + { + } + + Name& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + + template <typename C> + class NCName: public Name<C> + { + protected: + typedef typename Name<C>::Base__ Base__; + + public: + NCName() + { + } + + NCName(XSCRT::XML::Element<C> const& e) + : Name<C> (e) + { + } + + NCName(XSCRT::XML::Attribute<C> const& a) + : Name<C> (a) + { + } + + NCName(Base__ const& x) + : Name<C> (x) + { + } + + NCName& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + class QName: public Name<C> + { + protected: + typedef typename Name<C>::Base__ Base__; + + public: + QName() + { + } + + QName(XSCRT::XML::Element<C> const& e) + : Name<C> (e) + { + } + + QName(XSCRT::XML::Attribute<C> const& a) + : Name<C> (a) + { + } + + QName(Base__ const& x) + : Name<C> (x) + { + } + + QName& + operator= (Base__ const& x) + { + static_cast<Base__&> (*this) = x; + return *this; + } + }; + + template <typename C> + struct IdentityProvider : XSCRT::IdentityProvider + { + IdentityProvider (NCName<C> const& id) + : id_ (id) + { + } + + virtual bool + before (XSCRT::IdentityProvider const& y) const + { + return id_ < dynamic_cast<IdentityProvider const&> (y).id_; + } + + private: + NCName<C> const& id_; + + private: + IdentityProvider (IdentityProvider const&); + + IdentityProvider& + operator= (IdentityProvider const&); + }; + + + template <typename C> + class ID : public NCName<C> + { + protected: + typedef typename NCName<C>::Base__ Base__; + + public: + ~ID() + { + unregister_id (); + } + + ID () + : id_provider_ (*this) + { + } + + ID (XSCRT::XML::Element<C> const& e) + : NCName<C> (e), id_provider_ (*this) + { + } + + ID (XSCRT::XML::Attribute<C> const& a) + : NCName<C> (a), id_provider_ (*this) + { + } + + ID (ID const& x) + : NCName<C> (x), id_provider_ (*this) + { + } + + ID (Base__ const& x) + : NCName<C> (x), id_provider_ (*this) + { + } + + ID& + operator= (Base__ const& x) + { + unregister_id (); + + static_cast<NCName<C>&>(*this) = x; + + register_id (); + + return *this; + } + + ID& + operator= (ID const& x) + { + unregister_id (); + + static_cast<NCName<C>&>(*this) = static_cast<NCName<C> const&>(x); + + register_id (); + + return *this; + } + + public: + using NCName<C>::container; + + virtual void + container (XSCRT::Type* c) + { + unregister_id (); + + NCName<C>::container (c); + + register_id (); + } + + private: + using NCName<C>::empty; + using NCName<C>::root; + + void + register_id () + { + if (container () != this && !empty ()) + { + //std::wcerr << "registering " << container () + // << " as '" << *this + // << "' on " << container () << std::endl; + container ()->register_id (id_provider_, container ()); + } + } + + void + unregister_id () + { + if (container () != this && !empty ()) + { + //std::wcerr << "un-registering " << container () + // << " as '" << *this + // << "' on " << container () << std::endl; + container ()->unregister_id (id_provider_); + } + } + + private: + IdentityProvider<C> id_provider_; + }; + + struct IDREF_Base : public XSCRT::Type + { + virtual XSCRT::Type* + get () const = 0; + }; + + template <typename C> + class IDREF : public IDREF_Base + { + public: + IDREF () + : id_provider_ (id_) + { + } + + IDREF (XSCRT::XML::Element<C> const& e) + : id_ (e), id_provider_ (id_) + { + } + + IDREF (XSCRT::XML::Attribute<C> const& a) + : id_ (a), id_provider_ (id_) + { + } + + IDREF (IDREF const& x) + : id_ (x.id_), id_provider_ (id_) + { + } + + IDREF (basic_string<C> const& id) + : id_ (id), id_provider_ (id_) + { + } + + IDREF& + operator= (IDREF const& x) + { + id_ = x.id_; + return *this; + } + + IDREF& + operator= (basic_string<C> const& x) + { + id_ = x; + return *this; + } + + public: + XSCRT::Type* + operator-> () const + { + return get (); + } + + XSCRT::Type& + operator* () const + { + return *(get ()); + } + + virtual XSCRT::Type* + get () const + { + if (!id_.empty () && container () != this) + { + return root ()->lookup_id (id_provider_); + } + else + { + return 0; + } + } + + // conversion to bool + // + typedef XSCRT::Type* (IDREF::*bool_convertable)() const; + + operator bool_convertable () const + { + return get () ? &IDREF::operator-> : 0; + } + + private: + NCName<C> id_; + IdentityProvider<C> id_provider_; + }; +} + +// Traversal +// +// + +#include "ace/XML_Utils/XSCRT/Traversal.hpp" + +namespace XMLSchema +{ + namespace Traversal + { + template <typename T> + struct Traverser : XSCRT::Traversal::Traverser<T, XSCRT::Type>, + XSCRT::Traversal::Traverser<IDREF_Base, XSCRT::Type> + { + typedef + T + Type; + + virtual void + traverse (XMLSchema::IDREF_Base& r) + { + if (r.get ()) dispatch (*(r.get ())); + } + }; + + typedef Traverser<byte> byte; + typedef Traverser<unsignedByte> unsignedByte; + + typedef Traverser<short_> short_; + typedef Traverser<unsignedShort> unsignedShort; + + typedef Traverser<int_> int_; + typedef Traverser<unsignedInt> unsignedInt; + + typedef Traverser<long_> long_; + typedef Traverser<unsignedLong> unsignedLong; + + typedef Traverser<boolean> boolean; + + typedef Traverser<float_> float_; + typedef Traverser<double_> double_; + + template <typename C> + struct string : Traverser<XMLSchema::string<C> > + { + }; + + template <typename C> + struct ID : Traverser<XMLSchema::ID<C> > + { + }; + } +} + + +// ExtendedTypeInfo for XML Schema types +// +// + +#include "ace/XML_Utils/XSCRT/ExtendedTypeInfo.hpp" + +namespace XMLSchema +{ + template <typename C> + struct TypeInfoInitializer + { + TypeInfoInitializer (XSCRT::ExtendedTypeInfoMap&); + }; +} + +#include "ace/XML_Utils/XSCRT/XMLSchema.ipp" +#include "ace/XML_Utils/XSCRT/XMLSchema.tpp" + +#endif // XSCRT_XMLSCHEMA_HPP diff --git a/dep/acelite/ace/XML_Utils/XercesString.cpp b/dep/acelite/ace/XML_Utils/XercesString.cpp new file mode 100644 index 00000000000..41cfa49d988 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XercesString.cpp @@ -0,0 +1,167 @@ +// $Id: XercesString.cpp 95760 2012-05-15 13:46:19Z msmit $ + +#include <ostream> +#include <algorithm> + +#include "XercesString.h" +#include "xercesc/util/PlatformUtils.hpp" + +using xercesc::XMLString; +using xercesc::XMLPlatformUtils; + +namespace XML +{ +// On unicode windows, ACE_TCHAR == XMLCh +#if !defined (_MSC_VER) || !defined (ACE_USES_WCHAR) + XStr::XStr (const ACE_TCHAR* str) + : _wstr(0) + { + _wstr = XMLString::transcode(ACE_TEXT_ALWAYS_CHAR (str)); + } +#endif + + XStr::XStr (XMLCh *wstr) + : _wstr(wstr) + { + + } + + XStr::XStr (const XMLCh* wstr) + : _wstr(0) + { + _wstr = XMLString::replicate(wstr); + } + + XStr::XStr (const XStr &right) + : _wstr(0) + { + _wstr = XMLString::replicate(right._wstr); + } + + XStr& XStr::operator= (const XStr& rhs) + { + if (&rhs == this) + return *this; + XStr temp (rhs); + std::swap (this->_wstr, temp._wstr); + return *this; + } + + XStr::~XStr () + { + this->reset (); + } + + const XMLCh* XStr::begin () const + { + return _wstr; + } + + const XMLCh* XStr::end () const + { + return _wstr + size(); + } + + bool XStr::append(const XMLCh *tail) + { + int iTailLen = XMLString::stringLen(tail); + int iWorkLen = XMLString::stringLen(_wstr); + + XMLSize_t bytes = (iWorkLen + iTailLen + 1) * sizeof (XMLCh); + void *tmp = XMLPlatformUtils::fgMemoryManager->allocate (bytes); + XMLCh *result = reinterpret_cast<XMLCh *> (tmp); + + bool bOK = result != 0; + if (bOK) + { + XMLCh *target = result; + XMLString::moveChars(target, _wstr, iWorkLen); + target += iWorkLen; + XMLString::moveChars(target, tail, iTailLen); + target += iTailLen; + *target++ = 0; + XMLString::release(&_wstr); + _wstr = result; + } + return bOK; + } + + bool XStr::erase(const XMLCh *head, const XMLCh *tail) + { + bool bOK = head <= tail && head >= begin() && tail <= end(); + if (bOK) + { + XMLSize_t bytes = (size() - (tail - head) + 1 ) * sizeof (XMLCh); + void *tmp = XMLPlatformUtils::fgMemoryManager->allocate (bytes); + XMLCh *result = reinterpret_cast<XMLCh *> (tmp); + + XMLCh *target = result; + bOK = target != 0; + if (bOK) + { + const XMLCh *cursor = begin(); + + while (cursor != head) *target++ = *cursor++; + cursor = tail; + while ( cursor != end() ) *target++ = *cursor++; + *target ++ = 0; + XMLString::release(&_wstr); + _wstr = result; + } + } + return bOK; + } + + int XStr::size () const + { + return XMLString::stringLen(_wstr); + } + + XMLCh XStr::operator [] (const int i) + { + return _wstr[i]; + } + + XMLCh XStr::operator [] (const int i) const + { + return _wstr[i]; + } + + XMLCh * XStr::release (void) + { + XMLCh* tmp = _wstr; + this->_wstr = 0; + return tmp; + } + + void + XStr::reset (void) + { + if (_wstr) + XMLString::release(&_wstr); + _wstr = 0; + } + + bool operator== (const XStr& lhs, const XStr& rhs) + { + return XMLString::compareIString (lhs,rhs) == 0; + } + + bool operator!= (const XStr& lhs, const XStr& rhs) + { + return !operator==(lhs, rhs); + } + + + std::ostream& + operator<< (std::ostream& o, XStr const& str) + { + char* s = XMLString::transcode (str); + + o << s; + + XMLString::release (&s); // idiots? + return o; + } + +} diff --git a/dep/acelite/ace/XML_Utils/XercesString.h b/dep/acelite/ace/XML_Utils/XercesString.h new file mode 100644 index 00000000000..7073184a491 --- /dev/null +++ b/dep/acelite/ace/XML_Utils/XercesString.h @@ -0,0 +1,82 @@ +// $Id: XercesString.h 95760 2012-05-15 13:46:19Z msmit $ + +#ifndef _XERCESSTRING_H +#define _XERCESSTRING_H + +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include <iosfwd> + +#ifdef __BORLANDC__ +using std::memcpy; +#endif + +#include <xercesc/util/XMLString.hpp> + +// Utility class that provides a std::string like facade to XMLString. +// Doesn't implement all of the methods of std::string. +#include "XML_Utils_Export.h" + +namespace XML +{ + class XML_Utils_Export XStr + { + public: + XStr() : _wstr(0L) { }; + +// On unicode windows, ACE_TCHAR == XMLCh +#if !defined (_MSC_VER) || !defined (ACE_USES_WCHAR) + XStr (const ACE_TCHAR* str); +#endif + + XStr (XMLCh* wstr); + + XStr (const XMLCh* wstr); + + XStr (const XStr& copy); + + XStr& operator= (const XStr& rhs); + + ~XStr(); + + const XMLCh* begin() const; + + const XMLCh* end() const; + + bool append(const XMLCh* tail); + + bool erase (const XMLCh* head, const XMLCh* tail); + + int size() const; + + XMLCh operator [] (const int i); + + XMLCh operator [] (const int i) const; + + operator const XMLCh* () const { return _wstr; }; + + XMLCh * release (void); + + /// Release the held string and free its memory. + void reset (void); + private: + + XMLCh* _wstr; // Internal representation + + }; + + XML_Utils_Export bool operator== (const XStr& lhs, const XStr& rhs); + XML_Utils_Export bool operator!= (const XStr& lhs, const XStr& rhs); + + XML_Utils_Export std::ostream& + operator<< (std::ostream& o, XStr const& str); + +} + +#include /**/ "ace/post.h" + +#endif /* _XERCESSTRING_H */ diff --git a/dep/acelite/ace/XtReactor/ACE_XtReactor_export.h b/dep/acelite/ace/XtReactor/ACE_XtReactor_export.h new file mode 100644 index 00000000000..323355be750 --- /dev/null +++ b/dep/acelite/ace/XtReactor/ACE_XtReactor_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id: ACE_XtReactor_export.h 80826 2008-03-04 14:51:23Z wotte $ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -s ACE_XtReactor +// ------------------------------ +#ifndef ACE_XTREACTOR_EXPORT_H +#define ACE_XTREACTOR_EXPORT_H + +#include /**/ "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_XTREACTOR_HAS_DLL) +# define ACE_XTREACTOR_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && ACE_XTREACTOR_HAS_DLL */ + +#if !defined (ACE_XTREACTOR_HAS_DLL) +# define ACE_XTREACTOR_HAS_DLL 1 +#endif /* ! ACE_XTREACTOR_HAS_DLL */ + +#if defined (ACE_XTREACTOR_HAS_DLL) && (ACE_XTREACTOR_HAS_DLL == 1) +# if defined (ACE_XTREACTOR_BUILD_DLL) +# define ACE_XtReactor_Export ACE_Proper_Export_Flag +# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* ACE_XTREACTOR_BUILD_DLL */ +# define ACE_XtReactor_Export ACE_Proper_Import_Flag +# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* ACE_XTREACTOR_BUILD_DLL */ +#else /* ACE_XTREACTOR_HAS_DLL == 1 */ +# define ACE_XtReactor_Export +# define ACE_XTREACTOR_SINGLETON_DECLARATION(T) +# define ACE_XTREACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* ACE_XTREACTOR_HAS_DLL == 1 */ + +// Set ACE_XTREACTOR_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (ACE_XTREACTOR_NTRACE) +# if (ACE_NTRACE == 1) +# define ACE_XTREACTOR_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define ACE_XTREACTOR_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !ACE_XTREACTOR_NTRACE */ + +#if (ACE_XTREACTOR_NTRACE == 1) +# define ACE_XTREACTOR_TRACE(X) +#else /* (ACE_XTREACTOR_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define ACE_XTREACTOR_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (ACE_XTREACTOR_NTRACE == 1) */ + +#endif /* ACE_XTREACTOR_EXPORT_H */ + +// End of auto generated file. diff --git a/dep/acelite/ace/XtReactor/XtReactor.cpp b/dep/acelite/ace/XtReactor/XtReactor.cpp new file mode 100644 index 00000000000..1233a304d58 --- /dev/null +++ b/dep/acelite/ace/XtReactor/XtReactor.cpp @@ -0,0 +1,468 @@ +// $Id: XtReactor.cpp 95528 2012-02-07 12:57:33Z johnnyw $ + +#include "ace/XtReactor/XtReactor.h" + +#include "ace/SOCK_Acceptor.h" +#include "ace/SOCK_Connector.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE (ACE_XtReactor) + +// Must be called with lock held +ACE_XtReactor::ACE_XtReactor (XtAppContext context, + size_t size, + bool restart, + ACE_Sig_Handler *h) + : ACE_Select_Reactor (size, restart, h), + context_ (context), + ids_ (0), + timeout_ (0) +{ + // When the ACE_Select_Reactor is constructed it creates the notify + // pipe and registers it with the register_handler_i() method. The + // XtReactor overloads this method BUT because the + // register_handler_i occurs when constructing the base class + // ACE_Select_Reactor, the ACE_Select_Reactor register_handler_i() + // is called not the XtReactor register_handler_i(). This means + // that the notify pipe is registered with the ACE_Select_Reactor + // event handling code not the XtReactor and so notfications don't + // work. To get around this we simply close and re-opened the + // notification handler in the constructor of the XtReactor. + +#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + this->notify_handler_->close (); + this->notify_handler_->open (this, 0); +#endif /* ACE_MT_SAFE */ +} + +ACE_XtReactor::~ACE_XtReactor (void) +{ + // Delete the remaining items in the linked list. + + while (this->ids_) + { + ACE_XtReactorID *XtID = this->ids_->next_; + delete this->ids_; + this->ids_ = XtID; + } +} + +// This is just the <wait_for_multiple_events> from ace/Reactor.cpp +// but we use the Xt functions to wait for an event, not <select> + +int +ACE_XtReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) +{ + ACE_TRACE ("ACE_XtReactor::wait_for_multiple_events"); + int nfound; + + do + { + max_wait_time = this->timer_queue_->calculate_timeout (max_wait_time); + + size_t width = this->handler_rep_.max_handlep1 (); + handle_set.rd_mask_ = this->wait_set_.rd_mask_; + handle_set.wr_mask_ = this->wait_set_.wr_mask_; + handle_set.ex_mask_ = this->wait_set_.ex_mask_; + nfound = XtWaitForMultipleEvents (width, + handle_set, + max_wait_time); + + } while (nfound == -1 && this->handle_error () > 0); + + if (nfound > 0) + { +#if !defined (ACE_WIN32) + handle_set.rd_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.wr_mask_.sync (this->handler_rep_.max_handlep1 ()); + handle_set.ex_mask_.sync (this->handler_rep_.max_handlep1 ()); +#endif /* ACE_WIN32 */ + } + return nfound; // Timed out or input available +} + +void +ACE_XtReactor::TimerCallbackProc (XtPointer closure, XtIntervalId * /* id */) +{ + ACE_XtReactor *self = (ACE_XtReactor *) closure; + self->timeout_ = 0; + + // Deal with any timer events + ACE_Select_Reactor_Handle_Set handle_set; + self->dispatch (0, handle_set); + self->reset_timeout (); +} + +// This could be made shorter if we know which *kind* of event we were +// about to get. Here we use <select> to find out which one might be +// available. + +void +ACE_XtReactor::InputCallbackProc (XtPointer closure, + int *source, + XtInputId *) +{ + ACE_XtReactor *self = (ACE_XtReactor *) closure; + ACE_HANDLE handle = (ACE_HANDLE) *source; + + // my copy isn't const. + ACE_Time_Value zero = ACE_Time_Value::zero; + + ACE_Select_Reactor_Handle_Set wait_set; + + // Deal with one file event. + + // - read which kind of event + if (self->wait_set_.rd_mask_.is_set (handle)) + wait_set.rd_mask_.set_bit (handle); + if (self->wait_set_.wr_mask_.is_set (handle)) + wait_set.wr_mask_.set_bit (handle); + if (self->wait_set_.ex_mask_.is_set (handle)) + wait_set.ex_mask_.set_bit (handle); + + int result = ACE_OS::select (*source + 1, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); + + ACE_Select_Reactor_Handle_Set dispatch_set; + + // - Use only that one file event (removes events for other files). + if (result > 0) + { + if (wait_set.rd_mask_.is_set (handle)) + dispatch_set.rd_mask_.set_bit (handle); + if (wait_set.wr_mask_.is_set (handle)) + dispatch_set.wr_mask_.set_bit (handle); + if (wait_set.ex_mask_.is_set (handle)) + dispatch_set.ex_mask_.set_bit (handle); + + self->dispatch (1, dispatch_set); + } +} + +int +ACE_XtReactor::XtWaitForMultipleEvents (int width, + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value *) +{ + // Make sure we have a valid context + ACE_ASSERT (this->context_ != 0); + + // Check to make sure our handle's are all usable. + ACE_Select_Reactor_Handle_Set temp_set = wait_set; + + if (ACE_OS::select (width, + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + return -1; // Bad file arguments... + + // Instead of waiting using <select>, just use the Xt mechanism to + // wait for a single event. + + // Wait for something to happen. + ::XtAppProcessEvent (this->context_, XtIMAll); + + // Reset the width, in case it changed during the upcalls. + width = this->handler_rep_.max_handlep1 (); + + // Now actually read the result needed by the <Select_Reactor> using + // <select>. + return ACE_OS::select (width, + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); +} + +XtAppContext +ACE_XtReactor::context (void) const +{ + return this->context_; +} + +void +ACE_XtReactor::context (XtAppContext context) +{ + this->context_ = context; +} + +int +ACE_XtReactor::register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_XtReactor::register_handler_i"); + + // Make sure we have a valid context + ACE_ASSERT (this->context_ != 0); + +#if defined ACE_WIN32 + // Let's handle this special case before we do any real work. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_NOTSUP_RETURN(-1); +#endif /* ACE_WIN32 */ + + int result = ACE_Select_Reactor::register_handler_i (handle, + handler, mask); + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + +int +ACE_XtReactor::register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::register_handler_i (handles, + handler, + mask); +} + +int +ACE_XtReactor::remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + ACE_TRACE ("ACE_XtReactor::remove_handler_i"); + + int result = ACE_Select_Reactor::remove_handler_i (handle, + mask); + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + +int +ACE_XtReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, + mask); +} + +int +ACE_XtReactor::suspend_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::suspend_i"); + + int result = ACE_Select_Reactor::suspend_i (handle); + + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + +int +ACE_XtReactor::resume_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::resume_i"); + + int result = ACE_Select_Reactor::resume_i (handle); + + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + +void +ACE_XtReactor::synchronize_XtInput(ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::synchronize_XtInput"); + + // The idea here is to call this function after the base class has + // processed the register/remove/suspend/resume_handler request. The + // resulting mask is used to find out which XtInput mask we need. + + // Find existing handler in linked list. + ACE_XtReactorID **XtID = &(this->ids_); + + while (*XtID && (*XtID)->handle_ != handle) + XtID = &((*XtID)->next_); + + // Remove existing input handler. + if (*XtID) + ::XtRemoveInput ((*XtID)->id_); + + int condition = compute_Xt_condition (handle); + + if (condition == 0) // No input handler needed. + { + if (*XtID) + { + // Remove linked list entry. + ACE_XtReactorID *toDelete = *XtID; + *XtID = (*XtID)->next_; + delete toDelete; + } + return; + } + + if (*XtID == 0) + { + // Create new node. + ACE_XtReactorID *tmp = new ACE_XtReactorID; + tmp->next_ = this->ids_; + tmp->handle_ = handle; + this->ids_ = tmp; + XtID = &(this->ids_); + } + + // Finally, add input handler. + (*XtID)->id_ = ::XtAppAddInput (this->context_, + (int) handle, + reinterpret_cast <XtPointer> (condition), + InputCallbackProc, + (XtPointer) this); +} + +int +ACE_XtReactor::compute_Xt_condition(ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::compute_Xt_condition"); + + // Retrieve current wait mask from base class. + // The returned value is either a combination of READ/WRITE/EXCEPT_MASK + // or -1. + int mask =this->bit_ops(handle, + 0, + this->wait_set_, + ACE_Reactor::GET_MASK); + + if (mask == -1) // No active mask. + return 0; + + int condition = 0; + +#if !defined ACE_WIN32 + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, XtInputReadMask); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, XtInputWriteMask); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, XtInputExceptMask); +#else + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, XtInputReadWinsock); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, XtInputWriteWinsock); + // EXCEPT_MASK is not supported for WIN32. As this was + // already handled in register_handler_i, no check here. +#endif /* !ACE_WIN32 */ + + return condition; +} + +// The following functions ensure that there is an Xt timeout for the +// first timeout in the Reactor's Timer_Queue. + +void +ACE_XtReactor::reset_timeout (void) +{ + // Make sure we have a valid context + ACE_ASSERT (this->context_ != 0); + + if (timeout_) + ::XtRemoveTimeOut (timeout_); + timeout_ = 0; + + ACE_Time_Value *max_wait_time = + this->timer_queue_->calculate_timeout (0); + + if (max_wait_time) + timeout_ = ::XtAppAddTimeOut (this->context_, + max_wait_time->msec (), + TimerCallbackProc, + (XtPointer) this); +} + +int +ACE_XtReactor::reset_timer_interval + (long timer_id, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_XtReactor::reset_timer_interval"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + int const result = ACE_Select_Reactor::timer_queue_->reset_interval + (timer_id, + interval); + + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +long +ACE_XtReactor::schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval) +{ + ACE_TRACE ("ACE_XtReactor::schedule_timer"); + ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); + + long const result = ACE_Select_Reactor::schedule_timer (event_handler, + arg, + delay, + interval); + if (result == -1) + return -1; + else + { + this->reset_timeout (); + return result; + } +} + +int +ACE_XtReactor::cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_XtReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (handler, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +int +ACE_XtReactor::cancel_timer (long timer_id, + const void **arg, + int dont_call_handle_close) +{ + ACE_TRACE ("ACE_XtReactor::cancel_timer"); + + if (ACE_Select_Reactor::cancel_timer (timer_id, + arg, + dont_call_handle_close) == -1) + return -1; + else + { + this->reset_timeout (); + return 0; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/dep/acelite/ace/XtReactor/XtReactor.h b/dep/acelite/ace/XtReactor/XtReactor.h new file mode 100644 index 00000000000..a4082f0d305 --- /dev/null +++ b/dep/acelite/ace/XtReactor/XtReactor.h @@ -0,0 +1,147 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file XtReactor.h + * + * $Id: XtReactor.h 91743 2010-09-13 18:24:51Z johnnyw $ + * + * @author Eric C. Newton <ecn@clark.net> + * @author Kirill Rybaltchenko <Kirill.Rybaltchenko@cern.ch> + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//============================================================================= + + +#ifndef ACE_XTREACTOR_H +#define ACE_XTREACTOR_H +#include /**/ "ace/pre.h" + +#include /**/ "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/XtReactor/ACE_XtReactor_export.h" +#include "ace/Select_Reactor.h" + +#include /**/ <X11/Intrinsic.h> + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_XtReactorID + * + * @brief This little class is necessary due to the way that Microsoft + * implements sockets to be pointers rather than indices. + */ +class ACE_XtReactor_Export ACE_XtReactorID +{ +public: + /// Magic cookie. + XtInputId id_; + + /// Underlying handle. + ACE_HANDLE handle_; + + /// Pointer to next node in the linked list. + ACE_XtReactorID *next_; +}; + +/** + * @class ACE_XtReactor + * + * @brief An object-oriented event demultiplexor and event handler + * dispatcher that uses the X Toolkit functions. + */ +class ACE_XtReactor_Export ACE_XtReactor : public ACE_Select_Reactor +{ +public: + // = Initialization and termination methods. + ACE_XtReactor (XtAppContext context = 0, + size_t size = DEFAULT_SIZE, + bool restart = false, + ACE_Sig_Handler * = 0); + virtual ~ACE_XtReactor (void); + + XtAppContext context (void) const; + void context (XtAppContext); + + // = Timer operations. + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval); + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval); + virtual int cancel_timer (ACE_Event_Handler *handler, + int dont_call_handle_close = 1); + + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1); + +protected: + // = Register timers/handles with Xt. + /// Register a single @a handler. + virtual int register_handler_i (ACE_HANDLE handle, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Register a set of <handlers>. + virtual int register_handler_i (const ACE_Handle_Set &handles, + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask); + + /// Remove the @a handler associated with this @a handle. + virtual int remove_handler_i (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + /// Remove a set of <handles>. + virtual int remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask); + + /// Suspend the <Event_Handler> associated with @a handle + virtual int suspend_i (ACE_HANDLE handle); + + /// Resume the <Event_Handler> associated with @a handle + virtual int resume_i (ACE_HANDLE handle); + + /// Synchronize XtInputHandler for @a handle + virtual void synchronize_XtInput(ACE_HANDLE handle); + + /// Compute needed Xt condition by looking at base class wait set. + virtual int compute_Xt_condition(ACE_HANDLE handle); + + /// Wait for events to occur. + virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + ///Wait for Xt events to occur. + virtual int XtWaitForMultipleEvents (int, + ACE_Select_Reactor_Handle_Set &, + ACE_Time_Value *); + + XtAppContext context_; + ACE_XtReactorID *ids_; + XtIntervalId timeout_; + +private: + /// This method ensures there's an Xt timeout for the first timeout + /// in the Reactor's Timer_Queue. + void reset_timeout (void); + + // = Integrate with the X callback function mechanism. + static void TimerCallbackProc (XtPointer closure, XtIntervalId *id); + static void InputCallbackProc (XtPointer closure, int* source, XtInputId *id); + + /// Deny access since member-wise won't work... + ACE_XtReactor (const ACE_XtReactor &); + ACE_XtReactor &operator = (const ACE_XtReactor &); +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* ACE_XTREACTOR_H */ diff --git a/dep/acelite/ace/ace_wchar.h b/dep/acelite/ace/ace_wchar.h index 77db8f83808..ff884231b1a 100644 --- a/dep/acelite/ace/ace_wchar.h +++ b/dep/acelite/ace/ace_wchar.h @@ -4,7 +4,7 @@ /** * @file ace_wchar.h * - * $Id: ace_wchar.h 91688 2010-09-09 11:21:50Z johnnyw $ + * $Id: ace_wchar.h 93597 2011-03-21 12:54:52Z johnnyw $ * * @author Darrell Brunsch <brunsch@uci.edu> */ @@ -148,10 +148,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Wide_To_Ascii { public: - /// Ctor must take a wchar string. + /// Constructor must take a wchar string. ACE_Wide_To_Ascii (const wchar_t *s); - /// Dtor will free up the memory. + /// Destructor will free up the memory. ~ACE_Wide_To_Ascii (void); /// Return the internal char* representation. @@ -186,10 +186,10 @@ private: class ACE_Ascii_To_Wide { public: - /// Ctor must take a wchar string. + /// Constructor must take a wchar string. ACE_Ascii_To_Wide (const char *s); - /// Dtor will free up the memory. + /// Destructor will free up the memory. ~ACE_Ascii_To_Wide (void); /// Return the internal wchar* representation. diff --git a/dep/acelite/ace/config-WinCE.h b/dep/acelite/ace/config-WinCE.h index 93040583980..121f46555f9 100644 --- a/dep/acelite/ace/config-WinCE.h +++ b/dep/acelite/ace/config-WinCE.h @@ -1,4 +1,4 @@ -// $Id: config-WinCE.h 89494 2010-03-15 20:11:18Z olli $ +// $Id: config-WinCE.h 93622 2011-03-22 15:45:57Z johnnyw $ // Note: For WinCE build, simply use: #include "ace/config-win32.h" // It is same as config.h for Windows NT/2k so that you can @@ -53,6 +53,7 @@ // the information using getenv. #define ACE_DEFAULT_LD_SEARCH_PATH ACE_TEXT (".\\;\\windows") +#define ACE_LACKS_ABORT #define ACE_LACKS_FCNTL_H #define ACE_LACKS_SYS_TYPES_H #define ACE_LACKS_GETCWD @@ -61,6 +62,7 @@ #define ACE_LACKS_GMTIME #define ACE_LACKS_GMTIME_R #define ACE_LACKS_LOCALTIME +#define ACE_LACKS_STRTOK_R #define ACE_LACKS_PERROR #define ACE_LACKS_STRFTIME #define ACE_LACKS_WIN32_SETFILEPOINTEREX @@ -74,8 +76,6 @@ #define ACE_LACKS_RAISE #define ACE_LACKS_BSEARCH -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - #define ACE_LACKS_MSG_WFMO #define ACE_LACKS_UMASK #define ACE_HAS_TYPES_H diff --git a/dep/acelite/ace/config-aix-5.x.h b/dep/acelite/ace/config-aix-5.x.h index 3e212059507..edff471a0f9 100644 --- a/dep/acelite/ace/config-aix-5.x.h +++ b/dep/acelite/ace/config-aix-5.x.h @@ -1,4 +1,4 @@ -// $Id: config-aix-5.x.h 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: config-aix-5.x.h 93530 2011-03-11 12:12:40Z olli $ // // Config file for AIX 5.1 and higher. @@ -312,7 +312,6 @@ #undef ACE_LACKS_NETINET_TCP_H #define ACE_HAS_3_PARAM_READDIR_R -#define ACE_HAS_POSIX_GETPWNAM_R #define ACE_HAS_SCANDIR #define ACE_SCANDIR_CMP_USES_VOIDPTR #define ACE_SCANDIR_SEL_LACKS_CONST diff --git a/dep/acelite/ace/config-aix-7.h b/dep/acelite/ace/config-aix-7.h new file mode 100644 index 00000000000..29ae0802344 --- /dev/null +++ b/dep/acelite/ace/config-aix-7.h @@ -0,0 +1,29 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file config-aix-7.h + * + * $Id: config-aix-7.h 93556 2011-03-16 12:12:04Z shuston $ + * + * This is the config file for AIX 7 and higher. + * + * @author Steve Huston <shuston@riverace.com> + */ +//============================================================================= + +#ifndef ACE_CONFIG_AIX_7_H +#define ACE_CONFIG_AIX_7_H + +// Diffs from prior AIX versions are related to scandir() arguments. +#include "ace/config-aix-5.x.h" + +#ifdef ACE_SCANDIR_CMP_USES_VOIDPTR +# undef ACE_SCANDIR_CMP_USES_VOIDPTR +#endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */ + +#ifdef ACE_SCANDIR_SEL_LACKS_CONST +# undef ACE_SCANDIR_SEL_LACKS_CONST +#endif /* ACE_SCANDIR_SEL_LACKS_CONST */ + +#endif /* ACE_CONFIG_AIX_7_H */ diff --git a/dep/acelite/ace/config-linux-common.h b/dep/acelite/ace/config-android.h index a2367bb81f6..26be6ffec7a 100644 --- a/dep/acelite/ace/config-linux-common.h +++ b/dep/acelite/ace/config-android.h @@ -1,22 +1,87 @@ -/* -*- C++ -*- */ -// $Id: config-linux-common.h 92183 2010-10-08 08:44:15Z olli $ - -// Do not use this configuration file directly since it's designed to -// be included by another, specific configuration file, such as -// config-linux.h. It provides config information common to all Linux -// platforms. It automatically determines the CPU architecture, -// compiler (g++ or egcs), and libc (libc5 or glibc), and configures -// based on those. - -#ifndef ACE_LINUX_COMMON_H -#define ACE_LINUX_COMMON_H +// -*- C++ -*- +// $Id: config-android.h 94491 2011-09-12 11:17:33Z johnnyw $ + +// The following configuration file is designed to work for Android +// platforms using GNU C++. + +#ifndef ACE_CONFIG_ANDROID_H +#define ACE_CONFIG_ANDROID_H #include /**/ "ace/pre.h" -#define ACE_HAS_BYTESEX_H +// Location of the __ANDROID_API__ define +// #include $NDK_ROOT/sysroot/usr/include/android/api-level.h +#include "android/api-level.h" -#if ! defined (__ACE_INLINE__) -#define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ +#if !defined (__ANDROID_API__) +# error __ANDROID_API__ must be defined +#endif + +#define ACE_HAS_SSIZE_T + +// system errorno is a volatile int +#define ACE_HAS_VOLATILE_ERRNO + +#define ACE_ERRNO_TYPE volatile int + +// Android doesn't check is sig is out of range. +#define ACE_HAS_SIGISMEMBER_BUG + +#define ACE_HAS_PTHREADS_UNIX98_EXT + +// Android does not support pthread concurrency (yet) +#define ACE_LACKS_MUTEXATTR_PSHARED 1 + +// the android definition of struct stat{} uses +// unsigned long rather than time_t for st_[acm]time +// members of the stat struct used to report file +// status details. +#define ACE_USES_ULONG_FOR_STAT_TIME + +#define ACE_LACKS_NEW_H +#define ACE_LACKS_SEARCH_H +#define ACE_LACKS_SIGINFO_H +#define ACE_LACKS_STROPTS_H +#define ACE_LACKS_SYS_SEM_H +#define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYS_SHM_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_UCONTEXT_H + +#define ACE_LACKS_CUSERID +#define ACE_LACKS_FD_MASK +#define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETLOADAVG +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_LOG2 +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_PTHREAD_CANCEL +#define ACE_LACKS_SEEKDIR +#define ACE_LACKS_SEMBUF_T +#define ACE_LACKS_SETINHERITSCHED +#define ACE_LACKS_STD_WSTRING +#define ACE_LACKS_STRRECVFD +#define ACE_LACKS_SWAB +#define ACE_LACKS_SYSV_SHMEM +#define ACE_LACKS_TELLDIR +#define ACE_LACKS_WCSTOLL +#define ACE_LACKS_WCSTOULL + +#define ACE_LACKS_RAND_R + +// Android seems to have 64 keys of which Android itself use 5 +#define ACE_DEFAULT_THREAD_KEYS 59 + +// Android Standalone compiler std library does not include +// wide character support +// Used in tests/Sequence_Unit_Tests/string_sequence_tester.hpp +# define TAO_LACKS_WCHAR_CXX_STDLIB + +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + +#define ACE_PLATFORM_CONFIG config-android.h // Needed to differentiate between libc 5 and libc 6 (aka glibc). #include <features.h> @@ -25,10 +90,10 @@ # define ACE_HAS_PTHREADS_UNIX98_EXT #endif /* _XOPEN_SOURCE - 0 >= 500 */ -#if !defined (ACE_LACKS_LINUX_NPTL) - # include "ace/config-posix.h" +#if !defined (ACE_LACKS_LINUX_NPTL) + // Temporary fix because NPTL kernels do have shm_open but there is a problem // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time. # if defined (ACE_HAS_SHM_OPEN) @@ -50,6 +115,14 @@ # endif /* ACE_HAS_POSIX_SEM */ #endif /* !ACE_LACKS_LINUX_NPTL */ +// AIO support pulls in the rt library, which pulls in the pthread +// library. Disable AIO in single-threaded builds. +#if defined (ACE_HAS_THREADS) +# define ACE_HAS_CLOCK_GETTIME +#else +# undef ACE_HAS_AIO_CALLS +#endif + // First the machine specific part #if defined (__powerpc__) || defined (__x86_64__) @@ -64,93 +137,17 @@ # endif /* ! ACE_DEFAULT_BASE_ADDR */ #endif /* ! __powerpc__ && ! __ia64 */ -// Then glibc/libc5 specific parts - -#if defined(__GLIBC__) -# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) -# define ACE_HAS_NONCONST_SETRLIMIT -# endif -# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 3) -# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who -# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource -# define ACE_LACKS_ISCTYPE -# endif -# define ACE_HAS_SOCKLEN_T -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG - - // glibc defines both of these, used in OS_String. -# if defined (_GNU_SOURCE) -# define ACE_HAS_STRNLEN -# define ACE_HAS_WCSNLEN - - // This is probably not a 100%-sure-fire check... Red Hat Linux 9 - // and Enterprise Linux 3 and up have a new kernel that can send signals - // across threads. This was not possible prior because there was no real - // difference between a process and a thread. With this, the - // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working. - // There are restrictions, such as all socket operations being silently - // converted to synchronous by the kernel, that make aio a non-starter - // for most Linux platforms at this time. But we'll start to crawl... -# define ACE_POSIX_SIG_PROACTOR -# endif - - // To avoid the strangeness with Linux's ::select (), which modifies - // its timeout argument, use ::poll () instead. -# define ACE_HAS_POLL - -// Don't define _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED in ACE to make -// getpgid() prototype visible. ACE shouldn't depend on feature test -// macros to make prototypes visible. -# define ACE_LACKS_GETPGID_PROTOTYPE - -// @note the following defines are necessary with glibc 2.0 (0.961212-5) -// on Alpha. I assume that they're necessary on Intel as well, -// but that may depend on the version of glibc that is used. -//# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C -# define ACE_HAS_VOIDPTR_SOCKOPT - -// Don't define _POSIX_SOURCE in ACE to make strtok() prototype -// visible. ACE shouldn't depend on feature test macros to make -// prototypes visible. -# define ACE_LACKS_STRTOK_R_PROTOTYPE -// @note end of glibc 2.0 (0.961212-5)-specific configuration. - -# if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 - // These were suggested by Robert Hanzlik <robi@codalan.cz> to get - // ACE to compile on Linux using glibc 2.1 and libg++/gcc 2.8. -# undef ACE_HAS_BYTESEX_H -# define ACE_HAS_SIGINFO_T -# define ACE_LACKS_SIGINFO_H -# define ACE_HAS_UCONTEXT_T - - // Pre-glibc (RedHat 5.2) doesn't have sigtimedwait. -# define ACE_HAS_SIGTIMEDWAIT -# endif /* __GLIBC__ 2.1+ */ -#else /* ! __GLIBC__ */ - // Fixes a problem with some non-glibc versions of Linux... -# define ACE_LACKS_MADVISE -# define ACE_LACKS_MSG_ACCRIGHTS -#endif /* ! __GLIBC__ */ - -// Don't define _LARGEFILE64_SOURCE in ACE to make llseek() or -// lseek64() prototype visible. ACE shouldn't depend on feature test -// macros to make prototypes visible. -#if __GLIBC__ > 1 -# if __GLIBC_MINOR__ == 0 -# define ACE_HAS_LLSEEK -# define ACE_LACKS_LLSEEK_PROTOTYPE -# else /* __GLIBC_MINOR__ > 0 */ -# define ACE_HAS_LSEEK64 -# define ACE_LACKS_LSEEK64_PROTOTYPE -# endif -#endif /* __GLIBC__ > 1 */ - -#if __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 -# define ACE_HAS_P_READ_WRITE +#define ACE_HAS_SIGINFO_T +#define ACE_HAS_SOCKLEN_T +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG + +#define ACE_HAS_LSEEK64 +//#define ACE_LACKS_LSEEK64_PROTOTYPE + +#define ACE_HAS_P_READ_WRITE // Use ACE's alternate cuserid() implementation since the use of the // system cuserid() is discouraged. -# define ACE_HAS_ALT_CUSERID -#endif /* __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 */ +#define ACE_HAS_ALT_CUSERID #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) # define ACE_HAS_ISASTREAM_PROTOTYPE @@ -160,22 +157,11 @@ // Then the compiler specific parts -#if defined (__INTEL_COMPILER) -# include "ace/config-icc-common.h" -#elif defined (__GNUG__) +#if defined (__GNUG__) // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so // this must appear before its #include. # define ACE_HAS_STRING_CLASS # include "ace/config-g++-common.h" -#elif defined (__SUNCC_PRO) || defined (__SUNPRO_CC) -# include "ace/config-suncc-common.h" -#elif defined (__PGI) -// Portable group compiler -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_HAS_STDCPP_STL_INCLUDES -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# define ACE_LACKS_SWAB #elif defined (__GNUC__) /** * GNU C compiler. @@ -187,7 +173,7 @@ */ #else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */ # ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler in ace/config-linux-common.h +# error unsupported compiler in ace/config-android.h # endif /* __cplusplus */ #endif /* ! __GNUG__*/ @@ -198,40 +184,21 @@ #define ACE_HAS_SIGSUSPEND -#define ACE_HAS_UALARM - #define ACE_HAS_STRSIGNAL -#if __GLIBC__ >= 2 #ifndef ACE_HAS_POSIX_REALTIME_SIGNALS -#define ACE_HAS_POSIX_REALTIME_SIGNALS +# define ACE_HAS_POSIX_REALTIME_SIGNALS #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ -#ifndef ACE_HAS_AIO_CALLS -#define ACE_HAS_AIO_CALLS -#endif /* ACE_HAS_AIO_CALLS */ -#endif - -#if __GLIBC__ >= 2 -// glibc 2 and higher has wchar support -# define ACE_HAS_XPG4_MULTIBYTE_CHAR -# define ACE_HAS_VFWPRINTF -#endif - -#if __GLIBC__ < 2 -// These are present in glibc 2 and higher -# define ACE_LACKS_WCSTOK -# define ACE_LACKS_WCSDUP_PROTOTYPE -#endif /* __GLIBC__ < 2 */ +#define ACE_HAS_XPG4_MULTIBYTE_CHAR +#define ACE_HAS_VFWPRINTF #define ACE_LACKS_ITOW #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP #define ACE_LACKS_ISWASCII -#if __GLIBC__ >= 2 -# define ACE_HAS_3_PARAM_WCSTOK -#endif +#define ACE_HAS_3_PARAM_WCSTOK #define ACE_HAS_3_PARAM_READDIR_R @@ -239,11 +206,7 @@ # define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) #endif /* ! ACE_DEFAULT_BASE_ADDR */ -// Compiler/platform supports alloca(). -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA +#define ACE_HAS_ALLOCA // Compiler/platform has <alloca.h> #define ACE_HAS_ALLOCA_H @@ -258,8 +221,8 @@ #define ACE_HAS_BSWAP_16 #define ACE_HAS_BSWAP_32 -#if defined __GNUC__ && __GNUC__ >= 2 -# define ACE_HAS_BSWAP_64 +#if defined (__GNUC__) +# define ACE_HAS_BSWAP_64 #endif #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES @@ -294,59 +257,25 @@ #define ACE_HAS_GETPAGESIZE 1 -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2) -// glibc supports wchar, but lacks fgetwc and ungetwc -# define ACE_LACKS_FGETWC -# define ACE_HAS_NONCONST_MSGSND -# define ACE_LACKS_STRNLEN_PROTOTYPE -#endif - -// glibc requires _XOPEN_SOURCE_EXTENDED to make this prototype -// visible, so force ACE to declare one. Yuk! -#ifndef _XOPEN_SOURCE_EXTENDED -# define ACE_LACKS_MKSTEMP_PROTOTYPE -#endif /* !_XOPEN_SOURCE_EXTENDED */ - // Platform defines struct timespec but not timespec_t #define ACE_LACKS_TIMESPEC_T // Platform supplies scandir() #define ACE_HAS_SCANDIR -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) -// Although the scandir man page says otherwise, this setting is correct. -// The setting was fixed in 2.10, so do not use the hack after that. -#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR -#endif -// A conflict appears when including both <ucontext.h> and -// <sys/procfs.h> with recent glibc headers. -//#define ACE_HAS_PROC_FS - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC +#define ACE_MMAP_NO_ZERO // Compiler/platform contains the <sys/syscall.h> file. #define ACE_HAS_SYS_SYSCALL_H -// Platform/compiler supports global timezone variable. -#define ACE_HAS_TIMEZONE - #define ACE_HAS_TIMEZONE_GETTIMEOFDAY -// Don't define _XOPEN_SOURCE in ACE to make strptime() prototype -// visible. ACE shouldn't depend on feature test macros to make -// prototypes visible. -#define ACE_LACKS_STRPTIME_PROTOTYPE - // Compiler supports the ssize_t typedef. #define ACE_HAS_SSIZE_T // Compiler/platform defines the sig_atomic_t typedef. #define ACE_HAS_SIG_ATOMIC_T -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - #define ACE_HAS_POSIX_TIME #define ACE_HAS_GPERF @@ -364,7 +293,7 @@ # define ACE_HAS_STRBUF_T #endif -#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) +#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) || defined(__powerpc64__) // On 64 bit platforms, the "long" type is 64-bits. Override the // default 32-bit platform-specific format specifiers appropriately. # define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" @@ -390,8 +319,6 @@ #define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_ICMP_SUPPORT 1 - #define ACE_HAS_VASPRINTF // According to man pages Linux uses different (compared to UNIX systems) types @@ -405,9 +332,6 @@ # include "ace/config-posix-nonetworking.h" #else # define ACE_HAS_NETLINK -# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) -# define ACE_HAS_GETIFADDRS -# endif #endif #if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) @@ -428,11 +352,26 @@ # if !defined (ACE_LACKS_LINUX_VERSION_H) # include <linux/version.h> # endif /* !ACE_LACKS_LINUX_VERSION_H */ -# if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0)) -# define ACE_HAS_EVENT_POLL -# endif +#endif + +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE +#define ACE_HAS_RECURSIVE_MUTEXES +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_REENTRANT_FUNCTIONS + +#if __ANDROID_API__ == 8 +# define ACE_LACKS_REGEX_H 1 +# define ACE_LACKS_CONDATTR 1 +#elif __ANDROID_API__ == 9 +# define ACE_HAS_TIMEZONE +#else +# error Unsupported Android release #endif #include /**/ "ace/post.h" -#endif /* ACE_LINUX_COMMON_H */ +#endif /* ACE_CONFIG_ANDROID_H */ diff --git a/dep/acelite/ace/config-cray.h b/dep/acelite/ace/config-cray.h deleted file mode 100644 index 1b944876112..00000000000 --- a/dep/acelite/ace/config-cray.h +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-cray.h 87169 2009-10-19 20:26:55Z olli $ - -#ifndef ACE_CONFIG_CRAY_H -#define ACE_CONFIG_CRAY_H -#include /**/ "ace/pre.h" - -/* - The following predefined macros are used within ACE ifdefs. - These are defined when using the Cray compilers. _CRAYMPP - is defined, for example, if you are running on a Cray T3E - massively parallel machine. Moreover, in the case of the T3E, - _CRAYT3E will be defined. This is used to determine the - ACE_SIZEOF defines for primitive types. - - _UNICOS is defined as either the major version of UNICOS being run, - e.g. 9 or 10 on the vector machines (e.g. C90, T90, J90, YMP, ...) - or the major+minor+level UNICOS/mk version, e.g. 2.0.3 => 203, - being run on an MPP machine. - - Summary: - - _CRAYMPP (defined only if running on MPP machine, e.g. T3E, UNICOS/mk) - _CRAYT3E (defined specifically if compiling on a Cray T3E) - _UNICOS (defined if running UNICOS or UNICOS/mk) - - Tested on UNICOS 10.0.0.5, UNICOS/mk 2.0.4.57 - Compiles on UNICOS 9.0.2.8, but some tests deadlock - - Contributed by Doug Anderson <dla@home.com> -*/ - -#if defined (_UNICOS) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* _UNICOS */ - -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#define ACE_HAS_CPLUSPLUS_HEADERS - -#define ACE_HAS_SSIZE_T - -#define ACE_HAS_SYSV_IPC - -#define ACE_MT_SAFE 1 - -#define ACE_HAS_THREADS - -#define ACE_HAS_PTHREADS - -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -#define ACE_HAS_POSIX_TIME - -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -#define ACE_HAS_POSIX_NONBLOCK - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -#define ACE_HAS_DIRENT - -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -#define ACE_HAS_IP_MULTICAST - -#define ACE_HAS_SOCKADDR_IN_SIN_LEN - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -#define ACE_HAS_NONCONST_READLINK - -#define ACE_HAS_CHARPTR_SOCKOPT - -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_INET_ADDR - -// has man pages, but links with missing symbols and I can't find lib yet -/* #define ACE_HAS_REGEX */ - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -#if _UNICOS > 9 -# define ACE_HAS_SIGWAIT -#endif - -#define ACE_HAS_SIG_ATOMIC_T - -#define ACE_HAS_SIGISMEMBER_BUG - -#define ACE_HAS_MSG - -#define ACE_HAS_GPERF - -// Special modifications that apply to UNICOS/mk -#if defined(_CRAYMPP) - -# define ACE_HAS_SIGINFO_T -# define ACE_HAS_UCONTEXT_T - -#endif - -// The Cray T90 supposedly supports SYSV SHMEM, but I was unable to get it -// working. Of course, all other Cray PVP and MPP systems do NOT support it, -// so it's probably good to just define like this for consistency -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_MMAP -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_MADVISE -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_PTHREAD_CLEANUP -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -#if !defined(_CRAYMPP) - -#define ACE_LACKS_PTHREAD_CANCEL -#define ACE_LACKS_PTHREAD_KILL - -#endif - -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_PRI_T -#define ACE_LACKS_GETPGID -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID -#define ACE_LACKS_MPROTECT -#define ACE_LACKS_MSYNC -#define ACE_LACKS_READV -#define ACE_LACKS_RLIMIT - -// we probably want to fake not having this, since Cray memory mgmt is different -#define ACE_LACKS_SBRK - -#define ACE_LACKS_SETSCHED - -#define ACE_LACKS_SIGINFO_H - -#define ACE_LACKS_TIMESPEC_T - -#define ACE_LACKS_WRITEV - -// Cray vector machines are "word" oriented, and modern ones are hard 64-bit. -// "char" is somewhat of a special case. Most problems arise when code thinks -// it can address 32-bit quantities and the like. MPP crays are typically -// byte oriented, e.g. T3E uses Alpha processors, so we don't need as much -// special treatment. - -#ifndef _CRAYMPP - -# define ACE_SIZEOF_CHAR 1 -# define ACE_SIZEOF_SHORT 8 -# define ACE_SIZEOF_INT 8 -# define ACE_SIZEOF_LONG 8 -# define ACE_SIZEOF_LONG_LONG 8 -# define ACE_SIZEOF_FLOAT 8 -# define ACE_SIZEOF_DOUBLE 8 -# define ACE_SIZEOF_LONG_DOUBLE 16 -# define ACE_SIZEOF_VOID_P 8 - -#elif defined(_CRAYT3E) - -# define ACE_SIZEOF_CHAR 1 -# define ACE_SIZEOF_SHORT 4 -# define ACE_SIZEOF_INT 8 -# define ACE_SIZEOF_LONG 8 -# define ACE_SIZEOF_LONG_LONG 8 -# define ACE_SIZEOF_FLOAT 4 -# define ACE_SIZEOF_DOUBLE 8 -# define ACE_SIZEOF_LONG_DOUBLE 8 -# define ACE_SIZEOF_VOID_P 8 - -#endif - -// Ones to check out at some point - -// C++ Compiler stuff to verify -/* #define ACE_NEW_THROWS_EXCEPTIONS */ -/* #define ACE_HAS_TEMPLATE_TYPEDEFS */ - -// thread issues to check out -/* #define ACE_LACKS_TIMEDWAIT_PROTOTYPES */ - -// Cray does seem to support it, in -lnsl and has tiuser.h header -/* #define ACE_HAS_TLI */ -/* #define ACE_HAS_TIUSER_H */ -/* #define ACE_HAS_TLI_PROTOTYPES */ - -/* #define ACE_LACKS_NAMED_POSIX_SEM */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_CRAY_H */ diff --git a/dep/acelite/ace/config-cxx-common.h b/dep/acelite/ace/config-cxx-common.h deleted file mode 100644 index 024c25fd27e..00000000000 --- a/dep/acelite/ace/config-cxx-common.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- -// -// $Id: config-cxx-common.h 81935 2008-06-12 22:01:53Z jtc $ - -#ifndef ACE_CXX_COMMON_H -#define ACE_CXX_COMMON_H -#include /**/ "ace/pre.h" - -#if !defined (ACE_CONFIG_INCLUDE_CXX_COMMON) -# error ace/config-cxx-common.h: ACE configuration error! Do not #include this file directly! -#endif - -#if defined (__DECCXX) -# if !defined (linux) -# define ACE_HAS_STRING_CLASS -# if (__DECCXX_VER >= 60090010) -# define ACE_HAS_STDCPP_STL_INCLUDES -# endif /* __DECCXX_VER < 60090010 */ -# endif /* ! linux */ - -# define DEC_CXX -# define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_SIGNED_CHAR -# define ACE_HAS_CPLUSPLUS_HEADERS -# define ACE_TEMPLATES_REQUIRE_SOURCE -# if (__DECCXX_VER >= 60090010) - // DEC CXX 6.0 supports exceptions, etc., by default. Exceptions - // are enabled by platform_osf1_4.x.GNU/wrapper_macros.GNU. -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_TEMPLATE_TYPEDEFS - -# define ACE_ENDLESS_LOOP \ - unsigned int ace_endless_loop____ = 0; if (ace_endless_loop____) break; - -# if defined (__USE_STD_IOSTREAM) -# define ACE_LACKS_CHAR_RIGHT_SHIFTS -# define ACE_LACKS_IOSTREAM_FX -# define ACE_LACKS_UNBUFFERED_STREAMBUF -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -# else /* ! __USE_STD_IOSTREAM */ -# define ACE_USES_OLD_IOSTREAMS -# endif /* ! __USE_STD_IOSTREAM */ - -// 9: nested comment not allowed. (/usr/include/pdsc.h!) (nestcomment) -// 177: variable was declared but never referenced (declbutnotref) -// 193: zero used for undefined preprocessing identifier (undpreid) -// 236: controlling expression is constant (boolexprconst) -// 401: base_class_with_nonvirtual_dtor (basclsnondto) -// 1016: expected type is incompatible with declared type of int (incint) -// 1136: conversion to smaller size integer could lose data (intconlosbit) - -# pragma message disable basclsnondto -# pragma message disable boolexprconst -# pragma message disable undpreid -# pragma message disable notusetmpfunprm -# pragma message disable bltinclnk - -# if (__DECCXX_VER >= 60190029) - // 6.1-029 and later support msg 1136. Disable it because it - // causes warnings from ACE and/or TAO. -# pragma message disable intconlosbit -# endif /* __DECCXX_VER >= 60190029 */ - -# if (__DECCXX_VER == 60190027) - // Seems that this version of cxx doesn't have reset -# define ACE_AUTO_PTR_LACKS_RESET -# endif /* __DECCXX_VER == 60190027 */ - -# if defined (DIGITAL_UNIX) && DIGITAL_UNIX >= 0x40D - // variable "PTHREAD_THIS_CATCH_NP" was declared but never referenced -# pragma message disable declbutnotref -# endif /* DIGITAL_UNIX >= 4.0f */ - -# else /* __DECCXX_VER < 60090010 */ -# define ACE_LACKS_PRAGMA_ONCE -# endif /* __DECCXX_VER < 60090010 */ -#else /* ! __DECCXX */ -# error ace/config-cxx-common.h can only be used with Compaq CXX! -#endif /* ! __DECCXX */ - -#include /**/ "ace/post.h" -#endif /* ACE_CXX_COMMON_H */ diff --git a/dep/acelite/ace/config-cygwin32.h b/dep/acelite/ace/config-cygwin32.h index 35c517c3ca6..4fc15437100 100644 --- a/dep/acelite/ace/config-cygwin32.h +++ b/dep/acelite/ace/config-cygwin32.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-cygwin32.h 87169 2009-10-19 20:26:55Z olli $ +// $Id: config-cygwin32.h 93530 2011-03-11 12:12:40Z olli $ // The following configuration file is designed to work for CygWin // platforms using GNU C++. @@ -64,7 +64,6 @@ #define ACE_HAS_VOIDPTR_SOCKOPT 1 #define ACE_HAS_UALARM 1 #define ACE_HAS_STRNLEN 1 -#define ACE_HAS_POSIX_GETPWNAM_R 1 #define ACE_HAS_POSIX_NONBLOCK 1 #define ACE_HAS_POSIX_TIME #define ACE_HAS_CLOCK_GETTIME 1 @@ -73,11 +72,9 @@ #define ACE_DEFAULT_BASE_ADDR ((char *) 0x8000000) #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_HAS_SVR4_DYNAMIC_LINKING -//#define ACE_HAS_SYSV_IPC #define ACE_HAS_VOIDPTR_MMAP #define ACE_HAS_CPLUSPLUS_HEADERS #define ACE_HAS_POLL -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 #define ACE_HAS_SOCKADDR_MSG_NAME 1 #define ACE_LACKS_PRI_T 1 #define ACE_HAS_3_PARAM_READDIR_R diff --git a/dep/acelite/ace/config-doxygen.h b/dep/acelite/ace/config-doxygen.h deleted file mode 100644 index 5664338e3a0..00000000000 --- a/dep/acelite/ace/config-doxygen.h +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- - -/** - * This is a configuration file to define all the macros that Doxygen - * needs - * - * @file config-doxygen.h - * - * $Id: config-doxygen.h 91685 2010-09-09 09:35:14Z johnnyw $ - * - * @author Carlos O'Ryan <coryan@uci.edu> - * @author Darrell Brunsch <brunsch@uci.edu> - * - */ -#ifndef ACE_CONFIG_DOXYGEN_H -#define ACE_CONFIG_DOXYGEN_H - -/// Make sure that we always turn inlining on. -#define __ACE_INLINE__ - -/// Make the wchar_t interfaces available. -#define ACE_HAS_WCHAR - -/// Make all the emulation versions of string operations visible -// #define ACE_LACKS_WCSTOK -#define ACE_LACKS_ITOW -#define ACE_LACKS_STRCASECMP -#define ACE_LACKS_STRRCHR -#define ACE_LACKS_WCSCAT -#define ACE_LACKS_WCSCHR -#define ACE_LACKS_WCSCMP -#define ACE_LACKS_WCSCPY -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSLEN -#define ACE_LACKS_WCSNCAT -#define ACE_LACKS_WCSNCMP -#define ACE_LACKS_WCSNCPY -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSPBRK -#define ACE_LACKS_WCSRCHR -#define ACE_LACKS_WCSCSPN -#define ACE_LACKS_WCSSPN -#define ACE_LACKS_WCSSTR - -/// Support for threads enables several important classes -#define ACE_HAS_THREADS - -/// Support for Win32 enables the WFMO_Reactor and several Async I/O -/// classes -#define ACE_WIN32 - -/// Enable support for POSIX Asynchronous I/O calls -#define ACE_HAS_AIO_CALLS - -/// Enable support for TLI interfaces -#define ACE_HAS_TLI - -/// Enable support for the SSL wrappers -#define ACE_HAS_SSL 1 - -/// Enable timeprobes -#define ACE_COMPILE_TIMEPROBES - -/// Enable unicode to generate ACE_Registry_Name_Space -#define UNICODE - -/// These defines make sure that Svc_Conf_y.cpp and Svc_Conf_l.cpp are correctly -/// parsed -#define __cplusplus -#define ACE_YY_USE_PROTOS - -/// TAO features that should be documented too -#define TAO_HAS_RT_CORBA 1 -#define TAO_HAS_MINIMUM_CORBA 0 -#define TAO_HAS_AMI 1 -#define TAO_HAS_INTERCEPTORS 1 -#define TAO_HAS_SCIOP 1 -#define TAO_HAS_COIOP 1 -#define TAO_HAS_TRANSPORT_CURRENT 1 - -/// Generate token library documentation -#define ACE_HAS_TOKENS_LIBRARY - -/// Generate ACE ATM classes documentation -#define ACE_HAS_ATM - -/// Generate ACE XTI ATM class documentation -#define ACE_HAS_XTI_ATM - -/// Generate ACE_Dev_Poll_Reactor documentation -#define ACE_HAS_DEV_POLL - -/// Generate ACE_Log_Msg_NT_Event_Log documentation -#define ACE_HAS_LOG_MSG_NT_EVENT_LOG - -/// Generate icmp documentation -#define ACE_HAS_ICMP_SUPPORT 1 - -/// Parse some ACE_SSL classes that depend on recent versions of -/// OpenSSL. -#define OPENSSL_VERSION_NUMBER 0x00905820L - -/// Enable IPv6 -#define ACE_HAS_IPV6 - -/// Enable netlink socket support -#define ACE_HAS_NETLINK - -#define ACE_HAS_IP_MULTICAST - -#define ACE_INLINE -#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL -#define ACE_END_VERSIONED_NAMESPACE_DECL -#define TAO_BEGIN_VERSIONED_NAMESPACE_DECL -#define TAO_END_VERSIONED_NAMESPACE_DECL - -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - -#endif /* ACE_CONFIG_DOXYGEN_H */ diff --git a/dep/acelite/ace/config-freebsd.h b/dep/acelite/ace/config-freebsd.h index b83394ddece..afd68e53c62 100644 --- a/dep/acelite/ace/config-freebsd.h +++ b/dep/acelite/ace/config-freebsd.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-freebsd.h 87483 2009-11-11 13:50:04Z olli $ +// $Id: config-freebsd.h 95430 2012-01-11 20:45:28Z mcorino $ // The following configuration file is designed to work for FreeBSD @@ -8,49 +8,20 @@ #include /**/ "ace/pre.h" #if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 +# define ACE_MT_SAFE 1 #endif -#if ACE_MT_SAFE - // Yes, we do have threads. -# define ACE_HAS_THREADS 1 -#else - // Set to 0 since that's what config-posix.h checks for. -# define ACE_HAS_THREADS 0 -#endif /* ACE_MT_SAFE */ - -#include "ace/config-posix.h" - // Make sure we source in the OS version. #include <osreldate.h> -#if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if (__FreeBSD_version < 220000) -# if defined (ACE_HAS_THREADS) -# error Threads are not supported. -# endif /* ACE_HAS_THREADS */ -#endif /* __FreeBSD_version < 220000 */ +#include "ace/config-posix.h" -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ +#include "ace/config-g++-common.h" #if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM #endif /* ACE_HAS_PENTIUM */ -// Platform specific directives -// gcc defines __FreeBSD__ automatically for us. -#ifdef ACE_HAS_THREADS -# if !defined (_THREAD_SAFE) -# define _THREAD_SAFE -# endif /* _THREAD_SAFE */ -#endif - - #define ACE_HAS_3_PARAM_READDIR_R #define ACE_HAS_3_PARAM_WCSTOK #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG @@ -91,6 +62,8 @@ #define ACE_HAS_TIMEZONE_GETTIMEOFDAY #define ACE_HAS_UALARM +#define ACE_HAS_XPG4_MULTIBYTE_CHAR + #define ACE_LACKS_CONDATTR_PSHARED #define ACE_LACKS_ISCTYPE #define ACE_LACKS_ITOW @@ -155,12 +128,12 @@ #if (__FreeBSD_version < 400000) # define ACE_LACKS_SIGSET +# define ACE_LACKS_SIGSET_T # define ACE_LACKS_RWLOCK_T # define ACE_LACKS_READDIR_R # define ACE_LACKS_SETSCHED # define ACE_LACKS_PTHREAD_THR_SIGSETMASK # define ACE_LACKS_UCONTEXT_H -# define ACE_LACKS_RAND_REENTRANT_FUNCTIONS enum schedparam_policy { SCHED_RR, @@ -189,7 +162,6 @@ enum schedparam_policy { #if (__FreeBSD_version < 501000) # define ACE_LACKS_STDINT_H -# define ACE_LACKS_PWD_REENTRANT_FUNCTIONS #endif #if (__FreeBSD_version >= 501000) diff --git a/dep/acelite/ace/config-g++-common.h b/dep/acelite/ace/config-g++-common.h index 4146b5c2147..6bd902d6e68 100644 --- a/dep/acelite/ace/config-g++-common.h +++ b/dep/acelite/ace/config-g++-common.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: config-g++-common.h 92120 2010-10-01 12:00:01Z johnnyw $ +// $Id: config-g++-common.h 93500 2011-03-07 16:19:27Z vzykov $ // This configuration file is designed to be included by another, // specific configuration file. It provides config information common @@ -24,20 +24,10 @@ #define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 #define ACE_TEMPLATES_REQUIRE_SOURCE -#if ( __GNUC__ == 2 && __GNUC_MINOR__ < 97 ) - // gcc 2.97 and lower use old iostreams -# define ACE_USES_OLD_IOSTREAMS -#endif /* __GNUC__ >= 2.97 */ - #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS #endif /* __GNUC__ >= 3.4 */ -#if (__GNUC__ < 3) -# define ACE_LACKS_MEMBER_TEMPLATES -# define ACE_LACKS_NUMERIC_LIMITS -#endif /* __GNUC__ < 3 */ - #define ACE_NEW_THROWS_EXCEPTIONS #if (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) // Versions of g++ prior to 3.3 had a buggy operator // new(nothrow)[](). @@ -73,6 +63,10 @@ #define ACE_HAS_GCC_DEPRECATED_ATTRIBUTE 1 #endif +#if !defined (ACE_HAS_GCC_FORMAT_ATTRIBUTE) +#define ACE_HAS_GCC_FORMAT_ATTRIBUTE 1 +#endif + #if (ACE_HAS_GCC_CONSTRUCTOR_ATTRIBUTE == 1) # define ACE_GCC_CONSTRUCTOR_ATTRIBUTE __attribute__ ((constructor)) #endif @@ -85,6 +79,11 @@ #define ACE_DEPRECATED __attribute__ ((deprecated)) #endif +#if (ACE_HAS_GCC_FORMAT_ATTRIBUTE == 1) +# define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX) \ + __attribute__ ((format (TYPE, STR_INDEX, FIRST_INDEX))) +#endif + // GNU g++ >= 4.x implements "#pragma once". #if (__GNUC__ < 4) && !defined (ACE_LACKS_PRAGMA_ONCE) // We define it with a -D with make depend. diff --git a/dep/acelite/ace/config-ghs-common.h b/dep/acelite/ace/config-ghs-common.h deleted file mode 100644 index ffa554c047e..00000000000 --- a/dep/acelite/ace/config-ghs-common.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-ghs-common.h 80826 2008-03-04 14:51:23Z wotte $ - -// This configuration file is designed to be included by another, -// specific configuration file. It provides config information common -// to all Green Hills platforms. - -#ifndef ACE_GHS_COMMON_H -#define ACE_GHS_COMMON_H -#include /**/ "ace/pre.h" - -#if !defined (ACE_CONFIG_INCLUDE_GHS_COMMON) -# error ace/config-ghs-common.h: ACE configuration error! Do not #include this file directly! -#endif - -#if defined (ghs) - -# if defined (sun) - // Need nonstatic Object_Manager on Solaris to prevent seg fault - // on startup. -# define ACE_HAS_NONSTATIC_OBJECT_MANAGER -# endif /* sun */ - -# if defined (__STANDARD_CXX) - // Green Hills 1.8.9, but not 1.8.8. -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_LACKS_AUTO_PTR -# define ACE_LACKS_CHAR_RIGHT_SHIFTS -# define ACE_LACKS_UNBUFFERED_STREAMBUF -# else -# define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA -# endif /* __STANDARD_CXX */ - -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_LONGLONG_T -# define ACE_LACKS_SIGNED_CHAR - -#else /* ! ghs */ -# error ace/config-ghs-common.h can only be used with Green Hills compilers! -#endif /* ! ghs */ - -#include /**/ "ace/post.h" -#endif /* ACE_GHS_COMMON_H */ diff --git a/dep/acelite/ace/config-hpux-11.00.h b/dep/acelite/ace/config-hpux-11.00.h index 978a85a8e87..4f16be93b5c 100644 --- a/dep/acelite/ace/config-hpux-11.00.h +++ b/dep/acelite/ace/config-hpux-11.00.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-hpux-11.00.h 92102 2010-09-30 08:14:15Z johnnyw $ +// $Id: config-hpux-11.00.h 96096 2012-08-23 12:34:02Z johnnyw $ // The following configuration file is designed to work for HP // platforms running HP-UX 11.00 using aC++ or gcc (2.95 and up). @@ -164,6 +164,9 @@ #define ACE_HAS_CLOCK_GETTIME #define ACE_HAS_CLOCK_SETTIME +#define ACE_LACKS_CLOCK_MONOTONIC +#define ACE_LACKS_MONOTONIC_TIME + // Prototypes for both signal() and struct sigaction are consistent. #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES @@ -205,13 +208,6 @@ // Compiler/platform supports poll(). #define ACE_HAS_POLL -/* Platform supports "position-independent" features provided by - ACE_Based_Pointer<>. */ -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - -/* Platform supports POSIX getpwnam_r() function */ -#define ACE_HAS_POSIX_GETPWNAM_R 1 - // Platform supports POSIX O_NONBLOCK semantics. #define ACE_HAS_POSIX_NONBLOCK @@ -319,12 +315,12 @@ #define ACE_LACKS_SUSECONDS_T #define ACE_LACKS_SYS_SYSCTL_H -// @@ TODO: It looks like HP-UX provides strtoll, strtoull, wcstoll and -// wcstoull but some more work is needed to plug them in correctly. -#define ACE_LACKS_STRTOLL -#define ACE_LACKS_WCSTOLL -#define ACE_LACKS_STRTOULL -#define ACE_LACKS_WCSTOULL +#if !(defined(__STDC_EXT__) || defined(_INCLUDE_LONGLONG) || defined(_INCLUDE_STDC__SOURCE_199901)) +# define ACE_LACKS_STRTOLL +# define ACE_LACKS_WCSTOLL +# define ACE_LACKS_STRTOULL +# define ACE_LACKS_WCSTOULL +#endif #define ACE_LACKS_ISWASCII @@ -425,6 +421,7 @@ # define ACE_HAS_RECURSIVE_MUTEXES # define ACE_HAS_THREAD_SPECIFIC_STORAGE # define ACE_LACKS_PTHREAD_ATTR_SETSTACK +# define ACE_LACKS_CONDATTR_SETCLOCK #endif /* ACE_HAS_THREADS */ #define ACE_HAS_POSIX_SEM diff --git a/dep/acelite/ace/config-irix6.5.x-sgic++.h b/dep/acelite/ace/config-irix6.5.x-sgic++.h deleted file mode 100644 index 2d501010b68..00000000000 --- a/dep/acelite/ace/config-irix6.5.x-sgic++.h +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -// $Id: config-irix6.5.x-sgic++.h 80826 2008-03-04 14:51:23Z wotte $ - -// Use this file for IRIX 6.5.x - -#ifndef ACE_CONFIG_IRIX65X_H -#define ACE_CONFIG_IRIX65X_H -#include /**/ "ace/pre.h" - -// Include IRIX 6.[234] configuration -#include "ace/config-irix6.x-sgic++.h" - -// Irix 6.5 man pages show that they exist -#undef ACE_LACKS_CONDATTR_PSHARED -#undef ACE_LACKS_MUTEXATTR_PSHARED - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_IRIX65X_H */ diff --git a/dep/acelite/ace/config-irix6.x-common.h b/dep/acelite/ace/config-irix6.x-common.h deleted file mode 100644 index 1de756d530c..00000000000 --- a/dep/acelite/ace/config-irix6.x-common.h +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- C++ -*- */ -// -// $Id: config-irix6.x-common.h 87167 2009-10-19 19:33:53Z olli $ -// -// This file contains the common configuration options for both -// SGI/MIPSPro C++ and g++ under IRIX 6.X -// -// For IRIX 6.2 there are several patches that should be applied to -// get reliable operation with multi-threading and exceptions. -// Specifically you should get a reasonable current IRIX, Compiler -// and POSIX patch-sets. - -// For IRIX 6.[34] it's less critical, but it's still recommended -// that you apply the applicable patch-sets (IRIX and Compiler I believe). - -// These patches are updated frequently, so you should ask your support -// contact or search SGI's web site (http://www.sgi.com) for the latest -// version. - -// Use this file for IRIX 6.[234] if you have the pthreads patches -// installed. - -#ifndef ACE_CONFIG_IRIX6X_COMMON_H - -#ifndef IRIX6 -# define IRIX6 -#endif - -#if ! defined(ACE_CONFIG_H) -#error "This file may only be included by config-irix6.x-sgic++.h, config-irix6.x-kcc.h or config-irix6.x-g++.h" -#endif - -// The Irix 6.x float.h doesn't allow us to distinguish between a -// double and a long double. So, we have to hard-code this. Thanks -// to Bob Laferriere <laferrie@gsao.med.ge.com> for figuring it out. -#if defined (_MIPS_SIM) /* 6.X System */ -# include <sgidefs.h> -# if defined (__GNUC__) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif defined (_MIPS_SIM_NABI32) && (_MIPS_SIM == _MIPS_SIM_NABI32) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif defined (_MIPS_SIM_ABI32) && (_MIPS_SIM == _MIPS_SIM_ABI32) -# define ACE_SIZEOF_LONG_DOUBLE 8 -# elif defined (_MIPS_SIM_ABI64) && (_MIPS_SIM == _MIPS_SIM_ABI64) -# define ACE_SIZEOF_LONG_DOUBLE 16 -# elif !defined (ACE_SIZEOF_LONG_DOUBLE) -# define ACE_SIZEOF_LONG_DOUBLE 8 -# endif -#else -# define ACE_SIZEOF_LONG_DOUBLE 8 /* 5.3 System */ -#endif - -// petern, Next part of it: - -// Platform supports getpagesize() call. -#define ACE_HAS_GETPAGESIZE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! (like Irix 6.2) -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED - -#define ACE_LACKS_SUSECONDS_T - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform requires void * for mmap(). -#define ACE_HAS_VOIDPTR_MMAP - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the <sys/syscall.h> file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -// Compiler/platform has <alloca.h> -#define ACE_HAS_ALLOCA_H - -// Irix needs to define bzero() in this odd file <bstring.h> -#define ACE_HAS_BSTRING - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Platform contains <poll.h>. -#define ACE_HAS_POLL - -// Platform supports the /proc file system. -#define ACE_HAS_PROC_FS - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Platform supports SVR4 extended signals. -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler supports the ssize_t typedef. -#define ACE_HAS_SSIZE_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform provides <sys/filio.h> header. -#define ACE_HAS_SYS_FILIO_H - -// Compiler/platform defines a union semun for SysV shared memory. -#define ACE_HAS_SEMUN - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST -#ifdef ACE_LACKS_PERFECT_MULTICAST_FILTERING - #undef ACE_LACKS_PERFECT_MULTICAST_FILTERING -#endif -#define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 - -//************************************************************** -// Not so sure how next lines should look like - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -//************************************************************** - -// IRIX 6.4 and below do not support reentrant netdb functions -// (getprotobyname_r, getprotobynumber_r, gethostbyaddr_r, -// gethostbyname_r, getservbyname_r). -#if (ACE_IRIX_VERS <= 64) && !defined (ACE_HAS_NETDB_REENTRANT_FUNCTIONS) -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#endif /* ACE_HAS_NETDB_REENTRANT_FUNCTIONS */ - -#define ACE_HAS_DIRENT -// Unless the thread enabled version is used the readdir_r interface -// does not get defined in IRIX 6.2 -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_RWLOCK_T - -#define ACE_HAS_GPERF - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_BROKEN_DGRAM_SENDV - -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -#define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 2 - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// IRIX 6.5 supports AIO -#define ACE_HAS_AIO_CALLS -#define ACE_POSIX_AIOCB_PROACTOR -#define ACE_HAS_SGIDLADD -#define ACE_HAS_P_READ_WRITE -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_STDINT_H -#define ACE_HAS_SYSENT_H -#define ACE_HAS_SYSV_SYSINFO -#define ACE_HAS_SYS_SYSTEMINFO_H - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// We need to setup a very high address or Naming_Test won't run. -#define ACE_DEFAULT_BASE_ADDR ((char *) (1024U * 1024 * 1024)) - -#define ACE_LACKS_SIGNED_CHAR - -// Platform supports reentrant functions (i.e., all the POSIX *_r -// functions). -#define ACE_HAS_REENTRANT_FUNCTIONS - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform does not support reentrant password file accessor functiions. -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// uses ctime_r & asctime_r with only two parameters vs. three -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -#define ACE_HAS_UALARM - -// Scheduling functions are declared in <sched.h> -#define ACE_NEEDS_SCHED_H - -// Compile using multi-thread libraries by default -#if !defined (ACE_MT_SAFE) - #define ACE_MT_SAFE 1 -#endif /* ACE_MT_SAFE */ - -#if (ACE_MT_SAFE != 0) - -// Add threading support - -#define ACE_HAS_IRIX62_THREADS - -// Needed for the threading stuff? -#include /**/ <task.h> -#define PTHREAD_MIN_PRIORITY PX_PRIO_MIN -#define PTHREAD_MAX_PRIORITY PX_PRIO_MAX - -// ACE supports threads. -#define ACE_HAS_THREADS - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! (like Irix 6.2) -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_MUTEXATTR_PSHARED - -// IRIX 6.2 supports a variant of POSIX Pthreads, supposedly POSIX 1c -#define ACE_HAS_PTHREADS - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// The pthread_cond_timedwait call does not reset the timer. -#define ACE_LACKS_COND_TIMEDWAIT_RESET 1 - -// When threads are enabled READDIR_R is supported on IRIX. -#undef ACE_LACKS_READDIR_R - -#endif /* (ACE_MT_SAFE == 0) */ - - -#endif /* ACE_CONFIG_IRIX6X_COMMON_H */ diff --git a/dep/acelite/ace/config-irix6.x-g++.h b/dep/acelite/ace/config-irix6.x-g++.h deleted file mode 100644 index 94c79119a64..00000000000 --- a/dep/acelite/ace/config-irix6.x-g++.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-irix6.x-g++.h 87268 2009-10-29 21:06:06Z olli $ - -// The following configuration file is designed to work for the SGI -// Indigo2EX running Irix 6.2 platform using the GNU C++ Compiler - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-g++-common.h" -#include "ace/config-irix6.x-common.h" - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-irix6.x-sgic++.h b/dep/acelite/ace/config-irix6.x-sgic++.h deleted file mode 100644 index 8bba07ac671..00000000000 --- a/dep/acelite/ace/config-irix6.x-sgic++.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-irix6.x-sgic++.h 81935 2008-06-12 22:01:53Z jtc $ - -// Use this file for IRIX 6.[234] if you have the pthreads patches -// installed. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-irix6.x-common.h" - -// This is the config file for IRIX 6.2, 6.4 and hopefully 6.3, using -// the SGI C++ compiler (7.1 or higher). - -// The following three should be enabled/disabled together. -#if _COMPILER_VERSION < 720 -#define ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA -#endif /* _COMPILER_VERSION < 720 */ -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_NEEDS_FUNC_DEFINITIONS - -// Platform supports STREAM pipes (note that this is disabled by -// default, see the manual page on pipe(2) to find out how to enable -// it). -// #define ACE_HAS_STREAM_PIPES - -#if defined (_COMPILER_VERSION) -# define ACE_CC_NAME ACE_TEXT ("SGI/MIPSPro") -# define ACE_CC_MAJOR_VERSION (_COMPILER_VERSION / 100) -# define ACE_CC_MINOR_VERSION (_COMPILER_VERSION % 100) -# define ACE_CC_BETA_VERSION (0) -#endif /* _COMPILER_VERSION */ - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-kfreebsd.h b/dep/acelite/ace/config-kfreebsd.h index ab2cd8882f4..1f607d13efa 100644 --- a/dep/acelite/ace/config-kfreebsd.h +++ b/dep/acelite/ace/config-kfreebsd.h @@ -1,4 +1,4 @@ -// $Id: config-kfreebsd.h 91743 2010-09-13 18:24:51Z johnnyw $ +// $Id: config-kfreebsd.h 93550 2011-03-15 21:26:56Z olli $ #ifndef ACE_CONFIG_KFREEBSD_H #define ACE_CONFIG_KFREEBSDH @@ -153,13 +153,6 @@ /* Platform contains <poll.h> */ #define ACE_HAS_POLL 1 -/* Platform supports "position-independent" features provided by - ACE_Based_Pointer<>. */ -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 - -/* Platform supports POSIX getpwnam_r() function */ -#define ACE_HAS_POSIX_GETPWNAM_R 1 - /* Platform supports POSIX O_NONBLOCK semantics */ #define ACE_HAS_POSIX_NONBLOCK 1 @@ -176,9 +169,6 @@ /* Define to 1 if platform has POSIX threads */ #define ACE_HAS_PTHREADS 1 -/* Platform supports POSIX.1c-1995 threads */ -#define ACE_HAS_PTHREADS_STD 1 - /* Platform has the UNIX98 extensions to Pthreads (rwlocks) */ #define ACE_HAS_PTHREADS_UNIX98_EXT 1 diff --git a/dep/acelite/ace/config-linux.h b/dep/acelite/ace/config-linux.h index 8b79c13a415..7283136d034 100644 --- a/dep/acelite/ace/config-linux.h +++ b/dep/acelite/ace/config-linux.h @@ -1,6 +1,6 @@ // -*- C++ -*- // -// $Id: config-linux.h 80826 2008-03-04 14:51:23Z wotte $ +// $Id: config-linux.h 96072 2012-08-17 12:29:59Z mcorino $ // The following configuration file is designed to work for Linux // platforms using GNU C++. @@ -9,66 +9,444 @@ #define ACE_CONFIG_LINUX_H #include /**/ "ace/pre.h" -#define ACE_PLATFORM_CONFIG config-linux.h +#if !defined (ACE_LINUX) +#define ACE_LINUX +#endif /* ACE_LINUX */ -#include "ace/config-linux-common.h" +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE +#if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ +#endif /* ! __ACE_INLINE__ */ -#if !defined (ACE_MT_SAFE) -#define ACE_MT_SAFE 1 // JCEJ 12/22/96 #1 +#if !defined (ACE_PLATFORM_CONFIG) +#define ACE_PLATFORM_CONFIG config-linux.h #endif -#if ACE_MT_SAFE -// Yes, we do have threads. -#define ACE_HAS_THREADS -// And they're even POSIX pthreads (LinuxThreads implementation) -#define ACE_HAS_PTHREADS - -// On linux this is part of pthreads -# if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L) -# if !defined (ACE_HAS_CLOCK_GETTIME) -# if !defined(__PGI) -# define ACE_HAS_CLOCK_GETTIME -# endif /* __PGI */ -# define ACE_HAS_CLOCK_SETTIME -# endif /* !ACE_HAS_CLOCK_GETTIME */ -# endif /* _POSIX_C_SOURCE >= 199309L */ - -#if !defined (ACE_HAS_PTHREADS_UNIX98_EXT) -# define ACE_LACKS_RWLOCK_T +#define ACE_HAS_BYTESEX_H + +// Needed to differentiate between libc 5 and libc 6 (aka glibc). +#include <features.h> + +#if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) +# define ACE_HAS_PTHREADS_UNIX98_EXT +#endif /* _XOPEN_SOURCE - 0 >= 500 */ + +# include "ace/config-posix.h" + +#if !defined (ACE_LACKS_LINUX_NPTL) + + // Temporary fix because NPTL kernels do have shm_open but there is a problem + // with shm_open/shm_unlink pairing in ACE which needs to be fixed when I have time. +# if defined (ACE_HAS_SHM_OPEN) +# undef ACE_HAS_SHM_OPEN +# endif /* ACE_HAS_SHM_OPEN */ + +# if defined (ACE_USES_FIFO_SEM) + // Don't use this for Linux NPTL since this has complete + // POSIX semaphores which are more efficient +# undef ACE_USES_FIFO_SEM +# endif /* ACE_USES_FIFO_SEM */ + +# if defined (ACE_HAS_POSIX_SEM) + // Linux NPTL may not define the right POSIX macro + // but they have the actual runtime support for this stuff +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) +# define ACE_HAS_POSIX_SEM_TIMEOUT +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT && (((_POSIX_C_SOURCE - 0) >= 200112L) || (_XOPEN_SOURCE >= 600)) */ +# endif /* ACE_HAS_POSIX_SEM */ +#endif /* !ACE_LACKS_LINUX_NPTL */ + +// AIO support pulls in the rt library, which pulls in the pthread +// library. Disable AIO in single-threaded builds. +#if defined (ACE_HAS_THREADS) +# define ACE_HAS_CLOCK_GETTIME +# define ACE_HAS_CLOCK_SETTIME #else -# define ACE_HAS_RECURSIVE_MUTEXES -#endif /* !ACE_HAS_PTHREADS_UNIX98_EXT */ +# undef ACE_HAS_AIO_CALLS +#endif + +// First the machine specific part -#define ACE_HAS_THREAD_SPECIFIC_STORAGE // jcej 12/22/96 #2 +#if defined (__powerpc__) || defined (__x86_64__) +# if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x40000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#elif defined (__ia64) +# if !defined (ACE_DEFAULT_BASE_ADDR) +// Zero base address should work fine for Linux of IA-64: it just lets +// the kernel to choose the right value. +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x0000000000000000) +# endif /* ! ACE_DEFAULT_BASE_ADDR */ +#endif /* ! __powerpc__ && ! __ia64 */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS // JCEJ 1/7-8/96 +// Then glibc/libc5 specific parts #if defined(__GLIBC__) -// Platform supports reentrant functions (i.e., all the POSIX *_r -// functions). -#define ACE_HAS_REENTRANT_FUNCTIONS +# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 3) +# define ACE_HAS_RUSAGE_WHO_ENUM enum __rusage_who +# define ACE_HAS_RLIMIT_RESOURCE_ENUM enum __rlimit_resource +# define ACE_LACKS_ISCTYPE +# endif +# define ACE_HAS_SOCKLEN_T +# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) - // Older versions of glibc lacked reentrant netdb functions -# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS + // glibc defines both of these, used in OS_String. +# if defined (_GNU_SOURCE) +# define ACE_HAS_STRNLEN +# define ACE_HAS_WCSNLEN - // glibc < 2.1 lacks pthread_attr_setstacksize() -# define ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE -#endif /* (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) */ + // This is probably not a 100%-sure-fire check... Red Hat Linux 9 + // and Enterprise Linux 3 and up have a new kernel that can send signals + // across threads. This was not possible prior because there was no real + // difference between a process and a thread. With this, the + // ACE_POSIX_SIG_Proactor is the only chance of getting asynch I/O working. + // There are restrictions, such as all socket operations being silently + // converted to synchronous by the kernel, that make aio a non-starter + // for most Linux platforms at this time. But we'll start to crawl... +# define ACE_POSIX_SIG_PROACTOR +# endif -// uses ctime_r & asctime_r with only two parameters vs. three -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R + // To avoid the strangeness with Linux's ::select (), which modifies + // its timeout argument, use ::poll () instead. +# define ACE_HAS_POLL + +# define ACE_HAS_SIGINFO_T +# define ACE_LACKS_SIGINFO_H +# define ACE_HAS_UCONTEXT_T +# define ACE_HAS_SIGTIMEDWAIT + +#else /* ! __GLIBC__ */ + // Fixes a problem with some non-glibc versions of Linux... +# define ACE_LACKS_MADVISE +# define ACE_LACKS_MSG_ACCRIGHTS +#endif /* ! __GLIBC__ */ + +#define ACE_HAS_LSEEK64 +//#define ACE_LACKS_LSEEK64_PROTOTYPE + +#define ACE_HAS_P_READ_WRITE +// Use ACE's alternate cuserid() implementation since the use of the +// system cuserid() is discouraged. +#define ACE_HAS_ALT_CUSERID + +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) +# define ACE_HAS_ISASTREAM_PROTOTYPE +# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE +# define ACE_HAS_CPU_SET_T +#endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */ + +// Then the compiler specific parts + +#if defined (__INTEL_COMPILER) +# include "ace/config-icc-common.h" +#elif defined (__GNUG__) + // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so + // this must appear before its #include. +# define ACE_HAS_STRING_CLASS +# include "ace/config-g++-common.h" +# ifdef __clang__ +# undef ACE_HAS_GCC_ATOMIC_BUILTINS +# endif +#elif defined (__SUNCC_PRO) || defined (__SUNPRO_CC) +# include "ace/config-suncc-common.h" +#elif defined (__PGI) +// Portable group compiler +# define ACE_HAS_CPLUSPLUS_HEADERS +# define ACE_HAS_STDCPP_STL_INCLUDES +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_LACKS_SWAB +#elif defined (__GNUC__) +/** + * GNU C compiler. + * + * We need to recognize the GNU C compiler since TAO has at least one + * C source header and file + * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly + * include this + */ +#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */ +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-linux.h +# endif /* __cplusplus */ +#endif /* ! __GNUG__*/ + +// Completely common part :-) + +// Platform/compiler has the sigwait(2) prototype +#define ACE_HAS_SIGWAIT + +#define ACE_HAS_SIGSUSPEND + +#define ACE_HAS_UALARM + +#define ACE_HAS_STRSIGNAL + +#ifndef ACE_HAS_POSIX_REALTIME_SIGNALS +# define ACE_HAS_POSIX_REALTIME_SIGNALS +#endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ + +#define ACE_HAS_XPG4_MULTIBYTE_CHAR +#define ACE_HAS_VFWPRINTF + +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_ISWASCII + +#define ACE_HAS_3_PARAM_WCSTOK + +#define ACE_HAS_3_PARAM_READDIR_R + +#if !defined (ACE_DEFAULT_BASE_ADDR) +# define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) +#endif /* ! ACE_DEFAULT_BASE_ADDR */ + +#define ACE_HAS_ALLOCA + +// Compiler/platform has <alloca.h> +#define ACE_HAS_ALLOCA_H +#define ACE_HAS_SYS_SYSINFO_H +#define ACE_HAS_LINUX_SYSINFO + +// Compiler/platform has the getrusage() system call. +#define ACE_HAS_GETRUSAGE +#define ACE_HAS_GETRUSAGE_PROTOTYPE + +#define ACE_HAS_BYTESWAP_H +#define ACE_HAS_BSWAP_16 +#define ACE_HAS_BSWAP_32 + +#if defined (__GNUC__) +# define ACE_HAS_BSWAP_64 +#endif + +#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES + +// Optimize ACE_Handle_Set for select(). +#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT + +// ONLY define this if you have config'd multicast into a 2.0.34 or +// prior kernel. It is enabled by default in 2.0.35 kernels. +#if !defined (ACE_HAS_IP_MULTICAST) +# define ACE_HAS_IP_MULTICAST +#endif /* ! ACE_HAS_IP_MULTICAST */ + +// At least for IPv4, Linux lacks perfect filtering. +#if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ + +#define ACE_HAS_BIG_FD_SET + +// Linux defines struct msghdr in /usr/include/socket.h +#define ACE_HAS_MSG + +// Linux "improved" the interface to select() so that it modifies +// the struct timeval to reflect the amount of time not slept +// (see NOTES in Linux's select(2) man page). +#define ACE_HAS_NONCONST_SELECT_TIMEVAL + +#define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 + +#define ACE_CDR_IMPLEMENT_WITH_NATIVE_DOUBLE 1 + +#define ACE_HAS_GETPAGESIZE 1 + +// Platform defines struct timespec but not timespec_t +#define ACE_LACKS_TIMESPEC_T + +// Platform supplies scandir() +#define ACE_HAS_SCANDIR +#if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 10) +// Although the scandir man page says otherwise, this setting is correct. +// The setting was fixed in 2.10, so do not use the hack after that. +#define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +#endif + +// A conflict appears when including both <ucontext.h> and +// <sys/procfs.h> with recent glibc headers. +//#define ACE_HAS_PROC_FS + +// Platform supports System V IPC (most versions of UNIX, but not Win32) +#define ACE_HAS_SYSV_IPC + +// Compiler/platform contains the <sys/syscall.h> file. +#define ACE_HAS_SYS_SYSCALL_H + +// Platform/compiler supports global timezone variable. +#define ACE_HAS_TIMEZONE + +#define ACE_HAS_TIMEZONE_GETTIMEOFDAY + +// Compiler supports the ssize_t typedef. +#define ACE_HAS_SSIZE_T + +// Compiler/platform defines the sig_atomic_t typedef. +#define ACE_HAS_SIG_ATOMIC_T + +// Compiler/platform defines a union semun for SysV shared memory. +#define ACE_HAS_SEMUN + +#define ACE_HAS_POSIX_TIME + +#define ACE_HAS_GPERF + +#define ACE_HAS_DIRENT + +// Starting with FC9 rawhide this file is not available anymore but +// this define is set +#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1 +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_STRRECVFD +#endif + +#if !defined (ACE_LACKS_STROPTS_H) +# define ACE_HAS_STRBUF_T +#endif + +#if defined (__ia64) || defined(__alpha) || defined (__x86_64__) || defined(__powerpc64__) +// On 64 bit platforms, the "long" type is 64-bits. Override the +// default 32-bit platform-specific format specifiers appropriately. +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" +#endif /* __ia64 */ + +#define ACE_SIZEOF_WCHAR 4 + +#if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE) +// 32bit PowerPC Linux uses 128bit long double +# define ACE_SIZEOF_LONG_DOUBLE 16 #endif +#define ACE_LACKS_GETIPNODEBYADDR +#define ACE_LACKS_GETIPNODEBYNAME + +// Platform has POSIX terminal interface. +#define ACE_HAS_TERMIOS + +// Linux implements sendfile(). +#define ACE_HAS_SENDFILE 1 + +#define ACE_HAS_VOIDPTR_MMAP + +#define ACE_HAS_ICMP_SUPPORT 1 + +#define ACE_HAS_VASPRINTF + +// According to man pages Linux uses different (compared to UNIX systems) types +// for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP +// in setsockopt/getsockopt. +// In the current (circa 2012) kernel source however there is an explicit check +// for IPV6_MULTICAST_LOOP being sizeof(int). Anything else is rejected so it must +// not be a passed a bool, irrespective of what the man pages (still) say. +// i.e. #define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 is wrong +#define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1 +#define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1 + +#if defined (ACE_LACKS_NETWORKING) +# include "ace/config-posix-nonetworking.h" #else -// AIO support pulls in the rt library, which pulls in the pthread -// library. Disable AIO in single-threaded builds. -# undef ACE_HAS_AIO_CALLS -#endif /* ACE_MT_SAFE */ +# define ACE_HAS_NETLINK +# define ACE_HAS_GETIFADDRS +#endif + +#if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) +// Detect if getsockname() and getpeername() returns random values in +// the sockaddr_in::sin_zero field by evaluation of the kernel +// version. Since version 2.5.47 this problem is fixed. +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include <linux/version.h> +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,47)) +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 0 +# else +# define ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO 1 +# endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,47)) */ +#endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */ + +#if !defined (ACE_HAS_EVENT_POLL) && !defined (ACE_HAS_DEV_POLL) +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include <linux/version.h> +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE > KERNEL_VERSION (2,6,0)) +# define ACE_HAS_EVENT_POLL +# endif +#endif + +// This is ghastly, but as long as there are platforms supported +// which define the right POSIX macros but lack actual support +// we have no choice. +// RHEL4 fails (2.6.9) while RHEL5 works (2.6.18) +#if !defined (ACE_LACKS_CONDATTR_SETCLOCK) +# if !defined (ACE_LACKS_LINUX_VERSION_H) +# include <linux/version.h> +# endif /* !ACE_LACKS_LINUX_VERSION_H */ +# if (LINUX_VERSION_CODE < KERNEL_VERSION (2,6,18)) +# define ACE_LACKS_CONDATTR_SETCLOCK +# endif +#endif + +#define ACE_HAS_SVR4_DYNAMIC_LINKING +#define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE +#define ACE_HAS_RECURSIVE_MUTEXES +#define ACE_HAS_THREAD_SPECIFIC_STORAGE +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_REENTRANT_FUNCTIONS + +// To support UCLIBC +#if defined (__UCLIBC__) + +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_GETLOADAVG +# define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +# define ACE_LACKS_PTHREAD_SETSTACK +# define ACE_LACKS_STRRECVFD +# define ACE_HAS_CPU_SET_T + +# if defined (ACE_HAS_STRBUF_T) +# undef ACE_HAS_STRBUF_T +# endif /* ACE_HAS_STRBUF_T */ + +# if defined (ACE_HAS_PTHREAD_SETSTACK) +# undef ACE_HAS_PTHREAD_SETSTACK +# endif /* ACE_HAS_PTHREAD_SETSTACK */ + +# if defined (ACE_HAS_AIO_CALLS) +# undef ACE_HAS_AIO_CALLS +# endif /* ACE_HAS_AIO_CALLS */ + +# if defined (ACE_HAS_GETIFADDRS) +# undef ACE_HAS_GETIFADDRS +# endif /* ACE_HAS_GETIFADDRS */ + +# if defined (ACE_SCANDIR_CMP_USES_VOIDPTR) +# undef ACE_SCANDIR_CMP_USES_VOIDPTR +# endif /* ACE_SCANDIR_CMP_USES_VOIDPTR */ + +# if defined (ACE_SCANDIR_CMP_USES_CONST_VOIDPTR) +# undef ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +# endif /* ACE_SCANDIR_CMP_USES_CONST_VOIDPTR */ + +# if defined (ACE_HAS_EXECINFO_H) +# undef ACE_HAS_EXECINFO_H +# endif /* ACE_HAS_EXECINFO_H */ + +# if defined(__GLIBC__) +# undef __GLIBC__ +# endif /* __GLIBC__ */ + +# if defined(ACE_HAS_SEMUN) +# undef ACE_HAS_SEMUN +# endif /* ACE_HAS_SEMUN */ + +#endif /* __UCLIBC__ */ #include /**/ "ace/post.h" diff --git a/dep/acelite/ace/config-lite.h b/dep/acelite/ace/config-lite.h index 1a6937c851b..7c0fab03e75 100644 --- a/dep/acelite/ace/config-lite.h +++ b/dep/acelite/ace/config-lite.h @@ -4,7 +4,7 @@ /** * @file config-lite.h * - * $Id: config-lite.h 85832 2009-06-28 16:14:59Z johnnyw $ + * $Id: config-lite.h 95867 2012-06-11 21:46:38Z mitza $ * * @author (Originally in OS.h)Doug Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -27,12 +27,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// Empty ACE_OS namespace to help identify compiler errors more -// easily. -- @@ Do we really need this? -ACE_BEGIN_VERSIONED_NAMESPACE_DECL -namespace ACE_OS {} -ACE_END_VERSIONED_NAMESPACE_DECL - // ============================================================================ // UNICODE macros (to be added later) // ============================================================================ @@ -122,13 +116,13 @@ ACE_END_VERSIONED_NAMESPACE_DECL // Once all C++ compilers support the standard reverse_iterator // adapters, we can drop this generator macro or at least drop the // MSVC++ or Sun Studio preprocessor conditional blocks. -#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5100 \ +#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5120 \ && !defined (_STLPORT_VERSION) // If we're not using the stlport4 C++ library (which has standard // iterators), we need to ensure this is included in order to test // the _RWSTD_NO_CLASS_PARTIAL_SPEC feature test macro below. # include <Cstd/stdcomp.h> -#endif /* __SUNPRO_CC <= 0x5100 */ +#endif /* __SUNPRO_CC <= 0x5110 */ #if (defined (_MSC_VER) && (_MSC_VER <= 1310) && defined (_WIN64)) \ || defined (ACE_HAS_BROKEN_STD_REVERSE_ITERATOR) // VC 7.1 and the latest 64-bit platform SDK still don't define a standard @@ -137,7 +131,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL typedef std::reverse_iterator<iterator, value_type> reverse_iterator; \ typedef std::reverse_iterator<const_iterator, \ value_type const> const_reverse_iterator; -#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5100 \ +#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x5120 \ && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) # define ACE_DECLARE_STL_REVERSE_ITERATORS \ typedef std::reverse_iterator<iterator, \ diff --git a/dep/acelite/ace/config-lynxos.h b/dep/acelite/ace/config-lynxos.h index cd217465685..e0d5f4d1cf5 100644 --- a/dep/acelite/ace/config-lynxos.h +++ b/dep/acelite/ace/config-lynxos.h @@ -1,4 +1,4 @@ -// $Id: config-lynxos.h 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: config-lynxos.h 94274 2011-06-29 07:59:12Z mcorino $ // The following configuration file is designed to work for LynxOS, // version 4.0.0 and later, using the GNU g++ compiler. @@ -14,29 +14,23 @@ #include <param.h> #undef __FREEBSDCODE__ -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ +#include "ace/config-g++-common.h" // Compile using multi-thread libraries. #if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 +# define ACE_MT_SAFE 1 #endif #include "ace/config-posix.h" #if defined (__x86__) -# define ACE_HAS_PENTIUM +# define ACE_HAS_PENTIUM #elif defined (__powerpc__) - // It looks like the default stack size is 15000. - // ACE's Recursive_Mutex_Test needs more. -# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 - // This doesn't work on LynxOS 3.0.0, because it resets the TimeBaseRegister. - // # define ACE_HAS_POWERPC_TIMER + // It looks like the default stack size is 15000. + // ACE's Recursive_Mutex_Test needs more. +# define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 + // This doesn't work on LynxOS 3.0.0, because it resets the TimeBaseRegister. + // # define ACE_HAS_POWERPC_TIMER #endif /* __x86__ || __powerpc__ */ #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R @@ -72,10 +66,14 @@ #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_HAS_NONCONST_SETRLIMIT #define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_POSIX_TIME +#define ACE_HAS_PTHREADS_UNIX98_EXT +#define ACE_HAS_PTHREAD_GETCONCURRENCY +#define ACE_HAS_PTHREAD_SETCONCURRENCY +#define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS +#define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SCANDIR #define ACE_HAS_SIGACTION_CONSTP2 #define ACE_HAS_SIGINFO_T @@ -96,28 +94,21 @@ #define ACE_HAS_SYS_FILIO_H #define ACE_HAS_SYS_SOCKIO_H #define ACE_HAS_TERMIOS +#define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_TIMEZONE_GETTIMEOFDAY #define ACE_LACKS_ALPHASORT_PROTOTYPE -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_GETPGID #define ACE_LACKS_ISCTYPE #define ACE_LACKS_MADVISE -#define ACE_LACKS_MKSTEMP_PROTOTYPE -#define ACE_LACKS_MKTEMP_PROTOTYPE -#define ACE_LACKS_PUTENV_PROTOTYPE +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS #define ACE_LACKS_REALPATH -#define ACE_LACKS_RLIMIT_NOFILE -#define ACE_LACKS_RWLOCK_T #define ACE_LACKS_SCANDIR_PROTOTYPE -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETEUID #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_STRPTIME -#define ACE_LACKS_SWAB_PROTOTYPE +#define ACE_LACKS_SUSECONDS_T #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_STD_WSTRING #define ACE_DEFAULT_BASE_ADDR ((char *) 0) #define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS @@ -129,66 +120,68 @@ // LynxOS has poll.h but it is unusable since implementation is not provided #define ACE_LACKS_POLL_H -#if ACE_MT_SAFE == 1 - // Platform supports threads. -# define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD -# define ACE_HAS_PTHREADS_UNIX98_EXT -# define ACE_HAS_PTHREAD_GETCONCURRENCY -# define ACE_HAS_PTHREAD_SETCONCURRENCY -# define ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE -# define ACE_HAS_THREAD_SPECIFIC_STORAGE -# define ACE_LACKS_PTHREAD_ATTR_SETSTACK -# define ACE_LACKS_THREAD_PROCESS_SCOPING -# if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0 -# define ACE_LACKS_SETDETACH -# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR -# endif -#endif /* ACE_MT_SAFE */ +#if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) +# define ACE_HAS_BROKEN_THREAD_KEYFREE +#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ #if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0 -# define ACE_LACKS_GETOPT_PROTOTYPE -# define ACE_LACKS_INET_ATON_PROTOTYPE -# define ACE_LACKS_REGEX_H -# define ACE_LACKS_STRCASECMP_PROTOTYPE -# define ACE_LACKS_STRNCASECMP_PROTOTYPE -# define ACE_LACKS_SYS_SELECT_H +// LynxOS 4.0 +# define ACE_LACKS_GETOPT_PROTOTYPE +# define ACE_LACKS_INET_ATON_PROTOTYPE +# define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR +# define ACE_LACKS_REGEX_H +# define ACE_LACKS_RWLOCK_T +# define ACE_LACKS_SETDETACH +# define ACE_LACKS_STRCASECMP_PROTOTYPE +# define ACE_LACKS_STRNCASECMP_PROTOTYPE +# define ACE_LACKS_SYS_SELECT_H +# define ACE_LACKS_THREAD_PROCESS_SCOPING #endif #if (ACE_LYNXOS_MAJOR > 4) || (ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR >= 2) -// LynxOS 4.2 additons -# define ACE_HAS_POSIX_SEM_TIMEOUT -# define ACE_HAS_MUTEX_TIMEOUTS +// LynxOS 4.2 and 5.0 +# define ACE_HAS_POSIX_SEM_TIMEOUT +# define ACE_HAS_MUTEX_TIMEOUTS #endif -#if (ACE_LYNXOS_MAJOR >=5) -// LynxOS 5.0 Additons -# define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -# define ACE_HAS_NONCONST_INET_ADDR -# define ACE_LACKS_INET_ATON_PROTOTYPE -# define ACE_LACKS_SEMBUF_T -# define ACE_LACKS_STROPTS_H -# define ACE_LACKS_STRRECVFD -# define ACE_LACKS_SYS_SEM_H -# define ACE_SYS_SIGLIST __sys_siglist -#else -// LynxOS 5.0 Removals +#if (ACE_LYNXOS_MAJOR < 5) +// LynxOS 4.x +# define ACE_HAS_LYNXOS4_GETPWNAM_R # define ACE_HAS_LYNXOS4_SIGNALS # define ACE_HAS_SEMUN # define ACE_HAS_STRBUF_T # define ACE_HAS_SYSV_IPC +# define ACE_LACKS_CONST_TIMESPEC_PTR +# define ACE_LACKS_GETPGID # define ACE_LACKS_ISBLANK +# define ACE_LACKS_MKSTEMP_PROTOTYPE +# define ACE_LACKS_MKTEMP_PROTOTYPE +# define ACE_LACKS_PTHREAD_ATTR_SETSTACK +# define ACE_LACKS_PUTENV_PROTOTYPE +# define ACE_LACKS_SETEGID # define ACE_LACKS_SETENV +# define ACE_LACKS_SETEUID +# define ACE_LACKS_SWAB_PROTOTYPE # define ACE_LACKS_UNSETENV # define ACE_LACKS_USECONDS_T # define ACE_LACKS_VSNPRINTF # define ACE_LACKS_WCHAR_H # define ACE_SYS_SIGLIST sys_siglist +# if !defined (ACE_HAS_THREADS) +# undef ACE_HAS_AIO_CALLS +# endif +#else +// LynxOS 5.0 +# define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES +# define ACE_HAS_NONCONST_INET_ADDR +# define ACE_LACKS_INET_ATON_PROTOTYPE +# define ACE_LACKS_SEMBUF_T +# define ACE_LACKS_STROPTS_H +# define ACE_LACKS_STRRECVFD +# define ACE_LACKS_SYS_SEM_H +# define ACE_SYS_SIGLIST __sys_siglist #endif -#if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) -# define ACE_HAS_BROKEN_THREAD_KEYFREE -#endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ - #include /**/ "ace/post.h" + #endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-macosx-iphone-hardware.h b/dep/acelite/ace/config-macosx-iOS-hardware.h index 6201d8e824b..927dacd74b1 100644 --- a/dep/acelite/ace/config-macosx-iphone-hardware.h +++ b/dep/acelite/ace/config-macosx-iOS-hardware.h @@ -1,15 +1,15 @@ -// $Id: config-macosx-iphone-hardware.h 88739 2010-01-27 05:35:23Z sowayaa $ +// $Id: config-macosx-iOS-hardware.h 95319 2011-12-13 14:54:44Z mhengstmengel $ #ifndef ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H #define ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H #define ACE_HAS_IPHONE #define ACE_SIZEOF_LONG_DOUBLE 8 -#include "ace/config-macosx-snowleopard.h" +#include "ace/config-macosx-lion.h" #ifdef ACE_HAS_SYSV_IPC #undef ACE_HAS_SYSV_IPC #endif -#endif ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H +#endif /* ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H */ diff --git a/dep/acelite/ace/config-macosx-iOS-simulator.h b/dep/acelite/ace/config-macosx-iOS-simulator.h new file mode 100644 index 00000000000..73d7e90a17e --- /dev/null +++ b/dep/acelite/ace/config-macosx-iOS-simulator.h @@ -0,0 +1,9 @@ +// $Id: config-macosx-iOS-simulator.h 94431 2011-08-31 11:36:49Z sowayaa $ +#ifndef ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H +#define ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H + +#define ACE_HAS_IPHONE +#include "ace/config-macosx-lion.h" + +#endif /* ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H */ + diff --git a/dep/acelite/ace/config-macosx-iphone-simulator.h b/dep/acelite/ace/config-macosx-iphone-simulator.h deleted file mode 100644 index 024cf8480a3..00000000000 --- a/dep/acelite/ace/config-macosx-iphone-simulator.h +++ /dev/null @@ -1,9 +0,0 @@ -// $Id: config-macosx-iphone-simulator.h 88653 2010-01-21 23:19:50Z sowayaa $ -#ifndef ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H -#define ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H - -#define ACE_HAS_IPHONE -#include "ace/config-macosx-snowleopard.h" - -#endif ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H - diff --git a/dep/acelite/ace/config-macosx-leopard.h b/dep/acelite/ace/config-macosx-leopard.h index 5fb28c338f3..42229ebd2d4 100644 --- a/dep/acelite/ace/config-macosx-leopard.h +++ b/dep/acelite/ace/config-macosx-leopard.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-macosx-leopard.h 91688 2010-09-09 11:21:50Z johnnyw $ +// $Id: config-macosx-leopard.h 96085 2012-08-21 02:48:37Z mesnier_p $ // This configuration file is designed to work with the MacOS X operating system. @@ -176,7 +176,6 @@ # define ACE_HAS_THREADS // And they're even POSIX pthreads # define ACE_HAS_PTHREADS -# define ACE_HAS_PTHREADS_STD # define ACE_HAS_PTHREAD_SCHEDPARAM # define ACE_HAS_THREAD_SPECIFIC_STORAGE #endif /* ACE_MT_SAFE == 1 */ @@ -205,6 +204,7 @@ #define ACE_HAS_VOID_UNSETENV #endif +#define ACE_LACKS_CONDATTR_SETCLOCK // dlcompat package (not part of base Darwin) is needed for dlopen(). // You may download directly from sourceforge and install or use fink diff --git a/dep/acelite/ace/config-macosx-lion.h b/dep/acelite/ace/config-macosx-lion.h new file mode 100644 index 00000000000..e4a56ae4ebc --- /dev/null +++ b/dep/acelite/ace/config-macosx-lion.h @@ -0,0 +1,19 @@ +// $Id: config-macosx-lion.h 94764 2011-10-15 01:02:57Z sowayaa $ +#ifndef ACE_CONFIG_MACOSX_LION_H +#define ACE_CONFIG_MACOSX_LION_H + + +#include "ace/config-macosx-leopard.h" + +#ifdef __clang__ +#ifdef ACE_HAS_GCC_ATOMIC_BUILTINS +#undef ACE_HAS_GCC_ATOMIC_BUILTINS +#endif + +#define ACE_ANY_OPS_USE_NAMESPACE + +#endif + +#define ACE_LACKS_UCONTEXT_H + +#endif // ACE_CONFIG_MACOSX_LION_H diff --git a/dep/acelite/ace/config-macosx.h b/dep/acelite/ace/config-macosx.h index 12b69de3b72..e39e27e0e73 100644 --- a/dep/acelite/ace/config-macosx.h +++ b/dep/acelite/ace/config-macosx.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-macosx.h 91693 2010-09-09 12:57:54Z johnnyw $ +// $Id: config-macosx.h 93359 2011-02-11 11:33:12Z mcorino $ // This configuration file is designed to work with the MacOS X operating system, version 10.2 (Jaguar). @@ -51,6 +51,8 @@ #define ACE_LACKS_GETPGID #define ACE_LACKS_RWLOCK_T +#define ACE_HAS_SIOCGIFCONF + // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT diff --git a/dep/acelite/ace/config-macros.h b/dep/acelite/ace/config-macros.h index d81156e9480..32e58947e9a 100644 --- a/dep/acelite/ace/config-macros.h +++ b/dep/acelite/ace/config-macros.h @@ -4,7 +4,7 @@ /** * @file config-macros.h * - * $Id: config-macros.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: config-macros.h 94386 2011-08-10 12:42:53Z johnnyw $ * * @author (Originally in OS.h)Doug Schmidt <schmidt@cs.wustl.edu> * @author Jesper S. M|ller<stophph@diku.dk> @@ -69,9 +69,6 @@ # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) # define ACE_MT(X) X -# if !defined (_REENTRANT) -# define _REENTRANT -# endif /* _REENTRANT */ # else # define ACE_MT(X) # endif /* ACE_MT_SAFE */ @@ -82,6 +79,7 @@ # if defined (ACE_HAS_VALGRIND) # define ACE_INITIALIZE_MEMORY_BEFORE_USE +# define ACE_LACKS_DLCLOSE # endif /* ACE_HAS_VALGRIND */ // ========================================================================= @@ -499,8 +497,16 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \ #define ACE_HAS_TEMPLATE_TYPEDEFS #endif +#ifndef ACE_GCC_FORMAT_ATTRIBUTE +# define ACE_GCC_FORMAT_ATTRIBUTE(TYPE, STR_INDEX, FIRST_INDEX) +#endif + #ifndef ACE_DEPRECATED # define ACE_DEPRECATED #endif +#ifndef ACE_HAS_REACTOR_NOTIFICATION_QUEUE +# define ACE_HAS_REACTOR_NOTIFICATION_QUEUE +#endif + #endif /* ACE_CONFIG_MACROS_H */ diff --git a/dep/acelite/ace/config-minimal.h b/dep/acelite/ace/config-minimal.h deleted file mode 100644 index 4cf2e8a487b..00000000000 --- a/dep/acelite/ace/config-minimal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-minimal.h 80826 2008-03-04 14:51:23Z wotte $ - -// This configuration file is designed to build only the minimal -// ACE_OS adaptation layer. - -#ifndef ACE_CONFIG_MINIMAL_H -#define ACE_CONFIG_MINIMAL_H -#include /**/ "ace/pre.h" - -#define ACE_HAS_MINIMAL_ACE_OS - -// Only instantiate the ACE_OS_Object_Manager. -#define ACE_MAIN_OBJECT_MANAGER \ - ACE_OS_Object_Manager ace_os_object_manager; - -#if !defined(ACE_USE_THREAD_MANAGER_ADAPTER) - // To prevent use of ACE_Thread_Exit functions in - // ACE_Thread_Adapter::invoke (). -# define ACE_USE_THREAD_MANAGER_ADAPTER -#endif /* ! ACE_USE_THREAD_MANAGER_ADAPTER */ - -#if defined (ACE_ASSERT) -# undef ACE_ASSERT -#endif /* ACE_ASSERT */ -#define ACE_ASSERT(x) - -#if defined (ACE_DEBUG) -# undef ACE_DEBUG -#endif /* ACE_DEBUG */ -#define ACE_DEBUG(x) - -#if defined (ACE_ERROR) -# undef ACE_ERROR -#endif /* ACE_ERROR */ -#define ACE_ERROR(x) - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_MINIMAL_H */ diff --git a/dep/acelite/ace/config-mvs.h b/dep/acelite/ace/config-mvs.h deleted file mode 100644 index ce2971025a0..00000000000 --- a/dep/acelite/ace/config-mvs.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-mvs.h 92102 2010-09-30 08:14:15Z johnnyw $ - -// Config file for MVS with OpenEdition - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -// The following #defines are hacks to get around things -// that seem to be missing or different in MVS land -#define MAXPATHLEN 1024 /* sys/param.h not on MVS */ -#define NSIG 44 /* missing from Signal.h */ -#define MAXHOSTNAMELEN 256 /* missing form netdb.h */ -#define howmany __howmany /* MVS uses different names than most others */ -#define MAXNAMLEN __DIR_NAME_MAX -#if defined (log) /* log is a macro in math.h */ -# undef log /* conflicts with log function in ACE */ -#endif /* log */ - -#define ACE_MVS - -// Preprocesor requires an extra argument -#define ACE_CC_PREPROCESSOR_ARGS "-+ -E" - -// See the README file in this directory -// for a description of the following ACE_ macros - -#if __COMPILER_VER__ >= 0x21020000 /* OS/390 r2 or higher */ -# define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -# define ACE_HAS_UCONTEXT_T -#else /* __COMPILER_VER__ < 0x21020000 */ -# define ACE_LACKS_UCONTEXT_H -#endif /* __COMPILER_VER__ < 0x21020000 */ - -#if __COMPILER_VER__ < 0x22060000 /* before OS/390 r2.6 */ -# define ACE_LACKS_LONGLONG_T -#endif /* __COMPILER_VER__ < 0x22060000 */ - -#define ERRMAX __sys_nerr - -#define ACE_HAS_3_PARAM_WCSTOK -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_LIMITED_RUSAGE_T -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONSCALAR_THREAD_KEY_T -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SIG_C_FUNC -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STRINGS -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UTIME -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_INET_ATON -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_IOSTREAM_FX -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_PARAM_H -#define ACE_LACKS_SYS_PARAM_H -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_READDIR_R -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SCHED_H -#define ACE_LACKS_SETSCHED -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_SYSCTL_H -#define ACE_LACKS_SYSTIME_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_TCP_H -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_FD_MASK - -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_NEEDS_DEV_IO_CONVERSION - -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 16 -#define ACE_HAS_EBCDIC - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000) -#define IN_MULTICAST(a) IN_CLASSD(a) -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-netbsd.h b/dep/acelite/ace/config-netbsd.h index 242b3af700a..227c10832a2 100644 --- a/dep/acelite/ace/config-netbsd.h +++ b/dep/acelite/ace/config-netbsd.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-netbsd.h 91285 2010-08-05 08:29:30Z johnnyw $ +// $Id: config-netbsd.h 93530 2011-03-11 12:12:40Z olli $ #ifndef ACE_CONFIG_H #define ACE_CONFIG_H @@ -48,7 +48,6 @@ #define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 #define ACE_HAS_ONLY_SCHED_OTHER 1 #define ACE_HAS_POLL 1 -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 #define ACE_HAS_POSIX_NONBLOCK 1 #define ACE_HAS_POSIX_TIME 1 #define ACE_HAS_P_READ_WRITE 1 @@ -69,7 +68,6 @@ #define ACE_HAS_SOCKLEN_T 1 #define ACE_HAS_SSIZE_T 1 #define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 #define ACE_HAS_STRINGS 1 #define ACE_HAS_STRING_CLASS 1 #define ACE_HAS_SVR4_DYNAMIC_LINKING 1 @@ -105,7 +103,6 @@ #define ACE_LACKS_PRI_T 1 #define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 #define ACE_LACKS_PTHREAD_YIELD 1 -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 #define ACE_LACKS_RWLOCKATTR_PSHARED 1 #define ACE_LACKS_RWLOCK_T 1 #define ACE_LACKS_SETSCHED 1 diff --git a/dep/acelite/ace/config-openbsd.h b/dep/acelite/ace/config-openbsd.h index aab03106aab..a4039d556a8 100644 --- a/dep/acelite/ace/config-openbsd.h +++ b/dep/acelite/ace/config-openbsd.h @@ -1,61 +1,22 @@ /* -*- C++ -*- */ -// $Id: config-openbsd.h 89494 2010-03-15 20:11:18Z olli $ +// $Id: config-openbsd.h 93613 2011-03-22 09:27:38Z olli $ // The following configuration file is designed to work for OpenBSD -// platforms using GNU g++. #ifndef ACE_CONFIG_H -# define ACE_CONFIG_H +#define ACE_CONFIG_H #include /**/ "ace/pre.h" +#if !defined (ACE_MT_SAFE) +# define ACE_MT_SAFE 1 +#endif + // Platform specific directives -// gcc defines __OpenBSD__ automatically for us. #include <sys/param.h> -#if defined (ACE_HAS_THREADS) -# include /**/ <pthread.h> -#endif /* ACE_HAS_THREADS */ - #include "ace/config-posix.h" -#if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* !__ACE_INLINE__ */ - -#if defined (__GNUG__) -# include "ace/config-g++-common.h" -#endif /* __GNUG__ */ - - -#if defined (ACE_HAS_THREADS) - -# if !defined (_THREAD_SAFE) -# define _THREAD_SAFE -# endif /* _THREAD_SAFE */ - -// And they're even POSIX pthreads -# if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -# endif /* ! ACE_MT_SAFE */ - - -// Check if pthreads and native exceptions are being used together. -// This causes SEGVs to tbe thrown somewhat randomly for some -// reason. According to newsgroup postings, it appears to be an -// OpenBSD or gcc bug. -# if defined (ACE_USES_NATIVE_EXCEPTIONS) -# error "OpenBSD pthreads and native exceptions currently do not work. See OpenBSD bug #1750" -# endif /* ACE_USES_NATIVE_EXCEPTIONS */ - -#else -// OpenBSD really has readdir_r () in single threaded mode, -// but the #ifdefs in OS.i select one with the wrong parameter -// sets if the ACE_HAS_POSIX_STD isn't defined (which is defined -// when ACE_HAS_THREADS is defined.) -# define ACE_LACKS_READDIR_R - -#endif /* ACE_HAS_THREADS */ - +#include "ace/config-g++-common.h" #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R #define ACE_HAS_3_PARAM_READDIR_R @@ -86,11 +47,8 @@ #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_HAS_NONCONST_SWAB #define ACE_HAS_POLL -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -#define ACE_HAS_POSIX_GETPWNAM_R #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS_STD #define ACE_HAS_PTHREADS_UNIX98_EXT #define ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP #define ACE_HAS_PTHREAD_GETCONCURRENCY @@ -137,47 +95,19 @@ #define ACE_HAS_VOID_UNSETENV #define ACE_HAS_WCHAR #define ACE_HAS_XPG4_MULTIBYTE_CHAR +#define ACE_HAS_SYS_SIGINFO_H -#define ACE_LACKS_CONDATTR_PSHARED #define ACE_LACKS_GETIPNODEBYADDR #define ACE_LACKS_GETIPNODEBYNAME -#define ACE_LACKS_GETPGID -#define ACE_LACKS_IOSTREAM_FX #define ACE_LACKS_ISCTYPE -#define ACE_LACKS_ITOW -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_LOG2 -#define ACE_LACKS_MALLOC_H -#define ACE_LACKS_MSG_ACCRIGHTS -#define ACE_LACKS_MUTEXATTR_PSHARED +#define ACE_LACKS_ISWASCII #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS #define ACE_LACKS_PERFECT_MULTICAST_FILTERING -#define ACE_LACKS_PRI_T -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS -#define ACE_LACKS_RLIMIT_PROTOTYPE -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SETPGID -#define ACE_LACKS_SETREGID -#define ACE_LACKS_SETREUID #define ACE_LACKS_SETSCHED -#define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_STDINT_H #define ACE_LACKS_STROPTS_H #define ACE_LACKS_STRRECVFD -#define ACE_LACKS_TERMIO_H -#define ACE_LACKS_THREAD_PROCESS_SCOPING -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UNBUFFERED_STREAMBUF -#define ACE_LACKS_U_LONGLONG_T -#define ACE_LACKS_WCHAR_H -#define ACE_LACKS_WCSCASECMP -#define ACE_LACKS_WCSDUP -#define ACE_LACKS_WCSNCASECMP -#define ACE_LACKS_WCSNICMP #define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS #define ACE_PAGE_SIZE 4096 @@ -186,23 +116,26 @@ // OpenBSD 3.6 #if (OpenBSD < 200411) -# define ACE_USES_ASM_SYMBOL_IN_DLSYM +# define ACE_USES_ASM_SYMBOL_IN_DLSYM #endif // ucontext_t is in OpenBSD 3.5 and later. #if (OpenBSD >= 200405) -# define ACE_HAS_UCONTEXT_T +# define ACE_HAS_UCONTEXT_T #endif /* OpenBSD >= 200405 */ // Lacks perfect filtering, must bind group address. #if !defined ACE_LACKS_PERFECT_MULTICAST_FILTERING -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING #endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ // OpenBSD's dlsym call segfaults when passed an invalid handle. // It seems as if most other OSs detect this and just report an error. #define ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE +#define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" + #include /**/ "ace/post.h" #endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-openvms.h b/dep/acelite/ace/config-openvms.h index 33e2ff52d7a..91762386fc0 100644 --- a/dep/acelite/ace/config-openvms.h +++ b/dep/acelite/ace/config-openvms.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-openvms.h 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: config-openvms.h 94294 2011-07-01 09:32:25Z johnnyw $ // The following configuration file is designed to work for OpenVMS 7.3-2 @@ -87,9 +87,6 @@ #define ACE_LACKS_SYMLINKS 1 -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS 1 - #define ACE_HAS_P_READ_WRITE #define ACE_HAS_CHARPTR_DL 1 #define ACE_HAS_CLOCK_GETTIME 1 @@ -189,4 +186,7 @@ #define ACE_LACKS_SETENV #define ACE_LACKS_UNSETENV +#define ACE_HAS_SOCK_BUF_SIZE_MAX +#define ACE_HAS_SOCK_BUF_SIZE_MAX_VALUE 65535 + #endif diff --git a/dep/acelite/ace/config-qnx-neutrino.h b/dep/acelite/ace/config-qnx-neutrino.h deleted file mode 100644 index 8ba1b97e4c2..00000000000 --- a/dep/acelite/ace/config-qnx-neutrino.h +++ /dev/null @@ -1,136 +0,0 @@ -// -*- C++ -*- -// $Id: config-qnx-neutrino.h 92120 2010-10-01 12:00:01Z johnnyw $ -// The following configuration file is designed to work for Neutrino -// 2.0 (Beta) with GNU C++ and the POSIX (pthread) threads package. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define _POSIX_C_SOURCE 199506 -#define _QNX_SOURCE - -// These constants are in i386-nto/include/limits.h, but egcs -// picks up its own limits.h instead: -#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ -#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ - -#if defined(__OPTIMIZE__) -# if defined(__X86__) - // string.h can't be used by ACE with __OPTIMIZE__. -# undef __OPTIMIZE__ -# include <string.h> -# define __OPTIMIZE__ -# endif /* __X86__ */ -#endif /* __OPTIMIZE__ */ - -// The following defines the Neutrino compiler. -// gcc should know to call g++ as necessary -#ifdef __GNUC__ -# define ACE_CC_NAME ACE_TEXT ("gcc") -#else -# define ACE_CC_NAME ACE_TEXT ("NTO compiler ??") -#endif - -#include "ace/config-g++-common.h" - -// /usr/nto/include/float.h defines -// FLT_MAX_EXP 127 -// DBL_MAX_EXP 1023 -// ace expects 128 & 1024 respectively -// to set the following macros in ace/Basic_Types.h -// These macros are: -// #define ACE_SIZEOF_DOUBLE 8 -// #define ACE_SIZEOF_FLOAT 4 - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_INLINED_OSCALLS -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONCONST_SWAB -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRINGS -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_CUSERID -#define ACE_LACKS_FORK -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_POLL_H -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SO_SNDBUF -#define ACE_LACKS_SO_RCVBUF -#define ACE_LACKS_SOCKETPAIR -#define ACE_LACKS_STROPTS_H -#define ACE_LACKS_STREAM_MODULES -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_TCP_NODELAY -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_T_ERRNO -#define ACE_LACKS_UALARM_PROTOTYPE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_U_LONGLONG_T -#define ACE_MT_SAFE 1 -#define ACE_NEEDS_FUNC_DEFINITIONS -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 65536 -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_THR_PRI_FIFO_DEF 10 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-qnx-rtp-common.h b/dep/acelite/ace/config-qnx-rtp-common.h deleted file mode 100644 index 9d9e0aced4e..00000000000 --- a/dep/acelite/ace/config-qnx-rtp-common.h +++ /dev/null @@ -1,50 +0,0 @@ -// -*- C++ -*- -// $Id: config-qnx-rtp-common.h 92120 2010-10-01 12:00:01Z johnnyw $ -// several macros common to various qnx neutrino version. - -#ifndef ACE_CONFIG_QNX_RTP_COMMON_H -#define ACE_CONFIG_QNX_RTP_COMMON_H -#include /**/ "ace/pre.h" - -#define _POSIX_C_SOURCE 199506 -#define _QNX_SOURCE - -// These constants are in i386-nto/include/limits.h, but egcs -// picks up its own limits.h instead: -#define _POSIX_NAME_MAX 14 /* Max bytes in a filename */ -#define _POSIX_PATH_MAX 256 /* Num. bytes in pathname (excl. NULL) */ - -#if defined(__OPTIMIZE__) -# if defined(__X86__) - // string.h can't be used by ACE with __OPTIMIZE__. -# undef __OPTIMIZE__ -# include <string.h> -# define __OPTIMIZE__ -# endif /* __X86__ */ -#endif /* __OPTIMIZE__ */ - -// The following defines the Neutrino compiler. -// gcc should know to call g++ as necessary -#ifdef __GNUC__ -# define ACE_CC_NAME ACE_TEXT ("gcc") -#else -# define ACE_CC_NAME ACE_TEXT ("QNX-RTP compiler ??") -#endif - -#include "ace/config-g++-common.h" - -// /usr/nto/include/float.h defines -// FLT_MAX_EXP 127 -// DBL_MAX_EXP 1023 -// ace expects 128 & 1024 respectively -// to set the following macros in ace/Basic_Types.h -// These macros are: -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_FLOAT 4 - -// At least qnx 6.3.2 uses a void return for unsetenv -// This assumes that older versions do too. -#define ACE_HAS_VOID_UNSETENV - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_COMMON_H */ diff --git a/dep/acelite/ace/config-qnx-rtp-pre62x.h b/dep/acelite/ace/config-qnx-rtp-pre62x.h deleted file mode 100644 index 504d3a3ac09..00000000000 --- a/dep/acelite/ace/config-qnx-rtp-pre62x.h +++ /dev/null @@ -1,152 +0,0 @@ -// -*- C++ -*- -// $Id: config-qnx-rtp-pre62x.h 87167 2009-10-19 19:33:53Z olli $ -// The following configuration file is designed to work for QNX RTP -// GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com - -#ifndef ACE_CONFIG_RTP_PRE62x_H -#define ACE_CONFIG_RTP_PRE62x_H -#include /**/ "ace/pre.h" -#include /**/ "ace/config-qnx-rtp-common.h" - -///////////////////////////////////////////////////////////////// -// Definition of the features that are available. -// -// ACE_HAS Section -///////////////////////////////////////////////////////////////// - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA -#define ACE_HAS_ALLOCA_H -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_DIRENT -#define ACE_HAS_GETPAGESIZE -// Enable gperf, this is a hosted configuration. -#define ACE_HAS_GPERF -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#define ACE_HAS_INLINED_OSCALLS -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_MSG -#define ACE_HAS_MT_SAFE_MKTIME -#define ACE_HAS_MUTEX_TIMEOUTS -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_POSIX_SEM -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS -#define ACE_HAS_P_READ_WRITE -#define ACE_HAS_REENTRANT_FUNCTIONS -#define ACE_HAS_SELECT_H -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIGISMEMBER_BUG -#define ACE_HAS_SIGWAIT -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SOCKADDR_IN_SIN_LEN -// #define ACE_HAS_SIZET_SOCKET_LEN -#define ACE_HAS_SOCKLEN_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRINGS -#define ACE_HAS_SVR4_GETTIMEOFDAY -#define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_HAS_THR_C_DEST -#define ACE_HAS_THR_C_FUNC -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_HAS_VOIDPTR_MMAP -#define ACE_HAS_VOIDPTR_SOCKOPT - -///////////////////////////////////////////////////////////////// -// Definition of the features that are not available. -// -// ACE_LACKS Section -///////////////////////////////////////////////////////////////// -#define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_LINEBUFFERED_STREAMBUF -#define ACE_LACKS_MADVISE -#define ACE_LACKS_MUTEXATTR_PSHARED -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_LACKS_RWLOCK_T -#define ACE_LACKS_SBRK -#define ACE_LACKS_SEEKDIR -#define ACE_LACKS_SO_SNDBUF -#define ACE_LACKS_SO_RCVBUF -#define ACE_LACKS_SOCKETPAIR -// Even if the QNX RTP docs says that socket pair are -// available, there is actually no implementation of -// soket-pairs. -#define ACE_LACKS_STREAM_MODULES -#define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_SYSV_SHMEM -#define ACE_LACKS_ALPHASORT -//#define ACE_LACKS_TCP_NODELAY // Based on the QNX RTP documentation, this option seems to - // to be supported. -#define ACE_LACKS_TELLDIR -#define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_TRUNCATE -#define ACE_LACKS_T_ERRNO -#define ACE_LACKS_UALARM_PROTOTYPE -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_U_LONGLONG_T -#define ACE_LACKS_FD_MASK -#define ACE_LACKS_NFDBITS - -#define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. - -#define ACE_MT_SAFE 1 -#define ACE_NEEDS_FUNC_DEFINITIONS -#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 -#define ACE_TEMPLATES_REQUIRE_SOURCE -#define ACE_THR_PRI_FIFO_DEF 10 -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -#define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 - -#define ACE_SIZEOF_WCHAR 4 - -// Not really, but the prototype returns wchar_t instead of wchar_t * -#define ACE_LACKS_WCSSTR - -// No prototypes -#define ACE_LACKS_ITOW -#define ACE_LACKS_WCSICMP -#define ACE_LACKS_WCSNICMP -#define ACE_LACKS_WCSDUP - -// And these have prototypes but no implementation -#define ACE_LACKS_WCSLEN -#define ACE_LACKS_WCSNCMP -#define ACE_LACKS_WCSCPY -#define ACE_LACKS_WCSNCPY -#define ACE_LACKS_TOWLOWER -#define ACE_LACKS_TOWUPPER -#define ACE_LACKS_WCSCMP -#define ACE_LACKS_WCSCAT -#define ACE_LACKS_WCSNCAT -#define ACE_LACKS_WCSSPN -#define ACE_LACKS_WCSCHR -#define ACE_LACKS_WCSPBRK -#define ACE_LACKS_WCSRCHR - -#define ACE_LACKS_ACE_IOSTREAM - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_RTP_PRE62x_H */ diff --git a/dep/acelite/ace/config-qnx-rtp.h b/dep/acelite/ace/config-qnx-rtp.h deleted file mode 100644 index 02ee89bc5ef..00000000000 --- a/dep/acelite/ace/config-qnx-rtp.h +++ /dev/null @@ -1,25 +0,0 @@ -// -*- C++ -*- -// $Id: config-qnx-rtp.h 91743 2010-09-13 18:24:51Z johnnyw $ -// The following configuration file is designed to work for QNX RTP -// GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com. -// This header is intended to switch between configuration for -// various NTO versions. -#ifndef ACE_CONFIG_QNX_RTP_H -#define ACE_CONFIG_QNX_RTP_H -#include /**/ "ace/pre.h" - -#include <sys/neutrino.h> -#if !defined(_NTO_VERSION) -# error "Could not detect QNX version from macro _NTO_VERSION" -#else -# define ACE_NTO_VERS _NTO_VERSION -# if ACE_NTO_VERS < 620 -# include /**/ "ace/config-qnx-rtp-pre62x.h" -# else -# include /**/ "ace/config-qnx-rtp-62x.h" -# endif -#endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_H */ diff --git a/dep/acelite/ace/config-qnx-rtp-62x.h b/dep/acelite/ace/config-qnx.h index 7fa7514a1c8..73353d4ffa7 100644 --- a/dep/acelite/ace/config-qnx-rtp-62x.h +++ b/dep/acelite/ace/config-qnx.h @@ -1,12 +1,43 @@ // -*- C++ -*- -// $Id: config-qnx-rtp-62x.h 87167 2009-10-19 19:33:53Z olli $ -// The following configuration file is designed to work for QNX RTP 621 +// $Id: config-qnx.h 94293 2011-07-01 08:47:39Z mcorino $ +// The following configuration file is designed to work for QNX RTP // GNU C++ and the POSIX (pthread) threads package. You can get QNX -// RTP at http://get.qnx.com -#ifndef ACE_CONFIG_QNX_RTP_62x_H -#define ACE_CONFIG_QNX_RTP_62x_H +// RTP at http://get.qnx.com. +// This header is intended to switch between configuration for +// various NTO versions. +#ifndef ACE_CONFIG_QNX_H +#define ACE_CONFIG_QNX_H #include /**/ "ace/pre.h" -#include /**/ "ace/config-qnx-rtp-common.h" + +#include <sys/neutrino.h> +#if !defined(_NTO_VERSION) +# error "Could not detect QNX version from macro _NTO_VERSION" +#endif + +#define _POSIX_C_SOURCE 199506 + +// The following defines the Neutrino compiler. +// gcc should know to call g++ as necessary +#ifdef __GNUC__ +# define ACE_CC_NAME ACE_TEXT ("gcc") +#else +# define ACE_CC_NAME ACE_TEXT ("QNX-RTP compiler ??") +#endif + +#include "ace/config-g++-common.h" + +// /usr/nto/include/float.h defines +// FLT_MAX_EXP 127 +// DBL_MAX_EXP 1023 +// ace expects 128 & 1024 respectively +// to set the following macros in ace/Basic_Types.h +// These macros are: +#define ACE_SIZEOF_DOUBLE 8 +#define ACE_SIZEOF_FLOAT 4 + +// At least qnx 6.3.2 uses a void return for unsetenv +// This assumes that older versions do too. +#define ACE_HAS_VOID_UNSETENV ///////////////////////////////////////////////////////////////// // Definition of the features that are available. @@ -30,10 +61,8 @@ #define ACE_HAS_DIRENT #define ACE_HAS_GETPAGESIZE #define ACE_HAS_GETIFADDRS -// Enable gperf, this is a hosted configuration. #define ACE_HAS_GPERF #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -//#define ACE_HAS_NONSTATIC_OBJECT_MANAGER #define ACE_HAS_IP_MULTICAST #define ACE_HAS_MSG #define ACE_HAS_MT_SAFE_MKTIME @@ -42,7 +71,6 @@ #define ACE_HAS_NONCONST_SWAB #define ACE_HAS_POSIX_SEM #define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS #define ACE_HAS_P_READ_WRITE #define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SELECT_H @@ -51,6 +79,7 @@ #define ACE_HAS_SIGISMEMBER_BUG #define ACE_HAS_SIGWAIT #define ACE_HAS_SIG_ATOMIC_T +#define ACE_HAS_SIOCGIFCONF #define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SOCKLEN_T #define ACE_HAS_SSIZE_T @@ -58,7 +87,6 @@ #define ACE_HAS_SVR4_DYNAMIC_LINKING #define ACE_HAS_SVR4_GETTIMEOFDAY #define ACE_HAS_TERMIOS -#define ACE_HAS_THREADS #define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_THR_C_DEST #define ACE_HAS_THR_C_FUNC @@ -67,6 +95,23 @@ #define ACE_HAS_UCONTEXT_T #define ACE_HAS_VOIDPTR_MMAP #define ACE_HAS_VOIDPTR_SOCKOPT +#define ACE_HAS_NET_IF_DL_H +#define ACE_HAS_SYS_SIGINFO_H +#define ACE_HAS_GETTIMEOFDAY 1 +#define ACE_HAS_GETRUSAGE 1 +#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 +#define ACE_HAS_NEW_NO_H 1 +#define ACE_IOCTL_TYPE_ARG2 u_long +#define ACE_HAS_TIMEZONE 1 +#define ACE_HAS_SOCKADDR_MSG_NAME 1 +#define ACE_HAS_SIG_C_FUNC 1 +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN 1 +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#define ACE_HAS_STRING_CLASS 1 +#define ACE_HAS_STRSIGNAL +#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 +#define ACE_HAS_POSIX_NONBLOCK 1 +#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 ///////////////////////////////////////////////////////////////// // Definition of the features that are not available. @@ -76,30 +121,38 @@ #define ACE_LACKS_CONST_TIMESPEC_PTR #define ACE_LACKS_LINEBUFFERED_STREAMBUF #define ACE_LACKS_MADVISE -// lacks mqueue mgr or speed-up named sem by shm emulation -#define ACE_LACKS_NAMED_POSIX_SEM -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS // Multicast_Tests reports for NTO 621 frames from unsubscribed groups #define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 -#define ACE_LACKS_POLL_H -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK #define ACE_LACKS_RWLOCK_T #define ACE_LACKS_SO_SNDBUF #define ACE_LACKS_SO_RCVBUF #define ACE_LACKS_STREAM_MODULES #define ACE_LACKS_STROPTS_H -#define ACE_LACKS_STRPTIME #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_SYS_SHM_H #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_T_ERRNO #define ACE_LACKS_U_LONGLONG_T -#define ACE_LACKS_ALPHASORT -#define ACE_LACKS_FD_MASK -#define ACE_LACKS_NFDBITS +#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS +#define ACE_HAS_SYS_SOCKIO_H 1 +#define ACE_HAS_SYSCTL +#define ACE_HAS_SIGACTION_CONSTP2 1 + +#if _NTO_VERSION < 650 +# define ACE_LACKS_NFDBITS +# define ACE_LACKS_FD_MASK +# define ACE_LACKS_SYS_MSG_H +# define ACE_LACKS_ALPHASORT +# define ACE_LACKS_STRPTIME +# define ACE_LACKS_POLL_H +#else +# define ACE_HAS_POLL 1 +# define ACE_HAS_WCHAR 1 +# define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 +#endif + #define ACE_LACKS_ISCTYPE #define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. @@ -121,11 +174,23 @@ #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP #define ACE_LACKS_WCSDUP +#define ACE_LACKS_STD_WSTRING + +#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +# define ACE_HAS_THREADS +# define ACE_HAS_PTHREADS +# define ACE_HAS_PTHREADS_UNIX98_EXT 1 +# define ACE_LACKS_PTHREAD_THR_SIGSETMASK +# define ACE_HAS_PTHREAD_GETCONCURRENCY +#endif /* ACE_MT_SAFE */ + + // The default value of FD_SETSIZE is 32, but actually x86 NTO // supports by default at least 1000 descriptors in fd_set. #if defined( FD_SETSIZE ) #undef FD_SETSIZE #endif #define FD_SETSIZE 1000 + #include /**/ "ace/post.h" -#endif /* ACE_CONFIG_QNX_RTP_62x_H*/ +#endif /* ACE_CONFIG_QNX_H */ diff --git a/dep/acelite/ace/config-rtems.h b/dep/acelite/ace/config-rtems.h index d113a1434a4..f65893cc57b 100644 --- a/dep/acelite/ace/config-rtems.h +++ b/dep/acelite/ace/config-rtems.h @@ -1,5 +1,5 @@ /* -*- C -*- */ -// $Id: config-rtems.h 87169 2009-10-19 20:26:55Z olli $ +// $Id: config-rtems.h 93571 2011-03-17 07:37:11Z olli $ /* The following configuration file is designed to work for RTEMS platforms using GNU C. @@ -56,7 +56,6 @@ #define ACE_LACKS_MKSTEMP #define ACE_LACKS_STRDUP #define ACE_LACKS_STRTOK_R -#define ACE_LACKS_RAND_REENTRANT_FUNCTIONS #define ACE_LACKS_REALPATH #define ACE_LACKS_TEMPNAM #define ACE_LACKS_TZSET @@ -76,7 +75,6 @@ # define ACE_HAS_PTHREAD_SCHEDPARAM # define ACE_LACKS_THREAD_PROCESS_SCOPING #else -# define ACE_HAS_POSIX_GETPWNAM_R # define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R #endif diff --git a/dep/acelite/ace/config-sco-5.0.0-nothread.h b/dep/acelite/ace/config-sco-5.0.0-nothread.h deleted file mode 100644 index 259bd55c273..00000000000 --- a/dep/acelite/ace/config-sco-5.0.0-nothread.h +++ /dev/null @@ -1,12 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-sco-5.0.0-nothread.h 87268 2009-10-29 21:06:06Z olli $ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-g++-common.h" -#include "ace/config-sco-5.0.0.h" - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-sco-5.0.0.h b/dep/acelite/ace/config-sco-5.0.0.h deleted file mode 100644 index 61b68213bc1..00000000000 --- a/dep/acelite/ace/config-sco-5.0.0.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-sco-5.0.0.h 87167 2009-10-19 19:33:53Z olli $ - -#ifndef ACE_CONFIG_SCO_5_0_0_H -#define ACE_CONFIG_SCO_5_0_0_H -#include /**/ "ace/pre.h" - -// Compiling for SCO. -#if !defined (SCO) -#define SCO -#endif /* SCO */ - -#if defined (SCO) && !defined (MAXPATHLEN) -#define MAXPATHLEN 1023 -#endif /* SCO */ - -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_SYSCALL -#define ACE_LACKS_STRRECVFD -#define ACE_NEEDS_FTRUNCATE -#define ACE_LACKS_MADVISE -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -#define ACE_DEFAULT_CLOSE_ALL_HANDLES 0 - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC -#define ACE_HAS_NONCONST_MSGSND -#define ACE_HAS_BIG_FD_SET -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -// Compiler/platform contains the <sys/syscall.h> file. -//#define ACE_HAS_SYS_SYSCALL_H - -// Fixes a problem with HP/UX not wrapping the mmap(2) header files -// with extern "C". -//#define ACE_HAS_BROKEN_MMAP_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has correctly prototyped header files. -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform supports poll(). -// #define ACE_HAS_POLL - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// Compiler supports the ssize_t typedef. -//#define ACE_HAS_SSIZE_T - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Note, this only works if the flag is set above! -//#define ACE_HAS_GETRUSAGE - -// Platform uses int for select() rather than fd_set. -#define ACE_HAS_SELECT_H - -// Platform has prototypes for ACE_TLI. -#define ACE_HAS_TLI_PROTOTYPES -// Platform has the XLI version of ACE_TLI. -// #define ACE_HAS_XLI - -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -#define ACE_LACKS_STRCASECMP - -// #define ACE_HAS_POSIX_TIME -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_DIRENT -#define ACE_LACKS_READDIR_R -#define ACE_HAS_GPERF - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_SCO_5_0_0_H */ diff --git a/dep/acelite/ace/config-sunos5.10.h b/dep/acelite/ace/config-sunos5.10.h index df6f095fec9..1ba1e19a184 100644 --- a/dep/acelite/ace/config-sunos5.10.h +++ b/dep/acelite/ace/config-sunos5.10.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.10.h 89905 2010-04-16 13:04:47Z johnnyw $ +// $Id: config-sunos5.10.h 95428 2012-01-11 15:42:20Z sma $ // The following configuration file is designed to work for SunOS 5.10 // (Solaris 10) platforms using the SunC++ 5.x (Sun Studio 8-10), or g++ @@ -38,15 +38,10 @@ #endif // Solaris 10 introduced printf() modifiers for [s]size_t types. -#if defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) -# undef ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII -# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%zd" -#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII */ - -#if defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) -# undef ACE_SIZE_T_FORMAT_SPECIFIER_ASCII -# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%zu" -#endif /* ACE_SIZE_T_FORMAT_SPECIFIER_ASCII */ +#undef ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII +#define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%zd" +#undef ACE_SIZE_T_FORMAT_SPECIFIER_ASCII +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%zu" // Solaris 10 offers wcstoll() and wcstoull() #if defined (ACE_LACKS_WCSTOLL) diff --git a/dep/acelite/ace/config-sunos5.4-g++.h b/dep/acelite/ace/config-sunos5.4-g++.h index a678389e78d..55fc6579c24 100644 --- a/dep/acelite/ace/config-sunos5.4-g++.h +++ b/dep/acelite/ace/config-sunos5.4-g++.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.4-g++.h 87268 2009-10-29 21:06:06Z olli $ +// $Id: config-sunos5.4-g++.h 93573 2011-03-17 07:53:03Z olli $ // The following configuration file is designed to work for SunOS 5.4 // platforms using the GNU g++ compiler. @@ -34,9 +34,6 @@ // Sun has the wrong prototype for sendmsg. #define ACE_HAS_NONCONST_SENDMSG -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - // Platform supports system configuration information. #define ACE_HAS_SYS_SYSTEMINFO_H #define ACE_HAS_SYSV_SYSINFO diff --git a/dep/acelite/ace/config-sunos5.4-sunc++-4.x.h b/dep/acelite/ace/config-sunos5.4-sunc++-4.x.h index e4bc8239125..4c7a3a63923 100644 --- a/dep/acelite/ace/config-sunos5.4-sunc++-4.x.h +++ b/dep/acelite/ace/config-sunos5.4-sunc++-4.x.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.4-sunc++-4.x.h 91285 2010-08-05 08:29:30Z johnnyw $ +// $Id: config-sunos5.4-sunc++-4.x.h 93573 2011-03-17 07:53:03Z olli $ // The following configuration file is designed to work for SunOS 5.4 // platforms using the SunC++ 4.0.x compiler. @@ -26,9 +26,6 @@ // Sun has the wrong prototype for sendmsg. #define ACE_HAS_NONCONST_SENDMSG -// The SunOS 5.x version of rand_r is inconsistent with the header files... -#define ACE_HAS_BROKEN_RANDR - // Platform supports system configuration information. #define ACE_HAS_SYS_SYSTEMINFO_H #define ACE_HAS_SYSV_SYSINFO diff --git a/dep/acelite/ace/config-sunos5.5.h b/dep/acelite/ace/config-sunos5.5.h index d3279b9d3b6..30e48da6d59 100644 --- a/dep/acelite/ace/config-sunos5.5.h +++ b/dep/acelite/ace/config-sunos5.5.h @@ -1,10 +1,10 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.5.h 92102 2010-09-30 08:14:15Z johnnyw $ +// $Id: config-sunos5.5.h 94454 2011-09-08 17:36:56Z johnnyw $ // This configuration file is designed to work for SunOS 5.5 platforms // using the following compilers: // * Sun C++ 4.2 and later (including 5.x), patched as noted below -// * g++ 2.7.2 and later, including egcs +// * g++ // * Green Hills 1.8.8 and later #ifndef ACE_CONFIG_H @@ -24,24 +24,10 @@ // SunOS 5.5 does not provide getloadavg() #define ACE_LACKS_GETLOADAVG -// Some SunOS releases define _POSIX_PTHREAD_SEMANTICS automatically. -// We need to be check if the user has manually defined the macro before -// including <sys/feature_tests.h>. -#if defined (_POSIX_PTHREAD_SEMANTICS) -# define ACE_HAS_POSIX_PTHREAD_SEMANTICS -#endif /* _POSIX_PTHREAD_SEMANTICS */ - // Before we do anything, we should include <sys/feature_tests.h> to // ensure that things are set up properly. #include <sys/feature_tests.h> -// Some SunOS releases define _POSIX_PTHREAD_SEMANTICS automatically. -// We need to undef if the macro is set and not defined by the user. -#if defined (_POSIX_PTHREAD_SEMANTICS) && \ - !defined (ACE_HAS_POSIX_PTHREAD_SEMANTICS) -# undef _POSIX_PTHREAD_SEMANTICS -#endif /* _POSIX_PTHREAD_SEMANTICS && !ACE_HAS_POSIX_PTHREAD_SEMANTICS */ - // Sun has the posix defines so let this file sort out what Sun delivers #include "ace/config-posix.h" @@ -125,33 +111,15 @@ # endif /* _REENTRANT */ # endif /* !ACE_MT_SAFE */ -#elif defined (ghs) - -# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0 - // ACE_MT_SAFE is #defined below, for all compilers. -# if !defined (_REENTRANT) - /* If you want to disable threading, comment out the following - line. Or, add -DACE_MT_SAFE=0 to your CFLAGS, e.g., using - make threads=0. */ -# define _REENTRANT -# endif /* _REENTRANT */ -# endif /* !ACE_MT_SAFE */ - -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - - // To avoid warning about inconsistent declaration between Sun's - // stdlib.h and Green Hills' ctype.h. -# include <stdlib.h> +# if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 3)) +# define ACE_LACKS_STD_WSTRING 1 +# endif - // IOStream_Test never halts with Green Hills 1.8.9. -# define ACE_LACKS_ACE_IOSTREAM - -#else /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ +#else /* ! __SUNPRO_CC && ! __GNUG__ */ # ifdef __cplusplus /* Let it slide for C compilers. */ # error unsupported compiler in ace/config-sunos5.5.h # endif /* __cplusplus */ -#endif /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ +#endif /* ! __SUNPRO_CC && ! __GNUG__ */ #if !defined (__ACE_INLINE__) // @note If you have link problems with undefined inline template @@ -282,12 +250,6 @@ # define ACE_HAS_CHARPTR_SHMDT #endif -// Platform has posix getpwnam_r -#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE - 0 >= 199506L) || \ - defined(_POSIX_PTHREAD_SEMANTICS) -# define ACE_HAS_POSIX_GETPWNAM_R -#endif /* _POSIX_C_SOURCE || _POSIX_PTHREAD_SEMANTICS */ - #if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 1) #if defined (_REENTRANT) || \ (defined (_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) || \ diff --git a/dep/acelite/ace/config-sunos5.6.h b/dep/acelite/ace/config-sunos5.6.h index 958e019cd1b..e7f935c753e 100644 --- a/dep/acelite/ace/config-sunos5.6.h +++ b/dep/acelite/ace/config-sunos5.6.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.6.h 91685 2010-09-09 09:35:14Z johnnyw $ +// $Id: config-sunos5.6.h 93117 2011-01-20 12:11:28Z mcorino $ // The following configuration file is designed to work for SunOS 5.6 // platforms using the SunC++ 4.x or g++ compilers. @@ -78,7 +78,6 @@ // SunOS 5.6 and above support mkstemp #undef ACE_LACKS_MKSTEMP - // SunOS 5.6 has AIO calls. #if !defined (ACE_HAS_AIO_CALLS) #define ACE_HAS_AIO_CALLS diff --git a/dep/acelite/ace/config-sunos5.7.h b/dep/acelite/ace/config-sunos5.7.h index b01b0d47708..720fbbd430a 100644 --- a/dep/acelite/ace/config-sunos5.7.h +++ b/dep/acelite/ace/config-sunos5.7.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-sunos5.7.h 91581 2010-08-31 13:18:11Z shuston $ +// $Id: config-sunos5.7.h 93543 2011-03-14 08:25:46Z johnnyw $ // The following configuration file is designed to work for SunOS 5.7 // (Solaris 7) platforms using the SunC++ 4.x, 5.x, or g++ compilers. @@ -25,17 +25,10 @@ // SunOS 5.7 has getloadavg() #undef ACE_LACKS_GETLOADAVG -#if defined (ghs) - // SunOS 5.7's /usr/include/sys/procfs_isa.h needs uint64_t, - // but /usr/include/sys/int_types.h doesn't #define it because - // _NO_LONGLONG is # -# undef ACE_HAS_PROC_FS -# undef ACE_HAS_PRUSAGE_T - -#elif defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) +#if defined (__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) // Wide character methods are in std:: when using SunCC 5.3 # define ACE_WCHAR_IN_STD_NAMESPACE -#endif /* __GNUG__ || ghs */ +#endif // SunOS 5.7 supports SCHED_FIFO and SCHED_RR, as well as SCHED_OTHER. #undef ACE_HAS_ONLY_SCHED_OTHER diff --git a/dep/acelite/ace/config-tandem-nsk-mips-v2.h b/dep/acelite/ace/config-tandem-nsk-mips-v2.h deleted file mode 100644 index ff2111cf56e..00000000000 --- a/dep/acelite/ace/config-tandem-nsk-mips-v2.h +++ /dev/null @@ -1,384 +0,0 @@ -// -*- C++ -*- -// -// $Id: config-tandem-nsk-mips-v2.h 91685 2010-09-09 09:35:14Z johnnyw $ - -#ifndef ACE_CONFIG_NSK_H -#define ACE_CONFIG_NSK_H - -#include /**/ "ace/pre.h" - -// The following configuration file contains defines for Tandem NSK -// platform, MIPS processor, version 2 C++ compiler. - - -//========================================================================= -// Tandem NSK specific parts -//========================================================================= - - -// Disable pthread renaming of symbols such as "open" and "close" -#define _CMA_NOWRAPPERS_ 1 - -// Get Handle_Set.cpp to generate correct bit operations for NSK platform -#define ACE_TANDEM_NSK_BIT_ORDER - -// Use facilities provided by T1248 version of pthreads. -// (If not defined, will use old version of pthreads.) -#define ACE_TANDEM_T1248_PTHREADS - -// Use all available T1248 thread aware wrapper functions for providing -// non-blocking I/O. -// [@note this causes a significant performance degradation] -//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS - - -// Need this include here because some symbols defined by pthreads -// (e.g. timespec_t) are needed before spthread.h is normally included -// by ACE -#ifdef ACE_TANDEM_T1248_PTHREADS -#include <spthread.h> -#else -#include "pthread.h" -#include "dce/cma_dispatch_coop.h" -#endif - -// The following #defines are hacks to get around things -// that seem to be missing or different in Tandem land -#define NSIG 32 // missing from Signal.h - // note: on nsk TNS/R there is room in - // sigset_t for 128 signals but those - // above 31 are not valid. -#define MAXNAMLEN 248 // missing from dirent.h -#define ERRMAX 4218 // from errno.h - -// Following seems to be missing from G06.20 version of standard -// pthreads includes (it appeared in older version of standard pthreads) -// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) -#ifdef ACE_TANDEM_T1248_PTHREADS -typedef enum CMA_T_SCHED_POLICY { - cma_c_sched_fifo = 0, - cma_c_sched_rr = 1, - cma_c_sched_throughput = 2, - cma_c_sched_background = 3, - cma_c_sched_ada_low = 4 - } cma_t_sched_policy; -#endif - -// T1248 doesn't define these constants. They're defined in spt/cma.h -// (formerly dce/cma.h), but this header is not included or provided -// by T1248 G07-AAL. -#define cma_c_prio_fifo_min 16 -#define cma_c_prio_fifo_mid 24 -#define cma_c_prio_fifo_max 31 -#define cma_c_prio_rr_min 16 -#define cma_c_prio_rr_mid 24 -#define cma_c_prio_rr_max 31 -#define cma_c_prio_through_min 8 -#define cma_c_prio_through_mid 12 -#define cma_c_prio_through_max 15 -#define cma_c_prio_back_min 1 -#define cma_c_prio_back_mid 4 -#define cma_c_prio_back_max 7 - -// Enable NSK Pluggable Protocols -#define TAO_HAS_NSKPW 1 -#define TAO_HAS_NSKFS 1 - -//========================================================================= -// Platform specific parts -//========================================================================= - -// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// Platform/compiler lacks {get,set}rlimit() function -#define ACE_LACKS_RLIMIT - -// The platform doesn't have mmap(2) -#define ACE_LACKS_MMAP - -// Platform lacks streambuf "linebuffered ()". [C++ iostream] -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. -#define ACE_LACKS_MSG_ACCRIGHTS - -// Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// OS/compiler uses size_t * rather than int * for socket lengths -#define ACE_HAS_SIZET_SOCKET_LEN - -// OS/compiler uses void * arg 4 setsockopt() rather than const char * -#define ACE_HAS_VOIDPTR_SOCKOPT - -// The platform doesn't have mprotect(2) -#define ACE_LACKS_MPROTECT - -// Platform lacks msync() -#define ACE_LACKS_MSYNC - -// Platform does not support reentrant netdb functions (getprotobyname_r, -// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support - -// Platform lacks madvise() -#define ACE_LACKS_MADVISE - -// Platform lacks pri_t -#define ACE_LACKS_PRI_T - -// Platform lacks a working sbrk() -#define ACE_LACKS_SBRK - -// Platform doesn't have syscall() prototype -#define ACE_LACKS_SYSCALL - -// Platform lacks the inet_aton() function. -#define ACE_LACKS_INET_ATON - -// Compiler/platform has Dirent iterator functions -#define ACE_HAS_DIRENT - -// Platform uses ACE_HAS_DIRENT but does not have readdir_r() -#define ACE_LACKS_READDIR_R - -// Platform supports getpagesize() call (otherwise, -// ACE_PAGE_SIZE must be defined) -#define ACE_HAS_GETPAGESIZE - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform's select() uses non-const timeval* -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Platform lacks named POSIX semaphores -#define ACE_LACKS_NAMED_POSIX_SEM - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// No wcsstr function available for this compiler -#define ACE_LACKS_WCSSTR - -// No wctype.h available for this compiler -#define ACE_LACKS_WCTYPE_H - -// Platform supports the POSIX regular expression library. -// [Note Tandem NSK platform does have regular expresson support but it -// does not follow the assumptions made by ACE. To use it would need -// to make some ACE modifications.] -//#define ACE_HAS_REGEX - -// Platform doesn't have truncate() -#define ACE_LACKS_TRUNCATE - -// Platform lacks readers/writer locks. -#define ACE_LACKS_RWLOCK_T - -// Compiler's 'new' throws exception on failure (ANSI C++ behavior). -#define ACE_NEW_THROWS_EXCEPTIONS - -// Optimize ACE_Handle_Set::count_bits for select() operations (common -// case) -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform lacks setreuid() -#define ACE_LACKS_SETREUID - -// Platform lacks setregid() -#define ACE_LACKS_SETREGID - -// Compile using multi-thread libraries -#define ACE_MT_SAFE 1 - - - -// Platform supports System V IPC -#define ACE_HAS_SYSV_IPC - -#define ACE_LACKS_SO_SNDBUF -#define ACE_LACKS_SO_RCVBUF - -// Platform lacks the socketpair() call -#define ACE_LACKS_SOCKETPAIR - -// Platform limits the maximum socket message size. -#define ACE_HAS_SOCK_BUF_SIZE_MAX - -// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion -#define ACE_HRTIME_T_IS_BASIC_TYPE - -// printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" - -//========================================================================= -// Threads specific parts -//========================================================================= - -// Platform supports threads -#define ACE_HAS_THREADS - -// Platform supports POSIX Pthreads, of one form or another. This -// macro says the platform has a pthreads variety - should also define -// one of the below to say which one. Also may need some -// ACE_HAS_... thing for extensions. -#define ACE_HAS_PTHREADS - -// Standard pthreads supports only SCHED_FIFO -#define ACE_HAS_ONLY_SCHED_FIFO - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! -#define ACE_LACKS_CONDATTR_PSHARED - -// pthread_cond_timedwait does *not* reset the time argument when the -// lock is acquired. -#define ACE_LACKS_COND_TIMEDWAIT_RESET - -// Platform lacks pthread_attr_setsched() -#define ACE_LACKS_SETSCHED - -// Platform has pthread_mutexattr_setkind_np(). -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -// Platform lacks pthread_mutexattr_setpshared(). -#define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform lacks pthread_attr_setscope() -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -// Platform lacks pthread_attr_setstackaddr -#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR - -// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has -// a definition for it. -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_UCONTEXT_T -#endif - -#define ACE_LACKS_FD_MASK - -//========================================================================= -// Include file characteristics -//========================================================================= - -// Compiler/platform contains the <sys/syscall.h> file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform lacks malloc.h -#define ACE_LACKS_MALLOC_H - -// Platform lacks the siginfo.h include file -#define ACE_LACKS_SIGINFO_H - -// Platform doesn't define struct strrecvfd. -#define ACE_LACKS_STRRECVFD - -// Platform lacks the ucontext.h file -#define ACE_LACKS_UCONTEXT_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME - -// Platform/compiler supports timezone * as second parameter to gettimeofday() -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Platform has <strings.h> (which contains bzero() prototype) -#define ACE_HAS_STRINGS 1 - - -// OS/compiler omits the const from the iovec parameter in the -// writev() prototype. -#define ACE_HAS_NONCONST_WRITEV - -// Platform lacks <stdint.h> -#define ACE_LACKS_STDINT_H - -// Platform lacks <inttypes.h> -#define ACE_LACKS_INTTYPES_H - -// Platform lacks <sys/select.h> -#define ACE_LACKS_SYS_SELECT_H - -// Platform lacks <dlfcn.h> -#define ACE_LACKS_DLFCN_H - -// Platform lacks <semaphore.h> -#define ACE_LACKS_SEMAPHORE_H - -// Platform lacks <poll.h> -#define ACE_LACKS_POLL_H - -//========================================================================= -// Compiler specific parts -//========================================================================= - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform does not support the unsigned long long datatype. -#define ACE_LACKS_LONGLONG_T - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T - -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY 0 - -// Compiler's template mechanism must see source code (i.e., -// .cpp files). -#define ACE_TEMPLATES_REQUIRE_SOURCE - -// Platform has its standard c++ library in the namespace std. -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -// Compiler doesn't support static data member templates -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES - -// Platform lacks "signed char" type (broken!) -// Following will not be needed if use standard c library (G06.20 and later) -#define ACE_LACKS_SIGNED_CHAR - -//========================================================================= -// Build options -//========================================================================= - -// For debugging problems in os calls (but this doesn't work too well -// since output is not interleaved properly with output from ACE_TRACE -//# define ACE_OS_TRACE(X) ::printf(X) - -// Uncomment the following if timed message blocks are needed (e.g. -// for Dynamic_Priority_Test. Otherwise leave this disabled because -// enabling it adds overhead to message blocks and timed message blocks -// are "rarely used." -//#define ACE_HAS_TIMED_MESSAGE_BLOCKS - -// Uncomment the following if tokens library is needed. -//#define ACE_HAS_TOKENS_LIBRARY - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_NSK_H */ diff --git a/dep/acelite/ace/config-tandem-nsk-mips-v3.h b/dep/acelite/ace/config-tandem-nsk-mips-v3.h deleted file mode 100644 index c037bed4ec8..00000000000 --- a/dep/acelite/ace/config-tandem-nsk-mips-v3.h +++ /dev/null @@ -1,454 +0,0 @@ -// -*- C++ -*- -// -// $Id: config-tandem-nsk-mips-v3.h 91685 2010-09-09 09:35:14Z johnnyw $ - - -#ifndef ACE_CONFIG_NSK_H -#define ACE_CONFIG_NSK_H - -#include /**/ "ace/pre.h" - -// The following configuration file contains defines for Tandem NSK -// platform, MIPS processor, version 3 C++ compiler. - - -//========================================================================= -// Tandem NSK specific parts -//========================================================================= - - -// Disable pthread renaming of symbols such as "open" and "close" -#define _CMA_NOWRAPPERS_ 1 - -// Get Handle_Set.cpp to generate correct bit operations for NSK platform -#define ACE_TANDEM_NSK_BIT_ORDER - -// Use facilities provided by T1248 version of pthreads. -// (If not defined, will use old version of pthreads.) -#define ACE_TANDEM_T1248_PTHREADS - -// Use all available T1248 thread aware wrapper functions for providing -// non-blocking I/O. -// [Note: this causes a significant performance degradation] -//#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS - - -// Need this include here because some symbols defined by pthreads -// (e.g. timespec_t) are needed before spthread.h is normally included -// by ACE -#ifdef ACE_TANDEM_T1248_PTHREADS -#include <spthread.h> -#else -#include "pthread.h" -#include "dce/cma_dispatch_coop.h" -#endif - -// The following #defines are hacks to get around things -// that seem to be missing or different in Tandem land -#define NSIG 32 // missing from Signal.h - // note: on nsk TNS/R there is room in - // sigset_t for 128 signals but those - // above 31 are not valid. -#define MAXNAMLEN 248 // missing from dirent.h -#define ERRMAX 4218 // from errno.h - -// Following seems to be missing from G06.20 version of standard -// pthreads includes (it appeared in older version of standard pthreads) -// (SCHED_FIFO (aka cma_c_sched_fifo) used in Dynamic_Priority_Test) -#ifdef ACE_TANDEM_T1248_PTHREADS -typedef enum CMA_T_SCHED_POLICY { - cma_c_sched_fifo = 0, - cma_c_sched_rr = 1, - cma_c_sched_throughput = 2, - cma_c_sched_background = 3, - cma_c_sched_ada_low = 4 - } cma_t_sched_policy; -#endif - -// T1248 doesn't define these constants. They're defined in spt/cma.h -// (formerly dce/cma.h), but this header is not included or provided -// by T1248 G07-AAL. -#define cma_c_prio_fifo_min 16 -#define cma_c_prio_fifo_mid 24 -#define cma_c_prio_fifo_max 31 -#define cma_c_prio_rr_min 16 -#define cma_c_prio_rr_mid 24 -#define cma_c_prio_rr_max 31 -#define cma_c_prio_through_min 8 -#define cma_c_prio_through_mid 12 -#define cma_c_prio_through_max 15 -#define cma_c_prio_back_min 1 -#define cma_c_prio_back_mid 4 -#define cma_c_prio_back_max 7 - -// Enable NSK Pluggable Protocols -#define TAO_HAS_NSKPW 1 -#define TAO_HAS_NSKFS 1 - -//========================================================================= -// Platform specific parts -//========================================================================= - -// Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -#define ACE_LACKS_PWD_REENTRANT_FUNCTIONS - -// Platform/compiler lacks {get,set}rlimit() function -#define ACE_LACKS_RLIMIT - -// The platform doesn't have mmap(2) -#define ACE_LACKS_MMAP - -// Platform lacks streambuf "linebuffered ()". [C++ iostream] -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -// Platform defines ACE_HAS_MSG, but lacks msg_accrights{,len}. -#define ACE_LACKS_MSG_ACCRIGHTS - -// Platform supports sigsuspend() -#define ACE_HAS_SIGSUSPEND - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -// Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T - -// OS/compiler uses size_t * rather than int * for socket lengths -#define ACE_HAS_SIZET_SOCKET_LEN - -// OS/compiler uses void * arg 4 setsockopt() rather than const char * -#define ACE_HAS_VOIDPTR_SOCKOPT - -// The platform doesn't have mprotect(2) -#define ACE_LACKS_MPROTECT - -// Platform lacks msync() -#define ACE_LACKS_MSYNC - -// Platform does not support reentrant netdb functions (getprotobyname_r, -// getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS Platform does not support - -// Platform lacks madvise() -#define ACE_LACKS_MADVISE - -// Platform lacks pri_t -#define ACE_LACKS_PRI_T - -// Platform lacks a working sbrk() -#define ACE_LACKS_SBRK - -// Platform doesn't have syscall() prototype -#define ACE_LACKS_SYSCALL - -// Platform lacks the inet_aton() function. -#define ACE_LACKS_INET_ATON - -// Compiler/platform has Dirent iterator functions -#define ACE_HAS_DIRENT - -// Platform uses ACE_HAS_DIRENT but does not have readdir_r() -#define ACE_LACKS_READDIR_R - -// Platform supports getpagesize() call (otherwise, -// ACE_PAGE_SIZE must be defined) -#define ACE_HAS_GETPAGESIZE - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform's select() uses non-const timeval* -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -// Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Platform lacks named POSIX semaphores -#define ACE_LACKS_NAMED_POSIX_SEM - -// Platform has support for multi-byte character support compliant -// with the XPG4 Worldwide Portability Interface wide-character -// classification. -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -// No wcsstr function available for this compiler -#define ACE_LACKS_WCSSTR - -// No wctype.h available for this compiler -#define ACE_LACKS_WCTYPE_H - -// Platform supports the POSIX regular expression library. -// [Note Tandem NSK platform does have regular expresson support but it -// does not follow the assumptions made by ACE. To use it would need -// to make some ACE modifications.] -//#define ACE_HAS_REGEX - -// Platform doesn't have truncate() -#define ACE_LACKS_TRUNCATE - -// Platform lacks readers/writer locks. -#define ACE_LACKS_RWLOCK_T - -// Compiler's 'new' throws exception on failure (ANSI C++ behavior). -#define ACE_NEW_THROWS_EXCEPTIONS - -// Optimize ACE_Handle_Set::count_bits for select() operations (common -// case) -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform lacks setreuid() -#define ACE_LACKS_SETREUID - -// Platform lacks setregid() -#define ACE_LACKS_SETREGID - -// Compile using multi-thread libraries -#define ACE_MT_SAFE 1 - - - -// Platform supports System V IPC -#define ACE_HAS_SYSV_IPC - -#define ACE_LACKS_SO_SNDBUF -#define ACE_LACKS_SO_RCVBUF - -// Platform lacks the socketpair() call -#define ACE_LACKS_SOCKETPAIR - -// Platform limits the maximum socket message size. -#define ACE_HAS_SOCK_BUF_SIZE_MAX - -// hrtime_t is a basic type that doesn't require ACE_U64_TO_U32 conversion -#define ACE_HRTIME_T_IS_BASIC_TYPE - -// printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" - -// Use larger default buffer size for ease of interoperability -#define ACE_DEFAULT_CDR_BUFSIZE 4096 - -// Size of a wchar -#define ACE_SIZEOF_WCHAR 2 - -// Platform lacks time typedefs -#define ACE_LACKS_SUSECONDS_T -#define ACE_LACKS_USECONDS_T - -// Platform lacks setegid() and seteuid() -#define ACE_LACKS_SETEGID -#define ACE_LACKS_SETEUID - -// Platform lacks vsnprintf() -#define ACE_LACKS_VSNPRINTF - -// Platform lacks log2() -#define ACE_LACKS_LOG2 - -// Platform lacks alphasort() -#define ACE_LACKS_ALPHASORT - -#define ACE_LACKS_FD_MASK -#define ACE_LACKS_NFDBITS - -//========================================================================= -// Threads specific parts -//========================================================================= - -// Platform supports threads -#define ACE_HAS_THREADS - -// Platform supports POSIX Pthreads, of one form or another. This -// macro says the platform has a pthreads variety - should also define -// one of the below to say which one. Also may need some -// ACE_HAS_... thing for extensions. -#define ACE_HAS_PTHREADS - -// Standard pthreads supports only SCHED_FIFO -#define ACE_HAS_ONLY_SCHED_FIFO - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform has no implementation of pthread_condattr_setpshared(), -// even though it supports pthreads! -#define ACE_LACKS_CONDATTR_PSHARED - -// pthread_cond_timedwait does *not* reset the time argument when the -// lock is acquired. -#define ACE_LACKS_COND_TIMEDWAIT_RESET - -// Platform lacks pthread_attr_setsched() -#define ACE_LACKS_SETSCHED - -// Platform has pthread_getschedparam and pthread_setschedparam -// even when ACE_LACKS_SETSCHED is defined. -#define ACE_HAS_PTHREAD_SCHEDPARAM - -// Platform has pthread_mutexattr_setkind_np(). -#define ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP - -// Platform lacks pthread_mutexattr_setpshared(). -#define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform lacks pthread_attr_setscope() -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -// Platform lacks pthread_attr_setstackaddr -#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR - -// Platform lacks pthread_attr_setstack -#define ACE_LACKS_PTHREAD_ATTR_SETSTACK - -// Defining ACE_HAS_UCONTEXT_T since G06.21 version of spthreads has -// a definition for it. -#ifdef ACE_TANDEM_T1248_PTHREADS -#define ACE_HAS_UCONTEXT_T -#endif - -//========================================================================= -// Include file characteristics -//========================================================================= - -// Compiler/platform contains the <sys/syscall.h> file. -#define ACE_HAS_SYS_SYSCALL_H - -// Platform lacks malloc.h -#define ACE_LACKS_MALLOC_H - -// Platform lacks the siginfo.h include file -#define ACE_LACKS_SIGINFO_H - -// Platform doesn't define struct strrecvfd. -#define ACE_LACKS_STRRECVFD - -// Platform lacks the ucontext.h file -#define ACE_LACKS_UCONTEXT_H - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME - -// Platform/compiler supports timezone * as second parameter to gettimeofday() -#define ACE_HAS_TIMEZONE_GETTIMEOFDAY - -// Platform has <strings.h> (which contains bzero() prototype) -#define ACE_HAS_STRINGS 1 - - -// OS/compiler omits the const from the iovec parameter in the -// writev() prototype. -#define ACE_HAS_NONCONST_WRITEV - -// Platform lacks <stdint.h> -#define ACE_LACKS_STDINT_H - -// Platform lacks <inttypes.h> -#define ACE_LACKS_INTTYPES_H - -// Platform lacks <sys/select.h> -#define ACE_LACKS_SYS_SELECT_H - -// Platform lacks <dlfcn.h> -#define ACE_LACKS_DLFCN_H - -// Platform lacks <semaphore.h> -#define ACE_LACKS_SEMAPHORE_H - -// Platform lacks <poll.h> -#define ACE_LACKS_POLL_H - -// Platform lacks <sys/sysctl.h> -#define ACE_LACKS_SYS_SYSCTL_H - -//========================================================================= -// Compiler specific parts -//========================================================================= - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform does not support the unsigned long long datatype. -#define ACE_LACKS_UNSIGNEDLONGLONG_T - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T - -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 - -// Compiler's template mechanism must see source code (i.e., -// .cpp files). -#define ACE_TEMPLATES_REQUIRE_SOURCE - -// Platform/Compiler supports a String class -#define ACE_HAS_STRING_CLASS -#define ACE_HAS_STDCPP_STL_INCLUDES - -// Platform has its standard c++ library in the namespace std. -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -// Compiler doesn't support static data member templates -#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES - -// Platform lacks "signed char" type (broken!) -// Following will not be needed if use standard c library (G06.20 and later) -#define ACE_LACKS_SIGNED_CHAR - -// Compiler can handle any operators in namespace -#define ACE_ANY_OPS_USE_NAMESPACE - -// Platform lacks intptr_t typedef -#define ACE_LACKS_INTPTR_T - -//========================================================================= -// C++ version3 import/export macros -//========================================================================= - -// Define the export macros needed to export symbols outside a DLL -// The ACE_IMPORT_SINGLETON_DECLARE macro has been modified to not explicitly -// instantiate the class template. -#if defined(USE_EXPLICIT_EXPORT) -#define ACE_LACKS_INLINE_FUNCTIONS - -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag export$ -#define ACE_Proper_Import_Flag import$ -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class export$ T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class export$ SINGLETON_TYPE<CLASS, LOCK>; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class import$ T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class import$ SINGLETON_TYPE <CLASS, LOCK>; -#endif - - -//========================================================================= -// Build options -//========================================================================= - -// For debugging problems in os calls (but this doesn't work too well -// since output is not interleaved properly with output from ACE_TRACE -//# define ACE_OS_TRACE(X) ::printf(X) - -// Uncomment the following if timed message blocks are needed (e.g. -// for Dynamic_Priority_Test. Otherwise leave this disabled because -// enabling it adds overhead to message blocks and timed message blocks -// are "rarely used." -//#define ACE_HAS_TIMED_MESSAGE_BLOCKS - -// Uncomment the following if tokens library is needed. -//#define ACE_HAS_TOKENS_LIBRARY - -// NonStop CORBA uses the XML Service Configurator -#define ACE_HAS_XML_SVC_CONF - -#define ACE_LD_SEARCH_PATH "_RLD_LIB_PATH" - -#include /**/ "ace/post.h" - -#endif /* ACE_CONFIG_NSK_H */ diff --git a/dep/acelite/ace/config-tandem.h b/dep/acelite/ace/config-tandem.h deleted file mode 100644 index fa2869b3ca8..00000000000 --- a/dep/acelite/ace/config-tandem.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- C++ -*- */ -// Testing TANDEM -// $Id: config-tandem.h 91781 2010-09-15 12:49:15Z johnnyw $ - -// The following configuration file is designed to work for Tandems NonStop-UX -// 4.2MP platforms using the NCC 3.20 compiler. - -// Note this is a test version it might include several errors I -// have done a test and set/unset until I errors disappered. -// Some of the options that should be set aren't because of the simple fact -// that i haven't the time to check what is wrong. -// e.g. widecharacter are supported but a wcstok which only take 2 parameters -// are included by the compiler, to get the correct wcstok that takes 3 params -// we must set _XOPEN_SOURCE and we get ALOT of errors and warnings. -// So this config is done to get things to start to work it isn't finished. -// Janne (Jan.Perman@osd.Ericsson.se) - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#if ! defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#define ACE_HAS_IDTYPE_T -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Tandem doesn't include this although they are defined -// in sys/time.h and sys/resource.h -#define ACE_LACKS_RLIMIT_PROTOTYPE // jjpp -// Tandem has a function to set t_errno (set_t_errno) -#define ACE_HAS_SET_T_ERRNO // jjpp - -//Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// OS/compiler omits the const from the sendmsg() prototype. -#define ACE_HAS_NONCONST_SENDMSG - -//Platform supports system configuration information -#define ACE_HAS_SYS_SYSTEMINFO_H -#define ACE_HAS_SYSV_SYSINFO - -//Platform supports the POSIX regular expression library -#define ACE_HAS_REGEX - -// Platform supports recvmsg and sendmsg -#define ACE_HAS_MSG - -//Compiler/platform contains the <sys/syscall.h> file. -#define ACE_HAS_SYS_SYSCALL_H - -//Platform provides <sysent.h> header -#define ACE_HAS_SYSENT_H - -// Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS - -//Platform supports POSIX O_NONBLOCK semantics -#define ACE_HAS_POSIX_NONBLOCK - -// Compiler/platform has correctly prototyped header files -#define ACE_HAS_CPLUSPLUS_HEADERS - -//Compiler/platform supports alloca() -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA - -//Compiler/platform has <alloca.h> -#define ACE_HAS_ALLOCA_H - -//Platform contains <poll.h> -#define ACE_HAS_POLL - -// Platform supports the POSIX struct timespec type -#define ACE_HAS_POSIX_TIME // As i understand it, but i'm in deep water -//Platform supports the SVR4 timestruc_t type - -// To get this to work a patch in sys/signal must be made -// typedef void SIG_FUNC_TYPE(int); -//#if defined (__cplusplus) -// void (*sa_handler)(int); -//#else -// ... -//#endif -//#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_TANDEM_SIGNALS -//Compiler/platform defines the sig_atomic_t typedef -#define ACE_HAS_SIG_ATOMIC_T -//Platform supports SVR4 extended signals -#define ACE_HAS_SIGINFO_T -//Platform supports ucontext_t (which is used in the extended signal API). -#define ACE_HAS_UCONTEXT_T - -// Platform/compiler has the sigwait(2) prototype -#define ACE_HAS_SIGWAIT - -//Compiler/platform provides the sockio.h file -#define ACE_HAS_SYS_SOCKIO_H - -// Compiler supports the ssize_t typedef -#define ACE_HAS_SSIZE_T // Limits.h must be included - -//Platform supports STREAMS -#define ACE_HAS_STREAMS - -#define ACE_HAS_STREAM_PIPES -//Platform supports STREAM pipes - -//Compiler/platform supports struct strbuf -#define ACE_HAS_STRBUF_T - -//Compiler/platform supports SVR4 dynamic linking semantics -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -//Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... -#define ACE_HAS_SVR4_TLI - -//Platform provides <sys/filio.h> header -#define ACE_HAS_SYS_FILIO_H - -//Platform supports TLI timod STREAMS module -#define ACE_HAS_TIMOD_H -//Platform supports TLI tiuser header -#define ACE_HAS_TIUSER_H - -//Platform supports TLI -#define ACE_HAS_TLI -//Platform provides TLI function prototypes -#define ACE_HAS_TLI_PROTOTYPES - -//Platform lacks streambuf "linebuffered ()". -#define ACE_LACKS_LINEBUFFERED_STREAMBUF - -// Platform lacks "signed char" type (broken!) -#define ACE_LACKS_SIGNED_CHAR - - -#define ACE_PAGE_SIZE 4096 -// Defines the page size of the system (not used on Win32 or -// with ACE_HAS_GETPAGESIZE). - -/****** THREAD SPECIFIC **********/ -/* If you want to remove threading then comment out the following four #defines .*/ -#if !defined (ACE_MT_SAFE) - #define ACE_MT_SAFE 1 //Compile using multi-thread libraries -#endif -#define ACE_HAS_THREADS //Platform supports threads -#define ACE_HAS_STHREADS //Platform supports Solaris threads - -// Compiler/platform has threadspecific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -#define ACE_HAS_THR_MINSTACK // Tandem uses thr_minstack instead of thr_min_stack -#define ACE_LACKS_PRI_T // Tandem lacks pri_t -#define ACE_HAS_THR_KEYDELETE - -//************************************* - -/*********************************/ - -/******* SIGNAL STUFF *******/ - -//Platform uses non-const char * in calls to gethostbyaddr, gethostbyname, -// getservbyname -#define ACE_HAS_NONCONST_GETBY -#define ACE_HAS_NONCONST_INET_ADDR -// Platform's select() uses non-const timeval* (only found on Linux right now) -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -// And on Tandem :-) -//Uses ctime_r & asctime_r with only two parameters vs. three. -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -//Platform has special header for select(). -#define ACE_HAS_SELECT_H -// Platform/compiler supports Standard C++ Library -#define ACE_HAS_STANDARD_CPP_LIBRARY -//Platform lacks madvise() (e.g., Linux) -#define ACE_LACKS_MADVISE -#define ACE_LACKS_STRCASECMP - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 4096 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-tru64.h b/dep/acelite/ace/config-tru64.h deleted file mode 100644 index 45a7aa6bd53..00000000000 --- a/dep/acelite/ace/config-tru64.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-tru64.h 87270 2009-10-29 21:47:47Z olli $ - -// The following configuration file is designed to work for the -// Digital UNIX V4.0a and later platforms. It relies on -// config-osf1-4.0.h, and adds deltas for newer platforms. - -#ifndef ACE_CONFIG_TRU64_H -#define ACE_CONFIG_TRU64_H -#include /**/ "ace/pre.h" - -#if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif /* ! ACE_MT_SAFE */ - -/*clearerr is not defined when _REENTRANT is not defined*/ -#if ACE_MT_SAFE == 0 -#define ACE_LACKS_CLEARERR -#endif /* ACE_MT_SAFE == 0 */ - -#include "ace/config-posix.h" - -// Configuration-specific #defines: -// 1) g++ or cxx -// 2) pthreads or DCE threads -#if defined (__GNUG__) - // g++ with pthreads - - // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so - // this must appear before its #include. -# define ACE_HAS_STRING_CLASS - -# include "ace/config-g++-common.h" - -# define ACE_HAS_REENTRANT_FUNCTIONS -#elif defined (__DECCXX) - -# define ACE_CONFIG_INCLUDE_CXX_COMMON -# include "ace/config-cxx-common.h" - -#elif defined (__rational__) -# define ACE_HAS_REENTRANT_FUNCTIONS -# define ACE_HAS_STRING_CLASS -# define ACE_LACKS_LINEBUFFERED_STREAMBUF -# define ACE_LACKS_SIGNED_CHAR - - // Exceptions are enabled by platform_osf1_4.0_rcc.GNU. -# define ACE_HAS_STDCPP_STL_INCLUDES -#else -# ifdef __cplusplus /* Let it slide for C compilers. */ -# error unsupported compiler on Digital Unix -# endif /* __cplusplus */ -#endif /* ! __GNUG__ && ! __DECCXX && ! __rational__ */ - -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R -#define ACE_HAS_BROKEN_IF_HEADER -#if (ACE_MT_SAFE != 0) -# define ACE_HAS_PTHREADS -# define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -#endif /* ACE_MT_SAFE != 0 */ -#define ACE_LACKS_T_ERRNO -#if !defined (DIGITAL_UNIX) -# define DIGITAL_UNIX 0x400 -#endif /* ! DIGITAL_UNIX */ - -#define ACE_SIZEOF_LONG 8 - -#define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) -#define ACE_HAS_AUTOMATIC_INIT_FINI -#define ACE_HAS_NONCONST_SETRLIMIT -#define ACE_HAS_BROKEN_T_ERROR -#define ACE_HAS_NONCONST_WRITEV -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES -#define ACE_HAS_CPLUSPLUS_HEADERS -#define ACE_HAS_DIRENT -#define ACE_HAS_GETRUSAGE -#define ACE_HAS_GPERF -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_HAS_IP_MULTICAST -#define ACE_HAS_LLSEEK -#define ACE_HAS_LONG_MAP_FAILED -#define ACE_HAS_MSG -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_OSF1_GETTIMEOFDAY -#define ACE_HAS_OSF_TIMOD_H -#define ACE_HAS_POLL -#define ACE_HAS_POSIX_NONBLOCK -#define ACE_HAS_POSIX_TIME -#define ACE_HAS_PRIOCNTL -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_SSIZE_T -#define ACE_HAS_STRBUF_T -#define ACE_HAS_STREAMS -#define ACE_HAS_STRPTIME -#define ACE_HAS_SVR4_DYNAMIC_LINKING -#define ACE_HAS_SVR4_SIGNAL_T -#define ACE_HAS_SYS_SYSCALL_H -#define ACE_HAS_SYSV_IPC -#if (ACE_MT_SAFE == 0) -// clearerr is not defined when _REENTRANT is not defined -#define ACE_LACKS_CLEARERR -#else /* ACE_MT_SAFE != 0 */ -#define ACE_HAS_THREADS -#define ACE_HAS_THREAD_SPECIFIC_STORAGE -#define ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR -#endif /* ACE_MT_SAFE != 0 */ -#define ACE_HAS_TIUSER_H -#define ACE_HAS_XTI -#define ACE_HAS_TLI_PROTOTYPES -#define ACE_HAS_UALARM -#define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_PRI_T -#define ACE_LACKS_RWLOCK_T -#define ACE_PAGE_SIZE 8192 -#define ACE_HAS_SIGTIMEDWAIT -#define ACE_HAS_SIGSUSPEND - -// DJT 6/10/96 All these broken macro's can now be removed with the -// approporiate ordering of the include files. The Platinum release -// now temporarily supports both forms. Platform's implementation of -// sendmsg() has a non-const msgheader parameter. -#define ACE_HAS_NONCONST_SENDMSG -#define ACE_HAS_IDTYPE_T -#define ACE_HAS_NONSTATIC_OBJECT_MANAGER - -#if DIGITAL_UNIX >= 0x500 -# define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 -#endif /* DIGITAL_UNIX >= 0x500 */ - -#if DIGITAL_UNIX >= 0x40E -# define ACE_LACKS_STDINT_H -#endif /* DIGITAL_UNIX >= 0x40E */ - -#if (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) -#define ACE_LACKS_PREAD_PROTOTYPE -#endif /* (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) */ - -// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses -#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_TRU64_H */ diff --git a/dep/acelite/ace/config-unixware-7.1.0.h b/dep/acelite/ace/config-unixware-7.1.0.h deleted file mode 100644 index 820e7fb763a..00000000000 --- a/dep/acelite/ace/config-unixware-7.1.0.h +++ /dev/null @@ -1,406 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-unixware-7.1.0.h 87268 2009-10-29 21:06:06Z olli $ - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H - -/* ACE configuration header file */ - -/* Include the commong gnu config file */ -#include "config-g++-common.h" - -/* For unixware 7.1 && g++ 2.91.57, see if this fixes my problem */ -#ifndef UNIXWARE_7_1 -#define UNIXWARE_7_1 -#endif - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#define YYTEXT_POINTER 1 - -/* Define _REENTRANT if reentrant functions should be used. */ -#ifndef _REENTRANT -# define _REENTRANT 1 -#endif - -#define ACE_HAS_NEW_NO_H 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 - -#define ACE_THREAD_MIN_PRIORITY 0 -#if defined (ACE_THREAD_MIN_PRIORITY) -# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY -#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ - -#define ACE_THREAD_MAX_PRIORITY 99 -#if defined (ACE_THREAD_MAX_PRIORITY) -# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY -#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ - -/* Specify sizes of given built-in types. If a size isn't defined here, - then ace/Basic_Types.h will attempt to deduce the size. */ -/* #undef ACE_SIZEOF_CHAR */ -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 4 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_VOID_P 4 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 12 - -/* Enable ACE inlining */ -#define __ACE_INLINE__ 1 - -/* OS has priocntl (2) */ -#define ACE_HAS_PRIOCNTL 1 - -/* Platform has pread() and pwrite() support */ -#define ACE_HAS_P_READ_WRITE 1 - -/* Compiler/platform supports alloca() */ -// Although ACE does have alloca() on this compiler/platform combination, it is -// disabled by default since it can be dangerous. Uncomment the following line -// if you ACE to use it. -//#define ACE_HAS_ALLOCA 1 - -/* Compiler/platform correctly calls init()/fini() for shared libraries */ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - -/* Platform doesn't cast MAP_FAILED to a (void *). */ -/* #undef ACE_HAS_BROKEN_MAP_FAILED */ -/* Staller: oh yes, let's do this! */ -#define ACE_HAS_BROKEN_MAP_FAILED - -/* Prototypes for both signal() and struct sigaction are consistent. */ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 - -/* Platform supports operations on directories via struct dirent, - readdir_r, etc. */ -#define ACE_HAS_DIRENT 1 - -/* Compiler supports C++ exception handling */ -// MM-Graz if ! defined inserted, to prevent warnings, because it is already -// defined in config-g++common.h -# if !defined (ACE_HAS_EXCEPTIONS) -#define ACE_HAS_EXCEPTIONS 1 -# endif - -/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be - defined, except on Win32) */ -#define ACE_HAS_GETPAGESIZE 1 - -/* Platform supports the getrusage() system call. */ -#define ACE_HAS_GETRUSAGE 1 - -/* Platform has a getrusage () prototype in sys/resource.h that differs from - the one in ace/OS.i. */ -#define ACE_HAS_GETRUSAGE_PROTOTYPE 1 - -/* The GPERF utility is compiled for this platform */ -#define ACE_HAS_GPERF 1 - -/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 - -/* Compiler/platform supports idtype_t. */ -#define ACE_HAS_IDTYPE_T 1 - -/* Platform supports IP multicast */ -#define ACE_HAS_IP_MULTICAST 1 - -/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ -#define ACE_HAS_THR_KEYDELETE 1 - -/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ -#define ACE_HAS_THR_MINSTACK 1 - -/* Platform supports recvmsg and sendmsg */ -#define ACE_HAS_MSG 1 - -/* Platform's select() uses non-const timeval* (only found on Linux right - now) */ -#define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 - -/* Uses ctime_r & asctime_r with only two parameters vs. three. */ -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 - -/* Platform is an Intel Pentium microprocessor. */ -/* There is a problem with the gethrtime() because of (apparently) a problem - with the inline assembly instruction. Hopefully there is a way to resolve - that with an improvement to the assembler -*/ -#ifdef ACE_HAS_PENTIUM -#undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - - -/* Platform contains <poll.h> */ -#define ACE_HAS_POLL 1 - -/* Platform supports POSIX O_NONBLOCK semantics */ -#define ACE_HAS_POSIX_NONBLOCK 1 - -/* Platform supports the POSIX struct timespec type */ -#define ACE_HAS_POSIX_TIME 1 - -/* Platform supports the /proc file system and defines tid_t - in <sys/procfs.h> */ -#define ACE_HAS_PROC_FS 1 - -/* Platform supports POSIX Threads */ -#define ACE_HAS_PTHREADS 1 - -/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values */ -#define ACE_HAS_PTHREAD_PROCESS_ENUM 1 - -/* Platform will recurse infinitely on thread exits from TSS cleanup routines - (e.g., AIX) */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 - -/* Platform supports reentrant functions (i.e., all the POSIX *_r - functions). */ -#define ACE_HAS_REENTRANT_FUNCTIONS 1 - -/* Platform has support for multi-byte character support compliant with the - XPG4 Worldwide Portability Interface wide-character classification. */ -#define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 - -/* Platform does not support reentrant netdb functions (getprotobyname_r, - getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 - -/* Platform supports the POSIX regular expression library */ -#define ACE_HAS_REGEX 1 - -/* Platform has special header for select(). */ -#define ACE_HAS_SELECT_H 1 - -/* Platform has a function to set t_errno (e.g., Tandem). */ -#define ACE_HAS_SET_T_ERRNO 1 - -/* Platform supports SVR4 extended signals */ -#define ACE_HAS_SIGINFO_T 1 - -/* Platform/compiler has the sigwait(2) prototype */ -#define ACE_HAS_SIGWAIT 1 - -/* Compiler/platform defines the sig_atomic_t typedef */ -#define ACE_HAS_SIG_ATOMIC_T 1 - -/* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 - -/* OS/compiler uses size_t * rather than int * for socket lengths */ -#define ACE_HAS_SIZET_SOCKET_LEN 1 - -/* Compiler/platform provides the sys/sockio.h file */ -#define ACE_HAS_SYS_SOCKIO_H 1 - -/* Compiler supports the ssize_t typedef */ -#define ACE_HAS_SSIZE_T 1 - -/* Platform supports UNIX International Threads */ -#define ACE_HAS_STHREADS 1 - -/* Platform has thr_yield() */ -#define ACE_HAS_THR_YIELD 1 - -/* Compiler/platform supports struct strbuf */ -#define ACE_HAS_STRBUF_T 1 - -/* Platform supports STREAMS */ -#define ACE_HAS_STREAMS 1 - -/* Platform supports STREAM pipes */ -#define ACE_HAS_STREAM_PIPES 1 - -/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ -#define ACE_HAS_STRING_CLASS 1 - -/* Platform has <strings.h> (which contains bzero() prototype) */ -#define ACE_HAS_STRINGS 1 - -/* Platform/compiler supports void * as second parameter to gettimeofday(). */ -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY 1 - -/* Compiler/platform supports SVR4 dynamic linking semantics */ -#define ACE_HAS_SVR4_DYNAMIC_LINKING 1 - -/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ -#define ACE_HAS_SVR4_TLI 1 - -/* Compiler/platform contains the <sys/syscall.h> file. */ -#define ACE_HAS_SYS_SYSCALL_H 1 - -/* Platform supports system configuration information */ -#define ACE_HAS_SYS_SYSTEMINFO_H -#define ACE_HAS_SYSV_SYSINFO 1 - -/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ -#define ACE_HAS_SYSV_IPC 1 - -/* Platform provides <sys/filio.h> header */ -#define ACE_HAS_SYS_FILIO_H 1 - -/* Platform provides <sys/xti.h> header */ -#define ACE_HAS_SYS_XTI_H 1 - -/* Platform has POSIX terminal interface. */ -#define ACE_HAS_TERMIOS 1 - -/* Platform supports threads */ -#define ACE_HAS_THREADS 1 - -/* Compiler/platform has thread-specific storage */ -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 - -/* Platform supports TLI timod STREAMS module */ -#define ACE_HAS_TIMOD_H 1 - -/* Platform supports TLI tiuser header */ -#define ACE_HAS_TIUSER_H 1 - -/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ -#define ACE_HAS_TLI 1 - -/* Platform provides TLI function prototypes */ -#define ACE_HAS_TLI_PROTOTYPES 1 - -/* Platform supports ualarm() */ -#define ACE_HAS_UALARM 1 - -/* Platform supports ucontext_t (which is used in the extended signal API). */ -#define ACE_HAS_UCONTEXT_T 1 - -/* Platform has <utime.h> header file */ -#define ACE_HAS_UTIME 1 - -/* Platform requires void * for mmap(). */ -#define ACE_HAS_VOIDPTR_MMAP 1 - -/* Platform has XTI (X/Open-standardized superset of TLI). Implies - ACE_HAS_TLI but uses a different header file. */ -#define ACE_HAS_XTI 1 - -/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily - mean that the platform does not support iostreams. */ -#define ACE_LACKS_ACE_IOSTREAM 1 - -/* Platform does not have u_longlong_t typedef */ -#define ACE_LACKS_U_LONGLONG_T 1 - -/* Platform lacks madvise() (e.g., Linux) */ -#define ACE_LACKS_MADVISE 1 - -/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ -#define ACE_LACKS_PRI_T 1 - -/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 - -/* Platfrom lack pthread_yield() support. */ -#define ACE_LACKS_PTHREAD_YIELD 1 - -/* Platform lacks readers/writer locks. */ -#define ACE_LACKS_RWLOCK_T 1 - -/* MIT pthreads platform lacks the timedwait prototypes */ -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 - -/* Platform does not define timepec_t as a typedef for struct timespec. */ -#define ACE_LACKS_TIMESPEC_T 1 - -/* Compile using multi-thread libraries */ -#define ACE_MT_SAFE 1 - -/* Platform needs to #include <sched.h> to get thread scheduling defs. */ -#define ACE_NEEDS_SCHED_H 1 - -/*********************************************************************/ -/* Compiler's template mechanim must see source code (i.e., .cpp files). This - is used for GNU G++. */ -/* Staller -> make 0 */ -// #undef ACE_TEMPLATES_REQUIRE_SOURCE - -/*********************************************************************/ - -/* The OS/platform supports the poll() event demultiplexor */ -#define ACE_USE_POLL 1 - -/* Platform has its standard c++ library in the namespace std. */ -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long double. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a signed char. */ -#define SIZEOF_SIGNED_CHAR 1 - -/* The number of bytes in a void *. */ -#define SIZEOF_VOID_P 4 - -/* Define if you have the execv function. */ -#define HAVE_EXECV 1 - -/* Define if you have the execve function. */ -#define HAVE_EXECVE 1 - -/* Define if you have the execvp function. */ -#define HAVE_EXECVP 1 - -/* Define if you have the <dirent.h> header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the <fstream> header file. */ -#define HAVE_FSTREAM 1 - -/* Define if you have the <iomanip> header file. */ -#define HAVE_IOMANIP 1 - -/* Define if you have the <iostream> header file. */ -#define HAVE_IOSTREAM 1 - -/* Define if you have the <pwd.h> header file. */ -#define HAVE_PWD_H 1 - -/* Name of package */ -#define PACKAGE "ace" - -/* Added by Staller */ -#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define ACE_HAS_BROKEN_T_ERROR // make a nasty warning disappear in OS.i -#define __USLC__ 1 -#define __IOCTL_VERSIONED__ // By Carlo! - -#endif /* ACE_CONFIG_H */ diff --git a/dep/acelite/ace/config-unixware-7.1.0.udk.h b/dep/acelite/ace/config-unixware-7.1.0.udk.h deleted file mode 100644 index ec668c19581..00000000000 --- a/dep/acelite/ace/config-unixware-7.1.0.udk.h +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- C++ -*- */ -#ifndef ACE_CONFIG_UNIXWARE_UDK_H -#define ACE_CONFIG_UNIXWARE_UDK_H - -// $Id: config-unixware-7.1.0.udk.h 87167 2009-10-19 19:33:53Z olli $ - -// Configuration for the unixware UDK compiler. derived from the unixware/g++ config -// which was itself derived from an autoconfig run. - -/* ACE configuration header file */ - -#define ACE_TEMPLATES_REQUIRE_SOURCE - -#ifndef UNIXWARE_7_1 -#define UNIXWARE_7_1 -#endif - -#define ACE_LACKS_PLACEMENT_OPERATOR_DELETE - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if lex declares yytext as a char * by default, not a char[]. */ -#define YYTEXT_POINTER 1 - -/* Define _REENTRANT if reentrant functions should be used. */ -#ifndef _REENTRANT -# define _REENTRANT 1 -#endif - -#define ACE_HAS_NEW_NO_H 1 -#define ACE_HAS_STDEXCEPT_NO_H 1 - -/* - * TODO: These two next #defines have an #undef before them, in - * case the variable being defined already had a value. - * The #undefs are being picked up by configure, and are commented out! - */ -#define ACE_THREAD_MIN_PRIORITY 0 -#if defined (ACE_THREAD_MIN_PRIORITY) -/* # undef PTHREAD_MIN_PRIORITY */ -# define PTHREAD_MIN_PRIORITY ACE_THREAD_MIN_PRIORITY -#endif /* #if defined (ACE_THREAD_MIN_PRIORITY) */ - -#define ACE_THREAD_MAX_PRIORITY 99 -#if defined (ACE_THREAD_MAX_PRIORITY) -/* # undef PTHREAD_MAX_PRIORITY */ -# define PTHREAD_MAX_PRIORITY ACE_THREAD_MAX_PRIORITY -#endif /* #if defined (ACE_THREAD_MAX_PRIORITY) */ - - - -/* UnixWare specific configuration parameters */ -/* #undef UNIXWARE */ -/* #undef UNIXWARE_2_0 */ -/* #undef UNIXWARE_2_1 */ - -/* Specify sizes of given built-in types. If a size isn't defined here, - then ace/Basic_Types.h will attempt to deduce the size. */ -/* #undef ACE_SIZEOF_CHAR */ -#define ACE_SIZEOF_SHORT 2 -#define ACE_SIZEOF_INT 4 -#define ACE_SIZEOF_LONG 4 -#define ACE_SIZEOF_LONG_LONG 8 -#define ACE_SIZEOF_VOID_P 4 -#define ACE_SIZEOF_FLOAT 4 -#define ACE_SIZEOF_DOUBLE 8 -#define ACE_SIZEOF_LONG_DOUBLE 12 - -/* Enable ACE inlining */ -#define __ACE_INLINE__ 1 - -/* Platform supports Asynchronous IO calls */ -/* #define ACE_HAS_AIO_CALLS */ - -/* Specify this if you don't want threads to inherit parent thread's - ACE_Log_Msg properties. */ -/* #undef ACE_THREADS_DONT_INHERIT_LOG_MSG */ - -/* OS has priocntl (2) */ -#define ACE_HAS_PRIOCNTL 1 - -/* Platform has pread() and pwrite() support */ -#define ACE_HAS_P_READ_WRITE 1 - -/* Compiler/platform correctly calls init()/fini() for shared libraries */ -#define ACE_HAS_AUTOMATIC_INIT_FINI 1 - -/* Compiler handles explicit calling of template destructor correctly. - See "ace/OS.h" for details. */ -/* Staller: already defined by config-g++-common.h -#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 -*/ - -/* Platform doesn't cast MAP_FAILED to a (void *). */ -/* #undef ACE_HAS_BROKEN_MAP_FAILED */ -/* Staller: oh yes, let's do this! */ -#define ACE_HAS_BROKEN_MAP_FAILED - - -/* Prototypes for both signal() and struct sigaction are consistent. */ -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 - -/* Compiler/platform has correctly prototyped header files */ -#define ACE_HAS_CPLUSPLUS_HEADERS - -/* Platform supports operations on directories via struct dirent, - readdir_r, etc. */ -#define ACE_HAS_DIRENT - -/* Compiler supports C++ exception handling */ -# if !defined (ACE_HAS_EXCEPTIONS) -#define ACE_HAS_EXCEPTIONS -# endif - -/* Platform supports getpagesize() call (otherwise, ACE_PAGE_SIZE must be - defined, except on Win32) */ -#define ACE_HAS_GETPAGESIZE - -/* Platform supports the getrusage() system call. */ -#define ACE_HAS_GETRUSAGE - -/* Platform has a getrusage () prototype in sys/resource.h that differs from - the one in ace/OS.i. */ -#define ACE_HAS_GETRUSAGE_PROTOTYPE - -/* The GPERF utility is compiled for this platform */ -#define ACE_HAS_GPERF - -/* Optimize ACE_Handle_Set::count_bits for select() operations (common case) */ -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 - -/* Compiler/platform supports SunOS high resolution timers */ -/* #undef ACE_HAS_HI_RES_TIMER */ - -/* Compiler/platform supports idtype_t. */ -#define ACE_HAS_IDTYPE_T - -/* Inline all the static class OS methods to remove call overhead */ -/* Note: This gets defined by OS.h if __ACE_INLINE__ is defined */ -/* #undef ACE_HAS_INLINED_OSCALLS */ - -/* Platform supports IP multicast */ -#define ACE_HAS_IP_MULTICAST - -/* Platform supports thr_keydelete (e.g,. UNIXWARE) */ -#define ACE_HAS_THR_KEYDELETE - -/* Platform calls thr_minstack() rather than thr_min_stack() (e.g., Tandem). */ -#define ACE_HAS_THR_MINSTACK - -/* Some files, such as ace/streams.h, want to include new style C++ stream - headers. These headers are iomanip, ios, iostream, istream, ostream, - fstream and streambuf. If _all_ of these headers aren't available, then - assume that only iostream.h and fstream.h are available. */ -/* #define ACE_USES_OLD_IOSTREAMS */ - -/* Platform supports recvmsg and sendmsg */ -#define ACE_HAS_MSG - -/* Platform's select() uses non-const timeval* (only found on Linux right - now) */ -#define ACE_HAS_NONCONST_SELECT_TIMEVAL - -/* Uses ctime_r & asctime_r with only two parameters vs. three. */ -#define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R - - -/* Platform is an Intel Pentium microprocessor. */ -/* There is a problem with the gethrtime() because of (apparently) a problem - with the inline assembly instruction. Hopefully there is a way to resolve - that with an improvement to the assembler -*/ -#ifdef ACE_HAS_PENTIUM -//#undef ACE_HAS_PENTIUM -#endif /* ACE_HAS_PENTIUM */ - - -/* Platform contains <poll.h> */ -#define ACE_HAS_POLL - -/* Platform supports POSIX O_NONBLOCK semantics */ -#define ACE_HAS_POSIX_NONBLOCK - -/* Platform supports the POSIX struct timespec type */ -#define ACE_HAS_POSIX_TIME - -/* Platform supports the /proc file system and defines tid_t - in <sys/procfs.h> */ -#define ACE_HAS_PROC_FS - -/* Platform supports POSIX Threads */ -#define ACE_HAS_PTHREADS - -/* pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and - PTHREAD_PROCESS_SHARED values */ -#define ACE_HAS_PTHREAD_PROCESS_ENUM - -/* Platform will recurse infinitely on thread exits from TSS cleanup routines - (e.g., AIX) */ -#define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS - -/* Platform supports reentrant functions (i.e., all the POSIX *_r - functions). */ -#define ACE_HAS_REENTRANT_FUNCTIONS - -/* Platform has support for multi-byte character support compliant with the - XPG4 Worldwide Portability Interface wide-character classification. */ -#define ACE_HAS_XPG4_MULTIBYTE_CHAR - -/* Platform does not support reentrant netdb functions (getprotobyname_r, - getprotobynumber_r, gethostbyaddr_r, gethostbyname_r, getservbyname_r). */ -#define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS - -/* Platform supports the POSIX regular expression library */ -#define ACE_HAS_REGEX - -/* Platform has special header for select(). */ -#define ACE_HAS_SELECT_H - -/* Platform has a function to set t_errno (e.g., Tandem). */ -#define ACE_HAS_SET_T_ERRNO - -/* Platform supports SVR4 extended signals */ -#define ACE_HAS_SIGINFO_T - -/* Platform/compiler has the sigwait(2) prototype */ -#define ACE_HAS_SIGWAIT - -/* Compiler/platform defines the sig_atomic_t typedef */ -#define ACE_HAS_SIG_ATOMIC_T - -/* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SOCKADDR_IN_SIN_LEN - -/* OS/compiler uses size_t * rather than int * for socket lengths */ -#define ACE_HAS_SIZET_SOCKET_LEN - -/* Compiler/platform provides the sys/sockio.h file */ -#define ACE_HAS_SYS_SOCKIO_H - -/* Compiler supports the ssize_t typedef */ -#define ACE_HAS_SSIZE_T - -/* Platform supports UNIX International Threads */ -#define ACE_HAS_STHREADS - -/* Platform has thr_yield() */ -#define ACE_HAS_THR_YIELD - -/* Platform/compiler supports Standard C++ Library */ -/* It seems that UDK provides std-like declarations for only portions - such as <exception> -*/ -#define ACE_HAS_STANDARD_CPP_LIBRARY 0 - -/* Compiler/platform supports struct strbuf */ -#define ACE_HAS_STRBUF_T - -/* Platform supports STREAMS */ -#define ACE_HAS_STREAMS - -/* Platform supports STREAM pipes */ -#define ACE_HAS_STREAM_PIPES - -/* Platform/Compiler supports a String class (e.g., GNU or Win32). */ -#define ACE_HAS_STRING_CLASS - -/* Platform has <strings.h> (which contains bzero() prototype) */ -#define ACE_HAS_STRINGS - -/* Platform/compiler supports void * as second parameter to gettimeofday(). */ -#define ACE_HAS_VOIDPTR_GETTIMEOFDAY - -/* Compiler/platform supports SVR4 dynamic linking semantics */ -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -/* Compiler/platform supports SVR4 TLI (in particular, T_GETNAME stuff)... */ -#define ACE_HAS_SVR4_TLI - -/* Compiler/platform contains the <sys/syscall.h> file. */ -#define ACE_HAS_SYS_SYSCALL_H - -/* Platform supports system configuration information */ -#define ACE_HAS_SYS_SYSTEMINFO_H -#define ACE_HAS_SYSV_SYSINFO 1 - -/* Platform supports System V IPC (most versions of UNIX, but not Win32) */ -#define ACE_HAS_SYSV_IPC 1 - -/* Platform provides <sys/filio.h> header */ -#define ACE_HAS_SYS_FILIO_H 1 - -/* Platform provides <sys/xti.h> header */ -#define ACE_HAS_SYS_XTI_H 1 - -/* Compiler implements templates that support typedefs inside of classes used - as formal arguments to a template class. */ -#define ACE_HAS_TEMPLATE_TYPEDEFS 1 - -/* Platform has POSIX terminal interface. */ -#define ACE_HAS_TERMIOS 1 - -/* Platform supports threads */ -#define ACE_HAS_THREADS 1 - -/* Compiler/platform has thread-specific storage */ -#define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 - -/* Platform supports TLI timod STREAMS module */ -#define ACE_HAS_TIMOD_H 1 - -/* Platform supports TLI tiuser header */ -#define ACE_HAS_TIUSER_H 1 - -/* Platform supports TLI. Also see ACE_TLI_TCP_DEVICE. */ -#define ACE_HAS_TLI 1 - -/* Platform provides TLI function prototypes */ -#define ACE_HAS_TLI_PROTOTYPES 1 - -/* Platform supports ualarm() */ -#define ACE_HAS_UALARM 1 - -/* Platform supports ucontext_t (which is used in the extended signal API). */ -#define ACE_HAS_UCONTEXT_T 1 - -/* Platform has <utime.h> header file */ -#define ACE_HAS_UTIME 1 - -/* Prints out console message in ACE_NOTSUP. Useful for tracking down origin - of ACE_NOTSUP. */ -/* #undef ACE_HAS_VERBOSE_NOTSUP */ - -/* Platform requires void * for mmap(). */ -#define ACE_HAS_VOIDPTR_MMAP 1 - -/* Platform has XTI (X/Open-standardized superset of TLI). Implies - ACE_HAS_TLI but uses a different header file. */ -#define ACE_HAS_XTI 1 - -/* Platform can not build ace/IOStream{,_T}.cpp. This does not necessarily - mean that the platform does not support iostreams. */ -#define ACE_LACKS_ACE_IOSTREAM 1 - -/* Platform does not have u_longlong_t typedef */ -#define ACE_LACKS_U_LONGLONG_T 1 - -/* Platform lacks madvise() (e.g., Linux) */ -#define ACE_LACKS_MADVISE 1 - -/* Platform lacks pri_t (e.g., Tandem NonStop UNIX). */ -#define ACE_LACKS_PRI_T 1 - -/* Platform lacks pthread_thr_sigsetmask (e.g., MVS, HP/UX, and OSF/1 3.2) */ -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 - -/* Platfrom lack pthread_yield() support. */ -#define ACE_LACKS_PTHREAD_YIELD 1 - -/* Platform lacks readers/writer locks. */ -#define ACE_LACKS_RWLOCK_T 1 - -/* MIT pthreads platform lacks the timedwait prototypes */ -#define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 - -/* Platform does not define timepec_t as a typedef for struct timespec. */ -#define ACE_LACKS_TIMESPEC_T 1 - -/* Compile using multi-thread libraries */ -#define ACE_MT_SAFE 1 - -/* Platform needs to #include <sched.h> to get thread scheduling defs. */ -#define ACE_NEEDS_SCHED_H 1 - -/* The OS/platform supports the poll() event demultiplexor */ -#define ACE_USE_POLL 1 - -/* Platform has its standard c++ library in the namespace std. */ -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 - -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long double. */ -#define SIZEOF_LONG_DOUBLE 12 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a signed char. */ -#define SIZEOF_SIGNED_CHAR 1 - -/* The number of bytes in a void *. */ -#define SIZEOF_VOID_P 4 - -/* Define if you have the execv function. */ -#define HAVE_EXECV 1 - -/* Define if you have the execve function. */ -#define HAVE_EXECVE 1 - -/* Define if you have the execvp function. */ -#define HAVE_EXECVP 1 - -/* Define if you have the <dirent.h> header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the <fstream> header file. */ -#define HAVE_FSTREAM 1 - -/* Define if you have the <iomanip> header file. */ -#define HAVE_IOMANIP 1 - -/* Define if you have the <iostream> header file. */ -#define HAVE_IOSTREAM 1 - -/* Define if you have the <pwd.h> header file. */ -#define HAVE_PWD_H 1 - -/* Name of package */ -#define PACKAGE "ace" - -/* Version number of package */ -#define VERSION "4.6.37" - -/* Added by Staller */ -#define ENUM_BOOLEAN // See file /usr/local/lib/gcc-lib/i486-pc-sysv5/egcs-2.91.60/include/sys/types.h -/* Hat nix gebracht -#define ACE_DEFAULT_SELECT_REACTOR_SIZE 256 // this is like in linux config fileto avoid another error -*/ -#define howmany(x, y) (((x)+((y)-1))/(y)) -#define ACE_HAS_BROKEN_T_ERROR // let disappear a nasty warning from OS.i -#if !defined (__USLC__) -# define __USLC__ 1 -#endif - -#define __IOCTL_VERSIONED__ // By Carlo! -#endif /* ACE_UNIXWARE_UDK_H */ diff --git a/dep/acelite/ace/config-visualage.h b/dep/acelite/ace/config-visualage.h deleted file mode 100644 index 4cef8108bc5..00000000000 --- a/dep/acelite/ace/config-visualage.h +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- C++ -*- */ -// $Id: config-visualage.h 80826 2008-03-04 14:51:23Z wotte $ - -// This configuration file automatically includes the proper -// configurations for IBM's VisualAge C++ compiler on Win32 and AIX. - -#ifndef CONFIG_VISUALAGE_H -#define CONFIG_VISUALAGE_H -#include /**/ "ace/pre.h" - -#ifdef __TOS_WIN__ - #include "ace/config-win32.h" -#elif __TOS_AIX__ - #include "ace/config-aix-4.x.h" -#else - #include "PLATFORM NOT SPECIFIED" -#endif /* __TOS_WIN__ */ - -#include /**/ "ace/post.h" -#endif //CONFIG_VISUALAGE_H diff --git a/dep/acelite/ace/config-vxworks.h b/dep/acelite/ace/config-vxworks.h index fd4e04193c0..79e51ebd321 100644 --- a/dep/acelite/ace/config-vxworks.h +++ b/dep/acelite/ace/config-vxworks.h @@ -1,5 +1,5 @@ //* -*- C++ -*- */ -// $Id: config-vxworks.h 87036 2009-10-10 18:21:39Z johnnyw $ +// $Id: config-vxworks.h 95534 2012-02-17 23:19:33Z mitza $ // The following configuration file is designed to work for VxWorks // Based on ACE_VXWORKS it will select the correct config file @@ -33,6 +33,8 @@ # define ACE_VXWORKS 0x670 # elif (_WRS_VXWORKS_MINOR == 8) # define ACE_VXWORKS 0x680 +# elif (_WRS_VXWORKS_MINOR == 9) +# define ACE_VXWORKS 0x690 # endif # endif # endif @@ -48,6 +50,8 @@ # include "ace/config-vxworks6.7.h" #elif (ACE_VXWORKS == 0x680) # include "ace/config-vxworks6.8.h" +#elif (ACE_VXWORKS == 0x690) +# include "ace/config-vxworks6.9.h" #else #error Unknown or unsupported VxWorks version #endif diff --git a/dep/acelite/ace/config-vxworks6.4.h b/dep/acelite/ace/config-vxworks6.4.h index 9a0487f36bf..4ed50a7a1df 100644 --- a/dep/acelite/ace/config-vxworks6.4.h +++ b/dep/acelite/ace/config-vxworks6.4.h @@ -1,5 +1,5 @@ //* -*- C++ -*- */ -// $Id: config-vxworks6.4.h 91683 2010-09-09 09:07:49Z johnnyw $ +// $Id: config-vxworks6.4.h 93571 2011-03-17 07:37:11Z olli $ // The following configuration file is designed to work for VxWorks // 6.4 platforms using one of these compilers: @@ -48,7 +48,7 @@ #elif defined (__DCC__) # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_TEMPLATES_REQUIRE_SOURCE -#else /* ! __GNUG__ && ! ghs && !__DCC__ */ +#else /* ! __GNUG__ && !__DCC__ */ # ifdef __cplusplus /* Let it slide for C compilers. */ # error unsupported compiler on VxWorks # endif /* __cplusplus */ @@ -238,7 +238,6 @@ #define ACE_LACKS_STDINT_H #define ACE_LACKS_UNAME #define ACE_LACKS_UTSNAME_T - #define ACE_LACKS_RAND_REENTRANT_FUNCTIONS #define ACE_LACKS_DLFCN_H #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID diff --git a/dep/acelite/ace/config-vxworks6.8.h b/dep/acelite/ace/config-vxworks6.8.h index ecad4752d95..14e072df663 100644 --- a/dep/acelite/ace/config-vxworks6.8.h +++ b/dep/acelite/ace/config-vxworks6.8.h @@ -1,5 +1,5 @@ //* -*- C++ -*- */ -// $Id: config-vxworks6.8.h 87036 2009-10-10 18:21:39Z johnnyw $ +// $Id: config-vxworks6.8.h 96050 2012-08-14 22:22:54Z mitza $ // The following configuration file is designed to work for VxWorks // 6.8 platforms using one of these compilers: @@ -16,6 +16,14 @@ #include "ace/config-vxworks6.7.h" +#ifndef ACE_LACKS_RAND_R +# define ACE_LACKS_RAND_R 1 +#endif + +#ifndef __RTP__ +# define ACE_LACKS_STD_WSTRING +#endif + #include /**/ "ace/post.h" #endif /* ACE_CONFIG_VXWORKS_6_8_H */ diff --git a/dep/acelite/ace/config-vxworks6.9.h b/dep/acelite/ace/config-vxworks6.9.h new file mode 100644 index 00000000000..f15b2304621 --- /dev/null +++ b/dep/acelite/ace/config-vxworks6.9.h @@ -0,0 +1,33 @@ +//* -*- C++ -*- */ +// $Id: config-vxworks6.9.h 96017 2012-08-08 22:18:09Z mitza $ + +// The following configuration file is designed to work for VxWorks +// 6.9 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.9 +// 2) The Diab compiler that is shipped with VxWorks 6.9 + +#ifndef ACE_CONFIG_VXWORKS_6_9_H +#define ACE_CONFIG_VXWORKS_6_9_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x690 +#endif /* ! ACE_VXWORKS */ + +#define ACE_HAS_SSIZE_T + +#include "ace/config-vxworks6.8.h" + +#ifndef ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +// already defined for earlier RTP versions +# define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 +#endif + +#if defined(__RTP__) +// bzero is in strings.h +# define ACE_HAS_STRINGS 1 +#endif + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_9_H */ + diff --git a/dep/acelite/ace/config-win32-borland.h b/dep/acelite/ace/config-win32-borland.h deleted file mode 100644 index f5305d3b003..00000000000 --- a/dep/acelite/ace/config-win32-borland.h +++ /dev/null @@ -1,172 +0,0 @@ -// -*- C++ -*- -//$Id: config-win32-borland.h 92102 2010-09-30 08:14:15Z johnnyw $ - -// The following configuration file contains defines for Borland compilers. - -#ifndef ACE_CONFIG_WIN32_BORLAND_H -#define ACE_CONFIG_WIN32_BORLAND_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#define ACE_HAS_CUSTOM_EXPORT_MACROS -#define ACE_Proper_Export_Flag __declspec (dllexport) -#define ACE_Proper_Import_Flag __declspec (dllimport) -#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T -#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE<CLASS, LOCK>; -#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T -#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE <CLASS, LOCK>; - -// In later versions of C++Builder we will prefer inline functions by -// default. The debug configuration of ACE is built with functions -// out-of-line, so when linking your application against a debug ACE -// build, you can choose to use the out-of-line functions by adding -// ACE_NO_INLINE=1 to your project settings. -# if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ 1 -# endif /* __ACE_INLINE__ */ - -# define ACE_CC_NAME ACE_TEXT ("Embarcadero C++ Builder") -# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100) -# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100) -# define ACE_CC_BETA_VERSION (0) - -#if (__BORLANDC__ >= 0x620) -# define ACE_CC_PREPROCESSOR_ARGS "-q -Sl -o%s" -#else -# define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s" -#endif - -// Automatically define WIN32 macro if the compiler tells us it is our -// target platform. -# if defined (__WIN32__) && !defined (WIN32) -# define WIN32 1 -# endif - -// When building a VCL application, the main VCL header file should be -// included before anything else. You can define ACE_HAS_VCL=1 in your -// project settings to have this file included for you automatically. -# if defined (ACE_HAS_VCL) && (ACE_HAS_VCL != 0) -# include /**/ <vcl.h> -# endif - -# define ACE_CC_PREPROCESSOR "CPP32.EXE" - -# include "ace/config-win32-common.h" - -# define ACE_WSTRING_HAS_USHORT_SUPPORT 1 -# define ACE_HAS_DIRENT - -#define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 1 - -#define ACE_NEEDS_DL_UNDERSCORE - -#define ACE_LACKS_TERMIOS_H -#define ACE_LACKS_NETINET_TCP_H -#define ACE_LACKS_REGEX_H -#define ACE_LACKS_SYS_MSG_H -#define ACE_LACKS_PWD_H -#define ACE_LACKS_POLL_H -#define ACE_LACKS_SYS_SHM_H -#define ACE_LACKS_STRINGS_H -#define ACE_LACKS_SEMAPHORE_H -#define ACE_LACKS_INTTYPES_H -#define ACE_LACKS_UCONTEXT_H -#define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_SYS_TIME_H -#define ACE_LACKS_SYS_RESOURCE_H -#define ACE_LACKS_SYS_WAIT_H -#define ACE_LACKS_DLFCN_H -#define ACE_LACKS_SYS_MMAN_H -#define ACE_LACKS_SYS_UIO_H -#define ACE_LACKS_SYS_SOCKET_H -#define ACE_LACKS_NETINET_IN_H -#define ACE_LACKS_NETDB_H -#define ACE_LACKS_NET_IF_H -#define ACE_LACKS_SYS_IPC_H -#define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_SYS_IOCTL_H -#define ACE_LACKS_STROPTS_H - -#undef ACE_LACKS_STRUCT_DIR -#undef ACE_LACKS_CLOSEDIR -#undef ACE_LACKS_OPENDIR -#undef ACE_LACKS_READDIR -#undef ACE_LACKS_REWINDDIR - -#define ACE_HAS_WOPENDIR -#define ACE_HAS_WCLOSEDIR -#define ACE_HAS_WREADDIR -#define ACE_HAS_WREWINDDIR - -#define ACE_LACKS_STRRECVFD -#define ACE_USES_EXPLICIT_STD_NAMESPACE - -#define ACE_HAS_TIME_T_LONG_MISMATCH - -#define ACE_EXPORT_NESTED_CLASSES 1 -#define ACE_HAS_CPLUSPLUS_HEADERS 1 -#define ACE_HAS_NONCONST_SELECT_TIMEVAL -#define ACE_HAS_SIG_ATOMIC_T -#define ACE_HAS_STANDARD_CPP_LIBRARY 1 -#define ACE_HAS_STDCPP_STL_INCLUDES 1 -#define ACE_HAS_STRING_CLASS 1 -#define ACE_HAS_USER_MODE_MASKS 1 -#define ACE_LACKS_ACE_IOSTREAM 1 -#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -#define ACE_HAS_NEW_NOTHROW -#define ACE_TEMPLATES_REQUIRE_SOURCE 1 -#define ACE_SIZEOF_LONG_DOUBLE 10 -#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Lu" -#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" -#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -#define ACE_USES_STD_NAMESPACE_FOR_ABS 1 -#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) - -#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -// must have _MT defined to include multithreading -// features from win32 headers -# if !defined(__MT__) -// *** DO NOT *** defeat this error message by defining __MT__ yourself. -// You must link with the multi threaded libraries. Add -tWM to your -// compiler options -# error You must link against multi-threaded libraries when using ACE (check your project settings) -# endif /* !_MT && !ACE_HAS_WINCE */ -#endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ - -#if (__BORLANDC__ < 0x620) -# define ACE_LACKS_ISBLANK -# define ACE_LACKS_ISWBLANK -# define ACE_LACKS_PRAGMA_ONCE 1 -#endif - -#if (__BORLANDC__ < 0x630) -# define ACE_LACKS_ISWCTYPE -# define ACE_LACKS_ISCTYPE -#endif - -#if (__BORLANDC__ < 0x620) -// Older Borland compilers can't handle assembly in inline methods or -// templates (E2211). When we build for pentium optimized and we are inlining -// then we disable inline assembly -# if defined (ACE_HAS_PENTIUM) && defined(__ACE_INLINE__) -# define ACE_LACKS_INLINE_ASSEMBLY -# endif -#endif - -#if (__BORLANDC__ == 0x621) -// C++ Builder 2010 wcsncat seems broken -# define ACE_LACKS_WCSNCAT -#endif - -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup -#define ACE_STRCASECMP_EQUIVALENT ::stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::strnicmp -#define ACE_WTOF_EQUIVALENT ::_wtof -#define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) -#define ACE_HAS_ITOA 1 - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_BORLAND_H */ diff --git a/dep/acelite/ace/config-win32-common.h b/dep/acelite/ace/config-win32-common.h index 95cc3d3d107..098ddbd5701 100644 --- a/dep/acelite/ace/config-win32-common.h +++ b/dep/acelite/ace/config-win32-common.h @@ -1,5 +1,5 @@ /* -*- C++ -*- */ -// $Id: config-win32-common.h 92120 2010-10-01 12:00:01Z johnnyw $ +// $Id: config-win32-common.h 96094 2012-08-22 11:51:11Z johnnyw $ #ifndef ACE_CONFIG_WIN32_COMMON_H @@ -10,7 +10,6 @@ #error Use config-win32.h in config.h instead of this header #endif /* ACE_CONFIG_WIN32_H */ - // Windows Mobile (CE) stuff is primarily further restrictions to what's // in the rest of this file. Also, it defined ACE_HAS_WINCE, which is used // in this file. @@ -18,6 +17,21 @@ # include "ace/config-WinCE.h" #endif /* _WIN32_WCE */ +#if defined(__MINGW32__) +// When using the --std=c++0x option with MinGW the compiler omits defining +// the following required macros (at least with the GCC 4.6.2 version) +// So we define them ourselves here. +# if !defined(WIN32) +# define _stdcall __attribute__((__stdcall__)) +# define _cdecl __attribute__((__cdecl__)) +# define _thiscall __attribute__((__thiscall__)) +# define _fastcall __attribute__((__fastcall__)) +# define WIN32 1 +# define WINNT 1 +# define i386 1 +# endif +#endif + // Complain if WIN32 is not already defined. #if !defined (WIN32) && !defined (ACE_HAS_WINCE) # error Please define WIN32 in your project settings. @@ -27,6 +41,12 @@ #if defined (_WIN64) || defined (WIN64) # define ACE_WIN64 +// MPC template adds _AMD64_ but user projects not generated using MPC +// may want to use _AMD64_ as well. Ensure it's there in all cases. +# ifndef _AMD64_ +# define _AMD64_ +# endif + // Use 64-bit file offsets by default in the WIN64 case, similar to // what 64-bit UNIX systems do. // @@ -227,6 +247,10 @@ #define ACE_LACKS_SEEKDIR #define ACE_LACKS_TELLDIR +#define ACE_LACKS_CLOCKID_T +#define ACE_LACKS_CLOCK_REALTIME +#define ACE_LACKS_CLOCK_MONOTONIC + /* LACKS gid/pid/sid/uid facilities */ #define ACE_LACKS_GETPGID #define ACE_LACKS_GETPPID @@ -258,6 +282,7 @@ #define ACE_LACKS_MODE_MASKS #define ACE_LACKS_PTHREAD_H #define ACE_LACKS_PWD_FUNCTIONS +#define ACE_LACKS_RAND_R #define ACE_LACKS_READLINK #define ACE_LACKS_RLIMIT #define ACE_LACKS_SBRK @@ -265,6 +290,7 @@ #define ACE_LACKS_SEMBUF_T #define ACE_LACKS_SIGACTION #define ACE_LACKS_SIGSET +#define ACE_LACKS_SIGSET_T #define ACE_LACKS_SOCKETPAIR #define ACE_LACKS_SUSECONDS_T #define ACE_LACKS_USECONDS_T @@ -301,7 +327,7 @@ #define ACE_SIZEOF_LONG_LONG 8 -#if !defined (ACE_LACKS_LONGLONG_T) && !defined (__MINGW32__) +#if !defined (__MINGW32__) #define ACE_INT64_TYPE signed __int64 #define ACE_UINT64_TYPE unsigned __int64 #endif @@ -501,9 +527,9 @@ # else # pragma comment(lib, "ws2_32.lib") # pragma comment(lib, "mswsock.lib") -# if defined (ACE_HAS_IPV6) +// # if defined (ACE_HAS_IPV6) # pragma comment(lib, "iphlpapi.lib") -# endif +// # endif # endif /* ACE_HAS_WINCE */ # endif /* _MSC_VER */ @@ -580,6 +606,9 @@ // Looks like Win32 has a non-const swab function #define ACE_HAS_NONCONST_SWAB +// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses +#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED + // If we are using winsock2 then the SO_REUSEADDR feature is broken // SO_REUSEADDR=1 behaves like SO_REUSEPORT=1. (SO_REUSEPORT is an // extension to sockets on some platforms) diff --git a/dep/acelite/ace/config-win32-ghs.h b/dep/acelite/ace/config-win32-ghs.h deleted file mode 100644 index 0ac80bfbd11..00000000000 --- a/dep/acelite/ace/config-win32-ghs.h +++ /dev/null @@ -1,93 +0,0 @@ -// -*- C++ -*- -// $Id: config-win32-ghs.h 87268 2009-10-29 21:06:06Z olli $ - -// The following configuration file contains defines for Green Hills compilers. - -#ifndef ACE_CONFIG_WIN32_GHS_H -#define ACE_CONFIG_WIN32_GHS_H -#include /**/ "ace/pre.h" - -#ifndef ACE_CONFIG_WIN32_H -#error Use config-win32.h in config.h instead of this header -#endif /* ACE_CONFIG_WIN32_H */ - -#ifndef WIN32 -# define WIN32 -#endif /* WIN32 */ - -#undef _M_IX86 -// This turns on ACE_HAS_PENTIUM -#define _M_IX86 500 -// GHS does not provide DLL support -#define ACE_HAS_DLL 0 -#define TAO_HAS_DLL 0 -#undef _DLL - -//Green Hills Native x86 does not support structural exceptions -# undef ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS -# undef ACE_HAS_WCHAR -# define ACE_CONFIG_INCLUDE_GHS_COMMON -# include "ace/config-ghs-common.h" - -// Changed ACE_TEXT to ACE_TEXT in the following line -# define ACE_CC_NAME ACE_TEXT ("Green Hills C++") -# define ACE_CC_MAJOR_VERSION (1) -# define ACE_CC_MINOR_VERSION (8) -# define ACE_CC_BETA_VERSION (9) -# ifndef ACE_USING_MCPP_PREPROCESSOR -# define ACE_CC_PREPROCESSOR "GCX.EXE" -# define ACE_CC_PREPROCESSOR_ARGS "-E" -# endif - -// GHS uses Microsoft's standard cpp library, which has auto_ptr. -# undef ACE_LACKS_AUTO_PTR -// Microsoft's standard cpp library auto_ptr doesn't have reset (). -# define ACE_AUTO_PTR_LACKS_RESET - -#define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) - -// This section below was extracted from config-win32-msvc -#define ACE_HAS_ITOA -#define ACE_ITOA_EQUIVALENT ::_itoa -#define ACE_STRCASECMP_EQUIVALENT ::_stricmp -#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp -#define ACE_WCSDUP_EQUIVALENT ::_wcsdup -// This section above was extracted from config-win32-msvc - -# define ACE_EXPORT_NESTED_CLASSES 1 -# define ACE_HAS_CPLUSPLUS_HEADERS 1 -//# define ACE_HAS_EXCEPTIONS 1 -# define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 -# define ACE_HAS_SIG_ATOMIC_T 1 -# define ACE_HAS_STANDARD_CPP_LIBRARY 1 -# define ACE_HAS_STDCPP_STL_INCLUDES 1 -# define ACE_HAS_STRING_CLASS 1 -# define ACE_HAS_TEMPLATE_TYPEDEFS 1 -# define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_LACKS_ACE_IOSTREAM 1 -//# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 -# define ACE_LACKS_STRPTIME 1 -//# define ACE_LACKS_PRAGMA_ONCE 1 -# define ACE_LACKS_STRRECVFD 1 -//# define ACE_NEW_THROWS_EXCEPTIONS 1 -# define ACE_SIZEOF_LONG_DOUBLE 10 -# define ACE_TEMPLATES_REQUIRE_SOURCE 1 -# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" -# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" -# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 -// Set the following to zero to placate SString.h ACE_WString CTOR -# undef ACE_WSTRING_HAS_USHORT_SUPPORT - -// Green Hills Native x86 does not support __int64 keyword -# define ACE_LACKS_LONGLONG_T - -/* need to ensure these are included before <iomanip> */ -# include <time.h> -# include <stdlib.h> - -# if !defined (ACE_LD_DECORATOR_STR) && defined (_DEBUG) -# define ACE_LD_DECORATOR_STR ACE_TEXT ("d") -# endif - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_WIN32_GHS_H */ diff --git a/dep/acelite/ace/config-win32-interix.h b/dep/acelite/ace/config-win32-interix.h index 2fa9695996c..a1a8faefff7 100644 --- a/dep/acelite/ace/config-win32-interix.h +++ b/dep/acelite/ace/config-win32-interix.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: config-win32-interix.h 91285 2010-08-05 08:29:30Z johnnyw $ +// $Id: config-win32-interix.h 93550 2011-03-15 21:26:56Z olli $ // The following configuration file is designed to work for Interix // platforms using GNU g++ (Interix == Microsoft's Services for Unix) @@ -11,6 +11,7 @@ #include "ace/config-g++-common.h" +#define ACE_HAS_SYS_SIGINFO_H #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R #define ACE_HAS_3_PARAM_READDIR_R #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG @@ -32,11 +33,8 @@ #define ACE_HAS_NEW_NO_H #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_HAS_POLL -#define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -#define ACE_HAS_POSIX_GETPWNAM_R #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_POSIX_TIME -#define ACE_HAS_PTHREADS_STD #define ACE_HAS_PTHREADS_UNIX98_EXT #define ACE_HAS_PTHREAD_GETCONCURRENCY #define ACE_HAS_PTHREAD_SETCONCURRENCY diff --git a/dep/acelite/ace/config-win32-mingw.h b/dep/acelite/ace/config-win32-mingw.h index 58635b74ca8..a34ff605b2d 100644 --- a/dep/acelite/ace/config-win32-mingw.h +++ b/dep/acelite/ace/config-win32-mingw.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: config-win32-mingw.h 92102 2010-09-30 08:14:15Z johnnyw $ +// $Id: config-win32-mingw.h 95438 2012-01-16 10:35:03Z mcorino $ // // The following configuration file is designed to work for win32 @@ -28,11 +28,17 @@ #define ACE_HAS_USER_MODE_MASKS -#if (__MINGW32_MAJOR_VERSION < 2) +#if (__MINGW32_MAJOR_VERSION < 2) && (__MINGW64_VERSION_MAJOR < 3) # error You need a newer version (>= 2.0) of mingw32/w32api #endif -#if (__MINGW32_MAJOR_VERSION >= 3) +// In strict ANSI mode (default when using --std=c++0x) the fileno() +// macro is not defined so use the following work around. +#if defined(__STRICT_ANSI__) +# define ACE_FILENO_EQUIVALENT ::_fileno +#endif + +#if (__MINGW32_MAJOR_VERSION >= 3) || (__MINGW64_VERSION_MAJOR >= 3) # define ACE_HAS_SSIZE_T # undef ACE_LACKS_STRUCT_DIR # undef ACE_LACKS_OPENDIR @@ -47,6 +53,22 @@ #if (__MINGW32_MAJOR_VERSION > 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 15)) # undef ACE_LACKS_USECONDS_T +#elif (__MINGW64_VERSION_MAJOR >= 3) +# undef ACE_LACKS_USECONDS_T +#endif + +#if (__MINGW64_VERSION_MAJOR >= 3) +# define ACE_HAS_POSIX_TIME 1 +# define ACE_LACKS_TIMESPEC_T 1 + +# include <stdlib.h> +# if defined (strtod) +# undef strtod +# endif +#else +# if defined (ACE_LACKS_SIGSET_T) +# undef ACE_LACKS_SIGSET_T +# endif #endif #undef ACE_HAS_WTOF @@ -78,6 +100,8 @@ #define ACE_LACKS_SYS_IOCTL_H #define ACE_LACKS_PDH_H #define ACE_LACKS_PDHMSG_H +#define ACE_LACKS_STRTOK_R +#define ACE_LACKS_LOCALTIME_R #define ACE_HAS_NONCONST_WCSDUP #define ACE_HAS_WINSOCK2_GQOS #define ACE_ISCTYPE_EQUIVALENT ::_isctype diff --git a/dep/acelite/ace/config-win32-msvc-10.h b/dep/acelite/ace/config-win32-msvc-10.h index f915cb22ca9..2cbcd941ae6 100644 --- a/dep/acelite/ace/config-win32-msvc-10.h +++ b/dep/acelite/ace/config-win32-msvc-10.h @@ -3,7 +3,7 @@ /** * @file config-win32-msvc-10.h * - * $Id: config-win32-msvc-10.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: config-win32-msvc-10.h 95719 2012-05-01 12:54:01Z johnnyw $ * * @brief Microsoft Visual C++ 10.0 configuration file. * @@ -35,11 +35,10 @@ #endif // Windows' timeval is non-conformant (defined in terms of long instead of -// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value -// even when compiling a 32-bit application. Therefore, ace/Time_Value -// needs to rearrange a few things for this compiler. See Time_Value.h -// for complete details. -#if !defined (ACE_HAS_WINCE) +// time_t) and VC8 changed time_t to a 64-bit value even when compiling a +// 32-bit application. Therefore, ace/Time_Value needs to rearrange a few +// things for this compiler. See Time_Value.h for complete details. +#if !defined (_USE_32BIT_TIME_T) # define ACE_HAS_TIME_T_LONG_MISMATCH #endif diff --git a/dep/acelite/ace/config-win32-msvc-7.h b/dep/acelite/ace/config-win32-msvc-7.h index d7fb64078d9..93ced167cc3 100644 --- a/dep/acelite/ace/config-win32-msvc-7.h +++ b/dep/acelite/ace/config-win32-msvc-7.h @@ -3,7 +3,7 @@ /** * @file config-win32-msvc-7.h * - * $Id: config-win32-msvc-7.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: config-win32-msvc-7.h 93562 2011-03-16 14:13:52Z olli $ * * @brief Microsoft Visual C++ 7.0 configuration file. * @@ -48,6 +48,9 @@ #define ACE_LACKS_STRPTIME +#define ACE_LACKS_STRTOK_R +#define ACE_LACKS_LOCALTIME_R + #define ACE_HAS_SIG_ATOMIC_T #define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES #define ACE_LACKS_STRRECVFD diff --git a/dep/acelite/ace/config-win32-msvc-8.h b/dep/acelite/ace/config-win32-msvc-8.h index ef13986f906..fa6c63a1fd3 100644 --- a/dep/acelite/ace/config-win32-msvc-8.h +++ b/dep/acelite/ace/config-win32-msvc-8.h @@ -3,7 +3,7 @@ /** * @file config-win32-msvc-8.h * - * $Id: config-win32-msvc-8.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: config-win32-msvc-8.h 95719 2012-05-01 12:54:01Z johnnyw $ * * @brief Microsoft Visual C++ 8.0 configuration file. * @@ -37,11 +37,10 @@ #endif // Windows' timeval is non-conformant (defined in terms of long instead of -// time_t) and VC8 (on desktop, not CE) changed time_t to a 64-bit value -// even when compiling a 32-bit application. Therefore, ace/Time_Value -// needs to rearrange a few things for this compiler. See Time_Value.h -// for complete details. -#if !defined (ACE_HAS_WINCE) +// time_t) and VC8 changed time_t to a 64-bit value even when compiling a +// 32-bit application. Therefore, ace/Time_Value needs to rearrange a few +// things for this compiler. See Time_Value.h for complete details. +#if !defined (_USE_32BIT_TIME_T) # define ACE_HAS_TIME_T_LONG_MISMATCH #endif @@ -131,7 +130,7 @@ # define ACE_HAS_TR24731_2005_CRT #endif -//Detect Platform SDK 64-bit (AMD64) compiler using _MSC_FULL_VER +// Detect Platform SDK 64-bit (AMD64) compiler using _MSC_FULL_VER #if (defined (_WIN64) || defined (WIN64)) && _MSC_FULL_VER < 140050000 # define ACE_AUTO_PTR_LACKS_RESET # define ACE_MSVC_USES_DOUBLE_UNDERSCORE_STAT64 diff --git a/dep/acelite/ace/config-win32-msvc-9.h b/dep/acelite/ace/config-win32-msvc-9.h index 884f975347e..551b80f7694 100644 --- a/dep/acelite/ace/config-win32-msvc-9.h +++ b/dep/acelite/ace/config-win32-msvc-9.h @@ -3,7 +3,7 @@ /** * @file config-win32-msvc-9.h * - * $Id: config-win32-msvc-9.h 91685 2010-09-09 09:35:14Z johnnyw $ + * $Id: config-win32-msvc-9.h 95719 2012-05-01 12:54:01Z johnnyw $ * * @brief Microsoft Visual C++ 9.0 configuration file. * @@ -35,11 +35,10 @@ #endif // Windows' timeval is non-conformant (defined in terms of long instead of -// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value -// even when compiling a 32-bit application. Therefore, ace/Time_Value -// needs to rearrange a few things for this compiler. See Time_Value.h -// for complete details. -#if !defined (ACE_HAS_WINCE) +// time_t) and VC9 changed time_t to a 64-bit value even when compiling a +// 32-bit application. Therefore, ace/Time_Value needs to rearrange a few +// things for this compiler. See Time_Value.h for complete details. +#if !defined (_USE_32BIT_TIME_T) # define ACE_HAS_TIME_T_LONG_MISMATCH #endif @@ -57,14 +56,13 @@ # define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) #endif -// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. -# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) +// Windows CE 7 doesn't do sig_atomic_t, but maybe future versions will. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x700) # define ACE_HAS_SIG_ATOMIC_T -# endif /* !Win CE 6.0 or less */ +# endif /* !Win CE 7.0 or less */ #define ACE_LACKS_STRPTIME -// Evaluate this with a WinCE build; maybe things have improved since VC8. #if !defined (ACE_HAS_WINCE) # define ACE_HAS_INTRIN_H # define ACE_HAS_INTRINSIC_INTERLOCKED diff --git a/dep/acelite/ace/config-win32-msvc.h b/dep/acelite/ace/config-win32-msvc.h index 6b84ac2348c..d6ec650e5f8 100644 --- a/dep/acelite/ace/config-win32-msvc.h +++ b/dep/acelite/ace/config-win32-msvc.h @@ -2,12 +2,11 @@ /** * @file config-win32-msvc.h * - * $Id: config-win32-msvc.h 92120 2010-10-01 12:00:01Z johnnyw $ + * $Id: config-win32-msvc.h 95788 2012-05-24 07:59:51Z johnnyw $ * * @brief Microsoft Visual C++ configuration file. * - * This file is the ACE configuration file for Microsoft Visual C++ versions - * 5.0, 6.0, and 7.0 (.NET) + * This file is the ACE configuration file for Microsoft Visual C++ * * @author Darrell Brunsch <brunsch@cs.wustl.edu> */ @@ -156,7 +155,7 @@ # pragma warning(disable: 1744) /* field of class type without a DLL interface used in a class with a DLL interface */ # pragma warning(disable: 1738) # endif -#endif /* !ALL_WARNINGS && _MSV_VER && !ghs && !__MINGW32__ */ +#endif /* !ALL_WARNINGS && _MSV_VER && !__MINGW32__ */ // STRICT type checking in WINDOWS.H enhances type safety for Windows // programs by using distinct types to represent all the different diff --git a/dep/acelite/ace/config-win32.h b/dep/acelite/ace/config-win32.h index 89d8d68bc65..3f8caefb6a4 100644 --- a/dep/acelite/ace/config-win32.h +++ b/dep/acelite/ace/config-win32.h @@ -3,7 +3,7 @@ /** * @file config-win32.h * - * $Id: config-win32.h 92120 2010-10-01 12:00:01Z johnnyw $ + * $Id: config-win32.h 94388 2011-08-10 17:14:40Z johnnyw $ * * @brief Microsoft Windows configuration file. * @@ -22,18 +22,10 @@ // NOTE: Please do not add anything besides #include's here. Put other stuff // (definitions, etc.) in the included headers -// We need to ensure that for Borland vcl.h can be included before -// windows.h. So we will not include config-win32-common.h from here, -// but instead let it be included at the appropriate place in -// config-win32-borland.h. -#if !defined (__BORLANDC__) -# include "ace/config-win32-common.h" -#endif /* !__BORLANDC__ */ +#include "ace/config-win32-common.h" // Include the config-win32-* file specific to the compiler -#if defined (__BORLANDC__) -# include "ace/config-win32-borland.h" -#elif defined (_MSC_VER) +#if defined (_MSC_VER) # include "ace/config-win32-msvc.h" #elif defined (ACE_HAS_CEGCC) //need to be prior to MINGW32 # include "ace/config-win32-cegcc.h" @@ -45,9 +37,6 @@ # error Compiler is not supported #endif -// gethostbyaddr does not handle IPv6-mapped-IPv4 addresses -#define ACE_HAS_BROKEN_GETHOSTBYADDR_V4MAPPED - #include /**/ "ace/post.h" #endif /* ACE_CONFIG_WIN32_H */ diff --git a/dep/acelite/ace/config-windows.h b/dep/acelite/ace/config-windows.h new file mode 100644 index 00000000000..28e59c9a3d8 --- /dev/null +++ b/dep/acelite/ace/config-windows.h @@ -0,0 +1,5 @@ +/* -*- C++ -*- */ +// $Id: config-windows.h 94353 2011-07-30 13:13:13Z johnnyw $ + +// This is all we need to do to build ACE on a Windows platform (32bit or 64bit) +#include "config-win32.h" diff --git a/dep/acelite/ace/gethrtime.cpp b/dep/acelite/ace/gethrtime.cpp deleted file mode 100644 index 5c32d16dadd..00000000000 --- a/dep/acelite/ace/gethrtime.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// $Id: gethrtime.cpp 91286 2010-08-05 09:04:31Z johnnyw $ -// -// Build this file with g++. It can be linked in to a ACE application -// that was compiled with GreenHills. It wouldn't be necessary if I -// knew a way to correctly move values from registers to a 64-bit -// variable in GHS asm code. That's easy with g++ asm. - -#include "ace/config-all.h" - - - -#if defined (ghs) && (defined (i386) || defined(__i386__)) - -#include "ace/OS_NS_time.h" - -extern "C" -ACE_hrtime_t -ACE_GETHRTIME_NAME (void) -{ -#if defined (ACE_HAS_PENTIUM) - // ACE_TRACE ("ACE_GETHRTIME_NAME"); - -#if defined (ACE_LACKS_LONGLONG_T) - double now; -#else /* ! ACE_LACKS_LONGLONG_T */ - ACE_hrtime_t now; -#endif /* ! ACE_LACKS_LONGLONG_T */ - - // Read the high-res tick counter directly into memory variable - // "now". The A constraint signifies a 64-bit int. -#if defined (__GNUG__) - asm volatile ("rdtsc" : "=A" (now) : : "memory"); -// #elif defined (ghs) -// The following doesn't work. For now, this file must be compile with g++. -// asm ("rdtsc"); -// asm ("movl %edx,-16(%ebp)"); -// asm ("movl %eax,-12(%ebp)"); -#else -# error unsupported compiler -#endif - -#if defined (ACE_LACKS_LONGLONG_T) - // ACE_U_LongLong doesn't have the same layout as now, so construct - // it "properly". - ACE_UINT32 least, most; - ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32)); - ACE_OS::memcpy (&most, (unsigned char *) &now + sizeof (ACE_UINT32), - sizeof (ACE_UINT32)); - - const ACE_hrtime_t ret (least, most); - return ret; -#else /* ! ACE_LACKS_LONGLONG_T */ - return now; -#endif /* ! ACE_LACKS_LONGLONG_T */ - -#else /* ! ACE_HAS_PENTIUM */ -# error This file can _only_ be compiled with ACE_HAS_PENTIUM. -#endif /* ! ACE_HAS_PENTIUM */ -} -#endif /* ghs */ diff --git a/dep/acelite/ace/os_include/os_dirent.h b/dep/acelite/ace/os_include/os_dirent.h index 034bacd006d..a51317a4612 100644 --- a/dep/acelite/ace/os_include/os_dirent.h +++ b/dep/acelite/ace/os_include/os_dirent.h @@ -6,7 +6,7 @@ * * format of directory entries * - * $Id: os_dirent.h 82985 2008-10-08 18:15:30Z johnnyw $ + * $Id: os_dirent.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -27,10 +27,6 @@ #include "ace/os_include/sys/os_types.h" #include "ace/os_include/os_limits.h" -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include "ace/os_include/os_unistd.h" // VxWorks needs this to compile -#endif /* ACE_VXWORKS */ - #if !defined (ACE_LACKS_DIRENT_H) # include /**/ <dirent.h> #endif /* !ACE_LACKS_DIRENT_H */ diff --git a/dep/acelite/ace/os_include/os_dlfcn.h b/dep/acelite/ace/os_include/os_dlfcn.h index 0f74437fb80..c65d78f197c 100644 --- a/dep/acelite/ace/os_include/os_dlfcn.h +++ b/dep/acelite/ace/os_include/os_dlfcn.h @@ -6,7 +6,7 @@ * * dynamic linking * - * $Id: os_dlfcn.h 82273 2008-07-09 14:21:45Z jtc $ + * $Id: os_dlfcn.h 94379 2011-08-09 17:18:49Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -49,13 +49,6 @@ extern "C" { #endif /* __cplusplus */ -#if defined (_M_UNIX) - int _dlclose (void *); - char *_dlerror (void); - void *_dlopen (const char *, int); - void * _dlsym (void *, const char *); -#endif /* _M_UNIX */ - /* Set the proper handle type for dynamically-loaded libraries. */ /* Also define a default 'mode' for loading a library - the names and values */ /* differ between OSes, so if you write code that uses the mode, be careful */ @@ -63,22 +56,38 @@ extern "C" #if defined (ACE_WIN32) // Dynamic loading-related types - used for dlopen and family. typedef HINSTANCE ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE 0 +# if !defined (ACE_SHLIB_INVALID_HANDLE) +# define ACE_SHLIB_INVALID_HANDLE 0 +# endif /* ACE_SHLIB_INVALID_HANDLE */ +# if !defined (ACE_DEFAULT_SHLIB_MODE) +# define ACE_DEFAULT_SHLIB_MODE 0 +# endif /* ACE_DEFAULT_SHLIB_MODE */ #elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING) typedef void *ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 +# if !defined (ACE_SHLIB_INVALID_HANDLE) +# define ACE_SHLIB_INVALID_HANDLE 0 +# endif /* ACE_SHLIB_INVALID_HANDLE */ // This is needed to for dynamic_cast to work properly on objects passed to // libraries. -# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GLOBAL +# if !defined (ACE_DEFAULT_SHLIB_MODE) +# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY | RTLD_GLOBAL +# endif #elif defined (__hpux) typedef shl_t ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED | DYNAMIC_PATH +# if !defined (ACE_SHLIB_INVALID_HANDLE) +# define ACE_SHLIB_INVALID_HANDLE 0 +# endif /* ACE_SHLIB_INVALID_HANDLE */ +# if !defined (ACE_DEFAULT_SHLIB_MODE) +# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED | DYNAMIC_PATH +# endif /* ACE_DEFAULT_SHLIB_MODE */ #else /* !ACE_WIN32 && !ACE_HAS_SVR4_DYNAMIC_LINKING && !__hpux */ typedef void *ACE_SHLIB_HANDLE; -# define ACE_SHLIB_INVALID_HANDLE 0 -# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY +# if !defined (ACE_SHLIB_INVALID_HANDLE) +# define ACE_SHLIB_INVALID_HANDLE 0 +# endif /* ACE_SHLIB_INVALID_HANDLE */ +# if !defined (ACE_DEFAULT_SHLIB_MODE) +# define ACE_DEFAULT_SHLIB_MODE RTLD_LAZY +# endif /* ACE_DEFAULT_SHLIB_MODE */ #endif /* ACE_WIN32 */ #if !defined (RTLD_LAZY) diff --git a/dep/acelite/ace/os_include/os_fcntl.h b/dep/acelite/ace/os_include/os_fcntl.h index 048ff62ae6e..bc3796a6b1f 100644 --- a/dep/acelite/ace/os_include/os_fcntl.h +++ b/dep/acelite/ace/os_include/os_fcntl.h @@ -6,7 +6,7 @@ * * file control options * - * $Id: os_fcntl.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: os_fcntl.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -31,11 +31,6 @@ # include /**/ <fcntl.h> #endif /* !ACE_LACKS_FCNTL_H */ -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -// for creat(), open() -# include /**/ <ioLib.h> -#endif /* ACE_VXWORKS */ - // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" diff --git a/dep/acelite/ace/os_include/os_ifaddrs.h b/dep/acelite/ace/os_include/os_ifaddrs.h new file mode 100644 index 00000000000..1009c592a63 --- /dev/null +++ b/dep/acelite/ace/os_include/os_ifaddrs.h @@ -0,0 +1,43 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file os_ifaddrs.h + * + * os_ifaddrs.h include + * + * $Id: os_ifaddrs.h 93622 2011-03-22 15:45:57Z johnnyw $ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef ACE_OS_INCLUDE_OS_IFADDRS_H +#define ACE_OS_INCLUDE_OS_IFADDRS_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_VXWORKS) +# include /**/ <net/ifaddrs.h> +#else +# include /**/ <ifaddrs.h> +#endif /*ACE_VXWORKS */ + +// Place all additions (especially function declarations) within extern "C" {} +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#include /**/ "ace/post.h" +#endif /* ACE_OS_INCLUDE_OS_IFADDRS_H */ diff --git a/dep/acelite/ace/os_include/os_limits.h b/dep/acelite/ace/os_include/os_limits.h index a128efcc060..c0e5e23914a 100644 --- a/dep/acelite/ace/os_include/os_limits.h +++ b/dep/acelite/ace/os_include/os_limits.h @@ -6,7 +6,7 @@ * * implementation-defined constants * - * $Id: os_limits.h 84972 2009-03-25 19:09:06Z johnnyw $ + * $Id: os_limits.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -35,11 +35,6 @@ # include /**/ <sys/param.h> #endif /* ACE_LACKS_SYS_PARAM_H */ -// On VxWorks 5.5.1 _POSIX_TIMER_MAX is defined in time.h -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include /**/ <time.h> -#endif /* ACE_VXWORKS */ - // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" @@ -102,7 +97,7 @@ extern "C" # define ACE_IOV_MAX IOV_MAX #endif /* ACE_IOV_MAX */ -#if defined (ACE_VXWORKS) && ((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x670)) && !defined (__RTP__) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670) && !defined (__RTP__) # if defined (PIPE_BUF) && (PIPE_BUF == -1) # undef PIPE_BUF # endif diff --git a/dep/acelite/ace/os_include/os_netdb.h b/dep/acelite/ace/os_include/os_netdb.h index 87629474aa9..14a8e5d7f8b 100644 --- a/dep/acelite/ace/os_include/os_netdb.h +++ b/dep/acelite/ace/os_include/os_netdb.h @@ -6,7 +6,7 @@ * * definitions for network database operations * - * $Id: os_netdb.h 91743 2010-09-13 18:24:51Z johnnyw $ + * $Id: os_netdb.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -27,10 +27,6 @@ #include "ace/os_include/netinet/os_in.h" #include "ace/os_include/os_limits.h" -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) -# include /**/ <hostLib.h> -#endif /* ACE_VXWORKS */ - // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" diff --git a/dep/acelite/ace/os_include/os_pthread.h b/dep/acelite/ace/os_include/os_pthread.h index 64f1b75537d..aef6fca29ab 100644 --- a/dep/acelite/ace/os_include/os_pthread.h +++ b/dep/acelite/ace/os_include/os_pthread.h @@ -6,7 +6,7 @@ * * threads * - * $Id: os_pthread.h 91781 2010-09-15 12:49:15Z johnnyw $ + * $Id: os_pthread.h 95761 2012-05-15 18:23:04Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -48,11 +48,7 @@ #if !defined (ACE_LACKS_PTHREAD_H) extern "C" { -# if defined (ACE_TANDEM_T1248_PTHREADS) -# include /**/ <spthread.h> -# else # include /**/ <pthread.h> -# endif } #endif /* !ACE_LACKS_PTHREAD_H */ @@ -233,26 +229,10 @@ # endif /* ! ACE_LACKS_COND_T */ typedef pthread_mutex_t ACE_thread_mutex_t; -# if !defined (PTHREAD_CANCEL_DISABLE) -# define PTHREAD_CANCEL_DISABLE 0 -# endif /* PTHREAD_CANCEL_DISABLE */ - -# if !defined (PTHREAD_CANCEL_ENABLE) -# define PTHREAD_CANCEL_ENABLE 0 -# endif /* PTHREAD_CANCEL_ENABLE */ - -# if !defined (PTHREAD_CANCEL_DEFERRED) -# define PTHREAD_CANCEL_DEFERRED 0 -# endif /* PTHREAD_CANCEL_DEFERRED */ - -# if !defined (PTHREAD_CANCEL_ASYNCHRONOUS) -# define PTHREAD_CANCEL_ASYNCHRONOUS 0 -# endif /* PTHREAD_CANCEL_ASYNCHRONOUS */ - -# define THR_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE -# define THR_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE -# define THR_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED -# define THR_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS +# define THR_CANCEL_DISABLE 0x00000100 +# define THR_CANCEL_ENABLE 0x00000200 +# define THR_CANCEL_DEFERRED 0x00000400 +# define THR_CANCEL_ASYNCHRONOUS 0x00000800 # if !defined (PTHREAD_CREATE_JOINABLE) # if defined (PTHREAD_CREATE_UNDETACHED) @@ -292,20 +272,20 @@ # endif /* ACE_HAS_STHREADS */ /* MM-Graz: prevent warnings */ -# undef THR_BOUND -# undef THR_NEW_LWP -# undef THR_DETACHED -# undef THR_SUSPENDED -# undef THR_DAEMON - -# define THR_BOUND 0x00000001 -# define THR_NEW_LWP 0x00000002 -# define THR_DETACHED 0x00000040 -# define THR_SUSPENDED 0x00000080 -# define THR_DAEMON 0x00000100 -# define THR_SCHED_FIFO 0x00020000 -# define THR_SCHED_RR 0x00040000 -# define THR_SCHED_DEFAULT 0x00080000 +# undef THR_BOUND +# undef THR_NEW_LWP +# undef THR_DETACHED +# undef THR_SUSPENDED +# undef THR_DAEMON + +# define THR_BOUND 0x00000001 +# define THR_NEW_LWP 0x00000002 +# define THR_DAEMON 0x00000010 +# define THR_DETACHED 0x00000040 +# define THR_SUSPENDED 0x00000080 +# define THR_SCHED_FIFO 0x00020000 +# define THR_SCHED_RR 0x00040000 +# define THR_SCHED_DEFAULT 0x00080000 # define THR_JOINABLE 0x00010000 @@ -385,7 +365,7 @@ public: const struct timespec * abstime); # endif /* _XOPEN_SOURCE && _XOPEN_SOURCE < 600 */ -# endif /* linux && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) */ +# endif /* ACE_LINUX && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) */ #elif defined (ACE_HAS_STHREADS) # if !defined (ACE_THR_PRI_FIFO_MIN) diff --git a/dep/acelite/ace/os_include/os_pwd.h b/dep/acelite/ace/os_include/os_pwd.h index be00448a9d0..a478a770b3b 100644 --- a/dep/acelite/ace/os_include/os_pwd.h +++ b/dep/acelite/ace/os_include/os_pwd.h @@ -6,7 +6,7 @@ * * password structure * - * $Id: os_pwd.h 91683 2010-09-09 09:07:49Z johnnyw $ + * $Id: os_pwd.h 93564 2011-03-16 14:35:58Z olli $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -36,14 +36,6 @@ extern "C" { #endif /* __cplusplus */ -#if !defined (ACE_WIN32) -// VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined -// in pwd.h, and that redefinition is used here -# if defined (_AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) - extern int _posix_getpwnam_r(const char *, struct passwd *, char *, - int, struct passwd **); -# endif /* AIX and VAC++ 4 */ -#endif /* !ACE_WIN32 */ #ifdef __cplusplus } diff --git a/dep/acelite/ace/os_include/os_signal.h b/dep/acelite/ace/os_include/os_signal.h index 667f28401e4..14e12a81127 100644 --- a/dep/acelite/ace/os_include/os_signal.h +++ b/dep/acelite/ace/os_include/os_signal.h @@ -6,7 +6,7 @@ * * signals * - * $Id: os_signal.h 91781 2010-09-15 12:49:15Z johnnyw $ + * $Id: os_signal.h 95430 2012-01-11 20:45:28Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -34,27 +34,23 @@ #if defined (ACE_HAS_SIGINFO_T) # if !defined (ACE_LACKS_SIGINFO_H) -# if defined (__QNX__) || defined (__OpenBSD__) || defined (__INTERIX) +# if defined (ACE_HAS_SYS_SIGINFO_H) # include /**/ <sys/siginfo.h> -# else /* __QNX__ || __OpenBSD__ */ +# else /* ACE_HAS_SYS_SIGINFO_H */ # include /**/ <siginfo.h> -# endif /* __QNX__ || __OpenBSD__ */ +# endif /* ACE_HAS_SYS_SIGINFO_H */ # endif /* ACE_LACKS_SIGINFO_H */ #endif /* ACE_HAS_SIGINFO_T */ -#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__) -# include /**/ <sigLib.h> -#endif /* ACE_VXWORKS */ - // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#if defined (ACE_LACKS_SIGSET) && !defined (__MINGW32__) +#if defined (ACE_LACKS_SIGSET_T) typedef u_int sigset_t; -#endif /* ACE_LACKS_SIGSET && !sigset_t */ +#endif /* ACE_LACKS_SIGSET_T && !sigset_t */ #if !defined (ACE_HAS_SIG_ATOMIC_T) typedef int sig_atomic_t; diff --git a/dep/acelite/ace/os_include/os_stdio.h b/dep/acelite/ace/os_include/os_stdio.h index e9f452024ff..fe2a7e305e3 100644 --- a/dep/acelite/ace/os_include/os_stdio.h +++ b/dep/acelite/ace/os_include/os_stdio.h @@ -6,7 +6,7 @@ * * standard buffered input/output * - * $Id: os_stdio.h 80826 2008-03-04 14:51:23Z wotte $ + * $Id: os_stdio.h 93597 2011-03-21 12:54:52Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -37,9 +37,6 @@ # include /**/ <ioLib.h> // for remCurIdGet() # include /**/ <remLib.h> -# if defined (__RTP__) && ((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x650)) -# define L_cuserid _PARM_L_cuserid -# endif #endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} diff --git a/dep/acelite/ace/os_include/os_stdlib.h b/dep/acelite/ace/os_include/os_stdlib.h index 863a508029f..5576b142c6a 100644 --- a/dep/acelite/ace/os_include/os_stdlib.h +++ b/dep/acelite/ace/os_include/os_stdlib.h @@ -6,7 +6,7 @@ * * standard library definitions * - * $Id: os_stdlib.h 91683 2010-09-09 09:07:49Z johnnyw $ + * $Id: os_stdlib.h 93573 2011-03-17 07:53:03Z olli $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -45,14 +45,6 @@ extern "C" { #endif /* __cplusplus */ - typedef u_int ACE_RANDR_TYPE; -#if defined (ACE_HAS_BROKEN_RANDR) - // The SunOS 5.4.X version of rand_r is inconsistent with the header - // files... - int rand_r (ACE_RANDR_TYPE seed); -#else -#endif /* ACE_HAS_BROKEN_RANDR */ - #if defined (ACE_LACKS_PUTENV_PROTOTYPE) int putenv (char *); #endif /* ACE_LACKS_PUTENV_PROTOTYPE */ diff --git a/dep/acelite/ace/os_include/os_string.h b/dep/acelite/ace/os_include/os_string.h index 0aa2f7de7cc..779e97cf9fe 100644 --- a/dep/acelite/ace/os_include/os_string.h +++ b/dep/acelite/ace/os_include/os_string.h @@ -6,7 +6,7 @@ * * string operations * - * $Id: os_string.h 87216 2009-10-23 20:26:16Z olli $ + * $Id: os_string.h 93117 2011-01-20 12:11:28Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -41,10 +41,6 @@ extern "C" char *strtok_r (char *s, const char *delim, char **save_ptr); #endif /* ACE_LACKS_STRTOK_R_PROTOTYPE */ -#if defined (ACE_LACKS_STRNLEN_PROTOTYPE) - size_t strnlen(const char *s, size_t maxlen); -#endif /* ACE_LACKS_STRNLEN_PROTOTYPE */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/dep/acelite/ace/os_include/os_wchar.h b/dep/acelite/ace/os_include/os_wchar.h index 37eab2e4ee0..86f6572bc62 100644 --- a/dep/acelite/ace/os_include/os_wchar.h +++ b/dep/acelite/ace/os_include/os_wchar.h @@ -6,7 +6,7 @@ * * wide-character handling * - * $Id: os_wchar.h 83948 2008-12-02 13:55:34Z jtc $ + * $Id: os_wchar.h 93117 2011-01-20 12:11:28Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -41,14 +41,6 @@ extern "C" { #endif /* __cplusplus */ -#if defined (ACE_LACKS_WCSTOLL_PROTOTYPE) - long long wcstoll (const wchar_t *, wchar_t **, int); -#endif /* ACE_LACKS_WCSTOLL_PROTOTYPE */ - -#if defined (ACE_LACKS_WCSTOULL_PROTOTYPE) - unsigned long long wcstoull (const wchar_t *, wchar_t **, int); -#endif /* ACE_LACKS_WCSTOULL_PROTOTYPE */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/dep/acelite/ace/os_include/sys/os_resource.h b/dep/acelite/ace/os_include/sys/os_resource.h index 7f644a09d25..3ee101438cf 100644 --- a/dep/acelite/ace/os_include/sys/os_resource.h +++ b/dep/acelite/ace/os_include/sys/os_resource.h @@ -6,7 +6,7 @@ * * definitions for XSI resource operations * - * $Id: os_resource.h 91781 2010-09-15 12:49:15Z johnnyw $ + * $Id: os_resource.h 93895 2011-04-14 07:59:18Z olli $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -50,17 +50,6 @@ extern "C" { #endif /* __cplusplus */ -// There must be a better way to do this... -#if !defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT_NOFILE) -# if defined (linux) || defined (AIX) -# if defined (RLIMIT_OFILE) -# define RLIMIT_NOFILE RLIMIT_OFILE -# else -# define RLIMIT_NOFILE 200 -# endif /* RLIMIT_OFILE */ -# endif /* defined (linux) || defined (AIX) */ -#endif /* RLIMIT_NOFILE */ - #if defined (ACE_WIN32) # define RUSAGE_SELF 1 /// Fake the UNIX rusage structure. Perhaps we can add more to this diff --git a/dep/acelite/ace/os_include/sys/os_select.h b/dep/acelite/ace/os_include/sys/os_select.h index 59473aff398..d6f7a36f796 100644 --- a/dep/acelite/ace/os_include/sys/os_select.h +++ b/dep/acelite/ace/os_include/sys/os_select.h @@ -6,7 +6,7 @@ * * select types * - * $Id: os_select.h 85015 2009-04-03 12:27:59Z johnnyw $ + * $Id: os_select.h 93359 2011-02-11 11:33:12Z mcorino $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -44,7 +44,7 @@ extern "C" #if defined (ACE_LACKS_FD_MASK) typedef long fd_mask; -#endif /* __QNX__ */ +#endif /* ACE_LACKS_FD_MASK */ #if defined (ACE_WIN32) // This will help until we figure out everything: diff --git a/dep/acelite/ace/os_include/sys/os_stat.h b/dep/acelite/ace/os_include/sys/os_stat.h index 19b126500c1..d4987246680 100644 --- a/dep/acelite/ace/os_include/sys/os_stat.h +++ b/dep/acelite/ace/os_include/sys/os_stat.h @@ -6,7 +6,7 @@ * * data returned by the stat() function * - * $Id: os_stat.h 85057 2009-04-08 10:59:58Z msmit $ + * $Id: os_stat.h 95718 2012-05-01 11:42:47Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -110,6 +110,7 @@ extern "C" # define S_IFDIR FILE_ATTRIBUTE_DIRECTORY # define S_IFREG FILE_ATTRIBUTE_NORMAL # define S_IFLNK 0 +# define S_IFCHR 0 # if !defined (__MINGW32__) // Since CE does not have _stat by default as NT/2000 does, the 'stat' diff --git a/dep/acelite/ace/os_include/sys/os_time.h b/dep/acelite/ace/os_include/sys/os_time.h index 937ceebaa13..29e317d58f7 100644 --- a/dep/acelite/ace/os_include/sys/os_time.h +++ b/dep/acelite/ace/os_include/sys/os_time.h @@ -6,7 +6,7 @@ * * time types * - * $Id: os_time.h 85365 2009-05-18 08:27:42Z johnnyw $ + * $Id: os_time.h 96090 2012-08-22 06:13:38Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -30,9 +30,13 @@ # include /**/ <sys/time.h> #endif /* !ACE_LACKS_SYS_TIME_H */ -#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) -# include /**/ <time.h> // VxWorks 6.2 defined timeval in time.h -#endif +#if defined (ACE_LACKS_CLOCK_REALTIME) +# define CLOCK_REALTIME 0 +#endif /* ACE_LACKS_CLOCK_REALTIME */ + +#if defined (ACE_LACKS_CLOCK_MONOTONIC) +# define CLOCK_MONOTONIC 1 +#endif /* ACE_LACKS_CLOCK_MONOTONIC */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus diff --git a/dep/acelite/ace/os_include/sys/os_types.h b/dep/acelite/ace/os_include/sys/os_types.h index 195f24cffa5..d2920899283 100644 --- a/dep/acelite/ace/os_include/sys/os_types.h +++ b/dep/acelite/ace/os_include/sys/os_types.h @@ -6,7 +6,7 @@ * * data types * - * $Id: os_types.h 91683 2010-09-09 09:07:49Z johnnyw $ + * $Id: os_types.h 96089 2012-08-21 16:59:07Z johnnyw $ * * @author Don Hinton <dhinton@dresystems.com> * @author This code was originally in various places including ace/OS.h. @@ -47,13 +47,9 @@ extern "C" typedef double ACE_timer_t; -// todo: don't forget to clean this up! ;-) -#if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T)) +#if defined (ACE_LACKS_CLOCKID_T) typedef int clockid_t; -# if !defined (CLOCK_REALTIME) -# define CLOCK_REALTIME 0 -# endif /* CLOCK_REALTIME */ -#endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ +#endif /* ACE_LACKS_CLOCKID_T */ #if defined (ACE_LACKS_DEV_T) typedef unsigned int dev_t; @@ -71,7 +67,7 @@ typedef double ACE_timer_t; #if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 typedef off_t ACE_LOFF_T; -#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || defined(ACE_MVS) || defined(__INTERIX) || \ +#elif defined (ACE_HAS_RTEMS) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__INTERIX) || \ (defined (ACE_OPENVMS) && defined (_LARGEFILE)) typedef off_t ACE_LOFF_T; #elif defined (AIX) || defined (HPUX) || defined (__QNX__) @@ -80,7 +76,7 @@ typedef double ACE_timer_t; typedef offset_t ACE_LOFF_T; #elif defined (WIN32) typedef __int64 ACE_LOFF_T; -#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x680)) || \ +#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x690)) || \ defined (ACE_LYNXOS_MAJOR) || \ (defined (ACE_OPENVMS) && !defined (_LARGEFILE)) || \ defined (__TANDEM) diff --git a/dep/bzip2/LICENSE b/dep/bzip2/LICENSE new file mode 100644 index 00000000000..cc614178cf7 --- /dev/null +++ b/dep/bzip2/LICENSE @@ -0,0 +1,42 @@ + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2010 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@bzip.org +bzip2/libbzip2 version 1.0.6 of 6 September 2010 + +-------------------------------------------------------------------------- diff --git a/dep/bzip2/README b/dep/bzip2/README new file mode 100644 index 00000000000..9fb0f636013 --- /dev/null +++ b/dep/bzip2/README @@ -0,0 +1,215 @@ + +This is the README for bzip2/libzip2. +This version is fully compatible with the previous public releases. + +------------------------------------------------------------------ +This file is part of bzip2/libbzip2, a program and library for +lossless, block-sorting data compression. + +bzip2/libbzip2 version 1.0.6 of 6 September 2010 +Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> + +Please read the WARNING, DISCLAIMER and PATENTS sections in this file. + +This program is released under the terms of the license contained +in the file LICENSE. +------------------------------------------------------------------ + +Complete documentation is available in Postscript form (manual.ps), +PDF (manual.pdf) or html (manual.html). A plain-text version of the +manual page is available as bzip2.txt. + + +HOW TO BUILD -- UNIX + +Type 'make'. This builds the library libbz2.a and then the programs +bzip2 and bzip2recover. Six self-tests are run. If the self-tests +complete ok, carry on to installation: + +To install in /usr/local/bin, /usr/local/lib, /usr/local/man and +/usr/local/include, type + + make install + +To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type + + make install PREFIX=/xxx/yyy + +If you are (justifiably) paranoid and want to see what 'make install' +is going to do, you can first do + + make -n install or + make -n install PREFIX=/xxx/yyy respectively. + +The -n instructs make to show the commands it would execute, but not +actually execute them. + + +HOW TO BUILD -- UNIX, shared library libbz2.so. + +Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for +Linux-ELF (RedHat 7.2 on an x86 box), with gcc. I make no claims +that it works for any other platform, though I suspect it probably +will work for most platforms employing both ELF and gcc. + +bzip2-shared, a client of the shared library, is also built, but not +self-tested. So I suggest you also build using the normal Makefile, +since that conducts a self-test. A second reason to prefer the +version statically linked to the library is that, on x86 platforms, +building shared objects makes a valuable register (%ebx) unavailable +to gcc, resulting in a slowdown of 10%-20%, at least for bzip2. + +Important note for people upgrading .so's from 0.9.0/0.9.5 to version +1.0.X. All the functions in the library have been renamed, from (eg) +bzCompress to BZ2_bzCompress, to avoid namespace pollution. +Unfortunately this means that the libbz2.so created by +Makefile-libbz2_so will not work with any program which used an older +version of the library. I do encourage library clients to make the +effort to upgrade to use version 1.0, since it is both faster and more +robust than previous versions. + + +HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. + +It's difficult for me to support compilation on all these platforms. +My approach is to collect binaries for these platforms, and put them +on the master web site (http://www.bzip.org). Look there. However +(FWIW), bzip2-1.0.X is very standard ANSI C and should compile +unmodified with MS Visual C. If you have difficulties building, you +might want to read README.COMPILATION.PROBLEMS. + +At least using MS Visual C++ 6, you can build from the unmodified +sources by issuing, in a command shell: + + nmake -f makefile.msc + +(you may need to first run the MSVC-provided script VCVARS32.BAT + so as to set up paths to the MSVC tools correctly). + + +VALIDATION + +Correct operation, in the sense that a compressed file can always be +decompressed to reproduce the original, is obviously of paramount +importance. To validate bzip2, I used a modified version of Mark +Nelson's churn program. Churn is an automated test driver which +recursively traverses a directory structure, using bzip2 to compress +and then decompress each file it encounters, and checking that the +decompressed data is the same as the original. + + + +Please read and be aware of the following: + +WARNING: + + This program and library (attempts to) compress data by + performing several non-trivial transformations on it. + Unless you are 100% familiar with *all* the algorithms + contained herein, and with the consequences of modifying them, + you should NOT meddle with the compression or decompression + machinery. Incorrect changes can and very likely *will* + lead to disastrous loss of data. + + +DISCLAIMER: + + I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE + USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED. + + Every compression of a file implies an assumption that the + compressed file can be decompressed to reproduce the original. + Great efforts in design, coding and testing have been made to + ensure that this program works correctly. However, the complexity + of the algorithms, and, in particular, the presence of various + special cases in the code which occur with very low but non-zero + probability make it impossible to rule out the possibility of bugs + remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS + PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER + SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. + + That is not to say this program is inherently unreliable. + Indeed, I very much hope the opposite is true. bzip2/libbzip2 + has been carefully constructed and extensively tested. + + +PATENTS: + + To the best of my knowledge, bzip2/libbzip2 does not use any + patented algorithms. However, I do not have the resources + to carry out a patent search. Therefore I cannot give any + guarantee of the above statement. + + + +WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ? + + * Approx 10% faster compression, 30% faster decompression + * -t (test mode) is a lot quicker + * Can decompress concatenated compressed files + * Programming interface, so programs can directly read/write .bz2 files + * Less restrictive (BSD-style) licensing + * Flag handling more compatible with GNU gzip + * Much more documentation, i.e., a proper user manual + * Hopefully, improved portability (at least of the library) + +WHAT'S NEW IN 0.9.5 ? + + * Compression speed is much less sensitive to the input + data than in previous versions. Specifically, the very + slow performance caused by repetitive data is fixed. + * Many small improvements in file and flag handling. + * A Y2K statement. + +WHAT'S NEW IN 1.0.0 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.2 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.3 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.4 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.5 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.6 ? + + See the CHANGES file. + + +I hope you find bzip2 useful. Feel free to contact me at + jseward@bzip.org +if you have any suggestions or queries. Many people mailed me with +comments, suggestions and patches after the releases of bzip-0.15, +bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, +1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this +feedback. I thank you for your comments. + +bzip2's "home" is http://www.bzip.org/ + +Julian Seward +jseward@bzip.org +Cambridge, UK. + +18 July 1996 (version 0.15) +25 August 1996 (version 0.21) + 7 August 1997 (bzip2, version 0.1) +29 August 1997 (bzip2, version 0.1pl2) +23 August 1998 (bzip2, version 0.9.0) + 8 June 1999 (bzip2, version 0.9.5) + 4 Sept 1999 (bzip2, version 0.9.5d) + 5 May 2000 (bzip2, version 1.0pre8) +30 December 2001 (bzip2, version 1.0.2pre1) +15 February 2005 (bzip2, version 1.0.3) +20 December 2006 (bzip2, version 1.0.4) +10 December 2007 (bzip2, version 1.0.5) + 6 Sept 2010 (bzip2, version 1.0.6) diff --git a/dep/bzip2/blocksort.c b/dep/bzip2/blocksort.c index bd2dec157fa..d0d662cd4e9 100644 --- a/dep/bzip2/blocksort.c +++ b/dep/bzip2/blocksort.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/bzip2.c b/dep/bzip2/bzip2.c new file mode 100644 index 00000000000..6de9d1d1488 --- /dev/null +++ b/dep/bzip2/bzip2.c @@ -0,0 +1,2034 @@ + +/*-----------------------------------------------------------*/ +/*--- A block-sorting, lossless compressor bzip2.c ---*/ +/*-----------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +/* Place a 1 beside your platform, and 0 elsewhere. + Generic 32-bit Unix. + Also works on 64-bit Unix boxes. + This is the default. +*/ +#define BZ_UNIX 1 + +/*-- + Win32, as seen by Jacob Navia's excellent + port of (Chris Fraser & David Hanson)'s excellent + lcc compiler. Or with MS Visual C. + This is selected automatically if compiled by a compiler which + defines _WIN32, not including the Cygwin GCC. +--*/ +#define BZ_LCCWIN32 0 + +#if defined(_WIN32) && !defined(__CYGWIN__) +#undef BZ_LCCWIN32 +#define BZ_LCCWIN32 1 +#undef BZ_UNIX +#define BZ_UNIX 0 +#endif + + +/*---------------------------------------------*/ +/*-- + Some stuff for all platforms. +--*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <signal.h> +#include <math.h> +#include <errno.h> +#include <ctype.h> +#include "bzlib.h" + +#define ERROR_IF_EOF(i) { if ((i) == EOF) ioError(); } +#define ERROR_IF_NOT_ZERO(i) { if ((i) != 0) ioError(); } +#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); } + + +/*---------------------------------------------*/ +/*-- + Platform-specific stuff. +--*/ + +#if BZ_UNIX +# include <fcntl.h> +# include <sys/types.h> +# include <utime.h> +# include <unistd.h> +# include <sys/stat.h> +# include <sys/times.h> + +# define PATH_SEP '/' +# define MY_LSTAT lstat +# define MY_STAT stat +# define MY_S_ISREG S_ISREG +# define MY_S_ISDIR S_ISDIR + +# define APPEND_FILESPEC(root, name) \ + root=snocString((root), (name)) + +# define APPEND_FLAG(root, name) \ + root=snocString((root), (name)) + +# define SET_BINARY_MODE(fd) /**/ + +# ifdef __GNUC__ +# define NORETURN __attribute__ ((noreturn)) +# else +# define NORETURN /**/ +# endif + +# ifdef __DJGPP__ +# include <io.h> +# include <fcntl.h> +# undef MY_LSTAT +# undef MY_STAT +# define MY_LSTAT stat +# define MY_STAT stat +# undef SET_BINARY_MODE +# define SET_BINARY_MODE(fd) \ + do { \ + int retVal = setmode ( fileno ( fd ), \ + O_BINARY ); \ + ERROR_IF_MINUS_ONE ( retVal ); \ + } while ( 0 ) +# endif + +# ifdef __CYGWIN__ +# include <io.h> +# include <fcntl.h> +# undef SET_BINARY_MODE +# define SET_BINARY_MODE(fd) \ + do { \ + int retVal = setmode ( fileno ( fd ), \ + O_BINARY ); \ + ERROR_IF_MINUS_ONE ( retVal ); \ + } while ( 0 ) +# endif +#endif /* BZ_UNIX */ + + + +#if BZ_LCCWIN32 +# include <io.h> +# include <fcntl.h> +# include <sys\stat.h> + +# define NORETURN /**/ +# define PATH_SEP '\\' +# define MY_LSTAT _stat +# define MY_STAT _stat +# define MY_S_ISREG(x) ((x) & _S_IFREG) +# define MY_S_ISDIR(x) ((x) & _S_IFDIR) + +# define APPEND_FLAG(root, name) \ + root=snocString((root), (name)) + +# define APPEND_FILESPEC(root, name) \ + root = snocString ((root), (name)) + +# define SET_BINARY_MODE(fd) \ + do { \ + int retVal = setmode ( fileno ( fd ), \ + O_BINARY ); \ + ERROR_IF_MINUS_ONE ( retVal ); \ + } while ( 0 ) + +#endif /* BZ_LCCWIN32 */ + + +/*---------------------------------------------*/ +/*-- + Some more stuff for all platforms :-) +--*/ + +typedef char Char; +typedef unsigned char Bool; +typedef unsigned char UChar; +typedef int Int32; +typedef unsigned int UInt32; +typedef short Int16; +typedef unsigned short UInt16; + +#define True ((Bool)1) +#define False ((Bool)0) + +/*-- + IntNative is your platform's `native' int size. + Only here to avoid probs with 64-bit platforms. +--*/ +typedef int IntNative; + + +/*---------------------------------------------------*/ +/*--- Misc (file handling) data decls ---*/ +/*---------------------------------------------------*/ + +Int32 verbosity; +Bool keepInputFiles, smallMode, deleteOutputOnInterrupt; +Bool forceOverwrite, testFailsExist, unzFailsExist, noisy; +Int32 numFileNames, numFilesProcessed, blockSize100k; +Int32 exitValue; + +/*-- source modes; F==file, I==stdin, O==stdout --*/ +#define SM_I2O 1 +#define SM_F2O 2 +#define SM_F2F 3 + +/*-- operation modes --*/ +#define OM_Z 1 +#define OM_UNZ 2 +#define OM_TEST 3 + +Int32 opMode; +Int32 srcMode; + +#define FILE_NAME_LEN 1034 + +Int32 longestFileName; +Char inName [FILE_NAME_LEN]; +Char outName[FILE_NAME_LEN]; +Char tmpName[FILE_NAME_LEN]; +Char *progName; +Char progNameReally[FILE_NAME_LEN]; +FILE *outputHandleJustInCase; +Int32 workFactor; + +static void panic ( const Char* ) NORETURN; +static void ioError ( void ) NORETURN; +static void outOfMemory ( void ) NORETURN; +static void configError ( void ) NORETURN; +static void crcError ( void ) NORETURN; +static void cleanUpAndFail ( Int32 ) NORETURN; +static void compressedStreamEOF ( void ) NORETURN; + +static void copyFileName ( Char*, Char* ); +static void* myMalloc ( Int32 ); +static void applySavedFileAttrToOutputFile ( IntNative fd ); + + + +/*---------------------------------------------------*/ +/*--- An implementation of 64-bit ints. Sigh. ---*/ +/*--- Roll on widespread deployment of ANSI C9X ! ---*/ +/*---------------------------------------------------*/ + +typedef + struct { UChar b[8]; } + UInt64; + + +static +void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 ) +{ + n->b[7] = (UChar)((hi32 >> 24) & 0xFF); + n->b[6] = (UChar)((hi32 >> 16) & 0xFF); + n->b[5] = (UChar)((hi32 >> 8) & 0xFF); + n->b[4] = (UChar) (hi32 & 0xFF); + n->b[3] = (UChar)((lo32 >> 24) & 0xFF); + n->b[2] = (UChar)((lo32 >> 16) & 0xFF); + n->b[1] = (UChar)((lo32 >> 8) & 0xFF); + n->b[0] = (UChar) (lo32 & 0xFF); +} + + +static +double uInt64_to_double ( UInt64* n ) +{ + Int32 i; + double base = 1.0; + double sum = 0.0; + for (i = 0; i < 8; i++) { + sum += base * (double)(n->b[i]); + base *= 256.0; + } + return sum; +} + + +static +Bool uInt64_isZero ( UInt64* n ) +{ + Int32 i; + for (i = 0; i < 8; i++) + if (n->b[i] != 0) return 0; + return 1; +} + + +/* Divide *n by 10, and return the remainder. */ +static +Int32 uInt64_qrm10 ( UInt64* n ) +{ + UInt32 rem, tmp; + Int32 i; + rem = 0; + for (i = 7; i >= 0; i--) { + tmp = rem * 256 + n->b[i]; + n->b[i] = tmp / 10; + rem = tmp % 10; + } + return rem; +} + + +/* ... and the Whole Entire Point of all this UInt64 stuff is + so that we can supply the following function. +*/ +static +void uInt64_toAscii ( char* outbuf, UInt64* n ) +{ + Int32 i, q; + UChar buf[32]; + Int32 nBuf = 0; + UInt64 n_copy = *n; + do { + q = uInt64_qrm10 ( &n_copy ); + buf[nBuf] = q + '0'; + nBuf++; + } while (!uInt64_isZero(&n_copy)); + outbuf[nBuf] = 0; + for (i = 0; i < nBuf; i++) + outbuf[i] = buf[nBuf-i-1]; +} + + +/*---------------------------------------------------*/ +/*--- Processing of complete files and streams ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------*/ +static +Bool myfeof ( FILE* f ) +{ + Int32 c = fgetc ( f ); + if (c == EOF) return True; + ungetc ( c, f ); + return False; +} + + +/*---------------------------------------------*/ +static +void compressStream ( FILE *stream, FILE *zStream ) +{ + BZFILE* bzf = NULL; + UChar ibuf[5000]; + Int32 nIbuf; + UInt32 nbytes_in_lo32, nbytes_in_hi32; + UInt32 nbytes_out_lo32, nbytes_out_hi32; + Int32 bzerr, bzerr_dummy, ret; + + SET_BINARY_MODE(stream); + SET_BINARY_MODE(zStream); + + if (ferror(stream)) goto errhandler_io; + if (ferror(zStream)) goto errhandler_io; + + bzf = BZ2_bzWriteOpen ( &bzerr, zStream, + blockSize100k, verbosity, workFactor ); + if (bzerr != BZ_OK) goto errhandler; + + if (verbosity >= 2) fprintf ( stderr, "\n" ); + + while (True) { + + if (myfeof(stream)) break; + nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream ); + if (ferror(stream)) goto errhandler_io; + if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf ); + if (bzerr != BZ_OK) goto errhandler; + + } + + BZ2_bzWriteClose64 ( &bzerr, bzf, 0, + &nbytes_in_lo32, &nbytes_in_hi32, + &nbytes_out_lo32, &nbytes_out_hi32 ); + if (bzerr != BZ_OK) goto errhandler; + + if (ferror(zStream)) goto errhandler_io; + ret = fflush ( zStream ); + if (ret == EOF) goto errhandler_io; + if (zStream != stdout) { + Int32 fd = fileno ( zStream ); + if (fd < 0) goto errhandler_io; + applySavedFileAttrToOutputFile ( fd ); + ret = fclose ( zStream ); + outputHandleJustInCase = NULL; + if (ret == EOF) goto errhandler_io; + } + outputHandleJustInCase = NULL; + if (ferror(stream)) goto errhandler_io; + ret = fclose ( stream ); + if (ret == EOF) goto errhandler_io; + + if (verbosity >= 1) { + if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) { + fprintf ( stderr, " no data compressed.\n"); + } else { + Char buf_nin[32], buf_nout[32]; + UInt64 nbytes_in, nbytes_out; + double nbytes_in_d, nbytes_out_d; + uInt64_from_UInt32s ( &nbytes_in, + nbytes_in_lo32, nbytes_in_hi32 ); + uInt64_from_UInt32s ( &nbytes_out, + nbytes_out_lo32, nbytes_out_hi32 ); + nbytes_in_d = uInt64_to_double ( &nbytes_in ); + nbytes_out_d = uInt64_to_double ( &nbytes_out ); + uInt64_toAscii ( buf_nin, &nbytes_in ); + uInt64_toAscii ( buf_nout, &nbytes_out ); + fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, " + "%5.2f%% saved, %s in, %s out.\n", + nbytes_in_d / nbytes_out_d, + (8.0 * nbytes_out_d) / nbytes_in_d, + 100.0 * (1.0 - nbytes_out_d / nbytes_in_d), + buf_nin, + buf_nout + ); + } + } + + return; + + errhandler: + BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, + &nbytes_in_lo32, &nbytes_in_hi32, + &nbytes_out_lo32, &nbytes_out_hi32 ); + switch (bzerr) { + case BZ_CONFIG_ERROR: + configError(); break; + case BZ_MEM_ERROR: + outOfMemory (); break; + case BZ_IO_ERROR: + errhandler_io: + ioError(); break; + default: + panic ( "compress:unexpected error" ); + } + + panic ( "compress:end" ); + /*notreached*/ +} + + + +/*---------------------------------------------*/ +static +Bool uncompressStream ( FILE *zStream, FILE *stream ) +{ + BZFILE* bzf = NULL; + Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; + UChar obuf[5000]; + UChar unused[BZ_MAX_UNUSED]; + Int32 nUnused; + void* unusedTmpV; + UChar* unusedTmp; + + nUnused = 0; + streamNo = 0; + + SET_BINARY_MODE(stream); + SET_BINARY_MODE(zStream); + + if (ferror(stream)) goto errhandler_io; + if (ferror(zStream)) goto errhandler_io; + + while (True) { + + bzf = BZ2_bzReadOpen ( + &bzerr, zStream, verbosity, + (int)smallMode, unused, nUnused + ); + if (bzf == NULL || bzerr != BZ_OK) goto errhandler; + streamNo++; + + while (bzerr == BZ_OK) { + nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); + if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat; + if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0) + fwrite ( obuf, sizeof(UChar), nread, stream ); + if (ferror(stream)) goto errhandler_io; + } + if (bzerr != BZ_STREAM_END) goto errhandler; + + BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); + if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); + + unusedTmp = (UChar*)unusedTmpV; + for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; + + BZ2_bzReadClose ( &bzerr, bzf ); + if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" ); + + if (nUnused == 0 && myfeof(zStream)) break; + } + + closeok: + if (ferror(zStream)) goto errhandler_io; + if (stream != stdout) { + Int32 fd = fileno ( stream ); + if (fd < 0) goto errhandler_io; + applySavedFileAttrToOutputFile ( fd ); + } + ret = fclose ( zStream ); + if (ret == EOF) goto errhandler_io; + + if (ferror(stream)) goto errhandler_io; + ret = fflush ( stream ); + if (ret != 0) goto errhandler_io; + if (stream != stdout) { + ret = fclose ( stream ); + outputHandleJustInCase = NULL; + if (ret == EOF) goto errhandler_io; + } + outputHandleJustInCase = NULL; + if (verbosity >= 2) fprintf ( stderr, "\n " ); + return True; + + trycat: + if (forceOverwrite) { + rewind(zStream); + while (True) { + if (myfeof(zStream)) break; + nread = fread ( obuf, sizeof(UChar), 5000, zStream ); + if (ferror(zStream)) goto errhandler_io; + if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream ); + if (ferror(stream)) goto errhandler_io; + } + goto closeok; + } + + errhandler: + BZ2_bzReadClose ( &bzerr_dummy, bzf ); + switch (bzerr) { + case BZ_CONFIG_ERROR: + configError(); break; + case BZ_IO_ERROR: + errhandler_io: + ioError(); break; + case BZ_DATA_ERROR: + crcError(); + case BZ_MEM_ERROR: + outOfMemory(); + case BZ_UNEXPECTED_EOF: + compressedStreamEOF(); + case BZ_DATA_ERROR_MAGIC: + if (zStream != stdin) fclose(zStream); + if (stream != stdout) fclose(stream); + if (streamNo == 1) { + return False; + } else { + if (noisy) + fprintf ( stderr, + "\n%s: %s: trailing garbage after EOF ignored\n", + progName, inName ); + return True; + } + default: + panic ( "decompress:unexpected error" ); + } + + panic ( "decompress:end" ); + return True; /*notreached*/ +} + + +/*---------------------------------------------*/ +static +Bool testStream ( FILE *zStream ) +{ + BZFILE* bzf = NULL; + Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i; + UChar obuf[5000]; + UChar unused[BZ_MAX_UNUSED]; + Int32 nUnused; + void* unusedTmpV; + UChar* unusedTmp; + + nUnused = 0; + streamNo = 0; + + SET_BINARY_MODE(zStream); + if (ferror(zStream)) goto errhandler_io; + + while (True) { + + bzf = BZ2_bzReadOpen ( + &bzerr, zStream, verbosity, + (int)smallMode, unused, nUnused + ); + if (bzf == NULL || bzerr != BZ_OK) goto errhandler; + streamNo++; + + while (bzerr == BZ_OK) { + nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 ); + if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler; + } + if (bzerr != BZ_STREAM_END) goto errhandler; + + BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused ); + if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); + + unusedTmp = (UChar*)unusedTmpV; + for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i]; + + BZ2_bzReadClose ( &bzerr, bzf ); + if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" ); + if (nUnused == 0 && myfeof(zStream)) break; + + } + + if (ferror(zStream)) goto errhandler_io; + ret = fclose ( zStream ); + if (ret == EOF) goto errhandler_io; + + if (verbosity >= 2) fprintf ( stderr, "\n " ); + return True; + + errhandler: + BZ2_bzReadClose ( &bzerr_dummy, bzf ); + if (verbosity == 0) + fprintf ( stderr, "%s: %s: ", progName, inName ); + switch (bzerr) { + case BZ_CONFIG_ERROR: + configError(); break; + case BZ_IO_ERROR: + errhandler_io: + ioError(); break; + case BZ_DATA_ERROR: + fprintf ( stderr, + "data integrity (CRC) error in data\n" ); + return False; + case BZ_MEM_ERROR: + outOfMemory(); + case BZ_UNEXPECTED_EOF: + fprintf ( stderr, + "file ends unexpectedly\n" ); + return False; + case BZ_DATA_ERROR_MAGIC: + if (zStream != stdin) fclose(zStream); + if (streamNo == 1) { + fprintf ( stderr, + "bad magic number (file not created by bzip2)\n" ); + return False; + } else { + if (noisy) + fprintf ( stderr, + "trailing garbage after EOF ignored\n" ); + return True; + } + default: + panic ( "test:unexpected error" ); + } + + panic ( "test:end" ); + return True; /*notreached*/ +} + + +/*---------------------------------------------------*/ +/*--- Error [non-] handling grunge ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------*/ +static +void setExit ( Int32 v ) +{ + if (v > exitValue) exitValue = v; +} + + +/*---------------------------------------------*/ +static +void cadvise ( void ) +{ + if (noisy) + fprintf ( + stderr, + "\nIt is possible that the compressed file(s) have become corrupted.\n" + "You can use the -tvv option to test integrity of such files.\n\n" + "You can use the `bzip2recover' program to attempt to recover\n" + "data from undamaged sections of corrupted files.\n\n" + ); +} + + +/*---------------------------------------------*/ +static +void showFileNames ( void ) +{ + if (noisy) + fprintf ( + stderr, + "\tInput file = %s, output file = %s\n", + inName, outName + ); +} + + +/*---------------------------------------------*/ +static +void cleanUpAndFail ( Int32 ec ) +{ + IntNative retVal; + struct MY_STAT statBuf; + + if ( srcMode == SM_F2F + && opMode != OM_TEST + && deleteOutputOnInterrupt ) { + + /* Check whether input file still exists. Delete output file + only if input exists to avoid loss of data. Joerg Prante, 5 + January 2002. (JRS 06-Jan-2002: other changes in 1.0.2 mean + this is less likely to happen. But to be ultra-paranoid, we + do the check anyway.) */ + retVal = MY_STAT ( inName, &statBuf ); + if (retVal == 0) { + if (noisy) + fprintf ( stderr, + "%s: Deleting output file %s, if it exists.\n", + progName, outName ); + if (outputHandleJustInCase != NULL) + fclose ( outputHandleJustInCase ); + retVal = remove ( outName ); + if (retVal != 0) + fprintf ( stderr, + "%s: WARNING: deletion of output file " + "(apparently) failed.\n", + progName ); + } else { + fprintf ( stderr, + "%s: WARNING: deletion of output file suppressed\n", + progName ); + fprintf ( stderr, + "%s: since input file no longer exists. Output file\n", + progName ); + fprintf ( stderr, + "%s: `%s' may be incomplete.\n", + progName, outName ); + fprintf ( stderr, + "%s: I suggest doing an integrity test (bzip2 -tv)" + " of it.\n", + progName ); + } + } + + if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) { + fprintf ( stderr, + "%s: WARNING: some files have not been processed:\n" + "%s: %d specified on command line, %d not processed yet.\n\n", + progName, progName, + numFileNames, numFileNames - numFilesProcessed ); + } + setExit(ec); + exit(exitValue); +} + + +/*---------------------------------------------*/ +static +void panic ( const Char* s ) +{ + fprintf ( stderr, + "\n%s: PANIC -- internal consistency error:\n" + "\t%s\n" + "\tThis is a BUG. Please report it to me at:\n" + "\tjseward@bzip.org\n", + progName, s ); + showFileNames(); + cleanUpAndFail( 3 ); +} + + +/*---------------------------------------------*/ +static +void crcError ( void ) +{ + fprintf ( stderr, + "\n%s: Data integrity error when decompressing.\n", + progName ); + showFileNames(); + cadvise(); + cleanUpAndFail( 2 ); +} + + +/*---------------------------------------------*/ +static +void compressedStreamEOF ( void ) +{ + if (noisy) { + fprintf ( stderr, + "\n%s: Compressed file ends unexpectedly;\n\t" + "perhaps it is corrupted? *Possible* reason follows.\n", + progName ); + perror ( progName ); + showFileNames(); + cadvise(); + } + cleanUpAndFail( 2 ); +} + + +/*---------------------------------------------*/ +static +void ioError ( void ) +{ + fprintf ( stderr, + "\n%s: I/O or other error, bailing out. " + "Possible reason follows.\n", + progName ); + perror ( progName ); + showFileNames(); + cleanUpAndFail( 1 ); +} + + +/*---------------------------------------------*/ +static +void mySignalCatcher ( IntNative n ) +{ + fprintf ( stderr, + "\n%s: Control-C or similar caught, quitting.\n", + progName ); + cleanUpAndFail(1); +} + + +/*---------------------------------------------*/ +static +void mySIGSEGVorSIGBUScatcher ( IntNative n ) +{ + if (opMode == OM_Z) + fprintf ( + stderr, + "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n" + "\n" + " Possible causes are (most likely first):\n" + " (1) This computer has unreliable memory or cache hardware\n" + " (a surprisingly common problem; try a different machine.)\n" + " (2) A bug in the compiler used to create this executable\n" + " (unlikely, if you didn't compile bzip2 yourself.)\n" + " (3) A real bug in bzip2 -- I hope this should never be the case.\n" + " The user's manual, Section 4.3, has more info on (1) and (2).\n" + " \n" + " If you suspect this is a bug in bzip2, or are unsure about (1)\n" + " or (2), feel free to report it to me at: jseward@bzip.org.\n" + " Section 4.3 of the user's manual describes the info a useful\n" + " bug report should have. If the manual is available on your\n" + " system, please try and read it before mailing me. If you don't\n" + " have the manual or can't be bothered to read it, mail me anyway.\n" + "\n", + progName ); + else + fprintf ( + stderr, + "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n" + "\n" + " Possible causes are (most likely first):\n" + " (1) The compressed data is corrupted, and bzip2's usual checks\n" + " failed to detect this. Try bzip2 -tvv my_file.bz2.\n" + " (2) This computer has unreliable memory or cache hardware\n" + " (a surprisingly common problem; try a different machine.)\n" + " (3) A bug in the compiler used to create this executable\n" + " (unlikely, if you didn't compile bzip2 yourself.)\n" + " (4) A real bug in bzip2 -- I hope this should never be the case.\n" + " The user's manual, Section 4.3, has more info on (2) and (3).\n" + " \n" + " If you suspect this is a bug in bzip2, or are unsure about (2)\n" + " or (3), feel free to report it to me at: jseward@bzip.org.\n" + " Section 4.3 of the user's manual describes the info a useful\n" + " bug report should have. If the manual is available on your\n" + " system, please try and read it before mailing me. If you don't\n" + " have the manual or can't be bothered to read it, mail me anyway.\n" + "\n", + progName ); + + showFileNames(); + if (opMode == OM_Z) + cleanUpAndFail( 3 ); else + { cadvise(); cleanUpAndFail( 2 ); } +} + + +/*---------------------------------------------*/ +static +void outOfMemory ( void ) +{ + fprintf ( stderr, + "\n%s: couldn't allocate enough memory\n", + progName ); + showFileNames(); + cleanUpAndFail(1); +} + + +/*---------------------------------------------*/ +static +void configError ( void ) +{ + fprintf ( stderr, + "bzip2: I'm not configured correctly for this platform!\n" + "\tI require Int32, Int16 and Char to have sizes\n" + "\tof 4, 2 and 1 bytes to run properly, and they don't.\n" + "\tProbably you can fix this by defining them correctly,\n" + "\tand recompiling. Bye!\n" ); + setExit(3); + exit(exitValue); +} + + +/*---------------------------------------------------*/ +/*--- The main driver machinery ---*/ +/*---------------------------------------------------*/ + +/* All rather crufty. The main problem is that input files + are stat()d multiple times before use. This should be + cleaned up. +*/ + +/*---------------------------------------------*/ +static +void pad ( Char *s ) +{ + Int32 i; + if ( (Int32)strlen(s) >= longestFileName ) return; + for (i = 1; i <= longestFileName - (Int32)strlen(s); i++) + fprintf ( stderr, " " ); +} + + +/*---------------------------------------------*/ +static +void copyFileName ( Char* to, Char* from ) +{ + if ( strlen(from) > FILE_NAME_LEN-10 ) { + fprintf ( + stderr, + "bzip2: file name\n`%s'\n" + "is suspiciously (more than %d chars) long.\n" + "Try using a reasonable file name instead. Sorry! :-)\n", + from, FILE_NAME_LEN-10 + ); + setExit(1); + exit(exitValue); + } + + strncpy(to,from,FILE_NAME_LEN-10); + to[FILE_NAME_LEN-10]='\0'; +} + + +/*---------------------------------------------*/ +static +Bool fileExists ( Char* name ) +{ + FILE *tmp = fopen ( name, "rb" ); + Bool exists = (tmp != NULL); + if (tmp != NULL) fclose ( tmp ); + return exists; +} + + +/*---------------------------------------------*/ +/* Open an output file safely with O_EXCL and good permissions. + This avoids a race condition in versions < 1.0.2, in which + the file was first opened and then had its interim permissions + set safely. We instead use open() to create the file with + the interim permissions required. (--- --- rw-). + + For non-Unix platforms, if we are not worrying about + security issues, simple this simply behaves like fopen. +*/ +static +FILE* fopen_output_safely ( Char* name, const char* mode ) +{ +# if BZ_UNIX + FILE* fp; + IntNative fh; + fh = open(name, O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|S_IRUSR); + if (fh == -1) return NULL; + fp = fdopen(fh, mode); + if (fp == NULL) close(fh); + return fp; +# else + return fopen(name, mode); +# endif +} + + +/*---------------------------------------------*/ +/*-- + if in doubt, return True +--*/ +static +Bool notAStandardFile ( Char* name ) +{ + IntNative i; + struct MY_STAT statBuf; + + i = MY_LSTAT ( name, &statBuf ); + if (i != 0) return True; + if (MY_S_ISREG(statBuf.st_mode)) return False; + return True; +} + + +/*---------------------------------------------*/ +/*-- + rac 11/21/98 see if file has hard links to it +--*/ +static +Int32 countHardLinks ( Char* name ) +{ + IntNative i; + struct MY_STAT statBuf; + + i = MY_LSTAT ( name, &statBuf ); + if (i != 0) return 0; + return (statBuf.st_nlink - 1); +} + + +/*---------------------------------------------*/ +/* Copy modification date, access date, permissions and owner from the + source to destination file. We have to copy this meta-info off + into fileMetaInfo before starting to compress / decompress it, + because doing it afterwards means we get the wrong access time. + + To complicate matters, in compress() and decompress() below, the + sequence of tests preceding the call to saveInputFileMetaInfo() + involves calling fileExists(), which in turn establishes its result + by attempting to fopen() the file, and if successful, immediately + fclose()ing it again. So we have to assume that the fopen() call + does not cause the access time field to be updated. + + Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems + to imply that merely doing open() will not affect the access time. + Therefore we merely need to hope that the C library only does + open() as a result of fopen(), and not any kind of read()-ahead + cleverness. + + It sounds pretty fragile to me. Whether this carries across + robustly to arbitrary Unix-like platforms (or even works robustly + on this one, RedHat 7.2) is unknown to me. Nevertheless ... +*/ +#if BZ_UNIX +static +struct MY_STAT fileMetaInfo; +#endif + +static +void saveInputFileMetaInfo ( Char *srcName ) +{ +# if BZ_UNIX + IntNative retVal; + /* Note use of stat here, not lstat. */ + retVal = MY_STAT( srcName, &fileMetaInfo ); + ERROR_IF_NOT_ZERO ( retVal ); +# endif +} + + +static +void applySavedTimeInfoToOutputFile ( Char *dstName ) +{ +# if BZ_UNIX + IntNative retVal; + struct utimbuf uTimBuf; + + uTimBuf.actime = fileMetaInfo.st_atime; + uTimBuf.modtime = fileMetaInfo.st_mtime; + + retVal = utime ( dstName, &uTimBuf ); + ERROR_IF_NOT_ZERO ( retVal ); +# endif +} + +static +void applySavedFileAttrToOutputFile ( IntNative fd ) +{ +# if BZ_UNIX + IntNative retVal; + + retVal = fchmod ( fd, fileMetaInfo.st_mode ); + ERROR_IF_NOT_ZERO ( retVal ); + + (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid ); + /* chown() will in many cases return with EPERM, which can + be safely ignored. + */ +# endif +} + + +/*---------------------------------------------*/ +static +Bool containsDubiousChars ( Char* name ) +{ +# if BZ_UNIX + /* On unix, files can contain any characters and the file expansion + * is performed by the shell. + */ + return False; +# else /* ! BZ_UNIX */ + /* On non-unix (Win* platforms), wildcard characters are not allowed in + * filenames. + */ + for (; *name != '\0'; name++) + if (*name == '?' || *name == '*') return True; + return False; +# endif /* BZ_UNIX */ +} + + +/*---------------------------------------------*/ +#define BZ_N_SUFFIX_PAIRS 4 + +const Char* zSuffix[BZ_N_SUFFIX_PAIRS] + = { ".bz2", ".bz", ".tbz2", ".tbz" }; +const Char* unzSuffix[BZ_N_SUFFIX_PAIRS] + = { "", "", ".tar", ".tar" }; + +static +Bool hasSuffix ( Char* s, const Char* suffix ) +{ + Int32 ns = strlen(s); + Int32 nx = strlen(suffix); + if (ns < nx) return False; + if (strcmp(s + ns - nx, suffix) == 0) return True; + return False; +} + +static +Bool mapSuffix ( Char* name, + const Char* oldSuffix, + const Char* newSuffix ) +{ + if (!hasSuffix(name,oldSuffix)) return False; + name[strlen(name)-strlen(oldSuffix)] = 0; + strcat ( name, newSuffix ); + return True; +} + + +/*---------------------------------------------*/ +static +void compress ( Char *name ) +{ + FILE *inStr; + FILE *outStr; + Int32 n, i; + struct MY_STAT statBuf; + + deleteOutputOnInterrupt = False; + + if (name == NULL && srcMode != SM_I2O) + panic ( "compress: bad modes\n" ); + + switch (srcMode) { + case SM_I2O: + copyFileName ( inName, (Char*)"(stdin)" ); + copyFileName ( outName, (Char*)"(stdout)" ); + break; + case SM_F2F: + copyFileName ( inName, name ); + copyFileName ( outName, name ); + strcat ( outName, ".bz2" ); + break; + case SM_F2O: + copyFileName ( inName, name ); + copyFileName ( outName, (Char*)"(stdout)" ); + break; + } + + if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { + if (noisy) + fprintf ( stderr, "%s: There are no files matching `%s'.\n", + progName, inName ); + setExit(1); + return; + } + if ( srcMode != SM_I2O && !fileExists ( inName ) ) { + fprintf ( stderr, "%s: Can't open input file %s: %s.\n", + progName, inName, strerror(errno) ); + setExit(1); + return; + } + for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) { + if (hasSuffix(inName, zSuffix[i])) { + if (noisy) + fprintf ( stderr, + "%s: Input file %s already has %s suffix.\n", + progName, inName, zSuffix[i] ); + setExit(1); + return; + } + } + if ( srcMode == SM_F2F || srcMode == SM_F2O ) { + MY_STAT(inName, &statBuf); + if ( MY_S_ISDIR(statBuf.st_mode) ) { + fprintf( stderr, + "%s: Input file %s is a directory.\n", + progName,inName); + setExit(1); + return; + } + } + if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { + if (noisy) + fprintf ( stderr, "%s: Input file %s is not a normal file.\n", + progName, inName ); + setExit(1); + return; + } + if ( srcMode == SM_F2F && fileExists ( outName ) ) { + if (forceOverwrite) { + remove(outName); + } else { + fprintf ( stderr, "%s: Output file %s already exists.\n", + progName, outName ); + setExit(1); + return; + } + } + if ( srcMode == SM_F2F && !forceOverwrite && + (n=countHardLinks ( inName )) > 0) { + fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", + progName, inName, n, n > 1 ? "s" : "" ); + setExit(1); + return; + } + + if ( srcMode == SM_F2F ) { + /* Save the file's meta-info before we open it. Doing it later + means we mess up the access times. */ + saveInputFileMetaInfo ( inName ); + } + + switch ( srcMode ) { + + case SM_I2O: + inStr = stdin; + outStr = stdout; + if ( isatty ( fileno ( stdout ) ) ) { + fprintf ( stderr, + "%s: I won't write compressed data to a terminal.\n", + progName ); + fprintf ( stderr, "%s: For help, type: `%s --help'.\n", + progName, progName ); + setExit(1); + return; + }; + break; + + case SM_F2O: + inStr = fopen ( inName, "rb" ); + outStr = stdout; + if ( isatty ( fileno ( stdout ) ) ) { + fprintf ( stderr, + "%s: I won't write compressed data to a terminal.\n", + progName ); + fprintf ( stderr, "%s: For help, type: `%s --help'.\n", + progName, progName ); + if ( inStr != NULL ) fclose ( inStr ); + setExit(1); + return; + }; + if ( inStr == NULL ) { + fprintf ( stderr, "%s: Can't open input file %s: %s.\n", + progName, inName, strerror(errno) ); + setExit(1); + return; + }; + break; + + case SM_F2F: + inStr = fopen ( inName, "rb" ); + outStr = fopen_output_safely ( outName, "wb" ); + if ( outStr == NULL) { + fprintf ( stderr, "%s: Can't create output file %s: %s.\n", + progName, outName, strerror(errno) ); + if ( inStr != NULL ) fclose ( inStr ); + setExit(1); + return; + } + if ( inStr == NULL ) { + fprintf ( stderr, "%s: Can't open input file %s: %s.\n", + progName, inName, strerror(errno) ); + if ( outStr != NULL ) fclose ( outStr ); + setExit(1); + return; + }; + break; + + default: + panic ( "compress: bad srcMode" ); + break; + } + + if (verbosity >= 1) { + fprintf ( stderr, " %s: ", inName ); + pad ( inName ); + fflush ( stderr ); + } + + /*--- Now the input and output handles are sane. Do the Biz. ---*/ + outputHandleJustInCase = outStr; + deleteOutputOnInterrupt = True; + compressStream ( inStr, outStr ); + outputHandleJustInCase = NULL; + + /*--- If there was an I/O error, we won't get here. ---*/ + if ( srcMode == SM_F2F ) { + applySavedTimeInfoToOutputFile ( outName ); + deleteOutputOnInterrupt = False; + if ( !keepInputFiles ) { + IntNative retVal = remove ( inName ); + ERROR_IF_NOT_ZERO ( retVal ); + } + } + + deleteOutputOnInterrupt = False; +} + + +/*---------------------------------------------*/ +static +void uncompress ( Char *name ) +{ + FILE *inStr; + FILE *outStr; + Int32 n, i; + Bool magicNumberOK; + Bool cantGuess; + struct MY_STAT statBuf; + + deleteOutputOnInterrupt = False; + + if (name == NULL && srcMode != SM_I2O) + panic ( "uncompress: bad modes\n" ); + + cantGuess = False; + switch (srcMode) { + case SM_I2O: + copyFileName ( inName, (Char*)"(stdin)" ); + copyFileName ( outName, (Char*)"(stdout)" ); + break; + case SM_F2F: + copyFileName ( inName, name ); + copyFileName ( outName, name ); + for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) + if (mapSuffix(outName,zSuffix[i],unzSuffix[i])) + goto zzz; + cantGuess = True; + strcat ( outName, ".out" ); + break; + case SM_F2O: + copyFileName ( inName, name ); + copyFileName ( outName, (Char*)"(stdout)" ); + break; + } + + zzz: + if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { + if (noisy) + fprintf ( stderr, "%s: There are no files matching `%s'.\n", + progName, inName ); + setExit(1); + return; + } + if ( srcMode != SM_I2O && !fileExists ( inName ) ) { + fprintf ( stderr, "%s: Can't open input file %s: %s.\n", + progName, inName, strerror(errno) ); + setExit(1); + return; + } + if ( srcMode == SM_F2F || srcMode == SM_F2O ) { + MY_STAT(inName, &statBuf); + if ( MY_S_ISDIR(statBuf.st_mode) ) { + fprintf( stderr, + "%s: Input file %s is a directory.\n", + progName,inName); + setExit(1); + return; + } + } + if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) { + if (noisy) + fprintf ( stderr, "%s: Input file %s is not a normal file.\n", + progName, inName ); + setExit(1); + return; + } + if ( /* srcMode == SM_F2F implied && */ cantGuess ) { + if (noisy) + fprintf ( stderr, + "%s: Can't guess original name for %s -- using %s\n", + progName, inName, outName ); + /* just a warning, no return */ + } + if ( srcMode == SM_F2F && fileExists ( outName ) ) { + if (forceOverwrite) { + remove(outName); + } else { + fprintf ( stderr, "%s: Output file %s already exists.\n", + progName, outName ); + setExit(1); + return; + } + } + if ( srcMode == SM_F2F && !forceOverwrite && + (n=countHardLinks ( inName ) ) > 0) { + fprintf ( stderr, "%s: Input file %s has %d other link%s.\n", + progName, inName, n, n > 1 ? "s" : "" ); + setExit(1); + return; + } + + if ( srcMode == SM_F2F ) { + /* Save the file's meta-info before we open it. Doing it later + means we mess up the access times. */ + saveInputFileMetaInfo ( inName ); + } + + switch ( srcMode ) { + + case SM_I2O: + inStr = stdin; + outStr = stdout; + if ( isatty ( fileno ( stdin ) ) ) { + fprintf ( stderr, + "%s: I won't read compressed data from a terminal.\n", + progName ); + fprintf ( stderr, "%s: For help, type: `%s --help'.\n", + progName, progName ); + setExit(1); + return; + }; + break; + + case SM_F2O: + inStr = fopen ( inName, "rb" ); + outStr = stdout; + if ( inStr == NULL ) { + fprintf ( stderr, "%s: Can't open input file %s:%s.\n", + progName, inName, strerror(errno) ); + if ( inStr != NULL ) fclose ( inStr ); + setExit(1); + return; + }; + break; + + case SM_F2F: + inStr = fopen ( inName, "rb" ); + outStr = fopen_output_safely ( outName, "wb" ); + if ( outStr == NULL) { + fprintf ( stderr, "%s: Can't create output file %s: %s.\n", + progName, outName, strerror(errno) ); + if ( inStr != NULL ) fclose ( inStr ); + setExit(1); + return; + } + if ( inStr == NULL ) { + fprintf ( stderr, "%s: Can't open input file %s: %s.\n", + progName, inName, strerror(errno) ); + if ( outStr != NULL ) fclose ( outStr ); + setExit(1); + return; + }; + break; + + default: + panic ( "uncompress: bad srcMode" ); + break; + } + + if (verbosity >= 1) { + fprintf ( stderr, " %s: ", inName ); + pad ( inName ); + fflush ( stderr ); + } + + /*--- Now the input and output handles are sane. Do the Biz. ---*/ + outputHandleJustInCase = outStr; + deleteOutputOnInterrupt = True; + magicNumberOK = uncompressStream ( inStr, outStr ); + outputHandleJustInCase = NULL; + + /*--- If there was an I/O error, we won't get here. ---*/ + if ( magicNumberOK ) { + if ( srcMode == SM_F2F ) { + applySavedTimeInfoToOutputFile ( outName ); + deleteOutputOnInterrupt = False; + if ( !keepInputFiles ) { + IntNative retVal = remove ( inName ); + ERROR_IF_NOT_ZERO ( retVal ); + } + } + } else { + unzFailsExist = True; + deleteOutputOnInterrupt = False; + if ( srcMode == SM_F2F ) { + IntNative retVal = remove ( outName ); + ERROR_IF_NOT_ZERO ( retVal ); + } + } + deleteOutputOnInterrupt = False; + + if ( magicNumberOK ) { + if (verbosity >= 1) + fprintf ( stderr, "done\n" ); + } else { + setExit(2); + if (verbosity >= 1) + fprintf ( stderr, "not a bzip2 file.\n" ); else + fprintf ( stderr, + "%s: %s is not a bzip2 file.\n", + progName, inName ); + } + +} + + +/*---------------------------------------------*/ +static +void testf ( Char *name ) +{ + FILE *inStr; + Bool allOK; + struct MY_STAT statBuf; + + deleteOutputOnInterrupt = False; + + if (name == NULL && srcMode != SM_I2O) + panic ( "testf: bad modes\n" ); + + copyFileName ( outName, (Char*)"(none)" ); + switch (srcMode) { + case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break; + case SM_F2F: copyFileName ( inName, name ); break; + case SM_F2O: copyFileName ( inName, name ); break; + } + + if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) { + if (noisy) + fprintf ( stderr, "%s: There are no files matching `%s'.\n", + progName, inName ); + setExit(1); + return; + } + if ( srcMode != SM_I2O && !fileExists ( inName ) ) { + fprintf ( stderr, "%s: Can't open input %s: %s.\n", + progName, inName, strerror(errno) ); + setExit(1); + return; + } + if ( srcMode != SM_I2O ) { + MY_STAT(inName, &statBuf); + if ( MY_S_ISDIR(statBuf.st_mode) ) { + fprintf( stderr, + "%s: Input file %s is a directory.\n", + progName,inName); + setExit(1); + return; + } + } + + switch ( srcMode ) { + + case SM_I2O: + if ( isatty ( fileno ( stdin ) ) ) { + fprintf ( stderr, + "%s: I won't read compressed data from a terminal.\n", + progName ); + fprintf ( stderr, "%s: For help, type: `%s --help'.\n", + progName, progName ); + setExit(1); + return; + }; + inStr = stdin; + break; + + case SM_F2O: case SM_F2F: + inStr = fopen ( inName, "rb" ); + if ( inStr == NULL ) { + fprintf ( stderr, "%s: Can't open input file %s:%s.\n", + progName, inName, strerror(errno) ); + setExit(1); + return; + }; + break; + + default: + panic ( "testf: bad srcMode" ); + break; + } + + if (verbosity >= 1) { + fprintf ( stderr, " %s: ", inName ); + pad ( inName ); + fflush ( stderr ); + } + + /*--- Now the input handle is sane. Do the Biz. ---*/ + outputHandleJustInCase = NULL; + allOK = testStream ( inStr ); + + if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" ); + if (!allOK) testFailsExist = True; +} + + +/*---------------------------------------------*/ +static +void license ( void ) +{ + fprintf ( stderr, + + "bzip2, a block-sorting file compressor. " + "Version %s.\n" + " \n" + " Copyright (C) 1996-2010 by Julian Seward.\n" + " \n" + " This program is free software; you can redistribute it and/or modify\n" + " it under the terms set out in the LICENSE file, which is included\n" + " in the bzip2-1.0.6 source distribution.\n" + " \n" + " This program is distributed in the hope that it will be useful,\n" + " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + " LICENSE file for more details.\n" + " \n", + BZ2_bzlibVersion() + ); +} + + +/*---------------------------------------------*/ +static +void usage ( Char *fullProgName ) +{ + fprintf ( + stderr, + "bzip2, a block-sorting file compressor. " + "Version %s.\n" + "\n usage: %s [flags and input files in any order]\n" + "\n" + " -h --help print this message\n" + " -d --decompress force decompression\n" + " -z --compress force compression\n" + " -k --keep keep (don't delete) input files\n" + " -f --force overwrite existing output files\n" + " -t --test test compressed file integrity\n" + " -c --stdout output to standard out\n" + " -q --quiet suppress noncritical error messages\n" + " -v --verbose be verbose (a 2nd -v gives more)\n" + " -L --license display software version & license\n" + " -V --version display software version & license\n" + " -s --small use less memory (at most 2500k)\n" + " -1 .. -9 set block size to 100k .. 900k\n" + " --fast alias for -1\n" + " --best alias for -9\n" + "\n" + " If invoked as `bzip2', default action is to compress.\n" + " as `bunzip2', default action is to decompress.\n" + " as `bzcat', default action is to decompress to stdout.\n" + "\n" + " If no file names are given, bzip2 compresses or decompresses\n" + " from standard input to standard output. You can combine\n" + " short flags, so `-v -4' means the same as -v4 or -4v, &c.\n" +# if BZ_UNIX + "\n" +# endif + , + + BZ2_bzlibVersion(), + fullProgName + ); +} + + +/*---------------------------------------------*/ +static +void redundant ( Char* flag ) +{ + fprintf ( + stderr, + "%s: %s is redundant in versions 0.9.5 and above\n", + progName, flag ); +} + + +/*---------------------------------------------*/ +/*-- + All the garbage from here to main() is purely to + implement a linked list of command-line arguments, + into which main() copies argv[1 .. argc-1]. + + The purpose of this exercise is to facilitate + the expansion of wildcard characters * and ? in + filenames for OSs which don't know how to do it + themselves, like MSDOS, Windows 95 and NT. + + The actual Dirty Work is done by the platform- + specific macro APPEND_FILESPEC. +--*/ + +typedef + struct zzzz { + Char *name; + struct zzzz *link; + } + Cell; + + +/*---------------------------------------------*/ +static +void *myMalloc ( Int32 n ) +{ + void* p; + + p = malloc ( (size_t)n ); + if (p == NULL) outOfMemory (); + return p; +} + + +/*---------------------------------------------*/ +static +Cell *mkCell ( void ) +{ + Cell *c; + + c = (Cell*) myMalloc ( sizeof ( Cell ) ); + c->name = NULL; + c->link = NULL; + return c; +} + + +/*---------------------------------------------*/ +static +Cell *snocString ( Cell *root, Char *name ) +{ + if (root == NULL) { + Cell *tmp = mkCell(); + tmp->name = (Char*) myMalloc ( 5 + strlen(name) ); + strcpy ( tmp->name, name ); + return tmp; + } else { + Cell *tmp = root; + while (tmp->link != NULL) tmp = tmp->link; + tmp->link = snocString ( tmp->link, name ); + return root; + } +} + + +/*---------------------------------------------*/ +static +void addFlagsFromEnvVar ( Cell** argList, Char* varName ) +{ + Int32 i, j, k; + Char *envbase, *p; + + envbase = getenv(varName); + if (envbase != NULL) { + p = envbase; + i = 0; + while (True) { + if (p[i] == 0) break; + p += i; + i = 0; + while (isspace((Int32)(p[0]))) p++; + while (p[i] != 0 && !isspace((Int32)(p[i]))) i++; + if (i > 0) { + k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10; + for (j = 0; j < k; j++) tmpName[j] = p[j]; + tmpName[k] = 0; + APPEND_FLAG(*argList, tmpName); + } + } + } +} + + +/*---------------------------------------------*/ +#define ISFLAG(s) (strcmp(aa->name, (s))==0) + +IntNative main ( IntNative argc, Char *argv[] ) +{ + Int32 i, j; + Char *tmp; + Cell *argList; + Cell *aa; + Bool decode; + + /*-- Be really really really paranoid :-) --*/ + if (sizeof(Int32) != 4 || sizeof(UInt32) != 4 || + sizeof(Int16) != 2 || sizeof(UInt16) != 2 || + sizeof(Char) != 1 || sizeof(UChar) != 1) + configError(); + + /*-- Initialise --*/ + outputHandleJustInCase = NULL; + smallMode = False; + keepInputFiles = False; + forceOverwrite = False; + noisy = True; + verbosity = 0; + blockSize100k = 9; + testFailsExist = False; + unzFailsExist = False; + numFileNames = 0; + numFilesProcessed = 0; + workFactor = 30; + deleteOutputOnInterrupt = False; + exitValue = 0; + i = j = 0; /* avoid bogus warning from egcs-1.1.X */ + + /*-- Set up signal handlers for mem access errors --*/ + signal (SIGSEGV, mySIGSEGVorSIGBUScatcher); +# if BZ_UNIX +# ifndef __DJGPP__ + signal (SIGBUS, mySIGSEGVorSIGBUScatcher); +# endif +# endif + + copyFileName ( inName, (Char*)"(none)" ); + copyFileName ( outName, (Char*)"(none)" ); + + copyFileName ( progNameReally, argv[0] ); + progName = &progNameReally[0]; + for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++) + if (*tmp == PATH_SEP) progName = tmp + 1; + + + /*-- Copy flags from env var BZIP2, and + expand filename wildcards in arg list. + --*/ + argList = NULL; + addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" ); + addFlagsFromEnvVar ( &argList, (Char*)"BZIP" ); + for (i = 1; i <= argc-1; i++) + APPEND_FILESPEC(argList, argv[i]); + + + /*-- Find the length of the longest filename --*/ + longestFileName = 7; + numFileNames = 0; + decode = True; + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) { decode = False; continue; } + if (aa->name[0] == '-' && decode) continue; + numFileNames++; + if (longestFileName < (Int32)strlen(aa->name) ) + longestFileName = (Int32)strlen(aa->name); + } + + + /*-- Determine source modes; flag handling may change this too. --*/ + if (numFileNames == 0) + srcMode = SM_I2O; else srcMode = SM_F2F; + + + /*-- Determine what to do (compress/uncompress/test/cat). --*/ + /*-- Note that subsequent flag handling may change this. --*/ + opMode = OM_Z; + + if ( (strstr ( progName, "unzip" ) != 0) || + (strstr ( progName, "UNZIP" ) != 0) ) + opMode = OM_UNZ; + + if ( (strstr ( progName, "z2cat" ) != 0) || + (strstr ( progName, "Z2CAT" ) != 0) || + (strstr ( progName, "zcat" ) != 0) || + (strstr ( progName, "ZCAT" ) != 0) ) { + opMode = OM_UNZ; + srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O; + } + + + /*-- Look at the flags. --*/ + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) break; + if (aa->name[0] == '-' && aa->name[1] != '-') { + for (j = 1; aa->name[j] != '\0'; j++) { + switch (aa->name[j]) { + case 'c': srcMode = SM_F2O; break; + case 'd': opMode = OM_UNZ; break; + case 'z': opMode = OM_Z; break; + case 'f': forceOverwrite = True; break; + case 't': opMode = OM_TEST; break; + case 'k': keepInputFiles = True; break; + case 's': smallMode = True; break; + case 'q': noisy = False; break; + case '1': blockSize100k = 1; break; + case '2': blockSize100k = 2; break; + case '3': blockSize100k = 3; break; + case '4': blockSize100k = 4; break; + case '5': blockSize100k = 5; break; + case '6': blockSize100k = 6; break; + case '7': blockSize100k = 7; break; + case '8': blockSize100k = 8; break; + case '9': blockSize100k = 9; break; + case 'V': + case 'L': license(); break; + case 'v': verbosity++; break; + case 'h': usage ( progName ); + exit ( 0 ); + break; + default: fprintf ( stderr, "%s: Bad flag `%s'\n", + progName, aa->name ); + usage ( progName ); + exit ( 1 ); + break; + } + } + } + } + + /*-- And again ... --*/ + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) break; + if (ISFLAG("--stdout")) srcMode = SM_F2O; else + if (ISFLAG("--decompress")) opMode = OM_UNZ; else + if (ISFLAG("--compress")) opMode = OM_Z; else + if (ISFLAG("--force")) forceOverwrite = True; else + if (ISFLAG("--test")) opMode = OM_TEST; else + if (ISFLAG("--keep")) keepInputFiles = True; else + if (ISFLAG("--small")) smallMode = True; else + if (ISFLAG("--quiet")) noisy = False; else + if (ISFLAG("--version")) license(); else + if (ISFLAG("--license")) license(); else + if (ISFLAG("--exponential")) workFactor = 1; else + if (ISFLAG("--repetitive-best")) redundant(aa->name); else + if (ISFLAG("--repetitive-fast")) redundant(aa->name); else + if (ISFLAG("--fast")) blockSize100k = 1; else + if (ISFLAG("--best")) blockSize100k = 9; else + if (ISFLAG("--verbose")) verbosity++; else + if (ISFLAG("--help")) { usage ( progName ); exit ( 0 ); } + else + if (strncmp ( aa->name, "--", 2) == 0) { + fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name ); + usage ( progName ); + exit ( 1 ); + } + } + + if (verbosity > 4) verbosity = 4; + if (opMode == OM_Z && smallMode && blockSize100k > 2) + blockSize100k = 2; + + if (opMode == OM_TEST && srcMode == SM_F2O) { + fprintf ( stderr, "%s: -c and -t cannot be used together.\n", + progName ); + exit ( 1 ); + } + + if (srcMode == SM_F2O && numFileNames == 0) + srcMode = SM_I2O; + + if (opMode != OM_Z) blockSize100k = 0; + + if (srcMode == SM_F2F) { + signal (SIGINT, mySignalCatcher); + signal (SIGTERM, mySignalCatcher); +# if BZ_UNIX + signal (SIGHUP, mySignalCatcher); +# endif + } + + if (opMode == OM_Z) { + if (srcMode == SM_I2O) { + compress ( NULL ); + } else { + decode = True; + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) { decode = False; continue; } + if (aa->name[0] == '-' && decode) continue; + numFilesProcessed++; + compress ( aa->name ); + } + } + } + else + + if (opMode == OM_UNZ) { + unzFailsExist = False; + if (srcMode == SM_I2O) { + uncompress ( NULL ); + } else { + decode = True; + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) { decode = False; continue; } + if (aa->name[0] == '-' && decode) continue; + numFilesProcessed++; + uncompress ( aa->name ); + } + } + if (unzFailsExist) { + setExit(2); + exit(exitValue); + } + } + + else { + testFailsExist = False; + if (srcMode == SM_I2O) { + testf ( NULL ); + } else { + decode = True; + for (aa = argList; aa != NULL; aa = aa->link) { + if (ISFLAG("--")) { decode = False; continue; } + if (aa->name[0] == '-' && decode) continue; + numFilesProcessed++; + testf ( aa->name ); + } + } + if (testFailsExist && noisy) { + fprintf ( stderr, + "\n" + "You can use the `bzip2recover' program to attempt to recover\n" + "data from undamaged sections of corrupted files.\n\n" + ); + setExit(2); + exit(exitValue); + } + } + + /* Free the argument list memory to mollify leak detectors + (eg) Purify, Checker. Serves no other useful purpose. + */ + aa = argList; + while (aa != NULL) { + Cell* aa2 = aa->link; + if (aa->name != NULL) free(aa->name); + free(aa); + aa = aa2; + } + + return exitValue; +} + + +/*-----------------------------------------------------------*/ +/*--- end bzip2.c ---*/ +/*-----------------------------------------------------------*/ diff --git a/dep/bzip2/bzip2recover.c b/dep/bzip2/bzip2recover.c new file mode 100644 index 00000000000..f9de0496abf --- /dev/null +++ b/dep/bzip2/bzip2recover.c @@ -0,0 +1,514 @@ +/*-----------------------------------------------------------*/ +/*--- Block recoverer program for bzip2 ---*/ +/*--- bzip2recover.c ---*/ +/*-----------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + +/* This program is a complete hack and should be rewritten properly. + It isn't very complicated. */ + +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> + + +/* This program records bit locations in the file to be recovered. + That means that if 64-bit ints are not supported, we will not + be able to recover .bz2 files over 512MB (2^32 bits) long. + On GNU supported platforms, we take advantage of the 64-bit + int support to circumvent this problem. Ditto MSVC. + + This change occurred in version 1.0.2; all prior versions have + the 512MB limitation. +*/ +#ifdef __GNUC__ + typedef unsigned long long int MaybeUInt64; +# define MaybeUInt64_FMT "%Lu" +#else +#ifdef _MSC_VER + typedef unsigned __int64 MaybeUInt64; +# define MaybeUInt64_FMT "%I64u" +#else + typedef unsigned int MaybeUInt64; +# define MaybeUInt64_FMT "%u" +#endif +#endif + +typedef unsigned int UInt32; +typedef int Int32; +typedef unsigned char UChar; +typedef char Char; +typedef unsigned char Bool; +#define True ((Bool)1) +#define False ((Bool)0) + + +#define BZ_MAX_FILENAME 2000 + +Char inFileName[BZ_MAX_FILENAME]; +Char outFileName[BZ_MAX_FILENAME]; +Char progName[BZ_MAX_FILENAME]; + +MaybeUInt64 bytesOut = 0; +MaybeUInt64 bytesIn = 0; + + +/*---------------------------------------------------*/ +/*--- Header bytes ---*/ +/*---------------------------------------------------*/ + +#define BZ_HDR_B 0x42 /* 'B' */ +#define BZ_HDR_Z 0x5a /* 'Z' */ +#define BZ_HDR_h 0x68 /* 'h' */ +#define BZ_HDR_0 0x30 /* '0' */ + + +/*---------------------------------------------------*/ +/*--- I/O errors ---*/ +/*---------------------------------------------------*/ + +/*---------------------------------------------*/ +static void readError ( void ) +{ + fprintf ( stderr, + "%s: I/O error reading `%s', possible reason follows.\n", + progName, inFileName ); + perror ( progName ); + fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", + progName ); + exit ( 1 ); +} + + +/*---------------------------------------------*/ +static void writeError ( void ) +{ + fprintf ( stderr, + "%s: I/O error reading `%s', possible reason follows.\n", + progName, inFileName ); + perror ( progName ); + fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", + progName ); + exit ( 1 ); +} + + +/*---------------------------------------------*/ +static void mallocFail ( Int32 n ) +{ + fprintf ( stderr, + "%s: malloc failed on request for %d bytes.\n", + progName, n ); + fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n", + progName ); + exit ( 1 ); +} + + +/*---------------------------------------------*/ +static void tooManyBlocks ( Int32 max_handled_blocks ) +{ + fprintf ( stderr, + "%s: `%s' appears to contain more than %d blocks\n", + progName, inFileName, max_handled_blocks ); + fprintf ( stderr, + "%s: and cannot be handled. To fix, increase\n", + progName ); + fprintf ( stderr, + "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n", + progName ); + exit ( 1 ); +} + + + +/*---------------------------------------------------*/ +/*--- Bit stream I/O ---*/ +/*---------------------------------------------------*/ + +typedef + struct { + FILE* handle; + Int32 buffer; + Int32 buffLive; + Char mode; + } + BitStream; + + +/*---------------------------------------------*/ +static BitStream* bsOpenReadStream ( FILE* stream ) +{ + BitStream *bs = malloc ( sizeof(BitStream) ); + if (bs == NULL) mallocFail ( sizeof(BitStream) ); + bs->handle = stream; + bs->buffer = 0; + bs->buffLive = 0; + bs->mode = 'r'; + return bs; +} + + +/*---------------------------------------------*/ +static BitStream* bsOpenWriteStream ( FILE* stream ) +{ + BitStream *bs = malloc ( sizeof(BitStream) ); + if (bs == NULL) mallocFail ( sizeof(BitStream) ); + bs->handle = stream; + bs->buffer = 0; + bs->buffLive = 0; + bs->mode = 'w'; + return bs; +} + + +/*---------------------------------------------*/ +static void bsPutBit ( BitStream* bs, Int32 bit ) +{ + if (bs->buffLive == 8) { + Int32 retVal = putc ( (UChar) bs->buffer, bs->handle ); + if (retVal == EOF) writeError(); + bytesOut++; + bs->buffLive = 1; + bs->buffer = bit & 0x1; + } else { + bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) ); + bs->buffLive++; + }; +} + + +/*---------------------------------------------*/ +/*-- + Returns 0 or 1, or 2 to indicate EOF. +--*/ +static Int32 bsGetBit ( BitStream* bs ) +{ + if (bs->buffLive > 0) { + bs->buffLive --; + return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 ); + } else { + Int32 retVal = getc ( bs->handle ); + if ( retVal == EOF ) { + if (errno != 0) readError(); + return 2; + } + bs->buffLive = 7; + bs->buffer = retVal; + return ( ((bs->buffer) >> 7) & 0x1 ); + } +} + + +/*---------------------------------------------*/ +static void bsClose ( BitStream* bs ) +{ + Int32 retVal; + + if ( bs->mode == 'w' ) { + while ( bs->buffLive < 8 ) { + bs->buffLive++; + bs->buffer <<= 1; + }; + retVal = putc ( (UChar) (bs->buffer), bs->handle ); + if (retVal == EOF) writeError(); + bytesOut++; + retVal = fflush ( bs->handle ); + if (retVal == EOF) writeError(); + } + retVal = fclose ( bs->handle ); + if (retVal == EOF) { + if (bs->mode == 'w') writeError(); else readError(); + } + free ( bs ); +} + + +/*---------------------------------------------*/ +static void bsPutUChar ( BitStream* bs, UChar c ) +{ + Int32 i; + for (i = 7; i >= 0; i--) + bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 ); +} + + +/*---------------------------------------------*/ +static void bsPutUInt32 ( BitStream* bs, UInt32 c ) +{ + Int32 i; + + for (i = 31; i >= 0; i--) + bsPutBit ( bs, (c >> i) & 0x1 ); +} + + +/*---------------------------------------------*/ +static Bool endsInBz2 ( Char* name ) +{ + Int32 n = strlen ( name ); + if (n <= 4) return False; + return + (name[n-4] == '.' && + name[n-3] == 'b' && + name[n-2] == 'z' && + name[n-1] == '2'); +} + + +/*---------------------------------------------------*/ +/*--- ---*/ +/*---------------------------------------------------*/ + +/* This logic isn't really right when it comes to Cygwin. */ +#ifdef _WIN32 +# define BZ_SPLIT_SYM '\\' /* path splitter on Windows platform */ +#else +# define BZ_SPLIT_SYM '/' /* path splitter on Unix platform */ +#endif + +#define BLOCK_HEADER_HI 0x00003141UL +#define BLOCK_HEADER_LO 0x59265359UL + +#define BLOCK_ENDMARK_HI 0x00001772UL +#define BLOCK_ENDMARK_LO 0x45385090UL + +/* Increase if necessary. However, a .bz2 file with > 50000 blocks + would have an uncompressed size of at least 40GB, so the chances + are low you'll need to up this. +*/ +#define BZ_MAX_HANDLED_BLOCKS 50000 + +MaybeUInt64 bStart [BZ_MAX_HANDLED_BLOCKS]; +MaybeUInt64 bEnd [BZ_MAX_HANDLED_BLOCKS]; +MaybeUInt64 rbStart[BZ_MAX_HANDLED_BLOCKS]; +MaybeUInt64 rbEnd [BZ_MAX_HANDLED_BLOCKS]; + +Int32 main ( Int32 argc, Char** argv ) +{ + FILE* inFile; + FILE* outFile; + BitStream* bsIn, *bsWr; + Int32 b, wrBlock, currBlock, rbCtr; + MaybeUInt64 bitsRead; + + UInt32 buffHi, buffLo, blockCRC; + Char* p; + + strcpy ( progName, argv[0] ); + inFileName[0] = outFileName[0] = 0; + + fprintf ( stderr, + "bzip2recover 1.0.6: extracts blocks from damaged .bz2 files.\n" ); + + if (argc != 2) { + fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", + progName, progName ); + switch (sizeof(MaybeUInt64)) { + case 8: + fprintf(stderr, + "\trestrictions on size of recovered file: None\n"); + break; + case 4: + fprintf(stderr, + "\trestrictions on size of recovered file: 512 MB\n"); + fprintf(stderr, + "\tto circumvent, recompile with MaybeUInt64 as an\n" + "\tunsigned 64-bit int.\n"); + break; + default: + fprintf(stderr, + "\tsizeof(MaybeUInt64) is not 4 or 8 -- " + "configuration error.\n"); + break; + } + exit(1); + } + + if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) { + fprintf ( stderr, + "%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n", + progName, (int)strlen(argv[1]) ); + exit(1); + } + + strcpy ( inFileName, argv[1] ); + + inFile = fopen ( inFileName, "rb" ); + if (inFile == NULL) { + fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName ); + exit(1); + } + + bsIn = bsOpenReadStream ( inFile ); + fprintf ( stderr, "%s: searching for block boundaries ...\n", progName ); + + bitsRead = 0; + buffHi = buffLo = 0; + currBlock = 0; + bStart[currBlock] = 0; + + rbCtr = 0; + + while (True) { + b = bsGetBit ( bsIn ); + bitsRead++; + if (b == 2) { + if (bitsRead >= bStart[currBlock] && + (bitsRead - bStart[currBlock]) >= 40) { + bEnd[currBlock] = bitsRead-1; + if (currBlock > 0) + fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT + " to " MaybeUInt64_FMT " (incomplete)\n", + currBlock, bStart[currBlock], bEnd[currBlock] ); + } else + currBlock--; + break; + } + buffHi = (buffHi << 1) | (buffLo >> 31); + buffLo = (buffLo << 1) | (b & 1); + if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI + && buffLo == BLOCK_HEADER_LO) + || + ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI + && buffLo == BLOCK_ENDMARK_LO) + ) { + if (bitsRead > 49) { + bEnd[currBlock] = bitsRead-49; + } else { + bEnd[currBlock] = 0; + } + if (currBlock > 0 && + (bEnd[currBlock] - bStart[currBlock]) >= 130) { + fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT + " to " MaybeUInt64_FMT "\n", + rbCtr+1, bStart[currBlock], bEnd[currBlock] ); + rbStart[rbCtr] = bStart[currBlock]; + rbEnd[rbCtr] = bEnd[currBlock]; + rbCtr++; + } + if (currBlock >= BZ_MAX_HANDLED_BLOCKS) + tooManyBlocks(BZ_MAX_HANDLED_BLOCKS); + currBlock++; + + bStart[currBlock] = bitsRead; + } + } + + bsClose ( bsIn ); + + /*-- identified blocks run from 1 to rbCtr inclusive. --*/ + + if (rbCtr < 1) { + fprintf ( stderr, + "%s: sorry, I couldn't find any block boundaries.\n", + progName ); + exit(1); + }; + + fprintf ( stderr, "%s: splitting into blocks\n", progName ); + + inFile = fopen ( inFileName, "rb" ); + if (inFile == NULL) { + fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName ); + exit(1); + } + bsIn = bsOpenReadStream ( inFile ); + + /*-- placate gcc's dataflow analyser --*/ + blockCRC = 0; bsWr = 0; + + bitsRead = 0; + outFile = NULL; + wrBlock = 0; + while (True) { + b = bsGetBit(bsIn); + if (b == 2) break; + buffHi = (buffHi << 1) | (buffLo >> 31); + buffLo = (buffLo << 1) | (b & 1); + if (bitsRead == 47+rbStart[wrBlock]) + blockCRC = (buffHi << 16) | (buffLo >> 16); + + if (outFile != NULL && bitsRead >= rbStart[wrBlock] + && bitsRead <= rbEnd[wrBlock]) { + bsPutBit ( bsWr, b ); + } + + bitsRead++; + + if (bitsRead == rbEnd[wrBlock]+1) { + if (outFile != NULL) { + bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 ); + bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 ); + bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); + bsPutUInt32 ( bsWr, blockCRC ); + bsClose ( bsWr ); + } + if (wrBlock >= rbCtr) break; + wrBlock++; + } else + if (bitsRead == rbStart[wrBlock]) { + /* Create the output file name, correctly handling leading paths. + (31.10.2001 by Sergey E. Kusikov) */ + Char* split; + Int32 ofs, k; + for (k = 0; k < BZ_MAX_FILENAME; k++) + outFileName[k] = 0; + strcpy (outFileName, inFileName); + split = strrchr (outFileName, BZ_SPLIT_SYM); + if (split == NULL) { + split = outFileName; + } else { + ++split; + } + /* Now split points to the start of the basename. */ + ofs = split - outFileName; + sprintf (split, "rec%5d", wrBlock+1); + for (p = split; *p != 0; p++) if (*p == ' ') *p = '0'; + strcat (outFileName, inFileName + ofs); + + if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" ); + + fprintf ( stderr, " writing block %d to `%s' ...\n", + wrBlock+1, outFileName ); + + outFile = fopen ( outFileName, "wb" ); + if (outFile == NULL) { + fprintf ( stderr, "%s: can't write `%s'\n", + progName, outFileName ); + exit(1); + } + bsWr = bsOpenWriteStream ( outFile ); + bsPutUChar ( bsWr, BZ_HDR_B ); + bsPutUChar ( bsWr, BZ_HDR_Z ); + bsPutUChar ( bsWr, BZ_HDR_h ); + bsPutUChar ( bsWr, BZ_HDR_0 + 9 ); + bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 ); + bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 ); + bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 ); + } + } + + fprintf ( stderr, "%s: finished\n", progName ); + return 0; +} + + + +/*-----------------------------------------------------------*/ +/*--- end bzip2recover.c ---*/ +/*-----------------------------------------------------------*/ diff --git a/dep/bzip2/bzlib.c b/dep/bzip2/bzlib.c index ef86c91e695..bd358a793b8 100644 --- a/dep/bzip2/bzlib.c +++ b/dep/bzip2/bzlib.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/bzlib.h b/dep/bzip2/bzlib.h index c5b75d6d8ff..8277123da8c 100644 --- a/dep/bzip2/bzlib.h +++ b/dep/bzip2/bzlib.h @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/bzlib_private.h b/dep/bzip2/bzlib_private.h index 23427879b18..5d0217f4635 100644 --- a/dep/bzip2/bzlib_private.h +++ b/dep/bzip2/bzlib_private.h @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -36,7 +36,7 @@ /*-- General stuff. --*/ -#define BZ_VERSION "1.0.5, 10-Dec-2007" +#define BZ_VERSION "1.0.6, 6-Sept-2010" typedef char Char; typedef unsigned char Bool; diff --git a/dep/bzip2/compress.c b/dep/bzip2/compress.c index 8c80a079700..caf7696011b 100644 --- a/dep/bzip2/compress.c +++ b/dep/bzip2/compress.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/crctable.c b/dep/bzip2/crctable.c index 215687b2c05..1fea7e946c5 100644 --- a/dep/bzip2/crctable.c +++ b/dep/bzip2/crctable.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/decompress.c b/dep/bzip2/decompress.c index bba5e0fa36d..311f5668f9a 100644 --- a/dep/bzip2/decompress.c +++ b/dep/bzip2/decompress.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -381,6 +381,13 @@ Int32 BZ2_decompress ( DState* s ) es = -1; N = 1; do { + /* Check that N doesn't get too big, so that es doesn't + go negative. The maximum value that can be + RUNA/RUNB encoded is equal to the block size (post + the initial RLE), viz, 900k, so bounding N at 2 + million should guard against overflow without + rejecting any legitimate inputs. */ + if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; @@ -485,15 +492,28 @@ Int32 BZ2_decompress ( DState* s ) RETURN(BZ_DATA_ERROR); /*-- Set up cftab to facilitate generation of T^(-1) --*/ + /* Check: unzftab entries in range. */ + for (i = 0; i <= 255; i++) { + if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) + RETURN(BZ_DATA_ERROR); + } + /* Actually generate cftab. */ s->cftab[0] = 0; for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; + /* Check: cftab entries in range. */ for (i = 0; i <= 256; i++) { if (s->cftab[i] < 0 || s->cftab[i] > nblock) { /* s->cftab[i] can legitimately be == nblock */ RETURN(BZ_DATA_ERROR); } } + /* Check: cftab entries non-descending. */ + for (i = 1; i <= 256; i++) { + if (s->cftab[i-1] > s->cftab[i]) { + RETURN(BZ_DATA_ERROR); + } + } s->state_out_len = 0; s->state_out_ch = 0; diff --git a/dep/bzip2/huffman.c b/dep/bzip2/huffman.c index 87e79e38af0..2283fdbc5a1 100644 --- a/dep/bzip2/huffman.c +++ b/dep/bzip2/huffman.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/bzip2/randtable.c b/dep/bzip2/randtable.c index 068b76367bc..6d624599061 100644 --- a/dep/bzip2/randtable.c +++ b/dep/bzip2/randtable.c @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007 - Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org> + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. diff --git a/dep/g3dlite/G3D-v8.0_extra.diff b/dep/g3dlite/G3D-v8.0_extra.diff new file mode 100644 index 00000000000..d556103c96d --- /dev/null +++ b/dep/g3dlite/G3D-v8.0_extra.diff @@ -0,0 +1,12 @@ +diff --git a/dep/g3dlite/include/G3D/GMutex.h b/dep/g3dlite/include/G3D/GMutex.h +index 3469b81..9fe098d 100644 +--- a/dep/g3dlite/include/G3D/GMutex.h ++++ b/dep/g3dlite/include/G3D/GMutex.h +@@ -16,6 +16,7 @@ + #ifndef G3D_WIN32 + # include <pthread.h> + # include <signal.h> ++# include <unistd.h> + #endif + + diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h index 2e8da1f6098..d57320d73eb 100644 --- a/dep/g3dlite/include/G3D/AABox.h +++ b/dep/g3dlite/include/G3D/AABox.h @@ -20,6 +20,7 @@ #include "G3D/debug.h" #include "G3D/Array.h" #include "G3D/Plane.h" +#include "G3D/Sphere.h" namespace G3D { @@ -259,6 +260,8 @@ public: void getBounds(AABox& out) const { out = *this; } + + void getBounds(Sphere& out) const; }; } diff --git a/dep/g3dlite/include/G3D/Any.h b/dep/g3dlite/include/G3D/Any.h index c267eedd22f..e2d0fbe7e62 100644 --- a/dep/g3dlite/include/G3D/Any.h +++ b/dep/g3dlite/include/G3D/Any.h @@ -17,7 +17,9 @@ #include "G3D/platform.h" #include "G3D/Table.h" #include "G3D/Array.h" +#include "G3D/Set.h" #include "G3D/AtomicInt32.h" +#include "G3D/stringutils.h" #include <string> // needed for Token @@ -448,7 +450,6 @@ public: */ std::string resolveStringAsFilename() const; - /** If this is named ARRAY or TABLE, returns the name. */ const std::string& name() const; @@ -518,7 +519,7 @@ public: // Needed to prevent the operator[](int) overload from catching // string literals - inline const Any& operator[](const char* key) const { + const Any& operator[](const char* key) const { return operator[](std::string(key)); } @@ -548,7 +549,7 @@ public: Any& operator[](const std::string& key); /** \copydoc Any::operator[](const std::string&) */ - inline Any& operator[](const char* key) { + Any& operator[](const char* key) { return operator[](std::string(key)); } @@ -636,6 +637,124 @@ private: }; // class Any + +/** + Convenient iteration over the keys of a Any::TABLE, usually + for implementing construction of an object from an Any. + + Getting an element using either iteration or explicit requests + consumes that element from the iterator (but not from the Any!) + It is an error to consume the same element more than once from + the same iterator. + + <pre> + AnyKeyIterator r(a); + r.getIfPresent("enabled", enabled); + r.getIfPresent("showSamples", showSamples); + r.getIfPresent("showTiles", showTiles); + + r.verifyDone(); + </pre> + + \beta +*/ +class AnyTableReader { +private: + Any m_any; + Set<std::string> m_alreadyRead; +public: + + /** Verifies that \a is a TABLE with the given \a name. */ + AnyTableReader(const std::string& name, const Any& a) : m_any(a) { + try { + m_any.verifyType(Any::TABLE); + m_any.verifyName(name); + } catch (const ParseError& e) { + // If an exception is thrown, the destructors will not be + // invoked automatically. + m_any.~Any(); + m_alreadyRead.~Set(); + throw e; + } + } + + /** Verifies that \a is a TABLE. */ + AnyTableReader(const Any& a) : m_any(a) { + try { + m_any.verifyType(Any::TABLE); + } catch (const ParseError& e) { + // If an exception is thrown, the destructors will not be + // invoked automatically. + m_any.~Any(); + m_alreadyRead.~Set(); + throw e; + } + } + + bool hasMore() const { + return m_any.size() > m_alreadyRead.size(); + } + + /** Verifies that all keys have been read. */ + void verifyDone() const { + if (hasMore()) { + // Generate all keys + // Remove the ones we've read + // Assert the rest + // any.verify(""); + } + } + +#if 0 + /** Returns the current key */ + const std::string& key() const; + + /** Returns the current value */ + const Any& value() const; + + AnyKeyIterator& operator++(); +#endif + + /** If key \s appears in the any, reads its value into \a v and + removes that key from the ones available to iterate over. + + If key \s does not appear in the any, throws a G3D::ParseError. + + Assumes that if key \s appears in the any it has not already been extracted + by this iterator. If it has been read before, an assertion will fail in debug mode. + + */ + template<class ValueType> + void get(const std::string& s, ValueType& v) { + v = m_any[s]; + m_alreadyRead.insert(toLower(s)); + } + + /** Get the value associated with a key only if the key is actually present. + + If key \s appears in the any, reads its value into \a v and + removes that key from the ones available to iterate over. + + If key \s does not appear in the any, does nothing. + + Assumes that if key \s appears in the any it has not already been extracted + by this iterator. If it has been read before, an assertion will fail in debug mode. + + \return True if the value was read. + */ + template<class ValueType> + bool getIfPresent(const std::string& s, ValueType& v) { + if (m_any.containsKey(s)) { + debugAssertM(! m_alreadyRead.contains(toLower(s)), "read twice"); + + get(s, v); + return true; + } else { + return false; + } + } +}; + } // namespace G3D #endif diff --git a/dep/g3dlite/include/G3D/GMutex.h b/dep/g3dlite/include/G3D/GMutex.h index 3469b812736..9fe098d10e3 100644 --- a/dep/g3dlite/include/G3D/GMutex.h +++ b/dep/g3dlite/include/G3D/GMutex.h @@ -16,6 +16,7 @@ #ifndef G3D_WIN32 # include <pthread.h> # include <signal.h> +# include <unistd.h> #endif diff --git a/dep/g3dlite/include/G3D/PointHashGrid.h b/dep/g3dlite/include/G3D/PointHashGrid.h index 5b128d1b5d9..d0b60a88ae5 100644 --- a/dep/g3dlite/include/G3D/PointHashGrid.h +++ b/dep/g3dlite/include/G3D/PointHashGrid.h @@ -360,7 +360,7 @@ public: m_arrayIndex(0), m_epoch(0) {} Iterator(const ThisType* grid) : - m_isEnd(false), + m_isEnd(grid->size() == 0), m_grid(grid), m_tableIterator( grid->m_data.begin() ), m_arrayIndex(0), @@ -387,6 +387,10 @@ public: } } + bool hasMore() const { + return ! m_isEnd; + } + bool operator==(const Iterator& other) const { return !(*this != other); } diff --git a/dep/g3dlite/include/G3D/Quat.inl b/dep/g3dlite/include/G3D/Quat.inl deleted file mode 100644 index 9e4c861d93b..00000000000 --- a/dep/g3dlite/include/G3D/Quat.inl +++ /dev/null @@ -1,36 +0,0 @@ -/** - Quat.inl - - @cite Quaternion implementation based on Watt & Watt page 363. - Thanks to Max McGuire for slerp optimizations. - - @maintainer Morgan McGuire, matrix@graphics3d.com - - @created 2002-01-23 - @edited 2004-03-04 - */ - -namespace G3D { - -inline float& Quat::operator[] (int i) { - debugAssert(i >= 0); - debugAssert(i < 4); - return ((float*)this)[i]; -} - -inline const float& Quat::operator[] (int i) const { - debugAssert(i >= 0); - debugAssert(i < 4); - return ((float*)this)[i]; -} - -inline Quat Quat::operator-(const Quat& other) const { - return Quat(x - other.x, y - other.y, z - other.z, w - other.w); -} - -inline Quat Quat::operator+(const Quat& other) const { - return Quat(x + other.x, y + other.y, z + other.z, w + other.w); -} - -} - diff --git a/dep/g3dlite/include/G3D/Sphere.h b/dep/g3dlite/include/G3D/Sphere.h index 595b61c4bf1..d1448261d9f 100644 --- a/dep/g3dlite/include/G3D/Sphere.h +++ b/dep/g3dlite/include/G3D/Sphere.h @@ -15,7 +15,6 @@ #include "G3D/platform.h" #include "G3D/Vector3.h" #include "G3D/Array.h" -#include "G3D/Sphere.h" namespace G3D { diff --git a/dep/g3dlite/include/G3D/Table.h b/dep/g3dlite/include/G3D/Table.h index 896a5a2a08a..ab0b114b1c4 100644 --- a/dep/g3dlite/include/G3D/Table.h +++ b/dep/g3dlite/include/G3D/Table.h @@ -86,12 +86,11 @@ namespace G3D { <PRE> template<> struct HashTrait<MyEnum> { - static size_t equals(const MyEnum& key) const { return reinterpret_cast<size_t>( key ); } + static size_t hashCode(const MyEnum& key) const { return reinterpret_cast<size_t>( key ); } }; </PRE> - And rely on the default enum operator==. - + and rely on the default enum operator==. Periodically check that debugGetLoad() is low (> 0.1). When it gets near 1.0 your hash function is badly designed and maps too many inputs to diff --git a/dep/g3dlite/include/G3D/Vector2.inl b/dep/g3dlite/include/G3D/Vector2.inl deleted file mode 100644 index 4f7c55a39cf..00000000000 --- a/dep/g3dlite/include/G3D/Vector2.inl +++ /dev/null @@ -1,18 +0,0 @@ -/** - @file Vector2.inl - - @maintainer Morgan McGuire, matrix@graphics3d.com - @cite Portions by Laura Wollstadt, graphics3d.com - - @cite Portions based on Dave Eberly'x Magic Software Library - at http://www.magic-software.com - - @created 2001-06-02 - @edited 2006-01-14 - - Copyright 2000-2006, Morgan McGuire. - All rights reserved. - */ - -} - diff --git a/dep/g3dlite/include/G3D/Vector3.inl b/dep/g3dlite/include/G3D/Vector3.inl deleted file mode 100644 index 9211c2a70fd..00000000000 --- a/dep/g3dlite/include/G3D/Vector3.inl +++ /dev/null @@ -1,249 +0,0 @@ -/** - @file Vector3.inl - - @maintainer Morgan McGuire, matrix@graphics3d.com - - @cite Portions based on Dave Eberly's Magic Software Library at http://www.magic-software.com - - @created 2001-06-02 - @edited 2004-05-21 - Copyright 2000-2004, Morgan McGuire. - All rights reserved. - */ - -//---------------------------------------------------------------------------- -#ifdef SSE - // If you receive an error on this line, it is because you do not have the file - // xmmintrin.h needed for MMX & SSE extensions. Download and install - // - // http://download.microsoft.com/download/vstudio60ent/SP5/Wideband-Full/WIN98Me/EN-US/vs6sp5.exe - // and - // http://download.microsoft.com/download/vb60ent/Update/6/W9X2KXP/EN-US/vcpp5.exe - // - // to get this file. -# include <xmmintrin.h> -#endif - -inline unsigned int hashCode(const G3D::Vector3& v) { - return v.hashCode(); -} - -namespace G3D { - -//---------------------------------------------------------------------------- -inline Vector3::Vector3() : x(0.0f), y(0.0f), z(0.0f) { -} - -//---------------------------------------------------------------------------- - -inline Vector3::Vector3 (float fX, float fY, float fZ) : x(fX), y(fY), z(fZ) { -} - -//---------------------------------------------------------------------------- -inline Vector3::Vector3 (float V[3]) : x(V[0]), y(V[1]), z(V[2]){ -} -//---------------------------------------------------------------------------- -inline Vector3::Vector3 (double V[3]) : x((float)V[0]), y((float)V[1]), z((float)V[2]){ -} - -//---------------------------------------------------------------------------- -inline Vector3::Vector3 (const Vector3& V) : x(V.x), y(V.y), z(V.z) { -} - -//---------------------------------------------------------------------------- - -//inline Vector3::Vector3 (const __m128& m) { - // Cast from SSE packed floats -// *this = *(Vector3*)&m; -//} - -//---------------------------------------------------------------------------- -inline const float& Vector3::operator[] (int i) const { - return ((float*)this)[i]; -} - -inline float& Vector3::operator[] (int i) { - return ((float*)this)[i]; -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator= (const Vector3& rkVector) { - x = rkVector.x; - y = rkVector.y; - z = rkVector.z; - return *this; -} - -//---------------------------------------------------------------------------- - -inline bool Vector3::fuzzyEq(const Vector3& other) const { - return G3D::fuzzyEq((*this - other).squaredMagnitude(), 0); -} - -//---------------------------------------------------------------------------- - -inline bool Vector3::fuzzyNe(const Vector3& other) const { - return G3D::fuzzyNe((*this - other).squaredMagnitude(), 0); -} - -//---------------------------------------------------------------------------- - -inline bool Vector3::isFinite() const { - return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z); -} - -//---------------------------------------------------------------------------- -inline bool Vector3::operator== (const Vector3& rkVector) const { - return ( x == rkVector.x && y == rkVector.y && z == rkVector.z ); -} - -//---------------------------------------------------------------------------- -inline bool Vector3::operator!= (const Vector3& rkVector) const { - return ( x != rkVector.x || y != rkVector.y || z != rkVector.z ); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::operator+ (const Vector3& rkVector) const { - return Vector3(x + rkVector.x, y + rkVector.y, z + rkVector.z); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::operator- (const Vector3& rkVector) const { - return Vector3(x - rkVector.x, y - rkVector.y, z - rkVector.z); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::operator* (const Vector3& rkVector) const { - return Vector3(x * rkVector.x, y * rkVector.y, z * rkVector.z); -} - -inline Vector3 Vector3::operator*(float f) const { - return Vector3(x * f, y * f, z * f); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::operator/ (const Vector3& rkVector) const { - return Vector3(x / rkVector.x, y / rkVector.y, z / rkVector.z); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::operator- () const { - return Vector3(-x, -y, -z); -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator+= (const Vector3& rkVector) { - x += rkVector.x; - y += rkVector.y; - z += rkVector.z; - return *this; -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator-= (const Vector3& rkVector) { - x -= rkVector.x; - y -= rkVector.y; - z -= rkVector.z; - return *this; -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator*= (float fScalar) { - x *= fScalar; - y *= fScalar; - z *= fScalar; - return *this; -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator*= (const Vector3& rkVector) { - x *= rkVector.x; - y *= rkVector.y; - z *= rkVector.z; - return *this; -} - -//---------------------------------------------------------------------------- -inline Vector3& Vector3::operator/= (const Vector3& rkVector) { - x /= rkVector.x; - y /= rkVector.y; - z /= rkVector.z; - return *this; -} - -//---------------------------------------------------------------------------- -inline float Vector3::squaredMagnitude () const { - return x*x + y*y + z*z; -} - -//---------------------------------------------------------------------------- -inline float Vector3::squaredLength () const { - return squaredMagnitude(); -} - -//---------------------------------------------------------------------------- -inline float Vector3::magnitude() const { - return sqrtf(x*x + y*y + z*z); -} - -//---------------------------------------------------------------------------- -inline float Vector3::length() const { - return magnitude(); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::direction () const { - float lenSquared = squaredMagnitude(); - float invSqrt = 1.0f / sqrtf(lenSquared); - return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); -} - -//---------------------------------------------------------------------------- - -inline Vector3 Vector3::fastDirection () const { - float lenSquared = x * x + y * y + z * z; - float invSqrt = rsq(lenSquared); - return Vector3(x * invSqrt, y * invSqrt, z * invSqrt); -} - -//---------------------------------------------------------------------------- -inline float Vector3::dot (const Vector3& rkVector) const { - return x*rkVector.x + y*rkVector.y + z*rkVector.z; -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::cross (const Vector3& rkVector) const { - return Vector3(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, - x*rkVector.y - y*rkVector.x); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::unitCross (const Vector3& rkVector) const { - Vector3 kCross(y*rkVector.z - z*rkVector.y, z*rkVector.x - x*rkVector.z, - x*rkVector.y - y*rkVector.x); - kCross.unitize(); - return kCross; -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::min(const Vector3 &v) const { - return Vector3(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z)); -} - -//---------------------------------------------------------------------------- -inline Vector3 Vector3::max(const Vector3 &v) const { - return Vector3(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z)); -} - -//---------------------------------------------------------------------------- -inline bool Vector3::isZero() const { - return G3D::fuzzyEq(squaredMagnitude(), 0.0f); -} - -//---------------------------------------------------------------------------- - -inline bool Vector3::isUnit() const { - return G3D::fuzzyEq(squaredMagnitude(), 1.0f); -} - -} // namespace diff --git a/dep/g3dlite/include/G3D/Vector4.inl b/dep/g3dlite/include/G3D/Vector4.inl deleted file mode 100644 index 576cca83b56..00000000000 --- a/dep/g3dlite/include/G3D/Vector4.inl +++ /dev/null @@ -1,191 +0,0 @@ -/** - @file Vector4.inl - - @maintainer Morgan McGuire, matrix@graphics3d.com - - @created 2002-07-09 - @edited 2003-02-10 - */ - -//---------------------------------------------------------------------------- - -inline unsigned int hashCode(const G3D::Vector4& v) { - return v.hashCode(); -} - -namespace G3D { - -//---------------------------------------------------------------------------- -inline Vector4::Vector4() { - x = y = z = w = 0; -} - -//---------------------------------------------------------------------------- - -inline Vector4::Vector4 (float fX, float fY, float fZ, float fW) { - x = fX; - y = fY; - z = fZ; - w = fW; -} - -//---------------------------------------------------------------------------- -inline Vector4::Vector4 (float afCoordinate[4]) { - x = afCoordinate[0]; - y = afCoordinate[1]; - z = afCoordinate[2]; - w = afCoordinate[3]; -} - -//---------------------------------------------------------------------------- -inline Vector4::Vector4(const Vector4& rkVector) { - x = rkVector.x; - y = rkVector.y; - z = rkVector.z; - w = rkVector.w; -} -//---------------------------------------------------------------------------- -inline Vector4::Vector4(const Vector3& rkVector, float fW) { - x = rkVector.x; - y = rkVector.y; - z = rkVector.z; - w = fW; -} - -//---------------------------------------------------------------------------- -inline float& Vector4::operator[] (int i) { - return ((float*)this)[i]; -} - -//---------------------------------------------------------------------------- -inline const float& Vector4::operator[] (int i) const { - return ((float*)this)[i]; -} - -//---------------------------------------------------------------------------- -inline Vector4::operator float* () { - return (float*)this; -} - -inline Vector4::operator const float* () const { - return (float*)this; -} - -//---------------------------------------------------------------------------- -inline Vector4& Vector4::operator= (const Vector4& rkVector) { - x = rkVector.x; - y = rkVector.y; - z = rkVector.z; - w = rkVector.w; - return *this; -} - -//---------------------------------------------------------------------------- -inline bool Vector4::operator== (const Vector4& rkVector) const { - return ( (x == rkVector.x) && (y == rkVector.y) && (z == rkVector.z) && (w == rkVector.w)); -} - -//---------------------------------------------------------------------------- -inline bool Vector4::operator!= (const Vector4& rkVector) const { - return ( x != rkVector.x || y != rkVector.y || z != rkVector.z || w != rkVector.w); -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::operator+ (const Vector4& rkVector) const { - return Vector4(x + rkVector.x, y + rkVector.y, z + rkVector.z, w + rkVector.w); -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::operator- (const Vector4& rkVector) const { - return Vector4(x - rkVector.x, y - rkVector.y, z - rkVector.z, w - rkVector.w); -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::operator* (float fScalar) const { - return Vector4(fScalar*x, fScalar*y, fScalar*z, fScalar*w); -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::operator- () const { - return Vector4( -x, -y, -z, -w); -} - -//---------------------------------------------------------------------------- -inline Vector4& Vector4::operator+= (const Vector4& rkVector) { - x += rkVector.x; - y += rkVector.y; - z += rkVector.z; - w += rkVector.w; - return *this; -} - -//---------------------------------------------------------------------------- -inline Vector4& Vector4::operator-= (const Vector4& rkVector) { - x -= rkVector.x; - y -= rkVector.y; - z -= rkVector.z; - w -= rkVector.w; - return *this; -} - -//---------------------------------------------------------------------------- - -inline Vector4 Vector4::lerp(const Vector4& v, float alpha) const { - return (*this) + (v - *this) * alpha; -} - -//---------------------------------------------------------------------------- -inline Vector4& Vector4::operator*= (float fScalar) { - x *= fScalar; - y *= fScalar; - z *= fScalar; - w *= fScalar; - return *this; -} - -//---------------------------------------------------------------------------- -inline float Vector4::dot(const Vector4& rkVector) const { - return x*rkVector.x + y*rkVector.y + z*rkVector.z + w*rkVector.w; -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::min(const Vector4 &v) const { - return Vector4(G3D::min(v.x, x), G3D::min(v.y, y), G3D::min(v.z, z), G3D::min(v.w, w)); -} - -//---------------------------------------------------------------------------- -inline Vector4 Vector4::max(const Vector4 &v) const { - return Vector4(G3D::max(v.x, x), G3D::max(v.y, y), G3D::max(v.z, z), G3D::max(v.w, w)); -} - -//---------------------------------------------------------------------------- -inline bool Vector4::isZero() const { - return (x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (w == 0.0f); -} - -//---------------------------------------------------------------------------- - -inline bool Vector4::isFinite() const { - return G3D::isFinite(x) && G3D::isFinite(y) && G3D::isFinite(z) && G3D::isFinite(w); -} - -//---------------------------------------------------------------------------- - -inline bool Vector4::isUnit() const { - return squaredLength() == 1.0; -} - -//---------------------------------------------------------------------------- - -inline float Vector4::length() const { - return sqrtf(squaredLength()); -} - -//---------------------------------------------------------------------------- - -inline float Vector4::squaredLength() const { - return x * x + y * y + z * z + w * w; -} - -} - diff --git a/dep/g3dlite/include/G3D/g3dmath.inl b/dep/g3dlite/include/G3D/g3dmath.inl deleted file mode 100644 index 9bf661a7ebc..00000000000 --- a/dep/g3dlite/include/G3D/g3dmath.inl +++ /dev/null @@ -1,288 +0,0 @@ -/** - @file g3dmath.inl - - @maintainer Morgan McGuire, matrix@graphics3d.com - - @created 2001-06-02 - @edited 2006-01-14 - */ - -#include <stdlib.h> - -#ifdef _MSC_VER -// Disable conditional expression is constant, which occurs incorrectly on inlined functions -# pragma warning (push) -# pragma warning( disable : 4127 ) -#endif - -namespace G3D { - -inline bool isNaN(double x) { - bool b1 = (x < 0.0); - bool b2 = (x >= 0.0); - bool b3 = !(b1 || b2); - return b3; -} - -inline bool isFinite(double x) { - return ! isNaN(x) && (x < G3D::inf()) && (x > -G3D::inf()); -} - -//---------------------------------------------------------------------------- -inline int iAbs (int iValue) { - return ( iValue >= 0 ? iValue : -iValue ); -} - -//---------------------------------------------------------------------------- -inline int iCeil (double fValue) { - return int(::ceil(fValue)); -} - -//---------------------------------------------------------------------------- - -inline int iClamp(int val, int low, int hi) { - debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } -} - -//---------------------------------------------------------------------------- - -inline double clamp(double val, double low, double hi) { - debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } -} - -inline float clamp(float val, float low, float hi) { - debugAssert(low <= hi); - if (val <= low) { - return low; - } else if (val >= hi) { - return hi; - } else { - return val; - } -} -//---------------------------------------------------------------------------- - -inline int iWrap(int val, int hi) { - if (val < 0) { - return ((val % hi) + hi) % hi; - } else { - return val % hi; - } -} - -//---------------------------------------------------------------------------- -inline int iFloor (double fValue) { - return int(::floor(fValue)); -} - -//---------------------------------------------------------------------------- -inline int iSign (int iValue) { - return ( iValue > 0 ? + 1 : ( iValue < 0 ? -1 : 0 ) ); -} - -inline int iSign (double fValue) { - return ( fValue > 0.0 ? + 1 : ( fValue < 0.0 ? -1 : 0 ) ); -} - -//---------------------------------------------------------------------------- -inline double abs (double fValue) { - return double(::fabs(fValue)); -} - -//---------------------------------------------------------------------------- -inline double aCos (double fValue) { - if ( -1.0 < fValue ) { - if ( fValue < 1.0 ) - return double(::acos(fValue)); - else - return 0.0; - } else { - return G3D_PI; - } -} - -//---------------------------------------------------------------------------- -inline double aSin (double fValue) { - if ( -1.0 < fValue ) { - if ( fValue < 1.0 ) { - return double(::asin(fValue)); - } else { - return -G3D_HALF_PI; - } - } else { - return G3D_HALF_PI; - } -} - -//---------------------------------------------------------------------------- -inline double aTan (double fValue) { - return double(::atan(fValue)); -} - -//---------------------------------------------------------------------------- -inline double aTan2 (double fY, double fX) { - return double(::atan2(fY, fX)); -} - -//---------------------------------------------------------------------------- -inline double sign (double fValue) { - if (fValue > 0.0) { - return 1.0; - } - - if (fValue < 0.0) { - return -1.0; - } - - return 0.0; -} - -inline double G3D_DEPRECATED unitRandom () { - return double(::rand()) / double(RAND_MAX); -} - -inline float uniformRandom(float low, float hi) { - return (hi - low) * float(::rand()) / float(RAND_MAX) + low; -} - -//---------------------------------------------------------------------------- -inline double G3D_DEPRECATED symmetricRandom () { - return 2.0 * double(::rand()) / double(RAND_MAX) - 1.0; -} - -//---------------------------------------------------------------------------- -inline double square(double x) { - return x * x; -} - -//---------------------------------------------------------------------------- -inline double sumSquares(double x, double y) { - return x*x + y*y; -} - -//---------------------------------------------------------------------------- -inline double sumSquares(double x, double y, double z) { - return x*x + y*y + z*z; -} - -//---------------------------------------------------------------------------- -inline double distance(double x, double y) { - return sqrt(sumSquares(x, y)); -} - -//---------------------------------------------------------------------------- -inline double distance(double x, double y, double z) { - return sqrt(sumSquares(x, y, z)); -} - -//---------------------------------------------------------------------------- - -/** @deprecated use G3D::min */ -inline int iMin(int x, int y) { - return (x >= y) ? y : x; -} - -//---------------------------------------------------------------------------- -/** @deprecated use G3D::min */ -inline int iMax(int x, int y) { - return (x >= y) ? x : y; -} - -//---------------------------------------------------------------------------- -inline int ceilPow2(unsigned int in) { - in -= 1; - - in |= in >> 16; - in |= in >> 8; - in |= in >> 4; - in |= in >> 2; - in |= in >> 1; - - return in + 1; -} - -inline bool isPow2(int num) { - return ((num & -num) == num); -} - -inline bool isOdd(int num) { - return (num & 1) == 1; -} - -inline bool isEven(int num) { - return (num & 1) == 0; -} - -inline double toRadians(double deg) { - return deg * G3D_PI / 180.0; -} - -inline double toDegrees(double rad) { - return rad * 180.0 / G3D_PI; -} - -/** - Computes an appropriate epsilon for comparing a and b. - */ -inline double eps(double a, double b) { - // For a and b to be nearly equal, they must have nearly - // the same magnitude. This means that we can ignore b - // since it either has the same magnitude or the comparison - // will fail anyway. - (void)b; - const double aa = abs(a) + 1; - if (aa == inf()) { - return fuzzyEpsilon; - } else { - return fuzzyEpsilon * aa; - } -} - -inline bool fuzzyEq(double a, double b) { - return (a == b) || (abs(a - b) <= eps(a, b)); -} - -inline bool fuzzyNe(double a, double b) { - return ! fuzzyEq(a, b); -} - -inline bool fuzzyGt(double a, double b) { - return a > b + eps(a, b); -} - -inline bool fuzzyGe(double a, double b) { - return a > b - eps(a, b); -} - -inline bool fuzzyLt(double a, double b) { - return a < b - eps(a, b); -} - -inline bool fuzzyLe(double a, double b) { - return a < b + eps(a, b); -} - -inline int iMod3(int x) { - return x % 3; -} - -} // namespace G3D - -#ifdef _MSC_VER -// Disable conditional expression is constant, which occurs incorrectly on inlined functions -# pragma warning (pop) -#endif diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h index d399135101b..c8d2f0b6534 100644 --- a/dep/g3dlite/include/G3D/platform.h +++ b/dep/g3dlite/include/G3D/platform.h @@ -6,7 +6,7 @@ @maintainer Morgan McGuire, http://graphics.cs.williams.edu @created 2003-06-09 - @edited 2010-01-11 + @edited 2010-08-11 */ #ifndef G3D_platform_h @@ -16,7 +16,7 @@ The version number of G3D in the form: MmmBB -> version M.mm [beta BB] */ -#define G3D_VER 80000 +#define G3D_VER 80100 // fatal error for unsupported architectures #if defined(__powerpc__) diff --git a/dep/g3dlite/source/AABox.cpp b/dep/g3dlite/source/AABox.cpp index 035497aa3c4..8e66456c013 100644 --- a/dep/g3dlite/source/AABox.cpp +++ b/dep/g3dlite/source/AABox.cpp @@ -282,6 +282,10 @@ bool AABox::culledBy( return false; } +void AABox::getBounds(Sphere& s) const { + s.center = center(); + s.radius = extent().length() / 2; +} bool AABox::intersects(const class Sphere& sphere) const { double d = 0; diff --git a/dep/g3dlite/source/Log.cpp b/dep/g3dlite/source/Log.cpp index d44d88d0242..f437351cfbd 100644 --- a/dep/g3dlite/source/Log.cpp +++ b/dep/g3dlite/source/Log.cpp @@ -23,23 +23,23 @@ namespace G3D { void logPrintf(const char* fmt, ...) { - va_list arg_list; - va_start(arg_list, fmt); + va_list arg_list; + va_start(arg_list, fmt); Log::common()->vprintf(fmt, arg_list); va_end(arg_list); } void logLazyPrintf(const char* fmt, ...) { - va_list arg_list; - va_start(arg_list, fmt); + va_list arg_list; + va_start(arg_list, fmt); Log::common()->lazyvprintf(fmt, arg_list); va_end(arg_list); } Log* Log::commonLog = NULL; -Log::Log(const std::string& filename, int stripFromStackBottom) : +Log::Log(const std::string& filename, int stripFromStackBottom) : stripFromStackBottom(stripFromStackBottom) { this->filename = filename; @@ -50,7 +50,7 @@ Log::Log(const std::string& filename, int stripFromStackBottom) : std::string drive, base, ext; Array<std::string> path; parseFilename(filename, drive, path, base, ext); - std::string logName = base + ((ext != "") ? ("." + ext) : ""); + std::string logName = base + ((ext != "") ? ("." + ext) : ""); // Write time is greater than 1ms. This may be a network drive.... try another file. #ifdef G3D_WIN32 @@ -80,7 +80,7 @@ Log::Log(const std::string& filename, int stripFromStackBottom) : Log::~Log() { section("Shutdown"); println("Closing log file"); - + // Make sure we don't leave a dangling pointer if (Log::commonLog == this) { Log::commonLog = NULL; diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp index 5170ba44941..809f05c0ab4 100644 --- a/dep/g3dlite/source/System.cpp +++ b/dep/g3dlite/source/System.cpp @@ -920,9 +920,12 @@ RealTime System::time() { //////////////////////////////////////////////////////////////// -#define REALPTR_TO_USERPTR(x) ((uint8*)(x) + sizeof (void *)) -#define USERPTR_TO_REALPTR(x) ((uint8*)(x) - sizeof (void *)) -#define REALBLOCK_SIZE(x) ((x) + sizeof (void *)) + +#define REALPTR_TO_USERPTR(x) ((uint8*)(x) + sizeof(uint32)) +#define USERPTR_TO_REALPTR(x) ((uint8*)(x) - sizeof(uint32)) +#define USERSIZE_TO_REALSIZE(x) ((x) + sizeof(uint32)) +#define REALSIZE_FROM_USERPTR(u) (*(uint32*)USERPTR_TO_REALPTR(ptr) + sizeof(uint32)) +#define USERSIZE_FROM_USERPTR(u) (*(uint32*)USERPTR_TO_REALPTR(ptr)) class BufferPool { public: @@ -947,13 +950,19 @@ public: private: + /** Pointer given to the program. Unless in the tiny heap, the user size of the block is stored right in front of the pointer as a uint32.*/ + typedef void* UserPtr; + + /** Actual block allocated on the heap */ + typedef void* RealPtr; + class MemBlock { public: - void* ptr; - size_t bytes; + UserPtr ptr; + size_t bytes; inline MemBlock() : ptr(NULL), bytes(0) {} - inline MemBlock(void* p, size_t b) : ptr(p), bytes(b) {} + inline MemBlock(UserPtr p, size_t b) : ptr(p), bytes(b) {} }; MemBlock smallPool[maxSmallBuffers]; @@ -1010,13 +1019,13 @@ private: /** Malloc out of the tiny heap. Returns NULL if allocation failed. */ - inline void* tinyMalloc(size_t bytes) { + inline UserPtr tinyMalloc(size_t bytes) { // Note that we ignore the actual byte size // and create a constant size block. (void)bytes; assert(tinyBufferSize >= bytes); - void* ptr = NULL; + UserPtr ptr = NULL; if (tinyPoolSize > 0) { --tinyPoolSize; @@ -1040,20 +1049,20 @@ private: } /** Returns true if this is a pointer into the tiny heap. */ - bool inTinyHeap(void* ptr) { + bool inTinyHeap(UserPtr ptr) { return (ptr >= tinyHeap) && (ptr < (uint8*)tinyHeap + maxTinyBuffers * tinyBufferSize); } - void tinyFree(void* ptr) { + void tinyFree(UserPtr ptr) { assert(ptr); assert(tinyPoolSize < maxTinyBuffers); // "Tried to free a tiny pool buffer when the tiny pool freelist is full."); # ifdef G3D_DEBUG if (tinyPoolSize > 0) { - void* prevOnHeap = tinyPool[tinyPoolSize - 1]; + UserPtr prevOnHeap = tinyPool[tinyPoolSize - 1]; assert(prevOnHeap != ptr); // "System::malloc heap corruption detected: " // "the last two pointers on the freelist are identical (during tinyFree)."); @@ -1070,7 +1079,8 @@ private: void flushPool(MemBlock* pool, int& poolSize) { for (int i = 0; i < poolSize; ++i) { - ::free(pool[i].ptr); + bytesAllocated -= USERSIZE_TO_REALSIZE(pool[i].bytes); + ::free(USERPTR_TO_REALPTR(pool[i].ptr)); pool[i].ptr = NULL; pool[i].bytes = 0; } @@ -1078,24 +1088,23 @@ private: } - /** Allocate out of a specific pool-> Return NULL if no suitable - memory was found. - - */ - void* malloc(MemBlock* pool, int& poolSize, size_t bytes) { + /** Allocate out of a specific pool. Return NULL if no suitable + memory was found. */ + UserPtr malloc(MemBlock* pool, int& poolSize, size_t bytes) { // OPT: find the smallest block that satisfies the request. - // See if there's something we can use in the buffer pool-> + // See if there's something we can use in the buffer pool. // Search backwards since usually we'll re-use the last one. for (int i = (int)poolSize - 1; i >= 0; --i) { if (pool[i].bytes >= bytes) { - // We found a suitable entry in the pool-> + // We found a suitable entry in the pool. // No need to offset the pointer; it is already offset - void* ptr = pool[i].ptr; + UserPtr ptr = pool[i].ptr; - // Remove this element from the pool + // Remove this element from the pool, replacing it with + // the one from the end (same as Array::fastRemove) --poolSize; pool[i] = pool[poolSize]; @@ -1159,6 +1168,8 @@ public: ~BufferPool() { ::free(tinyHeap); + flushPool(smallPool, smallPoolSize); + flushPool(medPool, medPoolSize); #if 0 //-------------------------------- old mutex # ifdef G3D_WIN32 DeleteCriticalSection(&mutex); @@ -1169,7 +1180,7 @@ public: } - void* realloc(void* ptr, size_t bytes) { + UserPtr realloc(UserPtr ptr, size_t bytes) { if (ptr == NULL) { return malloc(bytes); } @@ -1181,7 +1192,7 @@ public: } else { // Free the old pointer and malloc - void* newPtr = malloc(bytes); + UserPtr newPtr = malloc(bytes); System::memcpy(newPtr, ptr, tinyBufferSize); tinyFree(ptr); return newPtr; @@ -1191,28 +1202,28 @@ public: // In one of our heaps. // See how big the block really was - size_t realSize = *(uint32*)USERPTR_TO_REALPTR(ptr); - if (bytes <= realSize) { + size_t userSize = USERSIZE_FROM_USERPTR(ptr); + if (bytes <= userSize) { // The old block was big enough. return ptr; } - // Need to reallocate - void* newPtr = malloc(bytes); - System::memcpy(newPtr, ptr, realSize); + // Need to reallocate and move + UserPtr newPtr = malloc(bytes); + System::memcpy(newPtr, ptr, userSize); free(ptr); return newPtr; } } - void* malloc(size_t bytes) { + UserPtr malloc(size_t bytes) { lock(); ++totalMallocs; if (bytes <= tinyBufferSize) { - void* ptr = tinyMalloc(bytes); + UserPtr ptr = tinyMalloc(bytes); if (ptr) { ++mallocsFromTinyPool; @@ -1226,7 +1237,7 @@ public: // through to a small buffer if (bytes <= smallBufferSize) { - void* ptr = malloc(smallPool, smallPoolSize, bytes); + UserPtr ptr = malloc(smallPool, smallPoolSize, bytes); if (ptr) { ++mallocsFromSmallPool; @@ -1239,7 +1250,7 @@ public: // through into a medium allocation because that would // waste the medium buffer's resources. - void* ptr = malloc(medPool, medPoolSize, bytes); + UserPtr ptr = malloc(medPool, medPoolSize, bytes); if (ptr) { ++mallocsFromMedPool; @@ -1249,37 +1260,37 @@ public: } } - bytesAllocated += REALBLOCK_SIZE(bytes); + bytesAllocated += USERSIZE_TO_REALSIZE(bytes); unlock(); // Heap allocate // Allocate 4 extra bytes for our size header (unfortunate, // since malloc already added its own header). - void* ptr = ::malloc(REALBLOCK_SIZE(bytes)); + RealPtr ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes)); if (ptr == NULL) { // Flush memory pools to try and recover space flushPool(smallPool, smallPoolSize); flushPool(medPool, medPoolSize); - ptr = ::malloc(REALBLOCK_SIZE(bytes)); + ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes)); } if (ptr == NULL) { if ((System::outOfMemoryCallback() != NULL) && - (System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), true) == true)) { + (System::outOfMemoryCallback()(USERSIZE_TO_REALSIZE(bytes), true) == true)) { // Re-attempt the malloc - ptr = ::malloc(REALBLOCK_SIZE(bytes)); + ptr = ::malloc(USERSIZE_TO_REALSIZE(bytes)); } } if (ptr == NULL) { if (System::outOfMemoryCallback() != NULL) { // Notify the application - System::outOfMemoryCallback()(REALBLOCK_SIZE(bytes), false); + System::outOfMemoryCallback()(USERSIZE_TO_REALSIZE(bytes), false); } # ifdef G3D_DEBUG - debugPrintf("::malloc(%d) returned NULL\n", (int)REALBLOCK_SIZE(bytes)); + debugPrintf("::malloc(%d) returned NULL\n", (int)USERSIZE_TO_REALSIZE(bytes)); # endif debugAssertM(ptr != NULL, "::malloc returned NULL. Either the " @@ -1294,7 +1305,7 @@ public: } - void free(void* ptr) { + void free(UserPtr ptr) { if (ptr == NULL) { // Free does nothing on null pointers return; @@ -1309,7 +1320,7 @@ public: return; } - uint32 bytes = *(uint32*)USERPTR_TO_REALPTR(ptr); + uint32 bytes = USERSIZE_FROM_USERPTR(ptr); lock(); if (bytes <= smallBufferSize) { @@ -1327,7 +1338,7 @@ public: return; } } - bytesAllocated -= REALBLOCK_SIZE(bytes); + bytesAllocated -= USERSIZE_TO_REALSIZE(bytes); unlock(); // Free; the buffer pools are full or this is too big to store. diff --git a/dep/g3dlite/source/TextInput.cpp b/dep/g3dlite/source/TextInput.cpp index 09abacc7391..354d0de13c0 100644 --- a/dep/g3dlite/source/TextInput.cpp +++ b/dep/g3dlite/source/TextInput.cpp @@ -128,32 +128,34 @@ Token TextInput::read() { } -std::string TextInput::readUntilNewlineAsString() { - // Go to the front of the next token - Token t = read(); - // Reset the position to the start of this token +std::string TextInput::readUntilNewlineAsString() { +/* + // Reset the read position back to the start of that token currentCharOffset = t.bytePosition(); + lineNumber = t.line(); + charNumber = t.character(); stack.clear(); if (currentCharOffset == buffer.size()) { // End of file return ""; } - + */ std::string s; // Read until newline or eof char c = '\0'; do { - c = buffer[currentCharOffset]; - if (c == '\r' || c == '\n') { - // Done - break; - } else { - s += c; - ++currentCharOffset; - } + c = buffer[currentCharOffset]; + if (c == '\r' || c == '\n') { + // Done + break; + } else { + s += c; + ++currentCharOffset; + ++charNumber; + } } while (currentCharOffset < buffer.size()); return s; diff --git a/dep/gsoap/gsoap.stub b/dep/gsoap/gsoap.stub new file mode 100644 index 00000000000..be215b46655 --- /dev/null +++ b/dep/gsoap/gsoap.stub @@ -0,0 +1 @@ +int ns1__executeCommand(char* command, char** result); diff --git a/dep/gsoap/soapC.cpp b/dep/gsoap/soapC.cpp index 7fefc27f5d1..2c675cc339d 100644 --- a/dep/gsoap/soapC.cpp +++ b/dep/gsoap/soapC.cpp @@ -1,8 +1,11 @@ /* soapC.cpp - Generated by gSOAP 2.8.2 from stub.h - Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved. - The generated code is released under one of the following licenses: - GPL OR Genivia's license for commercial use. + Generated by gSOAP 2.8.10 from gsoap.stub + +Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved. +The generated code is released under one of the following licenses: +1) GPL or 2) Genivia's license for commercial use. +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. */ #if defined(__BORLANDC__) @@ -12,15 +15,17 @@ #include "soapH.h" -SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.8.2 2011-04-26 21:49:07 GMT") +SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.8.10 2012-09-02 20:48:00 GMT") #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) { - if (soap->header) - soap_serialize_SOAP_ENV__Header(soap, soap->header); + soap->part = SOAP_IN_HEADER; + soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", soap->header, NULL); + soap->part = SOAP_END_HEADER; + return soap->header == NULL; } SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) @@ -34,12 +39,10 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) return SOAP_OK; } -SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) +SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) { - soap->part = SOAP_IN_HEADER; - soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL); - soap->part = SOAP_END_HEADER; - return soap->header == NULL; + if (soap->header) + soap_serialize_SOAP_ENV__Header(soap, soap->header); } SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) @@ -90,7 +93,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) { soap_fault(soap); - if (soap->version == 2) + if (soap->version == 2 && soap->fault->SOAP_ENV__Code) return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Value; return (const char**)&soap->fault->faultcode; } @@ -108,6 +111,17 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) return (const char**)&soap->fault->faultcode; } +SOAP_FMAC3 const char * SOAP_FMAC4 soap_check_faultsubcode(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 2) + { if (soap->fault->SOAP_ENV__Code && soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode && soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) + return soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value; + return NULL; + } + return soap->fault->faultcode; +} + SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) { soap_fault(soap); @@ -133,6 +147,16 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap) return (const char**)&soap->fault->SOAP_ENV__Detail->__any; } +SOAP_FMAC3 const char * SOAP_FMAC4 soap_check_faultdetail(struct soap *soap) +{ + soap_fault(soap); + if (soap->version == 2 && soap->fault->SOAP_ENV__Detail) + return soap->fault->SOAP_ENV__Detail->__any; + if (soap->fault->detail) + return soap->fault->detail->__any; + return NULL; +} + #endif #ifndef WITH_NOIDREF @@ -158,7 +182,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap) extern "C" { #endif SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) -{ +{ (void)type; if (soap_peek_element(soap)) return NULL; if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) @@ -280,7 +304,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap) extern "C" { #endif SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, const char *tag, int id, int type) -{ +{ (void)tag; switch (type) { case SOAP_TYPE_byte: @@ -340,7 +364,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *ptr, #endif SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap *soap, int t, const char *type, const char *arrayType, size_t *n) -{ +{ (void)type; switch (t) { case SOAP_TYPE_ns1__executeCommandResponse: @@ -446,7 +470,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) } SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap *soap, const char *tag, int id, const char *a, const char *type) -{ +{ (void)soap; (void)type; (void)tag; (void)id; return soap_outbyte(soap, tag, id, a, type, SOAP_TYPE_byte); } @@ -483,7 +507,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) } SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap *soap, const char *tag, int id, const int *a, const char *type) -{ +{ (void)soap; (void)type; (void)tag; (void)id; return soap_outint(soap, tag, id, a, type, SOAP_TYPE_int); } @@ -542,13 +566,14 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, con SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Fault *a, const char *type) { const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type)) return soap->error; if (soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, "")) return soap->error; - if (soap_out_string(soap, "faultstring", -1, &a->faultstring, "xsd:string")) + if (soap_out_string(soap, "faultstring", -1, &a->faultstring, "")) return soap->error; - if (soap_out_string(soap, "faultactor", -1, &a->faultactor, "xsd:string")) + if (soap_out_string(soap, "faultactor", -1, &a->faultactor, "")) return soap->error; if (soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, "")) return soap->error; @@ -692,7 +717,7 @@ SOAP_FMAC1 struct SOAP_ENV__Fault * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Fault( SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Fault %p -> %p\n", q, p)); *(struct SOAP_ENV__Fault*)p = *(struct SOAP_ENV__Fault*)q; } @@ -715,6 +740,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type) { + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type)) return soap->error; if (soap->lang) @@ -803,7 +829,7 @@ SOAP_FMAC1 struct SOAP_ENV__Reason * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Reaso SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Reason %p -> %p\n", q, p)); *(struct SOAP_ENV__Reason*)p = *(struct SOAP_ENV__Reason*)q; } @@ -828,6 +854,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) { + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type)) return soap->error; soap_outliteral(soap, "-any", &a->__any, NULL); @@ -921,7 +948,7 @@ SOAP_FMAC1 struct SOAP_ENV__Detail * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Detai SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Detail %p -> %p\n", q, p)); *(struct SOAP_ENV__Detail*)p = *(struct SOAP_ENV__Detail*)q; } @@ -947,6 +974,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, cons SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) { const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type)) return soap->error; if (soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, "")) @@ -1041,7 +1069,7 @@ SOAP_FMAC1 struct SOAP_ENV__Code * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Code(st SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Code %p -> %p\n", q, p)); *(struct SOAP_ENV__Code*)p = *(struct SOAP_ENV__Code*)q; } @@ -1062,6 +1090,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, co SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) { + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type)) return soap->error; return soap_element_end_out(soap, tag); @@ -1140,7 +1169,7 @@ SOAP_FMAC1 struct SOAP_ENV__Header * SOAP_FMAC2 soap_instantiate_SOAP_ENV__Heade SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Header %p -> %p\n", q, p)); *(struct SOAP_ENV__Header*)p = *(struct SOAP_ENV__Header*)q; } @@ -1161,9 +1190,10 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap *soap, SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap *soap, const char *tag, int id, const struct ns1__executeCommand *a, const char *type) { + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommand), type)) return soap->error; - if (soap_out_string(soap, "command", -1, &a->command, "xsd:string")) + if (soap_out_string(soap, "command", -1, &a->command, "")) return soap->error; return soap_element_end_out(soap, tag); } @@ -1247,7 +1277,7 @@ SOAP_FMAC1 struct ns1__executeCommand * SOAP_FMAC2 soap_instantiate_ns1__execute SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommand %p -> %p\n", q, p)); *(struct ns1__executeCommand*)p = *(struct ns1__executeCommand*)q; } @@ -1266,9 +1296,10 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soa SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap *soap, const char *tag, int id, const struct ns1__executeCommandResponse *a, const char *type) { + (void)soap; (void)tag; (void)id; (void)type; if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommandResponse), type)) return soap->error; - if (soap_out_PointerTostring(soap, "result", -1, &a->result, "xsd:string")) + if (soap_out_PointerTostring(soap, "result", -1, &a->result, "")) return soap->error; return soap_element_end_out(soap, tag); } @@ -1352,7 +1383,7 @@ SOAP_FMAC1 struct ns1__executeCommandResponse * SOAP_FMAC2 soap_instantiate_ns1_ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { - (void)soap; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ + (void)soap; (void)tt; (void)st; (void)len; (void)n; /* appease -Wall -Werror */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommandResponse %p -> %p\n", q, p)); *(struct ns1__executeCommandResponse*)p = *(struct ns1__executeCommandResponse*)q; } @@ -1383,6 +1414,8 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reas *a = NULL; if (!soap->null && *soap->href != '#') { soap_revert(soap); + *a = (struct SOAP_ENV__Reason *)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason)); + soap_default_SOAP_ENV__Reason(soap, *a); if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) return NULL; } @@ -1438,6 +1471,8 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Deta *a = NULL; if (!soap->null && *soap->href != '#') { soap_revert(soap); + *a = (struct SOAP_ENV__Detail *)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); + soap_default_SOAP_ENV__Detail(soap, *a); if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type))) return NULL; } @@ -1493,6 +1528,8 @@ SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(s *a = NULL; if (!soap->null && *soap->href != '#') { soap_revert(soap); + *a = (struct SOAP_ENV__Code *)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); + soap_default_SOAP_ENV__Code(soap, *a); if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type))) return NULL; } diff --git a/dep/gsoap/soapH.h b/dep/gsoap/soapH.h index e51d3defaaf..06e9ec21239 100644 --- a/dep/gsoap/soapH.h +++ b/dep/gsoap/soapH.h @@ -1,8 +1,11 @@ /* soapH.h - Generated by gSOAP 2.8.2 from stub.h - Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved. - The generated code is released under one of the following licenses: - GPL OR Genivia's license for commercial use. + Generated by gSOAP 2.8.10 from gsoap.stub + +Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved. +The generated code is released under one of the following licenses: +1) GPL or 2) Genivia's license for commercial use. +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. */ #ifndef soapH_H diff --git a/dep/gsoap/soapServer.cpp b/dep/gsoap/soapServer.cpp index 8c8206fb3ef..b6304a3e525 100644 --- a/dep/gsoap/soapServer.cpp +++ b/dep/gsoap/soapServer.cpp @@ -1,8 +1,11 @@ /* soapServer.cpp - Generated by gSOAP 2.8.2 from stub.h - Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved. - The generated code is released under one of the following licenses: - GPL OR Genivia's license for commercial use. + Generated by gSOAP 2.8.10 from gsoap.stub + +Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved. +The generated code is released under one of the following licenses: +1) GPL or 2) Genivia's license for commercial use. +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. */ #if defined(__BORLANDC__) @@ -11,7 +14,7 @@ #endif #include "soapH.h" -SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.8.2 2011-04-26 21:49:07 GMT") +SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.8.10 2012-09-02 20:48:00 GMT") SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) @@ -67,6 +70,7 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap) soap_tmp_string = NULL; soap_tmp_ns1__executeCommandResponse.result = &soap_tmp_string; soap_default_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand); + soap->encodingStyle = NULL; if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", NULL)) return soap->error; if (soap_body_end_in(soap) diff --git a/dep/gsoap/soapStub.h b/dep/gsoap/soapStub.h index 85f3119b9ff..fbdd170e0f4 100644 --- a/dep/gsoap/soapStub.h +++ b/dep/gsoap/soapStub.h @@ -1,13 +1,20 @@ /* soapStub.h - Generated by gSOAP 2.8.2 from stub.h - Copyright(C) 2000-2011, Robert van Engelen, Genivia Inc. All Rights Reserved. - The generated code is released under one of the following licenses: - GPL OR Genivia's license for commercial use. + Generated by gSOAP 2.8.10 from gsoap.stub + +Copyright(C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved. +The generated code is released under one of the following licenses: +1) GPL or 2) Genivia's license for commercial use. +This program is released under the GPL with the additional exemption that +compiling, linking, and/or using OpenSSL is allowed. */ #ifndef soapStub_H #define soapStub_H #include "stdsoap2.h" +#if GSOAP_VERSION != 20810 +# error "GSOAP VERSION MISMATCH IN GENERATED CODE: PLEASE REINSTALL PACKAGE" +#endif + /******************************************************************************\ * * diff --git a/dep/gsoap/stdsoap2.cpp b/dep/gsoap/stdsoap2.cpp index ed0922d86f2..36a8901dcab 100644 --- a/dep/gsoap/stdsoap2.cpp +++ b/dep/gsoap/stdsoap2.cpp @@ -1,17 +1,17 @@ /* - stdsoap2.c[pp] 2.8.2 + stdsoap2.c[pp] 2.8.10 gSOAP runtime engine gSOAP XML Web services tools -Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved. This part of the software is released under ONE of the following licenses: GPL, or the gSOAP public license, or Genivia's license for commercial use. -------------------------------------------------------------------------------- Contributors: Wind River Systems Inc., for the following additions under gSOAP public license: - - vxWorks compatible + - vxWorks compatible options -------------------------------------------------------------------------------- gSOAP public license. @@ -24,7 +24,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Robert A. van Engelen. -Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved. -------------------------------------------------------------------------------- GPL license. @@ -49,25 +49,18 @@ compiling, linking, and/or using OpenSSL is allowed. -------------------------------------------------------------------------------- A commercial use license is available from Genivia, Inc., contact@genivia.com -------------------------------------------------------------------------------- - -Installation note: - -Win32 build needs "ws2_32.lib" -To do this in Visual C++ 6.0, go to "Project", "settings", select the "Link" -tab (the project file needs to be selected in the file view) and add -"ws2_32.lib" to the "Object/library modules" entry - -On Mac OS X with gcc (GCC) 3.1 20020420 (prerelease) you MUST compile with --fstack_check when using -O2 because gcc 3.1 has a bug that smashes the stack -when locally allocated data exceeds 64K. - */ +#define GSOAP_LIB_VERSION 20810 + #ifdef AS400 # pragma convert(819) /* EBCDIC to ASCII */ #endif #include "stdsoap2.h" +#if GSOAP_VERSION != GSOAP_LIB_VERSION +# error "GSOAP VERSION MISMATCH IN LIBRARY: PLEASE REINSTALL PACKAGE" +#endif #ifdef __BORLANDC__ # pragma warn -8060 @@ -83,10 +76,10 @@ when locally allocated data exceeds 64K. #endif #ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.8.2 2011-04-17 00:00:00 GMT") +SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.8.10 2012-08-16 00:00:00 GMT") extern "C" { #else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.2 2011-04-17 00:00:00 GMT") +SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.10 2012-08-16 00:00:00 GMT") #endif /* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */ @@ -101,7 +94,7 @@ SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.8.2 2011-04-17 00:00:00 GMT") #define SOAP_QT (soap_wchar)(-5) /* XML-specific '"' */ #define SOAP_AP (soap_wchar)(-6) /* XML-specific ''' */ -#define soap_blank(c) ((c) >= 0 && (c) <= 32) +#define soap_blank(c) ((c)+1 > 0 && (c) <= 32) #define soap_notblank(c) ((c) > 32) #if defined(WIN32) && !defined(UNDER_CE) @@ -138,8 +131,10 @@ static int soap_isxdigit(int); static void *fplugin(struct soap*, const char*); static size_t soap_count_attachments(struct soap *soap); static int soap_try_connect_command(struct soap*, int http_command, const char *endpoint, const char *action); +#ifdef WITH_NTLM +static int soap_ntlm_handshake(struct soap *soap, int command, const char *endpoint, const char *host, int port); +#endif #ifndef WITH_NOIDREF -static void soap_update_ptrs(struct soap*, char*, char*, char*, char*); static int soap_has_copies(struct soap*, const char*, const char*); static void soap_init_iht(struct soap*); static void soap_free_iht(struct soap*); @@ -152,7 +147,7 @@ static void soap_free_pht(struct soap*); static const char *soap_set_validation_fault(struct soap*, const char*, const char*); static int soap_isnumeric(struct soap*, const char*); static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized); -static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n); +static void soap_utilize_ns(struct soap *soap, const char *tag); #endif #ifndef WITH_LEANER @@ -208,9 +203,9 @@ static const char *soap_decode(char*, size_t, const char*, const char*); #ifndef PALM_1 static soap_wchar soap_getchunkchar(struct soap*); static const char *http_error(struct soap*, int); -static int http_put(struct soap*); static int http_get(struct soap*); static int http_405(struct soap*); +static int http_200(struct soap*); static int http_post(struct soap*, const char*, const char*, int, const char*, const char*, size_t); static int http_send_header(struct soap*, const char*); static int http_post_header(struct soap*, const char*, const char*); @@ -538,6 +533,7 @@ extern int h_errno; static int fsend(struct soap *soap, const char *s, size_t n) { register int nwritten, err; + SOAP_SOCKET sk; #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) if (soap->os) { soap->os->write(s, (std::streamsize)n); @@ -547,23 +543,26 @@ fsend(struct soap *soap, const char *s, size_t n) return SOAP_EOF; } #endif + sk = soap->sendsk; + if (!soap_valid_socket(sk)) + sk = soap->socket; while (n) - { if (soap_valid_socket(soap->socket)) + { if (soap_valid_socket(sk)) { if (soap->send_timeout) { for (;;) { register int r; #ifdef WITH_OPENSSL if (soap->ssl) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ALL, soap->send_timeout); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_ALL, soap->send_timeout); else #endif #ifdef WITH_GNUTLS if (soap->session) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ALL, soap->send_timeout); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_ALL, soap->send_timeout); else #endif - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout); if (r > 0) break; if (!r) @@ -590,25 +589,25 @@ fsend(struct soap *soap, const char *s, size_t n) #ifndef WITH_LEAN if ((soap->omode & SOAP_IO_UDP)) { if (soap->peerlen) - nwritten = sendto(soap->socket, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); + nwritten = sendto(sk, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); else - nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); + nwritten = send(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags); /* retry and back-off algorithm */ /* TODO: this is not very clear from specs so verify and limit conditions under which we should loop (e.g. ENOBUFS) */ if (nwritten < 0) { int udp_repeat; int udp_delay; if ((soap->connect_flags & SO_BROADCAST)) - udp_repeat = 3; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */ + udp_repeat = 2; /* SOAP-over-UDP MULTICAST_UDP_REPEAT - 1 */ else udp_repeat = 1; /* SOAP-over-UDP UNICAST_UDP_REPEAT - 1 */ udp_delay = ((unsigned int)soap_random % 201) + 50; /* UDP_MIN_DELAY .. UDP_MAX_DELAY */ do - { tcp_select(soap, soap->socket, SOAP_TCP_SELECT_ERR, -1000 * udp_delay); + { tcp_select(soap, sk, SOAP_TCP_SELECT_ERR, -1000 * udp_delay); if (soap->peerlen) - nwritten = sendto(soap->socket, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); + nwritten = sendto(sk, (char*)s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, (SOAP_WINSOCKINT)soap->peerlen); else - nwritten = send(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags); + nwritten = send(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags); udp_delay <<= 1; if (udp_delay > 500) /* UDP_UPPER_DELAY */ udp_delay = 500; @@ -619,14 +618,14 @@ fsend(struct soap *soap, const char *s, size_t n) else #endif #if !defined(PALM) && !defined(AS400) - nwritten = send(soap->socket, s, (int)n, soap->socket_flags); + nwritten = send(sk, s, (int)n, soap->socket_flags); #else - nwritten = send(soap->socket, (void*)s, n, soap->socket_flags); + nwritten = send(sk, (void*)s, n, soap->socket_flags); #endif if (nwritten <= 0) { register int r = 0; - err = soap_socket_errno(soap->socket); + err = soap_socket_errno(sk); #ifdef WITH_OPENSSL if (soap->ssl && (r = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && r != SSL_ERROR_WANT_READ && r != SSL_ERROR_WANT_WRITE) { soap->errnum = err; @@ -645,14 +644,14 @@ fsend(struct soap *soap, const char *s, size_t n) { #if defined(WITH_OPENSSL) if (soap->ssl && r == SSL_ERROR_WANT_READ) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); else #elif defined(WITH_GNUTLS) if (soap->session && !gnutls_record_get_direction(soap->session)) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); else #endif - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->send_timeout ? soap->send_timeout : -10000); if (!r && soap->send_timeout) return SOAP_EOF; if (r < 0 && soap->errnum != SOAP_EINTR) @@ -775,7 +774,7 @@ soap_flush(struct soap *soap) do { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating %u bytes\n", soap->d_stream->avail_in)); if (deflate(soap->d_stream, Z_NO_FLUSH) != Z_OK) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to deflate: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS)); return soap->error = SOAP_ZLIB_ERROR; } if (!soap->d_stream->avail_out) @@ -870,6 +869,7 @@ static size_t frecv(struct soap *soap, char *s, size_t n) { register int r; register int retries = 100; /* max 100 retries with non-blocking sockets */ + SOAP_SOCKET sk; soap->errnum = 0; #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) if (soap->is) @@ -878,7 +878,10 @@ frecv(struct soap *soap, char *s, size_t n) return 0; } #endif - if (soap_valid_socket(soap->socket)) + sk = soap->recvsk; + if (!soap_valid_socket(sk)) + sk = soap->socket; + if (soap_valid_socket(sk)) { for (;;) { #ifdef WITH_OPENSSL @@ -890,7 +893,7 @@ frecv(struct soap *soap, char *s, size_t n) if (soap->recv_timeout) #endif { for (;;) - { r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout); + { r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout); if (r > 0) break; if (!r) @@ -930,7 +933,7 @@ frecv(struct soap *soap, char *s, size_t n) if ((soap->omode & SOAP_IO_UDP)) { SOAP_SOCKLEN_T k = (SOAP_SOCKLEN_T)sizeof(soap->peer); memset((void*)&soap->peer, 0, sizeof(soap->peer)); - r = recvfrom(soap->socket, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ + r = recvfrom(sk, s, (SOAP_WINSOCKINT)n, soap->socket_flags, (struct sockaddr*)&soap->peer, &k); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ soap->peerlen = (size_t)k; #ifndef WITH_IPV6 soap->ip = ntohl(soap->peer.sin_addr.s_addr); @@ -938,13 +941,13 @@ frecv(struct soap *soap, char *s, size_t n) } else #endif - r = recv(soap->socket, s, (int)n, soap->socket_flags); + r = recv(sk, s, (int)n, soap->socket_flags); #ifdef PALM /* CycleSyncDisplay(curStatusMsg); */ #endif if (r >= 0) return (size_t)r; - r = soap_socket_errno(soap->socket); + r = soap_socket_errno(sk); if (r != SOAP_EINTR && r != SOAP_EAGAIN && r != SOAP_EWOULDBLOCK) { soap->errnum = r; return 0; @@ -952,14 +955,14 @@ frecv(struct soap *soap, char *s, size_t n) } #if defined(WITH_OPENSSL) if (soap->ssl && err == SSL_ERROR_WANT_WRITE) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); else #elif defined(WITH_GNUTLS) if (soap->session && gnutls_record_get_direction(soap->session)) - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); else #endif - r = tcp_select(soap, soap->socket, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, soap->recv_timeout ? soap->recv_timeout : 5); if (!r && soap->recv_timeout) return 0; if (r < 0) @@ -970,7 +973,7 @@ frecv(struct soap *soap, char *s, size_t n) if (retries-- <= 0) return 0; #ifdef PALM - r = soap_socket_errno(soap->socket); + r = soap_socket_errno(sk); if (r != SOAP_EINTR && retries-- <= 0) { soap->errnum = r; return 0; @@ -1076,10 +1079,9 @@ soap_recv_raw(struct soap *soap) } } else if (r != Z_BUF_ERROR) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inflate error: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS)); soap->d_stream->next_out = Z_NULL; - soap->error = SOAP_ZLIB_ERROR; - return EOF; + return soap->error = SOAP_ZLIB_ERROR; } } zlib_again: @@ -1110,7 +1112,9 @@ zlib_again: DBGMSG(RECV, soap->buf, ret); soap->bufidx = 0; if (!ret) - return soap->ahead = EOF; + { soap->ahead = EOF; + return EOF; + } } else soap->bufidx = soap->buflen; @@ -1118,7 +1122,9 @@ zlib_again: DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (idx=%u len=%u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) { if ((int)c == EOF) - return soap->ahead = EOF; + { soap->ahead = EOF; + return EOF; + } } do *t++ = (char)c; @@ -1126,7 +1132,9 @@ zlib_again: while ((int)c != EOF && c != '\n') c = soap_getchunkchar(soap); if ((int)c == EOF) - return soap->ahead = EOF; + { soap->ahead = EOF; + return EOF; + } *t = '\0'; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunk size = %s (hex)\n", tmp)); soap->chunksize = (size_t)soap_strtoul(tmp, &t, 16); @@ -1194,10 +1202,9 @@ zlib_again: #endif } else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS)); soap->d_stream->next_out = Z_NULL; - soap->error = SOAP_ZLIB_ERROR; - return EOF; + return soap->error = SOAP_ZLIB_ERROR; } } #endif @@ -1283,19 +1290,22 @@ soap_recv(struct soap *soap) } } while (soap->ffilterrecv) - { int err = soap->filterstop; - if (err) + { int err, last = soap->filterstop; + if (last) soap->bufidx = soap->buflen = 0; - else - err = soap_recv_raw(soap); /* do not call again after EOF */ - if ((soap->error = soap->ffilterrecv(soap, soap->buf, &soap->buflen, sizeof(soap->buf)))) - return soap->error; + if ((err = soap->ffilterrecv(soap, soap->buf, &soap->buflen, sizeof(soap->buf)))) + return soap->error = err; if (soap->buflen) - { soap->filterstop = err; + { soap->bufidx = 0; + soap->filterstop = last; return SOAP_OK; } - if (err) - return err; + if (last) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Returning postponed error %d\n", last)); + soap->filterstop = SOAP_OK; + return last; + } + soap->filterstop = soap_recv_raw(soap); /* do not call again after EOF */ } #endif return soap_recv_raw(soap); @@ -1505,7 +1515,7 @@ soap_get(struct soap *soap) { c = soap_get0(soap); if (c == '>') { soap->cdata = 0; - soap_get1(soap); + c = soap_get1(soap); c = soap_get1(soap); } else @@ -1702,12 +1712,11 @@ SOAP_FMAC2 soap_getutf8(struct soap *soap) { register soap_wchar c, c1, c2, c3, c4; c = soap->ahead; - if (c > 0x7F) - { soap->ahead = 0; - return c; - } - c = soap_get(soap); - if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) + if (c) + soap->ahead = 0; + else + c = soap_get(soap); + if (c < 0x80 || c > 0xFF || (soap->mode & SOAP_ENC_LATIN)) return c; c1 = soap_get1(soap); if (c1 < 0x80) @@ -1896,7 +1905,7 @@ SOAP_FMAC1 unsigned char* SOAP_FMAC2 soap_getbase64(struct soap *soap, int *n, int malloc_flag) -{ +{ (void)malloc_flag; #ifdef WITH_DOM if ((soap->mode & SOAP_XML_DOM) && soap->dom) { soap->dom->data = soap_string_in(soap, 0, -1, -1); @@ -1921,6 +1930,8 @@ soap_getbase64(struct soap *soap, int *n, int malloc_flag) register int j = 0; do { register soap_wchar c = soap_get(soap); + if (c < SOAP_AP) + c &= 0x7FFFFFFF; if (c == '=' || c < 0) { unsigned char *p; switch (j) @@ -2037,14 +2048,13 @@ SOAP_FMAC2 soap_xop_forward(struct soap *soap, unsigned char **ptr, int *size, char **id, char **type, char **options) { /* Check MTOM xop:Include element (within hex/base64Binary) */ /* TODO: this code to be obsoleted with new import/xop.h conventions */ - int body = soap->body; /* should save type too? */ + short body = soap->body; /* should save type too? */ if (!soap_peek_element(soap)) { if (!soap_element_begin_in(soap, "xop:Include", 0, NULL)) - { if (soap_dime_forward(soap, ptr, size, id, type, options)) + { if (soap_dime_forward(soap, ptr, size, id, type, options) + || (soap->body && soap_element_end_in(soap, "xop:Include"))) return soap->error; } - if (soap->body && soap_element_end_in(soap, NULL)) - return soap->error; } soap->body = body; return SOAP_OK; @@ -2176,11 +2186,14 @@ soap_pop_block(struct soap *soap, struct soap_blist *b) #endif /******************************************************************************/ -#ifndef WITH_NOIDREF #ifndef PALM_1 -static void -soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2) -{ int i; +SOAP_FMAC1 +void +SOAP_FMAC2 +soap_update_pointers(struct soap *soap, char *start, char *end, char *p1, char *p2) +{ +#ifndef WITH_NOIDREF + int i; register struct soap_ilist *ip = NULL; register struct soap_flist *fp = NULL; #ifndef WITH_LEANER @@ -2218,7 +2231,7 @@ soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2) #ifndef WITH_LEANER for (xp = soap->xlist; xp; xp = xp->next) { if (xp->ptr && (char*)xp->ptr >= start && (char*)xp->ptr < end) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id?xp->id:SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2))); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Update id='%s' %p -> %p\n", xp->id ? xp->id : SOAP_STR_EOS, xp->ptr, (char*)xp->ptr + (p1-p2))); xp->ptr = (unsigned char**)((char*)xp->ptr + (p1-p2)); xp->size = (int*)((char*)xp->size + (p1-p2)); xp->type = (char**)((char*)xp->type + (p1-p2)); @@ -2226,8 +2239,10 @@ soap_update_ptrs(struct soap *soap, char *start, char *end, char *p1, char *p2) } } #endif -} +#else + (void)soap; (void)start; (void)end; (void)p1; (void)p2; #endif +} #endif /******************************************************************************/ @@ -2469,11 +2484,11 @@ soap_save_block(struct soap *soap, struct soap_blist *b, char *p, int flag) if (p) { for (s = p, q = soap_first_block(soap, b); q; q = soap_next_block(soap, b)) { n = soap_block_size(soap, b); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s)); #ifndef WITH_NOIDREF if (flag) - soap_update_ptrs(soap, q, q + n, s, q); + soap_update_pointers(soap, q, q + n, s, q); #endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy %u bytes from %p to %p\n", (unsigned int)n, q, s)); memcpy(s, q, n); s += n; } @@ -2701,12 +2716,7 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns) if (p) { for (i = 0; p->id; p++, i++) { if (p->ns && !strcmp(ns, p->ns)) - { if (p->out) - { SOAP_FREE(soap, p->out); - p->out = NULL; - } break; - } if (p->out) { if (!strcmp(ns, p->out)) break; @@ -2733,10 +2743,10 @@ soap_push_namespace(struct soap *soap, const char *id, const char *ns) soap->nlist = np; np->level = soap->level; np->index = i; - strcpy(np->id, id); + strcpy((char*)np->id, id); DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); if (i < 0) - { np->ns = strcpy(np->id + n + 1, ns); + { np->ns = strcpy((char*)np->id + n + 1, ns); DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); } else @@ -3067,6 +3077,7 @@ soap_ssl_init() #ifdef WITH_OPENSSL SSL_library_init(); OpenSSL_add_all_algorithms(); /* 2.8.1 change (wsseapi.c) */ + OpenSSL_add_all_digests(); #ifndef WITH_LEAN SSL_load_error_strings(); #endif @@ -3122,7 +3133,11 @@ soap_ssl_error(struct soap *soap, int ret) strcpy(soap->msgbuf, "EOF was observed that violates the protocol. The client probably provided invalid authentication information."); break; case -1: +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Error observed by underlying BIO: %s", strerror(errno)); +#else sprintf(soap->msgbuf, "Error observed by underlying BIO: %s", strerror(errno)); +#endif break; } } @@ -3333,12 +3348,22 @@ ssl_verify_callback(int ok, X509_STORE_CTX *store) #ifdef SOAP_DEBUG if (!ok) { char buf[1024]; + int err = X509_STORE_CTX_get_error(store); X509 *cert = X509_STORE_CTX_get_current_cert(store); - fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(X509_STORE_CTX_get_error(store))); + fprintf(stderr, "SSL verify error or warning with certificate at depth %d: %s\n", X509_STORE_CTX_get_error_depth(store), X509_verify_cert_error_string(err)); X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf)); fprintf(stderr, "certificate issuer %s\n", buf); X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf)); fprintf(stderr, "certificate subject %s\n", buf); + /* accept self signed certificates and certificates out of date */ + switch (err) + { case X509_V_ERR_CERT_NOT_YET_VALID: + case X509_V_ERR_CERT_HAS_EXPIRED: + case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: + case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: + X509_STORE_CTX_set_error(store, X509_V_OK); + ok = 1; + } } #endif /* Note: return 1 to continue, but unsafe progress will be terminated by OpenSSL */ @@ -3353,13 +3378,16 @@ ssl_verify_callback(int ok, X509_STORE_CTX *store) static int ssl_verify_callback_allow_expired_certificate(int ok, X509_STORE_CTX *store) { ok = ssl_verify_callback(ok, store); - if (ok == 0 && X509_STORE_CTX_get_error(store) == X509_V_ERR_CERT_HAS_EXPIRED) - { -#ifdef SOAP_DEBUG - fprintf(stderr, "ignoring certificate expiration\n"); -#endif - X509_STORE_CTX_set_error(store, X509_V_OK); - ok = 1; + if (!ok) + { /* accept self signed certificates and certificates out of date */ + switch (X509_STORE_CTX_get_error(store)) + { case X509_V_ERR_CERT_NOT_YET_VALID: + case X509_V_ERR_CERT_HAS_EXPIRED: + case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: + case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: + X509_STORE_CTX_set_error(store, X509_V_OK); + ok = 1; + } } /* Note: return 1 to continue, but unsafe progress will be terminated by SSL */ return ok; @@ -3414,11 +3442,11 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap *soap) -{ SOAP_SOCKET fd = soap->socket; +{ SOAP_SOCKET sk = soap->socket; #ifdef WITH_OPENSSL BIO *bio; int retries, r, s; - if (!soap_valid_socket(fd)) + if (!soap_valid_socket(sk)) return soap_set_receiver_error(soap, "SSL/TLS error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR); soap->ssl_flags &= ~SOAP_SSL_CLIENT; if (!soap->ctx && (soap->error = soap->fsslauth(soap))) @@ -3430,12 +3458,12 @@ soap_ssl_accept(struct soap *soap) } else SSL_clear(soap->ssl); - bio = BIO_new_socket((int)fd, BIO_NOCLOSE); + bio = BIO_new_socket((int)sk, BIO_NOCLOSE); SSL_set_bio(soap->ssl, bio, bio); /* Set SSL sockets to non-blocking */ retries = 0; if (soap->accept_timeout) - { SOAP_SOCKNONBLOCK(fd) + { SOAP_SOCKNONBLOCK(sk) retries = 10*soap->accept_timeout; } if (retries <= 0) @@ -3447,14 +3475,14 @@ soap_ssl_accept(struct soap *soap) err = SSL_get_error(soap->ssl, r); if (err == SSL_ERROR_WANT_ACCEPT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) { if (err == SSL_ERROR_WANT_READ) - s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); else - s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); if (s < 0 && soap->errnum != SOAP_EINTR) break; } else - { soap->errnum = soap_socket_errno(fd); + { soap->errnum = soap_socket_errno(sk); break; } } @@ -3480,17 +3508,17 @@ soap_ssl_accept(struct soap *soap) #endif #ifdef WITH_GNUTLS int retries = 0, r; - if (!soap_valid_socket(fd)) + if (!soap_valid_socket(sk)) return soap_set_receiver_error(soap, "SSL/TLS error", "No socket in soap_ssl_accept()", SOAP_SSL_ERROR); soap->ssl_flags &= ~SOAP_SSL_CLIENT; if (!soap->session && (soap->error = soap->fsslauth(soap))) { soap_closesock(soap); return soap->error; } - gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)fd); + gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)sk); /* Set SSL sockets to non-blocking */ if (soap->accept_timeout) - { SOAP_SOCKNONBLOCK(fd) + { SOAP_SOCKNONBLOCK(sk) retries = 10*soap->accept_timeout; } if (retries <= 0) @@ -3502,14 +3530,14 @@ soap_ssl_accept(struct soap *soap) break; if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED) { if (!gnutls_record_get_direction(soap->session)) - s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); else - s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); if (s < 0 && soap->errnum != SOAP_EINTR) break; } else - { soap->errnum = soap_socket_errno(fd); + { soap->errnum = soap_socket_errno(sk); break; } } @@ -3526,9 +3554,9 @@ soap_ssl_accept(struct soap *soap) } #endif if (soap->recv_timeout || soap->send_timeout) - SOAP_SOCKNONBLOCK(fd) + SOAP_SOCKNONBLOCK(sk) else - SOAP_SOCKBLOCK(fd) + SOAP_SOCKBLOCK(sk) soap->imode |= SOAP_ENC_SSL; soap->omode |= SOAP_ENC_SSL; return SOAP_OK; @@ -3672,7 +3700,7 @@ tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) #ifdef WITH_IPV6 struct addrinfo hints, *res, *ressave; #endif - SOAP_SOCKET fd; + SOAP_SOCKET sk; int err = 0; #ifndef WITH_LEAN #ifndef WIN32 @@ -3714,7 +3742,7 @@ tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) } ressave = res; again: - fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + sk = socket(res->ai_family, res->ai_socktype, res->ai_protocol); soap->errmode = 0; #else #ifndef WITH_LEAN @@ -3722,12 +3750,12 @@ again: #endif #ifndef WITH_LEAN if ((soap->omode & SOAP_IO_UDP)) - fd = socket(AF_INET, SOCK_DGRAM, 0); + sk = socket(AF_INET, SOCK_DGRAM, 0); else #endif - fd = socket(AF_INET, SOCK_STREAM, 0); + sk = socket(AF_INET, SOCK_STREAM, 0); #endif - if (!soap_valid_socket(fd)) + if (!soap_valid_socket(sk)) { #ifdef WITH_IPV6 if (res->ai_next) @@ -3735,7 +3763,7 @@ again: goto again; } #endif - soap->errnum = soap_socket_errno(fd); + soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); #ifdef WITH_IPV6 freeaddrinfo(ressave); @@ -3745,10 +3773,10 @@ again: #ifdef SOCKET_CLOSE_ON_EXEC #ifdef WIN32 #ifndef UNDER_CE - SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation((HANDLE)sk, HANDLE_FLAG_INHERIT, 0); #endif #else - fcntl(fd, F_SETFD, 1); + fcntl(sk, F_SETFD, 1); #endif #endif #ifndef WITH_LEAN @@ -3757,57 +3785,57 @@ again: memset((void*)&linger, 0, sizeof(linger)); linger.l_onoff = 1; linger.l_linger = soap->linger_time; - if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno(fd); + if (setsockopt(sk, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif return SOAP_INVALID_SOCKET; } } - else if (soap->connect_flags && setsockopt(fd, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + else if (soap->connect_flags && setsockopt(sk, SOL_SOCKET, soap->connect_flags, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif return SOAP_INVALID_SOCKET; } - if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if ((soap->keep_alive || soap->tcp_keep_alive) && setsockopt(sk, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif return SOAP_INVALID_SOCKET; } - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif return SOAP_INVALID_SOCKET; } - if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (setsockopt(sk, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif return SOAP_INVALID_SOCKET; } #ifdef TCP_KEEPIDLE - if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&(soap->tcp_keep_idle), sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (soap->tcp_keep_idle && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&(soap->tcp_keep_idle), sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPIDLE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); + soap->fclosesocket(soap, (SOAP_SOCKET)sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3815,10 +3843,10 @@ again: } #endif #ifdef TCP_KEEPINTVL - if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&(soap->tcp_keep_intvl), sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (soap->tcp_keep_intvl && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&(soap->tcp_keep_intvl), sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPINTVL failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); + soap->fclosesocket(soap, (SOAP_SOCKET)sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3826,10 +3854,10 @@ again: } #endif #ifdef TCP_KEEPCNT - if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_KEEPCNT, (char*)&(soap->tcp_keep_cnt), sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (soap->tcp_keep_cnt && setsockopt((SOAP_SOCKET)sk, IPPROTO_TCP, TCP_KEEPCNT, (char*)&(soap->tcp_keep_cnt), sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_KEEPCNT failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); + soap->fclosesocket(soap, (SOAP_SOCKET)sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3837,10 +3865,10 @@ again: } #endif #ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno(fd); + if (!(soap->omode & SOAP_IO_UDP) && setsockopt(sk, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3857,29 +3885,29 @@ again: if ((soap->omode & SOAP_IO_UDP)) { if (soap->ipv4_multicast_ttl) { unsigned char ttl = soap->ipv4_multicast_ttl; - if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl))) - { soap->errnum = soap_socket_errno(fd); + if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_TTL failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } } if ((soap->omode & SOAP_IO_UDP) && soap->ipv4_multicast_if && !soap->ipv6_multicast_if) - { if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) + { if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) #ifndef WINDOWS - { soap->errnum = soap_socket_errno(fd); + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } #else #ifndef IP_MULTICAST_IF #define IP_MULTICAST_IF 2 #endif - if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) - { soap->errnum = soap_socket_errno(fd); + if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr))) + { soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } #endif @@ -3887,7 +3915,7 @@ again: } #endif #endif - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", fd, host, port)); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Opening socket %d to host='%s' port=%d\n", sk, host, port)); #ifndef WITH_IPV6 soap->peerlen = sizeof(soap->peer); memset((void*)&soap->peer, 0, sizeof(soap->peer)); @@ -3896,7 +3924,7 @@ again: if (soap->proxy_host) { if (soap->fresolve(soap, soap->proxy_host, &soap->peer.sin_addr)) { soap_set_sender_error(soap, tcp_error(soap), "get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } soap->peer.sin_port = htons((short)soap->proxy_port); @@ -3904,7 +3932,7 @@ again: else { if (soap->fresolve(soap, host, &soap->peer.sin_addr)) { soap_set_sender_error(soap, tcp_error(soap), "get host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } soap->peer.sin_port = htons((short)port); @@ -3912,34 +3940,34 @@ again: soap->errmode = 0; #ifndef WITH_LEAN if ((soap->omode & SOAP_IO_UDP)) - return fd; + return sk; #endif #else if ((soap->omode & SOAP_IO_UDP)) { memcpy(&soap->peer, res->ai_addr, res->ai_addrlen); soap->peerlen = res->ai_addrlen; freeaddrinfo(ressave); - return fd; + return sk; } #endif #ifndef WITH_LEAN if (soap->connect_timeout) - SOAP_SOCKNONBLOCK(fd) + SOAP_SOCKNONBLOCK(sk) else - SOAP_SOCKBLOCK(fd) + SOAP_SOCKBLOCK(sk) retries = 10; #endif for (;;) { #ifdef WITH_IPV6 - if (connect(fd, res->ai_addr, (int)res->ai_addrlen)) + if (connect(sk, res->ai_addr, (int)res->ai_addrlen)) #else - if (connect(fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) + if (connect(sk, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) #endif - { err = soap_socket_errno(fd); + { err = soap_socket_errno(sk); #ifndef WITH_LEAN if (err == SOAP_EADDRINUSE) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); if (retries-- > 0) goto again; } @@ -3948,13 +3976,13 @@ again: SOAP_SOCKLEN_T k; for (;;) { register int r; - r = tcp_select(soap, fd, SOAP_TCP_SELECT_SND, soap->connect_timeout); + r = tcp_select(soap, sk, SOAP_TCP_SELECT_SND, soap->connect_timeout); if (r > 0) break; if (!r) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); soap_set_sender_error(soap, "Timeout", "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3964,7 +3992,7 @@ again: if (r != SOAP_EINTR) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3972,13 +4000,13 @@ again: } } k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); - if (!getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ + if (!getsockopt(sk, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &k) && !soap->errnum) /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ break; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); if (!soap->errnum) - soap->errnum = soap_socket_errno(fd); + soap->errnum = soap_socket_errno(sk); soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -3988,7 +4016,7 @@ again: #ifdef WITH_IPV6 if (res->ai_next) { res = res->ai_next; - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); goto again; } #endif @@ -3996,7 +4024,7 @@ again: { soap->errnum = err; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); #ifdef WITH_IPV6 freeaddrinfo(ressave); #endif @@ -4010,7 +4038,7 @@ again: soap->peerlen = 0; /* IPv6: already connected so use send() */ freeaddrinfo(ressave); #endif - soap->socket = fd; + soap->socket = sk; soap->imode &= ~SOAP_ENC_SSL; soap->omode &= ~SOAP_ENC_SSL; if (!soap_tag_cmp(endpoint, "https:*")) @@ -4025,46 +4053,45 @@ again: soap_mode om = soap->omode; /* make sure we only parse HTTP */ size_t n = soap->count; /* save the content length */ const char *userid, *passwd; + int status = soap->status; /* save the current status/command */ + short keep_alive = soap->keep_alive; /* save the KA status */ soap->omode &= ~SOAP_ENC; /* mask IO and ENC */ soap->omode |= SOAP_IO_BUFFER; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to %s proxy server\n", soap->proxy_http_version)); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->proxy_http_version); - if (soap_begin_send(soap) - || (soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - { soap->fclosesocket(soap, fd); - return SOAP_INVALID_SOCKET; - } -#ifndef WITH_LEAN - if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761) - { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); - strcpy(soap->tmpbuf, "Basic "); - soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - { soap->fclosesocket(soap, fd); +#ifdef WITH_NTLM + if (soap->ntlm_challenge) + { if (soap_ntlm_handshake(soap, SOAP_CONNECT, endpoint, host, port)) return soap->error; - } } #endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - { soap->fclosesocket(soap, fd); + if (soap_begin_send(soap)) + { soap->fclosesocket(soap, sk); + return SOAP_INVALID_SOCKET; + } + soap->status = SOAP_CONNECT; + soap->keep_alive = 1; + if ((soap->error = soap->fpost(soap, endpoint, host, port, NULL, NULL, 0)) + || soap_end_send(soap)) + { soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } + soap->keep_alive = keep_alive; soap->omode = om; om = soap->imode; soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ userid = soap->userid; /* preserve */ passwd = soap->passwd; /* preserve */ if ((soap->error = soap->fparse(soap))) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } + soap->status = status; /* restore */ soap->userid = userid; /* restore */ soap->passwd = passwd; /* restore */ soap->imode = om; /* restore */ soap->count = n; /* restore */ if (soap_begin_send(soap)) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } if (endpoint) @@ -4074,13 +4101,15 @@ again: #ifdef WITH_OPENSSL soap->ssl_flags |= SOAP_SSL_CLIENT; if (!soap->ctx && (soap->error = soap->fsslauth(soap))) - { soap->fclosesocket(soap, fd); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL required, but no ctx set\n")); + soap->fclosesocket(soap, sk); + soap->error = SOAP_SSL_ERROR; return SOAP_INVALID_SOCKET; } if (!soap->ssl) { soap->ssl = SSL_new(soap->ctx); if (!soap->ssl) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); soap->error = SOAP_SSL_ERROR; return SOAP_INVALID_SOCKET; } @@ -4095,16 +4124,16 @@ again: } soap->imode |= SOAP_ENC_SSL; soap->omode |= SOAP_ENC_SSL; - bio = BIO_new_socket((int)fd, BIO_NOCLOSE); + bio = BIO_new_socket((int)sk, BIO_NOCLOSE); SSL_set_bio(soap->ssl, bio, bio); /* Connect timeout: set SSL sockets to non-blocking */ retries = 0; if (soap->connect_timeout) - { SOAP_SOCKNONBLOCK(fd) + { SOAP_SOCKNONBLOCK(sk) retries = 10*soap->connect_timeout; } else - SOAP_SOCKBLOCK(fd) + SOAP_SOCKBLOCK(sk) if (retries <= 0) retries = 100; /* timeout: 10 sec retries, 100 times 0.1 sec */ /* Try connecting until success or timeout (when nonblocking) */ @@ -4114,37 +4143,37 @@ again: if (err == SSL_ERROR_WANT_CONNECT || err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) { register int s; if (err == SSL_ERROR_WANT_READ) - s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); else - s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); if (s < 0 && soap->errnum != SOAP_EINTR) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL_connect/select error in tcp_connect\n")); soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL_connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } if (s == 0 && retries-- <= 0) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "SSL/TLS connect timeout\n")); soap_set_sender_error(soap, "Timeout", "SSL_connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } } else { soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL_connect error in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } } } while (!SSL_is_init_finished(soap->ssl)); /* Set SSL sockets to nonblocking */ - SOAP_SOCKNONBLOCK(fd) + SOAP_SOCKNONBLOCK(sk) /* Check server credentials when required */ if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) { int err; if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) { soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL/TLS certificate presented by peer cannot be verified in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK)) @@ -4155,7 +4184,7 @@ again: peer = SSL_get_peer_certificate(soap->ssl); if (!peer) { soap_set_sender_error(soap, "SSL/TLS error", "No SSL/TLS certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } ext_count = X509_get_ext_count(peer); @@ -4249,7 +4278,7 @@ again: X509_free(peer); if (!ok) { soap_set_sender_error(soap, "SSL/TLS error", "SSL/TLS certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } } @@ -4258,17 +4287,17 @@ again: #ifdef WITH_GNUTLS soap->ssl_flags |= SOAP_SSL_CLIENT; if (!soap->session && (soap->error = soap->fsslauth(soap))) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } - gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)fd); + gnutls_transport_set_ptr(soap->session, (gnutls_transport_ptr_t)(long)sk); /* Set SSL sockets to non-blocking */ if (soap->connect_timeout) - { SOAP_SOCKNONBLOCK(fd) + { SOAP_SOCKNONBLOCK(sk) retries = 10*soap->connect_timeout; } else - SOAP_SOCKBLOCK(fd) + SOAP_SOCKBLOCK(sk) if (retries <= 0) retries = 100; /* timeout: 10 sec retries, 100 times 0.1 sec */ while ((r = gnutls_handshake(soap->session))) @@ -4278,42 +4307,42 @@ again: break; if (r == GNUTLS_E_AGAIN || r == GNUTLS_E_INTERRUPTED) { if (!gnutls_record_get_direction(soap->session)) - s = tcp_select(soap, fd, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_RCV | SOAP_TCP_SELECT_ERR, -100000); else - s = tcp_select(soap, fd, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); + s = tcp_select(soap, sk, SOAP_TCP_SELECT_SND | SOAP_TCP_SELECT_ERR, -100000); if (s < 0 && soap->errnum != SOAP_EINTR) break; } else - { soap->errnum = soap_socket_errno(fd); + { soap->errnum = soap_socket_errno(sk); break; } } if (r) { soap_set_sender_error(soap, soap_ssl_error(soap, r), "SSL/TLS handshake failed", SOAP_SSL_ERROR); - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); return SOAP_INVALID_SOCKET; } if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) { const char *err = ssl_verify(soap, host); if (err) - { soap->fclosesocket(soap, fd); + { soap->fclosesocket(soap, sk); soap->error = soap_set_sender_error(soap, "SSL/TLS error", err, SOAP_SSL_ERROR); return SOAP_INVALID_SOCKET; } } #endif #else - soap->fclosesocket(soap, fd); + soap->fclosesocket(soap, sk); soap->error = SOAP_SSL_ERROR; return SOAP_INVALID_SOCKET; #endif } if (soap->recv_timeout || soap->send_timeout) - SOAP_SOCKNONBLOCK(fd) + SOAP_SOCKNONBLOCK(sk) else - SOAP_SOCKBLOCK(fd) - return fd; + SOAP_SOCKBLOCK(sk) + return sk; } #endif #endif @@ -4322,7 +4351,7 @@ again: #ifndef WITH_NOIO #ifndef PALM_1 static int -tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout) +tcp_select(struct soap *soap, SOAP_SOCKET sk, int flags, int timeout) { register int r; struct timeval tv; fd_set fd[3], *rfd, *sfd, *efd; @@ -4333,12 +4362,12 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout) if (1) #else /* if fd max set size exceeded, use poll() */ - if ((int)s >= (int)FD_SETSIZE) + if ((int)sk >= (int)FD_SETSIZE) #endif #ifdef HAVE_POLL { struct pollfd pollfd; int retries = 0; - pollfd.fd = (int)s; + pollfd.fd = (int)sk; pollfd.events = 0; if (flags & SOAP_TCP_SELECT_RCV) pollfd.events |= POLLIN; @@ -4379,17 +4408,17 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout) if (flags & SOAP_TCP_SELECT_RCV) { rfd = &fd[0]; FD_ZERO(rfd); - FD_SET(s, rfd); + FD_SET(sk, rfd); } if (flags & SOAP_TCP_SELECT_SND) { sfd = &fd[1]; FD_ZERO(sfd); - FD_SET(s, sfd); + FD_SET(sk, sfd); } if (flags & SOAP_TCP_SELECT_ERR) { efd = &fd[2]; FD_ZERO(efd); - FD_SET(s, efd); + FD_SET(sk, efd); } if (timeout >= 0) { tv.tv_sec = timeout; @@ -4399,14 +4428,14 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout) { tv.tv_sec = -timeout / 1000000; tv.tv_usec = -timeout % 1000000; } - r = select((int)s + 1, rfd, sfd, efd, &tv); + r = select((int)sk + 1, rfd, sfd, efd, &tv); if (r > 0) { r = 0; - if ((flags & SOAP_TCP_SELECT_RCV) && FD_ISSET(s, rfd)) + if ((flags & SOAP_TCP_SELECT_RCV) && FD_ISSET(sk, rfd)) r |= SOAP_TCP_SELECT_RCV; - if ((flags & SOAP_TCP_SELECT_SND) && FD_ISSET(s, sfd)) + if ((flags & SOAP_TCP_SELECT_SND) && FD_ISSET(sk, sfd)) r |= SOAP_TCP_SELECT_SND; - if ((flags & SOAP_TCP_SELECT_ERR) && FD_ISSET(s, efd)) + if ((flags & SOAP_TCP_SELECT_ERR) && FD_ISSET(sk, efd)) r |= SOAP_TCP_SELECT_ERR; } else if (r < 0) @@ -4421,18 +4450,19 @@ tcp_select(struct soap *soap, SOAP_SOCKET s, int flags, int timeout) #ifndef PALM_1 static SOAP_SOCKET tcp_accept(struct soap *soap, SOAP_SOCKET s, struct sockaddr *a, int *n) -{ SOAP_SOCKET fd; - fd = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ +{ SOAP_SOCKET sk; + (void)soap; + sk = accept(s, a, (SOAP_SOCKLEN_T*)n); /* portability note: see SOAP_SOCKLEN_T definition in stdsoap2.h */ #ifdef SOCKET_CLOSE_ON_EXEC #ifdef WIN32 #ifndef UNDER_CE - SetHandleInformation((HANDLE)fd, HANDLE_FLAG_INHERIT, 0); + SetHandleInformation((HANDLE)sk, HANDLE_FLAG_INHERIT, 0); #endif #else - fcntl(fd, F_SETFD, FD_CLOEXEC); + fcntl(sk, F_SETFD, FD_CLOEXEC); #endif #endif - return fd; + return sk; } #endif #endif @@ -4533,9 +4563,10 @@ tcp_disconnect(struct soap *soap) #ifndef WITH_NOIO #ifndef PALM_1 static int -tcp_closesocket(struct soap *soap, SOAP_SOCKET fd) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)fd)); - return soap_closesocket(fd); +tcp_closesocket(struct soap *soap, SOAP_SOCKET sk) +{ (void)soap; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Close socket %d\n", (int)sk)); + return soap_closesocket(sk); } #endif #endif @@ -4544,9 +4575,10 @@ tcp_closesocket(struct soap *soap, SOAP_SOCKET fd) #ifndef WITH_NOIO #ifndef PALM_1 static int -tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int how) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)fd, how)); - return shutdown(fd, how); +tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET sk, int how) +{ (void)soap; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Shutdown socket %d how=%d\n", (int)sk, how)); + return shutdown(sk, how); } #endif #endif @@ -4569,7 +4601,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog) #endif #endif #ifndef WITH_LEAN -#ifndef WITH_WIN32 +#ifndef WIN32 int len = SOAP_BUFLEN; #else int len = SOAP_BUFLEN + 1; /* speeds up windows xfer */ @@ -4623,6 +4655,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog) soap_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; } + soap->port = port; #ifndef WITH_LEAN if ((soap->omode & SOAP_IO_UDP)) soap->socket = soap->master; @@ -4642,7 +4675,7 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog) soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_bind()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; } - if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && (!((soap->imode | soap->omode) & SOAP_IO_UDP)) && setsockopt(soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) { soap->errnum = soap_socket_errno(soap->master); soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; @@ -4669,14 +4702,14 @@ soap_bind(struct soap *soap, const char *host, int port, int backlog) #ifdef WITH_IPV6_V6ONLY if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&set, sizeof(int))) { soap->errnum = soap_socket_errno(soap->master); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt set IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; } #endif #ifdef WITH_NO_IPV6_V6ONLY if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&unset, sizeof(int))) { soap->errnum = soap_socket_errno(soap->master); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt unset IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; } #endif @@ -4784,8 +4817,9 @@ SOAP_SOCKET SOAP_FMAC2 soap_accept(struct soap *soap) { int n = (int)sizeof(soap->peer); + register int err; #ifndef WITH_LEAN -#ifndef WITH_WIN32 +#ifndef WIN32 int len = SOAP_BUFLEN; #else int len = SOAP_BUFLEN + 1; /* speeds up windows xfer */ @@ -4793,124 +4827,123 @@ soap_accept(struct soap *soap) int set = 1; #endif soap->error = SOAP_OK; -#ifndef WITH_LEAN - if ((soap->omode & SOAP_IO_UDP)) - return soap->socket = soap->master; -#endif memset((void*)&soap->peer, 0, sizeof(soap->peer)); soap->socket = SOAP_INVALID_SOCKET; soap->errmode = 0; soap->keep_alive = 0; - if (soap_valid_socket(soap->master)) - { register int err; - for (;;) - { if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) - { for (;;) - { register int r; - r = tcp_select(soap, soap->master, SOAP_TCP_SELECT_ALL, soap->accept_timeout ? soap->accept_timeout : 60); - if (r > 0) - break; - if (!r && soap->accept_timeout) - { soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); + if (!soap_valid_socket(soap->master)) + { soap->errnum = 0; + soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } +#ifndef WITH_LEAN + if ((soap->omode & SOAP_IO_UDP)) + return soap->socket = soap->master; +#endif + for (;;) + { if (soap->accept_timeout || soap->send_timeout || soap->recv_timeout) + { for (;;) + { register int r; + r = tcp_select(soap, soap->master, SOAP_TCP_SELECT_ALL, soap->accept_timeout ? soap->accept_timeout : 60); + if (r > 0) + break; + if (!r && soap->accept_timeout) + { soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); + return SOAP_INVALID_SOCKET; + } + if (r < 0) + { r = soap->errnum; + if (r != SOAP_EINTR) + { soap_closesock(soap); + soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); return SOAP_INVALID_SOCKET; } - if (r < 0) - { r = soap->errnum; - if (r != SOAP_EINTR) - { soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } } } - if (soap->accept_timeout) - SOAP_SOCKNONBLOCK(soap->master) - else - SOAP_SOCKBLOCK(soap->master) - soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n); - soap->peerlen = (size_t)n; - if (soap_valid_socket(soap->socket)) - { + } + if (soap->accept_timeout) + SOAP_SOCKNONBLOCK(soap->master) + else + SOAP_SOCKBLOCK(soap->master) + soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&soap->peer, &n); + soap->peerlen = (size_t)n; + if (soap_valid_socket(soap->socket)) + { #ifdef WITH_IPV6 -/* Use soap->host to store the numeric form of the remote host */ - getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d from %s\n", soap->socket, soap->host)); - soap->ip = 0; /* info stored in soap->peer and soap->host */ - soap->port = 0; /* info stored in soap->peer and soap->host */ + unsigned int ip1, ip2, ip3, ip4; + char port[16]; + getnameinfo((struct sockaddr*)&soap->peer, n, soap->host, sizeof(soap->host), port, 16, NI_NUMERICHOST | NI_NUMERICSERV); + sscanf(soap->host, "%u.%u.%u.%u", &ip1, &ip2, &ip3, &ip4); + soap->ip = (unsigned long)ip1 << 24 | (unsigned long)ip2 << 16 | (unsigned long)ip3 << 8 | (unsigned long)ip4; + soap->port = soap_strtol(port, NULL, 10); #else - soap->ip = ntohl(soap->peer.sin_addr.s_addr); - soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */ - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %d.%d.%d.%d\n", soap->socket, soap->port, (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF)); + soap->ip = ntohl(soap->peer.sin_addr.s_addr); + sprintf(soap->host, "%u.%u.%u.%u", (int)(soap->ip>>24)&0xFF, (int)(soap->ip>>16)&0xFF, (int)(soap->ip>>8)&0xFF, (int)soap->ip&0xFF); + soap->port = (int)ntohs(soap->peer.sin_port); /* does not return port number on some systems */ #endif + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept socket %d at port %d from IP %s\n", soap->socket, soap->port, soap->host)); #ifndef WITH_LEAN - if (soap->accept_flags == SO_LINGER) - { struct linger linger; - memset((void*)&linger, 0, sizeof(linger)); - linger.l_onoff = 1; - linger.l_linger = soap->linger_time; - if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); - soap_closesock(soap); - return SOAP_INVALID_SOCKET; - } - } - else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int))) + if (soap->accept_flags == SO_LINGER) + { struct linger linger; + memset((void*)&linger, 0, sizeof(linger)); + linger.l_onoff = 1; + linger.l_linger = soap->linger_time; + if (setsockopt(soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR); - soap_closesock(soap); - return SOAP_INVALID_SOCKET; - } - if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); - soap_closesock(soap); - return SOAP_INVALID_SOCKET; - } - if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); - soap_closesock(soap); - return SOAP_INVALID_SOCKET; - } - if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); soap_closesock(soap); return SOAP_INVALID_SOCKET; } + } + else if (soap->accept_flags && setsockopt(soap->socket, SOL_SOCKET, soap->accept_flags, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) && setsockopt(soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } + if (setsockopt(soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; + } #ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno(soap->socket); - soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); - soap_closesock(soap); - return SOAP_INVALID_SOCKET; - } -#endif -#endif - soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); - if (soap->send_timeout || soap->recv_timeout) - SOAP_SOCKNONBLOCK(soap->socket) - else - SOAP_SOCKBLOCK(soap->socket) - return soap->socket; - } - err = soap_socket_errno(soap->socket); - if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); - soap->errnum = err; - soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); + if (setsockopt(soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) + { soap->errnum = soap_socket_errno(soap->socket); + soap_set_receiver_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); soap_closesock(soap); return SOAP_INVALID_SOCKET; } +#endif +#endif + soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); + if (soap->send_timeout || soap->recv_timeout) + SOAP_SOCKNONBLOCK(soap->socket) + else + SOAP_SOCKBLOCK(soap->socket) + return soap->socket; + } + err = soap_socket_errno(soap->socket); + if (err != 0 && err != SOAP_EINTR && err != SOAP_EAGAIN && err != SOAP_EWOULDBLOCK) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); + soap->errnum = err; + soap_set_receiver_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); + soap_closesock(soap); + return SOAP_INVALID_SOCKET; } } - else - { soap->errnum = 0; - soap_set_receiver_error(soap, tcp_error(soap), "no master socket in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } } #endif #endif @@ -4949,6 +4982,19 @@ soap_closesock(struct soap *soap) #endif /******************************************************************************/ +#ifndef PALM_1 +SOAP_FMAC1 +int +SOAP_FMAC2 +soap_force_closesock(struct soap *soap) +{ soap->keep_alive = 0; + if (soap_valid_socket(soap->socket)) + return soap_closesocket(soap->socket); + return SOAP_OK; +} +#endif + +/******************************************************************************/ #ifndef WITH_NOIO #ifndef PALM_2 SOAP_FMAC1 @@ -5004,11 +5050,11 @@ soap_done(struct soap *soap) soap->fmalloc = NULL; #ifndef WITH_NOHTTP soap->fpost = http_post; - soap->fput = http_put; soap->fget = http_get; + soap->fput = http_405; soap->fdel = http_405; - soap->fopt = http_405; - soap->fhead = http_405; + soap->fopt = http_200; + soap->fhead = http_200; soap->fform = NULL; soap->fposthdr = http_post_header; soap->fresponse = http_response; @@ -5106,7 +5152,11 @@ soap_done(struct soap *soap) } #endif #ifdef WITH_C_LOCALE +# ifdef WIN32 + _free_locale(soap->c_locale); +# else freelocale(soap->c_locale); +# endif #endif #ifdef WITH_ZLIB if (soap->d_stream) @@ -5147,16 +5197,24 @@ soap_done(struct soap *soap) int http_parse(struct soap *soap) { char header[SOAP_HDRLEN], *s; - unsigned short httpcmd = 0, status = 0; + unsigned short httpcmd = 0; + int status = 0; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for HTTP request/response...\n")); *soap->endpoint = '\0'; soap->length = 0; - soap->userid = NULL; - soap->passwd = NULL; - soap->action = NULL; - soap->authrealm = NULL; +#ifdef WITH_NTLM + if (!soap->ntlm_challenge) +#endif + { soap->userid = NULL; + soap->passwd = NULL; + soap->authrealm = NULL; + } +#ifdef WITH_NTLM + soap->ntlm_challenge = NULL; +#endif soap->proxy_from = NULL; soap->http_content = NULL; + soap->action = NULL; soap->status = 0; do { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) @@ -5245,6 +5303,8 @@ http_parse(struct soap *soap) n = sizeof(soap->endpoint) - 1; strncpy(soap->path, soap->msgbuf + l, n - m); soap->path[n - m] = '\0'; + if (*soap->path && *soap->path != '/') + *soap->endpoint = '\0'; strcat(soap->endpoint, soap->path); DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); if (httpcmd > 1) @@ -5277,7 +5337,7 @@ http_parse(struct soap *soap) may not have a body. When content length, content type, or chunking is used assume there is a message to parse, either XML or HTTP. */ - if (soap->length > 0 || (soap->http_content && soap->recv_timeout) || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK) + if (soap->length > 0 || (soap->http_content && (!soap->keep_alive || soap->recv_timeout)) || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK) { if ((soap->status > 200 && soap->status <= 299) || soap->status == 400 || soap->status == 500) @@ -5392,8 +5452,14 @@ http_parse_header(struct soap *soap, const char *key, const char *val) } } } - else if (!soap_tag_cmp(key, "WWW-Authenticate")) - { soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm")); + else if (!soap_tag_cmp(key, "WWW-Authenticate") || !soap_tag_cmp(key, "Proxy-Authenticate")) + { +#ifdef WITH_NTLM + if (!soap_tag_cmp(val, "NTLM*")) + soap->ntlm_challenge = soap_strdup(soap, val + 4); + else +#endif + soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm")); } else if (!soap_tag_cmp(key, "Expect")) { if (!soap_tag_cmp(val, "100-continue")) @@ -5522,6 +5588,7 @@ soap_decode(char *buf, size_t len, const char *val, const char *sep) static const char* http_error(struct soap *soap, int status) { register const char *msg = SOAP_STR_EOS; + (void)soap; #ifndef WITH_LEAN msg = soap_code_str(h_http_error_codes, status); if (!msg) @@ -5533,21 +5600,25 @@ http_error(struct soap *soap, int status) #endif /******************************************************************************/ + #ifndef WITH_NOHTTP #ifndef PALM_1 static int -http_put(struct soap *soap) -{ return http_parse(soap); +http_get(struct soap *soap) +{ (void)soap; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "HTTP GET request\n")); + return SOAP_GET_METHOD; } #endif #endif -/******************************************************************************/ +/******************************************************************************/ #ifndef WITH_NOHTTP #ifndef PALM_1 static int -http_get(struct soap *soap) -{ return SOAP_GET_METHOD; +http_405(struct soap *soap) +{ return 405; + (void)soap; } #endif #endif @@ -5556,8 +5627,8 @@ http_get(struct soap *soap) #ifndef WITH_NOHTTP #ifndef PALM_1 static int -http_405(struct soap *soap) -{ return 405; +http_200(struct soap *soap) +{ return soap_send_empty_response(soap, 200); } #endif #endif @@ -5569,10 +5640,23 @@ static int http_post(struct soap *soap, const char *endpoint, const char *host, int port, const char *path, const char *action, size_t count) { register const char *s; register int err; - if (soap->status == SOAP_GET) - s = "GET"; - else - s = "POST"; + switch (soap->status) + { case SOAP_GET: + s = "GET"; + break; + case SOAP_PUT: + s = "PUT"; + break; + case SOAP_DEL: + s = "DELETE"; + break; + case SOAP_CONNECT: + s = "CONNECT"; + break; + default: + s = "POST"; + } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "HTTP %s to %s\n", s, endpoint ? endpoint : "(null)")); #ifdef PALM if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) #else @@ -5580,24 +5664,30 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c #endif return SOAP_OK; if (strlen(endpoint) + strlen(soap->http_version) > sizeof(soap->tmpbuf) - 80) - return soap->error = SOAP_EOM; - if (soap->proxy_host && soap_tag_cmp(endpoint, "https:*")) + return soap->error = SOAP_EOM; /* prevent overrun */ + if (soap->status == SOAP_CONNECT) + sprintf(soap->tmpbuf, "%s %s:%d HTTP/%s", s, soap->host, soap->port, soap->http_version); + else if (soap->proxy_host && endpoint) sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); else sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, (*path == '/' ? path + 1 : path), soap->http_version); if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) return err; #ifdef WITH_OPENSSL - if ((soap->ssl && soap->port != 443) || (!soap->ssl && soap->port != 80)) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); + if ((soap->ssl && port != 443) || (!soap->ssl && port != 80)) #else if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); +#endif + { +#ifdef WITH_IPV6 + if (*host != '[' && strchr(host, ':')) + sprintf(soap->tmpbuf, "[%s]:%d", host, port); /* RFC 2732 */ + else +#endif + sprintf(soap->tmpbuf, "%s:%d", host, port); + } else strcpy(soap->tmpbuf, host); -#endif if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf))) return err; if ((err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.8"))) @@ -5614,16 +5704,30 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c #endif #ifndef WITH_LEAN if (soap->userid && soap->passwd && strlen(soap->userid) + strlen(soap->passwd) < 761) - { sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd); - strcpy(soap->tmpbuf, "Basic "); - soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + { +#ifdef WITH_NTLM + if (soap->ntlm_challenge && strlen(soap->ntlm_challenge) + 6 < sizeof(soap->tmpbuf)) + sprintf(soap->tmpbuf, "NTLM %s", soap->ntlm_challenge); + else +#endif + { strcpy(soap->tmpbuf, "Basic "); + sprintf(soap->tmpbuf + 262, "%s:%s", soap->userid, soap->passwd); + soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + } if ((err = soap->fposthdr(soap, "Authorization", soap->tmpbuf))) return err; } if (soap->proxy_userid && soap->proxy_passwd && strlen(soap->proxy_userid) + strlen(soap->proxy_passwd) < 761) - { sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); - strcpy(soap->tmpbuf, "Basic "); - soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + { +#ifdef WITH_NTLM + if (soap->ntlm_challenge && strlen(soap->ntlm_challenge) + 6 < sizeof(soap->tmpbuf)) + sprintf(soap->tmpbuf, "NTLM %s", soap->ntlm_challenge); + else +#endif + { strcpy(soap->tmpbuf, "Basic "); + sprintf(soap->tmpbuf + 262, "%s:%s", soap->proxy_userid, soap->proxy_passwd); + soap_s2base64(soap, (const unsigned char*)(soap->tmpbuf + 262), soap->tmpbuf + 6, (int)strlen(soap->tmpbuf + 262)); + } if ((err = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) return err; } @@ -5637,7 +5741,7 @@ http_post(struct soap *soap, const char *endpoint, const char *host, int port, c return soap->error; #endif #endif - if (soap->status != SOAP_GET && soap->version == 1) + if (action && soap->status != SOAP_GET && soap->status != SOAP_DEL) { sprintf(soap->tmpbuf, "\"%s\"", action && strlen(action) < sizeof(soap->tmpbuf) - 3 ? action : SOAP_STR_EOS); if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) return err; @@ -5699,7 +5803,7 @@ http_response(struct soap *soap, int status, size_t count) if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) s = "200 OK"; else - s = "202 ACCEPTED"; + s = "202 Accepted"; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Status = %s\n", s)); #ifdef WMW_RPM_IO if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ @@ -5842,9 +5946,9 @@ soap_cookie(struct soap *soap, const char *name, const char *domain, const char path = SOAP_STR_EOS; else if (*path == '/') path++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain?domain:"(null)", path?path:"(null)")); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Search cookie %s domain=%s path=%s\n", name, domain ? domain : "(null)", path ? path : "(null)")); for (p = soap->cookies; p; p = p->next) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->env)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie in database: %s=%s domain=%s path=%s env=%hd\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->env)); if (!strcmp(p->name, name) && p->domain && p->path @@ -5871,7 +5975,7 @@ soap_set_cookie(struct soap *soap, const char *name, const char *value, const ch else if (*path == '/') path++; q = soap_cookie(soap, name, domain, path); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)")); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set %scookie: %s=%s domain=%s path=%s\n", q ? SOAP_STR_EOS : "new ", name, value ? value : "(null)", domain ? domain : "(null)", path ? path : "(null)")); if (!q) { if ((q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) { if ((q->name = (char*)SOAP_MALLOC(soap, strlen(name)+1))) @@ -5940,13 +6044,13 @@ soap_clr_cookie(struct soap *soap, const char *name, const char *domain, const c if (!domain) domain = soap->cookie_domain; if (!domain) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name?name:"(null)")); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie domain not set\n", name ? name : "(null)")); return; } if (!path) path = soap->cookie_path; if (!path) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name?name:"(null)")); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error in clear cookie %s: cookie path not set\n", name ? name : "(null)")); return; } if (*path == '/') @@ -6006,7 +6110,7 @@ int SOAP_FMAC2 soap_set_cookie_expire(struct soap *soap, const char *name, long expire, const char *domain, const char *path) { struct soap_cookie *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain?domain:"(null)", path?path:"(null)")); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie expiration max-age %ld: %s domain=%s path=%s\n", expire, name, domain ? domain : "(null)", path ? path : "(null)")); if ((p = soap_cookie(soap, name, domain, path))) { p->maxage = expire; p->modified = 1; @@ -6123,6 +6227,9 @@ soap_putcookies(struct soap *soap, const char *domain, const char *path, int sec unsigned int version = 0; time_t now = time(NULL); char *s, tmp[4096]; + if (!domain || !path) + return SOAP_OK; + s = tmp; p = &soap->cookies; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending cookies for domain=%s path=%s\n", domain, path)); if (*path == '/') @@ -6169,30 +6276,53 @@ soap_putcookies(struct soap *soap, const char *domain, const char *path, int sec if (flag && (!q->path || !strncmp(q->path, path, strlen(q->path))) && (!q->secure || secure)) - { s = tmp; + { size_t n = 12; + if (q->name) + n += 3*strlen(q->name); + if (q->value && *q->value) + n += 3*strlen(q->value) + 1; + if (q->path && *q->path) + n += strlen(q->path) + 9; + if (q->domain) + n += strlen(q->domain) + 11; + if (tmp - s + n > sizeof(tmp)) + { if (s == tmp) + return SOAP_OK; /* HTTP header size overflow */ + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp)); + if ((soap->error = soap->fposthdr(soap, "Cookie", tmp))) + return soap->error; + s = tmp; + } + else if (s != tmp) + { strcat(s, " "); + s++; + } if (q->version != version) { sprintf(s, "$Version=%u;", q->version); version = q->version; + s += strlen(s); } if (q->name) - s += soap_encode_cookie(q->name, s, tmp-s+4080); + s += soap_encode_cookie(q->name, s, tmp+sizeof(tmp)-s-16); if (q->value && *q->value) { *s++ = '='; - s += soap_encode_cookie(q->value, s, tmp-s+4080); + s += soap_encode_cookie(q->value, s, tmp+sizeof(tmp)-s-16); } - if (q->path && *q->path && (int)strlen(q->path) < tmp-s+4080) + if (q->path) { sprintf(s, ";$Path=\"/%s\"", (*q->path == '/' ? q->path + 1 : q->path)); s += strlen(s); } - if (q->domain && (int)strlen(q->domain) < tmp-s+4080) - sprintf(s, ";$Domain=\"%s\"", q->domain); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie: %s\n", tmp)); - if ((soap->error = soap->fposthdr(soap, "Cookie", tmp))) - return soap->error; + if (q->domain) + { sprintf(s, ";$Domain=\"%s\"", q->domain); + s += strlen(s); + } } p = &q->next; } } + if (s != tmp) + if ((soap->error = soap->fposthdr(soap, "Cookie", tmp))) + return soap->error; return SOAP_OK; } @@ -6322,7 +6452,7 @@ soap_getcookies(struct soap *soap, const char *val) p->secure = 1; else { if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->expire, p->secure)); if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) { q->version = p->version; q->expire = p->expire; @@ -6374,7 +6504,7 @@ soap_getcookies(struct soap *soap, const char *val) } } if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"(null)", p->domain?p->domain:"(null)", p->path?p->path:"(null)", p->expire, p->secure)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got environment cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value ? p->value : "(null)", p->domain ? p->domain : "(null)", p->path ? p->path : "(null)", p->expire, p->secure)); if ((q = soap_set_cookie(soap, p->name, p->value, p->domain, p->path))) { q->version = p->version; q->expire = p->expire; @@ -6506,30 +6636,10 @@ soap_init_pht(struct soap *soap) SOAP_FMAC1 struct soap* SOAP_FMAC2 -soap_new1(soap_mode mode) -{ return soap_new2(mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new() -{ return soap_new2(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new2(soap_mode imode, soap_mode omode) +soap_versioning(soap_new)(soap_mode imode, soap_mode omode) { struct soap *soap = (struct soap*)malloc(sizeof(struct soap)); if (soap) - soap_init2(soap, imode, omode); + soap_versioning(soap_init)(soap, imode, omode); return soap; } #endif @@ -6597,6 +6707,7 @@ soap_embed(struct soap *soap, const void *p, const struct soap_array *a, int n, soap_set_embedded(soap, pp); } return i; + (void)soap; } #endif #endif @@ -6649,7 +6760,7 @@ soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, h = soap_hash_ptr(a->__ptr); else h = soap_hash_ptr(p); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a?a->__ptr:NULL, a?a->__size:0, n, type, soap->idnum+1)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pointer enter location=%p array=%p size=%d dim=%d type=%d id=%d\n", p, a ? a->__ptr : NULL, a ? a->__size : 0, n, type, soap->idnum+1)); pp->next = soap->pht[h]; pp->type = type; pp->mark1 = 0; @@ -6659,6 +6770,7 @@ soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, soap->pht[h] = pp; pp->id = ++soap->idnum; return pp->id; + (void)n; } #endif #endif @@ -6747,6 +6859,7 @@ soap_begin_count(struct soap *soap) soap->encoding = 0; soap->part = SOAP_BEGIN; soap->event = 0; + soap->evlev = 0; soap->idnum = 0; soap_clr_attr(soap); soap_set_local_namespaces(soap); @@ -6829,7 +6942,7 @@ soap_begin_send(struct soap *soap) #ifdef WIN32 #ifndef UNDER_CE #ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */ + if (!soap_valid_socket(soap->socket) && !soap->os) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */ #ifdef __BORLANDC__ setmode(soap->sendfd, _O_BINARY); #else @@ -7084,7 +7197,7 @@ soap_attachment(struct soap *soap, const char *tag, int id, const void *p, const int i; if (!p || !a->__ptr || (!aid && !atype)) return soap_element_id(soap, tag, id, p, a, n, type, t); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid?aid:SOAP_STR_EOS, id, atype?atype:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Attachment tag='%s' id='%s' (%d) type='%s'\n", tag, aid ? aid : SOAP_STR_EOS, id, atype ? atype : SOAP_STR_EOS)); i = soap_array_pointer_lookup(soap, p, a, n, t, &pp); if (!i) { i = soap_pointer_enter(soap, p, a, n, t, &pp); @@ -7213,7 +7326,7 @@ soap_enter(struct soap *soap, const char *id) ip = (struct soap_ilist*)SOAP_MALLOC(soap, sizeof(struct soap_ilist) + strlen(id)); if (ip) { h = soap_hash(id); - strcpy(ip->id, id); + strcpy((char*)ip->id, id); ip->next = soap->iht[h]; soap->iht[h] = ip; } @@ -7400,13 +7513,16 @@ soap_dealloc(struct soap *soap, void *p) SOAP_FREE(soap, q); } /* we must assume these were deallocated: */ + soap->http_content = NULL; soap->action = NULL; soap->fault = NULL; soap->header = NULL; soap->userid = NULL; soap->passwd = NULL; soap->authrealm = NULL; - soap->http_content = NULL; +#ifdef WITH_NTLM + soap->ntlm_challenge = NULL; +#endif #ifndef WITH_LEANER soap_clr_mime(soap); #endif @@ -7537,32 +7653,33 @@ soap_link(struct soap *soap, void *p, int t, int n, int (*fdelete)(struct soap_c /******************************************************************************/ #ifndef PALM_2 SOAP_FMAC1 -void +int SOAP_FMAC2 soap_unlink(struct soap *soap, const void *p) { register char **q; register struct soap_clist **cp; - if (!soap || !p) - return; - for (q = (char**)&soap->alist; *q; q = *(char***)q) - { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) - { *q = **(char***)q; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p)); + if (soap && p) + { for (q = (char**)&soap->alist; *q; q = *(char***)q) + { if (p == (void*)(*q - *(size_t*)(*q + sizeof(void*)))) + { *q = **(char***)q; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked data %p\n", p)); #ifdef SOAP_MEM_DEBUG - soap_track_unlink(soap, p); + soap_track_unlink(soap, p); #endif - return; + return SOAP_OK; /* found and removed from dealloc chain */ + } } - } - for (cp = &soap->clist; *cp; cp = &(*cp)->next) - { if (p == (*cp)->ptr) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked class instance %p\n", p)); - q = (char**)*cp; - *cp = (*cp)->next; - SOAP_FREE(soap, q); - return; + for (cp = &soap->clist; *cp; cp = &(*cp)->next) + { if (p == (*cp)->ptr) + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unlinked class instance %p\n", p)); + q = (char**)*cp; + *cp = (*cp)->next; + SOAP_FREE(soap, q); + return SOAP_OK; /* found and removed from dealloc chain */ + } } } + return SOAP_ERR; } #endif @@ -7802,6 +7919,7 @@ SOAP_FMAC2 soap_fcopy(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Copying data type=%d (target type=%d) %p -> %p (%lu bytes)\n", st, tt, q, p, (unsigned long)n)); memcpy(p, q, n); + (void)soap; (void)st; (void)tt; (void)len; } #endif @@ -7867,7 +7985,7 @@ soap_end_send(struct soap *soap) soap->mode &= ~SOAP_ENC_ZLIB; soap->zlib_state = SOAP_ZLIB_NONE; if (deflateEnd(soap->d_stream) != Z_OK || r != Z_STREAM_END) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS)); return soap->error = SOAP_ZLIB_ERROR; } #ifdef WITH_GZIP @@ -8004,7 +8122,7 @@ soap_end_recv(struct soap *soap) for (i = 0; i < 8; i++) { if ((int)(c = soap_get1(soap)) == EOF) { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: unable to read crc value\n")); - return soap->error = SOAP_EOF; + return soap->error = SOAP_ZLIB_ERROR; } soap->z_buf[i] = (char)c; } @@ -8232,6 +8350,7 @@ soap_copy_context(struct soap *copy, const struct soap *soap) return NULL; if (copy) { register struct soap_plugin *p = NULL; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying context\n")); #ifdef __cplusplus *copy = *soap; #else @@ -8241,6 +8360,9 @@ soap_copy_context(struct soap *copy, const struct soap *soap) copy->error = SOAP_OK; copy->userid = NULL; copy->passwd = NULL; +#ifdef WITH_NTLM + copy->ntlm_challenge = NULL; +#endif copy->nlist = NULL; copy->blist = NULL; copy->clist = NULL; @@ -8260,8 +8382,18 @@ soap_copy_context(struct soap *copy, const struct soap *soap) soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); #endif + copy->namespaces = NULL; + copy->local_namespaces = NULL; + if (soap->local_namespaces) + soap_set_namespaces(copy, soap->local_namespaces); + else + soap_set_namespaces(copy, soap->namespaces); #ifdef WITH_C_LOCALE +# ifdef WIN32 + copy->c_locale = _create_locale(LC_ALL, "C"); +# else copy->c_locale = duplocale(soap->c_locale); +# endif #else copy->c_locale = NULL; #endif @@ -8326,7 +8458,10 @@ soap_copy_stream(struct soap *copy, struct soap *soap) copy->mode = soap->mode; copy->imode = soap->imode; copy->omode = soap->omode; + copy->master = soap->master; copy->socket = soap->socket; + copy->sendsk = soap->sendsk; + copy->recvsk = soap->recvsk; copy->recv_timeout = soap->recv_timeout; copy->send_timeout = soap->send_timeout; #if defined(__cplusplus) && !defined(WITH_LEAN) @@ -8350,23 +8485,27 @@ soap_copy_stream(struct soap *copy, struct soap *soap) #ifndef WITH_NOIO copy->peer = soap->peer; copy->peerlen = soap->peerlen; + copy->ip = soap->ip; + copy->port = soap->port; + memcpy(copy->host, soap->host, sizeof(soap->host)); + memcpy(copy->endpoint, soap->endpoint, sizeof(soap->endpoint)); #endif #ifdef WITH_OPENSSL - copy->bio = NULL; - copy->ctx = NULL; - copy->ssl = NULL; - if (soap->ssl) - copy->ssl = SSL_dup(soap->ssl); + copy->bio = soap->bio; + copy->ctx = soap->ctx; + copy->ssl = soap->ssl; #endif #ifdef WITH_GNUTLS - copy->session = soap->session; /* TODO: Oops, GNUTLS provides a dup? */ + copy->session = soap->session; #endif #ifdef WITH_ZLIB copy->zlib_state = soap->zlib_state; copy->zlib_in = soap->zlib_in; copy->zlib_out = soap->zlib_out; - copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); - memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream)); + if (!copy->d_stream) + copy->d_stream = (z_stream*)SOAP_MALLOC(copy, sizeof(z_stream)); + if (copy->d_stream) + memcpy(copy->d_stream, soap->d_stream, sizeof(z_stream)); copy->z_crc = soap->z_crc; copy->z_ratio_in = soap->z_ratio_in; copy->z_ratio_out = soap->z_ratio_out; @@ -8375,7 +8514,8 @@ soap_copy_stream(struct soap *copy, struct soap *soap) copy->z_level = soap->z_level; if (soap->z_buf && soap->zlib_state != SOAP_ZLIB_NONE) { copy->z_buf = (char*)SOAP_MALLOC(copy, SOAP_BUFLEN); - memcpy(copy->z_buf, soap->z_buf, sizeof(soap->z_buf)); + if (copy->z_buf) + memcpy(copy->z_buf, soap->z_buf, SOAP_BUFLEN); } copy->z_dict = soap->z_dict; copy->z_dict_len = soap->z_dict_len; @@ -8411,10 +8551,18 @@ soap_copy_stream(struct soap *copy, struct soap *soap) SOAP_FREE(copy, nq); } } - copy->level = soap->level; + memcpy(copy->tag, soap->tag, sizeof(copy->tag)); + memcpy(copy->id, soap->id, sizeof(copy->id)); + memcpy(copy->href, soap->href, sizeof(copy->href)); + memcpy(copy->type, soap->type, sizeof(copy->type)); + copy->other = soap->other; + copy->root = soap->root; + copy->null = soap->null; copy->body = soap->body; + copy->part = soap->part; + copy->mustUnderstand = soap->mustUnderstand; + copy->level = soap->level; copy->peeked = soap->peeked; - memcpy(copy->tag, soap->tag, sizeof(copy->tag)); /* copy attributes */ for (tq = soap->attributes; tq; tq = tq->next) { struct soap_attribute *tr = tp; @@ -8440,24 +8588,22 @@ void SOAP_FMAC2 soap_free_stream(struct soap *soap) { soap->socket = SOAP_INVALID_SOCKET; + soap->sendsk = SOAP_INVALID_SOCKET; + soap->recvsk = SOAP_INVALID_SOCKET; #ifdef WITH_OPENSSL soap->bio = NULL; - if (soap->ssl) - SSL_free(soap->ssl); + soap->ctx = NULL; soap->ssl = NULL; #endif #ifdef WITH_GNUTLS soap->xcred = NULL; soap->acred = NULL; soap->cache = NULL; - soap->session = NULL; /* TODO: GNUTLS free here when dupped */ + soap->session = NULL; soap->dh_params = NULL; soap->rsa_params = NULL; #endif #ifdef WITH_ZLIB - if (soap->d_stream) - SOAP_FREE(soap, soap->d_stream); - soap->d_stream = NULL; if (soap->z_buf) SOAP_FREE(soap, soap->z_buf); soap->z_buf = NULL; @@ -8470,7 +8616,7 @@ soap_free_stream(struct soap *soap) SOAP_FMAC1 void SOAP_FMAC2 -soap_init(struct soap *soap) +soap_versioning(soap_init)(struct soap *soap, soap_mode imode, soap_mode omode) { size_t i; soap->state = SOAP_INIT; #ifdef SOAP_MEM_DEBUG @@ -8480,7 +8626,7 @@ soap_init(struct soap *soap) soap_init_logs(soap); #endif #ifdef SOAP_DEBUG -#ifdef TANDEM +#ifdef TANDEM_NONSTOP soap_set_test_logfile(soap, "TESTLOG"); soap_set_sent_logfile(soap, "SENTLOG"); soap_set_recv_logfile(soap, "RECVLOG"); @@ -8491,21 +8637,26 @@ soap_init(struct soap *soap) #endif #endif soap->version = 0; - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); + soap_mode(soap, imode); + soap_imode(soap, imode); + soap_omode(soap, omode); soap->plugins = NULL; soap->user = NULL; for (i = 0; i < sizeof(soap->data)/sizeof(*soap->data); i++) soap->data[i] = NULL; soap->userid = NULL; soap->passwd = NULL; + soap->authrealm = NULL; +#ifdef WITH_NTLM + soap->ntlm_challenge = NULL; +#endif #ifndef WITH_NOHTTP soap->fpost = http_post; - soap->fput = http_put; soap->fget = http_get; + soap->fput = http_405; soap->fdel = http_405; - soap->fopt = http_405; - soap->fhead = http_405; + soap->fopt = http_200; + soap->fhead = http_200; soap->fform = NULL; soap->fposthdr = http_post_header; soap->fresponse = http_response; @@ -8611,6 +8762,8 @@ soap_init(struct soap *soap) soap->fault = NULL; soap->master = SOAP_INVALID_SOCKET; soap->socket = SOAP_INVALID_SOCKET; + soap->sendsk = SOAP_INVALID_SOCKET; + soap->recvsk = SOAP_INVALID_SOCKET; soap->os = NULL; soap->is = NULL; #ifndef WITH_LEANER @@ -8639,7 +8792,6 @@ soap_init(struct soap *soap) soap->proxy_port = 8080; soap->proxy_userid = NULL; soap->proxy_passwd = NULL; - soap->authrealm = NULL; soap->prolog = NULL; #ifdef WITH_ZLIB soap->zlib_state = SOAP_ZLIB_NONE; @@ -8709,7 +8861,11 @@ soap_init(struct soap *soap) soap->rsa_params = NULL; #endif #ifdef WITH_C_LOCALE +# ifdef WIN32 + soap->c_locale = _create_locale(LC_ALL, "C"); +# else soap->c_locale = newlocale(LC_ALL_MASK, "C", NULL); +# endif #else soap->c_locale = NULL; #endif @@ -8726,6 +8882,7 @@ soap_init(struct soap *soap) soap->ns = 0; soap->part = SOAP_END; soap->event = 0; + soap->evlev = 0; soap->alloced = 0; soap->count = 0; soap->length = 0; @@ -8740,28 +8897,6 @@ soap_init(struct soap *soap) #endif /******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init1(struct soap *soap, soap_mode mode) -{ soap_init2(soap, mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init2(struct soap *soap, soap_mode imode, soap_mode omode) -{ soap_init(soap); - soap_imode(soap, imode); - soap_omode(soap, omode); -} -#endif - -/******************************************************************************/ #ifndef PALM_2 SOAP_FMAC1 void @@ -8772,7 +8907,6 @@ soap_begin(struct soap *soap) { soap->buflen = 0; soap->bufidx = 0; } - soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); soap->null = 0; soap->position = 0; soap->encoding = 0; @@ -8781,6 +8915,7 @@ soap_begin(struct soap *soap) soap->ns = 0; soap->part = SOAP_END; soap->event = 0; + soap->evlev = 0; soap->alloced = 0; soap->count = 0; soap->length = 0; @@ -8903,6 +9038,8 @@ soap_set_local_namespaces(struct soap *soap) soap->version = 2; } soap->local_namespaces = ns2; + for (; ns2->id; ns2++) + ns2->out = NULL; } } } @@ -8976,7 +9113,7 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized) return NULL; } } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns ? ns : "(null)", utilized)); n = strlen(id); if (ns) k = strlen(ns); @@ -8989,9 +9126,9 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized) } np->next = soap->nlist; soap->nlist = np; - strcpy(np->id, id); + strcpy((char*)np->id, id); if (ns) - np->ns = strcpy(np->id + n + 1, ns); + np->ns = strcpy((char*)np->id + n + 1, ns); else np->ns = NULL; np->level = soap->level; @@ -9003,8 +9140,13 @@ soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized) /******************************************************************************/ #ifndef WITH_LEAN static void -soap_utilize_ns(struct soap *soap, const char *tag, size_t n) -{ register struct soap_nlist *np = soap_lookup_ns(soap, tag, n); +soap_utilize_ns(struct soap *soap, const char *tag) +{ register struct soap_nlist *np; + size_t n = 0; + const char *t = strchr(tag, ':'); + if (t) + n = t - tag; + np = soap_lookup_ns(soap, tag, n); DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Utilizing namespace of '%s'\n", tag)); if (np) { if (np->index == 0) @@ -9028,7 +9170,8 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) #ifndef WITH_LEAN register const char *s; #endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' level='%u' id='%d' type='%s'\n", tag, soap->level, id, type ? type : SOAP_STR_EOS)); + soap->level++; #ifdef WITH_DOM #ifndef WITH_LEAN if (soap->wsuid && soap_tagsearch(soap->wsuid, tag)) @@ -9039,12 +9182,20 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) if (soap_set_attr(soap, "wsu:Id", soap->tag, 1)) return soap->error; } - if (soap->event == SOAP_SEC_BEGIN && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS)) - { register struct soap_nlist *np; - /* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */ - for (np = soap->nlist; np; np = np->next) - { if (np->index == 2) - np->index = 0; + if ((soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS)) + { if (soap->evlev >= soap->level) + soap->evlev = 0; + if (soap->event == SOAP_SEC_BEGIN && !soap->evlev) + { register struct soap_nlist *np; + /* non-nested wsu:Id found: clear xmlns, re-emit them for exc-c14n */ + for (np = soap->nlist; np; np = np->next) + { if (np->index == 2) + { struct soap_nlist *np1 = soap_push_ns(soap, np->id, np->ns, 1); + if (np1) + np1->index = 0; + } + } + soap->evlev = soap->level; } } #endif @@ -9080,7 +9231,6 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) else { #endif - soap->level++; #ifndef WITH_LEAN if (!soap->ns) { if (!(soap->mode & SOAP_XML_CANONICAL) @@ -9135,26 +9285,30 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) soap->ns = 1; /* namespace table control: ns = 0 or 2 to start, then 1 to stop dumping the table */ #ifndef WITH_LEAN if (soap->mode & SOAP_XML_CANONICAL) - { const char *t = strchr(tag, ':'); - if (t) - soap_utilize_ns(soap, tag, t - tag); - } + soap_utilize_ns(soap, tag); #endif if (id > 0) { sprintf(soap->tmpbuf, "_%d", id); if (soap_attribute(soap, "id", soap->tmpbuf)) return soap->error; } - if (type && *type && soap->part != SOAP_IN_HEADER) /* TODO: filter Header? */ - { if (soap_attribute(soap, "xsi:type", type)) - return soap->error; + if (type && *type && !(soap->mode & SOAP_XML_NOTYPE) && soap->part != SOAP_IN_HEADER) + { const char *t = type; #ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { const char *t = strchr(type, ':'); + if (soap->mode & SOAP_XML_DEFAULTNS) + { t = strchr(type, ':'); if (t) - soap_utilize_ns(soap, type, t - type); + t++; + else + t = type; } #endif + if (soap->attributes ? soap_set_attr(soap, "xsi:type", t, 1) : soap_attribute(soap, "xsi:type", t)) + return soap->error; +#ifndef WITH_LEAN + if (soap->mode & SOAP_XML_CANONICAL) + soap_utilize_ns(soap, type); +#endif } if (soap->null && soap->position > 0) { register int i; @@ -9189,8 +9343,8 @@ soap_element(struct soap *soap, const char *tag, int id, const char *type) } soap->null = 0; soap->position = 0; - if (soap->event == SOAP_SEC_BEGIN && (soap->mode & SOAP_XML_CANONICAL)) - soap->event = SOAP_SEC_SIGN; + if (soap->event == SOAP_SEC_BEGIN) + soap->event = 0; return SOAP_OK; } #endif @@ -9358,10 +9512,7 @@ soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *typ } #ifndef WITH_LEAN if ((soap->mode & SOAP_XML_CANONICAL)) - { const char *s = strchr(type, ':'); - if (s) - soap_utilize_ns(soap, type, s - type); - } + soap_utilize_ns(soap, type); #endif return soap_element_start_end_out(soap, NULL); } @@ -9379,14 +9530,11 @@ soap_element_start_end_out(struct soap *soap, const char *tag) { struct soap_nlist *np; for (tp = soap->attributes; tp; tp = tp->next) { if (tp->visible && tp->name) - { const char *s = strchr(tp->name, ':'); - if (s) - soap_utilize_ns(soap, tp->name, s - tp->name); - } + soap_utilize_ns(soap, tp->name); } for (np = soap->nlist; np; np = np->next) { if (np->index == 1 && np->ns) - { sprintf(soap->tmpbuf, "xmlns:%s", np->id); + { sprintf(soap->tmpbuf, *(np->id) ? "xmlns:%s" : "xmlns", np->id); DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns)); soap_set_attr(soap, soap->tmpbuf, np->ns, 1); np->index = 2; @@ -9636,6 +9784,7 @@ soap_check_result(struct soap *soap, const char *tag) { soap_instring(soap, ":result", NULL, NULL, 0, 2, -1, -1); /* just ignore content for compliance reasons, but should compare tag to element's QName value? */ } + (void)tag; } #endif @@ -9664,16 +9813,9 @@ soap_attribute(struct soap *soap, const char *name, const char *value) #endif #ifndef WITH_LEAN if (soap->mode & SOAP_XML_CANONICAL) - { /* TODO: consider using this code to handle default namespace bindings + { /* push namespace */ if (!strncmp(name, "xmlns", 5) && (name[5] == ':' || name[5] == '\0')) - { if (name[5] == ':') - soap_push_ns(soap, name + 6, value, 0); - else - soap_push_ns(soap, "", value, 0); - } - */ - if (!strncmp(name, "xmlns:", 6)) - soap_push_ns(soap, name + 6, value, 0); + soap_push_ns(soap, name + 5 + (name[5] == ':'), value, 0); else if (soap_set_attr(soap, name, value, 1)) return soap->error; } @@ -9710,7 +9852,8 @@ soap_element_begin_in(struct soap *soap, const char *tag, int nillable, const ch return soap->error = SOAP_NULL; if (soap->body) soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS )); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag ? tag : SOAP_STR_EOS )); + soap->error = SOAP_OK; } } else if (soap->error == SOAP_NO_TAG && tag && *tag == '-') @@ -9749,7 +9892,7 @@ soap_element_end_in(struct soap *soap, const char *tag) do { while (((c = soap_get(soap)) != SOAP_TT)) { if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; if (c == SOAP_LT) n++; else if (c == '/') @@ -9769,7 +9912,7 @@ soap_element_end_in(struct soap *soap, const char *tag) } *s = '\0'; if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; while (soap_blank(c)) c = soap_get(soap); if (c != SOAP_GT) @@ -9784,12 +9927,12 @@ soap_element_end_in(struct soap *soap, const char *tag) if (tag && (soap->mode & SOAP_XML_STRICT)) { soap_pop_namespace(soap); if (soap_match_tag(soap, soap->tag, tag)) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag '%s' does not match '%s'\n", soap->tag, tag?tag:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag '%s' does not match '%s'\n", soap->tag, tag ? tag : SOAP_STR_EOS)); return soap->error = SOAP_SYNTAX_ERROR; } } #endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag ? tag : SOAP_STR_EOS)); soap->level--; return SOAP_OK; } @@ -9831,7 +9974,7 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag) { register struct soap_attribute *tp; if (*name == '-') return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value ? value : SOAP_STR_EOS)); for (tp = soap->attributes; tp; tp = tp->next) { if (!strcmp(tp->name, name)) break; @@ -9883,7 +10026,7 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag) { tp->next = soap->attributes; soap->attributes = tp; } - strcpy(tp->name, name); + strcpy((char*)tp->name, name); tp->value = NULL; } else if (tp->visible) @@ -9906,9 +10049,9 @@ soap_set_attr(struct soap *soap, const char *name, const char *value, int flag) if (!strncmp(tp->name, "xmlns:", 6)) tp->ns = tp->value; tp->visible = 2; - tp->flag = flag; + tp->flag = (short)flag; #ifndef WITH_LEAN - if (soap->event != SOAP_SEC_SIGN && !strcmp(name, "wsu:Id")) + if (!strcmp(name, "wsu:Id")) { soap->event = SOAP_SEC_BEGIN; strncpy(soap->id, value, sizeof(soap->id)); soap->id[sizeof(soap->id)-1] = '\0'; @@ -9996,7 +10139,7 @@ soap_getattrval(struct soap *soap, char *s, size_t n, soap_wchar d) } default: if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; *s++ = (char)c; } } @@ -10085,8 +10228,19 @@ soap_peek_element(struct soap *soap) soap->position = 0; soap->null = 0; soap->mustUnderstand = 0; - /* skip BOM */ - if ((c = soap_getchar(soap)) != 0xEF || (c = soap_get1(soap)) != 0xBB || (c = soap_get1(soap)) != 0xBF) + /* UTF-8 BOM? */ + c = soap_getchar(soap); + if (c == 0xEF && soap_get0(soap) == 0xBB) + { c = soap_get1(soap); + if ((c = soap_get1(soap)) == 0xBF) + soap->mode &= ~SOAP_ENC_LATIN; + else + soap_unget(soap, (0x0F << 12) | (0xBB << 6) | (c & 0x3F)); /* UTF-8 */ + } + else if ((c == 0xFE && soap_get0(soap) == 0xFF) /* UTF-16 BE */ + || (c == 0xFF && soap_get0(soap) == 0xFE)) /* UTF-16 LE */ + return soap->error = SOAP_UTF_ERROR; + else soap_unget(soap, c); c = soap_get(soap); #ifdef WITH_DOM @@ -10116,7 +10270,7 @@ soap_peek_element(struct soap *soap) if (c != SOAP_LT) { *soap->tag = '\0'; if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; soap_unget(soap, c > 0 ? c | 0x80000000 : c); #ifdef WITH_DOM /* whitespace leading to end tag is significant for DOM */ @@ -10221,7 +10375,7 @@ soap_peek_element(struct soap *soap) { tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(soap->tmpbuf)); if (!tp) return soap->error = SOAP_EOM; - strcpy(tp->name, soap->tmpbuf); + strcpy((char*)tp->name, soap->tmpbuf); tp->value = NULL; tp->size = 0; tp->ns = NULL; @@ -10254,6 +10408,7 @@ soap_peek_element(struct soap *soap) return soap->error; if (tp->value) SOAP_FREE(soap, tp->value); + tp->value = NULL; for (;;) { if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c)) { if (soap->error != SOAP_EOM) @@ -10333,7 +10488,7 @@ soap_peek_element(struct soap *soap) } #endif if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; if (!(soap->body = (c != '/'))) do c = soap_get1(soap); while (soap_blank(c)); @@ -10342,8 +10497,6 @@ soap_peek_element(struct soap *soap) { if (!soap->body && soap->dom->prnt) soap->dom = soap->dom->prnt; } - if (soap->feltbegin) - return soap->error = soap->feltbegin(soap, soap->tag); #endif for (tp = soap->attributes; tp; tp = tp->next) { if (tp->visible && tp->value) @@ -10436,6 +10589,10 @@ soap_peek_element(struct soap *soap) } } } +#ifdef WITH_DOM + if (soap->feltbegin) + return soap->error = soap->feltbegin(soap, soap->tag); +#endif return soap->error = SOAP_OK; } #endif @@ -10536,7 +10693,7 @@ soap_string_out(struct soap *soap, const char *s, int flag) if (soap->mode & SOAP_C_MBSTRING) { wchar_t wc; register int m = mbtowc(&wc, t - 1, MB_CUR_MAX); - if (m > 0 && (soap_wchar)wc != c) + if (m > 0 && !((soap_wchar)wc == c && m == 1 && c < 0x80)) { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, wc)) return soap->error; s = t += m - 1; @@ -10649,11 +10806,11 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) if ((int)c == EOF) goto end; if ((c >= 0x80 || c < SOAP_AP) && state != 1 && !(soap->mode & SOAP_ENC_LATIN)) - { if (c >= 0x80) + { if ((c & 0x7FFFFFFF) >= 0x80) { soap_unget(soap, c); c = soap_getutf8(soap); } - if (soap->mode & SOAP_C_UTFSTRING) + if ((c & 0x7FFFFFFF) >= 0x80 && (soap->mode & SOAP_C_UTFSTRING)) { c &= 0x7FFFFFFF; t = buf; if (c < 0x0800) @@ -10688,17 +10845,17 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) { case 1: if (c == ']') state = 4; - *s++ = c; + *s++ = (char)c; continue; case 2: if (c == '-') state = 6; - *s++ = c; + *s++ = (char)c; continue; case 3: if (c == '?') state = 8; - *s++ = c; + *s++ = (char)c; continue; /* CDATA */ case 4: @@ -10706,14 +10863,14 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) state = 5; else state = 1; - *s++ = c; + *s++ = (char)c; continue; case 5: if (c == '>') state = 0; else state = 1; - *s++ = c; + *s++ = (char)c; continue; /* comment */ case 6: @@ -10721,14 +10878,14 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) state = 7; else state = 2; - *s++ = c; + *s++ = (char)c; continue; case 7: if (c == '>') state = 0; else state = 2; - *s++ = c; + *s++ = (char)c; continue; /* PI */ case 8: @@ -10736,7 +10893,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) state = 0; else state = 3; - *s++ = c; + *s++ = (char)c; continue; } switch (c) @@ -10830,7 +10987,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) #ifndef WITH_LEANER #ifdef HAVE_WCTOMB if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); + { m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF)); if (m >= 1 && m <= (int)MB_CUR_MAX) { t = buf; *s++ = *t++; @@ -11001,7 +11158,7 @@ soap_string_in(struct soap *soap, int flag, long minlen, long maxlen) #ifndef WITH_LEANER #ifdef HAVE_WCTOMB if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); + { m = wctomb(buf, (wchar_t)(c & 0x7FFFFFFF)); if (m >= 1 && m <= (int)MB_CUR_MAX) { t = buf; *s++ = *t++; @@ -11266,7 +11423,7 @@ soap_wstring_in(struct soap *soap, int flag, long minlen, long maxlen) if ((int)c == EOF) goto end; if (sizeof(wchar_t) < 4 && c > 0xFFFF) - { wchar_t c1, c2; + { soap_wchar c1, c2; /* http://unicode.org/faq/utf_bom.html#utf16-2 */ c1 = 0xD800 - (0x10000 >> 10) + (c >> 10); c2 = 0xDC00 + (c & 0x3FF); @@ -11511,7 +11668,7 @@ soap_s2LONG64(struct soap *soap, const char *s, LONG64 *p) soap_reset_errno; #endif #endif - *p = strtoll(s, &r, 10); + *p = soap_strtoll(s, &r, 10); if (s == r || *r #ifndef WITH_NOIO #ifndef WITH_LEAN @@ -11726,7 +11883,11 @@ soap_float2s(struct soap *soap, float n) return "-INF"; s = soap->tmpbuf; #if defined(HAVE_SPRINTF_L) +# ifdef WIN32 + _sprintf_s_l(s, _countof(soap->tmpbuf), soap->float_format, soap->c_locale, n); +# else sprintf_l(s, soap->c_locale, soap->float_format, n); +# endif #else sprintf(s, soap->float_format, n); s = strchr(s, ','); /* convert decimal comma to DP */ @@ -11772,7 +11933,11 @@ soap_s2float(struct soap *soap, const char *s, float *p) /* On some systems strtof requires -std=c99 or does not even link: so we try to use strtod first */ #if defined(HAVE_STRTOD_L) char *r; +# ifdef WIN32 + *p = (float)_strtod_l(s, &r, soap->c_locale); +# else *p = (float)strtod_l(s, &r, soap->c_locale); +# endif if (*r) #elif defined(HAVE_STRTOD) char *r; @@ -11872,7 +12037,11 @@ soap_double2s(struct soap *soap, double n) return "-INF"; s = soap->tmpbuf; #if defined(HAVE_SPRINTF_L) +# ifdef WIN32 + _sprintf_s_l(s, _countof(soap->tmpbuf), soap->double_format, soap->c_locale, n); +# else sprintf_l(s, soap->c_locale, soap->double_format, n); +# endif #else sprintf(s, soap->double_format, n); s = strchr(s, ','); /* convert decimal comma to DP */ @@ -11917,7 +12086,11 @@ soap_s2double(struct soap *soap, const char *s, double *p) { #if defined(HAVE_STRTOD_L) char *r; +# ifdef WIN32 + *p = _strtod_l(s, &r, soap->c_locale); +# else *p = strtod_l(s, &r, soap->c_locale); +# endif if (*r) #elif defined(HAVE_STRTOD) char *r; @@ -12313,7 +12486,7 @@ soap_s2ULONG64(struct soap *soap, const char *s, ULONG64 *p) soap_reset_errno; #endif #endif - *p = strtoull(s, &r, 10); + *p = soap_strtoull(s, &r, 10); if ((s == r && (soap->mode & SOAP_XML_STRICT)) || *r #ifndef WITH_NOIO #ifndef WITH_LEAN @@ -12414,7 +12587,7 @@ soap_s2QName(struct soap *soap, const char *s, char **t, long minlen, long maxle break; /* find next QName */ n = 1; - while (s[n] && !soap_blank(s[n])) + while (s[n] && !soap_blank((soap_wchar)s[n])) n++; np = soap->nlist; /* if there is no namespace stack, or prefix is "xml" then copy string */ @@ -12455,7 +12628,7 @@ soap_s2QName(struct soap *soap, const char *s, char **t, long minlen, long maxle soap_append_lab(soap, "\"", 1); } else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:SOAP_STR_EOS)); + { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "\nNamespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns ? np->ns : SOAP_STR_EOS)); return soap->error = SOAP_NAMESPACE; } } @@ -12506,10 +12679,7 @@ soap_QName2s(struct soap *soap, const char *s) { soap_append_lab(soap, s, n); #ifndef WITH_LEAN if ((soap->mode & SOAP_XML_CANONICAL)) - { const char *r = strchr(s, ':'); - if (r) - soap_utilize_ns(soap, s, r - s); - } + soap_utilize_ns(soap, s); #endif } else /* URL-based string prefix */ @@ -12688,7 +12858,8 @@ SOAP_FMAC1 char ** SOAP_FMAC2 soap_instring(struct soap *soap, const char *tag, char **p, const char *type, int t, int flag, long minlen, long maxlen) -{ if (soap_element_begin_in(soap, tag, 1, NULL)) +{ (void)type; + if (soap_element_begin_in(soap, tag, 1, NULL)) { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) return NULL; soap->error = SOAP_OK; @@ -12754,7 +12925,8 @@ SOAP_FMAC1 wchar_t ** SOAP_FMAC2 soap_inwstring(struct soap *soap, const char *tag, wchar_t **p, const char *type, int t, long minlen, long maxlen) -{ if (soap_element_begin_in(soap, tag, 1, NULL)) +{ (void)type; + if (soap_element_begin_in(soap, tag, 1, NULL)) { if (!tag || *tag != '-' || soap->error != SOAP_NO_TAG) return NULL; soap->error = SOAP_OK; @@ -13217,7 +13389,7 @@ soap_getline(struct soap *soap, char *s, int len) if (c == '\r' || c == '\n') break; if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; *s++ = (char)c; } if (c != '\n') @@ -13231,7 +13403,7 @@ soap_getline(struct soap *soap, char *s, int len) break; } else if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; if (i < 0) return soap->error = SOAP_HDR; } @@ -13346,7 +13518,7 @@ SOAP_FMAC2 soap_putdimehdr(struct soap *soap) { unsigned char tmp[12]; size_t optlen = 0, idlen = 0, typelen = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Put DIME header id='%s'\n", soap->dime.id ? soap->dime.id : SOAP_STR_EOS)); if (soap->dime.options) optlen = (((unsigned char)soap->dime.options[2] << 8) | ((unsigned char)soap->dime.options[3])) + 4; if (soap->dime.id) @@ -13442,7 +13614,7 @@ soap_putdime(struct soap *soap) bufsize = sizeof(soap->tmpbuf); if (!(bufsize = soap->fdimeread(soap, handle, soap->tmpbuf, bufsize))) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size)); - soap->error = SOAP_EOF; + soap->error = SOAP_CHK_EOF; break; } if (soap_send_raw(soap, soap->tmpbuf, bufsize)) @@ -13484,7 +13656,7 @@ soap_getdimefield(struct soap *soap, size_t n) { s = p; for (i = n; i > 0; i--) { if ((int)(c = soap_get1(soap)) == EOF) - { soap->error = SOAP_EOF; + { soap->error = SOAP_CHK_EOF; return NULL; } *s++ = (char)c; @@ -13518,7 +13690,7 @@ soap_getdimehdr(struct soap *soap) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get DIME header\n")); if (soap->dime.buflen || soap->dime.chunksize) { if (soap_move(soap, (long)(soap->dime.size - soap_tell(soap)))) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; soap_unget(soap, soap_getchar(soap)); /* skip padding and get hdr */ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... From chunked\n")); return SOAP_OK; @@ -13526,7 +13698,7 @@ soap_getdimehdr(struct soap *soap) s = (char*)tmp; for (i = 12; i > 0; i--) { if ((int)(c = soap_getchar(soap)) == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; *s++ = (char)c; } if ((tmp[0] & 0xF8) != SOAP_DIME_VERSION) @@ -13543,7 +13715,7 @@ soap_getdimehdr(struct soap *soap) return soap->error; if (!(soap->dime.type = soap_getdimefield(soap, typelen)) && soap->error) return soap->error; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id?soap->dime.id:SOAP_STR_EOS, soap->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "DIME id=%s, type=%s, options=%s\n", soap->dime.id ? soap->dime.id : SOAP_STR_EOS, soap->dime.type ? soap->dime.type : "", soap->dime.options ? soap->dime.options+4 : SOAP_STR_EOS)); if (soap->dime.flags & SOAP_DIME_ME) soap->mode &= ~SOAP_ENC_DIME; return SOAP_OK; @@ -13795,7 +13967,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle) return NULL; } } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:SOAP_STR_EOS, content->type?content->type:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id ? content->id : SOAP_STR_EOS, content->type ? content->type : SOAP_STR_EOS)); if (!content->ptr && soap_new_block(soap) == NULL) { soap->error = SOAP_EOM; return NULL; @@ -13816,7 +13988,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle) { if (!flag) { c = soap_get1(soap); if ((int)c == EOF) - { soap->error = SOAP_EOF; + { soap->error = SOAP_CHK_EOF; return NULL; } } @@ -13829,7 +14001,7 @@ soap_get_mime_attachment(struct soap *soap, void *handle) do c = soap_getchar(soap); while (c == *t++); if ((int)c == EOF) - { soap->error = SOAP_EOF; + { soap->error = SOAP_CHK_EOF; return NULL; } if (!*--t) @@ -13954,7 +14126,7 @@ int SOAP_FMAC2 soap_putmimehdr(struct soap *soap, struct soap_multipart *content) { const char *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type?content->type:SOAP_STR_EOS)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "MIME attachment type=%s\n", content->type ? content->type : SOAP_STR_EOS)); if (soap_send3(soap, "\r\n--", soap->mime.boundary, "\r\n")) return soap->error; if (content->type && soap_send3(soap, "Content-Type: ", content->type, "\r\n")) @@ -14245,7 +14417,7 @@ soap_getgziphdr(struct soap *soap) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Get gzip header\n")); for (i = 0; i < 9; i++) { if ((int)(c = soap_get1(soap) == EOF)) - return soap->error = SOAP_EOF; + return soap->error = SOAP_ZLIB_ERROR; if (i == 1 && c == 8) soap->z_dict = 0; if (i == 2) @@ -14254,7 +14426,7 @@ soap_getgziphdr(struct soap *soap) if (f & 0x04) /* FEXTRA */ { for (i = soap_get1(soap) | (soap_get1(soap) << 8); i; i--) { if ((int)soap_get1(soap) == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_ZLIB_ERROR; } } if (f & 0x08) /* skip FNAME */ @@ -14272,7 +14444,7 @@ soap_getgziphdr(struct soap *soap) c = soap_get1(soap); } if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_ZLIB_ERROR; return SOAP_OK; } #endif @@ -14292,7 +14464,10 @@ soap_begin_serve(struct soap *soap) } #endif soap_begin(soap); - if (soap_begin_recv(soap)) + if (soap_begin_recv(soap) + || soap_envelope_begin_in(soap) + || soap_recv_header(soap) + || soap_body_begin_in(soap)) { if (soap->error < SOAP_STOP) { #ifdef WITH_FASTCGI @@ -14303,10 +14478,6 @@ soap_begin_serve(struct soap *soap) } return soap_closesock(soap); } - if (soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap->error; return SOAP_OK; } #endif @@ -14317,7 +14488,7 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_begin_recv(struct soap *soap) -{ soap_wchar c; +{ register soap_wchar c; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing for input\n")); soap->error = SOAP_OK; soap->filterstop = SOAP_OK; @@ -14350,6 +14521,7 @@ soap_begin_recv(struct soap *soap) soap->header = NULL; soap->fault = NULL; soap->status = 0; + soap->fform = NULL; #ifndef WITH_LEANER soap->dom = NULL; soap->dime.chunksize = 0; @@ -14366,7 +14538,7 @@ soap_begin_recv(struct soap *soap) #ifdef WIN32 #ifndef UNDER_CE #ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) + if (!soap_valid_socket(soap->socket) && !soap->is) /* Set win32 stdout or soap->sendfd to BINARY, e.g. to support DIME */ #ifdef __BORLANDC__ setmode(soap->recvfd, _O_BINARY); #else @@ -14433,14 +14605,24 @@ soap_begin_recv(struct soap *soap) else #endif { /* skip BOM */ - if (c == 0xEF && (c = soap_getchar(soap)) == 0xBB && (c = soap_getchar(soap)) == 0xBF) - c = soap_getchar(soap); + if (c == 0xEF && soap_get0(soap) == 0xBB) + { c = soap_get1(soap); + if ((c = soap_get1(soap)) == 0xBF) + { soap->mode &= ~SOAP_ENC_LATIN; + c = soap_getchar(soap); + } + else + c = (0x0F << 12) | (0xBB << 6) | (c & 0x3F); /* UTF-8 */ + } + else if ((c == 0xFE && soap_get0(soap) == 0xFF) /* UTF-16 BE */ + || (c == 0xFF && soap_get0(soap) == 0xFE)) /* UTF-16 LE */ + return soap->error = SOAP_UTF_ERROR; /* skip space */ while (soap_blank(c)) c = soap_getchar(soap); } if ((int)c == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; soap_unget(soap, c); #ifndef WITH_NOHTTP /* if not XML or MIME/DIME/ZLIB, assume HTTP header */ @@ -14453,7 +14635,13 @@ soap_begin_recv(struct soap *soap) return soap->error; } if (soap->error == SOAP_STOP) + { if (soap->fform) + { soap->error = soap->fform(soap); + if (soap->error == SOAP_OK) + soap->error = SOAP_STOP; /* prevents further processing */ + } return soap->error; + } soap->mode = soap->imode; /* if imode is changed, effectuate */ soap->imode = m; /* restore imode */ #ifdef WITH_ZLIB @@ -14532,7 +14720,7 @@ soap_begin_recv(struct soap *soap) if (soap->mode & SOAP_ENC_MIME) { do /* skip preamble */ { if ((int)(c = soap_getchar(soap)) == EOF) - return soap->error = SOAP_EOF; + return soap->error = SOAP_CHK_EOF; } while (c != '-' || soap_get0(soap) != '-'); soap_unget(soap, c); if (soap_getmimehdr(soap)) @@ -14614,7 +14802,8 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_end_out(struct soap *soap) -{ if (soap_element_end_out(soap, "SOAP-ENV:Envelope") || soap_send_raw(soap, "\r\n", 2)) /* 2.8: always emit \r\n after SOAP Envelope */ +{ if (soap_element_end_out(soap, "SOAP-ENV:Envelope") + || soap_send_raw(soap, "\r\n", 2)) /* 2.8: always emit \r\n */ return soap->error; #ifndef WITH_LEANER if ((soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) @@ -14959,23 +15148,32 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi } else #endif + soap->action = soap_strdup(soap, action); if (soap->fopen && *soap->host) { if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap)) { soap->error = SOAP_OK; - soap->keep_alive = 0; /* to force close */ - soap->omode &= ~SOAP_IO_UDP; /* to force close */ - soap_closesock(soap); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); #ifndef WITH_LEAN if (!strncmp(endpoint, "soap.udp:", 9)) soap->omode |= SOAP_IO_UDP; + else #endif - soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); - if (soap->error) - return soap->error; - soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0); + { soap->keep_alive = 0; /* to force close */ + soap->omode &= ~SOAP_IO_UDP; /* to force close */ + } + soap_closesock(soap); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to '%s' host='%s' path='%s' port=%d\n", endpoint?endpoint:"(null)", soap->host, soap->path, soap->port)); + if (!soap->keep_alive || !soap_valid_socket(soap->socket)) + { soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); + if (soap->error) + return soap->error; + soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0); + } } } +#ifdef WITH_NTLM + if (soap_ntlm_handshake(soap, SOAP_GET, endpoint, soap->host, soap->port)) + return soap->error; +#endif count = soap_count_attachments(soap); if (soap_begin_send(soap)) return soap->error; @@ -14984,7 +15182,6 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi soap->mode |= SOAP_IO_BUFFER; } #ifndef WITH_NOHTTP - soap->action = soap_strdup(soap, action); if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML) && endpoint) { unsigned int k = soap->mode; soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB); @@ -15000,7 +15197,7 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi #endif soap->mode = k; } - if (http_command == SOAP_GET) + if (http_command == SOAP_GET || http_command == SOAP_DEL) return soap_end_send(soap); #endif return SOAP_OK; @@ -15008,6 +15205,80 @@ soap_try_connect_command(struct soap *soap, int http_command, const char *endpoi #endif /******************************************************************************/ +#ifdef WITH_NTLM +#ifndef PALM_1 +static int +soap_ntlm_handshake(struct soap *soap, int command, const char *endpoint, const char *host, int port) +{ /* requires libntlm from http://www.nongnu.org/libntlm/ */ + const char *userid = (soap->proxy_userid ? soap->proxy_userid : soap->userid); + const char *passwd = (soap->proxy_passwd ? soap->proxy_passwd : soap->passwd); + struct SOAP_ENV__Header *oldheader; + if (soap->ntlm_challenge && userid && passwd && soap->authrealm) + { tSmbNtlmAuthRequest req; + tSmbNtlmAuthResponse res; + tSmbNtlmAuthChallenge ch; + short k = soap->keep_alive; + size_t l = soap->length; + size_t c = soap->count; + soap_mode m = soap->mode, o = soap->omode; + int s = soap->status; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM '%s'\n", soap->ntlm_challenge)); + if (!*soap->ntlm_challenge) + { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM S->C Type 1: received NTLM authentication challenge from server\n")); + /* S -> C 401 Unauthorized + WWW-Authenticate: NTLM + */ + buildSmbNtlmAuthRequest(&req, userid, soap->authrealm); + soap->ntlm_challenge = soap_s2base64(soap, (unsigned char*)&req, NULL, SmbLength(&req)); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM C->S Type 2: sending NTLM authorization to server\nAuthorization: NTLM %s\n", soap->ntlm_challenge)); + /* C -> S GET ... + Authorization: NTLM TlRMTVNTUAABAAAAA7IAAAoACgApAAAACQAJACAAAABMSUdIVENJVFlVUlNBLU1JTk9S + */ + soap->omode = SOAP_IO_BUFFER; + if (soap_begin_send(soap)) + return soap->error; + soap->keep_alive = 1; + soap->status = command; + if (soap->fpost(soap, endpoint, host, port, soap->path, soap->action, 0) + || soap_end_send(soap)) + return soap->error; + soap->mode = m; + soap->keep_alive = k; + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM S->C Type 2: waiting on server NTLM response\n")); + oldheader = soap->header; + if (soap_begin_recv(soap)) + if (soap->error == SOAP_EOF) + return soap->error; + soap_end_recv(soap); + soap->header = oldheader; + soap->length = l; + if (soap->status != 401 && soap->status != 407) + return soap->error = SOAP_NTLM_ERROR; + soap->error = SOAP_OK; + } + /* S -> C 401 Unauthorized + WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA== + */ + soap_base642s(soap, soap->ntlm_challenge, (char*)&ch, sizeof(tSmbNtlmAuthChallenge), NULL); + buildSmbNtlmAuthResponse(&ch, &res, userid, passwd); + soap->ntlm_challenge = soap_s2base64(soap, (unsigned char*)&res, NULL, SmbLength(&res)); + DBGLOG(TEST,SOAP_MESSAGE(fdebug, "NTLM C->S Type 3: sending NTLM authorization to server\nAuthorization: NTLM %s\n", soap->ntlm_challenge)); + /* C -> S GET ... + Authorization: NTLM TlRMTVNTUAADAAAAGAAYAHIAAAAYABgAigAAABQAFABAAAAADAAMAFQAAAASABIAYAAAAAAAAACiAAAAAYIAAFUAUgBTAEEALQBNAEkATgBPAFIAWgBhAHAAaABvAGQATABJAEcASABUAEMASQBUAFkArYfKbe/jRoW5xDxHeoxC1gBmfWiS5+iX4OAN4xBKG/IFPwfH3agtPEia6YnhsADT + */ + soap->keep_alive = k; + soap->length = l; + soap->count = c; + soap->mode = m; + soap->omode = o; + soap->status = s; + } + return SOAP_OK; +} +#endif +#endif + +/******************************************************************************/ #ifndef WITH_LEAN SOAP_FMAC1 char* @@ -15055,7 +15326,8 @@ SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) -{ register int i, j, c; +{ register size_t i, j; + register soap_wchar c; register unsigned long m; register const char *p; if (!s || !*s) @@ -15066,7 +15338,7 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) return SOAP_NON_NULL; } if (!t) - { l = (strlen(s) + 3) / 4 * 3; + { l = (strlen(s) + 3) / 4 * 3 + 1; /* make sure enough space for \0 */ t = (char*)soap_malloc(soap, l); } if (!t) @@ -15093,7 +15365,9 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) i += 2; } if (n) - *n += i; + *n += (int)i; + if (l >= j) + *t = '\0'; return p; } c -= '+'; @@ -15111,14 +15385,15 @@ soap_base642s(struct soap *soap, const char *s, char *t, size_t l, int *n) return NULL; } } - *t++ = (char)((m >> 16) & 0xFF); - *t++ = (char)((m >> 8) & 0xFF); - *t++ = (char)(m & 0xFF); if (l < 3) { if (n) - *n += i; + *n += (int)i; + *t = '\0'; return p; } + *t++ = (char)((m >> 16) & 0xFF); + *t++ = (char)((m >> 8) & 0xFF); + *t++ = (char)(m & 0xFF); l -= 3; } if (n) @@ -15168,7 +15443,7 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) return SOAP_NON_NULL; } if (!t) - { l = strlen(s) / 2; + { l = strlen(s) / 2 + 1; /* make sure enough space for \0 */ t = (char*)soap_malloc(soap, l); } if (!t) @@ -15182,11 +15457,13 @@ soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n) d2 = *s++; if (!d2) break; - *t++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); + *t++ = (char)(((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0')); l--; } if (n) *n = (int)(t - p); + if (l) + *t = '\0'; return p; } #endif @@ -15198,13 +15475,13 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_puthttphdr(struct soap *soap, int status, size_t count) -{ if (soap->status != SOAP_GET) +{ if (soap->status != SOAP_GET && soap->status != SOAP_DEL && soap->status != SOAP_CONNECT) { register const char *s = "text/xml; charset=utf-8"; register int err = SOAP_OK; #ifndef WITH_LEANER register const char *r = NULL; #endif - if ((status == SOAP_FILE || soap->status == SOAP_POST_FILE) && soap->http_content) + if ((status == SOAP_FILE || soap->status == SOAP_PUT || soap->status == SOAP_POST_FILE) && soap->http_content) s = soap->http_content; else if (status == SOAP_HTML) s = "text/html; charset=utf-8"; @@ -15245,12 +15522,12 @@ soap_puthttphdr(struct soap *soap, int status, size_t count) } s = soap->tmpbuf; } - if (status == SOAP_OK && soap->version == 2 && soap->action && strlen(soap->action) < sizeof(soap->tmpbuf) - 80) - { sprintf(soap->tmpbuf, "%s; action=\"%s\"", s, soap->action); - s = soap->tmpbuf; - } + else + s = strcpy(soap->tmpbuf, s); + if (status == SOAP_OK && soap->version == 2 && soap->action && strlen(soap->action) + strlen(s) < sizeof(soap->tmpbuf) - 80) + sprintf(soap->tmpbuf + strlen(s), "; action=\"%s\"", soap->action); #endif - if (s && (err = soap->fposthdr(soap, "Content-Type", s))) + if ((err = soap->fposthdr(soap, "Content-Type", s))) return err; #ifdef WITH_ZLIB if ((soap->omode & SOAP_ENC_ZLIB)) @@ -15286,9 +15563,17 @@ soap_puthttphdr(struct soap *soap, int status, size_t count) static const char* soap_set_validation_fault(struct soap *soap, const char *s, const char *t) { if (*soap->tag) - sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element '%s'", s, t?t:SOAP_STR_EOS, soap->tag); +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Validation constraint violation: %s%s in element '%s'", s, t ? t : SOAP_STR_EOS, soap->tag); +#else + sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element '%s'", s, t ? t : SOAP_STR_EOS, soap->tag); +#endif else - sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t?t:SOAP_STR_EOS); +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Validation constraint violation: %s%s", s, t ? t : SOAP_STR_EOS); +#else + sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t ? t : SOAP_STR_EOS); +#endif return soap->msgbuf; } #endif @@ -15330,11 +15615,15 @@ soap_set_fault(struct soap *soap) *s = "Well-formedness violation"; break; case SOAP_NO_TAG: - *s = "No XML root element"; + *s = "No tag: no XML root element or missing SOAP message body element"; break; case SOAP_MUSTUNDERSTAND: *c = "SOAP-ENV:MustUnderstand"; +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "The data in element '%s' must be understood but cannot be handled", soap->tag); +#else sprintf(soap->msgbuf, "The data in element '%s' must be understood but cannot be handled", soap->tag); +#endif *s = soap->msgbuf; break; case SOAP_VERSIONMISMATCH: @@ -15355,7 +15644,11 @@ soap_set_fault(struct soap *soap) *s = "Fatal error"; break; case SOAP_NO_METHOD: +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Method '%s' not implemented: method name or namespace not recognized", soap->tag); +#else sprintf(soap->msgbuf, "Method '%s' not implemented: method name or namespace not recognized", soap->tag); +#endif *s = soap->msgbuf; break; case SOAP_NO_DATA: @@ -15386,7 +15679,7 @@ soap_set_fault(struct soap *soap) *s = soap_set_validation_fault(soap, "nil not allowed", NULL); break; case SOAP_DUPLICATE_ID: - *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id); + *s = soap_set_validation_fault(soap, "multiple definitions (use the SOAP_XML_TREE flag) of the same id ", soap->id); if (soap->version == 2) *soap_faultsubcode(soap) = "SOAP-ENC:DuplicateID"; break; @@ -15411,6 +15704,9 @@ soap_set_fault(struct soap *soap) case SOAP_HTTP_ERROR: *s = "An HTTP processing error occurred"; break; + case SOAP_NTLM_ERROR: + *s = "An HTTP NTLM authentication error occurred"; + break; case SOAP_SSL_ERROR: #ifdef WITH_OPENSSL *s = "SSL/TLS error"; @@ -15444,7 +15740,11 @@ soap_set_fault(struct soap *soap) break; case SOAP_ZLIB_ERROR: #ifdef WITH_ZLIB - sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg?soap->d_stream->msg:SOAP_STR_EOS); +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "Zlib/gzip error: '%s'", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS); +#else + sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream->msg ? soap->d_stream->msg : SOAP_STR_EOS); +#endif *s = soap->msgbuf; #else *s = "Zlib/gzip not installed for (de)compression: recompile with -DWITH_GZIP"; @@ -15465,8 +15765,11 @@ soap_set_fault(struct soap *soap) case SOAP_FD_EXCEEDED: *s = "Maximum number of open connections was reached (no define HAVE_POLL): increase FD_SETSIZE"; break; + case SOAP_UTF_ERROR: + *s = "UTF content encoding error"; + break; case SOAP_STOP: - *s = "Stopped: no response to be sent or received (informative)"; + *s = "Stopped: no response sent or received (informative)"; break; #endif case SOAP_EOF: @@ -15488,7 +15791,12 @@ soap_set_fault(struct soap *soap) #ifndef WITH_NOHTTP #ifndef WITH_LEAN if (soap->error > 200 && soap->error < 600) - { sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error)); + { +#ifdef HAVE_SNPRINTF + soap_snprintf(soap->msgbuf, sizeof(soap->msgbuf), "HTTP Error: %d %s", soap->error, http_error(soap, soap->error)); +#else + sprintf(soap->msgbuf, "HTTP Error: %d %s", soap->error, http_error(soap, soap->error)); +#endif *s = soap->msgbuf; } else @@ -15617,12 +15925,14 @@ int SOAP_FMAC2 soap_send_empty_response(struct soap *soap, int httpstatuscode) { register soap_mode m = soap->omode; - soap->count = 0; - if ((m & SOAP_IO) == SOAP_IO_CHUNK) - soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER; - if (!soap_response(soap, httpstatuscode) && !soap_end_send(soap)) - soap->error = SOAP_STOP; /* stops the server's response */ - soap->omode = m; + if (!(m & SOAP_IO_UDP)) + { soap->count = 0; + if ((m & SOAP_IO) == SOAP_IO_CHUNK) + soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER; + if (!soap_response(soap, httpstatuscode) && !soap_end_send(soap)) + soap->error = SOAP_STOP; /* stops the server's processing of request */ + soap->omode = m; + } return soap_closesock(soap); } #endif @@ -15635,10 +15945,12 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_recv_empty_response(struct soap *soap) -{ if (!soap_begin_recv(soap)) - soap_end_recv(soap); - else if (soap->error == SOAP_NO_DATA || soap->error == 202) - soap->error = SOAP_OK; +{ if (!(soap->omode & SOAP_IO_UDP)) + { if (!soap_begin_recv(soap)) + soap_end_recv(soap); + else if (soap->error == SOAP_NO_DATA || soap->error == 202) + soap->error = SOAP_OK; + } return soap_closesock(soap); } #endif @@ -15805,16 +16117,15 @@ soap_print_fault(struct soap *soap, FILE *fd) { if (soap_check_state(soap)) fprintf(fd, "Error: soap struct state not initialized\n"); else if (soap->error) - { const char *c, *v = NULL, *s, **d; - d = soap_faultcode(soap); - if (!*d) + { const char **c, *v = NULL, *s, *d; + c = soap_faultcode(soap); + if (!*c) soap_set_fault(soap); - c = *d; if (soap->version == 2) - v = *soap_faultsubcode(soap); + v = soap_check_faultsubcode(soap); s = *soap_faultstring(soap); - d = soap_faultdetail(soap); - fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); + d = soap_check_faultdetail(soap); + fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]"); } } #endif @@ -15824,6 +16135,7 @@ soap_print_fault(struct soap *soap, FILE *fd) #ifdef __cplusplus #ifndef WITH_LEAN #ifndef WITH_NOSTDLIB +#ifndef WITH_COMPAT SOAP_FMAC1 void SOAP_FMAC2 @@ -15831,29 +16143,29 @@ soap_stream_fault(struct soap *soap, std::ostream& os) { if (soap_check_state(soap)) os << "Error: soap struct state not initialized\n"; else if (soap->error) - { const char *c, *v = NULL, *s, **d; - d = soap_faultcode(soap); - if (!*d) + { const char **c, *v = NULL, *s, *d; + c = soap_faultcode(soap); + if (!*c) soap_set_fault(soap); - c = *d; if (soap->version == 2) - v = *soap_faultsubcode(soap); + v = soap_check_faultsubcode(soap); s = *soap_faultstring(soap); - d = soap_faultdetail(soap); + d = soap_check_faultdetail(soap); os << (soap->version ? "SOAP 1." : "Error ") << (soap->version ? (int)soap->version : soap->error) - << " fault: " << c + << " fault: " << *c << "[" << (v ? v : "no subcode") << "]" << std::endl << "\"" << (s ? s : "[no reason]") << "\"" << std::endl - << "Detail: " << (d && *d ? *d : "[no detail]") + << "Detail: " << (d ? d : "[no detail]") << std::endl; } } #endif #endif #endif +#endif /******************************************************************************/ #ifndef WITH_LEAN @@ -15865,27 +16177,21 @@ soap_sprint_fault(struct soap *soap, char *buf, size_t len) { if (soap_check_state(soap)) strncpy(buf, "Error: soap struct not initialized", len); else if (soap->error) - { const char *c, *v = NULL, *s, **d; - d = soap_faultcode(soap); - if (!*d) + { const char **c, *v = NULL, *s, *d; + c = soap_faultcode(soap); + if (!*c) soap_set_fault(soap); - c = *d; if (soap->version == 2) v = *soap_faultsubcode(soap); s = *soap_faultstring(soap); - d = soap_faultdetail(soap); + d = soap_check_faultdetail(soap); #ifdef HAVE_SNPRINTF -# ifdef WIN32 - _snprintf -# else - snprintf -# endif - (buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); + soap_snprintf(buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]"); #else - if (len > 40 + (v ? strlen(v) : 0) + (s ? strlen(s) : 0) + (d && *d ? strlen(*d) : 0)) - sprintf(buf, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]"); + if (len > 40 + (v ? strlen(v) : 0) + (s ? strlen(s) : 0) + (d ? strlen(d) : 0)) + sprintf(buf, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c, v ? v : "no subcode", s ? s : "[no reason]", d ? d : "[no detail]"); else if (len > 40) - sprintf(buf, "%s%d fault: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c); + sprintf(buf, "%s%d fault: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, *c); else buf[0] = '\0'; #endif @@ -15920,8 +16226,8 @@ soap_print_fault_location(struct soap *soap, FILE *fd) fprintf(fd, "%s%c\n<!-- ** HERE ** -->\n", soap->buf, c1); if (soap->bufidx < soap->buflen) fprintf(fd, "%s\n", soap->buf + soap->bufidx); - soap->buf[i] = c1; - soap->buf[j] = c2; + soap->buf[i] = (char)c1; + soap->buf[j] = (char)c2; } #endif } @@ -15949,7 +16255,7 @@ soap_register_plugin_arg(struct soap *soap, int (*fcreate)(struct soap*, struct DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Registered '%s' plugin\n", p->id)); return SOAP_OK; } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id?p->id:"?", r)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id ? p->id : "?", r)); SOAP_FREE(soap, p); return r; } diff --git a/dep/gsoap/stdsoap2.h b/dep/gsoap/stdsoap2.h index 238b7f175ac..87185924135 100644 --- a/dep/gsoap/stdsoap2.h +++ b/dep/gsoap/stdsoap2.h @@ -1,10 +1,10 @@ /* - stdsoap2.h 2.8.2 + stdsoap2.h 2.8.10 gSOAP runtime engine gSOAP XML Web services tools -Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved. This part of the software is released under ONE of the following licenses: GPL, or the gSOAP public license, or Genivia's license for commercial use. -------------------------------------------------------------------------------- @@ -24,7 +24,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Robert A. van Engelen. -Copyright (C) 2000-2011, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc., All Rights Reserved. -------------------------------------------------------------------------------- GPL license. @@ -51,6 +51,8 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com -------------------------------------------------------------------------------- */ +#define GSOAP_VERSION 20810 + #ifdef WITH_SOAPDEFS_H # include "soapdefs.h" /* include user-defined stuff */ #endif @@ -129,6 +131,13 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # endif #endif +/* for legacy purposes we use WIN32 macro even though 64 bit is supported */ +#ifdef _WIN64 +# ifndef WIN32 +# define WIN32 +# endif +#endif + #ifdef _WIN32_WCE # ifndef UNDER_CE # define UNDER_CE _WIN32_WCE @@ -211,8 +220,14 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # define HAVE_STRRCHR # define HAVE_STRTOD # define HAVE_SSCANF +# define HAVE_STRTOD_L +# define HAVE_SPRINTF_L # define HAVE_STRTOL # define HAVE_STRTOUL +# if _MSC_VER >= 1300 +# define HAVE_STRTOLL // use _strtoi64 +# define HAVE_STRTOULL // use _strtoui64 +# endif # define HAVE_SYS_TIMEB_H # define HAVE_FTIME # define HAVE_GMTIME @@ -293,7 +308,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # define HAVE_WCTOMB # define HAVE_MBTOWC # define HAVE_ISNAN -# define HAVE_ISINF # elif defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) # define HAVE_POLL # define HAVE_SNPRINTF @@ -472,6 +486,19 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # define ULONG64 unsigned LONG64 # define SOAP_LONG_FORMAT "%ld" # define SOAP_ULONG_FORMAT "%lu" +# elif defined(SUN_OS) +# define HAVE_SNPRINTF +# define HAVE_STRRCHR +# define HAVE_STRTOD +# define HAVE_SSCANF +# define HAVE_STRTOL +# define HAVE_STRTOUL +# define HAVE_SYS_TIMEB_H +# define HAVE_FTIME +# define HAVE_RAND_R +# define HAVE_GETHOSTBYNAME_R +# define HAVE_GMTIME_R +# define HAVE_LOCALTIME_R # else /* Default assumptions for supported functions */ # define HAVE_SNPRINTF @@ -515,11 +542,17 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # endif #endif -/* native Win and HP-UX compilers don't like empty structs */ +/* native Win, HP-UX, and AIX compilers don't like empty structs */ #if defined(WIN32) || defined(HP_UX) || defined(_AIX41) || defined(_AIX43) || defined(VXWORKS) # define WITH_NOEMPTYSTRUCT #endif +#ifdef WITH_PURE_VIRTUAL +# define SOAP_PURE_VIRTUAL = 0 +#else +# define SOAP_PURE_VIRTUAL +#endif + #ifdef HP_UX # undef HAVE_STRTOLL # undef HAVE_STRTOULL @@ -534,8 +567,11 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com /* if we have xlocale.h we use it to avoid decimal point conversion issues */ #ifdef WITH_C_LOCALE -# include <locale.h> -# include <xlocale.h> +# ifdef WIN32 +# include <locale.h> +# else +# include <xlocale.h> +# endif #else # undef HAVE_STRTOF_L # undef HAVE_STRTOD_L @@ -543,7 +579,7 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # undef HAVE_SPRINTF_L #endif -#ifdef TANDEM +#ifdef TANDEM_NONSTOP # define SOAP_BUFLEN (32767) /*# define WITH_NOSTDLIB */ /* uncommment to remove stdlib dependences */ # define WITH_NOIO /* no IO dependences, e.g. remove TCP/IP */ @@ -586,6 +622,10 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # include <limits.h> #endif +#ifdef WITH_NTLM +# include <ntlm.h> +#endif + #ifdef HAVE_POLL # include <poll.h> #endif @@ -672,14 +712,6 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # define SOAP_WINSOCKINT size_t #endif -#ifdef WITH_IPV6 -# ifdef IPV6_V6ONLY -# if !defined(WITH_NO_IPV6_V6ONLY) && !defined(WITH_IPV6_V6ONLY) -# define WITH_NO_IPV6_V6ONLY /* turn on IPv6-IPv4 switching */ -# endif -# endif -#endif - #if defined(WITH_IPV6_V6ONLY) || defined(WITH_NO_IPV6_V6ONLY) # ifndef WITH_IPV6 # define WITH_IPV6 @@ -691,9 +723,17 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com # include <io.h> # include <fcntl.h> # endif -# include <winsock2.h> /* Visual Studio 2005 users: you must install the Platform SDK (R2) */ -# include <ws2tcpip.h> -# include <wspiapi.h> +// When you get macro redefinition errors when compiling the code below: +// try arrange your include list that <windows.h> is included after "stdsoap2.h" +// or define _WINSOCKAPI_ first: +// #define _WINSOCKAPI_ // stops windows.h including winsock.h +// #include <windows.h> +// #include "stdsoap2.h" +# include <winsock2.h> /* Visual Studio 2005 users: install Platform SDK (R2) */ +# include <ws2tcpip.h> +// # define _WSPIAPI_COUNTOF /* DEV NOTE: enble to fix problems with VC6 */ +// # include <wspiapi.h> +# include <ws2spi.h> /* DEV NOTE: replaces older wspiapi.h above */ # ifdef WITH_IPV6 # define SOAP_GAI_STRERROR gai_strerrorA # endif @@ -790,9 +830,9 @@ extern "C" { # endif #elif defined(SOCKLEN_T) # define SOAP_SOCKLEN_T SOCKLEN_T -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390) || defined(HP_UX) +#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__) || defined(QNX) || defined(OS390) # define SOAP_SOCKLEN_T socklen_t -#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) +#elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) || defined(HP_UX) # define SOAP_SOCKLEN_T int #else # define SOAP_SOCKLEN_T size_t @@ -822,6 +862,12 @@ extern "C" { # define FD_SETSIZE (1024) #endif +#ifdef WITH_LEAN +# define SOAP_CHK_EOF SOAP_EOF +#else +# define SOAP_CHK_EOF (soap->error ? soap->error : SOAP_EOF) +#endif + #if defined(SYMBIAN) # define LONG64 long # define ULONG64 unsigned LONG64 @@ -874,7 +920,6 @@ extern "C" { #elif defined(PALM) # define soap_int32 Int32 #elif defined(_AIX) -# define SOAP_NEW(type) new type /* AIX compilers don't like new (t) */ # if defined(_AIX43) # define soap_int32 int32_t # else @@ -1133,6 +1178,14 @@ extern const char soap_base64o[], soap_base64i[]; #define soap_isninfd(n) ((n) < 0 && soap_isinf(n)) #define soap_isninff(n) ((n) < 0 && soap_isinf(n)) +#ifdef HAVE_SNPRINTF +# ifdef WIN32 +# define soap_snprintf _snprintf +# else +# define soap_snprintf snprintf +# endif +#endif + /* gSOAP error codes */ #define SOAP_EOF EOF @@ -1184,6 +1237,8 @@ extern const char soap_base64o[], soap_base64i[]; #define SOAP_OCCURS 44 #define SOAP_LENGTH 45 #define SOAP_FD_EXCEEDED 46 +#define SOAP_UTF_ERROR 47 +#define SOAP_NTLM_ERROR 48 #define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF) #define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD) @@ -1199,7 +1254,7 @@ extern const char soap_base64o[], soap_base64i[]; /* Exceptional gSOAP HTTP server response status codes >= 1000 */ #define SOAP_STOP 1000 /* No HTTP response */ -#define SOAP_FORM 1001 /* Form request/response */ +#define SOAP_FORM 1001 /* Request (form) data is present, no HTTP response */ #define SOAP_HTML 1002 /* Custom HTML response */ #define SOAP_FILE 1003 /* Custom file-based response */ @@ -1208,6 +1263,9 @@ extern const char soap_base64o[], soap_base64i[]; #define SOAP_POST 2000 /* POST request */ #define SOAP_POST_FILE 2001 /* Custom file-based POST request */ #define SOAP_GET 2002 /* GET request */ +#define SOAP_PUT 2003 /* PUT request */ +#define SOAP_DEL 2004 /* DELETE request */ +#define SOAP_CONNECT 2005 /* CONNECT request */ /* gSOAP DIME */ @@ -1254,21 +1312,22 @@ typedef soap_int32 soap_mode; #define SOAP_XML_DEFAULTNS 0x00008000 /* out: emit xmlns="..." */ #define SOAP_XML_CANONICAL 0x00010000 /* out: excC14N canonical XML */ #define SOAP_XML_TREE 0x00020000 /* out: XML tree (no id/ref) */ -#define SOAP_XML_GRAPH 0x00040000 /* see DOM manual */ -#define SOAP_XML_NIL 0x00080000 /* out: NULLs as xsi:nil */ +#define SOAP_XML_NIL 0x00040000 /* out: NULLs as xsi:nil */ +#define SOAP_XML_NOTYPE 0x00080000 /* out: NULLs as xsi:nil */ -#define SOAP_C_NOIOB 0x00100000 /* don't fault on array index out of bounds (just ignore) */ -#define SOAP_C_UTFSTRING 0x00200000 /* (de)serialize strings with UTF8 content */ -#define SOAP_C_MBSTRING 0x00400000 /* (de)serialize strings with multi-byte content */ -#define SOAP_C_NILSTRING 0x00800000 /* serialize empty strings as nil (omitted) */ +#define SOAP_DOM_TREE 0x00100000 /* see DOM manual */ +#define SOAP_DOM_NODE 0x00200000 +#define SOAP_DOM_ASIS 0x00400000 -#define SOAP_XML_DOM 0x01000000 +#define SOAP_C_NOIOB 0x01000000 /* don't fault on array index out of bounds (just ignore) */ +#define SOAP_C_UTFSTRING 0x02000000 /* (de)serialize strings with UTF8 content */ +#define SOAP_C_MBSTRING 0x04000000 /* (de)serialize strings with multi-byte content */ +#define SOAP_C_NILSTRING 0x08000000 /* serialize empty strings as nil (omitted) */ -#define SOAP_DOM_TREE 0x02000000 -#define SOAP_DOM_NODE 0x04000000 -#define SOAP_DOM_ASIS 0x08000000 +#define SOAP_XML_DOM 0x10000000 /* enable internal DOM */ +#define SOAP_XML_GRAPH 0x20000000 /* id-ref graph in DOM */ -#define SOAP_MIME_POSTCHECK 0x10000000 /* MIME flag (internal) */ +#define SOAP_MIME_POSTCHECK 0x40000000 /* MIME flag (internal) */ #define SOAP_SEC_WSUID 0x80000000 /* Add Body wsu:Id */ @@ -1303,7 +1362,7 @@ typedef soap_int32 soap_mode; #define soap_check_state(soap) (!(soap) || ((soap)->state != SOAP_INIT && (soap)->state != SOAP_COPY)) -/* parts, states, and events */ +/* parts */ #define SOAP_BEGIN 0 #define SOAP_IN_ENVELOPE 2 @@ -1315,8 +1374,11 @@ typedef soap_int32 soap_mode; #define SOAP_END_ENVELOPE 8 #define SOAP_END 9 -#define SOAP_SEC_BEGIN 10 -#define SOAP_SEC_SIGN 11 +/* events */ + +#define SOAP_SEC_BEGIN 1 +#define SOAP_SEC_SIGN 2 +#define SOAP_SEC_DECRYPT 3 /* DEBUG macros */ @@ -1349,13 +1411,17 @@ typedef soap_int32 soap_mode; #endif #ifndef SOAP_NEW /* use C++ new operator */ -# if (__GNUC__ <= 2) && !defined(__BORLANDC__) /* Borland uses GNU C? */ +# if (defined(__GNUC__) && (__GNUC__ <= 2) && !defined(__BORLANDC__)) || defined(__clang__) || defined(_AIX) # define SOAP_NEW(type) new type /* old form w/o parenthesis */ # else # define SOAP_NEW(type) new (type) /* prefer with parenthesis */ # endif #endif +#ifndef SOAP_PLACEMENT_NEW +# define SOAP_PLACEMENT_NEW(buf, type) new (buf) type +#endif + #ifndef SOAP_NEW_COPY /* use C++ new operator for ::copy() */ # define SOAP_NEW_COPY(clas) new clas /* prefer w/o parenthesis */ #endif @@ -1792,9 +1858,15 @@ struct SOAP_STD_API soap struct soap_plugin *plugins; /* linked list of plug-in data */ const char *userid; /* HTTP Basic authorization userid */ const char *passwd; /* HTTP Basic authorization passwd */ + const char *authrealm; /* HTTP authentication realm (NTLM domain) */ +#if !defined(WITH_LEAN) || defined(WITH_NTLM) + const char *ntlm_challenge; /* HTTP NTLM challenge key string */ + short ntlm_auth; /* HTTP NTLM authentication type */ + short ntlm_stage; /* HTTP NTLM stage 0..3 */ +#endif int (*fpost)(struct soap*, const char*, const char*, int, const char*, const char*, size_t); int (*fget)(struct soap*); /* HTTP GET hook (not set by default) */ - int (*fput)(struct soap*); /* HTTP PUT hook (handled as POST) */ + int (*fput)(struct soap*); /* HTTP PUT hook (handled as POST by default) */ int (*fdel)(struct soap*); /* HTTP DELETE hook (not set by default) */ int (*fopt)(struct soap*); /* HTTP OPTIONS hook (not set by default) */ int (*fhead)(struct soap*); /* HTTP HEAD hook (not set by default) */ @@ -1847,11 +1919,13 @@ struct SOAP_STD_API soap size_t (*fmimeread)(struct soap*, void*, char*, size_t); int (*fmimewrite)(struct soap*, void*, const char*, size_t); #endif - SOAP_SOCKET master; - SOAP_SOCKET socket; + SOAP_SOCKET master; /* socket bound to TCP/IP port */ + SOAP_SOCKET socket; /* socket to send and receive */ + SOAP_SOCKET sendsk; /* socket to send (overrides ::socket) */ + SOAP_SOCKET recvsk; /* socket to receive (overrides ::socket) */ #if defined(__cplusplus) && !defined(WITH_LEAN) && !defined(WITH_COMPAT) - std::ostream *os; - std::istream *is; + std::ostream *os; /* stream to send */ + std::istream *is; /* stream to receive */ #else void *os; /* preserve struct size */ void *is; /* preserve struct size */ @@ -1860,8 +1934,8 @@ struct SOAP_STD_API soap int sendfd; /* WinCE FD to send */ int recvfd; /* WinCE FD to receive */ #else - FILE *sendfd; - FILE *recvfd; + FILE *sendfd; /* FD to send */ + FILE *recvfd; /* FD to receive */ #endif size_t bufidx; /* index in soap.buf[] */ size_t buflen; /* length of soap.buf[] content */ @@ -1885,9 +1959,9 @@ struct SOAP_STD_API soap char arraySize[SOAP_TAGLEN]; char arrayOffset[SOAP_TAGLEN]; short other; - short position; - int positions[SOAP_MAXDIMS]; short root; + int position; + int positions[SOAP_MAXDIMS]; struct soap_attribute *attributes; /* attribute list */ short encoding; /* when set, output encodingStyle */ short mustUnderstand; /* a mustUnderstand element was parsed or is output */ @@ -1895,6 +1969,7 @@ struct SOAP_STD_API soap short ns; /* when not set, output full xmlns bindings */ short part; /* SOAP part state (header or body) */ short event; /* engine events and states for use by plugins */ + unsigned int evlev; /* event level */ short alloced; short peeked; size_t chunksize; @@ -1903,7 +1978,6 @@ struct SOAP_STD_API soap char path[SOAP_TAGLEN]; char host[SOAP_TAGLEN]; char *action; - char *authrealm; /* HTTP authentication realm */ char *prolog; /* XML declaration prolog */ unsigned long ip; /* IP number */ int port; /* port number */ @@ -1990,7 +2064,11 @@ struct SOAP_STD_API soap char session_host[SOAP_TAGLEN]; int session_port; #ifdef WITH_C_LOCALE +# ifdef WIN32 + _locale_t c_locale; /* set to C locale by default */ +# else locale_t c_locale; /* set to C locale by default */ +# endif #else void *c_locale; #endif @@ -2073,13 +2151,26 @@ soap_wchar soap_get0(struct soap*); soap_wchar soap_get1(struct soap*); #endif +#define soap_versioning_paste(name, ext) name##_LIBRARY_VERSION_REQUIRED_##ext +#define soap_versioning_ext(name, ext) soap_versioning_paste(name, ext) +#define soap_versioning(name) soap_versioning_ext(name, GSOAP_VERSION) + +#define soap_init(soap) soap_init1(soap, SOAP_IO_DEFAULT) +#define soap_init1(soap, mode) soap_init2(soap, mode, mode) +#define soap_init2(soap, imode, omode) soap_versioning(soap_init)(soap, imode, omode) + +#define soap_new() soap_new1(SOAP_IO_DEFAULT) +#define soap_new1(mode) soap_new2(mode, mode) +#define soap_new2(imode, omode) soap_versioning(soap_new)(imode, omode) + #define soap_revget1(soap) ((soap)->bufidx--) #define soap_unget(soap, c) ((soap)->ahead = c) #define soap_register_plugin(soap, plugin) soap_register_plugin_arg(soap, plugin, NULL) -#define soap_imode(soap, n) ((soap)->mode = (soap)->imode = (n)) +#define soap_mode(soap, n) ((soap)->mode = (soap)->imode = (soap)->omode = (n)) +#define soap_imode(soap, n) ((soap)->imode = (n)) +#define soap_omode(soap, n) ((soap)->omode = (n)) #define soap_set_imode(soap, n) ((soap)->imode |= (n)) #define soap_clr_imode(soap, n) ((soap)->imode &= ~(n)) -#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) #define soap_set_omode(soap, n) ((soap)->omode |= (n)) #define soap_clr_omode(soap, n) ((soap)->omode &= ~(n)) #define soap_set_mode(soap, n) ((soap)->imode |= (n), (soap)->omode |= (n)) @@ -2104,6 +2195,18 @@ soap_wchar soap_get1(struct soap*); SOAP_FMAC1 unsigned long SOAP_FMAC2 soap_strtoul(const char *s, char **t, int b); #endif +#ifdef WIN32 +# define soap_strtoll _strtoi64 +#else +# define soap_strtoll strtoll +#endif + +#ifdef WIN32 +# define soap_strtoull _strtoui64 +#else +# define soap_strtoull strtoull +#endif + #if defined(WITH_OPENSSL) # define soap_random soap_rand() SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void); @@ -2131,18 +2234,29 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_rand(void); # define soap_markelement(s, p, n) (0) #endif -SOAP_FMAC1 void SOAP_FMAC2 soap_header(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_fault(struct soap*); -SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultcode(struct soap*); -SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultsubcode(struct soap*); -SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultstring(struct soap*); -SOAP_FMAC1 const char** SOAP_FMAC2 soap_faultdetail(struct soap*); +/* soap_traverse() traversal/walker routines take walker function arguments */ +typedef void soap_walker(struct soap*, void*, int, const char*, const char*); + +SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap); +SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap); + +#ifndef WITH_NOGLOBAL +SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap*); +SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap*); +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultcode(struct soap*); +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultsubcode(struct soap*); +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultstring(struct soap*); +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultdetail(struct soap*); +SOAP_FMAC3 const char* SOAP_FMAC4 soap_check_faultsubcode(struct soap*); +SOAP_FMAC3 const char* SOAP_FMAC4 soap_check_faultdetail(struct soap*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap*); +#endif + SOAP_FMAC1 void SOAP_FMAC2 soap_serializeheader(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_putheader(struct soap*); SOAP_FMAC1 int SOAP_FMAC2 soap_getheader(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_serializefault(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_putfault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putheader(struct soap*); SOAP_FMAC1 int SOAP_FMAC2 soap_getfault(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_putfault(struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_ssl_init(void); SOAP_FMAC1 int SOAP_FMAC2 soap_poll(struct soap*); @@ -2234,7 +2348,7 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_end_recv(struct soap*); SOAP_FMAC1 void* SOAP_FMAC2 soap_malloc(struct soap*, size_t); SOAP_FMAC1 void SOAP_FMAC2 soap_dealloc(struct soap*, void*); SOAP_FMAC1 struct soap_clist * SOAP_FMAC2 soap_link(struct soap*, void*, int, int, int (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); +SOAP_FMAC1 int SOAP_FMAC2 soap_unlink(struct soap*, const void*); SOAP_FMAC1 void SOAP_FMAC2 soap_free_temp(struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_del(struct soap*); @@ -2262,18 +2376,15 @@ SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffset(struct soap*, int); SOAP_FMAC1 char* SOAP_FMAC2 soap_putoffsets(struct soap*, const int *, int); SOAP_FMAC1 int SOAP_FMAC2 soap_closesock(struct soap*); +SOAP_FMAC1 int SOAP_FMAC2 soap_force_closesock(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new(void); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new1(soap_mode); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(soap_mode, soap_mode); +SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_versioning(soap_new)(soap_mode, soap_mode); SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(const struct soap*); SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, const struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_copy_stream(struct soap*, struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_free_stream(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, soap_mode); -SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, soap_mode, soap_mode); +SOAP_FMAC1 void SOAP_FMAC2 soap_versioning(soap_init)(struct soap*, soap_mode, soap_mode); SOAP_FMAC1 void SOAP_FMAC2 soap_done(struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_cleanup(struct soap*); SOAP_FMAC1 void SOAP_FMAC2 soap_begin(struct soap*); @@ -2353,6 +2464,7 @@ SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*, struct soap_blist*); SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*, struct soap_blist*); SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, struct soap_blist*, char*, int); SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*, struct soap_blist*); +SOAP_FMAC1 void SOAP_FMAC2 soap_update_pointers(struct soap *soap, char *start, char *end, char *p1, char *p2); SOAP_FMAC1 int SOAP_FMAC2 soap_envelope_begin_out(struct soap*); SOAP_FMAC1 int soap_envelope_end_out(struct soap*); @@ -2382,8 +2494,10 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*, int check); SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); # ifndef WITH_LEAN -# ifdef __cplusplus +# ifndef WITH_COMPAT +# ifdef __cplusplus SOAP_FMAC1 void SOAP_FMAC2 soap_stream_fault(struct soap*, std::ostream&); +# endif # endif SOAP_FMAC1 char* SOAP_FMAC2 soap_sprint_fault(struct soap*, char*, size_t); # endif diff --git a/dep/gsoap/tc_upgrades.txt b/dep/gsoap/tc_upgrades.txt new file mode 100644 index 00000000000..04298b2ae82 --- /dev/null +++ b/dep/gsoap/tc_upgrades.txt @@ -0,0 +1,12 @@ +* Generate new headers based on TrinityCore soap-services stub: +gsoap/bin/linux386/soapcpp2 -1 -S -L -w -x -y soap.stub + +* Copy the following files from the gsoap package: +gsoap/stdsoap2.h +gsoap/stdsoap2.cpp + +* Remove the following files after generation: +ns1.nsmap +soapObject.h + +* Test compile and see if SOAP works... diff --git a/dep/utf8cpp/utf8/checked.h b/dep/utf8cpp/utf8/checked.h index a1d2035364d..3b00644444c 100644 --- a/dep/utf8cpp/utf8/checked.h +++ b/dep/utf8cpp/utf8/checked.h @@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE. namespace utf8 { // Base for the exceptions that may be thrown from the library - class exception : public std::exception { + class exception : public ::std::exception { }; // Exceptions that may be thrown from the library functions. @@ -69,12 +69,38 @@ namespace utf8 /// The library API - functions intended to be called by the users + template <typename octet_iterator> + octet_iterator append(uint32_t cp, octet_iterator result) + { + if (!utf8::internal::is_code_point_valid(cp)) + throw invalid_code_point(cp); + + if (cp < 0x80) // one octet + *(result++) = static_cast<uint8_t>(cp); + else if (cp < 0x800) { // two octets + *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0); + *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); + } + else if (cp < 0x10000) { // three octets + *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0); + *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); + } + else { // four octets + *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0); + *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80); + *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); + *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); + } + return result; + } + template <typename octet_iterator, typename output_iterator> output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out, uint32_t replacement) { while (start != end) { octet_iterator sequence_start = start; - internal::utf_error err_code = internal::validate_next(start, end); + internal::utf_error err_code = utf8::internal::validate_next(start, end); switch (err_code) { case internal::UTF8_OK : for (octet_iterator it = sequence_start; it != start; ++it) @@ -83,16 +109,16 @@ namespace utf8 case internal::NOT_ENOUGH_ROOM: throw not_enough_room(); case internal::INVALID_LEAD: - append (replacement, out); + utf8::append (replacement, out); ++start; break; case internal::INCOMPLETE_SEQUENCE: case internal::OVERLONG_SEQUENCE: case internal::INVALID_CODE_POINT: - append (replacement, out); + utf8::append (replacement, out); ++start; // just one replacement mark for the sequence - while (internal::is_trail(*start) && start != end) + while (start != end && utf8::internal::is_trail(*start)) ++start; break; } @@ -103,41 +129,15 @@ namespace utf8 template <typename octet_iterator, typename output_iterator> inline output_iterator replace_invalid(octet_iterator start, octet_iterator end, output_iterator out) { - static const uint32_t replacement_marker = internal::mask16(0xfffd); - return replace_invalid(start, end, out, replacement_marker); - } - - template <typename octet_iterator> - octet_iterator append(uint32_t cp, octet_iterator result) - { - if (!internal::is_code_point_valid(cp)) - throw invalid_code_point(cp); - - if (cp < 0x80) // one octet - *(result++) = static_cast<uint8_t>(cp); - else if (cp < 0x800) { // two octets - *(result++) = static_cast<uint8_t>((cp >> 6) | 0xc0); - *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); - } - else if (cp < 0x10000) { // three octets - *(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0); - *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); - } - else { // four octets - *(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0); - *(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f) | 0x80); - *(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80); - *(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80); - } - return result; + static const uint32_t replacement_marker = utf8::internal::mask16(0xfffd); + return utf8::replace_invalid(start, end, out, replacement_marker); } template <typename octet_iterator> uint32_t next(octet_iterator& it, octet_iterator end) { uint32_t cp = 0; - internal::utf_error err_code = internal::validate_next(it, end, &cp); + internal::utf_error err_code = utf8::internal::validate_next(it, end, cp); switch (err_code) { case internal::UTF8_OK : break; @@ -156,18 +156,22 @@ namespace utf8 template <typename octet_iterator> uint32_t peek_next(octet_iterator it, octet_iterator end) { - return next(it, end); + return utf8::next(it, end); } template <typename octet_iterator> uint32_t prior(octet_iterator& it, octet_iterator start) { + // can't do much if it == start + if (it == start) + throw not_enough_room(); + octet_iterator end = it; - while (internal::is_trail(*(--it))) - if (it < start) + // Go back until we hit either a lead octet or start + while (utf8::internal::is_trail(*(--it))) + if (it == start) throw invalid_utf8(*it); // error - no lead byte in the sequence - octet_iterator temp = it; - return next(temp, end); + return utf8::peek_next(it, end); } /// Deprecated in versions that include "prior" @@ -175,18 +179,18 @@ namespace utf8 uint32_t previous(octet_iterator& it, octet_iterator pass_start) { octet_iterator end = it; - while (internal::is_trail(*(--it))) + while (utf8::internal::is_trail(*(--it))) if (it == pass_start) throw invalid_utf8(*it); // error - no lead byte in the sequence octet_iterator temp = it; - return next(temp, end); + return utf8::next(temp, end); } template <typename octet_iterator, typename distance_type> void advance (octet_iterator& it, distance_type n, octet_iterator end) { for (distance_type i = 0; i < n; ++i) - next(it, end); + utf8::next(it, end); } template <typename octet_iterator> @@ -195,7 +199,7 @@ namespace utf8 { typename std::iterator_traits<octet_iterator>::difference_type dist; for (dist = 0; first < last; ++dist) - next(first, last); + utf8::next(first, last); return dist; } @@ -203,12 +207,12 @@ namespace utf8 octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) { while (start != end) { - uint32_t cp = internal::mask16(*start++); + uint32_t cp = utf8::internal::mask16(*start++); // Take care of surrogate pairs first - if (internal::is_lead_surrogate(cp)) { + if (utf8::internal::is_lead_surrogate(cp)) { if (start != end) { - uint32_t trail_surrogate = internal::mask16(*start++); - if (internal::is_trail_surrogate(trail_surrogate)) + uint32_t trail_surrogate = utf8::internal::mask16(*start++); + if (utf8::internal::is_trail_surrogate(trail_surrogate)) cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; else throw invalid_utf16(static_cast<uint16_t>(trail_surrogate)); @@ -218,10 +222,10 @@ namespace utf8 } // Lone trail surrogate - else if (internal::is_trail_surrogate(cp)) + else if (utf8::internal::is_trail_surrogate(cp)) throw invalid_utf16(static_cast<uint16_t>(cp)); - result = append(cp, result); + result = utf8::append(cp, result); } return result; } @@ -230,7 +234,7 @@ namespace utf8 u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) { while (start != end) { - uint32_t cp = next(start, end); + uint32_t cp = utf8::next(start, end); if (cp > 0xffff) { //make a surrogate pair *result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET); *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); @@ -245,7 +249,7 @@ namespace utf8 octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) { while (start != end) - result = append(*(start++), result); + result = utf8::append(*(start++), result); return result; } @@ -254,7 +258,7 @@ namespace utf8 u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) { while (start != end) - (*result++) = next(start, end); + (*result++) = utf8::next(start, end); return result; } @@ -280,7 +284,7 @@ namespace utf8 uint32_t operator * () const { octet_iterator temp = it; - return next(temp, range_end); + return utf8::next(temp, range_end); } bool operator == (const iterator& rhs) const { @@ -294,24 +298,24 @@ namespace utf8 } iterator& operator ++ () { - next(it, range_end); + utf8::next(it, range_end); return *this; } iterator operator ++ (int) { iterator temp = *this; - next(it, range_end); + utf8::next(it, range_end); return temp; } iterator& operator -- () { - prior(it, range_start); + utf8::prior(it, range_start); return *this; } iterator operator -- (int) { iterator temp = *this; - prior(it, range_start); + utf8::prior(it, range_start); return temp; } }; // class iterator diff --git a/dep/utf8cpp/utf8/core.h b/dep/utf8cpp/utf8/core.h index ec709f12006..693d388c078 100644 --- a/dep/utf8cpp/utf8/core.h +++ b/dep/utf8cpp/utf8/core.h @@ -68,7 +68,7 @@ namespace internal template<typename octet_type> inline bool is_trail(octet_type oc) { - return ((mask8(oc) >> 6) == 0x2); + return ((utf8::internal::mask8(oc) >> 6) == 0x2); } template <typename u16> @@ -92,14 +92,14 @@ namespace internal template <typename u32> inline bool is_code_point_valid(u32 cp) { - return (cp <= CODE_POINT_MAX && !is_surrogate(cp) && cp != 0xfffe && cp != 0xffff); + return (cp <= CODE_POINT_MAX && !utf8::internal::is_surrogate(cp)); } template <typename octet_iterator> inline typename std::iterator_traits<octet_iterator>::difference_type sequence_length(octet_iterator lead_it) { - uint8_t lead = mask8(*lead_it); + uint8_t lead = utf8::internal::mask8(*lead_it); if (lead < 0x80) return 1; else if ((lead >> 5) == 0x6) @@ -133,123 +133,94 @@ namespace internal enum utf_error {UTF8_OK, NOT_ENOUGH_ROOM, INVALID_LEAD, INCOMPLETE_SEQUENCE, OVERLONG_SEQUENCE, INVALID_CODE_POINT}; - /// get_sequence_x functions decode utf-8 sequences of the length x + /// Helper for get_sequence_x + template <typename octet_iterator> + utf_error increase_safely(octet_iterator& it, octet_iterator end) + { + if (++it == end) + return NOT_ENOUGH_ROOM; + + if (!utf8::internal::is_trail(*it)) + return INCOMPLETE_SEQUENCE; + + return UTF8_OK; + } + #define UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(IT, END) {utf_error ret = increase_safely(IT, END); if (ret != UTF8_OK) return ret;} + + /// get_sequence_x functions decode utf-8 sequences of the length x template <typename octet_iterator> - utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t* code_point) + utf_error get_sequence_1(octet_iterator& it, octet_iterator end, uint32_t& code_point) { - if (it != end) { - if (code_point) - *code_point = mask8(*it); - return UTF8_OK; - } - return NOT_ENOUGH_ROOM; + if (it == end) + return NOT_ENOUGH_ROOM; + + code_point = utf8::internal::mask8(*it); + + return UTF8_OK; } template <typename octet_iterator> - utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t* code_point) + utf_error get_sequence_2(octet_iterator& it, octet_iterator end, uint32_t& code_point) { - utf_error ret_code = NOT_ENOUGH_ROOM; + if (it == end) + return NOT_ENOUGH_ROOM; + + code_point = utf8::internal::mask8(*it); - if (it != end) { - uint32_t cp = mask8(*it); - if (++it != end) { - if (is_trail(*it)) { - cp = ((cp << 6) & 0x7ff) + ((*it) & 0x3f); + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - if (code_point) - *code_point = cp; - ret_code = UTF8_OK; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } + code_point = ((code_point << 6) & 0x7ff) + ((*it) & 0x3f); - return ret_code; + return UTF8_OK; } template <typename octet_iterator> - utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t* code_point) + utf_error get_sequence_3(octet_iterator& it, octet_iterator end, uint32_t& code_point) { - utf_error ret_code = NOT_ENOUGH_ROOM; - - if (it != end) { - uint32_t cp = mask8(*it); - if (++it != end) { - if (is_trail(*it)) { - cp = ((cp << 12) & 0xffff) + ((mask8(*it) << 6) & 0xfff); - if (++it != end) { - if (is_trail(*it)) { - cp += (*it) & 0x3f; - - if (code_point) - *code_point = cp; - ret_code = UTF8_OK; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } + if (it == end) + return NOT_ENOUGH_ROOM; + + code_point = utf8::internal::mask8(*it); + + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) + + code_point = ((code_point << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); + + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) - return ret_code; + code_point += (*it) & 0x3f; + + return UTF8_OK; } template <typename octet_iterator> - utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t* code_point) + utf_error get_sequence_4(octet_iterator& it, octet_iterator end, uint32_t& code_point) { - utf_error ret_code = NOT_ENOUGH_ROOM; - - if (it != end) { - uint32_t cp = mask8(*it); - if (++it != end) { - if (is_trail(*it)) { - cp = ((cp << 18) & 0x1fffff) + ((mask8(*it) << 12) & 0x3ffff); - if (++it != end) { - if (is_trail(*it)) { - cp += (mask8(*it) << 6) & 0xfff; - if (++it != end) { - if (is_trail(*it)) { - cp += (*it) & 0x3f; - - if (code_point) - *code_point = cp; - ret_code = UTF8_OK; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } - else - ret_code = INCOMPLETE_SEQUENCE; - } - else - ret_code = NOT_ENOUGH_ROOM; - } + if (it == end) + return NOT_ENOUGH_ROOM; - return ret_code; + code_point = utf8::internal::mask8(*it); + + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) + + code_point = ((code_point << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); + + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) + + code_point += (utf8::internal::mask8(*it) << 6) & 0xfff; + + UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR(it, end) + + code_point += (*it) & 0x3f; + + return UTF8_OK; } + #undef UTF8_CPP_INCREASE_AND_RETURN_ON_ERROR + template <typename octet_iterator> - utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t* code_point) + utf_error validate_next(octet_iterator& it, octet_iterator end, uint32_t& code_point) { // Save the original value of it so we can go back in case of failure // Of course, it does not make much sense with i.e. stream iterators @@ -258,34 +229,33 @@ namespace internal uint32_t cp = 0; // Determine the sequence length based on the lead octet typedef typename std::iterator_traits<octet_iterator>::difference_type octet_difference_type; - octet_difference_type length = sequence_length(it); - if (length == 0) - return INVALID_LEAD; + const octet_difference_type length = utf8::internal::sequence_length(it); - // Now that we have a valid sequence length, get trail octets and calculate the code point + // Get trail octets and calculate the code point utf_error err = UTF8_OK; switch (length) { + case 0: + return INVALID_LEAD; case 1: - err = get_sequence_1(it, end, &cp); + err = utf8::internal::get_sequence_1(it, end, cp); break; case 2: - err = get_sequence_2(it, end, &cp); + err = utf8::internal::get_sequence_2(it, end, cp); break; case 3: - err = get_sequence_3(it, end, &cp); + err = utf8::internal::get_sequence_3(it, end, cp); break; case 4: - err = get_sequence_4(it, end, &cp); + err = utf8::internal::get_sequence_4(it, end, cp); break; } if (err == UTF8_OK) { // Decoding succeeded. Now, security checks... - if (is_code_point_valid(cp)) { - if (!is_overlong_sequence(cp, length)){ + if (utf8::internal::is_code_point_valid(cp)) { + if (!utf8::internal::is_overlong_sequence(cp, length)){ // Passed! Return here. - if (code_point) - *code_point = cp; + code_point = cp; ++it; return UTF8_OK; } @@ -303,7 +273,8 @@ namespace internal template <typename octet_iterator> inline utf_error validate_next(octet_iterator& it, octet_iterator end) { - return validate_next(it, end, 0); + uint32_t ignored; + return utf8::internal::validate_next(it, end, ignored); } } // namespace internal @@ -318,7 +289,7 @@ namespace internal { octet_iterator result = start; while (result != end) { - internal::utf_error err_code = internal::validate_next(result, end); + utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end); if (err_code != internal::UTF8_OK) return result; } @@ -328,27 +299,27 @@ namespace internal template <typename octet_iterator> inline bool is_valid(octet_iterator start, octet_iterator end) { - return (find_invalid(start, end) == end); + return (utf8::find_invalid(start, end) == end); } template <typename octet_iterator> inline bool starts_with_bom (octet_iterator it, octet_iterator end) { return ( - ((it != end) && (internal::mask8(*it++)) == bom[0]) && - ((it != end) && (internal::mask8(*it++)) == bom[1]) && - ((it != end) && (internal::mask8(*it)) == bom[2]) + ((it != end) && (utf8::internal::mask8(*it++)) == bom[0]) && + ((it != end) && (utf8::internal::mask8(*it++)) == bom[1]) && + ((it != end) && (utf8::internal::mask8(*it)) == bom[2]) ); } - //Deprecated in release 2.3 + //Deprecated in release 2.3 template <typename octet_iterator> inline bool is_bom (octet_iterator it) { return ( - (internal::mask8(*it++)) == bom[0] && - (internal::mask8(*it++)) == bom[1] && - (internal::mask8(*it)) == bom[2] + (utf8::internal::mask8(*it++)) == bom[0] && + (utf8::internal::mask8(*it++)) == bom[1] && + (utf8::internal::mask8(*it)) == bom[2] ); } } // namespace utf8 diff --git a/dep/utf8cpp/utf8/unchecked.h b/dep/utf8cpp/utf8/unchecked.h index 2f3eb4d1d02..b4547fad945 100644 --- a/dep/utf8cpp/utf8/unchecked.h +++ b/dep/utf8cpp/utf8/unchecked.h @@ -60,7 +60,7 @@ namespace utf8 template <typename octet_iterator> uint32_t next(octet_iterator& it) { - uint32_t cp = internal::mask8(*it); + uint32_t cp = utf8::internal::mask8(*it); typename std::iterator_traits<octet_iterator>::difference_type length = utf8::internal::sequence_length(it); switch (length) { case 1: @@ -71,15 +71,15 @@ namespace utf8 break; case 3: ++it; - cp = ((cp << 12) & 0xffff) + ((internal::mask8(*it) << 6) & 0xfff); + cp = ((cp << 12) & 0xffff) + ((utf8::internal::mask8(*it) << 6) & 0xfff); ++it; cp += (*it) & 0x3f; break; case 4: ++it; - cp = ((cp << 18) & 0x1fffff) + ((internal::mask8(*it) << 12) & 0x3ffff); + cp = ((cp << 18) & 0x1fffff) + ((utf8::internal::mask8(*it) << 12) & 0x3ffff); ++it; - cp += (internal::mask8(*it) << 6) & 0xfff; + cp += (utf8::internal::mask8(*it) << 6) & 0xfff; ++it; cp += (*it) & 0x3f; break; @@ -91,29 +91,29 @@ namespace utf8 template <typename octet_iterator> uint32_t peek_next(octet_iterator it) { - return next(it); + return utf8::unchecked::next(it); } template <typename octet_iterator> uint32_t prior(octet_iterator& it) { - while (internal::is_trail(*(--it))) ; + while (utf8::internal::is_trail(*(--it))) ; octet_iterator temp = it; - return next(temp); + return utf8::unchecked::next(temp); } // Deprecated in versions that include prior, but only for the sake of consistency (see utf8::previous) template <typename octet_iterator> inline uint32_t previous(octet_iterator& it) { - return prior(it); + return utf8::unchecked::prior(it); } template <typename octet_iterator, typename distance_type> void advance (octet_iterator& it, distance_type n) { for (distance_type i = 0; i < n; ++i) - next(it); + utf8::unchecked::next(it); } template <typename octet_iterator> @@ -122,7 +122,7 @@ namespace utf8 { typename std::iterator_traits<octet_iterator>::difference_type dist; for (dist = 0; first < last; ++dist) - next(first); + utf8::unchecked::next(first); return dist; } @@ -130,13 +130,13 @@ namespace utf8 octet_iterator utf16to8 (u16bit_iterator start, u16bit_iterator end, octet_iterator result) { while (start != end) { - uint32_t cp = internal::mask16(*start++); + uint32_t cp = utf8::internal::mask16(*start++); // Take care of surrogate pairs first - if (internal::is_lead_surrogate(cp)) { - uint32_t trail_surrogate = internal::mask16(*start++); + if (utf8::internal::is_lead_surrogate(cp)) { + uint32_t trail_surrogate = utf8::internal::mask16(*start++); cp = (cp << 10) + trail_surrogate + internal::SURROGATE_OFFSET; } - result = append(cp, result); + result = utf8::unchecked::append(cp, result); } return result; } @@ -145,7 +145,7 @@ namespace utf8 u16bit_iterator utf8to16 (octet_iterator start, octet_iterator end, u16bit_iterator result) { while (start < end) { - uint32_t cp = next(start); + uint32_t cp = utf8::unchecked::next(start); if (cp > 0xffff) { //make a surrogate pair *result++ = static_cast<uint16_t>((cp >> 10) + internal::LEAD_OFFSET); *result++ = static_cast<uint16_t>((cp & 0x3ff) + internal::TRAIL_SURROGATE_MIN); @@ -160,7 +160,7 @@ namespace utf8 octet_iterator utf32to8 (u32bit_iterator start, u32bit_iterator end, octet_iterator result) { while (start != end) - result = append(*(start++), result); + result = utf8::unchecked::append(*(start++), result); return result; } @@ -169,7 +169,7 @@ namespace utf8 u32bit_iterator utf8to32 (octet_iterator start, octet_iterator end, u32bit_iterator result) { while (start < end) - (*result++) = next(start); + (*result++) = utf8::unchecked::next(start); return result; } @@ -186,7 +186,7 @@ namespace utf8 uint32_t operator * () const { octet_iterator temp = it; - return next(temp); + return utf8::unchecked::next(temp); } bool operator == (const iterator& rhs) const { @@ -198,24 +198,24 @@ namespace utf8 } iterator& operator ++ () { - std::advance(it, internal::sequence_length(it)); + ::std::advance(it, utf8::internal::sequence_length(it)); return *this; } iterator operator ++ (int) { iterator temp = *this; - std::advance(it, internal::sequence_length(it)); + ::std::advance(it, utf8::internal::sequence_length(it)); return temp; } iterator& operator -- () { - prior(it); + utf8::unchecked::prior(it); return *this; } iterator operator -- (int) { iterator temp = *this; - prior(it); + utf8::unchecked::prior(it); return temp; } }; // class iterator diff --git a/dep/zlib/adler32.c b/dep/zlib/adler32.c index 65ad6a5adc4..a868f073d8a 100644 --- a/dep/zlib/adler32.c +++ b/dep/zlib/adler32.c @@ -1,5 +1,5 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2007 Mark Adler + * Copyright (C) 1995-2011 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,9 +9,9 @@ #define local static -local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); +local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); -#define BASE 65521UL /* largest prime smaller than 65536 */ +#define BASE 65521 /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ @@ -21,39 +21,44 @@ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); -/* use NO_DIVIDE if your processor does not do division in hardware */ +/* use NO_DIVIDE if your processor does not do division in hardware -- + try it both ways to see which is faster */ #ifdef NO_DIVIDE -# define MOD(a) \ +/* note that this assumes BASE is 65521, where 65536 % 65521 == 15 + (thank you to John Reiser for pointing this out) */ +# define CHOP(a) \ + do { \ + unsigned long tmp = a >> 16; \ + a &= 0xffffUL; \ + a += (tmp << 4) - tmp; \ + } while (0) +# define MOD28(a) \ do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ + CHOP(a); \ if (a >= BASE) a -= BASE; \ } while (0) -# define MOD4(a) \ +# define MOD(a) \ do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ + CHOP(a); \ + MOD28(a); \ + } while (0) +# define MOD63(a) \ + do { /* this assumes a is not negative */ \ + z_off64_t tmp = a >> 32; \ + a &= 0xffffffffL; \ + a += (tmp << 8) - (tmp << 5) + tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ + tmp = a >> 16; \ + a &= 0xffffL; \ + a += (tmp << 4) - tmp; \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE -# define MOD4(a) a %= BASE +# define MOD28(a) a %= BASE +# define MOD63(a) a %= BASE #endif /* ========================================================================= */ @@ -92,7 +97,7 @@ uLong ZEXPORT adler32(adler, buf, len) } if (adler >= BASE) adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ + MOD28(sum2); /* only added so many BASE's */ return adler | (sum2 << 16); } @@ -137,8 +142,13 @@ local uLong adler32_combine_(adler1, adler2, len2) unsigned long sum2; unsigned rem; + /* for negative len, return invalid adler32 as a clue for debugging */ + if (len2 < 0) + return 0xffffffffUL; + /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); + MOD63(len2); /* assumes len2 >= 0 */ + rem = (unsigned)len2; sum1 = adler1 & 0xffff; sum2 = rem * sum1; MOD(sum2); diff --git a/dep/zlib/crc32.c b/dep/zlib/crc32.c index 91be372d224..979a7190a3c 100644 --- a/dep/zlib/crc32.c +++ b/dep/zlib/crc32.c @@ -1,5 +1,5 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010 Mark Adler + * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster @@ -17,6 +17,8 @@ of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). + + DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. */ #ifdef MAKECRCH @@ -30,31 +32,11 @@ #define local static -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include <limits.h> -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - /* Definitions for doing the crc four data bytes at a time. */ +#if !defined(NOBYFOUR) && defined(Z_U4) +# define BYFOUR +#endif #ifdef BYFOUR -# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, @@ -68,16 +50,16 @@ local unsigned long gf2_matrix_times OF((unsigned long *mat, unsigned long vec)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); +local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; +local z_crc_t FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); + local void write_table OF((FILE *, const z_crc_t FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: @@ -107,9 +89,9 @@ local void make_crc_table OF((void)); */ local void make_crc_table() { - unsigned long c; + z_crc_t c; int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ + z_crc_t poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; @@ -121,13 +103,13 @@ local void make_crc_table() first = 0; /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); + poly = 0; + for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) + poly |= (z_crc_t)1 << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { - c = (unsigned long)n; + c = (z_crc_t)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; @@ -138,11 +120,11 @@ local void make_crc_table() and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; - crc_table[4][n] = REV(c); + crc_table[4][n] = ZSWAP32(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); + crc_table[k + 4][n] = ZSWAP32(c); } } #endif /* BYFOUR */ @@ -164,7 +146,7 @@ local void make_crc_table() if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); + fprintf(out, "local const z_crc_t FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR @@ -184,12 +166,13 @@ local void make_crc_table() #ifdef MAKECRCH local void write_table(out, table) FILE *out; - const unsigned long FAR *table; + const z_crc_t FAR *table; { int n; for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", + (unsigned long)(table[n]), n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } #endif /* MAKECRCH */ @@ -204,13 +187,13 @@ local void write_table(out, table) /* ========================================================================= * This function can be used by asm versions of crc32() */ -const unsigned long FAR * ZEXPORT get_crc_table() +const z_crc_t FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; + return (const z_crc_t FAR *)crc_table; } /* ========================================================================= */ @@ -232,7 +215,7 @@ unsigned long ZEXPORT crc32(crc, buf, len) #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; + z_crc_t endian; endian = 1; if (*((unsigned char *)(&endian))) @@ -266,17 +249,17 @@ local unsigned long crc32_little(crc, buf, len) const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = (u4)crc; + c = (z_crc_t)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; @@ -306,17 +289,17 @@ local unsigned long crc32_big(crc, buf, len) const unsigned char FAR *buf; unsigned len; { - register u4 c; - register const u4 FAR *buf4; + register z_crc_t c; + register const z_crc_t FAR *buf4; - c = REV((u4)crc); + c = ZSWAP32((z_crc_t)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } - buf4 = (const u4 FAR *)(const void FAR *)buf; + buf4 = (const z_crc_t FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; @@ -333,7 +316,7 @@ local unsigned long crc32_big(crc, buf, len) c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; - return (unsigned long)(REV(c)); + return (unsigned long)(ZSWAP32(c)); } #endif /* BYFOUR */ diff --git a/dep/zlib/crc32.h b/dep/zlib/crc32.h index 8053b6117c0..9e0c7781025 100644 --- a/dep/zlib/crc32.h +++ b/dep/zlib/crc32.h @@ -2,7 +2,7 @@ * Generated automatically by crc32.c */ -local const unsigned long FAR crc_table[TBLS][256] = +local const z_crc_t FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, diff --git a/dep/zlib/deflate.c b/dep/zlib/deflate.c index 5c4022f3d47..9e4c2cbc8af 100644 --- a/dep/zlib/deflate.c +++ b/dep/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -37,7 +37,7 @@ * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt + * Available in http://tools.ietf.org/html/rfc1951 * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -155,6 +155,9 @@ local const config configuration_table[10] = { struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #endif +/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ +#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) + /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive @@ -235,10 +238,19 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; +#endif } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif #ifdef FASTEST if (level != 0) level = 1; @@ -314,43 +326,70 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) uInt dictLength; { deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; + uInt str, n; + int wrap; + unsigned avail; + unsigned char *next; - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); + wrap = s->wrap; + if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) + return Z_STREAM_ERROR; - if (length < MIN_MATCH) return Z_OK; - if (length > s->w_size) { - length = s->w_size; - dictionary += dictLength - length; /* use the tail of the dictionary */ + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap == 1) + strm->adler = adler32(strm->adler, dictionary, dictLength); + s->wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s->w_size) { + if (wrap == 0) { /* already empty otherwise */ + CLEAR_HASH(s); + s->strstart = 0; + s->block_start = 0L; + s->insert = 0; + } + dictionary += dictLength - s->w_size; /* use the tail */ + dictLength = s->w_size; } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); + /* insert dictionary into window and hash */ + avail = strm->avail_in; + next = strm->next_in; + strm->avail_in = dictLength; + strm->next_in = (Bytef *)dictionary; + fill_window(s); + while (s->lookahead >= MIN_MATCH) { + str = s->strstart; + n = s->lookahead - (MIN_MATCH-1); + do { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + } while (--n); + s->strstart = str; + s->lookahead = MIN_MATCH-1; + fill_window(s); } - if (hash_head) hash_head = 0; /* to make compiler happy */ + s->strstart += s->lookahead; + s->block_start = (long)s->strstart; + s->insert = s->lookahead; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + strm->next_in = next; + strm->avail_in = avail; + s->wrap = wrap; return Z_OK; } /* ========================================================================= */ -int ZEXPORT deflateReset (strm) +int ZEXPORT deflateResetKeep (strm) z_streamp strm; { deflate_state *s; @@ -380,12 +419,23 @@ int ZEXPORT deflateReset (strm) s->last_flush = Z_NO_FLUSH; _tr_init(s); - lm_init(s); return Z_OK; } /* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + int ret; + + ret = deflateResetKeep(strm); + if (ret == Z_OK) + lm_init(strm->state); + return ret; +} + +/* ========================================================================= */ int ZEXPORT deflateSetHeader (strm, head) z_streamp strm; gz_headerp head; @@ -397,14 +447,42 @@ int ZEXPORT deflateSetHeader (strm, head) } /* ========================================================================= */ +int ZEXPORT deflatePending (strm, pending, bits) + unsigned *pending; + int *bits; + z_streamp strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (pending != Z_NULL) + *pending = strm->state->pending; + if (bits != Z_NULL) + *bits = strm->state->bi_valid; + return Z_OK; +} + +/* ========================================================================= */ int ZEXPORT deflatePrime (strm, bits, value) z_streamp strm; int bits; int value; { + deflate_state *s; + int put; + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + s = strm->state; + if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; + do { + put = Buf_size - s->bi_valid; + if (put > bits) + put = bits; + s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); + s->bi_valid += put; + _tr_flush_bits(s); + value >>= put; + bits -= put; + } while (bits); return Z_OK; } @@ -562,19 +640,22 @@ local void putShortMSB (s, b) local void flush_pending(strm) z_streamp strm; { - unsigned len = strm->state->pending; + unsigned len; + deflate_state *s = strm->state; + _tr_flush_bits(s); + len = s->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; - zmemcpy(strm->next_out, strm->state->pending_out, len); + zmemcpy(strm->next_out, s->pending_out, len); strm->next_out += len; - strm->state->pending_out += len; + s->pending_out += len; strm->total_out += len; strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; + s->pending -= len; + if (s->pending == 0) { + s->pending_out = s->pending_buf; } } @@ -801,7 +882,7 @@ int ZEXPORT deflate (strm, flush) * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ - } else if (strm->avail_in == 0 && flush <= old_flush && + } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } @@ -850,6 +931,7 @@ int ZEXPORT deflate (strm, flush) if (s->lookahead == 0) { s->strstart = 0; s->block_start = 0L; + s->insert = 0; } } } @@ -945,12 +1027,12 @@ int ZEXPORT deflateCopy (dest, source) ss = source->state; - zmemcpy(dest, source, sizeof(z_stream)); + zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; - zmemcpy(ds, ss, sizeof(deflate_state)); + zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); @@ -966,8 +1048,8 @@ int ZEXPORT deflateCopy (dest, source) } /* following zmemcpy do not work for 16-bit MSDOS */ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); @@ -1001,15 +1083,15 @@ local int read_buf(strm, buf, size) strm->avail_in -= len; + zmemcpy(buf, strm->next_in, len); if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); + strm->adler = adler32(strm->adler, buf, len); } #ifdef GZIP else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); + strm->adler = crc32(strm->adler, buf, len); } #endif - zmemcpy(buf, strm->next_in, len); strm->next_in += len; strm->total_in += len; @@ -1036,6 +1118,7 @@ local void lm_init (s) s->strstart = 0; s->block_start = 0L; s->lookahead = 0; + s->insert = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; @@ -1310,6 +1393,8 @@ local void fill_window(s) unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; + Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); @@ -1362,7 +1447,7 @@ local void fill_window(s) #endif more += wsize; } - if (s->strm->avail_in == 0) return; + if (s->strm->avail_in == 0) break; /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && @@ -1381,12 +1466,24 @@ local void fill_window(s) s->lookahead += n; /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); + if (s->lookahead + s->insert >= MIN_MATCH) { + uInt str = s->strstart - s->insert; + s->ins_h = s->window[str]; + UPDATE_HASH(s, s->ins_h, s->window[str + 1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif + while (s->insert) { + UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); +#ifndef FASTEST + s->prev[str & s->w_mask] = s->head[s->ins_h]; +#endif + s->head[s->ins_h] = (Pos)str; + str++; + s->insert--; + if (s->lookahead + s->insert < MIN_MATCH) + break; + } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. @@ -1427,6 +1524,9 @@ local void fill_window(s) s->high_water += init; } } + + Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, + "not enough room for search"); } /* =========================================================================== @@ -1506,8 +1606,14 @@ local block_state deflate_stored(s, flush) FLUSH_BLOCK(s, 0); } } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if ((long)s->strstart > s->block_start) + FLUSH_BLOCK(s, 0); + return block_done; } /* =========================================================================== @@ -1603,8 +1709,14 @@ local block_state deflate_fast(s, flush) } if (bflush) FLUSH_BLOCK(s, 0); } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; + s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; } #ifndef FASTEST @@ -1728,8 +1840,14 @@ local block_state deflate_slow(s, flush) _tr_tally_lit(s, s->window[s->strstart-1], bflush); s->match_available = 0; } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; + s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; } #endif /* FASTEST */ @@ -1749,11 +1867,11 @@ local block_state deflate_rle(s, flush) for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes - * for the longest encodable run. + * for the longest run, plus one for the unrolled loop. */ - if (s->lookahead < MAX_MATCH) { + if (s->lookahead <= MAX_MATCH) { fill_window(s); - if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { + if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ @@ -1776,6 +1894,7 @@ local block_state deflate_rle(s, flush) if (s->match_length > s->lookahead) s->match_length = s->lookahead; } + Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ @@ -1796,8 +1915,14 @@ local block_state deflate_rle(s, flush) } if (bflush) FLUSH_BLOCK(s, 0); } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; } /* =========================================================================== @@ -1829,6 +1954,12 @@ local block_state deflate_huff(s, flush) s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; + s->insert = 0; + if (flush == Z_FINISH) { + FLUSH_BLOCK(s, 1); + return finish_done; + } + if (s->last_lit) + FLUSH_BLOCK(s, 0); + return block_done; } diff --git a/dep/zlib/deflate.h b/dep/zlib/deflate.h index cbf0d1ea5d9..fbac44d908e 100644 --- a/dep/zlib/deflate.h +++ b/dep/zlib/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2010 Jean-loup Gailly + * Copyright (C) 1995-2012 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -48,6 +48,9 @@ #define MAX_BITS 15 /* All codes must not exceed MAX_BITS bits */ +#define Buf_size 16 +/* size of bit buffer in bi_buf */ + #define INIT_STATE 42 #define EXTRA_STATE 69 #define NAME_STATE 73 @@ -188,7 +191,7 @@ typedef struct internal_state { int nice_match; /* Stop searching when current match exceeds this */ /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ + /* Didn't use ct_data typedef below to suppress compiler warning */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ @@ -244,7 +247,7 @@ typedef struct internal_state { ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ + uInt insert; /* bytes at end of window left to insert */ #ifdef DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ @@ -294,6 +297,7 @@ void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); +void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); diff --git a/dep/zlib/gzguts.h b/dep/zlib/gzguts.h index 0f8fb79f87d..ee3f281aa57 100644 --- a/dep/zlib/gzguts.h +++ b/dep/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -12,7 +12,7 @@ # endif #endif -#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +#ifdef HAVE_HIDDEN # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL @@ -27,13 +27,65 @@ #endif #include <fcntl.h> +#ifdef _WIN32 +# include <stddef.h> +#endif + +#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) +# include <io.h> +#endif + #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif -#ifdef _MSC_VER -# include <io.h> -# define vsnprintf _vsnprintf +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS +/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 +/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +# ifdef VMS +# define NO_vsnprintf +# endif +# ifdef __OS400__ +# define NO_vsnprintf +# endif +# ifdef __MVS__ +# define NO_vsnprintf +# endif #endif #ifndef local @@ -52,7 +104,7 @@ # include <windows.h> # define zstrerror() gz_strwinerror((DWORD)GetLastError()) #else -# ifdef STDC +# ifndef NO_STRERROR # include <errno.h> # define zstrerror() strerror(errno) # else @@ -68,6 +120,13 @@ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); #endif +/* default memLevel */ +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif + /* default i/o buffer size -- double this for output when reading */ #define GZBUFSIZE 8192 @@ -84,23 +143,25 @@ /* internal gzip file state data structure */ typedef struct { + /* exposed contents for gzgetc() macro */ + struct gzFile_s x; /* "x" for exposed */ + /* x.have: number of bytes available at x.next */ + /* x.next: next output data to deliver or write */ + /* x.pos: current position in uncompressed data */ /* used for both reading and writing */ int mode; /* see gzip modes above */ int fd; /* file descriptor */ char *path; /* path or fd for error messages */ - z_off64_t pos; /* current position in uncompressed data */ unsigned size; /* buffer size, zero if not allocated yet */ unsigned want; /* requested buffer size, default is GZBUFSIZE */ unsigned char *in; /* input buffer */ unsigned char *out; /* output buffer (double-sized when reading) */ - unsigned char *next; /* next output data to deliver or write */ + int direct; /* 0 if processing gzip, 1 if transparent */ /* just for reading */ - unsigned have; /* amount of output data unused at next */ - int eof; /* true if end of input file reached */ - z_off64_t start; /* where the gzip data started, for rewinding */ - z_off64_t raw; /* where the raw data started, for seeking */ int how; /* 0: get header, 1: copy, 2: decompress */ - int direct; /* true if last read direct, false if gzip */ + z_off64_t start; /* where the gzip data started, for rewinding */ + int eof; /* true if end of input file reached */ + int past; /* true if read requested past end */ /* just for writing */ int level; /* compression level */ int strategy; /* compression strategy */ diff --git a/dep/zlib/gzlib.c b/dep/zlib/gzlib.c index 603e60ed544..ca55c6ea926 100644 --- a/dep/zlib/gzlib.c +++ b/dep/zlib/gzlib.c @@ -1,19 +1,23 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010 Mark Adler + * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" +#if defined(_WIN32) && !defined(__BORLANDC__) +# define LSEEK _lseeki64 +#else #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 # define LSEEK lseek64 #else # define LSEEK lseek #endif +#endif /* Local functions */ local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const char *, int, const char *)); +local gzFile gz_open OF((const void *, int, const char *)); #if defined UNDER_CE @@ -71,25 +75,37 @@ char ZLIB_INTERNAL *gz_strwinerror (error) local void gz_reset(state) gz_statep state; { + state->x.have = 0; /* no output data available */ if (state->mode == GZ_READ) { /* for reading ... */ - state->have = 0; /* no output data available */ state->eof = 0; /* not at end of file */ + state->past = 0; /* have not read past end yet */ state->how = LOOK; /* look for gzip header */ - state->direct = 1; /* default for empty file */ } state->seek = 0; /* no seek request pending */ gz_error(state, Z_OK, NULL); /* clear error */ - state->pos = 0; /* no uncompressed data yet */ + state->x.pos = 0; /* no uncompressed data yet */ state->strm.avail_in = 0; /* no input data yet */ } /* Open a gzip file either by name or file descriptor. */ local gzFile gz_open(path, fd, mode) - const char *path; + const void *path; int fd; const char *mode; { gz_statep state; + size_t len; + int oflag; +#ifdef O_CLOEXEC + int cloexec = 0; +#endif +#ifdef O_EXCL + int exclusive = 0; +#endif + + /* check input */ + if (path == NULL) + return NULL; /* allocate gzFile structure to return */ state = malloc(sizeof(gz_state)); @@ -103,6 +119,7 @@ local gzFile gz_open(path, fd, mode) state->mode = GZ_NONE; state->level = Z_DEFAULT_COMPRESSION; state->strategy = Z_DEFAULT_STRATEGY; + state->direct = 0; while (*mode) { if (*mode >= '0' && *mode <= '9') state->level = *mode - '0'; @@ -124,6 +141,16 @@ local gzFile gz_open(path, fd, mode) return NULL; case 'b': /* ignore -- will request binary anyway */ break; +#ifdef O_CLOEXEC + case 'e': + cloexec = 1; + break; +#endif +#ifdef O_EXCL + case 'x': + exclusive = 1; + break; +#endif case 'f': state->strategy = Z_FILTERED; break; @@ -135,6 +162,8 @@ local gzFile gz_open(path, fd, mode) break; case 'F': state->strategy = Z_FIXED; + case 'T': + state->direct = 1; default: /* could consider as an error, but just ignore */ ; } @@ -147,30 +176,67 @@ local gzFile gz_open(path, fd, mode) return NULL; } + /* can't force transparent read */ + if (state->mode == GZ_READ) { + if (state->direct) { + free(state); + return NULL; + } + state->direct = 1; /* for empty file */ + } + /* save the path name for error messages */ - state->path = malloc(strlen(path) + 1); +#ifdef _WIN32 + if (fd == -2) { + len = wcstombs(NULL, path, 0); + if (len == (size_t)-1) + len = 0; + } + else +#endif + len = strlen(path); + state->path = malloc(len + 1); if (state->path == NULL) { free(state); return NULL; } - strcpy(state->path, path); +#ifdef _WIN32 + if (fd == -2) + if (len) + wcstombs(state->path, path, len + 1); + else + *(state->path) = 0; + else +#endif + strcpy(state->path, path); - /* open the file with the appropriate mode (or just use fd) */ - state->fd = fd != -1 ? fd : - open(path, + /* compute the flags for open() */ + oflag = #ifdef O_LARGEFILE - O_LARGEFILE | + O_LARGEFILE | #endif #ifdef O_BINARY - O_BINARY | + O_BINARY | +#endif +#ifdef O_CLOEXEC + (cloexec ? O_CLOEXEC : 0) | #endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | ( - state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))), - 0666); + (state->mode == GZ_READ ? + O_RDONLY : + (O_WRONLY | O_CREAT | +#ifdef O_EXCL + (exclusive ? O_EXCL : 0) | +#endif + (state->mode == GZ_WRITE ? + O_TRUNC : + O_APPEND))); + + /* open the file with the appropriate flags (or just use fd) */ + state->fd = fd > -1 ? fd : ( +#ifdef _WIN32 + fd == -2 ? _wopen(path, oflag, 0666) : +#endif + open(path, oflag, 0666)); if (state->fd == -1) { free(state->path); free(state); @@ -225,6 +291,16 @@ gzFile ZEXPORT gzdopen(fd, mode) } /* -- see zlib.h -- */ +#ifdef _WIN32 +gzFile ZEXPORT gzopen_w(path, mode) + const wchar_t *path; + const char *mode; +{ + return gz_open(path, -2, mode); +} +#endif + +/* -- see zlib.h -- */ int ZEXPORT gzbuffer(file, size) gzFile file; unsigned size; @@ -243,8 +319,8 @@ int ZEXPORT gzbuffer(file, size) return -1; /* check and set requested size */ - if (size == 0) - return -1; + if (size < 2) + size = 2; /* need two bytes to check magic header */ state->want = size; return 0; } @@ -261,7 +337,8 @@ int ZEXPORT gzrewind(file) state = (gz_statep)file; /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) return -1; /* back up and start over */ @@ -289,7 +366,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) return -1; /* check that there's no error */ - if (state->err != Z_OK) + if (state->err != Z_OK && state->err != Z_BUF_ERROR) return -1; /* can only seek from start or relative to current position */ @@ -298,31 +375,32 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* normalize offset to a SEEK_CUR specification */ if (whence == SEEK_SET) - offset -= state->pos; + offset -= state->x.pos; else if (state->seek) offset += state->skip; state->seek = 0; /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && - state->pos + offset >= state->raw) { - ret = LSEEK(state->fd, offset - state->have, SEEK_CUR); + state->x.pos + offset >= 0) { + ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); if (ret == -1) return -1; - state->have = 0; + state->x.have = 0; state->eof = 0; + state->past = 0; state->seek = 0; gz_error(state, Z_OK, NULL); state->strm.avail_in = 0; - state->pos += offset; - return state->pos; + state->x.pos += offset; + return state->x.pos; } /* calculate skip amount, rewinding if needed for back seek when reading */ if (offset < 0) { if (state->mode != GZ_READ) /* writing -- can't go backwards */ return -1; - offset += state->pos; + offset += state->x.pos; if (offset < 0) /* before start of file! */ return -1; if (gzrewind(file) == -1) /* rewind, then skip to offset */ @@ -331,11 +409,11 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* if reading, skip what's in output buffer (one less gzgetc() check) */ if (state->mode == GZ_READ) { - n = GT_OFF(state->have) || (z_off64_t)state->have > offset ? - (unsigned)offset : state->have; - state->have -= n; - state->next += n; - state->pos += n; + n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ? + (unsigned)offset : state->x.have; + state->x.have -= n; + state->x.next += n; + state->x.pos += n; offset -= n; } @@ -344,7 +422,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) state->seek = 1; state->skip = offset; } - return state->pos + offset; + return state->x.pos + offset; } /* -- see zlib.h -- */ @@ -373,7 +451,7 @@ z_off64_t ZEXPORT gztell64(file) return -1; /* return position */ - return state->pos + (state->seek ? state->skip : 0); + return state->x.pos + (state->seek ? state->skip : 0); } /* -- see zlib.h -- */ @@ -433,8 +511,7 @@ int ZEXPORT gzeof(file) return 0; /* return end-of-file state */ - return state->mode == GZ_READ ? - (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0; + return state->mode == GZ_READ ? state->past : 0; } /* -- see zlib.h -- */ @@ -471,8 +548,10 @@ void ZEXPORT gzclearerr(file) return; /* clear error and end-of-file */ - if (state->mode == GZ_READ) + if (state->mode == GZ_READ) { state->eof = 0; + state->past = 0; + } gz_error(state, Z_OK, NULL); } @@ -494,6 +573,10 @@ void ZLIB_INTERNAL gz_error(state, err, msg) state->msg = NULL; } + /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ + if (err != Z_OK && err != Z_BUF_ERROR) + state->x.have = 0; + /* set error code, and if no message, then done */ state->err = err; if (msg == NULL) diff --git a/dep/zlib/gzread.c b/dep/zlib/gzread.c index 548201ab009..3493d34d4ea 100644 --- a/dep/zlib/gzread.c +++ b/dep/zlib/gzread.c @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -8,10 +8,9 @@ /* Local functions */ local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); local int gz_avail OF((gz_statep)); -local int gz_next4 OF((gz_statep, unsigned long *)); -local int gz_head OF((gz_statep)); +local int gz_look OF((gz_statep)); local int gz_decomp OF((gz_statep)); -local int gz_make OF((gz_statep)); +local int gz_fetch OF((gz_statep)); local int gz_skip OF((gz_statep, z_off64_t)); /* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from @@ -46,67 +45,47 @@ local int gz_load(state, buf, len, have) error, 0 otherwise. Note that the eof flag is set when the end of the input file is reached, even though there may be unused data in the buffer. Once that data has been used, no more attempts will be made to read the file. - gz_avail() assumes that strm->avail_in == 0. */ + If strm->avail_in != 0, then the current data is moved to the beginning of + the input buffer, and then the remainder of the buffer is loaded with the + available data from the input file. */ local int gz_avail(state) gz_statep state; { + unsigned got; z_streamp strm = &(state->strm); - if (state->err != Z_OK) + if (state->err != Z_OK && state->err != Z_BUF_ERROR) return -1; if (state->eof == 0) { - if (gz_load(state, state->in, state->size, - (unsigned *)&(strm->avail_in)) == -1) + if (strm->avail_in) { /* copy what's there to the start */ + unsigned char *p = state->in, *q = strm->next_in; + unsigned n = strm->avail_in; + do { + *p++ = *q++; + } while (--n); + } + if (gz_load(state, state->in + strm->avail_in, + state->size - strm->avail_in, &got) == -1) return -1; + strm->avail_in += got; strm->next_in = state->in; } return 0; } -/* Get next byte from input, or -1 if end or error. */ -#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \ - (strm->avail_in == 0 ? -1 : \ - (strm->avail_in--, *(strm->next_in)++))) - -/* Get a four-byte little-endian integer and return 0 on success and the value - in *ret. Otherwise -1 is returned and *ret is not modified. */ -local int gz_next4(state, ret) - gz_statep state; - unsigned long *ret; -{ - int ch; - unsigned long val; - z_streamp strm = &(state->strm); - - val = NEXT(); - val += (unsigned)NEXT() << 8; - val += (unsigned long)NEXT() << 16; - ch = NEXT(); - if (ch == -1) - return -1; - val += (unsigned long)ch << 24; - *ret = val; - return 0; -} - -/* Look for gzip header, set up for inflate or copy. state->have must be zero. +/* Look for gzip header, set up for inflate or copy. state->x.have must be 0. If this is the first time in, allocate required memory. state->how will be left unchanged if there is no more input data available, will be set to COPY if there is no gzip header and direct copying will be performed, or it will - be set to GZIP for decompression, and the gzip header will be skipped so - that the next available input data is the raw deflate stream. If direct - copying, then leftover input data from the input buffer will be copied to - the output buffer. In that case, all further file reads will be directly to - either the output buffer or a user buffer. If decompressing, the inflate - state and the check value will be initialized. gz_head() will return 0 on - success or -1 on failure. Failures may include read errors or gzip header - errors. */ -local int gz_head(state) + be set to GZIP for decompression. If direct copying, then leftover input + data from the input buffer will be copied to the output buffer. In that + case, all further file reads will be directly to either the output buffer or + a user buffer. If decompressing, the inflate state will be initialized. + gz_look() will return 0 on success or -1 on failure. */ +local int gz_look(state) gz_statep state; { z_streamp strm = &(state->strm); - int flags; - unsigned len; /* allocate read buffers and inflate memory */ if (state->size == 0) { @@ -129,7 +108,7 @@ local int gz_head(state) state->strm.opaque = Z_NULL; state->strm.avail_in = 0; state->strm.next_in = Z_NULL; - if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */ + if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */ free(state->out); free(state->in); state->size = 0; @@ -138,83 +117,45 @@ local int gz_head(state) } } - /* get some data in the input buffer */ - if (strm->avail_in == 0) { + /* get at least the magic bytes in the input buffer */ + if (strm->avail_in < 2) { if (gz_avail(state) == -1) return -1; if (strm->avail_in == 0) return 0; } - /* look for the gzip magic header bytes 31 and 139 */ - if (strm->next_in[0] == 31) { - strm->avail_in--; - strm->next_in++; - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in && strm->next_in[0] == 139) { - /* we have a gzip header, woo hoo! */ - strm->avail_in--; - strm->next_in++; - - /* skip rest of header */ - if (NEXT() != 8) { /* compression method */ - gz_error(state, Z_DATA_ERROR, "unknown compression method"); - return -1; - } - flags = NEXT(); - if (flags & 0xe0) { /* reserved flag bits */ - gz_error(state, Z_DATA_ERROR, "unknown header flags set"); - return -1; - } - NEXT(); /* modification time */ - NEXT(); - NEXT(); - NEXT(); - NEXT(); /* extra flags */ - NEXT(); /* operating system */ - if (flags & 4) { /* extra field */ - len = (unsigned)NEXT(); - len += (unsigned)NEXT() << 8; - while (len--) - if (NEXT() < 0) - break; - } - if (flags & 8) /* file name */ - while (NEXT() > 0) - ; - if (flags & 16) /* comment */ - while (NEXT() > 0) - ; - if (flags & 2) { /* header crc */ - NEXT(); - NEXT(); - } - /* an unexpected end of file is not checked for here -- it will be - noticed on the first request for uncompressed data */ - - /* set up for decompression */ - inflateReset(strm); - strm->adler = crc32(0L, Z_NULL, 0); - state->how = GZIP; - state->direct = 0; - return 0; - } - else { - /* not a gzip file -- save first byte (31) and fall to raw i/o */ - state->out[0] = 31; - state->have = 1; - } + /* look for gzip magic bytes -- if there, do gzip decoding (note: there is + a logical dilemma here when considering the case of a partially written + gzip file, to wit, if a single 31 byte is written, then we cannot tell + whether this is a single-byte file, or just a partially written gzip + file -- for here we assume that if a gzip file is being written, then + the header will be written in a single operation, so that reading a + single byte is sufficient indication that it is not a gzip file) */ + if (strm->avail_in > 1 && + strm->next_in[0] == 31 && strm->next_in[1] == 139) { + inflateReset(strm); + state->how = GZIP; + state->direct = 0; + return 0; + } + + /* no gzip header -- if we were decoding gzip before, then this is trailing + garbage. Ignore the trailing garbage and finish. */ + if (state->direct == 0) { + strm->avail_in = 0; + state->eof = 1; + state->x.have = 0; + return 0; } - /* doing raw i/o, save start of raw data for seeking, copy any leftover - input to output -- this assumes that the output buffer is larger than - the input buffer, which also assures space for gzungetc() */ - state->raw = state->pos; - state->next = state->out; + /* doing raw i/o, copy any leftover input to output -- this assumes that + the output buffer is larger than the input buffer, which also assures + space for gzungetc() */ + state->x.next = state->out; if (strm->avail_in) { - memcpy(state->next + state->have, strm->next_in, strm->avail_in); - state->have += strm->avail_in; + memcpy(state->x.next, strm->next_in, strm->avail_in); + state->x.have = strm->avail_in; strm->avail_in = 0; } state->how = COPY; @@ -223,19 +164,15 @@ local int gz_head(state) } /* Decompress from input to the provided next_out and avail_out in the state. - If the end of the compressed data is reached, then verify the gzip trailer - check value and length (modulo 2^32). state->have and state->next are set - to point to the just decompressed data, and the crc is updated. If the - trailer is verified, state->how is reset to LOOK to look for the next gzip - stream or raw data, once state->have is depleted. Returns 0 on success, -1 - on failure. Failures may include invalid compressed data or a failed gzip - trailer verification. */ + On return, state->x.have and state->x.next point to the just decompressed + data. If the gzip stream completes, state->how is reset to LOOK to look for + the next gzip stream or raw data, once state->x.have is depleted. Returns 0 + on success, -1 on failure. */ local int gz_decomp(state) gz_statep state; { - int ret; + int ret = Z_OK; unsigned had; - unsigned long crc, len; z_streamp strm = &(state->strm); /* fill output buffer up to end of deflate stream */ @@ -245,15 +182,15 @@ local int gz_decomp(state) if (strm->avail_in == 0 && gz_avail(state) == -1) return -1; if (strm->avail_in == 0) { - gz_error(state, Z_DATA_ERROR, "unexpected end of file"); - return -1; + gz_error(state, Z_BUF_ERROR, "unexpected end of file"); + break; } /* decompress and handle errors */ ret = inflate(strm, Z_NO_FLUSH); if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { gz_error(state, Z_STREAM_ERROR, - "internal error: inflate stream corrupt"); + "internal error: inflate stream corrupt"); return -1; } if (ret == Z_MEM_ERROR) { @@ -262,67 +199,55 @@ local int gz_decomp(state) } if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ gz_error(state, Z_DATA_ERROR, - strm->msg == NULL ? "compressed data error" : strm->msg); + strm->msg == NULL ? "compressed data error" : strm->msg); return -1; } } while (strm->avail_out && ret != Z_STREAM_END); - /* update available output and crc check value */ - state->have = had - strm->avail_out; - state->next = strm->next_out - state->have; - strm->adler = crc32(strm->adler, state->next, state->have); + /* update available output */ + state->x.have = had - strm->avail_out; + state->x.next = strm->next_out - state->x.have; - /* check gzip trailer if at end of deflate stream */ - if (ret == Z_STREAM_END) { - if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) { - gz_error(state, Z_DATA_ERROR, "unexpected end of file"); - return -1; - } - if (crc != strm->adler) { - gz_error(state, Z_DATA_ERROR, "incorrect data check"); - return -1; - } - if (len != (strm->total_out & 0xffffffffL)) { - gz_error(state, Z_DATA_ERROR, "incorrect length check"); - return -1; - } - state->how = LOOK; /* ready for next stream, once have is 0 (leave - state->direct unchanged to remember how) */ - } + /* if the gzip stream completed successfully, look for another */ + if (ret == Z_STREAM_END) + state->how = LOOK; /* good decompression */ return 0; } -/* Make data and put in the output buffer. Assumes that state->have == 0. +/* Fetch data and put it in the output buffer. Assumes state->x.have is 0. Data is either copied from the input file or decompressed from the input file depending on state->how. If state->how is LOOK, then a gzip header is - looked for (and skipped if found) to determine wither to copy or decompress. - Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY - or GZIP unless the end of the input file has been reached and all data has - been processed. */ -local int gz_make(state) + looked for to determine whether to copy or decompress. Returns -1 on error, + otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the + end of the input file has been reached and all data has been processed. */ +local int gz_fetch(state) gz_statep state; { z_streamp strm = &(state->strm); - if (state->how == LOOK) { /* look for gzip header */ - if (gz_head(state) == -1) - return -1; - if (state->have) /* got some data from gz_head() */ + do { + switch(state->how) { + case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ + if (gz_look(state) == -1) + return -1; + if (state->how == LOOK) + return 0; + break; + case COPY: /* -> COPY */ + if (gz_load(state, state->out, state->size << 1, &(state->x.have)) + == -1) + return -1; + state->x.next = state->out; return 0; - } - if (state->how == COPY) { /* straight copy */ - if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1) - return -1; - state->next = state->out; - } - else if (state->how == GZIP) { /* decompress */ - strm->avail_out = state->size << 1; - strm->next_out = state->out; - if (gz_decomp(state) == -1) - return -1; - } + case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */ + strm->avail_out = state->size << 1; + strm->next_out = state->out; + if (gz_decomp(state) == -1) + return -1; + } + } while (state->x.have == 0 && (!state->eof || strm->avail_in)); return 0; } @@ -336,12 +261,12 @@ local int gz_skip(state, len) /* skip over len bytes or reach end-of-file, whichever comes first */ while (len) /* skip over whatever is in output buffer */ - if (state->have) { - n = GT_OFF(state->have) || (z_off64_t)state->have > len ? - (unsigned)len : state->have; - state->have -= n; - state->next += n; - state->pos += n; + if (state->x.have) { + n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ? + (unsigned)len : state->x.have; + state->x.have -= n; + state->x.next += n; + state->x.pos += n; len -= n; } @@ -352,7 +277,7 @@ local int gz_skip(state, len) /* need more data to skip -- load up output buffer */ else { /* get more output, looking for header if required */ - if (gz_make(state) == -1) + if (gz_fetch(state) == -1) return -1; } return 0; @@ -374,14 +299,15 @@ int ZEXPORT gzread(file, buf, len) state = (gz_statep)file; strm = &(state->strm); - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) return -1; /* since an int is returned, make sure len fits in one, otherwise return with an error (this avoids the flaw in the interface) */ if ((int)len < 0) { - gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); return -1; } @@ -400,24 +326,26 @@ int ZEXPORT gzread(file, buf, len) got = 0; do { /* first just try copying data from the output buffer */ - if (state->have) { - n = state->have > len ? len : state->have; - memcpy(buf, state->next, n); - state->next += n; - state->have -= n; + if (state->x.have) { + n = state->x.have > len ? len : state->x.have; + memcpy(buf, state->x.next, n); + state->x.next += n; + state->x.have -= n; } /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && strm->avail_in == 0) + else if (state->eof && strm->avail_in == 0) { + state->past = 1; /* tried to read past end */ break; + } /* need output data -- for small len or new stream load up our output buffer */ else if (state->how == LOOK || len < (state->size << 1)) { /* get more output, looking for header if required */ - if (gz_make(state) == -1) + if (gz_fetch(state) == -1) return -1; - continue; /* no progress yet -- go back to memcpy() above */ + continue; /* no progress yet -- go back to copy above */ /* the copy above assures that we will leave with space in the output buffer, allowing at least one gzungetc() to succeed */ } @@ -434,15 +362,15 @@ int ZEXPORT gzread(file, buf, len) strm->next_out = buf; if (gz_decomp(state) == -1) return -1; - n = state->have; - state->have = 0; + n = state->x.have; + state->x.have = 0; } /* update progress */ len -= n; buf = (char *)buf + n; got += n; - state->pos += n; + state->x.pos += n; } while (len); /* return number of bytes read into user buffer (will fit in int) */ @@ -450,6 +378,7 @@ int ZEXPORT gzread(file, buf, len) } /* -- see zlib.h -- */ +#undef gzgetc int ZEXPORT gzgetc(file) gzFile file; { @@ -462,15 +391,16 @@ int ZEXPORT gzgetc(file) return -1; state = (gz_statep)file; - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) return -1; /* try output buffer (no need to check for skip request) */ - if (state->have) { - state->have--; - state->pos++; - return *(state->next)++; + if (state->x.have) { + state->x.have--; + state->x.pos++; + return *(state->x.next)++; } /* nothing there -- try gzread() */ @@ -478,6 +408,12 @@ int ZEXPORT gzgetc(file) return ret < 1 ? -1 : buf[0]; } +int ZEXPORT gzgetc_(file) +gzFile file; +{ + return gzgetc(file); +} + /* -- see zlib.h -- */ int ZEXPORT gzungetc(c, file) int c; @@ -490,8 +426,9 @@ int ZEXPORT gzungetc(c, file) return -1; state = (gz_statep)file; - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) return -1; /* process a skip request */ @@ -506,32 +443,34 @@ int ZEXPORT gzungetc(c, file) return -1; /* if output buffer empty, put byte at end (allows more pushing) */ - if (state->have == 0) { - state->have = 1; - state->next = state->out + (state->size << 1) - 1; - state->next[0] = c; - state->pos--; + if (state->x.have == 0) { + state->x.have = 1; + state->x.next = state->out + (state->size << 1) - 1; + state->x.next[0] = c; + state->x.pos--; + state->past = 0; return c; } /* if no room, give up (must have already done a gzungetc()) */ - if (state->have == (state->size << 1)) { - gz_error(state, Z_BUF_ERROR, "out of room to push characters"); + if (state->x.have == (state->size << 1)) { + gz_error(state, Z_DATA_ERROR, "out of room to push characters"); return -1; } /* slide output data if needed and insert byte before existing data */ - if (state->next == state->out) { - unsigned char *src = state->out + state->have; + if (state->x.next == state->out) { + unsigned char *src = state->out + state->x.have; unsigned char *dest = state->out + (state->size << 1); while (src > state->out) *--dest = *--src; - state->next = dest; + state->x.next = dest; } - state->have++; - state->next--; - state->next[0] = c; - state->pos--; + state->x.have++; + state->x.next--; + state->x.next[0] = c; + state->x.pos--; + state->past = 0; return c; } @@ -551,8 +490,9 @@ char * ZEXPORT gzgets(file, buf, len) return NULL; state = (gz_statep)file; - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || state->err != Z_OK) + /* check that we're reading and that there's no (serious) error */ + if (state->mode != GZ_READ || + (state->err != Z_OK && state->err != Z_BUF_ERROR)) return NULL; /* process a skip request */ @@ -569,32 +509,31 @@ char * ZEXPORT gzgets(file, buf, len) left = (unsigned)len - 1; if (left) do { /* assure that something is in the output buffer */ - if (state->have == 0) { - if (gz_make(state) == -1) - return NULL; /* error */ - if (state->have == 0) { /* end of file */ - if (buf == str) /* got bupkus */ - return NULL; - break; /* got something -- return it */ - } + if (state->x.have == 0 && gz_fetch(state) == -1) + return NULL; /* error */ + if (state->x.have == 0) { /* end of file */ + state->past = 1; /* read past end */ + break; /* return what we have */ } /* look for end-of-line in current output buffer */ - n = state->have > left ? left : state->have; - eol = memchr(state->next, '\n', n); + n = state->x.have > left ? left : state->x.have; + eol = memchr(state->x.next, '\n', n); if (eol != NULL) - n = (unsigned)(eol - state->next) + 1; + n = (unsigned)(eol - state->x.next) + 1; /* copy through end-of-line, or remainder if not found */ - memcpy(buf, state->next, n); - state->have -= n; - state->next += n; - state->pos += n; + memcpy(buf, state->x.next, n); + state->x.have -= n; + state->x.next += n; + state->x.pos += n; left -= n; buf += n; } while (left && eol == NULL); - /* found end-of-line or out of space -- terminate string and return it */ + /* return terminated string, or if nothing, end of file */ + if (buf == str) + return NULL; buf[0] = 0; return str; } @@ -610,16 +549,12 @@ int ZEXPORT gzdirect(file) return 0; state = (gz_statep)file; - /* check that we're reading */ - if (state->mode != GZ_READ) - return 0; - /* if the state is not known, but we can find out, then do so (this is mainly for right after a gzopen() or gzdopen()) */ - if (state->how == LOOK && state->have == 0) - (void)gz_head(state); + if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) + (void)gz_look(state); - /* return 1 if reading direct, 0 if decompressing a gzip stream */ + /* return 1 if transparent, 0 if processing a gzip stream */ return state->direct; } @@ -627,7 +562,7 @@ int ZEXPORT gzdirect(file) int ZEXPORT gzclose_r(file) gzFile file; { - int ret; + int ret, err; gz_statep state; /* get internal structure */ @@ -645,9 +580,10 @@ int ZEXPORT gzclose_r(file) free(state->out); free(state->in); } + err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK; gz_error(state, Z_OK, NULL); free(state->path); ret = close(state->fd); free(state); - return ret ? Z_ERRNO : Z_OK; + return ret ? Z_ERRNO : err; } diff --git a/dep/zlib/gzwrite.c b/dep/zlib/gzwrite.c index e8defc6887a..27cb3428e32 100644 --- a/dep/zlib/gzwrite.c +++ b/dep/zlib/gzwrite.c @@ -1,5 +1,5 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -18,44 +18,55 @@ local int gz_init(state) int ret; z_streamp strm = &(state->strm); - /* allocate input and output buffers */ + /* allocate input buffer */ state->in = malloc(state->want); - state->out = malloc(state->want); - if (state->in == NULL || state->out == NULL) { - if (state->out != NULL) - free(state->out); - if (state->in != NULL) - free(state->in); + if (state->in == NULL) { gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } - /* allocate deflate memory, set up for gzip compression */ - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - ret = deflateInit2(strm, state->level, Z_DEFLATED, - 15 + 16, 8, state->strategy); - if (ret != Z_OK) { - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; + /* only need output buffer and deflate state if compressing */ + if (!state->direct) { + /* allocate output buffer */ + state->out = malloc(state->want); + if (state->out == NULL) { + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } + + /* allocate deflate memory, set up for gzip compression */ + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; + ret = deflateInit2(strm, state->level, Z_DEFLATED, + MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); + if (ret != Z_OK) { + free(state->out); + free(state->in); + gz_error(state, Z_MEM_ERROR, "out of memory"); + return -1; + } } /* mark state as initialized */ state->size = state->want; - /* initialize write buffer */ - strm->avail_out = state->size; - strm->next_out = state->out; - state->next = strm->next_out; + /* initialize write buffer if compressing */ + if (!state->direct) { + strm->avail_out = state->size; + strm->next_out = state->out; + state->x.next = strm->next_out; + } return 0; } /* Compress whatever is at avail_in and next_in and write to the output file. Return -1 if there is an error writing to the output file, otherwise 0. flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, - then the deflate() state is reset to start a new gzip stream. */ + then the deflate() state is reset to start a new gzip stream. If gz->direct + is true, then simply write to the output file without compressing, and + ignore flush. */ local int gz_comp(state, flush) gz_statep state; int flush; @@ -68,6 +79,17 @@ local int gz_comp(state, flush) if (state->size == 0 && gz_init(state) == -1) return -1; + /* write directly if requested */ + if (state->direct) { + got = write(state->fd, strm->next_in, strm->avail_in); + if (got < 0 || (unsigned)got != strm->avail_in) { + gz_error(state, Z_ERRNO, zstrerror()); + return -1; + } + strm->avail_in = 0; + return 0; + } + /* run deflate() on provided input until it produces no more output */ ret = Z_OK; do { @@ -75,8 +97,8 @@ local int gz_comp(state, flush) doing Z_FINISH then don't write until we get to Z_STREAM_END */ if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && (flush != Z_FINISH || ret == Z_STREAM_END))) { - have = (unsigned)(strm->next_out - state->next); - if (have && ((got = write(state->fd, state->next, have)) < 0 || + have = (unsigned)(strm->next_out - state->x.next); + if (have && ((got = write(state->fd, state->x.next, have)) < 0 || (unsigned)got != have)) { gz_error(state, Z_ERRNO, zstrerror()); return -1; @@ -85,7 +107,7 @@ local int gz_comp(state, flush) strm->avail_out = state->size; strm->next_out = state->out; } - state->next = strm->next_out; + state->x.next = strm->next_out; } /* compress */ @@ -131,7 +153,7 @@ local int gz_zero(state, len) } strm->avail_in = n; strm->next_in = state->in; - state->pos += n; + state->x.pos += n; if (gz_comp(state, Z_NO_FLUSH) == -1) return -1; len -= n; @@ -163,7 +185,7 @@ int ZEXPORT gzwrite(file, buf, len) /* since an int is returned, make sure len fits in one, otherwise return with an error (this avoids the flaw in the interface) */ if ((int)len < 0) { - gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); + gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); return 0; } @@ -193,7 +215,7 @@ int ZEXPORT gzwrite(file, buf, len) n = len; memcpy(strm->next_in + strm->avail_in, buf, n); strm->avail_in += n; - state->pos += n; + state->x.pos += n; buf = (char *)buf + n; len -= n; if (len && gz_comp(state, Z_NO_FLUSH) == -1) @@ -208,7 +230,7 @@ int ZEXPORT gzwrite(file, buf, len) /* directly compress user buffer to file */ strm->avail_in = len; strm->next_in = (voidp)buf; - state->pos += len; + state->x.pos += len; if (gz_comp(state, Z_NO_FLUSH) == -1) return 0; } @@ -249,15 +271,15 @@ int ZEXPORT gzputc(file, c) if (strm->avail_in == 0) strm->next_in = state->in; strm->next_in[strm->avail_in++] = c; - state->pos++; - return c; + state->x.pos++; + return c & 0xff; } /* no room in buffer or not initialized, use gz_write() */ buf[0] = c; if (gzwrite(file, buf, 1) != 1) return -1; - return c; + return c & 0xff; } /* -- see zlib.h -- */ @@ -274,7 +296,7 @@ int ZEXPORT gzputs(file, str) return ret == 0 && len != 0 ? -1 : ret; } -#ifdef STDC +#if defined(STDC) || defined(Z_HAVE_STDARG_H) #include <stdarg.h> /* -- see zlib.h -- */ @@ -316,19 +338,19 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) va_start(va, format); #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void - (void)vsprintf(state->in, format, va); + (void)vsprintf((char *)(state->in), format, va); va_end(va); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else - len = vsprintf(state->in, format, va); + len = vsprintf((char *)(state->in), format, va); va_end(va); # endif #else # ifdef HAS_vsnprintf_void - (void)vsnprintf(state->in, size, format, va); + (void)vsnprintf((char *)(state->in), size, format, va); va_end(va); - len = strlen(state->in); + len = strlen((char *)(state->in)); # else len = vsnprintf((char *)(state->in), size, format, va); va_end(va); @@ -342,11 +364,11 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) /* update buffer and position, defer compression until needed */ strm->avail_in = (unsigned)len; strm->next_in = state->in; - state->pos += len; + state->x.pos += len; return len; } -#else /* !STDC */ +#else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, @@ -366,6 +388,10 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, state = (gz_statep)file; strm = &(state->strm); + /* check that can really pass pointer in ints */ + if (sizeof(int) != sizeof(void *)) + return 0; + /* check that we're writing and that there's no error */ if (state->mode != GZ_WRITE || state->err != Z_OK) return 0; @@ -390,22 +416,23 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, state->in[size - 1] = 0; #ifdef NO_snprintf # ifdef HAS_sprintf_void - sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, + sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else - len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); # endif #else # ifdef HAS_snprintf_void - snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, + snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(state->in); + len = strlen((char *)(state->in)); # else - len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, + a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, + a19, a20); # endif #endif @@ -416,7 +443,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, /* update buffer and position, defer compression until needed */ strm->avail_in = (unsigned)len; strm->next_in = state->in; - state->pos += len; + state->x.pos += len; return len; } @@ -500,7 +527,7 @@ int ZEXPORT gzsetparams(file, level, strategy) int ZEXPORT gzclose_w(file) gzFile file; { - int ret = 0; + int ret = Z_OK; gz_statep state; /* get internal structure */ @@ -515,17 +542,24 @@ int ZEXPORT gzclose_w(file) /* check for seek request */ if (state->seek) { state->seek = 0; - ret += gz_zero(state, state->skip); + if (gz_zero(state, state->skip) == -1) + ret = state->err; } /* flush, free memory, and close file */ - ret += gz_comp(state, Z_FINISH); - (void)deflateEnd(&(state->strm)); - free(state->out); - free(state->in); + if (state->size) { + if (gz_comp(state, Z_FINISH) == -1) + ret = state->err; + if (!state->direct) { + (void)deflateEnd(&(state->strm)); + free(state->out); + } + free(state->in); + } gz_error(state, Z_OK, NULL); free(state->path); - ret += close(state->fd); + if (close(state->fd) == -1) + ret = Z_ERRNO; free(state); - return ret ? Z_ERRNO : Z_OK; + return ret; } diff --git a/dep/zlib/infback.c b/dep/zlib/infback.c index af3a8c965d5..981aff17c2d 100644 --- a/dep/zlib/infback.c +++ b/dep/zlib/infback.c @@ -1,5 +1,5 @@ /* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2009 Mark Adler + * Copyright (C) 1995-2011 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -42,10 +42,19 @@ int stream_size; return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; +#endif } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif state = (struct inflate_state FAR *)ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; @@ -394,7 +403,6 @@ void FAR *out_desc; PULLBYTE(); } if (here.val < 16) { - NEEDBITS(here.bits); DROPBITS(here.bits); state->lens[state->have++] = here.val; } diff --git a/dep/zlib/inffixed.h b/dep/zlib/inffixed.h index 75ed4b5978d..d6283277694 100644 --- a/dep/zlib/inffixed.h +++ b/dep/zlib/inffixed.h @@ -2,9 +2,9 @@ * Generated automatically by makefixed(). */ - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. + /* WARNING: this file should *not* be used by applications. + It is part of the implementation of this library and is + subject to change. Applications should only use zlib.h. */ static const code lenfix[512] = { diff --git a/dep/zlib/inflate.c b/dep/zlib/inflate.c index a8431abeacf..47418a1e1e1 100644 --- a/dep/zlib/inflate.c +++ b/dep/zlib/inflate.c @@ -1,5 +1,5 @@ /* inflate.c -- zlib decompression - * Copyright (C) 1995-2010 Mark Adler + * Copyright (C) 1995-2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -100,7 +100,7 @@ local int updatewindow OF((z_streamp strm, unsigned out)); local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, unsigned len)); -int ZEXPORT inflateReset(strm) +int ZEXPORT inflateResetKeep(strm) z_streamp strm; { struct inflate_state FAR *state; @@ -109,15 +109,13 @@ z_streamp strm; state = (struct inflate_state FAR *)strm->state; strm->total_in = strm->total_out = state->total = 0; strm->msg = Z_NULL; - strm->adler = 1; /* to support ill-conceived Java test suite */ + if (state->wrap) /* to support ill-conceived Java test suite */ + strm->adler = state->wrap & 1; state->mode = HEAD; state->last = 0; state->havedict = 0; state->dmax = 32768U; state->head = Z_NULL; - state->wsize = 0; - state->whave = 0; - state->wnext = 0; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; @@ -127,6 +125,19 @@ z_streamp strm; return Z_OK; } +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + state->wsize = 0; + state->whave = 0; + state->wnext = 0; + return inflateResetKeep(strm); +} + int ZEXPORT inflateReset2(strm, windowBits) z_streamp strm; int windowBits; @@ -180,10 +191,19 @@ int stream_size; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else strm->zalloc = zcalloc; strm->opaque = (voidpf)0; +#endif } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; + if (strm->zfree == (free_func)0) +#ifdef Z_SOLO + return Z_STREAM_ERROR; +#else + strm->zfree = zcfree; +#endif state = (struct inflate_state FAR *) ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; @@ -321,8 +341,8 @@ void makefixed() low = 0; for (;;) { if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); + printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, + state.lencode[low].bits, state.lencode[low].val); if (++low == size) break; putchar(','); } @@ -499,11 +519,6 @@ unsigned out; bits -= bits & 7; \ } while (0) -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is @@ -797,7 +812,7 @@ int flush; #endif case DICTID: NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); + strm->adler = state->check = ZSWAP32(hold); INITBITS(); state->mode = DICT; case DICT: @@ -925,7 +940,6 @@ int flush; PULLBYTE(); } if (here.val < 16) { - NEEDBITS(here.bits); DROPBITS(here.bits); state->lens[state->have++] = here.val; } @@ -1170,7 +1184,7 @@ int flush; #ifdef GUNZIP state->flags ? hold : #endif - REVERSE(hold)) != state->check) { + ZSWAP32(hold)) != state->check) { strm->msg = (char *)"incorrect data check"; state->mode = BAD; break; @@ -1214,7 +1228,8 @@ int flush; */ inf_leave: RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (state->wsize || (out != strm->avail_out && state->mode < BAD && + (state->mode < CHECK || flush != Z_FINISH))) if (updatewindow(strm, out)) { state->mode = MEM; return Z_MEM_ERROR; @@ -1255,7 +1270,10 @@ const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; - unsigned long id; + unsigned long dictid; + unsigned char *next; + unsigned avail; + int ret; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; @@ -1263,29 +1281,27 @@ uInt dictLength; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; - /* check for correct dictionary id */ + /* check for correct dictionary identifier */ if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) + dictid = adler32(0L, Z_NULL, 0); + dictid = adler32(dictid, dictionary, dictLength); + if (dictid != state->check) return Z_DATA_ERROR; } - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + next = strm->next_out; + avail = strm->avail_out; + strm->next_out = (Bytef *)dictionary + dictLength; + strm->avail_out = 0; + ret = updatewindow(strm, dictLength); + strm->avail_out = avail; + strm->next_out = next; + if (ret) { state->mode = MEM; return Z_MEM_ERROR; } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } state->havedict = 1; Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; @@ -1433,8 +1449,8 @@ z_streamp source; } /* copy state */ - zmemcpy(dest, source, sizeof(z_stream)); - zmemcpy(copy, state, sizeof(struct inflate_state)); + zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); + zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); diff --git a/dep/zlib/inftrees.c b/dep/zlib/inftrees.c index 11e9c52accb..abcd7c45ed3 100644 --- a/dep/zlib/inftrees.c +++ b/dep/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2010 Mark Adler + * Copyright (C) 1995-2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; + " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, @@ -289,38 +289,14 @@ unsigned short FAR *work; } } - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)(len - drop); - here.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - here.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = here; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff != 0) { + here.op = (unsigned char)64; /* invalid code marker */ + here.bits = (unsigned char)(len - drop); + here.val = (unsigned short)0; + next[huff] = here; } /* set return parameters */ diff --git a/dep/zlib/trees.c b/dep/zlib/trees.c index 56e9bb1c115..8c32b214b1d 100644 --- a/dep/zlib/trees.c +++ b/dep/zlib/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2010 Jean-loup Gailly + * Copyright (C) 1995-2012 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -74,11 +74,6 @@ local const uch bl_order[BL_CODES] * probability, to avoid transmitting the lengths for unused bit length codes. */ -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - /* =========================================================================== * Local data. These are initialized only once. */ @@ -399,7 +394,6 @@ void ZLIB_INTERNAL _tr_init(s) s->bi_buf = 0; s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ #ifdef DEBUG s->compressed_len = 0L; s->bits_sent = 0L; @@ -883,15 +877,17 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) } /* =========================================================================== + * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) + */ +void ZLIB_INTERNAL _tr_flush_bits(s) + deflate_state *s; +{ + bi_flush(s); +} + +/* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. */ void ZLIB_INTERNAL _tr_align(s) deflate_state *s; @@ -902,20 +898,6 @@ void ZLIB_INTERNAL _tr_align(s) s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; } /* =========================================================================== @@ -1118,7 +1100,6 @@ local void compress_block(s, ltree, dtree) } while (lx < s->last_lit); send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; } /* =========================================================================== @@ -1226,7 +1207,6 @@ local void copy_block(s, buf, len, header) int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { put_short(s, (ush)len); diff --git a/dep/zlib/zconf.h b/dep/zlib/zconf.h index 02ce56c4313..8a46a58b30c 100644 --- a/dep/zlib/zconf.h +++ b/dep/zlib/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2010 Jean-loup Gailly. + * Copyright (C) 1995-2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -15,6 +15,7 @@ * this permanently in zconf.h using "./configure --zprefix". */ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET /* all linked symbols */ # define _dist_code z__dist_code @@ -27,9 +28,11 @@ # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 @@ -40,44 +43,52 @@ # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams +# define deflatePending z_deflatePending # define deflatePrime z_deflatePrime # define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep # define deflateSetDictionary z_deflateSetDictionary # define deflateSetHeader z_deflateSetHeader # define deflateTune z_deflateTune # define deflate_copyright z_deflate_copyright # define get_crc_table z_get_crc_table -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzgetc z_gzgetc -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzwrite z_gzwrite +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzwrite z_gzwrite +# endif # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd @@ -95,13 +106,18 @@ # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine +# define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table -# define uncompress z_uncompress +# ifndef Z_SOLO +# define uncompress z_uncompress +# endif # define zError z_zError -# define zcalloc z_zcalloc -# define zcfree z_zcfree +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif # define zlibCompileFlags z_zlibCompileFlags # define zlibVersion z_zlibVersion @@ -111,7 +127,9 @@ # define alloc_func z_alloc_func # define charf z_charf # define free_func z_free_func -# define gzFile z_gzFile +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif # define gz_header z_gz_header # define gz_headerp z_gz_headerp # define in_func z_in_func @@ -197,6 +215,12 @@ # endif #endif +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL @@ -243,6 +267,14 @@ # endif #endif +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have @@ -356,12 +388,45 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif +/* ./configure may #define Z_U4 here */ + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include <limits.h> +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# else +# if (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# else +# if (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +# endif +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ # define Z_HAVE_UNISTD_H #endif +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + #ifdef STDC -# include <sys/types.h> /* for off_t */ +# ifndef Z_SOLO +# include <sys/types.h> /* for off_t */ +# endif +#endif + +#ifdef _WIN32 +# include <stddef.h> /* for wchar_t */ #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and @@ -370,21 +435,38 @@ typedef uLong FAR uLongf; * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include <unistd.h> /* for SEEK_* and off_t */ -# ifdef VMS -# include <unixio.h> /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include <unixio.h> /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif # endif #endif -#ifndef SEEK_SET +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ @@ -394,18 +476,14 @@ typedef uLong FAR uLongf; # define z_off_t long #endif -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +#if !defined(_WIN32) && defined(Z_LARGE64) # define z_off64_t off64_t #else -# define z_off64_t z_off_t -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif #endif /* MVS linker does not support external names larger than 8 bytes */ diff --git a/dep/zlib/zlib.h b/dep/zlib/zlib.h index bfbba83e8ee..3edf3acdb57 100644 --- a/dep/zlib/zlib.h +++ b/dep/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.5, April 19th, 2010 + version 1.2.7, May 2nd, 2012 - Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ #ifndef ZLIB_H @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.5" -#define ZLIB_VERNUM 0x1250 +#define ZLIB_VERSION "1.2.7" +#define ZLIB_VERNUM 0x1270 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 5 +#define ZLIB_VER_REVISION 7 #define ZLIB_VER_SUBREVISION 0 /* @@ -83,15 +83,15 @@ typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ + z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ + uLong total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ + uLong total_out; /* total number of bytes output so far */ - char *msg; /* last error message, NULL if no error */ + z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ @@ -327,8 +327,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the - value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. + value returned by deflateBound (see below). Then deflate is guaranteed to + return Z_STREAM_END. If not enough output space is provided, deflate will + not return Z_STREAM_END, and it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). @@ -451,23 +452,29 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all the uncompressed data. (The size - of the uncompressed data may have been saved by the compressor for this - purpose.) The next operation on this stream must be inflateEnd to deallocate - the decompression state. The use of Z_FINISH is never required, but can be - used to inform inflate that a faster approach may be used for the single - inflate() call. + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK or Z_TREES is used. + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, + strm->adler to the Adler-32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END @@ -478,7 +485,9 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); initializing with inflateInit2(). Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and - perform their own processing of the gzip header and trailer. + perform their own processing of the gzip header and trailer. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + producted so far. The CRC-32 is checked against the gzip trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has @@ -580,10 +589,15 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any call - of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly @@ -610,8 +624,8 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, @@ -688,8 +702,28 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). -*/ + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, @@ -703,8 +737,9 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, than or equal to 16, and that many of the least significant bits of value will be inserted in the output. - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, @@ -790,10 +825,11 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is @@ -805,17 +841,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been - found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the - success case, the application may save the current current value of total_in - which indicates where valid compressed data was found. In the error case, - the application may repeatedly call inflateSync, providing more input each - time, until success or end of the input data. + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, @@ -962,7 +1002,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not be + the parameters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ @@ -1088,6 +1128,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); 27-31: 0 (reserved) */ +#ifndef Z_SOLO /* utility functions */ @@ -1149,10 +1190,11 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. */ - /* gzip file access functions */ /* @@ -1162,7 +1204,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, wrapper, documented in RFC 1952, wrapped around a deflate stream. */ -typedef voidp gzFile; /* opaque gzip file descriptor */ +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); @@ -1172,13 +1214,28 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) Also "a" - can be used instead of "w" to request that the gzip stream that will be - written be appended to the file. "+" will result in an error, since reading - and writing to the same gzip file is not supported. + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was @@ -1197,7 +1254,11 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not @@ -1235,14 +1296,26 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If - the input file was not in gzip format, gzread copies the given number of - bytes into the buffer. + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream, or failing that, reading the rest - of the input file directly without decompression. The entire input file - will be read if gzread is called until it returns less than the requested - len. + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. @@ -1256,7 +1329,7 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, error. */ -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of @@ -1301,7 +1374,10 @@ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); @@ -1397,9 +1473,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. This state can change from - false to true while reading the input file if the end of a gzip stream is - reached, but is followed by data that is not another gzip stream. + (0) if file is a gzip stream being decompressed. If the input file is empty, gzdirect() will return true, since the input does not contain a gzip stream. @@ -1408,6 +1482,13 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); cause buffers to be allocated to allow reading the file to determine if it is a gzip file. Therefore if gzbuffer() is used, it should be called before gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); @@ -1419,7 +1500,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); must not be called more than once on the same allocation. gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, or Z_OK on success. + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. */ ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); @@ -1457,6 +1539,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); file that is being written concurrently. */ +#endif /* !Z_SOLO */ /* checksum functions */ @@ -1492,16 +1575,17 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the for the crc. Pre- and post-conditioning (one's - complement) is performed within this function so it shouldn't be done by the - application. + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. Usage example: @@ -1544,17 +1628,42 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); #define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) + ZLIB_VERSION, (int)sizeof(z_stream)) + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#endif /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if @@ -1562,7 +1671,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, * functions are changed to 64 bits) -- in case these are set on systems * without large file support, _LFS64_LARGEFILE must also be true */ -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 +#ifdef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); @@ -1571,14 +1680,23 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif -#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# ifdef _LARGEFILE64_SOURCE +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); @@ -1595,6 +1713,13 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + /* hack for buggy compilers */ #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; @@ -1603,8 +1728,14 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif #ifdef __cplusplus } diff --git a/dep/zlib/zutil.c b/dep/zlib/zutil.c index 898ed345b0e..65e0d3b72b0 100644 --- a/dep/zlib/zutil.c +++ b/dep/zlib/zutil.c @@ -1,11 +1,14 @@ /* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ #include "zutil.h" +#ifndef Z_SOLO +# include "gzguts.h" +#endif #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ @@ -85,27 +88,27 @@ uLong ZEXPORT zlibCompileFlags() #ifdef FASTEST flags += 1L << 21; #endif -#ifdef STDC +#if defined(STDC) || defined(Z_HAVE_STDARG_H) # ifdef NO_vsnprintf - flags += 1L << 25; + flags += 1L << 25; # ifdef HAS_vsprintf_void - flags += 1L << 26; + flags += 1L << 26; # endif # else # ifdef HAS_vsnprintf_void - flags += 1L << 26; + flags += 1L << 26; # endif # endif #else - flags += 1L << 24; + flags += 1L << 24; # ifdef NO_snprintf - flags += 1L << 25; + flags += 1L << 25; # ifdef HAS_sprintf_void - flags += 1L << 26; + flags += 1L << 26; # endif # else # ifdef HAS_snprintf_void - flags += 1L << 26; + flags += 1L << 26; # endif # endif #endif @@ -181,6 +184,7 @@ void ZLIB_INTERNAL zmemzero(dest, len) } #endif +#ifndef Z_SOLO #ifdef SYS16BIT @@ -316,3 +320,5 @@ void ZLIB_INTERNAL zcfree (opaque, ptr) } #endif /* MY_ZCALLOC */ + +#endif /* !Z_SOLO */ diff --git a/dep/zlib/zutil.h b/dep/zlib/zutil.h index 258fa88799a..4e3dcc6ae9f 100644 --- a/dep/zlib/zutil.h +++ b/dep/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2010 Jean-loup Gailly. + * Copyright (C) 1995-2012 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -13,7 +13,7 @@ #ifndef ZUTIL_H #define ZUTIL_H -#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) +#ifdef HAVE_HIDDEN # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL @@ -21,7 +21,7 @@ #include "zlib.h" -#ifdef STDC +#if defined(STDC) && !defined(Z_SOLO) # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) # include <stddef.h> # endif @@ -29,6 +29,10 @@ # include <stdlib.h> #endif +#ifdef Z_SOLO + typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ +#endif + #ifndef local # define local static #endif @@ -78,16 +82,18 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include <alloc.h> +# ifndef Z_SOLO +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include <alloc.h> +# endif +# else /* MSC or DJGPP */ +# include <malloc.h> # endif -# else /* MSC or DJGPP */ -# include <malloc.h> # endif #endif @@ -107,18 +113,20 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #ifdef OS2 # define OS_CODE 0x06 -# ifdef M_I86 +# if defined(M_I86) && !defined(Z_SOLO) # include <malloc.h> # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include <unix.h> /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef Z_SOLO +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include <unix.h> /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif # endif # endif #endif @@ -153,14 +161,14 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(__BORLANDC__) +#if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 #pragma warn -8066 #endif /* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 +#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif @@ -177,42 +185,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* functions */ -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) +#if defined(pyr) || defined(Z_SOLO) # define NO_MEMCPY #endif #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) @@ -261,14 +234,19 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define Tracecv(c,x) #endif - -voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); -void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); +#ifndef Z_SOLO + voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); + void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); +#endif #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} +/* Reverse the bytes in a 32-bit value */ +#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + #endif /* ZUTIL_H */ |
